123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154681556815668157681586815968160681616816268163681646816568166681676816868169681706817168172681736817468175681766817768178681796818068181681826818368184681856818668187681886818968190681916819268193681946819568196681976819868199682006820168202682036820468205682066820768208682096821068211682126821368214682156821668217682186821968220682216822268223682246822568226682276822868229682306823168232682336823468235682366823768238682396824068241682426824368244682456824668247682486824968250682516825268253682546825568256682576825868259682606826168262682636826468265682666826768268682696827068271682726827368274682756827668277682786827968280682816828268283682846828568286682876828868289682906829168292682936829468295682966829768298682996830068301683026830368304683056830668307683086830968310683116831268313683146831568316683176831868319683206832168322683236832468325683266832768328683296833068331683326833368334683356833668337683386833968340683416834268343683446834568346683476834868349683506835168352683536835468355683566835768358683596836068361683626836368364683656836668367683686836968370683716837268373683746837568376683776837868379683806838168382683836838468385683866838768388683896839068391683926839368394683956839668397683986839968400684016840268403684046840568406684076840868409684106841168412684136841468415684166841768418684196842068421684226842368424684256842668427684286842968430684316843268433684346843568436684376843868439684406844168442684436844468445684466844768448684496845068451684526845368454684556845668457684586845968460684616846268463684646846568466684676846868469684706847168472684736847468475684766847768478684796848068481684826848368484684856848668487684886848968490684916849268493684946849568496684976849868499685006850168502685036850468505685066850768508685096851068511685126851368514685156851668517685186851968520685216852268523685246852568526685276852868529685306853168532685336853468535685366853768538685396854068541685426854368544685456854668547685486854968550685516855268553685546855568556685576855868559685606856168562685636856468565685666856768568685696857068571685726857368574685756857668577685786857968580685816858268583685846858568586685876858868589685906859168592685936859468595685966859768598685996860068601686026860368604686056860668607686086860968610686116861268613686146861568616686176861868619686206862168622686236862468625686266862768628686296863068631686326863368634686356863668637686386863968640686416864268643686446864568646686476864868649686506865168652686536865468655686566865768658686596866068661686626866368664686656866668667686686866968670686716867268673686746867568676686776867868679686806868168682686836868468685686866868768688686896869068691686926869368694686956869668697686986869968700687016870268703687046870568706687076870868709687106871168712687136871468715687166871768718687196872068721687226872368724687256872668727687286872968730687316873268733687346873568736687376873868739687406874168742687436874468745687466874768748687496875068751687526875368754687556875668757687586875968760687616876268763687646876568766687676876868769687706877168772687736877468775687766877768778687796878068781687826878368784687856878668787687886878968790687916879268793687946879568796687976879868799688006880168802688036880468805688066880768808688096881068811688126881368814688156881668817688186881968820688216882268823688246882568826688276882868829688306883168832688336883468835688366883768838688396884068841688426884368844688456884668847688486884968850688516885268853688546885568856688576885868859688606886168862688636886468865688666886768868688696887068871688726887368874688756887668877688786887968880688816888268883688846888568886688876888868889688906889168892688936889468895688966889768898688996890068901689026890368904689056890668907689086890968910689116891268913689146891568916689176891868919689206892168922689236892468925689266892768928689296893068931689326893368934689356893668937689386893968940689416894268943689446894568946689476894868949689506895168952689536895468955689566895768958689596896068961689626896368964689656896668967689686896968970689716897268973689746897568976689776897868979689806898168982689836898468985689866898768988689896899068991689926899368994689956899668997689986899969000690016900269003690046900569006690076900869009690106901169012690136901469015690166901769018690196902069021690226902369024690256902669027690286902969030690316903269033690346903569036690376903869039690406904169042690436904469045690466904769048690496905069051690526905369054690556905669057690586905969060690616906269063690646906569066690676906869069690706907169072690736907469075690766907769078690796908069081690826908369084690856908669087690886908969090690916909269093690946909569096690976909869099691006910169102691036910469105691066910769108691096911069111691126911369114691156911669117691186911969120691216912269123691246912569126691276912869129691306913169132691336913469135691366913769138691396914069141691426914369144691456914669147691486914969150691516915269153691546915569156691576915869159691606916169162691636916469165691666916769168691696917069171691726917369174691756917669177691786917969180691816918269183691846918569186691876918869189691906919169192691936919469195691966919769198691996920069201692026920369204692056920669207692086920969210692116921269213692146921569216692176921869219692206922169222692236922469225692266922769228692296923069231692326923369234692356923669237692386923969240692416924269243692446924569246692476924869249692506925169252692536925469255692566925769258692596926069261692626926369264692656926669267692686926969270692716927269273692746927569276692776927869279692806928169282692836928469285692866928769288692896929069291692926929369294692956929669297692986929969300693016930269303693046930569306693076930869309693106931169312693136931469315693166931769318693196932069321693226932369324693256932669327693286932969330693316933269333693346933569336693376933869339693406934169342693436934469345693466934769348693496935069351693526935369354693556935669357693586935969360693616936269363693646936569366693676936869369693706937169372693736937469375693766937769378693796938069381693826938369384693856938669387693886938969390693916939269393693946939569396693976939869399694006940169402694036940469405694066940769408694096941069411694126941369414694156941669417694186941969420694216942269423694246942569426694276942869429694306943169432694336943469435694366943769438694396944069441694426944369444694456944669447694486944969450694516945269453694546945569456694576945869459694606946169462694636946469465694666946769468694696947069471694726947369474694756947669477694786947969480694816948269483694846948569486694876948869489694906949169492694936949469495694966949769498694996950069501695026950369504695056950669507695086950969510695116951269513695146951569516695176951869519695206952169522695236952469525695266952769528695296953069531695326953369534695356953669537695386953969540695416954269543695446954569546695476954869549695506955169552695536955469555695566955769558695596956069561695626956369564695656956669567695686956969570695716957269573695746957569576695776957869579695806958169582695836958469585695866958769588695896959069591695926959369594695956959669597695986959969600696016960269603696046960569606696076960869609696106961169612696136961469615696166961769618696196962069621696226962369624696256962669627696286962969630696316963269633696346963569636696376963869639696406964169642696436964469645696466964769648696496965069651696526965369654696556965669657696586965969660696616966269663696646966569666696676966869669696706967169672696736967469675696766967769678696796968069681696826968369684696856968669687696886968969690696916969269693696946969569696696976969869699697006970169702697036970469705697066970769708697096971069711697126971369714697156971669717697186971969720697216972269723697246972569726697276972869729697306973169732697336973469735697366973769738697396974069741697426974369744697456974669747697486974969750697516975269753697546975569756697576975869759697606976169762697636976469765697666976769768697696977069771697726977369774697756977669777697786977969780697816978269783697846978569786697876978869789697906979169792697936979469795697966979769798697996980069801698026980369804698056980669807698086980969810698116981269813698146981569816698176981869819698206982169822698236982469825698266982769828698296983069831698326983369834698356983669837698386983969840698416984269843698446984569846698476984869849698506985169852698536985469855698566985769858698596986069861698626986369864698656986669867698686986969870698716987269873698746987569876698776987869879698806988169882698836988469885698866988769888698896989069891698926989369894698956989669897698986989969900699016990269903699046990569906699076990869909699106991169912699136991469915699166991769918699196992069921699226992369924699256992669927699286992969930699316993269933699346993569936699376993869939699406994169942699436994469945699466994769948699496995069951699526995369954699556995669957699586995969960699616996269963699646996569966699676996869969699706997169972699736997469975699766997769978699796998069981699826998369984699856998669987699886998969990699916999269993699946999569996699976999869999700007000170002700037000470005700067000770008700097001070011700127001370014700157001670017700187001970020700217002270023700247002570026700277002870029700307003170032700337003470035700367003770038700397004070041700427004370044700457004670047700487004970050700517005270053700547005570056700577005870059700607006170062700637006470065700667006770068700697007070071700727007370074700757007670077700787007970080700817008270083700847008570086700877008870089700907009170092700937009470095700967009770098700997010070101701027010370104701057010670107701087010970110701117011270113701147011570116701177011870119701207012170122701237012470125701267012770128701297013070131701327013370134701357013670137701387013970140701417014270143701447014570146701477014870149701507015170152701537015470155701567015770158701597016070161701627016370164701657016670167701687016970170701717017270173701747017570176701777017870179701807018170182701837018470185701867018770188701897019070191701927019370194701957019670197701987019970200702017020270203702047020570206702077020870209702107021170212702137021470215702167021770218702197022070221702227022370224702257022670227702287022970230702317023270233702347023570236702377023870239702407024170242702437024470245702467024770248702497025070251702527025370254702557025670257702587025970260702617026270263702647026570266702677026870269702707027170272702737027470275702767027770278702797028070281702827028370284702857028670287702887028970290702917029270293702947029570296702977029870299703007030170302703037030470305703067030770308703097031070311703127031370314703157031670317703187031970320703217032270323703247032570326703277032870329703307033170332703337033470335703367033770338703397034070341703427034370344703457034670347703487034970350703517035270353703547035570356703577035870359703607036170362703637036470365703667036770368703697037070371703727037370374703757037670377703787037970380703817038270383703847038570386703877038870389703907039170392703937039470395703967039770398703997040070401704027040370404704057040670407704087040970410704117041270413704147041570416704177041870419704207042170422704237042470425704267042770428704297043070431704327043370434704357043670437704387043970440704417044270443704447044570446704477044870449704507045170452704537045470455704567045770458704597046070461704627046370464704657046670467704687046970470704717047270473704747047570476704777047870479704807048170482704837048470485704867048770488704897049070491704927049370494704957049670497704987049970500705017050270503705047050570506705077050870509705107051170512705137051470515705167051770518705197052070521705227052370524705257052670527705287052970530705317053270533705347053570536705377053870539705407054170542705437054470545705467054770548705497055070551705527055370554705557055670557705587055970560705617056270563705647056570566705677056870569705707057170572705737057470575705767057770578705797058070581705827058370584705857058670587705887058970590705917059270593705947059570596705977059870599706007060170602706037060470605706067060770608706097061070611706127061370614706157061670617706187061970620706217062270623706247062570626706277062870629706307063170632706337063470635706367063770638706397064070641706427064370644706457064670647706487064970650706517065270653706547065570656706577065870659706607066170662706637066470665706667066770668706697067070671706727067370674706757067670677706787067970680706817068270683706847068570686706877068870689706907069170692706937069470695706967069770698706997070070701707027070370704707057070670707707087070970710707117071270713707147071570716707177071870719707207072170722707237072470725707267072770728707297073070731707327073370734707357073670737707387073970740707417074270743707447074570746707477074870749707507075170752707537075470755707567075770758707597076070761707627076370764707657076670767707687076970770707717077270773707747077570776707777077870779707807078170782707837078470785707867078770788707897079070791707927079370794707957079670797707987079970800708017080270803708047080570806708077080870809708107081170812708137081470815708167081770818708197082070821708227082370824708257082670827708287082970830708317083270833708347083570836708377083870839708407084170842708437084470845708467084770848708497085070851708527085370854708557085670857708587085970860708617086270863708647086570866708677086870869708707087170872708737087470875708767087770878708797088070881708827088370884708857088670887708887088970890708917089270893708947089570896708977089870899709007090170902709037090470905709067090770908709097091070911709127091370914709157091670917709187091970920709217092270923709247092570926709277092870929709307093170932709337093470935709367093770938709397094070941709427094370944709457094670947709487094970950709517095270953709547095570956709577095870959709607096170962709637096470965709667096770968709697097070971709727097370974709757097670977709787097970980709817098270983709847098570986709877098870989709907099170992709937099470995709967099770998709997100071001710027100371004710057100671007710087100971010710117101271013710147101571016710177101871019710207102171022710237102471025710267102771028710297103071031710327103371034710357103671037710387103971040710417104271043710447104571046710477104871049710507105171052710537105471055710567105771058710597106071061710627106371064710657106671067710687106971070710717107271073710747107571076710777107871079710807108171082710837108471085710867108771088710897109071091710927109371094710957109671097710987109971100711017110271103711047110571106711077110871109711107111171112711137111471115711167111771118711197112071121711227112371124711257112671127711287112971130711317113271133711347113571136711377113871139711407114171142711437114471145711467114771148711497115071151711527115371154711557115671157711587115971160711617116271163711647116571166711677116871169711707117171172711737117471175711767117771178711797118071181711827118371184711857118671187711887118971190711917119271193711947119571196711977119871199712007120171202712037120471205712067120771208712097121071211712127121371214712157121671217712187121971220712217122271223712247122571226712277122871229712307123171232712337123471235712367123771238712397124071241712427124371244712457124671247712487124971250712517125271253712547125571256712577125871259712607126171262712637126471265712667126771268712697127071271712727127371274712757127671277712787127971280712817128271283712847128571286712877128871289712907129171292712937129471295712967129771298712997130071301713027130371304713057130671307713087130971310713117131271313713147131571316713177131871319713207132171322713237132471325713267132771328713297133071331713327133371334713357133671337713387133971340713417134271343713447134571346713477134871349713507135171352713537135471355713567135771358713597136071361713627136371364713657136671367713687136971370713717137271373713747137571376713777137871379713807138171382713837138471385713867138771388713897139071391713927139371394713957139671397713987139971400714017140271403714047140571406714077140871409714107141171412714137141471415714167141771418714197142071421714227142371424714257142671427714287142971430714317143271433714347143571436714377143871439714407144171442714437144471445714467144771448714497145071451714527145371454714557145671457714587145971460714617146271463714647146571466714677146871469714707147171472714737147471475714767147771478714797148071481714827148371484714857148671487714887148971490714917149271493714947149571496714977149871499715007150171502715037150471505715067150771508715097151071511715127151371514715157151671517715187151971520715217152271523715247152571526715277152871529715307153171532715337153471535715367153771538715397154071541715427154371544715457154671547715487154971550715517155271553715547155571556715577155871559715607156171562715637156471565715667156771568715697157071571715727157371574715757157671577715787157971580715817158271583715847158571586715877158871589715907159171592715937159471595715967159771598715997160071601716027160371604716057160671607716087160971610716117161271613716147161571616716177161871619716207162171622716237162471625716267162771628716297163071631716327163371634716357163671637716387163971640716417164271643716447164571646716477164871649716507165171652716537165471655716567165771658716597166071661716627166371664716657166671667716687166971670716717167271673716747167571676716777167871679716807168171682716837168471685716867168771688716897169071691716927169371694716957169671697716987169971700717017170271703717047170571706717077170871709717107171171712717137171471715717167171771718717197172071721717227172371724717257172671727717287172971730717317173271733717347173571736717377173871739717407174171742717437174471745717467174771748717497175071751717527175371754717557175671757717587175971760717617176271763717647176571766717677176871769717707177171772717737177471775717767177771778717797178071781717827178371784717857178671787717887178971790717917179271793717947179571796717977179871799718007180171802718037180471805718067180771808718097181071811718127181371814718157181671817718187181971820718217182271823718247182571826718277182871829718307183171832718337183471835718367183771838718397184071841718427184371844718457184671847718487184971850718517185271853718547185571856718577185871859718607186171862718637186471865718667186771868718697187071871718727187371874718757187671877718787187971880718817188271883718847188571886718877188871889718907189171892718937189471895718967189771898718997190071901719027190371904719057190671907719087190971910719117191271913719147191571916719177191871919719207192171922719237192471925719267192771928719297193071931719327193371934719357193671937719387193971940719417194271943719447194571946719477194871949719507195171952719537195471955719567195771958719597196071961719627196371964719657196671967719687196971970719717197271973719747197571976719777197871979719807198171982719837198471985719867198771988719897199071991719927199371994719957199671997719987199972000720017200272003720047200572006720077200872009720107201172012720137201472015720167201772018720197202072021720227202372024720257202672027720287202972030720317203272033720347203572036720377203872039720407204172042720437204472045720467204772048720497205072051720527205372054720557205672057720587205972060720617206272063720647206572066720677206872069720707207172072720737207472075720767207772078720797208072081720827208372084720857208672087720887208972090720917209272093720947209572096720977209872099721007210172102721037210472105721067210772108721097211072111721127211372114721157211672117721187211972120721217212272123721247212572126721277212872129721307213172132721337213472135721367213772138721397214072141721427214372144721457214672147721487214972150721517215272153721547215572156721577215872159721607216172162721637216472165721667216772168721697217072171721727217372174721757217672177721787217972180721817218272183721847218572186721877218872189721907219172192721937219472195721967219772198721997220072201722027220372204722057220672207722087220972210722117221272213722147221572216722177221872219722207222172222722237222472225722267222772228722297223072231722327223372234722357223672237722387223972240722417224272243722447224572246722477224872249722507225172252722537225472255722567225772258722597226072261722627226372264722657226672267722687226972270722717227272273722747227572276722777227872279722807228172282722837228472285722867228772288722897229072291722927229372294722957229672297722987229972300723017230272303723047230572306723077230872309723107231172312723137231472315723167231772318723197232072321723227232372324723257232672327723287232972330723317233272333723347233572336723377233872339723407234172342723437234472345723467234772348723497235072351723527235372354723557235672357723587235972360723617236272363723647236572366723677236872369723707237172372723737237472375723767237772378723797238072381723827238372384723857238672387723887238972390723917239272393723947239572396723977239872399724007240172402724037240472405724067240772408724097241072411724127241372414724157241672417724187241972420724217242272423724247242572426724277242872429724307243172432724337243472435724367243772438724397244072441724427244372444724457244672447724487244972450724517245272453724547245572456724577245872459724607246172462724637246472465724667246772468724697247072471724727247372474724757247672477724787247972480724817248272483724847248572486724877248872489724907249172492724937249472495724967249772498724997250072501725027250372504725057250672507725087250972510725117251272513725147251572516725177251872519725207252172522725237252472525725267252772528725297253072531725327253372534725357253672537725387253972540725417254272543725447254572546725477254872549725507255172552725537255472555725567255772558725597256072561725627256372564725657256672567725687256972570725717257272573725747257572576725777257872579725807258172582725837258472585725867258772588725897259072591725927259372594725957259672597725987259972600726017260272603726047260572606726077260872609726107261172612726137261472615726167261772618726197262072621726227262372624726257262672627726287262972630726317263272633726347263572636726377263872639726407264172642726437264472645726467264772648726497265072651726527265372654726557265672657726587265972660726617266272663726647266572666726677266872669726707267172672726737267472675726767267772678726797268072681726827268372684726857268672687726887268972690726917269272693726947269572696726977269872699727007270172702727037270472705727067270772708727097271072711727127271372714727157271672717727187271972720727217272272723727247272572726727277272872729727307273172732727337273472735727367273772738727397274072741727427274372744727457274672747727487274972750727517275272753727547275572756727577275872759727607276172762727637276472765727667276772768727697277072771727727277372774727757277672777727787277972780727817278272783727847278572786727877278872789727907279172792727937279472795727967279772798727997280072801728027280372804728057280672807728087280972810728117281272813728147281572816728177281872819728207282172822728237282472825728267282772828728297283072831728327283372834728357283672837728387283972840728417284272843728447284572846728477284872849728507285172852728537285472855728567285772858728597286072861728627286372864728657286672867728687286972870728717287272873728747287572876728777287872879728807288172882728837288472885728867288772888728897289072891728927289372894728957289672897728987289972900729017290272903729047290572906729077290872909729107291172912729137291472915729167291772918729197292072921729227292372924729257292672927729287292972930729317293272933729347293572936729377293872939729407294172942729437294472945729467294772948729497295072951729527295372954729557295672957729587295972960729617296272963729647296572966729677296872969729707297172972729737297472975729767297772978729797298072981729827298372984729857298672987729887298972990729917299272993729947299572996729977299872999730007300173002730037300473005730067300773008730097301073011730127301373014730157301673017730187301973020730217302273023730247302573026730277302873029730307303173032730337303473035730367303773038730397304073041730427304373044730457304673047730487304973050730517305273053730547305573056730577305873059730607306173062730637306473065730667306773068730697307073071730727307373074730757307673077730787307973080730817308273083730847308573086730877308873089730907309173092730937309473095730967309773098730997310073101731027310373104731057310673107731087310973110731117311273113731147311573116731177311873119731207312173122731237312473125731267312773128731297313073131731327313373134731357313673137731387313973140731417314273143731447314573146731477314873149731507315173152731537315473155731567315773158731597316073161731627316373164731657316673167731687316973170731717317273173731747317573176731777317873179731807318173182731837318473185731867318773188731897319073191731927319373194731957319673197731987319973200732017320273203732047320573206732077320873209732107321173212732137321473215732167321773218732197322073221732227322373224732257322673227732287322973230732317323273233732347323573236732377323873239732407324173242732437324473245732467324773248732497325073251732527325373254732557325673257732587325973260732617326273263732647326573266732677326873269732707327173272732737327473275732767327773278732797328073281732827328373284732857328673287732887328973290732917329273293732947329573296732977329873299733007330173302733037330473305733067330773308733097331073311733127331373314733157331673317733187331973320733217332273323733247332573326733277332873329733307333173332733337333473335733367333773338733397334073341733427334373344733457334673347733487334973350733517335273353733547335573356733577335873359733607336173362733637336473365733667336773368733697337073371733727337373374733757337673377733787337973380733817338273383733847338573386733877338873389733907339173392733937339473395733967339773398733997340073401734027340373404734057340673407734087340973410734117341273413734147341573416734177341873419734207342173422734237342473425734267342773428734297343073431734327343373434734357343673437734387343973440734417344273443734447344573446734477344873449734507345173452734537345473455734567345773458734597346073461734627346373464734657346673467734687346973470734717347273473734747347573476734777347873479734807348173482734837348473485734867348773488734897349073491734927349373494734957349673497734987349973500735017350273503735047350573506735077350873509735107351173512735137351473515735167351773518735197352073521735227352373524735257352673527735287352973530735317353273533735347353573536735377353873539735407354173542735437354473545735467354773548735497355073551735527355373554735557355673557735587355973560735617356273563735647356573566735677356873569735707357173572735737357473575735767357773578735797358073581735827358373584735857358673587735887358973590735917359273593735947359573596735977359873599736007360173602736037360473605736067360773608736097361073611736127361373614736157361673617736187361973620736217362273623736247362573626736277362873629736307363173632736337363473635736367363773638736397364073641736427364373644736457364673647736487364973650736517365273653736547365573656736577365873659736607366173662736637366473665736667366773668736697367073671736727367373674736757367673677736787367973680736817368273683736847368573686736877368873689736907369173692736937369473695736967369773698736997370073701737027370373704737057370673707737087370973710737117371273713737147371573716737177371873719737207372173722737237372473725737267372773728737297373073731737327373373734737357373673737737387373973740737417374273743737447374573746737477374873749737507375173752737537375473755737567375773758737597376073761737627376373764737657376673767737687376973770737717377273773737747377573776737777377873779737807378173782737837378473785737867378773788737897379073791737927379373794737957379673797737987379973800738017380273803738047380573806738077380873809738107381173812738137381473815738167381773818738197382073821738227382373824738257382673827738287382973830738317383273833738347383573836738377383873839738407384173842738437384473845738467384773848738497385073851738527385373854738557385673857738587385973860738617386273863738647386573866738677386873869738707387173872738737387473875738767387773878738797388073881738827388373884738857388673887738887388973890738917389273893738947389573896738977389873899739007390173902739037390473905739067390773908739097391073911739127391373914739157391673917739187391973920739217392273923739247392573926739277392873929739307393173932739337393473935739367393773938739397394073941739427394373944739457394673947739487394973950739517395273953739547395573956739577395873959739607396173962739637396473965739667396773968739697397073971739727397373974739757397673977739787397973980739817398273983739847398573986739877398873989739907399173992739937399473995739967399773998739997400074001740027400374004740057400674007740087400974010740117401274013740147401574016740177401874019740207402174022740237402474025740267402774028740297403074031740327403374034740357403674037740387403974040740417404274043740447404574046740477404874049740507405174052740537405474055740567405774058740597406074061740627406374064740657406674067740687406974070740717407274073740747407574076740777407874079740807408174082740837408474085740867408774088740897409074091740927409374094740957409674097740987409974100741017410274103741047410574106741077410874109741107411174112741137411474115741167411774118741197412074121741227412374124741257412674127741287412974130741317413274133741347413574136741377413874139741407414174142741437414474145741467414774148741497415074151741527415374154741557415674157741587415974160741617416274163741647416574166741677416874169741707417174172741737417474175741767417774178741797418074181741827418374184741857418674187741887418974190741917419274193741947419574196741977419874199742007420174202742037420474205742067420774208742097421074211742127421374214742157421674217742187421974220742217422274223742247422574226742277422874229742307423174232742337423474235742367423774238742397424074241742427424374244742457424674247742487424974250742517425274253742547425574256742577425874259742607426174262742637426474265742667426774268742697427074271742727427374274742757427674277742787427974280742817428274283742847428574286742877428874289742907429174292742937429474295742967429774298742997430074301743027430374304743057430674307743087430974310743117431274313743147431574316743177431874319743207432174322743237432474325743267432774328743297433074331743327433374334743357433674337743387433974340743417434274343743447434574346743477434874349743507435174352743537435474355743567435774358743597436074361743627436374364743657436674367743687436974370743717437274373743747437574376743777437874379743807438174382743837438474385743867438774388743897439074391743927439374394743957439674397743987439974400744017440274403744047440574406744077440874409744107441174412744137441474415744167441774418744197442074421744227442374424744257442674427744287442974430744317443274433744347443574436744377443874439744407444174442744437444474445744467444774448744497445074451744527445374454744557445674457744587445974460744617446274463744647446574466744677446874469744707447174472744737447474475744767447774478744797448074481744827448374484744857448674487744887448974490744917449274493744947449574496744977449874499745007450174502745037450474505745067450774508745097451074511745127451374514745157451674517745187451974520745217452274523745247452574526745277452874529745307453174532745337453474535745367453774538745397454074541745427454374544745457454674547745487454974550745517455274553745547455574556745577455874559745607456174562745637456474565745667456774568745697457074571745727457374574745757457674577745787457974580745817458274583745847458574586745877458874589745907459174592745937459474595745967459774598745997460074601746027460374604746057460674607746087460974610746117461274613746147461574616746177461874619746207462174622746237462474625746267462774628746297463074631746327463374634746357463674637746387463974640746417464274643746447464574646746477464874649746507465174652746537465474655746567465774658746597466074661746627466374664746657466674667746687466974670746717467274673746747467574676746777467874679746807468174682746837468474685746867468774688746897469074691746927469374694746957469674697746987469974700747017470274703747047470574706747077470874709747107471174712747137471474715747167471774718747197472074721747227472374724747257472674727747287472974730747317473274733747347473574736747377473874739747407474174742747437474474745747467474774748747497475074751747527475374754747557475674757747587475974760747617476274763747647476574766747677476874769747707477174772747737477474775747767477774778747797478074781747827478374784747857478674787747887478974790747917479274793747947479574796747977479874799748007480174802748037480474805748067480774808748097481074811748127481374814748157481674817748187481974820748217482274823748247482574826748277482874829748307483174832748337483474835748367483774838748397484074841748427484374844748457484674847748487484974850748517485274853748547485574856748577485874859748607486174862748637486474865748667486774868748697487074871748727487374874748757487674877748787487974880748817488274883748847488574886748877488874889748907489174892748937489474895748967489774898748997490074901749027490374904749057490674907749087490974910749117491274913749147491574916749177491874919749207492174922749237492474925749267492774928749297493074931749327493374934749357493674937749387493974940749417494274943749447494574946749477494874949749507495174952749537495474955749567495774958749597496074961749627496374964749657496674967749687496974970749717497274973749747497574976749777497874979749807498174982749837498474985749867498774988749897499074991749927499374994749957499674997749987499975000750017500275003750047500575006750077500875009750107501175012750137501475015750167501775018750197502075021750227502375024750257502675027750287502975030750317503275033750347503575036750377503875039750407504175042750437504475045750467504775048750497505075051750527505375054750557505675057750587505975060750617506275063750647506575066750677506875069750707507175072750737507475075750767507775078750797508075081750827508375084750857508675087750887508975090750917509275093750947509575096750977509875099751007510175102751037510475105751067510775108751097511075111751127511375114751157511675117751187511975120751217512275123751247512575126751277512875129751307513175132751337513475135751367513775138751397514075141751427514375144751457514675147751487514975150751517515275153751547515575156751577515875159751607516175162751637516475165751667516775168751697517075171751727517375174751757517675177751787517975180751817518275183751847518575186751877518875189751907519175192751937519475195751967519775198751997520075201752027520375204752057520675207752087520975210752117521275213752147521575216752177521875219752207522175222752237522475225752267522775228752297523075231752327523375234752357523675237752387523975240752417524275243752447524575246752477524875249752507525175252752537525475255752567525775258752597526075261752627526375264752657526675267752687526975270752717527275273752747527575276752777527875279752807528175282752837528475285752867528775288752897529075291752927529375294752957529675297752987529975300753017530275303753047530575306753077530875309753107531175312753137531475315753167531775318753197532075321753227532375324753257532675327753287532975330753317533275333753347533575336753377533875339753407534175342753437534475345753467534775348753497535075351753527535375354753557535675357753587535975360753617536275363753647536575366753677536875369753707537175372753737537475375753767537775378753797538075381753827538375384753857538675387753887538975390753917539275393753947539575396753977539875399754007540175402754037540475405754067540775408754097541075411754127541375414754157541675417754187541975420754217542275423754247542575426754277542875429754307543175432754337543475435754367543775438754397544075441754427544375444754457544675447754487544975450754517545275453754547545575456754577545875459754607546175462754637546475465754667546775468754697547075471754727547375474754757547675477754787547975480754817548275483754847548575486754877548875489754907549175492754937549475495754967549775498754997550075501755027550375504755057550675507755087550975510755117551275513755147551575516755177551875519755207552175522755237552475525755267552775528755297553075531755327553375534755357553675537755387553975540755417554275543755447554575546755477554875549755507555175552755537555475555755567555775558755597556075561755627556375564755657556675567755687556975570755717557275573755747557575576755777557875579755807558175582755837558475585755867558775588755897559075591755927559375594755957559675597755987559975600756017560275603756047560575606756077560875609756107561175612756137561475615756167561775618756197562075621756227562375624756257562675627756287562975630756317563275633756347563575636756377563875639756407564175642756437564475645756467564775648756497565075651756527565375654756557565675657756587565975660756617566275663756647566575666756677566875669756707567175672756737567475675756767567775678756797568075681756827568375684756857568675687756887568975690756917569275693756947569575696756977569875699757007570175702757037570475705757067570775708757097571075711757127571375714757157571675717757187571975720757217572275723757247572575726757277572875729757307573175732757337573475735757367573775738757397574075741757427574375744757457574675747757487574975750757517575275753757547575575756757577575875759757607576175762757637576475765757667576775768757697577075771757727577375774757757577675777757787577975780757817578275783757847578575786757877578875789757907579175792757937579475795757967579775798757997580075801758027580375804758057580675807758087580975810758117581275813758147581575816758177581875819758207582175822758237582475825758267582775828758297583075831758327583375834758357583675837758387583975840758417584275843758447584575846758477584875849758507585175852758537585475855758567585775858758597586075861758627586375864758657586675867758687586975870758717587275873758747587575876758777587875879758807588175882758837588475885758867588775888758897589075891758927589375894758957589675897758987589975900759017590275903759047590575906759077590875909759107591175912759137591475915759167591775918759197592075921759227592375924759257592675927759287592975930759317593275933759347593575936759377593875939759407594175942759437594475945759467594775948759497595075951759527595375954759557595675957759587595975960759617596275963759647596575966759677596875969759707597175972759737597475975759767597775978759797598075981759827598375984759857598675987759887598975990759917599275993759947599575996759977599875999760007600176002760037600476005760067600776008760097601076011760127601376014760157601676017760187601976020760217602276023760247602576026760277602876029760307603176032760337603476035760367603776038760397604076041760427604376044760457604676047760487604976050760517605276053760547605576056760577605876059760607606176062760637606476065760667606776068760697607076071760727607376074760757607676077760787607976080760817608276083760847608576086760877608876089760907609176092760937609476095760967609776098760997610076101761027610376104761057610676107761087610976110761117611276113761147611576116761177611876119761207612176122761237612476125761267612776128761297613076131761327613376134761357613676137761387613976140761417614276143761447614576146761477614876149761507615176152761537615476155761567615776158761597616076161761627616376164761657616676167761687616976170761717617276173761747617576176761777617876179761807618176182761837618476185761867618776188761897619076191761927619376194761957619676197761987619976200762017620276203762047620576206762077620876209762107621176212762137621476215762167621776218762197622076221762227622376224762257622676227762287622976230762317623276233762347623576236762377623876239762407624176242762437624476245762467624776248762497625076251762527625376254762557625676257762587625976260762617626276263762647626576266762677626876269762707627176272762737627476275762767627776278762797628076281762827628376284762857628676287762887628976290762917629276293762947629576296762977629876299763007630176302763037630476305763067630776308763097631076311763127631376314763157631676317763187631976320763217632276323763247632576326763277632876329763307633176332763337633476335763367633776338763397634076341763427634376344763457634676347763487634976350763517635276353763547635576356763577635876359763607636176362763637636476365763667636776368763697637076371763727637376374763757637676377763787637976380763817638276383763847638576386763877638876389763907639176392763937639476395763967639776398763997640076401764027640376404764057640676407764087640976410764117641276413764147641576416764177641876419764207642176422764237642476425764267642776428764297643076431764327643376434764357643676437764387643976440764417644276443764447644576446764477644876449764507645176452764537645476455764567645776458764597646076461764627646376464764657646676467764687646976470764717647276473764747647576476764777647876479764807648176482764837648476485764867648776488764897649076491764927649376494764957649676497764987649976500765017650276503765047650576506765077650876509765107651176512765137651476515765167651776518765197652076521765227652376524765257652676527765287652976530765317653276533765347653576536765377653876539765407654176542765437654476545765467654776548765497655076551765527655376554765557655676557765587655976560765617656276563765647656576566765677656876569765707657176572765737657476575765767657776578765797658076581765827658376584765857658676587765887658976590765917659276593765947659576596765977659876599766007660176602766037660476605766067660776608766097661076611766127661376614766157661676617766187661976620766217662276623766247662576626766277662876629766307663176632766337663476635766367663776638766397664076641766427664376644766457664676647766487664976650766517665276653766547665576656766577665876659766607666176662766637666476665766667666776668766697667076671766727667376674766757667676677766787667976680766817668276683766847668576686766877668876689766907669176692766937669476695766967669776698766997670076701767027670376704767057670676707767087670976710767117671276713767147671576716767177671876719767207672176722767237672476725767267672776728767297673076731767327673376734767357673676737767387673976740767417674276743767447674576746767477674876749767507675176752767537675476755767567675776758767597676076761767627676376764767657676676767767687676976770767717677276773767747677576776767777677876779767807678176782767837678476785767867678776788767897679076791767927679376794767957679676797767987679976800768017680276803768047680576806768077680876809768107681176812768137681476815768167681776818768197682076821768227682376824768257682676827768287682976830768317683276833768347683576836768377683876839768407684176842768437684476845768467684776848768497685076851768527685376854768557685676857768587685976860768617686276863768647686576866768677686876869768707687176872768737687476875768767687776878768797688076881768827688376884768857688676887768887688976890768917689276893768947689576896768977689876899769007690176902769037690476905769067690776908769097691076911769127691376914769157691676917769187691976920769217692276923769247692576926769277692876929769307693176932769337693476935769367693776938769397694076941769427694376944769457694676947769487694976950769517695276953769547695576956769577695876959769607696176962769637696476965769667696776968769697697076971769727697376974769757697676977769787697976980769817698276983769847698576986769877698876989769907699176992769937699476995769967699776998769997700077001770027700377004770057700677007770087700977010770117701277013770147701577016770177701877019770207702177022770237702477025770267702777028770297703077031770327703377034770357703677037770387703977040770417704277043770447704577046770477704877049770507705177052770537705477055770567705777058770597706077061770627706377064770657706677067770687706977070770717707277073770747707577076770777707877079770807708177082770837708477085770867708777088770897709077091770927709377094770957709677097770987709977100771017710277103771047710577106771077710877109771107711177112771137711477115771167711777118771197712077121771227712377124771257712677127771287712977130771317713277133771347713577136771377713877139771407714177142771437714477145771467714777148771497715077151771527715377154771557715677157771587715977160771617716277163771647716577166771677716877169771707717177172771737717477175771767717777178771797718077181771827718377184771857718677187771887718977190771917719277193771947719577196771977719877199772007720177202772037720477205772067720777208772097721077211772127721377214772157721677217772187721977220772217722277223772247722577226772277722877229772307723177232772337723477235772367723777238772397724077241772427724377244772457724677247772487724977250772517725277253772547725577256772577725877259772607726177262772637726477265772667726777268772697727077271772727727377274772757727677277772787727977280772817728277283772847728577286772877728877289772907729177292772937729477295772967729777298772997730077301773027730377304773057730677307773087730977310773117731277313773147731577316773177731877319773207732177322773237732477325773267732777328773297733077331773327733377334773357733677337773387733977340773417734277343773447734577346773477734877349773507735177352773537735477355773567735777358773597736077361773627736377364773657736677367773687736977370773717737277373773747737577376773777737877379773807738177382773837738477385773867738777388773897739077391773927739377394773957739677397773987739977400774017740277403774047740577406774077740877409774107741177412774137741477415774167741777418774197742077421774227742377424774257742677427774287742977430774317743277433774347743577436774377743877439774407744177442774437744477445774467744777448774497745077451774527745377454774557745677457774587745977460774617746277463774647746577466774677746877469774707747177472774737747477475774767747777478774797748077481774827748377484774857748677487774887748977490774917749277493774947749577496774977749877499775007750177502775037750477505775067750777508775097751077511775127751377514775157751677517775187751977520775217752277523775247752577526775277752877529775307753177532775337753477535775367753777538775397754077541775427754377544775457754677547775487754977550775517755277553775547755577556775577755877559775607756177562775637756477565775667756777568775697757077571775727757377574775757757677577775787757977580775817758277583775847758577586775877758877589775907759177592775937759477595775967759777598775997760077601776027760377604776057760677607776087760977610776117761277613776147761577616776177761877619776207762177622776237762477625776267762777628776297763077631776327763377634776357763677637776387763977640776417764277643776447764577646776477764877649776507765177652776537765477655776567765777658776597766077661776627766377664776657766677667776687766977670776717767277673776747767577676776777767877679776807768177682776837768477685776867768777688776897769077691776927769377694776957769677697776987769977700777017770277703777047770577706777077770877709777107771177712777137771477715777167771777718777197772077721777227772377724777257772677727777287772977730777317773277733777347773577736777377773877739777407774177742777437774477745777467774777748777497775077751777527775377754777557775677757777587775977760777617776277763777647776577766777677776877769777707777177772777737777477775777767777777778777797778077781777827778377784777857778677787777887778977790777917779277793777947779577796777977779877799778007780177802778037780477805778067780777808778097781077811778127781377814778157781677817778187781977820778217782277823778247782577826778277782877829778307783177832778337783477835778367783777838778397784077841778427784377844778457784677847778487784977850778517785277853778547785577856778577785877859778607786177862778637786477865778667786777868778697787077871778727787377874778757787677877778787787977880778817788277883778847788577886778877788877889778907789177892778937789477895778967789777898778997790077901779027790377904779057790677907779087790977910779117791277913779147791577916779177791877919779207792177922779237792477925779267792777928779297793077931779327793377934779357793677937779387793977940779417794277943779447794577946779477794877949779507795177952779537795477955779567795777958779597796077961779627796377964779657796677967779687796977970779717797277973779747797577976779777797877979779807798177982779837798477985779867798777988779897799077991779927799377994779957799677997779987799978000780017800278003780047800578006780077800878009780107801178012780137801478015780167801778018780197802078021780227802378024780257802678027780287802978030780317803278033780347803578036780377803878039780407804178042780437804478045780467804778048780497805078051780527805378054780557805678057780587805978060780617806278063780647806578066780677806878069780707807178072780737807478075780767807778078780797808078081780827808378084780857808678087780887808978090780917809278093780947809578096780977809878099781007810178102781037810478105781067810778108781097811078111781127811378114781157811678117781187811978120781217812278123781247812578126781277812878129781307813178132781337813478135781367813778138781397814078141781427814378144781457814678147781487814978150781517815278153781547815578156781577815878159781607816178162781637816478165781667816778168781697817078171781727817378174781757817678177781787817978180781817818278183781847818578186781877818878189781907819178192781937819478195781967819778198781997820078201782027820378204782057820678207782087820978210782117821278213782147821578216782177821878219782207822178222782237822478225782267822778228782297823078231782327823378234782357823678237782387823978240782417824278243782447824578246782477824878249782507825178252782537825478255782567825778258782597826078261782627826378264782657826678267782687826978270782717827278273782747827578276782777827878279782807828178282782837828478285782867828778288782897829078291782927829378294782957829678297782987829978300783017830278303783047830578306783077830878309783107831178312783137831478315783167831778318783197832078321783227832378324783257832678327783287832978330783317833278333783347833578336783377833878339783407834178342783437834478345783467834778348783497835078351783527835378354783557835678357783587835978360783617836278363783647836578366783677836878369783707837178372783737837478375783767837778378783797838078381783827838378384783857838678387783887838978390783917839278393783947839578396783977839878399784007840178402784037840478405784067840778408784097841078411784127841378414784157841678417784187841978420784217842278423784247842578426784277842878429784307843178432784337843478435784367843778438784397844078441784427844378444784457844678447784487844978450784517845278453784547845578456784577845878459784607846178462784637846478465784667846778468784697847078471784727847378474784757847678477784787847978480784817848278483784847848578486784877848878489784907849178492784937849478495784967849778498784997850078501785027850378504785057850678507785087850978510785117851278513785147851578516785177851878519785207852178522785237852478525785267852778528785297853078531785327853378534785357853678537785387853978540785417854278543785447854578546785477854878549785507855178552785537855478555785567855778558785597856078561785627856378564785657856678567785687856978570785717857278573785747857578576785777857878579785807858178582785837858478585785867858778588785897859078591785927859378594785957859678597785987859978600786017860278603786047860578606786077860878609786107861178612786137861478615786167861778618786197862078621786227862378624786257862678627786287862978630786317863278633786347863578636786377863878639786407864178642786437864478645786467864778648786497865078651786527865378654786557865678657786587865978660786617866278663786647866578666786677866878669786707867178672786737867478675786767867778678786797868078681786827868378684786857868678687786887868978690786917869278693786947869578696786977869878699787007870178702787037870478705787067870778708787097871078711787127871378714787157871678717787187871978720787217872278723787247872578726787277872878729787307873178732787337873478735787367873778738787397874078741787427874378744787457874678747787487874978750787517875278753787547875578756787577875878759787607876178762787637876478765787667876778768787697877078771787727877378774787757877678777787787877978780787817878278783787847878578786787877878878789787907879178792787937879478795787967879778798787997880078801788027880378804788057880678807788087880978810788117881278813788147881578816788177881878819788207882178822788237882478825788267882778828788297883078831788327883378834788357883678837788387883978840788417884278843788447884578846788477884878849788507885178852788537885478855788567885778858788597886078861788627886378864788657886678867788687886978870788717887278873788747887578876788777887878879788807888178882788837888478885788867888778888788897889078891788927889378894788957889678897788987889978900789017890278903789047890578906789077890878909789107891178912789137891478915789167891778918789197892078921789227892378924789257892678927789287892978930789317893278933789347893578936789377893878939789407894178942789437894478945789467894778948789497895078951789527895378954789557895678957789587895978960789617896278963789647896578966789677896878969789707897178972789737897478975789767897778978789797898078981789827898378984789857898678987789887898978990789917899278993789947899578996789977899878999790007900179002790037900479005790067900779008790097901079011790127901379014790157901679017790187901979020790217902279023790247902579026790277902879029790307903179032790337903479035790367903779038790397904079041790427904379044790457904679047790487904979050790517905279053790547905579056790577905879059790607906179062790637906479065790667906779068790697907079071790727907379074790757907679077790787907979080790817908279083790847908579086790877908879089790907909179092790937909479095790967909779098790997910079101791027910379104791057910679107791087910979110791117911279113791147911579116791177911879119791207912179122791237912479125791267912779128791297913079131791327913379134791357913679137791387913979140791417914279143791447914579146791477914879149791507915179152791537915479155791567915779158791597916079161791627916379164791657916679167791687916979170791717917279173791747917579176791777917879179791807918179182791837918479185791867918779188791897919079191791927919379194791957919679197791987919979200792017920279203792047920579206792077920879209792107921179212792137921479215792167921779218792197922079221792227922379224792257922679227792287922979230792317923279233792347923579236792377923879239792407924179242792437924479245792467924779248792497925079251792527925379254792557925679257792587925979260792617926279263792647926579266792677926879269792707927179272792737927479275792767927779278792797928079281792827928379284792857928679287792887928979290792917929279293792947929579296792977929879299793007930179302793037930479305793067930779308793097931079311793127931379314793157931679317793187931979320793217932279323793247932579326793277932879329793307933179332793337933479335793367933779338793397934079341793427934379344793457934679347793487934979350793517935279353793547935579356793577935879359793607936179362793637936479365793667936779368793697937079371793727937379374793757937679377793787937979380793817938279383793847938579386793877938879389793907939179392793937939479395793967939779398793997940079401794027940379404794057940679407794087940979410794117941279413794147941579416794177941879419794207942179422794237942479425794267942779428794297943079431794327943379434794357943679437794387943979440794417944279443794447944579446794477944879449794507945179452794537945479455794567945779458794597946079461794627946379464794657946679467794687946979470794717947279473794747947579476794777947879479794807948179482794837948479485794867948779488794897949079491794927949379494794957949679497794987949979500795017950279503795047950579506795077950879509795107951179512795137951479515795167951779518795197952079521795227952379524795257952679527795287952979530795317953279533795347953579536795377953879539795407954179542795437954479545795467954779548795497955079551795527955379554795557955679557795587955979560795617956279563795647956579566795677956879569795707957179572795737957479575795767957779578795797958079581795827958379584795857958679587795887958979590795917959279593795947959579596795977959879599796007960179602796037960479605796067960779608796097961079611796127961379614796157961679617796187961979620796217962279623796247962579626796277962879629796307963179632796337963479635796367963779638796397964079641796427964379644796457964679647796487964979650796517965279653796547965579656796577965879659796607966179662796637966479665796667966779668796697967079671796727967379674796757967679677796787967979680796817968279683796847968579686796877968879689796907969179692796937969479695796967969779698796997970079701797027970379704797057970679707797087970979710797117971279713797147971579716797177971879719797207972179722797237972479725797267972779728797297973079731797327973379734797357973679737797387973979740797417974279743797447974579746797477974879749797507975179752797537975479755797567975779758797597976079761797627976379764797657976679767797687976979770797717977279773797747977579776797777977879779797807978179782797837978479785797867978779788797897979079791797927979379794797957979679797797987979979800798017980279803798047980579806798077980879809798107981179812798137981479815798167981779818798197982079821798227982379824798257982679827798287982979830798317983279833798347983579836798377983879839798407984179842798437984479845798467984779848798497985079851798527985379854798557985679857798587985979860798617986279863798647986579866798677986879869798707987179872798737987479875798767987779878798797988079881798827988379884798857988679887798887988979890798917989279893798947989579896798977989879899799007990179902799037990479905799067990779908799097991079911799127991379914799157991679917799187991979920799217992279923799247992579926799277992879929799307993179932799337993479935799367993779938799397994079941799427994379944799457994679947799487994979950799517995279953799547995579956799577995879959799607996179962799637996479965799667996779968799697997079971799727997379974799757997679977799787997979980799817998279983799847998579986799877998879989799907999179992799937999479995799967999779998799998000080001800028000380004800058000680007800088000980010800118001280013800148001580016800178001880019800208002180022800238002480025800268002780028800298003080031800328003380034800358003680037800388003980040800418004280043800448004580046800478004880049800508005180052800538005480055800568005780058800598006080061800628006380064800658006680067800688006980070800718007280073800748007580076800778007880079800808008180082800838008480085800868008780088800898009080091800928009380094800958009680097800988009980100801018010280103801048010580106801078010880109801108011180112801138011480115801168011780118801198012080121801228012380124801258012680127801288012980130801318013280133801348013580136801378013880139801408014180142801438014480145801468014780148801498015080151801528015380154801558015680157801588015980160801618016280163801648016580166801678016880169801708017180172801738017480175801768017780178801798018080181801828018380184801858018680187801888018980190801918019280193801948019580196801978019880199802008020180202802038020480205802068020780208802098021080211802128021380214802158021680217802188021980220802218022280223802248022580226802278022880229802308023180232802338023480235802368023780238802398024080241802428024380244802458024680247802488024980250802518025280253802548025580256802578025880259802608026180262802638026480265802668026780268802698027080271802728027380274802758027680277802788027980280802818028280283802848028580286802878028880289802908029180292802938029480295802968029780298802998030080301803028030380304803058030680307803088030980310803118031280313803148031580316803178031880319803208032180322803238032480325803268032780328803298033080331803328033380334803358033680337803388033980340803418034280343803448034580346803478034880349803508035180352803538035480355803568035780358803598036080361803628036380364803658036680367803688036980370803718037280373803748037580376803778037880379803808038180382803838038480385803868038780388803898039080391803928039380394803958039680397803988039980400804018040280403804048040580406804078040880409804108041180412804138041480415804168041780418804198042080421804228042380424804258042680427804288042980430804318043280433804348043580436804378043880439804408044180442804438044480445804468044780448804498045080451804528045380454804558045680457804588045980460804618046280463804648046580466804678046880469804708047180472804738047480475804768047780478804798048080481804828048380484804858048680487804888048980490804918049280493804948049580496804978049880499805008050180502805038050480505805068050780508805098051080511805128051380514805158051680517805188051980520805218052280523805248052580526805278052880529805308053180532805338053480535805368053780538805398054080541805428054380544805458054680547805488054980550805518055280553805548055580556805578055880559805608056180562805638056480565805668056780568805698057080571805728057380574805758057680577805788057980580805818058280583805848058580586805878058880589805908059180592805938059480595805968059780598805998060080601806028060380604806058060680607806088060980610806118061280613806148061580616806178061880619806208062180622806238062480625806268062780628806298063080631806328063380634806358063680637806388063980640806418064280643806448064580646806478064880649806508065180652806538065480655806568065780658806598066080661806628066380664806658066680667806688066980670806718067280673806748067580676806778067880679806808068180682806838068480685806868068780688806898069080691806928069380694806958069680697806988069980700807018070280703807048070580706807078070880709807108071180712807138071480715807168071780718807198072080721807228072380724807258072680727807288072980730807318073280733807348073580736807378073880739807408074180742807438074480745807468074780748807498075080751807528075380754807558075680757807588075980760807618076280763807648076580766807678076880769807708077180772807738077480775807768077780778807798078080781807828078380784807858078680787807888078980790807918079280793807948079580796807978079880799808008080180802808038080480805808068080780808808098081080811808128081380814808158081680817808188081980820808218082280823808248082580826808278082880829808308083180832808338083480835808368083780838808398084080841808428084380844808458084680847808488084980850808518085280853808548085580856808578085880859808608086180862808638086480865808668086780868808698087080871808728087380874808758087680877808788087980880808818088280883808848088580886808878088880889808908089180892808938089480895808968089780898808998090080901809028090380904809058090680907809088090980910809118091280913809148091580916809178091880919809208092180922809238092480925809268092780928809298093080931809328093380934809358093680937809388093980940809418094280943809448094580946809478094880949809508095180952809538095480955809568095780958809598096080961809628096380964809658096680967809688096980970809718097280973809748097580976809778097880979809808098180982809838098480985809868098780988809898099080991809928099380994809958099680997809988099981000810018100281003810048100581006810078100881009810108101181012810138101481015810168101781018810198102081021810228102381024810258102681027810288102981030810318103281033810348103581036810378103881039810408104181042810438104481045810468104781048810498105081051810528105381054810558105681057810588105981060810618106281063810648106581066810678106881069810708107181072810738107481075810768107781078810798108081081810828108381084810858108681087810888108981090810918109281093810948109581096810978109881099811008110181102811038110481105811068110781108811098111081111811128111381114811158111681117811188111981120811218112281123811248112581126811278112881129811308113181132811338113481135811368113781138811398114081141811428114381144811458114681147811488114981150811518115281153811548115581156811578115881159811608116181162811638116481165811668116781168811698117081171811728117381174811758117681177811788117981180811818118281183811848118581186811878118881189811908119181192811938119481195811968119781198811998120081201812028120381204812058120681207812088120981210812118121281213812148121581216812178121881219812208122181222812238122481225812268122781228812298123081231812328123381234812358123681237812388123981240812418124281243812448124581246812478124881249812508125181252812538125481255812568125781258812598126081261812628126381264812658126681267812688126981270812718127281273812748127581276812778127881279812808128181282812838128481285812868128781288812898129081291812928129381294812958129681297812988129981300813018130281303813048130581306813078130881309813108131181312813138131481315813168131781318813198132081321813228132381324813258132681327813288132981330813318133281333813348133581336813378133881339813408134181342813438134481345813468134781348813498135081351813528135381354813558135681357813588135981360813618136281363813648136581366813678136881369813708137181372813738137481375813768137781378813798138081381813828138381384813858138681387813888138981390813918139281393813948139581396813978139881399814008140181402814038140481405814068140781408814098141081411814128141381414814158141681417814188141981420814218142281423814248142581426814278142881429814308143181432814338143481435814368143781438814398144081441814428144381444814458144681447814488144981450814518145281453814548145581456814578145881459814608146181462814638146481465814668146781468814698147081471814728147381474814758147681477814788147981480814818148281483814848148581486814878148881489814908149181492814938149481495814968149781498814998150081501815028150381504815058150681507815088150981510815118151281513815148151581516815178151881519815208152181522815238152481525815268152781528815298153081531815328153381534815358153681537815388153981540815418154281543815448154581546815478154881549815508155181552815538155481555815568155781558815598156081561815628156381564815658156681567815688156981570815718157281573815748157581576815778157881579815808158181582815838158481585815868158781588815898159081591815928159381594815958159681597815988159981600816018160281603816048160581606816078160881609816108161181612816138161481615816168161781618816198162081621816228162381624816258162681627816288162981630816318163281633816348163581636816378163881639816408164181642816438164481645816468164781648816498165081651816528165381654816558165681657816588165981660816618166281663816648166581666816678166881669816708167181672816738167481675816768167781678816798168081681816828168381684816858168681687816888168981690816918169281693816948169581696816978169881699817008170181702817038170481705817068170781708817098171081711817128171381714817158171681717817188171981720817218172281723817248172581726817278172881729817308173181732817338173481735817368173781738817398174081741817428174381744817458174681747817488174981750817518175281753817548175581756817578175881759817608176181762817638176481765817668176781768817698177081771817728177381774817758177681777817788177981780817818178281783817848178581786817878178881789817908179181792817938179481795817968179781798817998180081801818028180381804818058180681807818088180981810818118181281813818148181581816818178181881819818208182181822818238182481825818268182781828818298183081831818328183381834818358183681837818388183981840818418184281843818448184581846818478184881849818508185181852818538185481855818568185781858818598186081861818628186381864818658186681867818688186981870818718187281873818748187581876818778187881879818808188181882818838188481885818868188781888818898189081891818928189381894818958189681897818988189981900819018190281903819048190581906819078190881909819108191181912819138191481915819168191781918819198192081921819228192381924819258192681927819288192981930819318193281933819348193581936819378193881939819408194181942819438194481945819468194781948819498195081951819528195381954819558195681957819588195981960819618196281963819648196581966819678196881969819708197181972819738197481975819768197781978819798198081981819828198381984819858198681987819888198981990819918199281993819948199581996819978199881999820008200182002820038200482005820068200782008820098201082011820128201382014820158201682017820188201982020820218202282023820248202582026820278202882029820308203182032820338203482035820368203782038820398204082041820428204382044820458204682047820488204982050820518205282053820548205582056820578205882059820608206182062820638206482065820668206782068820698207082071820728207382074820758207682077820788207982080820818208282083820848208582086820878208882089820908209182092820938209482095820968209782098820998210082101821028210382104821058210682107821088210982110821118211282113821148211582116821178211882119821208212182122821238212482125821268212782128821298213082131821328213382134821358213682137821388213982140821418214282143821448214582146821478214882149821508215182152821538215482155821568215782158821598216082161821628216382164821658216682167821688216982170821718217282173821748217582176821778217882179821808218182182821838218482185821868218782188821898219082191821928219382194821958219682197821988219982200822018220282203822048220582206822078220882209822108221182212822138221482215822168221782218822198222082221822228222382224822258222682227822288222982230822318223282233822348223582236822378223882239822408224182242822438224482245822468224782248822498225082251822528225382254822558225682257822588225982260822618226282263822648226582266822678226882269822708227182272822738227482275822768227782278822798228082281822828228382284822858228682287822888228982290822918229282293822948229582296822978229882299823008230182302823038230482305823068230782308823098231082311823128231382314823158231682317823188231982320823218232282323823248232582326823278232882329823308233182332823338233482335823368233782338823398234082341823428234382344823458234682347823488234982350823518235282353823548235582356823578235882359823608236182362823638236482365823668236782368823698237082371823728237382374823758237682377823788237982380823818238282383823848238582386823878238882389823908239182392823938239482395823968239782398823998240082401824028240382404824058240682407824088240982410824118241282413824148241582416824178241882419824208242182422824238242482425824268242782428824298243082431824328243382434824358243682437824388243982440824418244282443824448244582446824478244882449824508245182452824538245482455824568245782458824598246082461824628246382464824658246682467824688246982470824718247282473824748247582476824778247882479824808248182482824838248482485824868248782488824898249082491824928249382494824958249682497824988249982500825018250282503825048250582506825078250882509825108251182512825138251482515825168251782518825198252082521825228252382524825258252682527825288252982530825318253282533825348253582536825378253882539825408254182542825438254482545825468254782548825498255082551825528255382554825558255682557825588255982560825618256282563825648256582566825678256882569825708257182572825738257482575825768257782578825798258082581825828258382584825858258682587825888258982590825918259282593825948259582596825978259882599826008260182602826038260482605826068260782608826098261082611826128261382614826158261682617826188261982620826218262282623826248262582626826278262882629826308263182632826338263482635826368263782638826398264082641826428264382644826458264682647826488264982650826518265282653826548265582656826578265882659826608266182662826638266482665826668266782668826698267082671826728267382674826758267682677826788267982680826818268282683826848268582686826878268882689826908269182692826938269482695826968269782698826998270082701827028270382704827058270682707827088270982710827118271282713827148271582716827178271882719827208272182722827238272482725827268272782728827298273082731827328273382734827358273682737827388273982740827418274282743827448274582746827478274882749827508275182752827538275482755827568275782758827598276082761827628276382764827658276682767827688276982770827718277282773827748277582776827778277882779827808278182782827838278482785827868278782788827898279082791827928279382794827958279682797827988279982800828018280282803828048280582806828078280882809828108281182812828138281482815828168281782818828198282082821828228282382824828258282682827828288282982830828318283282833828348283582836828378283882839828408284182842828438284482845828468284782848828498285082851828528285382854828558285682857828588285982860828618286282863828648286582866828678286882869828708287182872828738287482875828768287782878828798288082881828828288382884828858288682887828888288982890828918289282893828948289582896828978289882899829008290182902829038290482905829068290782908829098291082911829128291382914829158291682917829188291982920829218292282923829248292582926829278292882929829308293182932829338293482935829368293782938829398294082941829428294382944829458294682947829488294982950829518295282953829548295582956829578295882959829608296182962829638296482965829668296782968829698297082971829728297382974829758297682977829788297982980829818298282983829848298582986829878298882989829908299182992829938299482995829968299782998829998300083001830028300383004830058300683007830088300983010830118301283013830148301583016830178301883019830208302183022830238302483025830268302783028830298303083031830328303383034830358303683037830388303983040830418304283043830448304583046830478304883049830508305183052830538305483055830568305783058830598306083061830628306383064830658306683067830688306983070830718307283073830748307583076830778307883079830808308183082830838308483085830868308783088830898309083091830928309383094830958309683097830988309983100831018310283103831048310583106831078310883109831108311183112831138311483115831168311783118831198312083121831228312383124831258312683127831288312983130831318313283133831348313583136831378313883139831408314183142831438314483145831468314783148831498315083151831528315383154831558315683157831588315983160831618316283163831648316583166831678316883169831708317183172831738317483175831768317783178831798318083181831828318383184831858318683187831888318983190831918319283193831948319583196831978319883199832008320183202832038320483205832068320783208832098321083211832128321383214832158321683217832188321983220832218322283223832248322583226832278322883229832308323183232832338323483235832368323783238832398324083241832428324383244832458324683247832488324983250832518325283253832548325583256832578325883259832608326183262832638326483265832668326783268832698327083271832728327383274832758327683277832788327983280832818328283283832848328583286832878328883289832908329183292832938329483295832968329783298832998330083301833028330383304833058330683307833088330983310833118331283313833148331583316833178331883319833208332183322833238332483325833268332783328833298333083331833328333383334833358333683337833388333983340833418334283343833448334583346833478334883349833508335183352833538335483355833568335783358833598336083361833628336383364833658336683367833688336983370833718337283373833748337583376833778337883379833808338183382833838338483385833868338783388833898339083391833928339383394833958339683397833988339983400834018340283403834048340583406834078340883409834108341183412834138341483415834168341783418834198342083421834228342383424834258342683427834288342983430834318343283433834348343583436834378343883439834408344183442834438344483445834468344783448834498345083451834528345383454834558345683457834588345983460834618346283463834648346583466834678346883469834708347183472834738347483475834768347783478834798348083481834828348383484834858348683487834888348983490834918349283493834948349583496834978349883499835008350183502835038350483505835068350783508835098351083511835128351383514835158351683517835188351983520835218352283523835248352583526835278352883529835308353183532835338353483535835368353783538835398354083541835428354383544835458354683547835488354983550835518355283553835548355583556835578355883559835608356183562835638356483565835668356783568835698357083571835728357383574835758357683577835788357983580835818358283583835848358583586835878358883589835908359183592835938359483595835968359783598835998360083601836028360383604836058360683607836088360983610836118361283613836148361583616836178361883619836208362183622836238362483625836268362783628836298363083631836328363383634836358363683637836388363983640836418364283643836448364583646836478364883649836508365183652836538365483655836568365783658836598366083661836628366383664836658366683667836688366983670836718367283673836748367583676836778367883679836808368183682836838368483685836868368783688836898369083691836928369383694836958369683697836988369983700837018370283703837048370583706837078370883709837108371183712837138371483715837168371783718837198372083721837228372383724837258372683727837288372983730837318373283733837348373583736837378373883739837408374183742837438374483745837468374783748837498375083751837528375383754837558375683757837588375983760837618376283763837648376583766837678376883769837708377183772837738377483775837768377783778837798378083781837828378383784837858378683787837888378983790837918379283793837948379583796837978379883799838008380183802838038380483805838068380783808838098381083811838128381383814838158381683817838188381983820838218382283823838248382583826838278382883829838308383183832838338383483835838368383783838838398384083841838428384383844838458384683847838488384983850838518385283853838548385583856838578385883859838608386183862838638386483865838668386783868838698387083871838728387383874838758387683877838788387983880838818388283883838848388583886838878388883889838908389183892838938389483895838968389783898838998390083901839028390383904839058390683907839088390983910839118391283913839148391583916839178391883919839208392183922839238392483925839268392783928839298393083931839328393383934839358393683937839388393983940839418394283943839448394583946839478394883949839508395183952839538395483955839568395783958839598396083961839628396383964839658396683967839688396983970839718397283973839748397583976839778397883979839808398183982839838398483985839868398783988839898399083991839928399383994839958399683997839988399984000840018400284003840048400584006840078400884009840108401184012840138401484015840168401784018840198402084021840228402384024840258402684027840288402984030840318403284033840348403584036840378403884039840408404184042840438404484045840468404784048840498405084051840528405384054840558405684057840588405984060840618406284063840648406584066840678406884069840708407184072840738407484075840768407784078840798408084081840828408384084840858408684087840888408984090840918409284093840948409584096840978409884099841008410184102841038410484105841068410784108841098411084111841128411384114841158411684117841188411984120841218412284123841248412584126841278412884129841308413184132841338413484135841368413784138841398414084141841428414384144841458414684147841488414984150841518415284153841548415584156841578415884159841608416184162841638416484165841668416784168841698417084171841728417384174841758417684177841788417984180841818418284183841848418584186841878418884189841908419184192841938419484195841968419784198841998420084201842028420384204842058420684207842088420984210842118421284213842148421584216842178421884219842208422184222842238422484225842268422784228842298423084231842328423384234842358423684237842388423984240842418424284243842448424584246842478424884249842508425184252842538425484255842568425784258842598426084261842628426384264842658426684267842688426984270842718427284273842748427584276842778427884279842808428184282842838428484285842868428784288842898429084291842928429384294842958429684297842988429984300843018430284303843048430584306843078430884309843108431184312843138431484315843168431784318843198432084321843228432384324843258432684327843288432984330843318433284333843348433584336843378433884339843408434184342843438434484345843468434784348843498435084351843528435384354843558435684357843588435984360843618436284363843648436584366843678436884369843708437184372843738437484375843768437784378843798438084381843828438384384843858438684387843888438984390843918439284393843948439584396843978439884399844008440184402844038440484405844068440784408844098441084411844128441384414844158441684417844188441984420844218442284423844248442584426844278442884429844308443184432844338443484435844368443784438844398444084441844428444384444844458444684447844488444984450844518445284453844548445584456844578445884459844608446184462844638446484465844668446784468844698447084471844728447384474844758447684477844788447984480844818448284483844848448584486844878448884489844908449184492844938449484495844968449784498844998450084501845028450384504845058450684507845088450984510845118451284513845148451584516845178451884519845208452184522845238452484525845268452784528845298453084531845328453384534845358453684537845388453984540845418454284543845448454584546845478454884549845508455184552845538455484555845568455784558845598456084561845628456384564845658456684567845688456984570845718457284573845748457584576845778457884579845808458184582845838458484585845868458784588845898459084591845928459384594845958459684597845988459984600846018460284603846048460584606846078460884609846108461184612846138461484615846168461784618846198462084621846228462384624846258462684627846288462984630846318463284633846348463584636846378463884639846408464184642846438464484645846468464784648846498465084651846528465384654846558465684657846588465984660846618466284663846648466584666846678466884669846708467184672846738467484675846768467784678846798468084681846828468384684846858468684687846888468984690846918469284693846948469584696846978469884699847008470184702847038470484705847068470784708847098471084711847128471384714847158471684717847188471984720847218472284723847248472584726847278472884729847308473184732847338473484735847368473784738847398474084741847428474384744847458474684747847488474984750847518475284753847548475584756847578475884759847608476184762847638476484765847668476784768847698477084771847728477384774847758477684777847788477984780847818478284783847848478584786847878478884789847908479184792847938479484795847968479784798847998480084801848028480384804848058480684807848088480984810848118481284813848148481584816848178481884819848208482184822848238482484825848268482784828848298483084831848328483384834848358483684837848388483984840848418484284843848448484584846848478484884849848508485184852848538485484855848568485784858848598486084861848628486384864848658486684867848688486984870848718487284873848748487584876848778487884879848808488184882848838488484885848868488784888848898489084891848928489384894848958489684897848988489984900849018490284903849048490584906849078490884909849108491184912849138491484915849168491784918849198492084921849228492384924849258492684927849288492984930849318493284933849348493584936849378493884939849408494184942849438494484945849468494784948849498495084951849528495384954849558495684957849588495984960849618496284963849648496584966849678496884969849708497184972849738497484975849768497784978849798498084981849828498384984849858498684987849888498984990849918499284993849948499584996849978499884999850008500185002850038500485005850068500785008850098501085011850128501385014850158501685017850188501985020850218502285023850248502585026850278502885029850308503185032850338503485035850368503785038850398504085041850428504385044850458504685047850488504985050850518505285053850548505585056850578505885059850608506185062850638506485065850668506785068850698507085071850728507385074850758507685077850788507985080850818508285083850848508585086850878508885089850908509185092850938509485095850968509785098850998510085101851028510385104851058510685107851088510985110851118511285113851148511585116851178511885119851208512185122851238512485125851268512785128851298513085131851328513385134851358513685137851388513985140851418514285143851448514585146851478514885149851508515185152851538515485155851568515785158851598516085161851628516385164851658516685167851688516985170851718517285173851748517585176851778517885179851808518185182851838518485185851868518785188851898519085191851928519385194851958519685197851988519985200852018520285203852048520585206852078520885209852108521185212852138521485215852168521785218852198522085221852228522385224852258522685227852288522985230852318523285233852348523585236852378523885239852408524185242852438524485245852468524785248852498525085251852528525385254852558525685257852588525985260852618526285263852648526585266852678526885269852708527185272852738527485275852768527785278852798528085281852828528385284852858528685287852888528985290852918529285293852948529585296852978529885299853008530185302853038530485305853068530785308853098531085311853128531385314853158531685317853188531985320853218532285323853248532585326853278532885329853308533185332853338533485335853368533785338853398534085341853428534385344853458534685347853488534985350853518535285353853548535585356853578535885359853608536185362853638536485365853668536785368853698537085371853728537385374853758537685377853788537985380853818538285383853848538585386853878538885389853908539185392853938539485395853968539785398853998540085401854028540385404854058540685407854088540985410854118541285413854148541585416854178541885419854208542185422854238542485425854268542785428854298543085431854328543385434854358543685437854388543985440854418544285443854448544585446854478544885449854508545185452854538545485455854568545785458854598546085461854628546385464854658546685467854688546985470854718547285473854748547585476854778547885479854808548185482854838548485485854868548785488854898549085491854928549385494854958549685497854988549985500855018550285503855048550585506855078550885509855108551185512855138551485515855168551785518855198552085521855228552385524855258552685527855288552985530855318553285533855348553585536855378553885539855408554185542855438554485545855468554785548855498555085551855528555385554855558555685557855588555985560855618556285563855648556585566855678556885569855708557185572855738557485575855768557785578855798558085581855828558385584855858558685587855888558985590855918559285593855948559585596855978559885599856008560185602856038560485605856068560785608856098561085611856128561385614856158561685617856188561985620856218562285623856248562585626856278562885629856308563185632856338563485635856368563785638856398564085641856428564385644856458564685647856488564985650856518565285653856548565585656856578565885659856608566185662856638566485665856668566785668856698567085671856728567385674856758567685677856788567985680856818568285683856848568585686856878568885689856908569185692856938569485695856968569785698856998570085701857028570385704857058570685707857088570985710857118571285713857148571585716857178571885719857208572185722857238572485725857268572785728857298573085731857328573385734857358573685737857388573985740857418574285743857448574585746857478574885749857508575185752857538575485755857568575785758857598576085761857628576385764857658576685767857688576985770857718577285773857748577585776857778577885779857808578185782857838578485785857868578785788857898579085791857928579385794857958579685797857988579985800858018580285803858048580585806858078580885809858108581185812858138581485815858168581785818858198582085821858228582385824858258582685827858288582985830858318583285833858348583585836858378583885839858408584185842858438584485845858468584785848858498585085851858528585385854858558585685857858588585985860858618586285863858648586585866858678586885869858708587185872858738587485875858768587785878858798588085881858828588385884858858588685887858888588985890858918589285893858948589585896858978589885899859008590185902859038590485905859068590785908859098591085911859128591385914859158591685917859188591985920859218592285923859248592585926859278592885929859308593185932859338593485935859368593785938859398594085941859428594385944859458594685947859488594985950859518595285953859548595585956859578595885959859608596185962859638596485965859668596785968859698597085971859728597385974859758597685977859788597985980859818598285983859848598585986859878598885989859908599185992859938599485995859968599785998859998600086001860028600386004860058600686007860088600986010860118601286013860148601586016860178601886019860208602186022860238602486025860268602786028860298603086031860328603386034860358603686037860388603986040860418604286043860448604586046860478604886049860508605186052860538605486055860568605786058860598606086061860628606386064860658606686067860688606986070860718607286073860748607586076860778607886079860808608186082860838608486085860868608786088860898609086091860928609386094860958609686097860988609986100861018610286103861048610586106861078610886109861108611186112861138611486115861168611786118861198612086121861228612386124861258612686127861288612986130861318613286133861348613586136861378613886139861408614186142861438614486145861468614786148861498615086151861528615386154861558615686157861588615986160861618616286163861648616586166861678616886169861708617186172861738617486175861768617786178861798618086181861828618386184861858618686187861888618986190861918619286193861948619586196861978619886199862008620186202862038620486205862068620786208862098621086211862128621386214862158621686217862188621986220862218622286223862248622586226862278622886229862308623186232862338623486235862368623786238862398624086241862428624386244862458624686247862488624986250862518625286253862548625586256862578625886259862608626186262862638626486265862668626786268862698627086271862728627386274862758627686277862788627986280862818628286283862848628586286862878628886289862908629186292862938629486295862968629786298862998630086301863028630386304863058630686307863088630986310863118631286313863148631586316863178631886319863208632186322863238632486325863268632786328863298633086331863328633386334863358633686337863388633986340863418634286343863448634586346863478634886349863508635186352863538635486355863568635786358863598636086361863628636386364863658636686367863688636986370863718637286373863748637586376863778637886379863808638186382863838638486385863868638786388863898639086391863928639386394863958639686397863988639986400864018640286403864048640586406864078640886409864108641186412864138641486415864168641786418864198642086421864228642386424864258642686427864288642986430864318643286433864348643586436864378643886439864408644186442864438644486445864468644786448864498645086451864528645386454864558645686457864588645986460864618646286463864648646586466864678646886469864708647186472864738647486475864768647786478864798648086481864828648386484864858648686487864888648986490864918649286493864948649586496864978649886499865008650186502865038650486505865068650786508865098651086511865128651386514865158651686517865188651986520865218652286523865248652586526865278652886529865308653186532865338653486535865368653786538865398654086541865428654386544865458654686547865488654986550865518655286553865548655586556865578655886559865608656186562865638656486565865668656786568865698657086571865728657386574865758657686577865788657986580865818658286583865848658586586865878658886589865908659186592865938659486595865968659786598865998660086601866028660386604866058660686607866088660986610866118661286613866148661586616866178661886619866208662186622866238662486625866268662786628866298663086631866328663386634866358663686637866388663986640866418664286643866448664586646866478664886649866508665186652866538665486655866568665786658866598666086661866628666386664866658666686667866688666986670866718667286673866748667586676866778667886679866808668186682866838668486685866868668786688866898669086691866928669386694866958669686697866988669986700867018670286703867048670586706867078670886709867108671186712867138671486715867168671786718867198672086721867228672386724867258672686727867288672986730867318673286733867348673586736867378673886739867408674186742867438674486745867468674786748867498675086751867528675386754867558675686757867588675986760867618676286763867648676586766867678676886769867708677186772867738677486775867768677786778867798678086781867828678386784867858678686787867888678986790867918679286793867948679586796867978679886799868008680186802868038680486805868068680786808868098681086811868128681386814868158681686817868188681986820868218682286823868248682586826868278682886829868308683186832868338683486835868368683786838868398684086841868428684386844868458684686847868488684986850868518685286853868548685586856868578685886859868608686186862868638686486865868668686786868868698687086871868728687386874868758687686877868788687986880868818688286883868848688586886868878688886889868908689186892868938689486895868968689786898868998690086901869028690386904869058690686907869088690986910869118691286913869148691586916869178691886919869208692186922869238692486925869268692786928869298693086931869328693386934869358693686937869388693986940869418694286943869448694586946869478694886949869508695186952869538695486955869568695786958869598696086961869628696386964869658696686967869688696986970869718697286973869748697586976869778697886979869808698186982869838698486985869868698786988869898699086991869928699386994869958699686997869988699987000870018700287003870048700587006870078700887009870108701187012870138701487015870168701787018870198702087021870228702387024870258702687027870288702987030870318703287033870348703587036870378703887039870408704187042870438704487045870468704787048870498705087051870528705387054870558705687057870588705987060870618706287063870648706587066870678706887069870708707187072870738707487075870768707787078870798708087081870828708387084870858708687087870888708987090870918709287093870948709587096870978709887099871008710187102871038710487105871068710787108871098711087111871128711387114871158711687117871188711987120871218712287123871248712587126871278712887129871308713187132871338713487135871368713787138871398714087141871428714387144871458714687147871488714987150871518715287153871548715587156871578715887159871608716187162871638716487165871668716787168871698717087171871728717387174871758717687177871788717987180871818718287183871848718587186871878718887189871908719187192871938719487195871968719787198871998720087201872028720387204872058720687207872088720987210872118721287213872148721587216872178721887219872208722187222872238722487225872268722787228872298723087231872328723387234872358723687237872388723987240872418724287243872448724587246872478724887249872508725187252872538725487255872568725787258872598726087261872628726387264872658726687267872688726987270872718727287273872748727587276872778727887279872808728187282872838728487285872868728787288872898729087291872928729387294872958729687297872988729987300873018730287303873048730587306873078730887309873108731187312873138731487315873168731787318873198732087321873228732387324873258732687327873288732987330873318733287333873348733587336873378733887339873408734187342873438734487345873468734787348873498735087351873528735387354873558735687357873588735987360873618736287363873648736587366873678736887369873708737187372873738737487375873768737787378873798738087381873828738387384873858738687387873888738987390873918739287393873948739587396873978739887399874008740187402874038740487405874068740787408874098741087411874128741387414874158741687417874188741987420874218742287423874248742587426874278742887429874308743187432874338743487435874368743787438874398744087441874428744387444874458744687447874488744987450874518745287453874548745587456874578745887459874608746187462874638746487465874668746787468874698747087471874728747387474874758747687477874788747987480874818748287483874848748587486874878748887489874908749187492874938749487495874968749787498874998750087501875028750387504875058750687507875088750987510875118751287513875148751587516875178751887519875208752187522875238752487525875268752787528875298753087531875328753387534875358753687537875388753987540875418754287543875448754587546875478754887549875508755187552875538755487555875568755787558875598756087561875628756387564875658756687567875688756987570875718757287573875748757587576875778757887579875808758187582875838758487585875868758787588875898759087591875928759387594875958759687597875988759987600876018760287603876048760587606876078760887609876108761187612876138761487615876168761787618876198762087621876228762387624876258762687627876288762987630876318763287633876348763587636876378763887639876408764187642876438764487645876468764787648876498765087651876528765387654876558765687657876588765987660876618766287663876648766587666876678766887669876708767187672876738767487675876768767787678876798768087681876828768387684876858768687687876888768987690876918769287693876948769587696876978769887699877008770187702877038770487705877068770787708877098771087711877128771387714877158771687717877188771987720877218772287723877248772587726877278772887729877308773187732877338773487735877368773787738877398774087741877428774387744877458774687747877488774987750877518775287753877548775587756877578775887759877608776187762877638776487765877668776787768877698777087771877728777387774877758777687777877788777987780877818778287783877848778587786877878778887789877908779187792877938779487795877968779787798877998780087801878028780387804878058780687807878088780987810878118781287813878148781587816878178781887819878208782187822878238782487825878268782787828878298783087831878328783387834878358783687837878388783987840878418784287843878448784587846878478784887849878508785187852878538785487855878568785787858878598786087861878628786387864878658786687867878688786987870878718787287873878748787587876878778787887879878808788187882878838788487885878868788787888878898789087891878928789387894878958789687897878988789987900879018790287903879048790587906879078790887909879108791187912879138791487915879168791787918879198792087921879228792387924879258792687927879288792987930879318793287933879348793587936879378793887939879408794187942879438794487945879468794787948879498795087951879528795387954879558795687957879588795987960879618796287963879648796587966879678796887969879708797187972879738797487975879768797787978879798798087981879828798387984879858798687987879888798987990879918799287993879948799587996879978799887999880008800188002880038800488005880068800788008880098801088011880128801388014880158801688017880188801988020880218802288023880248802588026880278802888029880308803188032880338803488035880368803788038880398804088041880428804388044880458804688047880488804988050880518805288053880548805588056880578805888059880608806188062880638806488065880668806788068880698807088071880728807388074880758807688077880788807988080880818808288083880848808588086880878808888089880908809188092880938809488095880968809788098880998810088101881028810388104881058810688107881088810988110881118811288113881148811588116881178811888119881208812188122881238812488125881268812788128881298813088131881328813388134881358813688137881388813988140881418814288143881448814588146881478814888149881508815188152881538815488155881568815788158881598816088161881628816388164881658816688167881688816988170881718817288173881748817588176881778817888179881808818188182881838818488185881868818788188881898819088191881928819388194881958819688197881988819988200882018820288203882048820588206882078820888209882108821188212882138821488215882168821788218882198822088221882228822388224882258822688227882288822988230882318823288233882348823588236882378823888239882408824188242882438824488245882468824788248882498825088251882528825388254882558825688257882588825988260882618826288263882648826588266882678826888269882708827188272882738827488275882768827788278882798828088281882828828388284882858828688287882888828988290882918829288293882948829588296882978829888299883008830188302883038830488305883068830788308883098831088311883128831388314883158831688317883188831988320883218832288323883248832588326883278832888329883308833188332883338833488335883368833788338883398834088341883428834388344883458834688347883488834988350883518835288353883548835588356883578835888359883608836188362883638836488365883668836788368883698837088371883728837388374883758837688377883788837988380883818838288383883848838588386883878838888389883908839188392883938839488395883968839788398883998840088401884028840388404884058840688407884088840988410884118841288413884148841588416884178841888419884208842188422884238842488425884268842788428884298843088431884328843388434884358843688437884388843988440884418844288443884448844588446884478844888449884508845188452884538845488455884568845788458884598846088461884628846388464884658846688467884688846988470884718847288473884748847588476884778847888479884808848188482884838848488485884868848788488884898849088491884928849388494884958849688497884988849988500885018850288503885048850588506885078850888509885108851188512885138851488515885168851788518885198852088521885228852388524885258852688527885288852988530885318853288533885348853588536885378853888539885408854188542885438854488545885468854788548885498855088551885528855388554885558855688557885588855988560885618856288563885648856588566885678856888569885708857188572885738857488575885768857788578885798858088581885828858388584885858858688587885888858988590885918859288593885948859588596885978859888599886008860188602886038860488605886068860788608886098861088611886128861388614886158861688617886188861988620886218862288623886248862588626886278862888629886308863188632886338863488635886368863788638886398864088641886428864388644886458864688647886488864988650886518865288653886548865588656886578865888659886608866188662886638866488665886668866788668886698867088671886728867388674886758867688677886788867988680886818868288683886848868588686886878868888689886908869188692886938869488695886968869788698886998870088701887028870388704887058870688707887088870988710887118871288713887148871588716887178871888719887208872188722887238872488725887268872788728887298873088731887328873388734887358873688737887388873988740887418874288743887448874588746887478874888749887508875188752887538875488755887568875788758887598876088761887628876388764887658876688767887688876988770887718877288773887748877588776887778877888779887808878188782887838878488785887868878788788887898879088791887928879388794887958879688797887988879988800888018880288803888048880588806888078880888809888108881188812888138881488815888168881788818888198882088821888228882388824888258882688827888288882988830888318883288833888348883588836888378883888839888408884188842888438884488845888468884788848888498885088851888528885388854888558885688857888588885988860888618886288863888648886588866888678886888869888708887188872888738887488875888768887788878888798888088881888828888388884888858888688887888888888988890888918889288893888948889588896888978889888899889008890188902889038890488905889068890788908889098891088911889128891388914889158891688917889188891988920889218892288923889248892588926889278892888929889308893188932889338893488935889368893788938889398894088941889428894388944889458894688947889488894988950889518895288953889548895588956889578895888959889608896188962889638896488965889668896788968889698897088971889728897388974889758897688977889788897988980889818898288983889848898588986889878898888989889908899188992889938899488995889968899788998889998900089001890028900389004890058900689007890088900989010890118901289013890148901589016890178901889019890208902189022890238902489025890268902789028890298903089031890328903389034890358903689037890388903989040890418904289043890448904589046890478904889049890508905189052890538905489055890568905789058890598906089061890628906389064890658906689067890688906989070890718907289073890748907589076890778907889079890808908189082890838908489085890868908789088890898909089091890928909389094890958909689097890988909989100891018910289103891048910589106891078910889109891108911189112891138911489115891168911789118891198912089121891228912389124891258912689127891288912989130891318913289133891348913589136891378913889139891408914189142891438914489145891468914789148891498915089151891528915389154891558915689157891588915989160891618916289163891648916589166891678916889169891708917189172891738917489175891768917789178891798918089181891828918389184891858918689187891888918989190891918919289193891948919589196891978919889199892008920189202892038920489205892068920789208892098921089211892128921389214892158921689217892188921989220892218922289223892248922589226892278922889229892308923189232892338923489235892368923789238892398924089241892428924389244892458924689247892488924989250892518925289253892548925589256892578925889259892608926189262892638926489265892668926789268892698927089271892728927389274892758927689277892788927989280892818928289283892848928589286892878928889289892908929189292892938929489295892968929789298892998930089301893028930389304893058930689307893088930989310893118931289313893148931589316893178931889319893208932189322893238932489325893268932789328893298933089331893328933389334893358933689337893388933989340893418934289343893448934589346893478934889349893508935189352893538935489355893568935789358893598936089361893628936389364893658936689367893688936989370893718937289373893748937589376893778937889379893808938189382893838938489385893868938789388893898939089391893928939389394893958939689397893988939989400894018940289403894048940589406894078940889409894108941189412894138941489415894168941789418894198942089421894228942389424894258942689427894288942989430894318943289433894348943589436894378943889439894408944189442894438944489445894468944789448894498945089451894528945389454894558945689457894588945989460894618946289463894648946589466894678946889469894708947189472894738947489475894768947789478894798948089481894828948389484894858948689487894888948989490894918949289493894948949589496894978949889499895008950189502895038950489505895068950789508895098951089511895128951389514895158951689517895188951989520895218952289523895248952589526895278952889529895308953189532895338953489535895368953789538895398954089541895428954389544895458954689547895488954989550895518955289553895548955589556895578955889559895608956189562895638956489565895668956789568895698957089571895728957389574895758957689577895788957989580895818958289583895848958589586895878958889589895908959189592895938959489595895968959789598895998960089601896028960389604896058960689607896088960989610896118961289613896148961589616896178961889619896208962189622896238962489625896268962789628896298963089631896328963389634896358963689637896388963989640896418964289643896448964589646896478964889649896508965189652896538965489655896568965789658896598966089661896628966389664896658966689667896688966989670896718967289673896748967589676896778967889679896808968189682896838968489685896868968789688896898969089691896928969389694896958969689697896988969989700897018970289703897048970589706897078970889709897108971189712897138971489715897168971789718897198972089721897228972389724897258972689727897288972989730897318973289733897348973589736897378973889739897408974189742897438974489745897468974789748897498975089751897528975389754897558975689757897588975989760897618976289763897648976589766897678976889769897708977189772897738977489775897768977789778897798978089781897828978389784897858978689787897888978989790897918979289793897948979589796897978979889799898008980189802898038980489805898068980789808898098981089811898128981389814898158981689817898188981989820898218982289823898248982589826898278982889829898308983189832898338983489835898368983789838898398984089841898428984389844898458984689847898488984989850898518985289853898548985589856898578985889859898608986189862898638986489865898668986789868898698987089871898728987389874898758987689877898788987989880898818988289883898848988589886898878988889889898908989189892898938989489895898968989789898898998990089901899028990389904899058990689907899088990989910899118991289913899148991589916899178991889919899208992189922899238992489925899268992789928899298993089931899328993389934899358993689937899388993989940899418994289943899448994589946899478994889949899508995189952899538995489955899568995789958899598996089961899628996389964899658996689967899688996989970899718997289973899748997589976899778997889979899808998189982899838998489985899868998789988899898999089991899928999389994899958999689997899988999990000900019000290003900049000590006900079000890009900109001190012900139001490015900169001790018900199002090021900229002390024900259002690027900289002990030900319003290033900349003590036900379003890039900409004190042900439004490045900469004790048900499005090051900529005390054900559005690057900589005990060900619006290063900649006590066900679006890069900709007190072900739007490075900769007790078900799008090081900829008390084900859008690087900889008990090900919009290093900949009590096900979009890099901009010190102901039010490105901069010790108901099011090111901129011390114901159011690117901189011990120901219012290123901249012590126901279012890129901309013190132901339013490135901369013790138901399014090141901429014390144901459014690147901489014990150901519015290153901549015590156901579015890159901609016190162901639016490165901669016790168901699017090171901729017390174901759017690177901789017990180901819018290183901849018590186901879018890189901909019190192901939019490195901969019790198901999020090201902029020390204902059020690207902089020990210902119021290213902149021590216902179021890219902209022190222902239022490225902269022790228902299023090231902329023390234902359023690237902389023990240902419024290243902449024590246902479024890249902509025190252902539025490255902569025790258902599026090261902629026390264902659026690267902689026990270902719027290273902749027590276902779027890279902809028190282902839028490285902869028790288902899029090291902929029390294902959029690297902989029990300903019030290303903049030590306903079030890309903109031190312903139031490315903169031790318903199032090321903229032390324903259032690327903289032990330903319033290333903349033590336903379033890339903409034190342903439034490345903469034790348903499035090351903529035390354903559035690357903589035990360903619036290363903649036590366903679036890369903709037190372903739037490375903769037790378903799038090381903829038390384903859038690387903889038990390903919039290393903949039590396903979039890399904009040190402904039040490405904069040790408904099041090411904129041390414904159041690417904189041990420904219042290423904249042590426904279042890429904309043190432904339043490435904369043790438904399044090441904429044390444904459044690447904489044990450904519045290453904549045590456904579045890459904609046190462904639046490465904669046790468904699047090471904729047390474904759047690477904789047990480904819048290483904849048590486904879048890489904909049190492904939049490495904969049790498904999050090501905029050390504905059050690507905089050990510905119051290513905149051590516905179051890519905209052190522905239052490525905269052790528905299053090531905329053390534905359053690537905389053990540905419054290543905449054590546905479054890549905509055190552905539055490555905569055790558905599056090561905629056390564905659056690567905689056990570905719057290573905749057590576905779057890579905809058190582905839058490585905869058790588905899059090591905929059390594905959059690597905989059990600906019060290603906049060590606906079060890609906109061190612906139061490615906169061790618906199062090621906229062390624906259062690627906289062990630906319063290633906349063590636906379063890639906409064190642906439064490645906469064790648906499065090651906529065390654906559065690657906589065990660906619066290663906649066590666906679066890669906709067190672906739067490675906769067790678906799068090681906829068390684906859068690687906889068990690906919069290693906949069590696906979069890699907009070190702907039070490705907069070790708907099071090711907129071390714907159071690717907189071990720907219072290723907249072590726907279072890729907309073190732907339073490735907369073790738907399074090741907429074390744907459074690747907489074990750907519075290753907549075590756907579075890759907609076190762907639076490765907669076790768907699077090771907729077390774907759077690777907789077990780907819078290783907849078590786907879078890789907909079190792907939079490795907969079790798907999080090801908029080390804908059080690807908089080990810908119081290813908149081590816908179081890819908209082190822908239082490825908269082790828908299083090831908329083390834908359083690837908389083990840908419084290843908449084590846908479084890849908509085190852908539085490855908569085790858908599086090861908629086390864908659086690867908689086990870908719087290873908749087590876908779087890879908809088190882908839088490885908869088790888908899089090891908929089390894908959089690897908989089990900909019090290903909049090590906909079090890909909109091190912909139091490915909169091790918909199092090921909229092390924909259092690927909289092990930909319093290933909349093590936909379093890939909409094190942909439094490945909469094790948909499095090951909529095390954909559095690957909589095990960909619096290963909649096590966909679096890969909709097190972909739097490975909769097790978909799098090981909829098390984909859098690987909889098990990909919099290993909949099590996909979099890999910009100191002910039100491005910069100791008910099101091011910129101391014910159101691017910189101991020910219102291023910249102591026910279102891029910309103191032910339103491035910369103791038910399104091041910429104391044910459104691047910489104991050910519105291053910549105591056910579105891059910609106191062910639106491065910669106791068910699107091071910729107391074910759107691077910789107991080910819108291083910849108591086910879108891089910909109191092910939109491095910969109791098910999110091101911029110391104911059110691107911089110991110911119111291113911149111591116911179111891119911209112191122911239112491125911269112791128911299113091131911329113391134911359113691137911389113991140911419114291143911449114591146911479114891149911509115191152911539115491155911569115791158911599116091161911629116391164911659116691167911689116991170911719117291173911749117591176911779117891179911809118191182911839118491185911869118791188911899119091191911929119391194911959119691197911989119991200912019120291203912049120591206912079120891209912109121191212912139121491215912169121791218912199122091221912229122391224912259122691227912289122991230912319123291233912349123591236912379123891239912409124191242912439124491245912469124791248912499125091251912529125391254912559125691257912589125991260912619126291263912649126591266912679126891269912709127191272912739127491275912769127791278912799128091281912829128391284912859128691287912889128991290912919129291293912949129591296912979129891299913009130191302913039130491305913069130791308913099131091311913129131391314913159131691317913189131991320913219132291323913249132591326913279132891329913309133191332913339133491335913369133791338913399134091341913429134391344913459134691347913489134991350913519135291353913549135591356913579135891359913609136191362913639136491365913669136791368913699137091371913729137391374913759137691377913789137991380913819138291383913849138591386913879138891389913909139191392913939139491395913969139791398913999140091401914029140391404914059140691407914089140991410914119141291413914149141591416914179141891419914209142191422914239142491425914269142791428914299143091431914329143391434914359143691437914389143991440914419144291443914449144591446914479144891449914509145191452914539145491455914569145791458914599146091461914629146391464914659146691467914689146991470914719147291473914749147591476914779147891479914809148191482914839148491485914869148791488914899149091491914929149391494914959149691497914989149991500915019150291503915049150591506915079150891509915109151191512915139151491515915169151791518915199152091521915229152391524915259152691527915289152991530915319153291533915349153591536915379153891539915409154191542915439154491545915469154791548915499155091551915529155391554915559155691557915589155991560915619156291563915649156591566915679156891569915709157191572915739157491575915769157791578915799158091581915829158391584915859158691587915889158991590915919159291593915949159591596915979159891599916009160191602916039160491605916069160791608916099161091611916129161391614916159161691617916189161991620916219162291623916249162591626916279162891629916309163191632916339163491635916369163791638916399164091641916429164391644916459164691647916489164991650916519165291653916549165591656916579165891659916609166191662916639166491665916669166791668916699167091671916729167391674916759167691677916789167991680916819168291683916849168591686916879168891689916909169191692916939169491695916969169791698916999170091701917029170391704917059170691707917089170991710917119171291713917149171591716917179171891719917209172191722917239172491725917269172791728917299173091731917329173391734917359173691737917389173991740917419174291743917449174591746917479174891749917509175191752917539175491755917569175791758917599176091761917629176391764917659176691767917689176991770917719177291773917749177591776917779177891779917809178191782917839178491785917869178791788917899179091791917929179391794917959179691797917989179991800918019180291803918049180591806918079180891809918109181191812918139181491815918169181791818918199182091821918229182391824918259182691827918289182991830918319183291833918349183591836918379183891839918409184191842918439184491845918469184791848918499185091851918529185391854918559185691857918589185991860918619186291863918649186591866918679186891869918709187191872918739187491875918769187791878918799188091881918829188391884918859188691887918889188991890918919189291893918949189591896918979189891899919009190191902919039190491905919069190791908919099191091911919129191391914919159191691917919189191991920919219192291923919249192591926919279192891929919309193191932919339193491935919369193791938919399194091941919429194391944919459194691947919489194991950919519195291953919549195591956919579195891959919609196191962919639196491965919669196791968919699197091971919729197391974919759197691977919789197991980919819198291983919849198591986919879198891989919909199191992919939199491995919969199791998919999200092001920029200392004920059200692007920089200992010920119201292013920149201592016920179201892019920209202192022920239202492025920269202792028920299203092031920329203392034920359203692037920389203992040920419204292043920449204592046920479204892049920509205192052920539205492055920569205792058920599206092061920629206392064920659206692067920689206992070920719207292073920749207592076920779207892079920809208192082920839208492085920869208792088920899209092091920929209392094920959209692097920989209992100921019210292103921049210592106921079210892109921109211192112921139211492115921169211792118921199212092121921229212392124921259212692127921289212992130921319213292133921349213592136921379213892139921409214192142921439214492145921469214792148921499215092151921529215392154921559215692157921589215992160921619216292163921649216592166921679216892169921709217192172921739217492175921769217792178921799218092181921829218392184921859218692187921889218992190921919219292193921949219592196921979219892199922009220192202922039220492205922069220792208922099221092211922129221392214922159221692217922189221992220922219222292223922249222592226922279222892229922309223192232922339223492235922369223792238922399224092241922429224392244922459224692247922489224992250922519225292253922549225592256922579225892259922609226192262922639226492265922669226792268922699227092271922729227392274922759227692277922789227992280922819228292283922849228592286922879228892289922909229192292922939229492295922969229792298922999230092301923029230392304923059230692307923089230992310923119231292313923149231592316923179231892319923209232192322923239232492325923269232792328923299233092331923329233392334923359233692337923389233992340923419234292343923449234592346923479234892349923509235192352923539235492355923569235792358923599236092361923629236392364923659236692367923689236992370923719237292373923749237592376923779237892379923809238192382923839238492385923869238792388923899239092391923929239392394923959239692397923989239992400924019240292403924049240592406924079240892409924109241192412924139241492415924169241792418924199242092421924229242392424924259242692427924289242992430924319243292433924349243592436924379243892439924409244192442924439244492445924469244792448924499245092451924529245392454924559245692457924589245992460924619246292463924649246592466924679246892469924709247192472924739247492475924769247792478924799248092481924829248392484924859248692487924889248992490924919249292493924949249592496924979249892499925009250192502925039250492505925069250792508925099251092511925129251392514925159251692517925189251992520925219252292523925249252592526925279252892529925309253192532925339253492535925369253792538925399254092541925429254392544925459254692547925489254992550925519255292553925549255592556925579255892559925609256192562925639256492565925669256792568925699257092571925729257392574925759257692577925789257992580925819258292583925849258592586925879258892589925909259192592925939259492595925969259792598925999260092601926029260392604926059260692607926089260992610926119261292613926149261592616926179261892619926209262192622926239262492625926269262792628926299263092631926329263392634926359263692637926389263992640926419264292643926449264592646926479264892649926509265192652926539265492655926569265792658926599266092661926629266392664926659266692667926689266992670926719267292673926749267592676926779267892679926809268192682926839268492685926869268792688926899269092691926929269392694926959269692697926989269992700927019270292703927049270592706927079270892709927109271192712927139271492715927169271792718927199272092721927229272392724927259272692727927289272992730927319273292733927349273592736927379273892739927409274192742927439274492745927469274792748927499275092751927529275392754927559275692757927589275992760927619276292763927649276592766927679276892769927709277192772927739277492775927769277792778927799278092781927829278392784927859278692787927889278992790927919279292793927949279592796927979279892799928009280192802928039280492805928069280792808928099281092811928129281392814928159281692817928189281992820928219282292823928249282592826928279282892829928309283192832928339283492835928369283792838928399284092841928429284392844928459284692847928489284992850928519285292853928549285592856928579285892859928609286192862928639286492865928669286792868928699287092871928729287392874928759287692877928789287992880928819288292883928849288592886928879288892889928909289192892928939289492895928969289792898928999290092901929029290392904929059290692907929089290992910929119291292913929149291592916929179291892919929209292192922929239292492925929269292792928929299293092931929329293392934929359293692937929389293992940929419294292943929449294592946929479294892949929509295192952929539295492955929569295792958929599296092961929629296392964929659296692967929689296992970929719297292973929749297592976929779297892979929809298192982929839298492985929869298792988929899299092991929929299392994929959299692997929989299993000930019300293003930049300593006930079300893009930109301193012930139301493015930169301793018930199302093021930229302393024930259302693027930289302993030930319303293033930349303593036930379303893039930409304193042930439304493045930469304793048930499305093051930529305393054930559305693057930589305993060930619306293063930649306593066930679306893069930709307193072930739307493075930769307793078930799308093081930829308393084930859308693087930889308993090930919309293093930949309593096930979309893099931009310193102931039310493105931069310793108931099311093111931129311393114931159311693117931189311993120931219312293123931249312593126931279312893129931309313193132931339313493135931369313793138931399314093141931429314393144931459314693147931489314993150931519315293153931549315593156931579315893159931609316193162931639316493165931669316793168931699317093171931729317393174931759317693177931789317993180931819318293183931849318593186931879318893189931909319193192931939319493195931969319793198931999320093201932029320393204932059320693207932089320993210932119321293213932149321593216932179321893219932209322193222932239322493225932269322793228932299323093231932329323393234932359323693237932389323993240932419324293243932449324593246932479324893249932509325193252932539325493255932569325793258932599326093261932629326393264932659326693267932689326993270932719327293273932749327593276932779327893279932809328193282932839328493285932869328793288932899329093291932929329393294932959329693297932989329993300933019330293303933049330593306933079330893309933109331193312933139331493315933169331793318933199332093321933229332393324933259332693327933289332993330933319333293333933349333593336933379333893339933409334193342933439334493345933469334793348933499335093351933529335393354933559335693357933589335993360933619336293363933649336593366933679336893369933709337193372933739337493375933769337793378933799338093381933829338393384933859338693387933889338993390933919339293393933949339593396933979339893399934009340193402934039340493405934069340793408934099341093411934129341393414934159341693417934189341993420934219342293423934249342593426934279342893429934309343193432934339343493435934369343793438934399344093441934429344393444934459344693447934489344993450934519345293453934549345593456934579345893459934609346193462934639346493465934669346793468934699347093471934729347393474934759347693477934789347993480934819348293483934849348593486934879348893489934909349193492934939349493495934969349793498934999350093501935029350393504935059350693507935089350993510935119351293513935149351593516935179351893519935209352193522935239352493525935269352793528935299353093531935329353393534935359353693537935389353993540935419354293543935449354593546935479354893549935509355193552935539355493555935569355793558935599356093561935629356393564935659356693567935689356993570935719357293573935749357593576935779357893579935809358193582935839358493585935869358793588935899359093591935929359393594935959359693597935989359993600936019360293603936049360593606936079360893609936109361193612936139361493615936169361793618936199362093621936229362393624936259362693627936289362993630936319363293633936349363593636936379363893639936409364193642936439364493645936469364793648936499365093651936529365393654936559365693657936589365993660936619366293663936649366593666936679366893669936709367193672936739367493675936769367793678936799368093681936829368393684936859368693687936889368993690936919369293693936949369593696936979369893699937009370193702937039370493705937069370793708937099371093711937129371393714937159371693717937189371993720937219372293723937249372593726937279372893729937309373193732937339373493735937369373793738937399374093741937429374393744937459374693747937489374993750937519375293753937549375593756937579375893759937609376193762937639376493765937669376793768937699377093771937729377393774937759377693777937789377993780937819378293783937849378593786937879378893789937909379193792937939379493795937969379793798937999380093801938029380393804938059380693807938089380993810938119381293813938149381593816938179381893819938209382193822938239382493825938269382793828938299383093831938329383393834938359383693837938389383993840938419384293843938449384593846938479384893849938509385193852938539385493855938569385793858938599386093861938629386393864938659386693867938689386993870938719387293873938749387593876938779387893879938809388193882938839388493885938869388793888938899389093891938929389393894938959389693897938989389993900939019390293903939049390593906939079390893909939109391193912939139391493915939169391793918939199392093921939229392393924939259392693927939289392993930939319393293933939349393593936939379393893939939409394193942939439394493945939469394793948939499395093951939529395393954939559395693957939589395993960939619396293963939649396593966939679396893969939709397193972939739397493975939769397793978939799398093981939829398393984939859398693987939889398993990939919399293993939949399593996939979399893999940009400194002940039400494005940069400794008940099401094011940129401394014940159401694017940189401994020940219402294023940249402594026940279402894029940309403194032940339403494035940369403794038940399404094041940429404394044940459404694047940489404994050940519405294053940549405594056940579405894059940609406194062940639406494065940669406794068940699407094071940729407394074940759407694077940789407994080940819408294083940849408594086940879408894089940909409194092940939409494095940969409794098940999410094101941029410394104941059410694107941089410994110941119411294113941149411594116941179411894119941209412194122941239412494125941269412794128941299413094131941329413394134941359413694137941389413994140941419414294143941449414594146941479414894149941509415194152941539415494155941569415794158941599416094161941629416394164941659416694167941689416994170941719417294173941749417594176941779417894179941809418194182941839418494185941869418794188941899419094191941929419394194941959419694197941989419994200942019420294203942049420594206942079420894209942109421194212942139421494215942169421794218942199422094221942229422394224942259422694227942289422994230942319423294233942349423594236942379423894239942409424194242942439424494245942469424794248942499425094251942529425394254942559425694257942589425994260942619426294263942649426594266942679426894269942709427194272942739427494275942769427794278942799428094281942829428394284942859428694287942889428994290942919429294293942949429594296942979429894299943009430194302943039430494305943069430794308943099431094311943129431394314943159431694317943189431994320943219432294323943249432594326943279432894329943309433194332943339433494335943369433794338943399434094341943429434394344943459434694347943489434994350943519435294353943549435594356943579435894359943609436194362943639436494365943669436794368943699437094371943729437394374943759437694377943789437994380943819438294383943849438594386943879438894389943909439194392943939439494395943969439794398943999440094401944029440394404944059440694407944089440994410944119441294413944149441594416944179441894419944209442194422944239442494425944269442794428944299443094431944329443394434944359443694437944389443994440944419444294443944449444594446944479444894449944509445194452944539445494455944569445794458944599446094461944629446394464944659446694467944689446994470944719447294473944749447594476944779447894479944809448194482944839448494485944869448794488944899449094491944929449394494944959449694497944989449994500945019450294503945049450594506945079450894509945109451194512945139451494515945169451794518945199452094521945229452394524945259452694527945289452994530945319453294533945349453594536945379453894539945409454194542945439454494545945469454794548945499455094551945529455394554945559455694557945589455994560945619456294563945649456594566945679456894569945709457194572945739457494575945769457794578945799458094581945829458394584945859458694587945889458994590945919459294593945949459594596945979459894599946009460194602946039460494605946069460794608946099461094611946129461394614946159461694617946189461994620946219462294623946249462594626946279462894629946309463194632946339463494635946369463794638946399464094641946429464394644946459464694647946489464994650946519465294653946549465594656946579465894659946609466194662946639466494665946669466794668946699467094671946729467394674946759467694677946789467994680946819468294683946849468594686946879468894689946909469194692946939469494695946969469794698946999470094701947029470394704947059470694707947089470994710947119471294713947149471594716947179471894719947209472194722947239472494725947269472794728947299473094731947329473394734947359473694737947389473994740947419474294743947449474594746947479474894749947509475194752947539475494755947569475794758947599476094761947629476394764947659476694767947689476994770947719477294773947749477594776947779477894779947809478194782947839478494785947869478794788947899479094791947929479394794947959479694797947989479994800948019480294803948049480594806948079480894809948109481194812948139481494815948169481794818948199482094821948229482394824948259482694827948289482994830948319483294833948349483594836948379483894839948409484194842948439484494845948469484794848948499485094851948529485394854948559485694857948589485994860948619486294863948649486594866948679486894869948709487194872948739487494875948769487794878948799488094881948829488394884948859488694887948889488994890948919489294893948949489594896948979489894899949009490194902949039490494905949069490794908949099491094911949129491394914949159491694917949189491994920949219492294923949249492594926949279492894929949309493194932949339493494935949369493794938949399494094941949429494394944949459494694947949489494994950949519495294953949549495594956949579495894959949609496194962949639496494965949669496794968949699497094971949729497394974949759497694977949789497994980949819498294983949849498594986949879498894989949909499194992949939499494995949969499794998949999500095001950029500395004950059500695007950089500995010950119501295013950149501595016950179501895019950209502195022950239502495025950269502795028950299503095031950329503395034950359503695037950389503995040950419504295043950449504595046950479504895049950509505195052950539505495055950569505795058950599506095061950629506395064950659506695067950689506995070950719507295073950749507595076950779507895079950809508195082950839508495085950869508795088950899509095091950929509395094950959509695097950989509995100951019510295103951049510595106951079510895109951109511195112951139511495115951169511795118951199512095121951229512395124951259512695127951289512995130951319513295133951349513595136951379513895139951409514195142951439514495145951469514795148951499515095151951529515395154951559515695157951589515995160951619516295163951649516595166951679516895169951709517195172951739517495175951769517795178951799518095181951829518395184951859518695187951889518995190951919519295193951949519595196951979519895199952009520195202952039520495205952069520795208952099521095211952129521395214952159521695217952189521995220952219522295223952249522595226952279522895229952309523195232952339523495235952369523795238952399524095241952429524395244952459524695247952489524995250952519525295253952549525595256952579525895259952609526195262952639526495265952669526795268952699527095271952729527395274952759527695277952789527995280952819528295283952849528595286952879528895289952909529195292952939529495295952969529795298952999530095301953029530395304953059530695307953089530995310953119531295313953149531595316953179531895319953209532195322953239532495325953269532795328953299533095331953329533395334953359533695337953389533995340953419534295343953449534595346953479534895349953509535195352953539535495355953569535795358953599536095361953629536395364953659536695367953689536995370953719537295373953749537595376953779537895379953809538195382953839538495385953869538795388953899539095391953929539395394953959539695397953989539995400954019540295403954049540595406954079540895409954109541195412954139541495415954169541795418954199542095421954229542395424954259542695427954289542995430954319543295433954349543595436954379543895439954409544195442954439544495445954469544795448954499545095451954529545395454954559545695457954589545995460954619546295463954649546595466954679546895469954709547195472954739547495475954769547795478954799548095481954829548395484954859548695487954889548995490954919549295493954949549595496954979549895499955009550195502955039550495505955069550795508955099551095511955129551395514955159551695517955189551995520955219552295523955249552595526955279552895529955309553195532955339553495535955369553795538955399554095541955429554395544955459554695547955489554995550955519555295553955549555595556955579555895559955609556195562955639556495565955669556795568955699557095571955729557395574955759557695577955789557995580955819558295583955849558595586955879558895589955909559195592955939559495595955969559795598955999560095601956029560395604956059560695607956089560995610956119561295613956149561595616956179561895619956209562195622956239562495625956269562795628956299563095631956329563395634956359563695637956389563995640956419564295643956449564595646956479564895649956509565195652956539565495655956569565795658956599566095661956629566395664956659566695667956689566995670956719567295673956749567595676956779567895679956809568195682956839568495685956869568795688956899569095691956929569395694956959569695697956989569995700957019570295703957049570595706957079570895709957109571195712957139571495715957169571795718957199572095721957229572395724957259572695727957289572995730957319573295733957349573595736957379573895739957409574195742957439574495745957469574795748957499575095751957529575395754957559575695757957589575995760957619576295763957649576595766957679576895769957709577195772957739577495775957769577795778957799578095781957829578395784957859578695787957889578995790957919579295793957949579595796957979579895799958009580195802958039580495805958069580795808958099581095811958129581395814958159581695817958189581995820958219582295823958249582595826958279582895829958309583195832958339583495835958369583795838958399584095841958429584395844958459584695847958489584995850958519585295853958549585595856958579585895859958609586195862958639586495865958669586795868958699587095871958729587395874958759587695877958789587995880958819588295883958849588595886958879588895889958909589195892958939589495895958969589795898958999590095901959029590395904959059590695907959089590995910959119591295913959149591595916959179591895919959209592195922959239592495925959269592795928959299593095931959329593395934959359593695937959389593995940959419594295943959449594595946959479594895949959509595195952959539595495955959569595795958959599596095961959629596395964959659596695967959689596995970959719597295973959749597595976959779597895979959809598195982959839598495985959869598795988959899599095991959929599395994959959599695997959989599996000960019600296003960049600596006960079600896009960109601196012960139601496015960169601796018960199602096021960229602396024960259602696027960289602996030960319603296033960349603596036960379603896039960409604196042960439604496045960469604796048960499605096051960529605396054960559605696057960589605996060960619606296063960649606596066960679606896069960709607196072960739607496075960769607796078960799608096081960829608396084960859608696087960889608996090960919609296093960949609596096960979609896099961009610196102961039610496105961069610796108961099611096111961129611396114961159611696117961189611996120961219612296123961249612596126961279612896129961309613196132961339613496135961369613796138961399614096141961429614396144961459614696147961489614996150961519615296153961549615596156961579615896159961609616196162961639616496165961669616796168961699617096171961729617396174961759617696177961789617996180961819618296183961849618596186961879618896189961909619196192961939619496195961969619796198961999620096201962029620396204962059620696207962089620996210962119621296213962149621596216962179621896219962209622196222962239622496225962269622796228962299623096231962329623396234962359623696237962389623996240962419624296243962449624596246962479624896249962509625196252962539625496255962569625796258962599626096261962629626396264962659626696267962689626996270962719627296273962749627596276962779627896279962809628196282962839628496285962869628796288962899629096291962929629396294962959629696297962989629996300963019630296303963049630596306963079630896309963109631196312963139631496315963169631796318963199632096321963229632396324963259632696327963289632996330963319633296333963349633596336963379633896339963409634196342963439634496345963469634796348963499635096351963529635396354963559635696357963589635996360963619636296363963649636596366963679636896369963709637196372963739637496375963769637796378963799638096381963829638396384963859638696387963889638996390963919639296393963949639596396963979639896399964009640196402964039640496405964069640796408964099641096411964129641396414964159641696417964189641996420964219642296423964249642596426964279642896429964309643196432964339643496435964369643796438964399644096441964429644396444964459644696447964489644996450964519645296453964549645596456964579645896459964609646196462964639646496465964669646796468964699647096471964729647396474964759647696477964789647996480964819648296483964849648596486964879648896489964909649196492964939649496495964969649796498964999650096501965029650396504965059650696507965089650996510965119651296513965149651596516965179651896519965209652196522965239652496525965269652796528965299653096531965329653396534965359653696537965389653996540965419654296543965449654596546965479654896549965509655196552965539655496555965569655796558965599656096561965629656396564965659656696567965689656996570965719657296573965749657596576965779657896579965809658196582965839658496585965869658796588965899659096591965929659396594965959659696597965989659996600966019660296603966049660596606966079660896609966109661196612966139661496615966169661796618966199662096621966229662396624966259662696627966289662996630966319663296633966349663596636966379663896639966409664196642966439664496645966469664796648966499665096651966529665396654966559665696657966589665996660966619666296663966649666596666966679666896669966709667196672966739667496675966769667796678966799668096681966829668396684966859668696687966889668996690966919669296693966949669596696966979669896699967009670196702967039670496705967069670796708967099671096711967129671396714967159671696717967189671996720967219672296723967249672596726967279672896729967309673196732967339673496735967369673796738967399674096741967429674396744967459674696747967489674996750967519675296753967549675596756967579675896759967609676196762967639676496765967669676796768967699677096771967729677396774967759677696777967789677996780967819678296783967849678596786967879678896789967909679196792967939679496795967969679796798967999680096801968029680396804968059680696807968089680996810968119681296813968149681596816968179681896819968209682196822968239682496825968269682796828968299683096831968329683396834968359683696837968389683996840968419684296843968449684596846968479684896849968509685196852968539685496855968569685796858968599686096861968629686396864968659686696867968689686996870968719687296873968749687596876968779687896879968809688196882968839688496885968869688796888968899689096891968929689396894968959689696897968989689996900969019690296903969049690596906969079690896909969109691196912969139691496915969169691796918969199692096921969229692396924969259692696927969289692996930969319693296933969349693596936969379693896939969409694196942969439694496945969469694796948969499695096951969529695396954969559695696957969589695996960969619696296963969649696596966969679696896969969709697196972969739697496975969769697796978969799698096981969829698396984969859698696987969889698996990969919699296993969949699596996969979699896999970009700197002970039700497005970069700797008970099701097011970129701397014970159701697017970189701997020970219702297023970249702597026970279702897029970309703197032970339703497035970369703797038970399704097041970429704397044970459704697047970489704997050970519705297053970549705597056970579705897059970609706197062970639706497065970669706797068970699707097071970729707397074970759707697077970789707997080970819708297083970849708597086970879708897089970909709197092970939709497095970969709797098970999710097101971029710397104971059710697107971089710997110971119711297113971149711597116971179711897119971209712197122971239712497125971269712797128971299713097131971329713397134971359713697137971389713997140971419714297143971449714597146971479714897149971509715197152971539715497155971569715797158971599716097161971629716397164971659716697167971689716997170971719717297173971749717597176971779717897179971809718197182971839718497185971869718797188971899719097191971929719397194971959719697197971989719997200972019720297203972049720597206972079720897209972109721197212972139721497215972169721797218972199722097221972229722397224972259722697227972289722997230972319723297233972349723597236972379723897239972409724197242972439724497245972469724797248972499725097251972529725397254972559725697257972589725997260972619726297263972649726597266972679726897269972709727197272972739727497275972769727797278972799728097281972829728397284972859728697287972889728997290972919729297293972949729597296972979729897299973009730197302973039730497305973069730797308973099731097311973129731397314973159731697317973189731997320973219732297323973249732597326973279732897329973309733197332973339733497335973369733797338973399734097341973429734397344973459734697347973489734997350973519735297353973549735597356973579735897359973609736197362973639736497365973669736797368973699737097371973729737397374973759737697377973789737997380973819738297383973849738597386973879738897389973909739197392973939739497395973969739797398973999740097401974029740397404974059740697407974089740997410974119741297413974149741597416974179741897419974209742197422974239742497425974269742797428974299743097431974329743397434974359743697437974389743997440974419744297443974449744597446974479744897449974509745197452974539745497455974569745797458974599746097461974629746397464974659746697467974689746997470974719747297473974749747597476974779747897479974809748197482974839748497485974869748797488974899749097491974929749397494974959749697497974989749997500975019750297503975049750597506975079750897509975109751197512975139751497515975169751797518975199752097521975229752397524975259752697527975289752997530975319753297533975349753597536975379753897539975409754197542975439754497545975469754797548975499755097551975529755397554975559755697557975589755997560975619756297563975649756597566975679756897569975709757197572975739757497575975769757797578975799758097581975829758397584975859758697587975889758997590975919759297593975949759597596975979759897599976009760197602976039760497605976069760797608976099761097611976129761397614976159761697617976189761997620976219762297623976249762597626976279762897629976309763197632976339763497635976369763797638976399764097641976429764397644976459764697647976489764997650976519765297653976549765597656976579765897659976609766197662976639766497665976669766797668976699767097671976729767397674976759767697677976789767997680976819768297683976849768597686976879768897689976909769197692976939769497695976969769797698976999770097701977029770397704977059770697707977089770997710977119771297713977149771597716977179771897719977209772197722977239772497725977269772797728977299773097731977329773397734977359773697737977389773997740977419774297743977449774597746977479774897749977509775197752977539775497755977569775797758977599776097761977629776397764977659776697767977689776997770977719777297773977749777597776977779777897779977809778197782977839778497785977869778797788977899779097791977929779397794977959779697797977989779997800978019780297803978049780597806978079780897809978109781197812978139781497815978169781797818978199782097821978229782397824978259782697827978289782997830978319783297833978349783597836978379783897839978409784197842978439784497845978469784797848978499785097851978529785397854978559785697857978589785997860978619786297863978649786597866978679786897869978709787197872978739787497875978769787797878978799788097881978829788397884978859788697887978889788997890978919789297893978949789597896978979789897899979009790197902979039790497905979069790797908979099791097911979129791397914979159791697917979189791997920979219792297923979249792597926979279792897929979309793197932979339793497935979369793797938979399794097941979429794397944979459794697947979489794997950979519795297953979549795597956979579795897959979609796197962979639796497965979669796797968979699797097971979729797397974979759797697977979789797997980979819798297983979849798597986979879798897989979909799197992979939799497995979969799797998979999800098001980029800398004980059800698007980089800998010980119801298013980149801598016980179801898019980209802198022980239802498025980269802798028980299803098031980329803398034980359803698037980389803998040980419804298043980449804598046980479804898049980509805198052980539805498055980569805798058980599806098061980629806398064980659806698067980689806998070980719807298073980749807598076980779807898079980809808198082980839808498085980869808798088980899809098091980929809398094980959809698097980989809998100981019810298103981049810598106981079810898109981109811198112981139811498115981169811798118981199812098121981229812398124981259812698127981289812998130981319813298133981349813598136981379813898139981409814198142981439814498145981469814798148981499815098151981529815398154981559815698157981589815998160981619816298163981649816598166981679816898169981709817198172981739817498175981769817798178981799818098181981829818398184981859818698187981889818998190981919819298193981949819598196981979819898199982009820198202982039820498205982069820798208982099821098211982129821398214982159821698217982189821998220982219822298223982249822598226982279822898229982309823198232982339823498235982369823798238982399824098241982429824398244982459824698247982489824998250982519825298253982549825598256982579825898259982609826198262982639826498265982669826798268982699827098271982729827398274982759827698277982789827998280982819828298283982849828598286982879828898289982909829198292982939829498295982969829798298982999830098301983029830398304983059830698307983089830998310983119831298313983149831598316983179831898319983209832198322983239832498325983269832798328983299833098331983329833398334983359833698337983389833998340983419834298343983449834598346983479834898349983509835198352983539835498355983569835798358983599836098361983629836398364983659836698367983689836998370983719837298373983749837598376983779837898379983809838198382983839838498385983869838798388983899839098391983929839398394983959839698397983989839998400984019840298403984049840598406984079840898409984109841198412984139841498415984169841798418984199842098421984229842398424984259842698427984289842998430984319843298433984349843598436984379843898439984409844198442984439844498445984469844798448984499845098451984529845398454984559845698457984589845998460984619846298463984649846598466984679846898469984709847198472984739847498475984769847798478984799848098481984829848398484984859848698487984889848998490984919849298493984949849598496984979849898499985009850198502985039850498505985069850798508985099851098511985129851398514985159851698517985189851998520985219852298523985249852598526985279852898529985309853198532985339853498535985369853798538985399854098541985429854398544985459854698547985489854998550985519855298553985549855598556985579855898559985609856198562985639856498565985669856798568985699857098571985729857398574985759857698577985789857998580985819858298583985849858598586985879858898589985909859198592985939859498595985969859798598985999860098601986029860398604986059860698607986089860998610986119861298613986149861598616986179861898619986209862198622986239862498625986269862798628986299863098631986329863398634986359863698637986389863998640986419864298643986449864598646986479864898649986509865198652986539865498655986569865798658986599866098661986629866398664986659866698667986689866998670986719867298673986749867598676986779867898679986809868198682986839868498685986869868798688986899869098691986929869398694986959869698697986989869998700987019870298703987049870598706987079870898709987109871198712987139871498715987169871798718987199872098721987229872398724987259872698727987289872998730987319873298733987349873598736987379873898739987409874198742987439874498745987469874798748987499875098751987529875398754987559875698757987589875998760987619876298763987649876598766987679876898769987709877198772987739877498775987769877798778987799878098781987829878398784987859878698787987889878998790987919879298793987949879598796987979879898799988009880198802988039880498805988069880798808988099881098811988129881398814988159881698817988189881998820988219882298823988249882598826988279882898829988309883198832988339883498835988369883798838988399884098841988429884398844988459884698847988489884998850988519885298853988549885598856988579885898859988609886198862988639886498865988669886798868988699887098871988729887398874988759887698877988789887998880988819888298883988849888598886988879888898889988909889198892988939889498895988969889798898988999890098901989029890398904989059890698907989089890998910989119891298913989149891598916989179891898919989209892198922989239892498925989269892798928989299893098931989329893398934989359893698937989389893998940989419894298943989449894598946989479894898949989509895198952989539895498955989569895798958989599896098961989629896398964989659896698967989689896998970989719897298973989749897598976989779897898979989809898198982989839898498985989869898798988989899899098991989929899398994989959899698997989989899999000990019900299003990049900599006990079900899009990109901199012990139901499015990169901799018990199902099021990229902399024990259902699027990289902999030990319903299033990349903599036990379903899039990409904199042990439904499045990469904799048990499905099051990529905399054990559905699057990589905999060990619906299063990649906599066990679906899069990709907199072990739907499075990769907799078990799908099081990829908399084990859908699087990889908999090990919909299093990949909599096990979909899099991009910199102991039910499105991069910799108991099911099111991129911399114991159911699117991189911999120991219912299123991249912599126991279912899129991309913199132991339913499135991369913799138991399914099141991429914399144991459914699147991489914999150991519915299153991549915599156991579915899159991609916199162991639916499165991669916799168991699917099171991729917399174991759917699177991789917999180991819918299183991849918599186991879918899189991909919199192991939919499195991969919799198991999920099201992029920399204992059920699207992089920999210992119921299213992149921599216992179921899219992209922199222992239922499225992269922799228992299923099231992329923399234992359923699237992389923999240992419924299243992449924599246992479924899249992509925199252992539925499255992569925799258992599926099261992629926399264992659926699267992689926999270992719927299273992749927599276992779927899279992809928199282992839928499285992869928799288992899929099291992929929399294992959929699297992989929999300993019930299303993049930599306993079930899309993109931199312993139931499315993169931799318993199932099321993229932399324993259932699327993289932999330993319933299333993349933599336993379933899339993409934199342993439934499345993469934799348993499935099351993529935399354993559935699357993589935999360993619936299363993649936599366993679936899369993709937199372993739937499375993769937799378993799938099381993829938399384993859938699387993889938999390993919939299393993949939599396993979939899399994009940199402994039940499405994069940799408994099941099411994129941399414994159941699417994189941999420994219942299423994249942599426994279942899429994309943199432994339943499435994369943799438994399944099441994429944399444994459944699447994489944999450994519945299453994549945599456994579945899459994609946199462994639946499465994669946799468994699947099471994729947399474994759947699477994789947999480994819948299483994849948599486994879948899489994909949199492994939949499495994969949799498994999950099501995029950399504995059950699507995089950999510995119951299513995149951599516995179951899519995209952199522995239952499525995269952799528995299953099531995329953399534995359953699537995389953999540995419954299543995449954599546995479954899549995509955199552995539955499555995569955799558995599956099561995629956399564995659956699567995689956999570995719957299573995749957599576995779957899579995809958199582995839958499585995869958799588995899959099591995929959399594995959959699597995989959999600996019960299603996049960599606996079960899609996109961199612996139961499615996169961799618996199962099621996229962399624996259962699627996289962999630996319963299633996349963599636996379963899639996409964199642996439964499645996469964799648996499965099651996529965399654996559965699657996589965999660996619966299663996649966599666996679966899669996709967199672996739967499675996769967799678996799968099681996829968399684996859968699687996889968999690996919969299693996949969599696996979969899699997009970199702997039970499705997069970799708997099971099711997129971399714997159971699717997189971999720997219972299723997249972599726997279972899729997309973199732997339973499735997369973799738997399974099741997429974399744997459974699747997489974999750997519975299753997549975599756997579975899759997609976199762997639976499765997669976799768997699977099771997729977399774997759977699777997789977999780997819978299783997849978599786997879978899789997909979199792997939979499795997969979799798997999980099801998029980399804998059980699807998089980999810998119981299813998149981599816998179981899819998209982199822998239982499825998269982799828998299983099831998329983399834998359983699837998389983999840998419984299843998449984599846998479984899849998509985199852998539985499855998569985799858998599986099861998629986399864998659986699867998689986999870998719987299873998749987599876998779987899879998809988199882998839988499885998869988799888998899989099891998929989399894998959989699897998989989999900999019990299903999049990599906999079990899909999109991199912999139991499915999169991799918999199992099921999229992399924999259992699927999289992999930999319993299933999349993599936999379993899939999409994199942999439994499945999469994799948999499995099951999529995399954999559995699957999589995999960999619996299963999649996599966999679996899969999709997199972999739997499975999769997799978999799998099981999829998399984999859998699987999889998999990999919999299993999949999599996999979999899999100000100001100002100003100004100005100006100007100008100009100010100011100012100013100014100015100016100017100018100019100020100021100022100023100024100025100026100027100028100029100030100031100032100033100034100035100036100037100038100039100040100041100042100043100044100045100046100047100048100049100050100051100052100053100054100055100056100057100058100059100060100061100062100063100064100065100066100067100068100069100070100071100072100073100074100075100076100077100078100079100080100081100082100083100084100085100086100087100088100089100090100091100092100093100094100095100096100097100098100099100100100101100102100103100104100105100106100107100108100109100110100111100112100113100114100115100116100117100118100119100120100121100122100123100124100125100126100127100128100129100130100131100132100133100134100135100136100137100138100139100140100141100142100143100144100145100146100147100148100149100150100151100152100153100154100155100156100157100158100159100160100161100162100163100164100165100166100167100168100169100170100171100172100173100174100175100176100177100178100179100180100181100182100183100184100185100186100187100188100189100190100191100192100193100194100195100196100197100198100199100200100201100202100203100204100205100206100207100208100209100210100211100212100213100214100215100216100217100218100219100220100221100222100223100224100225100226100227100228100229100230100231100232100233100234100235100236100237100238100239100240100241100242100243100244100245100246100247100248100249100250100251100252100253100254100255100256100257100258100259100260100261100262100263100264100265100266100267100268100269100270100271100272100273100274100275100276100277100278100279100280100281100282100283100284100285100286100287100288100289100290100291100292100293100294100295100296100297100298100299100300100301100302100303100304100305100306100307100308100309100310100311100312100313100314100315100316100317100318100319100320100321100322100323100324100325100326100327100328100329100330100331100332100333100334100335100336100337100338100339100340100341100342100343100344100345100346100347100348100349100350100351100352100353100354100355100356100357100358100359100360100361100362100363100364100365100366100367100368100369100370100371100372100373100374100375100376100377100378100379100380100381100382100383100384100385100386100387100388100389100390100391100392100393100394100395100396100397100398100399100400100401100402100403100404100405100406100407100408100409100410100411100412100413100414100415100416100417100418100419100420100421100422100423100424100425100426100427100428100429100430100431100432100433100434100435100436100437100438100439100440100441100442100443100444100445100446100447100448100449100450100451100452100453100454100455100456100457100458100459100460100461100462100463100464100465100466100467100468100469100470100471100472100473100474100475100476100477100478100479100480100481100482100483100484100485100486100487100488100489100490100491100492100493100494100495100496100497100498100499100500100501100502100503100504100505100506100507100508100509100510100511100512100513100514100515100516100517100518100519100520100521100522100523100524100525100526100527100528100529100530100531100532100533100534100535100536100537100538100539100540100541100542100543100544100545100546100547100548100549100550100551100552100553100554100555100556100557100558100559100560100561100562100563100564100565100566100567100568100569100570100571100572100573100574100575100576100577100578100579100580100581100582100583100584100585100586100587100588100589100590100591100592100593100594100595100596100597100598100599100600100601100602100603100604100605100606100607100608100609100610100611100612100613100614100615100616100617100618100619100620100621100622100623100624100625100626100627100628100629100630100631100632100633100634100635100636100637100638100639100640100641100642100643100644100645100646100647100648100649100650100651100652100653100654100655100656100657100658100659100660100661100662100663100664100665100666100667100668100669100670100671100672100673100674100675100676100677100678100679100680100681100682100683100684100685100686100687100688100689100690100691100692100693100694100695100696100697100698100699100700100701100702100703100704100705100706100707100708100709100710100711100712100713100714100715100716100717100718100719100720100721100722100723100724100725100726100727100728100729100730100731100732100733100734100735100736100737100738100739100740100741100742100743100744100745100746100747100748100749100750100751100752100753100754100755100756100757100758100759100760100761100762100763100764100765100766100767100768100769100770100771100772100773100774100775100776100777100778100779100780100781100782100783100784100785100786100787100788100789100790100791100792100793100794100795100796100797100798100799100800100801100802100803100804100805100806100807100808100809100810100811100812100813100814100815100816100817100818100819100820100821100822100823100824100825100826100827100828100829100830100831100832100833100834100835100836100837100838100839100840100841100842100843100844100845100846100847100848100849100850100851100852100853100854100855100856100857100858100859100860100861100862100863100864100865100866100867100868100869100870100871100872100873100874100875100876100877100878100879100880100881100882100883100884100885100886100887100888100889100890100891100892100893100894100895100896100897100898100899100900100901100902100903100904100905100906100907100908100909100910100911100912100913100914100915100916100917100918100919100920100921100922100923100924100925100926100927100928100929100930100931100932100933100934100935100936100937100938100939100940100941100942100943100944100945100946100947100948100949100950100951100952100953100954100955100956100957100958100959100960100961100962100963100964100965100966100967100968100969100970100971100972100973100974100975100976100977100978100979100980100981100982100983100984100985100986100987100988100989100990100991100992100993100994100995100996100997100998100999101000101001101002101003101004101005101006101007101008101009101010101011101012101013101014101015101016101017101018101019101020101021101022101023101024101025101026101027101028101029101030101031101032101033101034101035101036101037101038101039101040101041101042101043101044101045101046101047101048101049101050101051101052101053101054101055101056101057101058101059101060101061101062101063101064101065101066101067101068101069101070101071101072101073101074101075101076101077101078101079101080101081101082101083101084101085101086101087101088101089101090101091101092101093101094101095101096101097101098101099101100101101101102101103101104101105101106101107101108101109101110101111101112101113101114101115101116101117101118101119101120101121101122101123101124101125101126101127101128101129101130101131101132101133101134101135101136101137101138101139101140101141101142101143101144101145101146101147101148101149101150101151101152101153101154101155101156101157101158101159101160101161101162101163101164101165101166101167101168101169101170101171101172101173101174101175101176101177101178101179101180101181101182101183101184101185101186101187101188101189101190101191101192101193101194101195101196101197101198101199101200101201101202101203101204101205101206101207101208101209101210101211101212101213101214101215101216101217101218101219101220101221101222101223101224101225101226101227101228101229101230101231101232101233101234101235101236101237101238101239101240101241101242101243101244101245101246101247101248101249101250101251101252101253101254101255101256101257101258101259101260101261101262101263101264101265101266101267101268101269101270101271101272101273101274101275101276101277101278101279101280101281101282101283101284101285101286101287101288101289101290101291101292101293101294101295101296101297101298101299101300101301101302101303101304101305101306101307101308101309101310101311101312101313101314101315101316101317101318101319101320101321101322101323101324101325101326101327101328101329101330101331101332101333101334101335101336101337101338101339101340101341101342101343101344101345101346101347101348101349101350101351101352101353101354101355101356101357101358101359101360101361101362101363101364101365101366101367101368101369101370101371101372101373101374101375101376101377101378101379101380101381101382101383101384101385101386101387101388101389101390101391101392101393101394101395101396101397101398101399101400101401101402101403101404101405101406101407101408101409101410101411101412101413101414101415101416101417101418101419101420101421101422101423101424101425101426101427101428101429101430101431101432101433101434101435101436101437101438101439101440101441101442101443101444101445101446101447101448101449101450101451101452101453101454101455101456101457101458101459101460101461101462101463101464101465101466101467101468101469101470101471101472101473101474101475101476101477101478101479101480101481101482101483101484101485101486101487101488101489101490101491101492101493101494101495101496101497101498101499101500101501101502101503101504101505101506101507101508101509101510101511101512101513101514101515101516101517101518101519101520101521101522101523101524101525101526101527101528101529101530101531101532101533101534101535101536101537101538101539101540101541101542101543101544101545101546101547101548101549101550101551101552101553101554101555101556101557101558101559101560101561101562101563101564101565101566101567101568101569101570101571101572101573101574101575101576101577101578101579101580101581101582101583101584101585101586101587101588101589101590101591101592101593101594101595101596101597101598101599101600101601101602101603101604101605101606101607101608101609101610101611101612101613101614101615101616101617101618101619101620101621101622101623101624101625101626101627101628101629101630101631101632101633101634101635101636101637101638101639101640101641101642101643101644101645101646101647101648101649101650101651101652101653101654101655101656101657101658101659101660101661101662101663101664101665101666101667101668101669101670101671101672101673101674101675101676101677101678101679101680101681101682101683101684101685101686101687101688101689101690101691101692101693101694101695101696101697101698101699101700101701101702101703101704101705101706101707101708101709101710101711101712101713101714101715101716101717101718101719101720101721101722101723101724101725101726101727101728101729101730101731101732101733101734101735101736101737101738101739101740101741101742101743101744101745101746101747101748101749101750101751101752101753101754101755101756101757101758101759101760101761101762101763101764101765101766101767101768101769101770101771101772101773101774101775101776101777101778101779101780101781101782101783101784101785101786101787101788101789101790101791101792101793101794101795101796101797101798101799101800101801101802101803101804101805101806101807101808101809101810101811101812101813101814101815101816101817101818101819101820101821101822101823101824101825101826101827101828101829101830101831101832101833101834101835101836101837101838101839101840101841101842101843101844101845101846101847101848101849101850101851101852101853101854101855101856101857101858101859101860101861101862101863101864101865101866101867101868101869101870101871101872101873101874101875101876101877101878101879101880101881101882101883101884101885101886101887101888101889101890101891101892101893101894101895101896101897101898101899101900101901101902101903101904101905101906101907101908101909101910101911101912101913101914101915101916101917101918101919101920101921101922101923101924101925101926101927101928101929101930101931101932101933101934101935101936101937101938101939101940101941101942101943101944101945101946101947101948101949101950101951101952101953101954101955101956101957101958101959101960101961101962101963101964101965101966101967101968101969101970101971101972101973101974101975101976101977101978101979101980101981101982101983101984101985101986101987101988101989101990101991101992101993101994101995101996101997101998101999102000102001102002102003102004102005102006102007102008102009102010102011102012102013102014102015102016102017102018102019102020102021102022102023102024102025102026102027102028102029102030102031102032102033102034102035102036102037102038102039102040102041102042102043102044102045102046102047102048102049102050102051102052102053102054102055102056102057102058102059102060102061102062102063102064102065102066102067102068102069102070102071102072102073102074102075102076102077102078102079102080102081102082102083102084102085102086102087102088102089102090102091102092102093102094102095102096102097102098102099102100102101102102102103102104102105102106102107102108102109102110102111102112102113102114102115102116102117102118102119102120102121102122102123102124102125102126102127102128102129102130102131102132102133102134102135102136102137102138102139102140102141102142102143102144102145102146102147102148102149102150102151102152102153102154102155102156102157102158102159102160102161102162102163102164102165102166102167102168102169102170102171102172102173102174102175102176102177102178102179102180102181102182102183102184102185102186102187102188102189102190102191102192102193102194102195102196102197102198102199102200102201102202102203102204102205102206102207102208102209102210102211102212102213102214102215102216102217102218102219102220102221102222102223102224102225102226102227102228102229102230102231102232102233102234102235102236102237102238102239102240102241102242102243102244102245102246102247102248102249102250102251102252102253102254102255102256102257102258102259102260102261102262102263102264102265102266102267102268102269102270102271102272102273102274102275102276102277102278102279102280102281102282102283102284102285102286102287102288102289102290102291102292102293102294102295102296102297102298102299102300102301102302102303102304102305102306102307102308102309102310102311102312102313102314102315102316102317102318102319102320102321102322102323102324102325102326102327102328102329102330102331102332102333102334102335102336102337102338102339102340102341102342102343102344102345102346102347102348102349102350102351102352102353102354102355102356102357102358102359102360102361102362102363102364102365102366102367102368102369102370102371102372102373102374102375102376102377102378102379102380102381102382102383102384102385102386102387102388102389102390102391102392102393102394102395102396102397102398102399102400102401102402102403102404102405102406102407102408102409102410102411102412102413102414102415102416102417102418102419102420102421102422102423102424102425102426102427102428102429102430102431102432102433102434102435102436102437102438102439102440102441102442102443102444102445102446102447102448102449102450102451102452102453102454102455102456102457102458102459102460102461102462102463102464102465102466102467102468102469102470102471102472102473102474102475102476102477102478102479102480102481102482102483102484102485102486102487102488102489102490102491102492102493102494102495102496102497102498102499102500102501102502102503102504102505102506102507102508102509102510102511102512102513102514102515102516102517102518102519102520102521102522102523102524102525102526102527102528102529102530102531102532102533102534102535102536102537102538102539102540102541102542102543102544102545102546102547102548102549102550102551102552102553102554102555102556102557102558102559102560102561102562102563102564102565102566102567102568102569102570102571102572102573102574102575102576102577102578102579102580102581102582102583102584102585102586102587102588102589102590102591102592102593102594102595102596102597102598102599102600102601102602102603102604102605102606102607102608102609102610102611102612102613102614102615102616102617102618102619102620102621102622102623102624102625102626102627102628102629102630102631102632102633102634102635102636102637102638102639102640102641102642102643102644102645102646102647102648102649102650102651102652102653102654102655102656102657102658102659102660102661102662102663102664102665102666102667102668102669102670102671102672102673102674102675102676102677102678102679102680102681102682102683102684102685102686102687102688102689102690102691102692102693102694102695102696102697102698102699102700102701102702102703102704102705102706102707102708102709102710102711102712102713102714102715102716102717102718102719102720102721102722102723102724102725102726102727102728102729102730102731102732102733102734102735102736102737102738102739102740102741102742102743102744102745102746102747102748102749102750102751102752102753102754102755102756102757102758102759102760102761102762102763102764102765102766102767102768102769102770102771102772102773102774102775102776102777102778102779102780102781102782102783102784102785102786102787102788102789102790102791102792102793102794102795102796102797102798102799102800102801102802102803102804102805102806102807102808102809102810102811102812102813102814102815102816102817102818102819102820102821102822102823102824102825102826102827102828102829102830102831102832102833102834102835102836102837102838102839102840102841102842102843102844102845102846102847102848102849102850102851102852102853102854102855102856102857102858102859102860102861102862102863102864102865102866102867102868102869102870102871102872102873102874102875102876102877102878102879102880102881102882102883102884102885102886102887102888102889102890102891102892102893102894102895102896102897102898102899102900102901102902102903102904102905102906102907102908102909102910102911102912102913102914102915102916102917102918102919102920102921102922102923102924 |
- /*!
- *
- * iclient-leaflet.(https://iclient.supermap.io)
- * Copyright© 2000 - 2022 SuperMap Software Co.Ltd
- * license: Apache-2.0
- * version: v11.0.1
- *
- */
- /******/ (() => { // webpackBootstrap
- /******/ var __webpack_modules__ = ({
- /***/ 550:
- /***/ ((module) => {
- "use strict";
- module.exports = Point;
- /**
- * A standalone point geometry with useful accessor, comparison, and
- * modification methods.
- *
- * @class Point
- * @param {Number} x the x-coordinate. this could be longitude or screen
- * pixels, or any other sort of unit.
- * @param {Number} y the y-coordinate. this could be latitude or screen
- * pixels, or any other sort of unit.
- * @example
- * var point = new Point(-77, 38);
- */
- function Point(x, y) {
- this.x = x;
- this.y = y;
- }
- Point.prototype = {
- /**
- * Clone this point, returning a new point that can be modified
- * without affecting the old one.
- * @return {Point} the clone
- */
- clone: function() { return new Point(this.x, this.y); },
- /**
- * Add this point's x & y coordinates to another point,
- * yielding a new point.
- * @param {Point} p the other point
- * @return {Point} output point
- */
- add: function(p) { return this.clone()._add(p); },
- /**
- * Subtract this point's x & y coordinates to from point,
- * yielding a new point.
- * @param {Point} p the other point
- * @return {Point} output point
- */
- sub: function(p) { return this.clone()._sub(p); },
- /**
- * Multiply this point's x & y coordinates by point,
- * yielding a new point.
- * @param {Point} p the other point
- * @return {Point} output point
- */
- multByPoint: function(p) { return this.clone()._multByPoint(p); },
- /**
- * Divide this point's x & y coordinates by point,
- * yielding a new point.
- * @param {Point} p the other point
- * @return {Point} output point
- */
- divByPoint: function(p) { return this.clone()._divByPoint(p); },
- /**
- * Multiply this point's x & y coordinates by a factor,
- * yielding a new point.
- * @param {Point} k factor
- * @return {Point} output point
- */
- mult: function(k) { return this.clone()._mult(k); },
- /**
- * Divide this point's x & y coordinates by a factor,
- * yielding a new point.
- * @param {Point} k factor
- * @return {Point} output point
- */
- div: function(k) { return this.clone()._div(k); },
- /**
- * Rotate this point around the 0, 0 origin by an angle a,
- * given in radians
- * @param {Number} a angle to rotate around, in radians
- * @return {Point} output point
- */
- rotate: function(a) { return this.clone()._rotate(a); },
- /**
- * Rotate this point around p point by an angle a,
- * given in radians
- * @param {Number} a angle to rotate around, in radians
- * @param {Point} p Point to rotate around
- * @return {Point} output point
- */
- rotateAround: function(a,p) { return this.clone()._rotateAround(a,p); },
- /**
- * Multiply this point by a 4x1 transformation matrix
- * @param {Array<Number>} m transformation matrix
- * @return {Point} output point
- */
- matMult: function(m) { return this.clone()._matMult(m); },
- /**
- * Calculate this point but as a unit vector from 0, 0, meaning
- * that the distance from the resulting point to the 0, 0
- * coordinate will be equal to 1 and the angle from the resulting
- * point to the 0, 0 coordinate will be the same as before.
- * @return {Point} unit vector point
- */
- unit: function() { return this.clone()._unit(); },
- /**
- * Compute a perpendicular point, where the new y coordinate
- * is the old x coordinate and the new x coordinate is the old y
- * coordinate multiplied by -1
- * @return {Point} perpendicular point
- */
- perp: function() { return this.clone()._perp(); },
- /**
- * Return a version of this point with the x & y coordinates
- * rounded to integers.
- * @return {Point} rounded point
- */
- round: function() { return this.clone()._round(); },
- /**
- * Return the magitude of this point: this is the Euclidean
- * distance from the 0, 0 coordinate to this point's x and y
- * coordinates.
- * @return {Number} magnitude
- */
- mag: function() {
- return Math.sqrt(this.x * this.x + this.y * this.y);
- },
- /**
- * Judge whether this point is equal to another point, returning
- * true or false.
- * @param {Point} other the other point
- * @return {boolean} whether the points are equal
- */
- equals: function(other) {
- return this.x === other.x &&
- this.y === other.y;
- },
- /**
- * Calculate the distance from this point to another point
- * @param {Point} p the other point
- * @return {Number} distance
- */
- dist: function(p) {
- return Math.sqrt(this.distSqr(p));
- },
- /**
- * Calculate the distance from this point to another point,
- * without the square root step. Useful if you're comparing
- * relative distances.
- * @param {Point} p the other point
- * @return {Number} distance
- */
- distSqr: function(p) {
- var dx = p.x - this.x,
- dy = p.y - this.y;
- return dx * dx + dy * dy;
- },
- /**
- * Get the angle from the 0, 0 coordinate to this point, in radians
- * coordinates.
- * @return {Number} angle
- */
- angle: function() {
- return Math.atan2(this.y, this.x);
- },
- /**
- * Get the angle from this point to another point, in radians
- * @param {Point} b the other point
- * @return {Number} angle
- */
- angleTo: function(b) {
- return Math.atan2(this.y - b.y, this.x - b.x);
- },
- /**
- * Get the angle between this point and another point, in radians
- * @param {Point} b the other point
- * @return {Number} angle
- */
- angleWith: function(b) {
- return this.angleWithSep(b.x, b.y);
- },
- /*
- * Find the angle of the two vectors, solving the formula for
- * the cross product a x b = |a||b|sin(θ) for θ.
- * @param {Number} x the x-coordinate
- * @param {Number} y the y-coordinate
- * @return {Number} the angle in radians
- */
- angleWithSep: function(x, y) {
- return Math.atan2(
- this.x * y - this.y * x,
- this.x * x + this.y * y);
- },
- _matMult: function(m) {
- var x = m[0] * this.x + m[1] * this.y,
- y = m[2] * this.x + m[3] * this.y;
- this.x = x;
- this.y = y;
- return this;
- },
- _add: function(p) {
- this.x += p.x;
- this.y += p.y;
- return this;
- },
- _sub: function(p) {
- this.x -= p.x;
- this.y -= p.y;
- return this;
- },
- _mult: function(k) {
- this.x *= k;
- this.y *= k;
- return this;
- },
- _div: function(k) {
- this.x /= k;
- this.y /= k;
- return this;
- },
- _multByPoint: function(p) {
- this.x *= p.x;
- this.y *= p.y;
- return this;
- },
- _divByPoint: function(p) {
- this.x /= p.x;
- this.y /= p.y;
- return this;
- },
- _unit: function() {
- this._div(this.mag());
- return this;
- },
- _perp: function() {
- var y = this.y;
- this.y = this.x;
- this.x = -y;
- return this;
- },
- _rotate: function(angle) {
- var cos = Math.cos(angle),
- sin = Math.sin(angle),
- x = cos * this.x - sin * this.y,
- y = sin * this.x + cos * this.y;
- this.x = x;
- this.y = y;
- return this;
- },
- _rotateAround: function(angle, p) {
- var cos = Math.cos(angle),
- sin = Math.sin(angle),
- x = p.x + cos * (this.x - p.x) - sin * (this.y - p.y),
- y = p.y + sin * (this.x - p.x) + cos * (this.y - p.y);
- this.x = x;
- this.y = y;
- return this;
- },
- _round: function() {
- this.x = Math.round(this.x);
- this.y = Math.round(this.y);
- return this;
- }
- };
- /**
- * Construct a point from an array if necessary, otherwise if the input
- * is already a Point, or an unknown type, return it unchanged
- * @param {Array<Number>|Point|*} a any kind of input value
- * @return {Point} constructed point, or passed-through value.
- * @example
- * // this
- * var point = Point.convert([0, 1]);
- * // is equivalent to
- * var point = new Point(0, 1);
- */
- Point.convert = function (a) {
- if (a instanceof Point) {
- return a;
- }
- if (Array.isArray(a)) {
- return new Point(a[0], a[1]);
- }
- return a;
- };
- /***/ }),
- /***/ 929:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- module.exports.VectorTile = __webpack_require__(779);
- /* unused reexport */ __webpack_require__(24);
- /* unused reexport */ __webpack_require__(701);
- /***/ }),
- /***/ 779:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- "use strict";
- var VectorTileLayer = __webpack_require__(701);
- module.exports = VectorTile;
- function VectorTile(pbf, end) {
- this.layers = pbf.readFields(readTile, {}, end);
- }
- function readTile(tag, layers, pbf) {
- if (tag === 3) {
- var layer = new VectorTileLayer(pbf, pbf.readVarint() + pbf.pos);
- if (layer.length) layers[layer.name] = layer;
- }
- }
- /***/ }),
- /***/ 24:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- "use strict";
- var Point = __webpack_require__(550);
- module.exports = VectorTileFeature;
- function VectorTileFeature(pbf, end, extent, keys, values) {
- // Public
- this.properties = {};
- this.extent = extent;
- this.type = 0;
- // Private
- this._pbf = pbf;
- this._geometry = -1;
- this._keys = keys;
- this._values = values;
- pbf.readFields(readFeature, this, end);
- }
- function readFeature(tag, feature, pbf) {
- if (tag == 1) feature.id = pbf.readVarint();
- else if (tag == 2) readTag(pbf, feature);
- else if (tag == 3) feature.type = pbf.readVarint();
- else if (tag == 4) feature._geometry = pbf.pos;
- }
- function readTag(pbf, feature) {
- var end = pbf.readVarint() + pbf.pos;
- while (pbf.pos < end) {
- var key = feature._keys[pbf.readVarint()],
- value = feature._values[pbf.readVarint()];
- feature.properties[key] = value;
- }
- }
- VectorTileFeature.types = ['Unknown', 'Point', 'LineString', 'Polygon'];
- VectorTileFeature.prototype.loadGeometry = function() {
- var pbf = this._pbf;
- pbf.pos = this._geometry;
- var end = pbf.readVarint() + pbf.pos,
- cmd = 1,
- length = 0,
- x = 0,
- y = 0,
- lines = [],
- line;
- while (pbf.pos < end) {
- if (length <= 0) {
- var cmdLen = pbf.readVarint();
- cmd = cmdLen & 0x7;
- length = cmdLen >> 3;
- }
- length--;
- if (cmd === 1 || cmd === 2) {
- x += pbf.readSVarint();
- y += pbf.readSVarint();
- if (cmd === 1) { // moveTo
- if (line) lines.push(line);
- line = [];
- }
- line.push(new Point(x, y));
- } else if (cmd === 7) {
- // Workaround for https://github.com/mapbox/mapnik-vector-tile/issues/90
- if (line) {
- line.push(line[0].clone()); // closePolygon
- }
- } else {
- throw new Error('unknown command ' + cmd);
- }
- }
- if (line) lines.push(line);
- return lines;
- };
- VectorTileFeature.prototype.bbox = function() {
- var pbf = this._pbf;
- pbf.pos = this._geometry;
- var end = pbf.readVarint() + pbf.pos,
- cmd = 1,
- length = 0,
- x = 0,
- y = 0,
- x1 = Infinity,
- x2 = -Infinity,
- y1 = Infinity,
- y2 = -Infinity;
- while (pbf.pos < end) {
- if (length <= 0) {
- var cmdLen = pbf.readVarint();
- cmd = cmdLen & 0x7;
- length = cmdLen >> 3;
- }
- length--;
- if (cmd === 1 || cmd === 2) {
- x += pbf.readSVarint();
- y += pbf.readSVarint();
- if (x < x1) x1 = x;
- if (x > x2) x2 = x;
- if (y < y1) y1 = y;
- if (y > y2) y2 = y;
- } else if (cmd !== 7) {
- throw new Error('unknown command ' + cmd);
- }
- }
- return [x1, y1, x2, y2];
- };
- VectorTileFeature.prototype.toGeoJSON = function(x, y, z) {
- var size = this.extent * Math.pow(2, z),
- x0 = this.extent * x,
- y0 = this.extent * y,
- coords = this.loadGeometry(),
- type = VectorTileFeature.types[this.type],
- i, j;
- function project(line) {
- for (var j = 0; j < line.length; j++) {
- var p = line[j], y2 = 180 - (p.y + y0) * 360 / size;
- line[j] = [
- (p.x + x0) * 360 / size - 180,
- 360 / Math.PI * Math.atan(Math.exp(y2 * Math.PI / 180)) - 90
- ];
- }
- }
- switch (this.type) {
- case 1:
- var points = [];
- for (i = 0; i < coords.length; i++) {
- points[i] = coords[i][0];
- }
- coords = points;
- project(coords);
- break;
- case 2:
- for (i = 0; i < coords.length; i++) {
- project(coords[i]);
- }
- break;
- case 3:
- coords = classifyRings(coords);
- for (i = 0; i < coords.length; i++) {
- for (j = 0; j < coords[i].length; j++) {
- project(coords[i][j]);
- }
- }
- break;
- }
- if (coords.length === 1) {
- coords = coords[0];
- } else {
- type = 'Multi' + type;
- }
- var result = {
- type: "Feature",
- geometry: {
- type: type,
- coordinates: coords
- },
- properties: this.properties
- };
- if ('id' in this) {
- result.id = this.id;
- }
- return result;
- };
- // classifies an array of rings into polygons with outer rings and holes
- function classifyRings(rings) {
- var len = rings.length;
- if (len <= 1) return [rings];
- var polygons = [],
- polygon,
- ccw;
- for (var i = 0; i < len; i++) {
- var area = signedArea(rings[i]);
- if (area === 0) continue;
- if (ccw === undefined) ccw = area < 0;
- if (ccw === area < 0) {
- if (polygon) polygons.push(polygon);
- polygon = [rings[i]];
- } else {
- polygon.push(rings[i]);
- }
- }
- if (polygon) polygons.push(polygon);
- return polygons;
- }
- function signedArea(ring) {
- var sum = 0;
- for (var i = 0, len = ring.length, j = len - 1, p1, p2; i < len; j = i++) {
- p1 = ring[i];
- p2 = ring[j];
- sum += (p2.x - p1.x) * (p1.y + p2.y);
- }
- return sum;
- }
- /***/ }),
- /***/ 701:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- "use strict";
- var VectorTileFeature = __webpack_require__(24);
- module.exports = VectorTileLayer;
- function VectorTileLayer(pbf, end) {
- // Public
- this.version = 1;
- this.name = null;
- this.extent = 4096;
- this.length = 0;
- // Private
- this._pbf = pbf;
- this._keys = [];
- this._values = [];
- this._features = [];
- pbf.readFields(readLayer, this, end);
- this.length = this._features.length;
- }
- function readLayer(tag, layer, pbf) {
- if (tag === 15) layer.version = pbf.readVarint();
- else if (tag === 1) layer.name = pbf.readString();
- else if (tag === 5) layer.extent = pbf.readVarint();
- else if (tag === 2) layer._features.push(pbf.pos);
- else if (tag === 3) layer._keys.push(pbf.readString());
- else if (tag === 4) layer._values.push(readValueMessage(pbf));
- }
- function readValueMessage(pbf) {
- var value = null,
- end = pbf.readVarint() + pbf.pos;
- while (pbf.pos < end) {
- var tag = pbf.readVarint() >> 3;
- value = tag === 1 ? pbf.readString() :
- tag === 2 ? pbf.readFloat() :
- tag === 3 ? pbf.readDouble() :
- tag === 4 ? pbf.readVarint64() :
- tag === 5 ? pbf.readVarint() :
- tag === 6 ? pbf.readSVarint() :
- tag === 7 ? pbf.readBoolean() : null;
- }
- return value;
- }
- // return feature `i` from this layer as a `VectorTileFeature`
- VectorTileLayer.prototype.feature = function(i) {
- if (i < 0 || i >= this._features.length) throw new Error('feature index out of bounds');
- this._pbf.pos = this._features[i];
- var end = this._pbf.readVarint() + this._pbf.pos;
- return new VectorTileFeature(this._pbf, end, this.extent, this._keys, this._values);
- };
- /***/ }),
- /***/ 693:
- /***/ (function(module) {
- (function(self) {
- 'use strict';
- // if __disableNativeFetch is set to true, the it will always polyfill fetch
- // with Ajax.
- if (!self.__disableNativeFetch && self.fetch) {
- return
- }
- function normalizeName(name) {
- if (typeof name !== 'string') {
- name = String(name)
- }
- if (/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(name)) {
- throw new TypeError('Invalid character in header field name')
- }
- return name.toLowerCase()
- }
- function normalizeValue(value) {
- if (typeof value !== 'string') {
- value = String(value)
- }
- return value
- }
- function Headers(headers) {
- this.map = {}
- if (headers instanceof Headers) {
- headers.forEach(function(value, name) {
- this.append(name, value)
- }, this)
- } else if (headers) {
- Object.getOwnPropertyNames(headers).forEach(function(name) {
- this.append(name, headers[name])
- }, this)
- }
- }
- Headers.prototype.append = function(name, value) {
- name = normalizeName(name)
- value = normalizeValue(value)
- var list = this.map[name]
- if (!list) {
- list = []
- this.map[name] = list
- }
- list.push(value)
- }
- Headers.prototype['delete'] = function(name) {
- delete this.map[normalizeName(name)]
- }
- Headers.prototype.get = function(name) {
- var values = this.map[normalizeName(name)]
- return values ? values[0] : null
- }
- Headers.prototype.getAll = function(name) {
- return this.map[normalizeName(name)] || []
- }
- Headers.prototype.has = function(name) {
- return this.map.hasOwnProperty(normalizeName(name))
- }
- Headers.prototype.set = function(name, value) {
- this.map[normalizeName(name)] = [normalizeValue(value)]
- }
- Headers.prototype.forEach = function(callback, thisArg) {
- Object.getOwnPropertyNames(this.map).forEach(function(name) {
- this.map[name].forEach(function(value) {
- callback.call(thisArg, value, name, this)
- }, this)
- }, this)
- }
- function consumed(body) {
- if (body.bodyUsed) {
- return Promise.reject(new TypeError('Already read'))
- }
- body.bodyUsed = true
- }
- function fileReaderReady(reader) {
- return new Promise(function(resolve, reject) {
- reader.onload = function() {
- resolve(reader.result)
- }
- reader.onerror = function() {
- reject(reader.error)
- }
- })
- }
- function readBlobAsArrayBuffer(blob) {
- var reader = new FileReader()
- reader.readAsArrayBuffer(blob)
- return fileReaderReady(reader)
- }
- function readBlobAsText(blob, options) {
- var reader = new FileReader()
- var contentType = options.headers.map['content-type'] ? options.headers.map['content-type'].toString() : ''
- var regex = /charset\=[0-9a-zA-Z\-\_]*;?/
- var _charset = blob.type.match(regex) || contentType.match(regex)
- var args = [blob]
- if(_charset) {
- args.push(_charset[0].replace(/^charset\=/, '').replace(/;$/, ''))
- }
- reader.readAsText.apply(reader, args)
- return fileReaderReady(reader)
- }
- var support = {
- blob: 'FileReader' in self && 'Blob' in self && (function() {
- try {
- new Blob();
- return true
- } catch(e) {
- return false
- }
- })(),
- formData: 'FormData' in self,
- arrayBuffer: 'ArrayBuffer' in self
- }
- function Body() {
- this.bodyUsed = false
- this._initBody = function(body, options) {
- this._bodyInit = body
- if (typeof body === 'string') {
- this._bodyText = body
- } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
- this._bodyBlob = body
- this._options = options
- } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
- this._bodyFormData = body
- } else if (!body) {
- this._bodyText = ''
- } else if (support.arrayBuffer && ArrayBuffer.prototype.isPrototypeOf(body)) {
- // Only support ArrayBuffers for POST method.
- // Receiving ArrayBuffers happens via Blobs, instead.
- } else {
- throw new Error('unsupported BodyInit type')
- }
- }
- if (support.blob) {
- this.blob = function() {
- var rejected = consumed(this)
- if (rejected) {
- return rejected
- }
- if (this._bodyBlob) {
- return Promise.resolve(this._bodyBlob)
- } else if (this._bodyFormData) {
- throw new Error('could not read FormData body as blob')
- } else {
- return Promise.resolve(new Blob([this._bodyText]))
- }
- }
- this.arrayBuffer = function() {
- return this.blob().then(readBlobAsArrayBuffer)
- }
- this.text = function() {
- var rejected = consumed(this)
- if (rejected) {
- return rejected
- }
- if (this._bodyBlob) {
- return readBlobAsText(this._bodyBlob, this._options)
- } else if (this._bodyFormData) {
- throw new Error('could not read FormData body as text')
- } else {
- return Promise.resolve(this._bodyText)
- }
- }
- } else {
- this.text = function() {
- var rejected = consumed(this)
- return rejected ? rejected : Promise.resolve(this._bodyText)
- }
- }
- if (support.formData) {
- this.formData = function() {
- return this.text().then(decode)
- }
- }
- this.json = function() {
- return this.text().then(JSON.parse)
- }
- return this
- }
- // HTTP methods whose capitalization should be normalized
- var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']
- function normalizeMethod(method) {
- var upcased = method.toUpperCase()
- return (methods.indexOf(upcased) > -1) ? upcased : method
- }
- function Request(input, options) {
- options = options || {}
- var body = options.body
- if (Request.prototype.isPrototypeOf(input)) {
- if (input.bodyUsed) {
- throw new TypeError('Already read')
- }
- this.url = input.url
- this.credentials = input.credentials
- if (!options.headers) {
- this.headers = new Headers(input.headers)
- }
- this.method = input.method
- this.mode = input.mode
- if (!body) {
- body = input._bodyInit
- input.bodyUsed = true
- }
- } else {
- this.url = input
- }
- this.credentials = options.credentials || this.credentials || 'omit'
- if (options.headers || !this.headers) {
- this.headers = new Headers(options.headers)
- }
- this.method = normalizeMethod(options.method || this.method || 'GET')
- this.mode = options.mode || this.mode || null
- this.referrer = null
- if ((this.method === 'GET' || this.method === 'HEAD') && body) {
- throw new TypeError('Body not allowed for GET or HEAD requests')
- }
- this._initBody(body, options)
- }
- Request.prototype.clone = function() {
- return new Request(this)
- }
- function decode(body) {
- var form = new FormData()
- body.trim().split('&').forEach(function(bytes) {
- if (bytes) {
- var split = bytes.split('=')
- var name = split.shift().replace(/\+/g, ' ')
- var value = split.join('=').replace(/\+/g, ' ')
- form.append(decodeURIComponent(name), decodeURIComponent(value))
- }
- })
- return form
- }
- function headers(xhr) {
- var head = new Headers()
- var pairs = xhr.getAllResponseHeaders().trim().split('\n')
- pairs.forEach(function(header) {
- var split = header.trim().split(':')
- var key = split.shift().trim()
- var value = split.join(':').trim()
- head.append(key, value)
- })
- return head
- }
- Body.call(Request.prototype)
- function Response(bodyInit, options) {
- if (!options) {
- options = {}
- }
- this._initBody(bodyInit, options)
- this.type = 'default'
- this.status = options.status
- this.ok = this.status >= 200 && this.status < 300
- this.statusText = options.statusText
- this.headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers)
- this.url = options.url || ''
- }
- Body.call(Response.prototype)
- Response.prototype.clone = function() {
- return new Response(this._bodyInit, {
- status: this.status,
- statusText: this.statusText,
- headers: new Headers(this.headers),
- url: this.url
- })
- }
- Response.error = function() {
- var response = new Response(null, {status: 0, statusText: ''})
- response.type = 'error'
- return response
- }
- var redirectStatuses = [301, 302, 303, 307, 308]
- Response.redirect = function(url, status) {
- if (redirectStatuses.indexOf(status) === -1) {
- throw new RangeError('Invalid status code')
- }
- return new Response(null, {status: status, headers: {location: url}})
- }
- self.Headers = Headers;
- self.Request = Request;
- self.Response = Response;
- self.fetch = function(input, init) {
- return new Promise(function(resolve, reject) {
- var request
- if (Request.prototype.isPrototypeOf(input) && !init) {
- request = input
- } else {
- request = new Request(input, init)
- }
- var xhr = new XMLHttpRequest()
- function responseURL() {
- if ('responseURL' in xhr) {
- return xhr.responseURL
- }
- // Avoid security warnings on getResponseHeader when not allowed by CORS
- if (/^X-Request-URL:/m.test(xhr.getAllResponseHeaders())) {
- return xhr.getResponseHeader('X-Request-URL')
- }
- return;
- }
- var __onLoadHandled = false;
- function onload() {
- if (xhr.readyState !== 4) {
- return
- }
- var status = (xhr.status === 1223) ? 204 : xhr.status
- if (status < 100 || status > 599) {
- if (__onLoadHandled) { return; } else { __onLoadHandled = true; }
- reject(new TypeError('Network request failed'))
- return
- }
- var options = {
- status: status,
- statusText: xhr.statusText,
- headers: headers(xhr),
- url: responseURL()
- }
- var body = 'response' in xhr ? xhr.response : xhr.responseText;
- if (__onLoadHandled) { return; } else { __onLoadHandled = true; }
- resolve(new Response(body, options))
- }
- xhr.onreadystatechange = onload;
- xhr.onload = onload;
- xhr.onerror = function() {
- if (__onLoadHandled) { return; } else { __onLoadHandled = true; }
- reject(new TypeError('Network request failed'))
- }
- xhr.open(request.method, request.url, true)
- // `withCredentials` should be setted after calling `.open` in IE10
- // http://stackoverflow.com/a/19667959/1219343
- try {
- if (request.credentials === 'include') {
- if ('withCredentials' in xhr) {
- xhr.withCredentials = true;
- } else {
- console && console.warn && console.warn('withCredentials is not supported, you can ignore this warning');
- }
- }
- } catch (e) {
- console && console.warn && console.warn('set withCredentials error:' + e);
- }
- if ('responseType' in xhr && support.blob) {
- xhr.responseType = 'blob'
- }
- request.headers.forEach(function(value, name) {
- xhr.setRequestHeader(name, value)
- })
- xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit)
- })
- }
- self.fetch.polyfill = true
- // Support CommonJS
- if ( true && module.exports) {
- module.exports = self.fetch;
- }
- })(typeof self !== 'undefined' ? self : this);
- /***/ }),
- /***/ 144:
- /***/ (function(module, exports) {
- var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
- if (true) {
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports, module], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
- __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
- (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
- } else { var mod; }
- })(this, function (exports, module) {
- 'use strict';
- var defaultOptions = {
- timeout: 5000,
- jsonpCallback: 'callback',
- jsonpCallbackFunction: null
- };
- function generateCallbackFunction() {
- return 'jsonp_' + Date.now() + '_' + Math.ceil(Math.random() * 100000);
- }
- function clearFunction(functionName) {
- // IE8 throws an exception when you try to delete a property on window
- // http://stackoverflow.com/a/1824228/751089
- try {
- delete window[functionName];
- } catch (e) {
- window[functionName] = undefined;
- }
- }
- function removeScript(scriptId) {
- var script = document.getElementById(scriptId);
- if (script) {
- document.getElementsByTagName('head')[0].removeChild(script);
- }
- }
- function fetchJsonp(_url) {
- var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
- // to avoid param reassign
- var url = _url;
- var timeout = options.timeout || defaultOptions.timeout;
- var jsonpCallback = options.jsonpCallback || defaultOptions.jsonpCallback;
- var timeoutId = undefined;
- return new Promise(function (resolve, reject) {
- var callbackFunction = options.jsonpCallbackFunction || generateCallbackFunction();
- var scriptId = jsonpCallback + '_' + callbackFunction;
- window[callbackFunction] = function (response) {
- resolve({
- ok: true,
- // keep consistent with fetch API
- json: function json() {
- return Promise.resolve(response);
- }
- });
- if (timeoutId) clearTimeout(timeoutId);
- removeScript(scriptId);
- clearFunction(callbackFunction);
- };
- // Check if the user set their own params, and if not add a ? to start a list of params
- url += url.indexOf('?') === -1 ? '?' : '&';
- var jsonpScript = document.createElement('script');
- jsonpScript.setAttribute('src', '' + url + jsonpCallback + '=' + callbackFunction);
- if (options.charset) {
- jsonpScript.setAttribute('charset', options.charset);
- }
- jsonpScript.id = scriptId;
- document.getElementsByTagName('head')[0].appendChild(jsonpScript);
- timeoutId = setTimeout(function () {
- reject(new Error('JSONP request to ' + _url + ' timed out'));
- clearFunction(callbackFunction);
- removeScript(scriptId);
- window[callbackFunction] = function () {
- clearFunction(callbackFunction);
- };
- }, timeout);
- // Caught if got 404/500
- jsonpScript.onerror = function () {
- reject(new Error('JSONP request to ' + _url + ' failed'));
- clearFunction(callbackFunction);
- removeScript(scriptId);
- if (timeoutId) clearTimeout(timeoutId);
- };
- });
- }
- // export as global function
- /*
- let local;
- if (typeof global !== 'undefined') {
- local = global;
- } else if (typeof self !== 'undefined') {
- local = self;
- } else {
- try {
- local = Function('return this')();
- } catch (e) {
- throw new Error('polyfill failed because global object is unavailable in this environment');
- }
- }
- local.fetchJsonp = fetchJsonp;
- */
- module.exports = fetchJsonp;
- });
- /***/ }),
- /***/ 645:
- /***/ ((__unused_webpack_module, exports) => {
- /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
- exports.read = function (buffer, offset, isLE, mLen, nBytes) {
- var e, m
- var eLen = (nBytes * 8) - mLen - 1
- var eMax = (1 << eLen) - 1
- var eBias = eMax >> 1
- var nBits = -7
- var i = isLE ? (nBytes - 1) : 0
- var d = isLE ? -1 : 1
- var s = buffer[offset + i]
- i += d
- e = s & ((1 << (-nBits)) - 1)
- s >>= (-nBits)
- nBits += eLen
- for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
- m = e & ((1 << (-nBits)) - 1)
- e >>= (-nBits)
- nBits += mLen
- for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
- if (e === 0) {
- e = 1 - eBias
- } else if (e === eMax) {
- return m ? NaN : ((s ? -1 : 1) * Infinity)
- } else {
- m = m + Math.pow(2, mLen)
- e = e - eBias
- }
- return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
- }
- exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
- var e, m, c
- var eLen = (nBytes * 8) - mLen - 1
- var eMax = (1 << eLen) - 1
- var eBias = eMax >> 1
- var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
- var i = isLE ? 0 : (nBytes - 1)
- var d = isLE ? 1 : -1
- var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
- value = Math.abs(value)
- if (isNaN(value) || value === Infinity) {
- m = isNaN(value) ? 1 : 0
- e = eMax
- } else {
- e = Math.floor(Math.log(value) / Math.LN2)
- if (value * (c = Math.pow(2, -e)) < 1) {
- e--
- c *= 2
- }
- if (e + eBias >= 1) {
- value += rt / c
- } else {
- value += rt * Math.pow(2, 1 - eBias)
- }
- if (value * c >= 2) {
- e++
- c /= 2
- }
- if (e + eBias >= eMax) {
- m = 0
- e = eMax
- } else if (e + eBias >= 1) {
- m = ((value * c) - 1) * Math.pow(2, mLen)
- e = e + eBias
- } else {
- m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
- e = 0
- }
- }
- for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
- e = (e << mLen) | m
- eLen += mLen
- for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
- buffer[offset + i - d] |= s * 128
- }
- /***/ }),
- /***/ 545:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var utils = __webpack_require__(820)
- var AND = '&&'
- , OR = '||'
- , AND_STR = 'and'
- , OR_STR = 'or'
- , NOT = '!'
- , EQUAL = '='
- , LIKE = '~'
- , NOTEQUAL = NOT + EQUAL
- , NOTLIKE = NOT + LIKE
- , GT = '>'
- , GE = '>='
- , LT = '<'
- , LE = '<='
- , WILDCARD = '*'
- , COMMA = ','
- , DELIMITER = '.'
- , LEFT = '('
- , RIGHT = ')'
- , WHERE = 'where'
- , synopsis = {
- pathway: [],
- groups: {}
- }
- , AST = {}
- , options = {};
- var print = console.log;
- // ------------------ splitter -------------------- //
- function Tokenize(query) {
- var parts = __splitTrim(query, WHERE);
- var pathway = parts[0];
- var where = parts[1];
- synopsis.pathway = __splitTrim(pathway, COMMA);
- for (var i = 0, len = synopsis.pathway.length; i < len; i++) {
- synopsis.pathway[i] = __splitTrim(synopsis.pathway[i], DELIMITER);
- if (synopsis.pathway[i][0] == WILDCARD)
- synopsis.pathway[i].shift();
- if (synopsis.pathway[i].length === 0)
- synopsis.pathway.splice(i, 1);
- }
- var lastLeft = -1,
- lastRight = -1,
- current = 0;
- while (current < where.length) {
- if (where[current] === LEFT) {
- lastLeft = current;
- } else if (where[current] === RIGHT) {
- lastRight = current;
- if (lastRight > lastLeft && lastLeft !== -1) {
- var k = 'gr' + '_' + new Date().getTime();
- synopsis.groups[k] = where.substring(lastLeft + 1, lastRight);
- where = where.replace(LEFT + synopsis.groups[k] + RIGHT, k);
- current = -1;
- }
- }
- current += 1;
- }
- LogicalGrouping(AST, where);
- }
- function LogicalGrouping(current, where) {
- var lastAnd = __findIndex(where, AND),
- lastOr = __findIndex(where, OR);
- if (lastAnd !== Number.MAX_VALUE || lastOr !== Number.MAX_VALUE) {
- if (lastAnd < lastOr) {
- current.and = current.and || [];
- var parts = __splitTrim(where, AND);
- current.and.push(parts[0]);
- LogicalGrouping(current.and, parts[1]);
- } else {
- current.or = current.or || [];
- var parts = __splitTrim(where, OR);
- current.or.push(parts[0]);
- LogicalGrouping(current.or, parts[1]);
- }
- } else {
- if (synopsis.groups[where]) {
- where = synopsis.groups[where];
- LogicalGrouping(current, where);
- } else {
- if (Array.isArray(current))
- current.push(where);
- else
- current.or = [where];
- ExtractExpression(AST.or ? AST.or : AST.and)
- }
- }
- }
- function ExtractExpression(logicalGroup) {
- for (var k in logicalGroup) {
- if (logicalGroup.hasOwnProperty(k)) {
- if (Array.isArray(logicalGroup[k])) {
- ExtractExpression(logicalGroup[k]);
- }
- else if (typeof logicalGroup[k] === 'string') {
- if (__contains(logicalGroup[k], NOTEQUAL)) {
- var parts = __splitTrim(logicalGroup[k], NOTEQUAL);
- logicalGroup[k] = {
- ne: [
- parts[0],
- parts[1]
- ]
- };
- } else if (__contains(logicalGroup[k], NOTLIKE)) {
- var parts = __splitTrim(logicalGroup[k], NOTLIKE);
- logicalGroup[k] = {
- nreq: [
- parts[0],
- parts[1]
- ]
- };
- } else if (__contains(logicalGroup[k], LIKE)) {
- var parts = __splitTrim(logicalGroup[k], LIKE);
- logicalGroup[k] = { // rough eq
- req: [
- parts[0],
- parts[1]
- ]
- };
- } else if (__contains(logicalGroup[k], GE)) {
- var parts = __splitTrim(logicalGroup[k], GE);
- logicalGroup[k] = { // greater than or equal
- ge: [
- parts[0],
- parts[1]
- ]
- };
- } else if (__contains(logicalGroup[k], GT)) {
- var parts = __splitTrim(logicalGroup[k], GT);
- logicalGroup[k] = { // greater than
- gt: [
- parts[0],
- parts[1]
- ]
- };
- } else if (__contains(logicalGroup[k], LE)) {
- var parts = __splitTrim(logicalGroup[k], LE);
- logicalGroup[k] = { // less than or equal
- le: [
- parts[0],
- parts[1]
- ]
- };
- } else if (__contains(logicalGroup[k], LT)) {
- var parts = __splitTrim(logicalGroup[k], LT);
- logicalGroup[k] = { // less than
- lt: [
- parts[0],
- parts[1]
- ]
- };
- } else if (__contains(logicalGroup[k], EQUAL)) {
- var parts = __splitTrim(logicalGroup[k], EQUAL);
- logicalGroup[k] = {
- eq: [
- parts[0],
- parts[1]
- ]
- };
- }
- }
- }
- }
- }
- function __findIndex(str, token) {
- var index = str.indexOf(token);
- return index === -1 ? Number.MAX_VALUE : index;
- }
- function __splitTrim(str, token) {
- return str.split(token).map(function (p) {
- return p.trim();
- });
- }
- function __contains(a, b) {
- return a.indexOf(b) > -1;
- }
- function __hierarchize(obj, dottedPath) {
- var parts = __splitTrim(dottedPath, DELIMITER);
- var res = obj;
- for (var p in parts) {
- if (res.hasOwnProperty(parts[p]))
- res = res[parts[p]];
- else
- return '';
- }
- // support comparison for Date/DateString
- if(utils.isDate(res)) res = res.valueOf()
- else if(utils.isDateString(res)) res = utils.parseDateFromString(res)
- else res = res.toString()
- return res
- }
- function FilterOR(ASTNode, row) {
- var res = false;
- for (var k in ASTNode) {
- var filterFunc = (k === AND_STR ? FilterAND : (k === OR_STR ? FilterOR : Filter));
- res = res || filterFunc(ASTNode[k], row);
- if (options.trace)
- print(synopsis.step, '======((( or', ASTNode[k], res);
- if (res) return res;
- }
- return res;
- }
- function FilterAND(ASTNode, row) {
- var res = true;
- for (var k in ASTNode) {
- var filterFunc = (k === AND_STR ? FilterAND : (k === OR_STR ? FilterOR : Filter));
- res = res && filterFunc(ASTNode[k], row);
- if (options.trace)
- print(synopsis.step, '======((( and', ASTNode[k], res);
- if (!res) return res;
- }
- return res;
- }
- function Filter(ASTNode, row) {
- synopsis.step += 1;
- if (ASTNode.or) {
- var res = FilterOR(ASTNode.or, row);
- if (options.trace)
- print(synopsis.step, 'OR', ASTNode, res);
- return res;
- } else if (ASTNode.and) {
- var res = FilterAND(ASTNode.and, row);
- if (options.trace)
- print(synopsis.step, 'AND', ASTNode, res);
- return res;
- } else if (typeof ASTNode === 'object') {
- if (ASTNode.eq) { // =
- return __hierarchize(row, ASTNode.eq[0]) === ASTNode.eq[1];
- } else if (ASTNode.ne) { // !=
- return __hierarchize(row, ASTNode.ne[0]) !== ASTNode.ne[1];
- } else if (ASTNode.req) { // ~
- return __contains(__hierarchize(row, ASTNode.req[0]), ASTNode.req[1]);
- } else if (ASTNode.nreq) { // ~
- return !__contains(__hierarchize(row, ASTNode.nreq[0]), ASTNode.nreq[1]);
- } else if (ASTNode.gt) { // >
- return __hierarchize(row, ASTNode.gt[0]) > ASTNode.gt[1];
- } else if (ASTNode.ge) { // >=
- return __hierarchize(row, ASTNode.ge[0]) >= ASTNode.ge[1];
- } else if (ASTNode.lt) { // <
- return __hierarchize(row, ASTNode.lt[0]) < ASTNode.lt[1];
- } else if (ASTNode.le) { // <=
- return __hierarchize(row, ASTNode.le[0]) <= ASTNode.le[1];
- } else {
- return Filter(ASTNode, row);
- }
- }
- }
- function Parse(dataSource) {
- var result = [];
- for (var k in dataSource)
- if (Filter(AST, dataSource[k]))
- result.push(dataSource[k]);
- return result;
- }
- function Fields(result) {
- if (result && synopsis.pathway.length > 0) {
- //print(synopsis.pathway);
- return result.map(function (ele) {
- var res = {};
- for (var i = 0, len = synopsis.pathway.length; i < len; i++) {
- var key = synopsis.pathway[i].join(DELIMITER);
- res[key] = __hierarchize(ele, key);
- }
- return res;
- });
- }
- return result;
- }
- function Query(dataSource, query, opts) {
- synopsis = {
- pathway: [],
- groups: {},
- step: 0
- };
- AST = {};
- opts = opts || {
- trace: false
- };
- options = opts;
- Tokenize(query);
- return Fields(Parse(dataSource));
- }
- if ( true && typeof(module.exports) != 'undefined') module.exports = Query;
- if (typeof(window) != 'undefined') window.Query = Query;
- /***/ }),
- /***/ 820:
- /***/ ((module) => {
- function getObjectType(obj) {
- return Object.prototype.toString.call(obj);
- }
- function isDate(obj) {
- return getObjectType(obj) === '[object Date]';
- }
- function isString(obj) {
- return getObjectType(obj) === '[object String]';
- }
- function isDateString(obj) {
- return isString(obj) && !isNaN(Date.parse(obj))
- }
- function isNumber(obj) {
- return typeof obj === 'number'
- }
- function parseDateFromString(str) {
- return Date.parse(str)
- }
- module.exports = {
- getObjectType: getObjectType,
- isDate: isDate,
- isString: isString,
- isDateString: isDateString,
- parseDateFromString: parseDateFromString,
- isNumber: isNumber
- }
- /***/ }),
- /***/ 52:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- /**
- * lodash (Custom Build) <https://lodash.com/>
- * Build: `lodash modularize exports="npm" -o ./`
- * Copyright jQuery Foundation and other contributors <https://jquery.org/>
- * Released under MIT license <https://lodash.com/license>
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- */
- /** Used as references for various `Number` constants. */
- var MAX_SAFE_INTEGER = 9007199254740991;
- /** `Object#toString` result references. */
- var argsTag = '[object Arguments]',
- funcTag = '[object Function]',
- genTag = '[object GeneratorFunction]',
- mapTag = '[object Map]',
- objectTag = '[object Object]',
- promiseTag = '[object Promise]',
- setTag = '[object Set]',
- weakMapTag = '[object WeakMap]';
- var dataViewTag = '[object DataView]';
- /**
- * Used to match `RegExp`
- * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
- */
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
- /** Used to detect host constructors (Safari). */
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
- /** Used to detect unsigned integer values. */
- var reIsUint = /^(?:0|[1-9]\d*)$/;
- /** Detect free variable `global` from Node.js. */
- var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g;
- /** Detect free variable `self`. */
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
- /** Used as a reference to the global object. */
- var root = freeGlobal || freeSelf || Function('return this')();
- /**
- * A specialized version of `_.map` for arrays without support for iteratee
- * shorthands.
- *
- * @private
- * @param {Array} [array] The array to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Array} Returns the new mapped array.
- */
- function arrayMap(array, iteratee) {
- var index = -1,
- length = array ? array.length : 0,
- result = Array(length);
- while (++index < length) {
- result[index] = iteratee(array[index], index, array);
- }
- return result;
- }
- /**
- * The base implementation of `_.times` without support for iteratee shorthands
- * or max array length checks.
- *
- * @private
- * @param {number} n The number of times to invoke `iteratee`.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Array} Returns the array of results.
- */
- function baseTimes(n, iteratee) {
- var index = -1,
- result = Array(n);
- while (++index < n) {
- result[index] = iteratee(index);
- }
- return result;
- }
- /**
- * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
- * of key-value pairs for `object` corresponding to the property names of `props`.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {Array} props The property names to get values for.
- * @returns {Object} Returns the key-value pairs.
- */
- function baseToPairs(object, props) {
- return arrayMap(props, function(key) {
- return [key, object[key]];
- });
- }
- /**
- * Gets the value at `key` of `object`.
- *
- * @private
- * @param {Object} [object] The object to query.
- * @param {string} key The key of the property to get.
- * @returns {*} Returns the property value.
- */
- function getValue(object, key) {
- return object == null ? undefined : object[key];
- }
- /**
- * Checks if `value` is a host object in IE < 9.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
- */
- function isHostObject(value) {
- // Many host objects are `Object` objects that can coerce to strings
- // despite having improperly defined `toString` methods.
- var result = false;
- if (value != null && typeof value.toString != 'function') {
- try {
- result = !!(value + '');
- } catch (e) {}
- }
- return result;
- }
- /**
- * Converts `map` to its key-value pairs.
- *
- * @private
- * @param {Object} map The map to convert.
- * @returns {Array} Returns the key-value pairs.
- */
- function mapToArray(map) {
- var index = -1,
- result = Array(map.size);
- map.forEach(function(value, key) {
- result[++index] = [key, value];
- });
- return result;
- }
- /**
- * Creates a unary function that invokes `func` with its argument transformed.
- *
- * @private
- * @param {Function} func The function to wrap.
- * @param {Function} transform The argument transform.
- * @returns {Function} Returns the new function.
- */
- function overArg(func, transform) {
- return function(arg) {
- return func(transform(arg));
- };
- }
- /**
- * Converts `set` to its value-value pairs.
- *
- * @private
- * @param {Object} set The set to convert.
- * @returns {Array} Returns the value-value pairs.
- */
- function setToPairs(set) {
- var index = -1,
- result = Array(set.size);
- set.forEach(function(value) {
- result[++index] = [value, value];
- });
- return result;
- }
- /** Used for built-in method references. */
- var funcProto = Function.prototype,
- objectProto = Object.prototype;
- /** Used to detect overreaching core-js shims. */
- var coreJsData = root['__core-js_shared__'];
- /** Used to detect methods masquerading as native. */
- var maskSrcKey = (function() {
- var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
- return uid ? ('Symbol(src)_1.' + uid) : '';
- }());
- /** Used to resolve the decompiled source of functions. */
- var funcToString = funcProto.toString;
- /** Used to check objects for own properties. */
- var hasOwnProperty = objectProto.hasOwnProperty;
- /**
- * Used to resolve the
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
- * of values.
- */
- var objectToString = objectProto.toString;
- /** Used to detect if a method is native. */
- var reIsNative = RegExp('^' +
- funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
- .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
- );
- /** Built-in value references. */
- var propertyIsEnumerable = objectProto.propertyIsEnumerable;
- /* Built-in method references for those with the same name as other `lodash` methods. */
- var nativeKeys = overArg(Object.keys, Object);
- /* Built-in method references that are verified to be native. */
- var DataView = getNative(root, 'DataView'),
- Map = getNative(root, 'Map'),
- Promise = getNative(root, 'Promise'),
- Set = getNative(root, 'Set'),
- WeakMap = getNative(root, 'WeakMap');
- /** Used to detect maps, sets, and weakmaps. */
- var dataViewCtorString = toSource(DataView),
- mapCtorString = toSource(Map),
- promiseCtorString = toSource(Promise),
- setCtorString = toSource(Set),
- weakMapCtorString = toSource(WeakMap);
- /**
- * Creates an array of the enumerable property names of the array-like `value`.
- *
- * @private
- * @param {*} value The value to query.
- * @param {boolean} inherited Specify returning inherited property names.
- * @returns {Array} Returns the array of property names.
- */
- function arrayLikeKeys(value, inherited) {
- // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
- // Safari 9 makes `arguments.length` enumerable in strict mode.
- var result = (isArray(value) || isArguments(value))
- ? baseTimes(value.length, String)
- : [];
- var length = result.length,
- skipIndexes = !!length;
- for (var key in value) {
- if ((inherited || hasOwnProperty.call(value, key)) &&
- !(skipIndexes && (key == 'length' || isIndex(key, length)))) {
- result.push(key);
- }
- }
- return result;
- }
- /**
- * The base implementation of `getTag`.
- *
- * @private
- * @param {*} value The value to query.
- * @returns {string} Returns the `toStringTag`.
- */
- function baseGetTag(value) {
- return objectToString.call(value);
- }
- /**
- * The base implementation of `_.isNative` without bad shim checks.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a native function,
- * else `false`.
- */
- function baseIsNative(value) {
- if (!isObject(value) || isMasked(value)) {
- return false;
- }
- var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
- return pattern.test(toSource(value));
- }
- /**
- * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- */
- function baseKeys(object) {
- if (!isPrototype(object)) {
- return nativeKeys(object);
- }
- var result = [];
- for (var key in Object(object)) {
- if (hasOwnProperty.call(object, key) && key != 'constructor') {
- result.push(key);
- }
- }
- return result;
- }
- /**
- * Creates a `_.toPairs` or `_.toPairsIn` function.
- *
- * @private
- * @param {Function} keysFunc The function to get the keys of a given object.
- * @returns {Function} Returns the new pairs function.
- */
- function createToPairs(keysFunc) {
- return function(object) {
- var tag = getTag(object);
- if (tag == mapTag) {
- return mapToArray(object);
- }
- if (tag == setTag) {
- return setToPairs(object);
- }
- return baseToPairs(object, keysFunc(object));
- };
- }
- /**
- * Gets the native function at `key` of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {string} key The key of the method to get.
- * @returns {*} Returns the function if it's native, else `undefined`.
- */
- function getNative(object, key) {
- var value = getValue(object, key);
- return baseIsNative(value) ? value : undefined;
- }
- /**
- * Gets the `toStringTag` of `value`.
- *
- * @private
- * @param {*} value The value to query.
- * @returns {string} Returns the `toStringTag`.
- */
- var getTag = baseGetTag;
- // Fallback for data views, maps, sets, and weak maps in IE 11,
- // for data views in Edge < 14, and promises in Node.js.
- if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
- (Map && getTag(new Map) != mapTag) ||
- (Promise && getTag(Promise.resolve()) != promiseTag) ||
- (Set && getTag(new Set) != setTag) ||
- (WeakMap && getTag(new WeakMap) != weakMapTag)) {
- getTag = function(value) {
- var result = objectToString.call(value),
- Ctor = result == objectTag ? value.constructor : undefined,
- ctorString = Ctor ? toSource(Ctor) : undefined;
- if (ctorString) {
- switch (ctorString) {
- case dataViewCtorString: return dataViewTag;
- case mapCtorString: return mapTag;
- case promiseCtorString: return promiseTag;
- case setCtorString: return setTag;
- case weakMapCtorString: return weakMapTag;
- }
- }
- return result;
- };
- }
- /**
- * Checks if `value` is a valid array-like index.
- *
- * @private
- * @param {*} value The value to check.
- * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
- * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
- */
- function isIndex(value, length) {
- length = length == null ? MAX_SAFE_INTEGER : length;
- return !!length &&
- (typeof value == 'number' || reIsUint.test(value)) &&
- (value > -1 && value % 1 == 0 && value < length);
- }
- /**
- * Checks if `func` has its source masked.
- *
- * @private
- * @param {Function} func The function to check.
- * @returns {boolean} Returns `true` if `func` is masked, else `false`.
- */
- function isMasked(func) {
- return !!maskSrcKey && (maskSrcKey in func);
- }
- /**
- * Checks if `value` is likely a prototype object.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
- */
- function isPrototype(value) {
- var Ctor = value && value.constructor,
- proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
- return value === proto;
- }
- /**
- * Converts `func` to its source code.
- *
- * @private
- * @param {Function} func The function to process.
- * @returns {string} Returns the source code.
- */
- function toSource(func) {
- if (func != null) {
- try {
- return funcToString.call(func);
- } catch (e) {}
- try {
- return (func + '');
- } catch (e) {}
- }
- return '';
- }
- /**
- * Checks if `value` is likely an `arguments` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
- * else `false`.
- * @example
- *
- * _.isArguments(function() { return arguments; }());
- * // => true
- *
- * _.isArguments([1, 2, 3]);
- * // => false
- */
- function isArguments(value) {
- // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
- return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
- (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
- }
- /**
- * Checks if `value` is classified as an `Array` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
- * @example
- *
- * _.isArray([1, 2, 3]);
- * // => true
- *
- * _.isArray(document.body.children);
- * // => false
- *
- * _.isArray('abc');
- * // => false
- *
- * _.isArray(_.noop);
- * // => false
- */
- var isArray = Array.isArray;
- /**
- * Checks if `value` is array-like. A value is considered array-like if it's
- * not a function and has a `value.length` that's an integer greater than or
- * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
- * @example
- *
- * _.isArrayLike([1, 2, 3]);
- * // => true
- *
- * _.isArrayLike(document.body.children);
- * // => true
- *
- * _.isArrayLike('abc');
- * // => true
- *
- * _.isArrayLike(_.noop);
- * // => false
- */
- function isArrayLike(value) {
- return value != null && isLength(value.length) && !isFunction(value);
- }
- /**
- * This method is like `_.isArrayLike` except that it also checks if `value`
- * is an object.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an array-like object,
- * else `false`.
- * @example
- *
- * _.isArrayLikeObject([1, 2, 3]);
- * // => true
- *
- * _.isArrayLikeObject(document.body.children);
- * // => true
- *
- * _.isArrayLikeObject('abc');
- * // => false
- *
- * _.isArrayLikeObject(_.noop);
- * // => false
- */
- function isArrayLikeObject(value) {
- return isObjectLike(value) && isArrayLike(value);
- }
- /**
- * Checks if `value` is classified as a `Function` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
- * @example
- *
- * _.isFunction(_);
- * // => true
- *
- * _.isFunction(/abc/);
- * // => false
- */
- function isFunction(value) {
- // The use of `Object#toString` avoids issues with the `typeof` operator
- // in Safari 8-9 which returns 'object' for typed array and other constructors.
- var tag = isObject(value) ? objectToString.call(value) : '';
- return tag == funcTag || tag == genTag;
- }
- /**
- * Checks if `value` is a valid array-like length.
- *
- * **Note:** This method is loosely based on
- * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
- * @example
- *
- * _.isLength(3);
- * // => true
- *
- * _.isLength(Number.MIN_VALUE);
- * // => false
- *
- * _.isLength(Infinity);
- * // => false
- *
- * _.isLength('3');
- * // => false
- */
- function isLength(value) {
- return typeof value == 'number' &&
- value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
- }
- /**
- * Checks if `value` is the
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
- * @example
- *
- * _.isObject({});
- * // => true
- *
- * _.isObject([1, 2, 3]);
- * // => true
- *
- * _.isObject(_.noop);
- * // => true
- *
- * _.isObject(null);
- * // => false
- */
- function isObject(value) {
- var type = typeof value;
- return !!value && (type == 'object' || type == 'function');
- }
- /**
- * Checks if `value` is object-like. A value is object-like if it's not `null`
- * and has a `typeof` result of "object".
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
- * @example
- *
- * _.isObjectLike({});
- * // => true
- *
- * _.isObjectLike([1, 2, 3]);
- * // => true
- *
- * _.isObjectLike(_.noop);
- * // => false
- *
- * _.isObjectLike(null);
- * // => false
- */
- function isObjectLike(value) {
- return !!value && typeof value == 'object';
- }
- /**
- * Creates an array of the own enumerable property names of `object`.
- *
- * **Note:** Non-object values are coerced to objects. See the
- * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
- * for more details.
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category Object
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.keys(new Foo);
- * // => ['a', 'b'] (iteration order is not guaranteed)
- *
- * _.keys('hi');
- * // => ['0', '1']
- */
- function keys(object) {
- return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
- }
- /**
- * Creates an array of own enumerable string keyed-value pairs for `object`
- * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
- * entries are returned.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @alias entries
- * @category Object
- * @param {Object} object The object to query.
- * @returns {Array} Returns the key-value pairs.
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.toPairs(new Foo);
- * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
- */
- var toPairs = createToPairs(keys);
- module.exports = toPairs;
- /***/ }),
- /***/ 614:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- "use strict";
- module.exports = Pbf;
- var ieee754 = __webpack_require__(645);
- function Pbf(buf) {
- this.buf = ArrayBuffer.isView && ArrayBuffer.isView(buf) ? buf : new Uint8Array(buf || 0);
- this.pos = 0;
- this.type = 0;
- this.length = this.buf.length;
- }
- Pbf.Varint = 0; // varint: int32, int64, uint32, uint64, sint32, sint64, bool, enum
- Pbf.Fixed64 = 1; // 64-bit: double, fixed64, sfixed64
- Pbf.Bytes = 2; // length-delimited: string, bytes, embedded messages, packed repeated fields
- Pbf.Fixed32 = 5; // 32-bit: float, fixed32, sfixed32
- var SHIFT_LEFT_32 = (1 << 16) * (1 << 16),
- SHIFT_RIGHT_32 = 1 / SHIFT_LEFT_32;
- // Threshold chosen based on both benchmarking and knowledge about browser string
- // data structures (which currently switch structure types at 12 bytes or more)
- var TEXT_DECODER_MIN_LENGTH = 12;
- var utf8TextDecoder = typeof TextDecoder === 'undefined' ? null : new TextDecoder('utf8');
- Pbf.prototype = {
- destroy: function() {
- this.buf = null;
- },
- // === READING =================================================================
- readFields: function(readField, result, end) {
- end = end || this.length;
- while (this.pos < end) {
- var val = this.readVarint(),
- tag = val >> 3,
- startPos = this.pos;
- this.type = val & 0x7;
- readField(tag, result, this);
- if (this.pos === startPos) this.skip(val);
- }
- return result;
- },
- readMessage: function(readField, result) {
- return this.readFields(readField, result, this.readVarint() + this.pos);
- },
- readFixed32: function() {
- var val = readUInt32(this.buf, this.pos);
- this.pos += 4;
- return val;
- },
- readSFixed32: function() {
- var val = readInt32(this.buf, this.pos);
- this.pos += 4;
- return val;
- },
- // 64-bit int handling is based on github.com/dpw/node-buffer-more-ints (MIT-licensed)
- readFixed64: function() {
- var val = readUInt32(this.buf, this.pos) + readUInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;
- this.pos += 8;
- return val;
- },
- readSFixed64: function() {
- var val = readUInt32(this.buf, this.pos) + readInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;
- this.pos += 8;
- return val;
- },
- readFloat: function() {
- var val = ieee754.read(this.buf, this.pos, true, 23, 4);
- this.pos += 4;
- return val;
- },
- readDouble: function() {
- var val = ieee754.read(this.buf, this.pos, true, 52, 8);
- this.pos += 8;
- return val;
- },
- readVarint: function(isSigned) {
- var buf = this.buf,
- val, b;
- b = buf[this.pos++]; val = b & 0x7f; if (b < 0x80) return val;
- b = buf[this.pos++]; val |= (b & 0x7f) << 7; if (b < 0x80) return val;
- b = buf[this.pos++]; val |= (b & 0x7f) << 14; if (b < 0x80) return val;
- b = buf[this.pos++]; val |= (b & 0x7f) << 21; if (b < 0x80) return val;
- b = buf[this.pos]; val |= (b & 0x0f) << 28;
- return readVarintRemainder(val, isSigned, this);
- },
- readVarint64: function() { // for compatibility with v2.0.1
- return this.readVarint(true);
- },
- readSVarint: function() {
- var num = this.readVarint();
- return num % 2 === 1 ? (num + 1) / -2 : num / 2; // zigzag encoding
- },
- readBoolean: function() {
- return Boolean(this.readVarint());
- },
- readString: function() {
- var end = this.readVarint() + this.pos;
- var pos = this.pos;
- this.pos = end;
- if (end - pos >= TEXT_DECODER_MIN_LENGTH && utf8TextDecoder) {
- // longer strings are fast with the built-in browser TextDecoder API
- return readUtf8TextDecoder(this.buf, pos, end);
- }
- // short strings are fast with our custom implementation
- return readUtf8(this.buf, pos, end);
- },
- readBytes: function() {
- var end = this.readVarint() + this.pos,
- buffer = this.buf.subarray(this.pos, end);
- this.pos = end;
- return buffer;
- },
- // verbose for performance reasons; doesn't affect gzipped size
- readPackedVarint: function(arr, isSigned) {
- if (this.type !== Pbf.Bytes) return arr.push(this.readVarint(isSigned));
- var end = readPackedEnd(this);
- arr = arr || [];
- while (this.pos < end) arr.push(this.readVarint(isSigned));
- return arr;
- },
- readPackedSVarint: function(arr) {
- if (this.type !== Pbf.Bytes) return arr.push(this.readSVarint());
- var end = readPackedEnd(this);
- arr = arr || [];
- while (this.pos < end) arr.push(this.readSVarint());
- return arr;
- },
- readPackedBoolean: function(arr) {
- if (this.type !== Pbf.Bytes) return arr.push(this.readBoolean());
- var end = readPackedEnd(this);
- arr = arr || [];
- while (this.pos < end) arr.push(this.readBoolean());
- return arr;
- },
- readPackedFloat: function(arr) {
- if (this.type !== Pbf.Bytes) return arr.push(this.readFloat());
- var end = readPackedEnd(this);
- arr = arr || [];
- while (this.pos < end) arr.push(this.readFloat());
- return arr;
- },
- readPackedDouble: function(arr) {
- if (this.type !== Pbf.Bytes) return arr.push(this.readDouble());
- var end = readPackedEnd(this);
- arr = arr || [];
- while (this.pos < end) arr.push(this.readDouble());
- return arr;
- },
- readPackedFixed32: function(arr) {
- if (this.type !== Pbf.Bytes) return arr.push(this.readFixed32());
- var end = readPackedEnd(this);
- arr = arr || [];
- while (this.pos < end) arr.push(this.readFixed32());
- return arr;
- },
- readPackedSFixed32: function(arr) {
- if (this.type !== Pbf.Bytes) return arr.push(this.readSFixed32());
- var end = readPackedEnd(this);
- arr = arr || [];
- while (this.pos < end) arr.push(this.readSFixed32());
- return arr;
- },
- readPackedFixed64: function(arr) {
- if (this.type !== Pbf.Bytes) return arr.push(this.readFixed64());
- var end = readPackedEnd(this);
- arr = arr || [];
- while (this.pos < end) arr.push(this.readFixed64());
- return arr;
- },
- readPackedSFixed64: function(arr) {
- if (this.type !== Pbf.Bytes) return arr.push(this.readSFixed64());
- var end = readPackedEnd(this);
- arr = arr || [];
- while (this.pos < end) arr.push(this.readSFixed64());
- return arr;
- },
- skip: function(val) {
- var type = val & 0x7;
- if (type === Pbf.Varint) while (this.buf[this.pos++] > 0x7f) {}
- else if (type === Pbf.Bytes) this.pos = this.readVarint() + this.pos;
- else if (type === Pbf.Fixed32) this.pos += 4;
- else if (type === Pbf.Fixed64) this.pos += 8;
- else throw new Error('Unimplemented type: ' + type);
- },
- // === WRITING =================================================================
- writeTag: function(tag, type) {
- this.writeVarint((tag << 3) | type);
- },
- realloc: function(min) {
- var length = this.length || 16;
- while (length < this.pos + min) length *= 2;
- if (length !== this.length) {
- var buf = new Uint8Array(length);
- buf.set(this.buf);
- this.buf = buf;
- this.length = length;
- }
- },
- finish: function() {
- this.length = this.pos;
- this.pos = 0;
- return this.buf.subarray(0, this.length);
- },
- writeFixed32: function(val) {
- this.realloc(4);
- writeInt32(this.buf, val, this.pos);
- this.pos += 4;
- },
- writeSFixed32: function(val) {
- this.realloc(4);
- writeInt32(this.buf, val, this.pos);
- this.pos += 4;
- },
- writeFixed64: function(val) {
- this.realloc(8);
- writeInt32(this.buf, val & -1, this.pos);
- writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);
- this.pos += 8;
- },
- writeSFixed64: function(val) {
- this.realloc(8);
- writeInt32(this.buf, val & -1, this.pos);
- writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);
- this.pos += 8;
- },
- writeVarint: function(val) {
- val = +val || 0;
- if (val > 0xfffffff || val < 0) {
- writeBigVarint(val, this);
- return;
- }
- this.realloc(4);
- this.buf[this.pos++] = val & 0x7f | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;
- this.buf[this.pos++] = ((val >>>= 7) & 0x7f) | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;
- this.buf[this.pos++] = ((val >>>= 7) & 0x7f) | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;
- this.buf[this.pos++] = (val >>> 7) & 0x7f;
- },
- writeSVarint: function(val) {
- this.writeVarint(val < 0 ? -val * 2 - 1 : val * 2);
- },
- writeBoolean: function(val) {
- this.writeVarint(Boolean(val));
- },
- writeString: function(str) {
- str = String(str);
- this.realloc(str.length * 4);
- this.pos++; // reserve 1 byte for short string length
- var startPos = this.pos;
- // write the string directly to the buffer and see how much was written
- this.pos = writeUtf8(this.buf, str, this.pos);
- var len = this.pos - startPos;
- if (len >= 0x80) makeRoomForExtraLength(startPos, len, this);
- // finally, write the message length in the reserved place and restore the position
- this.pos = startPos - 1;
- this.writeVarint(len);
- this.pos += len;
- },
- writeFloat: function(val) {
- this.realloc(4);
- ieee754.write(this.buf, val, this.pos, true, 23, 4);
- this.pos += 4;
- },
- writeDouble: function(val) {
- this.realloc(8);
- ieee754.write(this.buf, val, this.pos, true, 52, 8);
- this.pos += 8;
- },
- writeBytes: function(buffer) {
- var len = buffer.length;
- this.writeVarint(len);
- this.realloc(len);
- for (var i = 0; i < len; i++) this.buf[this.pos++] = buffer[i];
- },
- writeRawMessage: function(fn, obj) {
- this.pos++; // reserve 1 byte for short message length
- // write the message directly to the buffer and see how much was written
- var startPos = this.pos;
- fn(obj, this);
- var len = this.pos - startPos;
- if (len >= 0x80) makeRoomForExtraLength(startPos, len, this);
- // finally, write the message length in the reserved place and restore the position
- this.pos = startPos - 1;
- this.writeVarint(len);
- this.pos += len;
- },
- writeMessage: function(tag, fn, obj) {
- this.writeTag(tag, Pbf.Bytes);
- this.writeRawMessage(fn, obj);
- },
- writePackedVarint: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedVarint, arr); },
- writePackedSVarint: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedSVarint, arr); },
- writePackedBoolean: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedBoolean, arr); },
- writePackedFloat: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedFloat, arr); },
- writePackedDouble: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedDouble, arr); },
- writePackedFixed32: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedFixed32, arr); },
- writePackedSFixed32: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedSFixed32, arr); },
- writePackedFixed64: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedFixed64, arr); },
- writePackedSFixed64: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedSFixed64, arr); },
- writeBytesField: function(tag, buffer) {
- this.writeTag(tag, Pbf.Bytes);
- this.writeBytes(buffer);
- },
- writeFixed32Field: function(tag, val) {
- this.writeTag(tag, Pbf.Fixed32);
- this.writeFixed32(val);
- },
- writeSFixed32Field: function(tag, val) {
- this.writeTag(tag, Pbf.Fixed32);
- this.writeSFixed32(val);
- },
- writeFixed64Field: function(tag, val) {
- this.writeTag(tag, Pbf.Fixed64);
- this.writeFixed64(val);
- },
- writeSFixed64Field: function(tag, val) {
- this.writeTag(tag, Pbf.Fixed64);
- this.writeSFixed64(val);
- },
- writeVarintField: function(tag, val) {
- this.writeTag(tag, Pbf.Varint);
- this.writeVarint(val);
- },
- writeSVarintField: function(tag, val) {
- this.writeTag(tag, Pbf.Varint);
- this.writeSVarint(val);
- },
- writeStringField: function(tag, str) {
- this.writeTag(tag, Pbf.Bytes);
- this.writeString(str);
- },
- writeFloatField: function(tag, val) {
- this.writeTag(tag, Pbf.Fixed32);
- this.writeFloat(val);
- },
- writeDoubleField: function(tag, val) {
- this.writeTag(tag, Pbf.Fixed64);
- this.writeDouble(val);
- },
- writeBooleanField: function(tag, val) {
- this.writeVarintField(tag, Boolean(val));
- }
- };
- function readVarintRemainder(l, s, p) {
- var buf = p.buf,
- h, b;
- b = buf[p.pos++]; h = (b & 0x70) >> 4; if (b < 0x80) return toNum(l, h, s);
- b = buf[p.pos++]; h |= (b & 0x7f) << 3; if (b < 0x80) return toNum(l, h, s);
- b = buf[p.pos++]; h |= (b & 0x7f) << 10; if (b < 0x80) return toNum(l, h, s);
- b = buf[p.pos++]; h |= (b & 0x7f) << 17; if (b < 0x80) return toNum(l, h, s);
- b = buf[p.pos++]; h |= (b & 0x7f) << 24; if (b < 0x80) return toNum(l, h, s);
- b = buf[p.pos++]; h |= (b & 0x01) << 31; if (b < 0x80) return toNum(l, h, s);
- throw new Error('Expected varint not more than 10 bytes');
- }
- function readPackedEnd(pbf) {
- return pbf.type === Pbf.Bytes ?
- pbf.readVarint() + pbf.pos : pbf.pos + 1;
- }
- function toNum(low, high, isSigned) {
- if (isSigned) {
- return high * 0x100000000 + (low >>> 0);
- }
- return ((high >>> 0) * 0x100000000) + (low >>> 0);
- }
- function writeBigVarint(val, pbf) {
- var low, high;
- if (val >= 0) {
- low = (val % 0x100000000) | 0;
- high = (val / 0x100000000) | 0;
- } else {
- low = ~(-val % 0x100000000);
- high = ~(-val / 0x100000000);
- if (low ^ 0xffffffff) {
- low = (low + 1) | 0;
- } else {
- low = 0;
- high = (high + 1) | 0;
- }
- }
- if (val >= 0x10000000000000000 || val < -0x10000000000000000) {
- throw new Error('Given varint doesn\'t fit into 10 bytes');
- }
- pbf.realloc(10);
- writeBigVarintLow(low, high, pbf);
- writeBigVarintHigh(high, pbf);
- }
- function writeBigVarintLow(low, high, pbf) {
- pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;
- pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;
- pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;
- pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;
- pbf.buf[pbf.pos] = low & 0x7f;
- }
- function writeBigVarintHigh(high, pbf) {
- var lsb = (high & 0x07) << 4;
- pbf.buf[pbf.pos++] |= lsb | ((high >>>= 3) ? 0x80 : 0); if (!high) return;
- pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;
- pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;
- pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;
- pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;
- pbf.buf[pbf.pos++] = high & 0x7f;
- }
- function makeRoomForExtraLength(startPos, len, pbf) {
- var extraLen =
- len <= 0x3fff ? 1 :
- len <= 0x1fffff ? 2 :
- len <= 0xfffffff ? 3 : Math.floor(Math.log(len) / (Math.LN2 * 7));
- // if 1 byte isn't enough for encoding message length, shift the data to the right
- pbf.realloc(extraLen);
- for (var i = pbf.pos - 1; i >= startPos; i--) pbf.buf[i + extraLen] = pbf.buf[i];
- }
- function writePackedVarint(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeVarint(arr[i]); }
- function writePackedSVarint(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSVarint(arr[i]); }
- function writePackedFloat(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFloat(arr[i]); }
- function writePackedDouble(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeDouble(arr[i]); }
- function writePackedBoolean(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeBoolean(arr[i]); }
- function writePackedFixed32(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFixed32(arr[i]); }
- function writePackedSFixed32(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSFixed32(arr[i]); }
- function writePackedFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFixed64(arr[i]); }
- function writePackedSFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSFixed64(arr[i]); }
- // Buffer code below from https://github.com/feross/buffer, MIT-licensed
- function readUInt32(buf, pos) {
- return ((buf[pos]) |
- (buf[pos + 1] << 8) |
- (buf[pos + 2] << 16)) +
- (buf[pos + 3] * 0x1000000);
- }
- function writeInt32(buf, val, pos) {
- buf[pos] = val;
- buf[pos + 1] = (val >>> 8);
- buf[pos + 2] = (val >>> 16);
- buf[pos + 3] = (val >>> 24);
- }
- function readInt32(buf, pos) {
- return ((buf[pos]) |
- (buf[pos + 1] << 8) |
- (buf[pos + 2] << 16)) +
- (buf[pos + 3] << 24);
- }
- function readUtf8(buf, pos, end) {
- var str = '';
- var i = pos;
- while (i < end) {
- var b0 = buf[i];
- var c = null; // codepoint
- var bytesPerSequence =
- b0 > 0xEF ? 4 :
- b0 > 0xDF ? 3 :
- b0 > 0xBF ? 2 : 1;
- if (i + bytesPerSequence > end) break;
- var b1, b2, b3;
- if (bytesPerSequence === 1) {
- if (b0 < 0x80) {
- c = b0;
- }
- } else if (bytesPerSequence === 2) {
- b1 = buf[i + 1];
- if ((b1 & 0xC0) === 0x80) {
- c = (b0 & 0x1F) << 0x6 | (b1 & 0x3F);
- if (c <= 0x7F) {
- c = null;
- }
- }
- } else if (bytesPerSequence === 3) {
- b1 = buf[i + 1];
- b2 = buf[i + 2];
- if ((b1 & 0xC0) === 0x80 && (b2 & 0xC0) === 0x80) {
- c = (b0 & 0xF) << 0xC | (b1 & 0x3F) << 0x6 | (b2 & 0x3F);
- if (c <= 0x7FF || (c >= 0xD800 && c <= 0xDFFF)) {
- c = null;
- }
- }
- } else if (bytesPerSequence === 4) {
- b1 = buf[i + 1];
- b2 = buf[i + 2];
- b3 = buf[i + 3];
- if ((b1 & 0xC0) === 0x80 && (b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80) {
- c = (b0 & 0xF) << 0x12 | (b1 & 0x3F) << 0xC | (b2 & 0x3F) << 0x6 | (b3 & 0x3F);
- if (c <= 0xFFFF || c >= 0x110000) {
- c = null;
- }
- }
- }
- if (c === null) {
- c = 0xFFFD;
- bytesPerSequence = 1;
- } else if (c > 0xFFFF) {
- c -= 0x10000;
- str += String.fromCharCode(c >>> 10 & 0x3FF | 0xD800);
- c = 0xDC00 | c & 0x3FF;
- }
- str += String.fromCharCode(c);
- i += bytesPerSequence;
- }
- return str;
- }
- function readUtf8TextDecoder(buf, pos, end) {
- return utf8TextDecoder.decode(buf.subarray(pos, end));
- }
- function writeUtf8(buf, str, pos) {
- for (var i = 0, c, lead; i < str.length; i++) {
- c = str.charCodeAt(i); // code point
- if (c > 0xD7FF && c < 0xE000) {
- if (lead) {
- if (c < 0xDC00) {
- buf[pos++] = 0xEF;
- buf[pos++] = 0xBF;
- buf[pos++] = 0xBD;
- lead = c;
- continue;
- } else {
- c = lead - 0xD800 << 10 | c - 0xDC00 | 0x10000;
- lead = null;
- }
- } else {
- if (c > 0xDBFF || (i + 1 === str.length)) {
- buf[pos++] = 0xEF;
- buf[pos++] = 0xBF;
- buf[pos++] = 0xBD;
- } else {
- lead = c;
- }
- continue;
- }
- } else if (lead) {
- buf[pos++] = 0xEF;
- buf[pos++] = 0xBF;
- buf[pos++] = 0xBD;
- lead = null;
- }
- if (c < 0x80) {
- buf[pos++] = c;
- } else {
- if (c < 0x800) {
- buf[pos++] = c >> 0x6 | 0xC0;
- } else {
- if (c < 0x10000) {
- buf[pos++] = c >> 0xC | 0xE0;
- } else {
- buf[pos++] = c >> 0x12 | 0xF0;
- buf[pos++] = c >> 0xC & 0x3F | 0x80;
- }
- buf[pos++] = c >> 0x6 & 0x3F | 0x80;
- }
- buf[pos++] = c & 0x3F | 0x80;
- }
- }
- return pos;
- }
- /***/ }),
- /***/ 107:
- /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
- (function (global, factory) {
- true ? factory() :
- 0;
- }(this, (function () { 'use strict';
- /**
- * @this {Promise}
- */
- function finallyConstructor(callback) {
- var constructor = this.constructor;
- return this.then(
- function(value) {
- // @ts-ignore
- return constructor.resolve(callback()).then(function() {
- return value;
- });
- },
- function(reason) {
- // @ts-ignore
- return constructor.resolve(callback()).then(function() {
- // @ts-ignore
- return constructor.reject(reason);
- });
- }
- );
- }
- function allSettled(arr) {
- var P = this;
- return new P(function(resolve, reject) {
- if (!(arr && typeof arr.length !== 'undefined')) {
- return reject(
- new TypeError(
- typeof arr +
- ' ' +
- arr +
- ' is not iterable(cannot read property Symbol(Symbol.iterator))'
- )
- );
- }
- var args = Array.prototype.slice.call(arr);
- if (args.length === 0) return resolve([]);
- var remaining = args.length;
- function res(i, val) {
- if (val && (typeof val === 'object' || typeof val === 'function')) {
- var then = val.then;
- if (typeof then === 'function') {
- then.call(
- val,
- function(val) {
- res(i, val);
- },
- function(e) {
- args[i] = { status: 'rejected', reason: e };
- if (--remaining === 0) {
- resolve(args);
- }
- }
- );
- return;
- }
- }
- args[i] = { status: 'fulfilled', value: val };
- if (--remaining === 0) {
- resolve(args);
- }
- }
- for (var i = 0; i < args.length; i++) {
- res(i, args[i]);
- }
- });
- }
- // Store setTimeout reference so promise-polyfill will be unaffected by
- // other code modifying setTimeout (like sinon.useFakeTimers())
- var setTimeoutFunc = setTimeout;
- function isArray(x) {
- return Boolean(x && typeof x.length !== 'undefined');
- }
- function noop() {}
- // Polyfill for Function.prototype.bind
- function bind(fn, thisArg) {
- return function() {
- fn.apply(thisArg, arguments);
- };
- }
- /**
- * @constructor
- * @param {Function} fn
- */
- function Promise(fn) {
- if (!(this instanceof Promise))
- throw new TypeError('Promises must be constructed via new');
- if (typeof fn !== 'function') throw new TypeError('not a function');
- /** @type {!number} */
- this._state = 0;
- /** @type {!boolean} */
- this._handled = false;
- /** @type {Promise|undefined} */
- this._value = undefined;
- /** @type {!Array<!Function>} */
- this._deferreds = [];
- doResolve(fn, this);
- }
- function handle(self, deferred) {
- while (self._state === 3) {
- self = self._value;
- }
- if (self._state === 0) {
- self._deferreds.push(deferred);
- return;
- }
- self._handled = true;
- Promise._immediateFn(function() {
- var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected;
- if (cb === null) {
- (self._state === 1 ? resolve : reject)(deferred.promise, self._value);
- return;
- }
- var ret;
- try {
- ret = cb(self._value);
- } catch (e) {
- reject(deferred.promise, e);
- return;
- }
- resolve(deferred.promise, ret);
- });
- }
- function resolve(self, newValue) {
- try {
- // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure
- if (newValue === self)
- throw new TypeError('A promise cannot be resolved with itself.');
- if (
- newValue &&
- (typeof newValue === 'object' || typeof newValue === 'function')
- ) {
- var then = newValue.then;
- if (newValue instanceof Promise) {
- self._state = 3;
- self._value = newValue;
- finale(self);
- return;
- } else if (typeof then === 'function') {
- doResolve(bind(then, newValue), self);
- return;
- }
- }
- self._state = 1;
- self._value = newValue;
- finale(self);
- } catch (e) {
- reject(self, e);
- }
- }
- function reject(self, newValue) {
- self._state = 2;
- self._value = newValue;
- finale(self);
- }
- function finale(self) {
- if (self._state === 2 && self._deferreds.length === 0) {
- Promise._immediateFn(function() {
- if (!self._handled) {
- Promise._unhandledRejectionFn(self._value);
- }
- });
- }
- for (var i = 0, len = self._deferreds.length; i < len; i++) {
- handle(self, self._deferreds[i]);
- }
- self._deferreds = null;
- }
- /**
- * @constructor
- */
- function Handler(onFulfilled, onRejected, promise) {
- this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;
- this.onRejected = typeof onRejected === 'function' ? onRejected : null;
- this.promise = promise;
- }
- /**
- * Take a potentially misbehaving resolver function and make sure
- * onFulfilled and onRejected are only called once.
- *
- * Makes no guarantees about asynchrony.
- */
- function doResolve(fn, self) {
- var done = false;
- try {
- fn(
- function(value) {
- if (done) return;
- done = true;
- resolve(self, value);
- },
- function(reason) {
- if (done) return;
- done = true;
- reject(self, reason);
- }
- );
- } catch (ex) {
- if (done) return;
- done = true;
- reject(self, ex);
- }
- }
- Promise.prototype['catch'] = function(onRejected) {
- return this.then(null, onRejected);
- };
- Promise.prototype.then = function(onFulfilled, onRejected) {
- // @ts-ignore
- var prom = new this.constructor(noop);
- handle(this, new Handler(onFulfilled, onRejected, prom));
- return prom;
- };
- Promise.prototype['finally'] = finallyConstructor;
- Promise.all = function(arr) {
- return new Promise(function(resolve, reject) {
- if (!isArray(arr)) {
- return reject(new TypeError('Promise.all accepts an array'));
- }
- var args = Array.prototype.slice.call(arr);
- if (args.length === 0) return resolve([]);
- var remaining = args.length;
- function res(i, val) {
- try {
- if (val && (typeof val === 'object' || typeof val === 'function')) {
- var then = val.then;
- if (typeof then === 'function') {
- then.call(
- val,
- function(val) {
- res(i, val);
- },
- reject
- );
- return;
- }
- }
- args[i] = val;
- if (--remaining === 0) {
- resolve(args);
- }
- } catch (ex) {
- reject(ex);
- }
- }
- for (var i = 0; i < args.length; i++) {
- res(i, args[i]);
- }
- });
- };
- Promise.allSettled = allSettled;
- Promise.resolve = function(value) {
- if (value && typeof value === 'object' && value.constructor === Promise) {
- return value;
- }
- return new Promise(function(resolve) {
- resolve(value);
- });
- };
- Promise.reject = function(value) {
- return new Promise(function(resolve, reject) {
- reject(value);
- });
- };
- Promise.race = function(arr) {
- return new Promise(function(resolve, reject) {
- if (!isArray(arr)) {
- return reject(new TypeError('Promise.race accepts an array'));
- }
- for (var i = 0, len = arr.length; i < len; i++) {
- Promise.resolve(arr[i]).then(resolve, reject);
- }
- });
- };
- // Use polyfill for setImmediate for performance gains
- Promise._immediateFn =
- // @ts-ignore
- (typeof setImmediate === 'function' &&
- function(fn) {
- // @ts-ignore
- setImmediate(fn);
- }) ||
- function(fn) {
- setTimeoutFunc(fn, 0);
- };
- Promise._unhandledRejectionFn = function _unhandledRejectionFn(err) {
- if (typeof console !== 'undefined' && console) {
- console.warn('Possible Unhandled Promise Rejection:', err); // eslint-disable-line no-console
- }
- };
- /** @suppress {undefinedVars} */
- var globalNS = (function() {
- // the only reliable means to get the global object is
- // `Function('return this')()`
- // However, this causes CSP violations in Chrome apps.
- if (typeof self !== 'undefined') {
- return self;
- }
- if (typeof window !== 'undefined') {
- return window;
- }
- if (typeof __webpack_require__.g !== 'undefined') {
- return __webpack_require__.g;
- }
- throw new Error('unable to locate global object');
- })();
- // Expose the polyfill if Promise is undefined or set to a
- // non-function value. The latter can be due to a named HTMLElement
- // being exposed by browsers for legacy reasons.
- // https://github.com/taylorhakes/promise-polyfill/issues/114
- if (typeof globalNS['Promise'] !== 'function') {
- globalNS['Promise'] = Promise;
- } else {
- if (!globalNS.Promise.prototype['finally']) {
- globalNS.Promise.prototype['finally'] = finallyConstructor;
- }
- if (!globalNS.Promise.allSettled) {
- globalNS.Promise.allSettled = allSettled;
- }
- }
- })));
- /***/ })
- /******/ });
- /************************************************************************/
- /******/ // The module cache
- /******/ var __webpack_module_cache__ = {};
- /******/
- /******/ // The require function
- /******/ function __webpack_require__(moduleId) {
- /******/ // Check if module is in cache
- /******/ var cachedModule = __webpack_module_cache__[moduleId];
- /******/ if (cachedModule !== undefined) {
- /******/ return cachedModule.exports;
- /******/ }
- /******/ // Create a new module (and put it into the cache)
- /******/ var module = __webpack_module_cache__[moduleId] = {
- /******/ // no module.id needed
- /******/ // no module.loaded needed
- /******/ exports: {}
- /******/ };
- /******/
- /******/ // Execute the module function
- /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
- /******/
- /******/ // Return the exports of the module
- /******/ return module.exports;
- /******/ }
- /******/
- /************************************************************************/
- /******/ /* webpack/runtime/compat get default export */
- /******/ (() => {
- /******/ // getDefaultExport function for compatibility with non-harmony modules
- /******/ __webpack_require__.n = (module) => {
- /******/ var getter = module && module.__esModule ?
- /******/ () => (module['default']) :
- /******/ () => (module);
- /******/ __webpack_require__.d(getter, { a: getter });
- /******/ return getter;
- /******/ };
- /******/ })();
- /******/
- /******/ /* webpack/runtime/define property getters */
- /******/ (() => {
- /******/ // define getter functions for harmony exports
- /******/ __webpack_require__.d = (exports, definition) => {
- /******/ for(var key in definition) {
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
- /******/ }
- /******/ }
- /******/ };
- /******/ })();
- /******/
- /******/ /* webpack/runtime/global */
- /******/ (() => {
- /******/ __webpack_require__.g = (function() {
- /******/ if (typeof globalThis === 'object') return globalThis;
- /******/ try {
- /******/ return this || new Function('return this')();
- /******/ } catch (e) {
- /******/ if (typeof window === 'object') return window;
- /******/ }
- /******/ })();
- /******/ })();
- /******/
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
- /******/ (() => {
- /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
- /******/ })();
- /******/
- /************************************************************************/
- var __webpack_exports__ = {};
- // This entry need to be wrapped in an IIFE because it need to be in strict mode.
- (() => {
- "use strict";
- // UNUSED EXPORTS: AddressMatchService, AggregationParameter, AggregationTypes, AlongLineDirection, AnalystAreaUnit, AnalystSizeUnit, AreaSolarRadiationParameters, ArrayStatistic, AttributesPopContainer, BaiduCRS, BaiduTileLayer, Bounds, Browser, BucketAggParameter, BucketAggType, BufferAnalystParameters, BufferDistance, BufferEndType, BufferRadiusUnit, BufferSetting, BuffersAnalystJobsParameter, BurstPipelineAnalystParameters, CRS, CartoCSS, ChangeTileVersion, ChartQueryFilterParameter, ChartQueryParameters, ChartService, ChartType, ChartView, ChartViewModel, CircleStyle, CityTabsPage, ClientComputationLayer, ClientComputationView, ClientComputationViewModel, ClientType, ClipAnalystMode, ClipParameter, CloudTileLayer, CloverStyle, ColorDictionary, ColorGradientType, ColorSpaceType, ColorsPickerUtil, CommonContainer, CommonServiceBase, CommonTheme, CommonUtil, CommontypesConversion, ComponentsUtil, ComponentsViewBase, ComputeWeightMatrixParameters, CreateDatasetParameters, Credential, DataFlowLayer, DataFlowService, DataFlowView, DataFlowViewModel, DataFormat, DataItemOrderBy, DataItemType, DataReturnMode, DataReturnOption, DataServiceQueryView, DataServiceQueryViewModel, DatasetBufferAnalystParameters, DatasetInfo, DatasetOverlayAnalystParameters, DatasetService, DatasetSurfaceAnalystParameters, DatasetThiessenAnalystParameters, DatasourceConnectionInfo, DatasourceService, DensityKernelAnalystParameters, DirectionType, DistributedAnalysisView, DistributedAnalysisViewModel, DropDownBox, EchartsLayer, EditFeaturesParameters, EditType, ElasticSearch, EngineType, EntityType, Event, Events, Exponent, 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, GeoFeatureThemeLayer, GeoHashGridAggParameter, GeoJSONFormat, GeoJSONLayerWithName, GeoJsonLayerDataModel, 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, GetResolutionFromScaleDpi, GraduatedMode, GraphAxesTextDisplayMode, GraphThemeLayer, Graphic, GraphicLayer, Grid, GridCellInfosService, GridType, HeatMapFeature, HeatMapLayer, HillshadeParameter, IManager, IManagerCreateNodeParam, IManagerServiceBase, IPortal, IPortalAddDataParam, IPortalAddResourceParam, IPortalDataConnectionInfoParam, IPortalDataMetaInfoParam, IPortalDataStoreInfoParam, IPortalQueryParam, IPortalQueryResult, IPortalRegisterServiceParam, IPortalResource, IPortalServiceBase, IPortalShareEntity, IPortalShareParam, IPortalUser, ImageCollectionService, ImageGFAspect, ImageGFHillShade, ImageGFOrtho, ImageGFSlope, ImageMapLayer, ImageRenderingRule, ImageSearchParameter, ImageService, ImageStretchOption, ImageStyle, ImageTileLayer, IndexTabsPageContainer, InterpolationAlgorithmType, InterpolationAnalystParameters, InterpolationDensityAnalystParameters, InterpolationIDWAnalystParameters, InterpolationKrigingAnalystParameters, InterpolationRBFAnalystParameters, JSONFormat, JoinItem, JoinType, KernelDensityJobParameter, KeyServiceParameter, LabelBackShape, LabelImageCell, LabelMatrixCell, LabelMixedTextStyle, LabelOverLengthMode, LabelSymbolCell, LabelThemeCell, LabelThemeLayer, Lang, LayerInfoService, LayerStatus, LayerType, LinkItem, Logo, LonLat, MapService, MapVLayer, MapVRenderer, MappingParameters, MapvRenderer, MathExpressionAnalysisParameters, MeasureMode, MeasureParameters, MeasureService, MessageBox, MetricsAggParameter, MetricsAggType, NDVIParameter, NavTabsPage, NetworkAnalyst3DService, NetworkAnalystService, NetworkAnalystServiceBase, NonEarthCRS, NormalRenderer, NormalizeScale, Online, OnlineData, OnlineQueryDatasParameter, OnlineServiceBase, OpenFileView, OpenFileViewModel, OrderBy, OrderType, OutputSetting, OutputType, OverlapDisplayedOptions, OverlayAnalystParameters, OverlayGeoJobParameter, OverlayOperationType, PaginationContainer, PermissionType, Pixel, PixelFormat, PointWithMeasure, PopContainer, ProcessingService, ProcessingServiceBase, QueryByBoundsParameters, QueryByDistanceParameters, QueryByGeometryParameters, QueryBySQLParameters, QueryOption, QueryParameters, QueryService, RangeMode, RangeThemeLayer, RankSymbolThemeLayer, RasterFunctionParameter, RasterFunctionType, ResourceType, Route, RouteCalculateMeasureParameters, RouteLocatorParameters, SVGRenderer, SearchMode, SearchType, SearchView, SearchViewModel, 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, 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, TianDiTu_MercatorCRS, TianDiTu_WGS84CRS, TiandituTileLayer, TileVectorLayer, TiledMapLayer, TiledVectorLayer, TimeControlBase, TimeFlowControl, TokenServiceParameter, TopologyValidatorJobsParameter, TopologyValidatorRule, TrafficTransferAnalystService, TransferLine, TransferPathParameters, TransferPreference, TransferSolutionParameters, TransferTactic, TransportationAnalystParameter, TransportationAnalystResultSetting, TurfLayer, TurnType, UGCLayer, UGCLayerType, UGCMapLayer, UGCSubLayer, UnicodeMarker, UniqueThemeLayer, Unit, UpdateDatasetParameters, UpdateEdgeWeightParameters, UpdateTurnNodeWeightParameters, VariogramMode, Vector, VectorClipJobsParameter, VectorGrid, VectorTileFormat, WKTFormat, WMTSLayer, WebExportFormatType, WebMap, WebPrintingJobContent, WebPrintingJobCustomItems, WebPrintingJobExportOptions, WebPrintingJobImage, WebPrintingJobLayers, WebPrintingJobLayoutOptions, WebPrintingJobLegendOptions, WebPrintingJobLittleMapOptions, WebPrintingJobNorthArrowOptions, WebPrintingJobParameters, WebPrintingJobScaleBarOptions, WebPrintingJobService, WebScaleOrientationType, WebScaleType, WebScaleUnit, addressMatchService, baiduTileLayer, changeTileVersion, chartService, circleStyle, clientComputationLayer, clientComputationView, cloudTileLayer, cloverStyle, componentsViewBase, conversionDegree, crs, crsFromMapJSON, dataFlowLayer, dataFlowService, dataFlowView, dataFlowViewModel, dataServiceQueryView, dataServiceQueryViewModel, datasetService, datasourceService, distributedAnalysisView, echartsLayer, featureService, fieldService, geoJSONLayerWithName, geoprocessingService, getMeterPerMapUnit, getResolutionFromScaleDpi, getWrapNum, graphThemeLayer, graphic, graphicLayer, gridCellInfosService, heatMapFeature, heatMapLayer, imageMapLayer, imageStyle, imageTileLayer, initMap, isCORS, labelThemeLayer, layerInfoService, logo, mapService, mapVLayer, measureService, networkAnalyst3DService, networkAnalystService, nonEarthCRS, normalizeScale, openFileView, openFileViewModel, processingService, queryService, rangeThemeLayer, rankSymbolThemeLayer, resolutionToScale, scaleToResolution, searchView, searchViewModel, setCORS, spatialAnalystService, themeFeature, themeService, tiandituTileLayer, tiledMapLayer, tiledVectorLayer, toGeoJSON, toSuperMapGeometry, trafficTransferAnalystService, transform, turfLayer, unicodeMarker, uniqueThemeLayer, webMap, webPrintingJobService, wmtsLayer
- ;// CONCATENATED MODULE: ./src/common/SuperMap.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- var SuperMap = window.SuperMap = window.SuperMap || {};
- SuperMap.Components = window.SuperMap.Components || {};
- ;// CONCATENATED MODULE: ./src/common/REST.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @enum DataFormat
- * @description 服务请求返回结果数据类型
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.DataFormat.GEOJSON;
- *
- * </script>
- * // ES6 Import
- * import { DataFormat } from '{npm}';
- *
- * const result = DataFormat.GEOJSON;
- * ```
- */
- var DataFormat = {
- /** GEOJSON */
- GEOJSON: "GEOJSON",
- /** ISERVER */
- ISERVER: "ISERVER"
- };
- /**
- * @enum ServerType
- * @description 服务器类型
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.ServerType.ISERVER;
- *
- * </script>
- * // ES6 Import
- * import { ServerType } from '{npm}';
- *
- * const result = ServerType.ISERVER;
- * ```
- */
- var ServerType = {
- /** ISERVER */
- ISERVER: "ISERVER",
- /** IPORTAL */
- IPORTAL: "IPORTAL",
- /** ONLINE */
- ONLINE: "ONLINE"
- };
- /**
- * @enum GeometryType
- * @description 几何对象枚举,定义了一系列几何对象类型。
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.GeometryType.LINE;
- *
- * </script>
- * // ES6 Import
- * import { GeometryType } from '{npm}';
- *
- * const result = GeometryType.LINE;
- * ```
- */
- var GeometryType = {
- /** LINE */
- LINE: "LINE",
- /** LINEM */
- LINEM: "LINEM",
- /** POINT */
- POINT: "POINT",
- /** REGION */
- REGION: "REGION",
- /** POINTEPS */
- POINTEPS: "POINTEPS",
- /** LINEEPS */
- LINEEPS: "LINEEPS",
- /** REGIONEPS */
- REGIONEPS: "REGIONEPS",
- /** ELLIPSE */
- ELLIPSE: "ELLIPSE",
- /** CIRCLE */
- CIRCLE: "CIRCLE",
- /** TEXT */
- TEXT: "TEXT",
- /** RECTANGLE */
- RECTANGLE: "RECTANGLE",
- /** UNKNOWN */
- UNKNOWN: "UNKNOWN",
- /** GEOCOMPOUND */
- GEOCOMPOUND:"GEOCOMPOUND"
- };
- /**
- * @enum QueryOption
- * @description 查询结果类型枚举,描述查询结果返回类型,包括只返回属性、只返回几何实体以及返回属性和几何实体。
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.QueryOption.ATTRIBUTE;
- *
- * </script>
- * // ES6 Import
- * import { QueryOption } from '{npm}';
- *
- * const result = QueryOption.ATTRIBUTE;
- * ```
- */
- var QueryOption = {
- /** 属性 */
- ATTRIBUTE: "ATTRIBUTE",
- /** 属性和几何对象 */
- ATTRIBUTEANDGEOMETRY: "ATTRIBUTEANDGEOMETRY",
- /** 几何对象 */
- GEOMETRY: "GEOMETRY"
- };
- /**
- * @enum JoinType
- * @description 关联查询时的关联类型常量。
- * 该类定义了两个表之间的连接类型常量,决定了对两个表之间进行连接查询时,查询结果中得到的记录的情况。
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.JoinType.INNERJOIN;
- *
- * </script>
- * // ES6 Import
- * import { JoinType } from '{npm}';
- *
- * const result = JoinType.INNERJOIN;
- * ```
- */
- var JoinType = {
- /** 内连接 */
- INNERJOIN: "INNERJOIN",
- /** 左连接 */
- LEFTJOIN: "LEFTJOIN"
- };
- /**
- * @enum SpatialQueryMode
- * @description 空间查询模式枚举。该类定义了空间查询操作模式常量。
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.SpatialQueryMode.CONTAIN;
- *
- * </script>
- * // ES6 Import
- * import { SpatialQueryMode } from '{npm}';
- *
- * const result = SpatialQueryMode.CONTAIN;
- * ```
- */
- var SpatialQueryMode = {
- /** 包含空间查询模式 */
- CONTAIN: "CONTAIN",
- /** 交叉空间查询模式 */
- CROSS: "CROSS",
- /** 分离空间查询模式 */
- DISJOINT: "DISJOINT",
- /** 重合空间查询模式 */
- IDENTITY: "IDENTITY",
- /** 相交空间查询模式 */
- INTERSECT: "INTERSECT",
- /** 无空间查询 */
- NONE: "NONE",
- /** 叠加空间查询模式 */
- OVERLAP: "OVERLAP",
- /** 邻接空间查询模式 */
- TOUCH: "TOUCH",
- /** 被包含空间查询模式 */
- WITHIN: "WITHIN"
- };
- /**
- * @enum SpatialRelationType
- * @description 数据集对象间的空间关系枚举。
- * 该类定义了数据集对象间的空间关系类型常量。
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.SpatialRelationType.CONTAIN;
- *
- * </script>
- * // ES6 Import
- * import { SpatialRelationType } from '{npm}';
- *
- * const result = {namespace}.SpatialRelationType.CONTAIN;
- * ```
- */
- var SpatialRelationType = {
- /** 包含关系 */
- CONTAIN: "CONTAIN",
- /** 相交关系 */
- INTERSECT: "INTERSECT",
- /** 被包含关系 */
- WITHIN: "WITHIN"
- };
- /**
- * @enum MeasureMode
- * @type {string}
- * @description 量算模式枚举。
- * @category BaseTypes Constant
- * 该类定义了两种测量模式:距离测量和面积测量。
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.MeasureMode.DISTANCE;
- *
- * </script>
- * // ES6 Import
- * import { MeasureMode } from '{npm}';
- *
- * const result = MeasureMode.DISTANCE;
- * ```
- */
- var MeasureMode = {
- /** 距离测量 */
- DISTANCE: "DISTANCE",
- /** 面积测量 */
- AREA: "AREA"
- };
- /**
- * @enum Unit
- * @description 距离单位枚举。
- * 该类定义了一系列距离单位类型。
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.Unit.METER;
- *
- * </script>
- * // ES6 Import
- * import { Unit } from '{npm}';
- *
- * const result = Unit.METER;
- * ```
- */
- var Unit = {
- /** 米 */
- METER: "METER",
- /** 千米 */
- KILOMETER: "KILOMETER",
- /** 英里 */
- MILE: "MILE",
- /** 码 */
- YARD: "YARD",
- /** 度 */
- DEGREE: "DEGREE",
- /** 毫米 */
- MILLIMETER: "MILLIMETER",
- /** 厘米 */
- CENTIMETER: "CENTIMETER",
- /** 英寸 */
- INCH: "INCH",
- /** 分米 */
- DECIMETER: "DECIMETER",
- /** 英尺 */
- FOOT: "FOOT",
- /** 秒 */
- SECOND: "SECOND",
- /** 分 */
- MINUTE: "MINUTE",
- /** 弧度 */
- RADIAN: "RADIAN"
- };
- /**
- * @enum BufferRadiusUnit
- * @description 缓冲区距离单位枚举。该类定义了一系列缓冲距离单位类型。
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.BufferRadiusUnit.CENTIMETER;
- *
- * </script>
- * // ES6 Import
- * import { BufferRadiusUnit } from '{npm}';
- *
- * const result = BufferRadiusUnit.CENTIMETER;
- * ```
- */
- var BufferRadiusUnit = {
- /** 厘米 */
- CENTIMETER: "CENTIMETER",
- /** 分米 */
- DECIMETER: "DECIMETER",
- /** 英尺 */
- FOOT: "FOOT",
- /** 英寸 */
- INCH: "INCH",
- /** 千米 */
- KILOMETER: "KILOMETER",
- /** 米 */
- METER: "METER",
- /** 英里 */
- MILE: "MILE",
- /** 毫米 */
- MILLIMETER: "MILLIMETER",
- /** 码 */
- YARD: "YARD"
- }
- /**
- * @enum EngineType
- * @description 数据源引擎类型枚举。
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.EngineType.IMAGEPLUGINS;
- *
- * </script>
- * // ES6 Import
- * import { EngineType } from '{npm}';
- *
- * const result = EngineType.IMAGEPLUGINS;
- * ```
- */
- var EngineType = {
- /** 影像只读引擎类型,文件引擎,针对通用影像格式如 BMP,JPG,TIFF 以及超图自定义影像格式 SIT 等。 */
- IMAGEPLUGINS: "IMAGEPLUGINS",
- /** OGC 引擎类型,针对于 Web 数据源,Web 引擎,目前支持的类型有 WMS,WFS,WCS。 */
- OGC: "OGC",
- /** Oracle 引擎类型,针对 Oracle 数据源,数据库引擎。 */
- ORACLEPLUS: "ORACLEPLUS",
- /** SDB 引擎类型,文件引擎,即 SDB 数据源。 */
- SDBPLUS: "SDBPLUS",
- /** SQL Server 引擎类型,针对 SQL Server 数据源,数据库引擎 */
- SQLPLUS: "SQLPLUS",
- /** UDB 引擎类型,文件引擎。 */
- UDB: "UDB"
- };
- /**
- * @enum ThemeGraphTextFormat
- * @description 统计专题图文本显示格式枚举。
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.ThemeGraphTextFormat.CAPTION;
- *
- * </script>
- * // ES6 Import
- * import { ThemeGraphTextFormat } from '{npm}';
- *
- * const result = ThemeGraphTextFormat.CAPTION;
- * ```
- */
- var ThemeGraphTextFormat = {
- /** 标题。以各子项的标题来进行标注。 */
- CAPTION: "CAPTION",
- /** 标题 + 百分数。以各子项的标题和所占的百分比来进行标注。 */
- CAPTION_PERCENT: "CAPTION_PERCENT",
- /** 标题 + 实际数值。以各子项的标题和真实数值来进行标注。 */
- CAPTION_VALUE: "CAPTION_VALUE",
- /** 百分数。以各子项所占的百分比来进行标注。 */
- PERCENT: "PERCENT",
- /** 实际数值。以各子项的真实数值来进行标注。 */
- VALUE: "VALUE"
- };
- /**
- * @enum ThemeGraphType
- * @description 统计专题图类型枚举。
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.ThemeGraphType.AREA;
- *
- * </script>
- * // ES6 Import
- * import { ThemeGraphType } from '{npm}';
- *
- * const result = ThemeGraphType.AREA;
- * ```
- */
- var ThemeGraphType = {
- /** 面积图。 */
- AREA: "AREA",
- /** 柱状图。 */
- BAR: "BAR",
- /** 三维柱状图。 */
- BAR3D: "BAR3D",
- /** 折线图。 */
- LINE: "LINE",
- /** 饼图。 */
- PIE: "PIE",
- /** 三维饼图。 */
- PIE3D: "PIE3D",
- /** 点状图。 */
- POINT: "POINT",
- /** 环状图。 */
- RING: "RING",
- /** 玫瑰图。 */
- ROSE: "ROSE",
- /** 三维玫瑰图。 */
- ROSE3D: "ROSE3D",
- /** 堆叠柱状图。 */
- STACK_BAR: "STACK_BAR",
- /** 三维堆叠柱状图。 */
- STACK_BAR3D: "STACK_BAR3D",
- /** 阶梯图。 */
- STEP: "STEP"
- };
- /**
- * @enum GraphAxesTextDisplayMode
- * @description 统计专题图坐标轴文本显示模式。
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.GraphAxesTextDisplayMode.ALL;
- *
- * </script>
- * // ES6 Import
- * import { GraphAxesTextDisplayMode } from '{npm}';
- *
- * const result = GraphAxesTextDisplayMode.ALL;
- * ```
- */
- var GraphAxesTextDisplayMode = {
- /** 显示全部文本。 */
- ALL: "ALL",
- /** 不显示。 */
- NONE: "NONE",
- /** 显示Y轴的文本。 */
- YAXES: "YAXES"
- };
- /**
- * @enum GraduatedMode
- * @description 专题图分级模式枚举。
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.GraduatedMode.CONSTANT;
- *
- * </script>
- * // ES6 Import
- * import { GraduatedMode } from '{npm}';
- *
- * const result = GraduatedMode.CONSTANT;
- * ```
- */
- var GraduatedMode = {
- /** 常量分级模式。 */
- CONSTANT: "CONSTANT",
- /** 对数分级模式。 */
- LOGARITHM: "LOGARITHM",
- /** 平方根分级模式。 */
- SQUAREROOT: "SQUAREROOT"
- };
- /**
- * @enum RangeMode
- * @description 范围分段专题图分段方式枚举。
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.RangeMode.CUSTOMINTERVAL;
- *
- * </script>
- * // ES6 Import
- * import { RangeMode } from '{npm}';
- *
- * const result = RangeMode.CUSTOMINTERVAL;
- * ```
- */
- var RangeMode = {
- /** 自定义分段法。 */
- CUSTOMINTERVAL: "CUSTOMINTERVAL",
- /** 等距离分段法。 */
- EQUALINTERVAL: "EQUALINTERVAL",
- /** 对数分段法。 */
- LOGARITHM: "LOGARITHM",
- /** 等计数分段法。 */
- QUANTILE: "QUANTILE",
- /** 平方根分段法。 */
- SQUAREROOT: "SQUAREROOT",
- /** 标准差分段法。 */
- STDDEVIATION: "STDDEVIATION"
- };
- /**
- * @enum ThemeType
- * @description 专题图类型枚举。
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.ThemeType.DOTDENSITY;
- *
- * </script>
- * // ES6 Import
- * import { ThemeType } from '{npm}';
- *
- * const result = ThemeType.DOTDENSITY;
- * ```
- */
- var ThemeType = {
- /** 点密度专题图。 */
- DOTDENSITY: "DOTDENSITY",
- /** 等级符号专题图。 */
- GRADUATEDSYMBOL: "GRADUATEDSYMBOL",
- /** 统计专题图。 */
- GRAPH: "GRAPH",
- /** 标签专题图。 */
- LABEL: "LABEL",
- /** 分段专题图。 */
- RANGE: "RANGE",
- /** 単值专题图。 */
- UNIQUE: "UNIQUE"
- };
- /**
- * @enum ColorGradientType
- * @description 渐变颜色枚举。
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.ColorGradientType.BLACK_WHITE;
- *
- * </script>
- * // ES6 Import
- * import { ColorGradientType } from '{npm}';
- *
- * const result = ColorGradientType.BLACK_WHITE;
- * ```
- */
- var ColorGradientType = {
- /** 黑白渐变色。 */
- BLACK_WHITE: "BLACKWHITE",
- /** 蓝黑渐变色。 */
- BLUE_BLACK: "BLUEBLACK",
- /** 蓝红渐变色。 */
- BLUE_RED: "BLUERED",
- /** 蓝白渐变色。 */
- BLUE_WHITE: "BLUEWHITE",
- /** 青黑渐变色。 */
- CYAN_BLACK: "CYANBLACK",
- /** 青蓝渐变色。 */
- CYAN_BLUE: "CYANBLUE",
- /** 青绿渐变色。 */
- CYAN_GREEN: "CYANGREEN",
- /** 青白渐变色。 */
- CYAN_WHITE: "CYANWHITE",
- /** 绿黑渐变色。 */
- GREEN_BLACK: "GREENBLACK",
- /** 绿蓝渐变色。 */
- GREEN_BLUE: "GREENBLUE",
- /** 绿橙紫渐变色。 */
- GREEN_ORANGE_VIOLET: "GREENORANGEVIOLET",
- /** 绿红渐变色。 */
- GREEN_RED: "GREENRED",
- /** 蓝红渐变色。 */
- GREEN_WHITE: "GREENWHITE",
- /** 粉黑渐变色。 */
- PINK_BLACK: "PINKBLACK",
- /** 粉蓝渐变色。 */
- PINK_BLUE: "PINKBLUE",
- /** 粉红渐变色。 */
- PINK_RED: "PINKRED",
- /** 粉白渐变色。 */
- PINK_WHITE: "PINKWHITE",
- /** 彩虹色。 */
- RAIN_BOW: "RAINBOW",
- /** 红黑渐变色。 */
- RED_BLACK: "REDBLACK",
- /** 红白渐变色。 */
- RED_WHITE: "REDWHITE",
- /** 光谱渐变。 */
- SPECTRUM: "SPECTRUM",
- /** 地形渐变,用于三维显示效果较好。 */
- TERRAIN: "TERRAIN",
- /** 黄黑渐变色。 */
- YELLOW_BLACK: "YELLOWBLACK",
- /** 黄蓝渐变色。 */
- YELLOW_BLUE: "YELLOWBLUE",
- /** 黄绿渐变色。 */
- YELLOW_GREEN: "YELLOWGREEN",
- /** 黄红渐变色。 */
- YELLOW_RED: "YELLOWRED",
- /** 黄白渐变色。 */
- YELLOW_WHITE: "YELLOWWHITE"
- };
- /**
- * @enum TextAlignment
- * @description 文本对齐枚举。
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.TextAlignment.TOPLEFT;
- *
- * </script>
- * // ES6 Import
- * import { TextAlignment } from '{npm}';
- *
- * const result = TextAlignment.TOPLEFT;
- * ```
- */
- var TextAlignment = {
- /** 左上角对齐。 */
- TOPLEFT: "TOPLEFT",
- /** 顶部居中对齐。 */
- TOPCENTER: "TOPCENTER",
- /** 右上角对齐。 */
- TOPRIGHT: "TOPRIGHT",
- /** 基准线左对齐。 */
- BASELINELEFT: "BASELINELEFT",
- /** 基准线居中对齐。 */
- BASELINECENTER: "BASELINECENTER",
- /** 基准线右对齐。 */
- BASELINERIGHT: "BASELINERIGHT",
- /** 左下角对齐。 */
- BOTTOMLEFT: "BOTTOMLEFT",
- /** 底部居中对齐。 */
- BOTTOMCENTER: "BOTTOMCENTER",
- /** 右下角对齐。 */
- BOTTOMRIGHT: "BOTTOMRIGHT",
- /** 左中对齐。 */
- MIDDLELEFT: "MIDDLELEFT",
- /** 中心对齐。 */
- MIDDLECENTER: "MIDDLECENTER",
- /** 右中对齐。 */
- MIDDLERIGHT: "MIDDLERIGHT"
- };
- /**
- * @enum FillGradientMode
- * @description 渐变填充风格的渐变类型枚举。
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.FillGradientMode.NONE;
- *
- * </script>
- * // ES6 Import
- * import { FillGradientMode } from '{npm}';
- *
- * const result = FillGradientMode.NONE;
- * ```
- */
- var FillGradientMode = {
- /** 无渐变。 */
- NONE: "NONE",
- /** 线性渐变填充。 */
- LINEAR: "LINEAR",
- /** 辐射渐变填充。 */
- RADIAL: "RADIAL",
- /** 圆锥渐变填充。 */
- CONICAL: "CONICAL",
- /** 四角渐变填充。 */
- SQUARE: "SQUARE"
- };
- /**
- * @enum AlongLineDirection
- * @description 标签沿线标注方向枚举。
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.AlongLineDirection.NORMAL;
- *
- * </script>
- * // ES6 Import
- * import { AlongLineDirection } from '{npm}';
- *
- * const result = AlongLineDirection.NORMAL;
- * ```
- */
- var AlongLineDirection = {
- /** 沿线的法线方向放置标签。 */
- NORMAL: "ALONG_LINE_NORMAL",
- /** 从下到上,从左到右放置。 */
- LB_TO_RT: "LEFT_BOTTOM_TO_RIGHT_TOP",
- /** 从上到下,从左到右放置。 */
- LT_TO_RB: "LEFT_TOP_TO_RIGHT_BOTTOM",
- /** 从下到上,从右到左放置。 */
- RB_TO_LT: "RIGHT_BOTTOM_TO_LEFT_TOP",
- /** 从上到下,从右到左放置。 */
- RT_TO_LB: "RIGHT_TOP_TO_LEFT_BOTTOM"
- };
- /**
- * @enum LabelBackShape
- * @description 标签专题图中标签背景的形状枚举。
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.LabelBackShape.DIAMOND;
- *
- * </script>
- * // ES6 Import
- * import { LabelBackShape } from '{npm}';
- *
- * const result = LabelBackShape.DIAMOND;
- * ```
- */
- var LabelBackShape = {
- /** 菱形背景,即标签背景的形状为菱形。 */
- DIAMOND: "DIAMOND",
- /** 椭圆形背景,即标签背景的行状为椭圆形。 */
- ELLIPSE: "ELLIPSE",
- /** 符号背景,即标签背景的形状为设定的符号。 */
- MARKER: "MARKER",
- /** 空背景,即不使用任何形状作为标签的背景。 */
- NONE: "NONE",
- /** 矩形背景,即标签背景的形状为矩形。 */
- RECT: "RECT",
- /** 圆角矩形背景,即标签背景的形状为圆角矩形。 */
- ROUNDRECT: "ROUNDRECT",
- /** 三角形背景,即标签背景的形状为三角形。 */
- TRIANGLE: "TRIANGLE"
- };
- /**
- * @enum LabelOverLengthMode
- * @description 标签专题图中超长标签的处理模式枚举。
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.LabelOverLengthMode.NEWLINE;
- *
- * </script>
- * // ES6 Import
- * import { LabelOverLengthMode } from '{npm}';
- *
- * const result = LabelOverLengthMode.NEWLINE;
- * ```
- */
- var LabelOverLengthMode = {
- /** 换行显示。 */
- NEWLINE: "NEWLINE",
- /** 对超长标签不进行处理。 */
- NONE: "NONE",
- /** 省略超出部分。 */
- OMIT: "OMIT"
- };
- /**
- * @enum DirectionType
- * @description 网络分析中方向枚举。
- * 在行驶引导子项中使用。
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.DirectionType.EAST;
- *
- * </script>
- * // ES6 Import
- * import { DirectionType } from '{npm}';
- *
- * const result = DirectionType.EAST;
- * ```
- */
- var DirectionType = {
- /** 东。 */
- EAST: "EAST",
- /** 无方向。 */
- NONE: "NONE",
- /** 北。 */
- NORTH: "NORTH",
- /** 南。 */
- SOURTH: "SOURTH",
- /** 西。 */
- WEST: "WEST"
- };
- /**
- * @enum SideType
- * @description 行驶位置枚举。
- * 表示在行驶在路的左边、右边或者路上的枚举,该类用在行驶导引子项类中。
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.SideType.LEFT;
- *
- * </script>
- * // ES6 Import
- * import { SideType } from '{npm}';
- *
- * const result = SideType.LEFT;
- * ```
- */
- var SideType = {
- /** 路的左侧。 */
- LEFT: "LEFT",
- /** 在路上(即路的中间)。 */
- MIDDLE: "MIDDLE",
- /** 无效值。 */
- NONE: "NONE",
- /** 路的右侧。 */
- RIGHT: "RIGHT"
- };
- /**
- * @enum SupplyCenterType
- * @description 资源供给中心类型枚举。
- * 该枚举定义了网络分析中资源中心点的类型,主要用于资源分配和选址分区。
- * 资源供给中心点的类型包括非中心,固定中心和可选中心。固定中心用于资源分配分析; 固定中心和可选中心用于选址分析;非中心在两种网络分析时都不予考虑。
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.SupplyCenterType.FIXEDCENTER;
- *
- * </script>
- * // ES6 Import
- * import { SupplyCenterType } from '{npm}';
- *
- * const result = SupplyCenterType.FIXEDCENTER;
- * ```
- */
- var SupplyCenterType = {
- /** 固定中心点。 */
- FIXEDCENTER: "FIXEDCENTER",
- /** 非中心点。 */
- NULL: "NULL",
- /** 可选中心点。 */
- OPTIONALCENTER: "OPTIONALCENTER"
- };
- /**
- * @enum TurnType
- * @description 转弯方向枚举。
- * 用在行驶引导子项类中,表示转弯的方向。
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.TurnType.AHEAD;
- *
- * </script>
- * // ES6 Import
- * import { TurnType } from '{npm}';
- *
- * const result = TurnType.AHEAD;
- * ```
- */
- var TurnType = {
- /** 向前直行。 */
- AHEAD: "AHEAD",
- /** 掉头。 */
- BACK: "BACK",
- /** 终点,不拐弯。 */
- END: "END",
- /** 左转弯。 */
- LEFT: "LEFT",
- /** 无效值。 */
- NONE: "NONE",
- /** 右转弯。 */
- RIGHT: "RIGHT"
- };
- /**
- * @enum BufferEndType
- * @description 缓冲区分析BufferEnd类型。
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.BufferEndType.FLAT;
- *
- * </script>
- * // ES6 Import
- * import { BufferEndType } from '{npm}';
- *
- * const result = BufferEndType.FLAT;
- * ```
- */
- var BufferEndType = {
- /** FLAT */
- FLAT: "FLAT",
- /** ROUND */
- ROUND: "ROUND"
- };
- /**
- * @enum OverlayOperationType
- * @description 叠加分析类型枚举。
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.OverlayOperationType.CLIP;
- *
- * </script>
- * // ES6 Import
- * import { OverlayOperationType } from '{npm}';
- *
- * const result = OverlayOperationType.CLIP;
- * ```
- */
- var OverlayOperationType = {
- /** 操作数据集(几何对象)裁剪被操作数据集(几何对象)。 */
- CLIP: "CLIP",
- /** 在被操作数据集(几何对象)上擦除掉与操作数据集(几何对象)相重合的部分。 */
- ERASE: "ERASE",
- /**对被操作数据集(几何对象)进行同一操作,即操作执行后,被操作数据集(几何对象)包含来自操作数据集(几何对象)的几何形状。 */
- IDENTITY: "IDENTITY",
- /** 对两个数据集(几何对象)求交,返回两个数据集(几何对象)的交集。 */
- INTERSECT: "INTERSECT",
- /** 对两个面数据集(几何对象)进行合并操作。 */
- UNION: "UNION",
- /** 对两个面数据集(几何对象)进行更新操作。 */
- UPDATE: "UPDATE",
- /** 对两个面数据集(几何对象)进行对称差操作。 */
- XOR: "XOR"
- };
- /**
- * @enum OutputType
- * @description 分布式分析输出类型枚举。
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.OutputType.INDEXEDHDFS;
- *
- * </script>
- * // ES6 Import
- * import { OutputType } from '{npm}';
- *
- * const result = OutputType.INDEXEDHDFS;
- * ```
- */
- var OutputType = {
- /** INDEXEDHDFS */
- INDEXEDHDFS: "INDEXEDHDFS",
- /** UDB */
- UDB: "UDB",
- /** MONGODB */
- MONGODB: "MONGODB",
- /** PG */
- PG: "PG"
- };
- /**
- * @enum SmoothMethod
- * @description 光滑方法枚举。
- * 用于从Grid 或DEM数据生成等值线或等值面时对等值线或者等值面的边界线进行平滑处理的方法。
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.SmoothMethod.BSPLINE;
- *
- * </script>
- * // ES6 Import
- * import { SmoothMethod } from '{npm}';
- *
- * const result = SmoothMethod.BSPLINE;
- * ```
- */
- var SmoothMethod = {
- /** B 样条法。 */
- BSPLINE: "BSPLINE",
- /** 磨角法。 */
- POLISH: "POLISH"
- };
- /**
- * @enum SurfaceAnalystMethod
- * @description 表面分析方法枚举。
- * 通过对数据进行表面分析,能够挖掘原始数据所包含的信息,使某些细节明显化,易于分析。
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.SurfaceAnalystMethod.ISOLINE;
- *
- * </script>
- * // ES6 Import
- * import { SurfaceAnalystMethod } from '{npm}';
- *
- * const result = SurfaceAnalystMethod.ISOLINE;
- * ```
- */
- var SurfaceAnalystMethod = {
- /** 等值线提取。 */
- ISOLINE: "ISOLINE",
- /** 等值面提取。 */
- ISOREGION: "ISOREGION"
- };
- /**
- * @enum DataReturnMode
- * @description 数据返回模式枚举。
- * 该枚举用于指定空间分析返回结果模式,包含返回数据集标识和记录集、只返回数据集标识(数据集名称@数据源名称)及只返回记录集三种模式。
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.DataReturnMode.DATASET_AND_RECORDSET;
- *
- * </script>
- * // ES6 Import
- * import { DataReturnMode } from '{npm}';
- *
- * const result = DataReturnMode.DATASET_AND_RECORDSET;
- * ```
- */
- var DataReturnMode = {
- /** 返回结果数据集标识(数据集名称@数据源名称)和记录集(RecordSet)。 */
- DATASET_AND_RECORDSET: "DATASET_AND_RECORDSET",
- /** 只返回数据集标识(数据集名称@数据源名称)。 */
- DATASET_ONLY: "DATASET_ONLY",
- /** 只返回记录集(RecordSet)。 */
- RECORDSET_ONLY: "RECORDSET_ONLY"
- };
- /**
- * @enum EditType
- * @description 要素集更新模式枚举。
- * 该枚举用于指定数据服务中要素集更新模式,包含添加要素集、更新要素集和删除要素集。
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.EditType.ADD;
- *
- * </script>
- * // ES6 Import
- * import { EditType } from '{npm}';
- *
- * const result = {namespace}.EditType.ADD;
- * ```
- */
- var EditType = {
- /** 增加操作。 */
- ADD: "add",
- /** 修改操作。 */
- UPDATE: "update",
- /** 删除操作。 */
- DELETE: "delete"
- };
- /**
- * @enum TransferTactic
- * @description 公交换乘策略枚举。
- * 该枚举用于指定公交服务中要素集更新模式,包含添加要素集、更新要素集和删除要素集。
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.TransferTactic.LESS_TIME;
- *
- * </script>
- * // ES6 Import
- * import { TransferTactic } from '{npm}';
- *
- * const result = TransferTactic.LESS_TIME;
- * ```
- */
- var TransferTactic = {
- /** 时间短。 */
- LESS_TIME: "LESS_TIME",
- /** 少换乘。 */
- LESS_TRANSFER: "LESS_TRANSFER",
- /** 少步行。 */
- LESS_WALK: "LESS_WALK",
- /** 距离最短。 */
- MIN_DISTANCE: "MIN_DISTANCE"
- };
- /**
- * @enum TransferPreference
- * @description 公交换乘策略枚举。
- * 该枚举用于指定交通换乘服务中设置地铁优先、公交优先、不乘地铁、无偏好等偏好设置。
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.TransferPreference.BUS;
- *
- * </script>
- * // ES6 Import
- * import { TransferPreference } from '{npm}';
- *
- * const result = TransferPreference.BUS;
- * ```
- */
- var TransferPreference = {
- /** 公交汽车优先。 */
- BUS: "BUS",
- /** 地铁优先。 */
- SUBWAY: "SUBWAY",
- /** 不乘坐地铁。 */
- NO_SUBWAY: "NO_SUBWAY",
- /** 无乘车偏好。 */
- NONE: "NONE"
- };
- /**
- * @enum GridType
- * @description 地图背景格网类型枚举。
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.GridType.CROSS;
- *
- * </script>
- * // ES6 Import
- * import { GridType } from '{npm}';
- *
- * const result = GridType.CROSS;
- * ```
- */
- var GridType = {
- /** 十字叉丝。 */
- CROSS: "CROSS",
- /** 网格线。 */
- GRID: "GRID",
- /** 点。 */
- POINT: "POINT"
- };
- /**
- * @enum ColorSpaceType
- * @description 色彩空间枚举。
- * 由于成色原理的不同,决定了显示器、投影仪这类靠色光直接合成颜色的颜色设备和打印机、
- * 印刷机这类靠使用颜料的印刷设备在生成颜色方式上的区别。
- * 针对上述不同成色方式,SuperMap 提供两种色彩空间,
- * 分别为 RGB 和 CMYK。RGB 主要用于显示系统中,CMYK 主要用于印刷系统中。
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.ColorSpaceType.CMYK;
- *
- * </script>
- * // ES6 Import
- * import { ColorSpaceType } from '{npm}';
- *
- * const result = ColorSpaceType.CMYK;
- * ```
- */
- var ColorSpaceType = {
- /** 该类型主要在印刷系统使用。 */
- CMYK: "CMYK",
- /** 该类型主要在显示系统中使用。 */
- RGB: "RGB"
- };
- /**
- * @enum LayerType
- * @description 图层类型。
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.LayerType.UGC;
- *
- * </script>
- * // ES6 Import
- * import { LayerType } from '{npm}';
- *
- * const result = LayerType.UGC;
- * ```
- */
- var LayerType = {
- /** SuperMap UGC 类型图层。如矢量图层、栅格(Grid)图层、影像图层。 */
- UGC: "UGC",
- /** WMS 图层。 */
- WMS: "WMS",
- /** WFS 图层。 */
- WFS: "WFS",
- /** 自定义图层。 */
- CUSTOM: "CUSTOM"
- };
- /**
- * @enum UGCLayerType
- * @description SuperMap 图层类型。
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.UGCLayerType.THEME;
- *
- * </script>
- * // ES6 Import
- * import { UGCLayerType } from '{npm}';
- *
- * const result = UGCLayerType.THEME;
- * ```
- */
- var UGCLayerType = {
- /** 专题图层。 */
- THEME: "THEME",
- /** 矢量图层。 */
- VECTOR: "VECTOR",
- /** 栅格图层。。 */
- GRID: "GRID",
- /** 影像图层。 */
- IMAGE: "IMAGE"
- };
- /**
- * @enum StatisticMode
- * @description 字段统计方法类型。
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.StatisticMode.AVERAGE;
- *
- * </script>
- * // ES6 Import
- * import { StatisticMode } from '{npm}';
- *
- * const result = StatisticMode.AVERAGE;
- * ```
- */
- var StatisticMode = {
- /** 统计所选字段的平均值。 */
- AVERAGE: "AVERAGE",
- /** 统计所选字段的最大值。 */
- MAX: "MAX",
- /** 统计所选字段的最小值。 */
- MIN: "MIN",
- /** 统计所选字段的标准差 */
- STDDEVIATION: "STDDEVIATION",
- /** 统计所选字段的总和。 */
- SUM: "SUM",
- /** 统计所选字段的方差。 */
- VARIANCE: "VARIANCE"
- };
- /**
- * @enum PixelFormat
- * @description 栅格与影像数据存储的像素格式枚举。
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.PixelFormat.BIT16;
- *
- * </script>
- * // ES6 Import
- * import { PixelFormat } from '{npm}';
- *
- * const result = PixelFormat.BIT16;
- * ```
- */
- var PixelFormat = {
- /** 每个像元用16个比特(即2个字节)表示。 */
- BIT16: "BIT16",
- /** 每个像元用32个比特(即4个字节)表示。 */
- BIT32: "BIT32",
- /** 每个像元用64个比特(即8个字节)表示,只提供给栅格数据集使用。 */
- BIT64: "BIT64",
- /** 每个像元用4个字节来表示,只提供给栅格数据集使用。 */
- SINGLE: "SINGLE",
- /** 每个像元用8个字节来表示,只提供给栅格数据集使用。 */
- DOUBLE: "DOUBLE",
- /** 每个像元用1个比特表示。 */
- UBIT1: "UBIT1",
- /** 每个像元用4个比特来表示。 */
- UBIT4: "UBIT4",
- /** 每个像元用8个比特(即1个字节)来表示。 */
- UBIT8: "UBIT8",
- /** 每个像元用24个比特(即3个字节)来表示。 */
- UBIT24: "UBIT24",
- /** 每个像元用32个比特(即4个字节)来表示。 */
- UBIT32: "UBIT32"
- };
- /**
- * @enum SearchMode
- * @description 内插时使用的样本点的查找方式枚举
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.SearchMode.KDTREE_FIXED_COUNT;
- *
- * </script>
- * // ES6 Import
- * import { SearchMode } from '{npm}';
- *
- * const result = SearchMode.KDTREE_FIXED_COUNT;
- * ```
- */
- var SearchMode = {
- /** 使用 KDTREE 的固定点数方式查找参与内插分析的点。 */
- KDTREE_FIXED_COUNT: "KDTREE_FIXED_COUNT",
- /** 使用 KDTREE 的定长方式查找参与内插分析的点。 */
- KDTREE_FIXED_RADIUS: "KDTREE_FIXED_RADIUS",
- /** 不进行查找,使用所有的输入点进行内插分析。 */
- NONE: "NONE",
- /** 使用 QUADTREE 方式查找参与内插分析的点,仅对样条(RBF)插值和普通克吕金(Kriging)有用。 */
- QUADTREE: "QUADTREE"
- };
- /**
- * @enum InterpolationAlgorithmType
- * @description 插值分析的算法的类型
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.InterpolationAlgorithmType.KRIGING;
- *
- * </script>
- * // ES6 Import
- * import { InterpolationAlgorithmType } from '{npm}';
- *
- * const result = InterpolationAlgorithmType.KRIGING;
- * ```
- */
- var InterpolationAlgorithmType = {
- /** 普通克吕金插值法。 */
- KRIGING: "KRIGING",
- /** 简单克吕金插值法。 */
- SimpleKriging: "SimpleKriging",
- /** 泛克吕金插值法。 */
- UniversalKriging: "UniversalKriging"
- };
- /**
- * @enum VariogramMode
- * @description 克吕金(Kriging)插值时的半变函数类型枚举
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.VariogramMode.EXPONENTIAL;
- *
- * </script>
- * // ES6 Import
- * import { VariogramMode } from '{npm}';
- *
- * const result = VariogramMode.EXPONENTIAL;
- * ```
- */
- var VariogramMode = {
- /** 指数函数。 */
- EXPONENTIAL: "EXPONENTIAL",
- /** 高斯函数。 */
- GAUSSIAN: "GAUSSIAN",
- /** 球型函数。 */
- SPHERICAL: "SPHERICAL"
- };
- /**
- * @enum Exponent
- * @description 定义了泛克吕金(UniversalKriging)插值时样点数据中趋势面方程的阶数
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.Exponent.EXP1;
- *
- * </script>
- * // ES6 Import
- * import { Exponent } from '{npm}';
- *
- * const result = Exponent.EXP1;
- * ```
- */
- var Exponent = {
- /** 阶数为1。 */
- EXP1: "EXP1",
- /** 阶数为2。 */
- EXP2: "EXP2"
- };
- /**
- * @enum ClientType
- * @description token申请的客户端标识类型
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.ClientType.IP;
- *
- * </script>
- * // ES6 Import
- * import { ClientType } from '{npm}';
- *
- * const result = ClientType.IP;
- * ```
- */
- var ClientType = {
- /** 指定的 IP 地址。 */
- IP: "IP",
- /** 指定的 URL。 */
- REFERER: "Referer",
- /** 发送申请令牌请求的客户端 IP。 */
- REQUESTIP: "RequestIP",
- /** 不做任何验证。 */
- NONE: "NONE",
- /** SERVER。 */
- SERVER: "SERVER",
- /** WEB。 */
- WEB: "WEB"
- };
- /**
- * @enum ChartType
- * @description 客户端专题图图表类型
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.ChartType.BAR;
- *
- * </script>
- * // ES6 Import
- * import { ChartType } from '{npm}';
- *
- * const result = ChartType.BAR;
- * ```
- */
- var ChartType = {
- /** 柱状图。 */
- BAR: "Bar",
- /** 三维柱状图。 */
- BAR3D: "Bar3D",
- /** 圆形图。 */
- CIRCLE: "Circle",
- /** 饼图。 */
- PIE: "Pie",
- /** 散点图。 */
- POINT: "Point",
- /** 折线图。 */
- LINE: "Line",
- /** 环状图。 */
- RING: "Ring"
- };
- /**
- * @enum ClipAnalystMode
- * @description 裁剪分析模式
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.ClipAnalystMode.CLIP;
- *
- * </script>
- * // ES6 Import
- * import { ClipAnalystMode } from '{npm}';
- *
- * const result = ClipAnalystMode.CLIP;
- * ```
- */
- var ClipAnalystMode = {
- /** CLIP。 */
- CLIP: "clip",
- /** INTERSECT。 */
- INTERSECT: "intersect"
- };
- /**
- * @enum AnalystAreaUnit
- * @description 分布式分析面积单位
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.AnalystAreaUnit.SQUAREMETER;
- *
- * </script>
- * // ES6 Import
- * import { AnalystAreaUnit } from '{npm}';
- *
- * const result = AnalystAreaUnit.SQUAREMETER;
- * ```
- */
- var AnalystAreaUnit = {
- /** 平方米。 */
- "SQUAREMETER": "SquareMeter",
- /** 平方千米。 */
- "SQUAREKILOMETER": "SquareKiloMeter",
- /** 公顷。 */
- "HECTARE": "Hectare",
- /** 公亩。 */
- "ARE": "Are",
- /** 英亩。 */
- "ACRE": "Acre",
- /** 平方英尺。 */
- "SQUAREFOOT": "SquareFoot",
- /** 平方码。 */
- "SQUAREYARD": "SquareYard",
- /** 平方英里。 */
- "SQUAREMILE": "SquareMile"
- };
- /**
- * @enum AnalystSizeUnit
- * @description 分布式分析单位
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.AnalystSizeUnit.METER;
- *
- * </script>
- * // ES6 Import
- * import { AnalystSizeUnit } from '{npm}';
- *
- * const result = AnalystSizeUnit.METER;
- * ```
- */
- var AnalystSizeUnit = {
- /** 米。 */
- "METER": "Meter",
- /** 千米。 */
- "KILOMETER": "Kilometer",
- /** 码。 */
- "YARD": "Yard",
- /** 英尺。 */
- "FOOT": "Foot",
- /** 英里。 */
- "MILE": "Mile"
- };
- /**
- * @enum StatisticAnalystMode
- * @description 分布式分析统计模式
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.StatisticAnalystMode.MAX;
- *
- * </script>
- * // ES6 Import
- * import { StatisticAnalystMode } from '{npm}';
- *
- * const result = StatisticAnalystMode.MAX;
- * ```
- */
- var StatisticAnalystMode = {
- /** 统计所选字段的最大值。 */
- "MAX": "max",
- /** 统计所选字段的最小值。 */
- "MIN": "min",
- /** 统计所选字段的平均值。 */
- "AVERAGE": "average",
- /** 统计所选字段的总和。 */
- "SUM": "sum",
- /** 统计所选字段的方差。 */
- "VARIANCE": "variance",
- /** 统计所选字段的标准差 */
- "STDDEVIATION": "stdDeviation"
- };
- /**
- * @enum SummaryType
- * @description 分布式分析聚合类型
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.SummaryType.SUMMARYMESH;
- *
- * </script>
- * // ES6 Import
- * import { SummaryType } from '{npm}';
- *
- * const result = SummaryType.SUMMARYMESH;
- * ```
- */
- var SummaryType = {
- /** 格网聚合。 */
- "SUMMARYMESH": "SUMMARYMESH",
- /** 多边形聚合。 */
- "SUMMARYREGION": "SUMMARYREGION"
- };
- /**
- * @enum TopologyValidatorRule
- * @description 拓扑检查模式枚举。该类定义了拓扑检查操作模式常量。
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.TopologyValidatorRule.REGIONNOOVERLAP;
- *
- * </script>
- * // ES6 Import
- * import { TopologyValidatorRule } from '{npm}';
- *
- * const result = TopologyValidatorRule.REGIONNOOVERLAP;
- * ```
- */
- var TopologyValidatorRule = {
- /** 面内无重叠,用于对面数据进行拓扑检查。 */
- REGIONNOOVERLAP: "REGIONNOOVERLAP",
- /** 面与面无重叠,用于对面数据进行拓扑检查。 */
- REGIONNOOVERLAPWITH: "REGIONNOOVERLAPWITH",
- /** 面被面包含,用于对面数据进行拓扑检查。 */
- REGIONCONTAINEDBYREGION: "REGIONCONTAINEDBYREGION",
- /** 面被面覆盖,用于对面数据进行拓扑检查。 */
- REGIONCOVEREDBYREGION: "REGIONCOVEREDBYREGION",
- /** 线与线无重叠,用于对线数据进行拓扑检查。 */
- LINENOOVERLAP: "LINENOOVERLAP",
- /** 线内无重叠,用于对线数据进行拓扑检查。 */
- LINENOOVERLAPWITH: "LINENOOVERLAPWITH",
- /** 点不相同,用于对点数据进行拓扑检查。 */
- POINTNOIDENTICAL: "POINTNOIDENTICAL"
- };
- /**
- * @enum BucketAggType
- * @description 格网聚合查询枚举类,该类定义了Elasticsearch数据服务中聚合查询模式常量
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.BucketAggType.GEOHASH_GRID;
- *
- * </script>
- * // ES6 Import
- * import { BucketAggType } from '{npm}';
- *
- * const result = BucketAggType.GEOHASH_GRID;
- * ```
- */
- var BucketAggType = {
- /** 格网聚合类型 */
- GEOHASH_GRID: "geohash_grid"
- };
- /**
- * @enum MetricsAggType
- * @description 指标聚合类型枚举类,该类定义了Elasticsearch数据服务中聚合查询模式常量
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.MetricsAggType.AVG;
- *
- * </script>
- * // ES6 Import
- * import { MetricsAggType } from '{npm}';
- *
- * const result = MetricsAggType.AVG;
- * ```
- */
- var MetricsAggType = {
- /** 平均值聚合类型 */
- AVG:'avg',
- /** 最大值聚合类型 */
- MAX:'max',
- /** 最小值聚合类型 */
- MIN:'min',
- /** 求和聚合类型 */
- SUM:'sum'
- };
- /**
- * @enum GetFeatureMode
- * @description feature 查询方式。
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.GetFeatureMode.BOUNDS;
- *
- * </script>
- * // ES6 Import
- * import { GetFeatureMode } from '{npm}';
- *
- * const result = GetFeatureMode.BOUNDS;
- * ```
- */
- var GetFeatureMode = {
- /** 通过范围查询来获取要素。 */
- BOUNDS: "BOUNDS",
- /** 通过几何对象的缓冲区来获取要素。 */
- BUFFER: "BUFFER",
- /** 通过 ID 来获取要素。 */
- ID: "ID",
- /** 通过空间查询模式来获取要素。 */
- SPATIAL: "SPATIAL",
- /** 通过 SQL 查询来获取要素。 */
- SQL: 'SQL'
- }
- /**
- * @enum RasterFunctionType
- * @description 栅格分析方法。
- * @category BaseTypes Constant
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.GetFeatureMode.NDVI;
- *
- * </script>
- * // ES6 Import
- * import { GetFeatureMode } from '{npm}';
- *
- * const result = GetFeatureMode.NDVI;
- * ```
- */
- var RasterFunctionType = {
- /** 归一化植被指数。 */
- NDVI: "NDVI",
- /** 阴影面分析。 */
- HILLSHADE: "HILLSHADE"
- }
- /**
- * @enum ResourceType
- * @description iportal资源类型。
- * @category BaseTypes Constant
- * @version 10.0.1
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.GetFeatureMode.MAP;
- *
- * </script>
- * // ES6 Import
- * import { GetFeatureMode } from '{npm}';
- *
- * const result = GetFeatureMode.MAP;
- * ```
- */
- var ResourceType = {
- /** 地图。 */
- MAP: "MAP",
- /** 服务。 */
- SERVICE: "SERVICE",
- /** 场景。 */
- SCENE: "SCENE",
- /** 数据。 */
- DATA: "DATA",
- /** 洞察。 */
- INSIGHTS_WORKSPACE: "INSIGHTS_WORKSPACE",
- /** 大屏。 */
- MAP_DASHBOARD: "MAP_DASHBOARD"
- }
- /**
- * @enum OrderBy
- * @description iportal资源排序字段。
- * @category BaseTypes Constant
- * @version 10.0.1
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.OrderBy.UPDATETIME;
- *
- * </script>
- * // ES6 Import
- * import { OrderBy } from '{npm}';
- *
- * const result = OrderBy.UPDATETIME;
- * ```
- */
- var OrderBy = {
- /** 按更新时间排序 */
- UPDATETIME: "UPDATETIME",
- /** 按热度(可能是访问量、下载量)排序 */
- HEATLEVEL: "HEATLEVEL",
- /** 按相关性排序 */
- RELEVANCE: "RELEVANCE"
- }
- /**
- * @enum OrderType
- * @description iportal资源升序还是降序过滤
- * @category BaseTypes Constant
- * @version 10.0.1
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.OrderType.ASC;
- *
- * </script>
- * // ES6 Import
- * import { OrderType } from '{npm}';
- *
- * const result = OrderType.ASC;
- * ```
- */
- var OrderType = {
- /** 升序 */
- ASC: "ASC",
- /** 降序 */
- DESC: "DESC"
- }
- /**
- * @enum SearchType
- * @description iportal资源查询的范围进行过滤
- * @category BaseTypes Constant
- * @version 10.0.1
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.SearchType.PUBLIC;
- *
- * </script>
- * // ES6 Import
- * import { SearchType } from '{npm}';
- *
- * const result = SearchType.PUBLIC;
- * ```
- */
- var SearchType = {
- /** 公开资源。 */
- PUBLIC: "PUBLIC",
- /** 我的资源。 */
- MY_RES: "MY_RES",
- /** 我的群组资源。 */
- MYGROUP_RES: "MYGROUP_RES",
- /** 我的部门资源。 */
- MYDEPARTMENT_RES: "MYDEPARTMENT_RES",
- /** 分享给我的资源。 */
- SHARETOME_RES: "SHARETOME_RES"
- }
- /**
- * @enum AggregationTypes
- * @description iportal资源聚合查询的类型
- * @category BaseTypes Constant
- * @version 10.0.1
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.AggregationTypes.TAG;
- *
- * </script>
- * // ES6 Import
- * import { AggregationTypes } from '{npm}';
- *
- * const result = AggregationTypes.TAG;
- * ```
- */
- var AggregationTypes = {
- /** 标签 */
- TAG: "TAG",
- /** 资源类型 */
- TYPE: "TYPE"
- }
- /**
- * @enum PermissionType
- * @description iportal资源权限类型。
- * @category BaseTypes Constant
- * @version 10.0.1
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.PermissionType.SEARCH;
- *
- * </script>
- * // ES6 Import
- * import { PermissionType } from '{npm}';
- *
- * const result = PermissionType.SEARCH;
- * ```
- */
- var PermissionType = {
- /** 可检索 */
- SEARCH:"SEARCH",
- /** 可查看 */
- READ: "READ",
- /** 可编辑 */
- READWRITE: "READWRITE",
- /** 可删除 */
- DELETE: "DELETE",
- /** 可下载,包括可读、可检索 */
- DOWNLOAD:"DOWNLOAD"
- }
- /**
- * @enum EntityType
- * @description iportal资源实体类型。
- * @category BaseTypes Constant
- * @version 10.0.1
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.EntityType.DEPARTMENT;
- *
- * </script>
- * // ES6 Import
- * import { EntityType } from '{npm}';
- *
- * const result = EntityType.DEPARTMENT;
- * ```
- */
- var EntityType = {
- /** 部门 */
- DEPARTMENT: "DEPARTMENT",
- /** 用户组 */
- GROUP: "GROUP",
- /** 群组 */
- IPORTALGROUP: "IPORTALGROUP",
- /** 角色 */
- ROLE: "ROLE",
- /** 用户 */
- USER: "USER"
- }
- /**
- * @enum DataItemType
- * @description iportal数据类型。
- * @category BaseTypes Constant
- * @version 10.0.1
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.DataItemType.GEOJSON;
- *
- * </script>
- * // ES6 Import
- * import { DataItemType } from '{npm}';
- *
- * const result = DataItemType.GEOJSON;
- * ```
- */
- var DataItemType = {
- /** geojson数据。 */
- GEOJSON: "GEOJSON",
- /** UGCV5_MVT */
- UGCV5_MVT: "UGCV5_MVT",
- /** json数据 */
- JSON: "JSON",
- /** AUDIO */
- AUDIO: "AUDIO",
- /** COLOR */
- COLOR: "COLOR",
- /** COLORSCHEME */
- COLORSCHEME: "COLORSCHEME",
- /** CSV */
- CSV: "CSV",
- /** EXCEL */
- EXCEL: "EXCEL",
- /** FILLSYMBOL */
- FILLSYMBOL: "FILLSYMBOL",
- /** IMAGE */
- IMAGE: "IMAGE",
- /** LAYERTEMPLATE */
- LAYERTEMPLATE: "LAYERTEMPLATE",
- /** LAYOUTTEMPLATE */
- LAYOUTTEMPLATE: "LAYOUTTEMPLATE",
- /** LINESYMBOL */
- LINESYMBOL: "LINESYMBOL",
- /** MAPTEMPLATE */
- MAPTEMPLATE: "MAPTEMPLATE",
- /** MARKERSYMBOL */
- MARKERSYMBOL: "MARKERSYMBOL",
- /** MBTILES */
- MBTILES: "MBTILES",
- /** PHOTOS */
- PHOTOS: "PHOTOS",
- /** SHP */
- SHP: "SHP",
- /** SMTILES */
- SMTILES: "SMTILES",
- /** SVTILES */
- SVTILES: "SVTILES",
- /** THEMETEMPLATE */
- THEMETEMPLATE: "THEMETEMPLATE",
- /** TPK */
- TPK: "TPK",
- /** UDB */
- UDB: "UDB",
- /** UGCV5 */
- UGCV5: "UGCV5",
- /** UNKNOWN */
- UNKNOWN: "UNKNOWN",
- /** VIDEO */
- VIDEO: "VIDEO",
- /** WORKENVIRONMENT */
- WORKENVIRONMENT: "WORKENVIRONMENT",
- /** WORKSPACE */
- WORKSPACE: "WORKSPACE"
- }
- /**
- * @enum WebExportFormatType
- * @description Web 打印输出的格式。
- * @category BaseTypes Constant
- * @version 10.0.1
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.WebExportFormatType.PNG;
- *
- * </script>
- * // ES6 Import
- * import { WebExportFormatType } from '{npm}';
- *
- * const result = WebExportFormatType.PNG;
- * ```
- */
- var WebExportFormatType = {
- /** png */
- PNG: "PNG",
- /** pdf */
- PDF: "PDF"
- }
- /**
- * @enum WebScaleOrientationType
- * @description Web 比例尺的方位样式。
- * @category BaseTypes Constant
- * @version 10.0.1
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.WebScaleOrientationType.HORIZONTALLABELSBELOW;
- *
- * </script>
- * // ES6 Import
- * import { WebScaleOrientationType } from '{npm}';
- *
- * const result = WebScaleOrientationType.HORIZONTALLABELSBELOW;
- * ```
- */
- var WebScaleOrientationType = {
- /** horizontal labels below */
- HORIZONTALLABELSBELOW: "HORIZONTALLABELSBELOW",
- /** horizontal labels above */
- HORIZONTALLABELSABOVE: "HORIZONTALLABELSABOVE",
- /** vertical labels left */
- VERTICALLABELSLEFT: "VERTICALLABELSLEFT",
- /** vertical labels right */
- VERTICALLABELSRIGHT: "VERTICALLABELSRIGHT"
- }
- /**
- * @enum WebScaleType
- * @description Web 比例尺的样式。
- * @category BaseTypes Constant
- * @version 10.0.1
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.WebScaleType.LINE;
- *
- * </script>
- * // ES6 Import
- * import { WebScaleType } from '{npm}';
- *
- * const result = WebScaleType.LINE;
- * ```
- */
- var WebScaleType = {
- /** line */
- LINE: "LINE",
- /** bar */
- BAR: "BAR",
- /** bar sub */
- BAR_SUB: "BAR_SUB"
- }
- /**
- * @enum WebScaleUnit
- * @description Web 比例尺的单位制。
- * @category BaseTypes Constant
- * @version 10.0.1
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.WebScaleUnit.METER;
- *
- * </script>
- * // ES6 Import
- * import { WebScaleUnit } from '{npm}';
- *
- * const result = WebScaleUnit.METER;
- * ```
- */
- var WebScaleUnit = {
- /** 米 */
- METER: "METER",
- /** 英尺 */
- FOOT: "FOOT",
- /** 度 */
- DEGREES: "DEGREES"
- }
- ;// CONCATENATED MODULE: ./src/common/commontypes/Size.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class Size
- * @deprecatedclass SuperMap.Size
- * @category BaseTypes Style
- * @classdesc 此类描绘一对高宽值的实例。
- * @param {number} [w=0.0] - 宽度。
- * @param {number} [h=0.0] - 高度。
- *
- * @example
- * var size = new Size(31,46);
- * @usage
- */
- class Size {
- constructor(w, h) {
- /**
- * @member {number} [Size.prototype.w=0.0]
- * @description 宽度。
- */
- this.w = w ? parseFloat(w) : 0.0;
- /**
- * @member {number} [Size.prototype.h=0.0]
- * @description 高度。
- */
- this.h = w ? parseFloat(h) : 0.0;
- this.CLASS_NAME = "SuperMap.Size";
- }
- /**
- * @function Size.prototype.toString
- * @description 返回字符串形式。
- * @example
- * var size = new Size(10,5);
- * var str = size.toString();
- * @returns {string} 例如:"w=10,h=5"。
- */
- toString() {
- return ("w=" + this.w + ",h=" + this.h);
- }
- /**
- * @function Size.prototype.clone
- * @description 克隆当前size对象。
- * @example
- * var size = new Size(31,46);
- * var size2 = size.clone();
- * @returns {Size} 新的与当前 size 对象有相同宽、高的 Size 对象。
- */
- clone() {
- return new Size(this.w, this.h);
- }
- /**
- *
- * @function Size.prototype.equals
- * @description 比较两个 size 对象是否相等。
- * @example
- * var size = new Size(31,46);
- * var size2 = new Size(31,46);
- * var isEquals = size.equals(size2);
- *
- * @param {Size} sz - 用于比较相等的 Size 对象。
- * @returns {boolean} 传入的 size 和当前 size 高宽相等,注意:如果传入的 size 为空则返回 false。
- *
- */
- equals(sz) {
- var equals = false;
- if (sz != null) {
- equals = ((this.w === sz.w && this.h === sz.h) ||
- (isNaN(this.w) && isNaN(this.h) && isNaN(sz.w) && isNaN(sz.h)));
- }
- return equals;
- }
- /**
- *
- * @function Size.prototype.destroy
- * @description 销毁此对象。销毁后此对象的所有属性为 null,而不是初始值。
- * @example
- * var size = new Size(31,46);
- * size.destroy();
- */
- destroy() {
- this.w = null;
- this.h = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/commontypes/Pixel.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class Pixel
- * @deprecatedclass SuperMap.Pixel
- * @category BaseTypes Geometry
- * @classdesc 用 x,y 坐标描绘屏幕坐标(像素点)。
- * @param {number} [x=0.0] - x 坐标。
- * @param {number} [y=0.0] - y 坐标。
- * @param {Pixel.Mode} [mode=Pixel.Mode.LeftTop] - 坐标模式。
- *
- * @example
- * //单独创建一个对象
- * var pixcel = new Pixel(100,50);
- *
- * //依据 size 创建
- * var size = new Size(21,25);
- * var offset = new Pixel(-(size.w/2), -size.h);
- * @usage
- */
- class Pixel {
- constructor(x, y, mode) {
- /**
- * @member {number} [Pixel.prototype.x=0.0]
- * @description x 坐标。
- */
- this.x = x ? parseFloat(x) : 0.0;
- /**
- * @member {number} [Pixel.prototype.y=0.0]
- * @description y 坐标。
- */
- this.y = y ? parseFloat(y) : 0.0;
- /**
- * @member {Pixel.Mode} [Pixel.prototype.mode=Pixel.Mode.LeftTop]
- * @description 坐标模式,有左上、右上、右下、左下这几种模式,分别表示相对于左上角、右上角、右下角、左下角的坐标。
- */
- this.mode = mode;
- this.CLASS_NAME = 'SuperMap.Pixel';
- }
- /**
- * @function Pixel.prototype.toString
- * @description 返回此对象的字符串形式。
- * @example
- *
- * var pixcel = new Pixel(100,50);
- * var str = pixcel.toString();
- *
- * @returns {string} 例如: "x=200.4,y=242.2"
- */
- toString() {
- return 'x=' + this.x + ',y=' + this.y;
- }
- /**
- * @function Pixel.prototype.clone
- * @description 克隆当前的 pixel 对象。
- * @example
- * var pixcel = new Pixel(100,50);
- * var pixcel2 = pixcel.clone();
- * @returns {Pixel} 新的与当前 pixel 对象有相同 x、y 坐标的 pixel 对象。
- */
- clone() {
- return new Pixel(this.x, this.y, this.mode);
- }
- /**
- * @function Pixel.prototype.equals
- * @description 比较两 pixel 是否相等。
- * @example
- * var pixcel = new Pixel(100,50);
- * var pixcel2 = new Pixel(100,50);
- * var isEquals = pixcel.equals(pixcel2);
- *
- * @param {Pixel} px - 用于比较相等的 pixel 对象。
- * @returns {boolean} 如果传入的像素点和当前像素点相同返回 true,如果不同或传入参数为 NULL 则返回 false。
- */
- equals(px) {
- var equals = false;
- if (px != null) {
- equals = (this.x == px.x && this.y == px.y) || (isNaN(this.x) && isNaN(this.y) && isNaN(px.x) && isNaN(px.y));
- }
- return equals;
- }
- /**
- * @function Pixel.prototype.distanceTo
- * @description 返回两个 pixel 的距离。
- * @example
- * var pixcel = new Pixel(100,50);
- * var pixcel2 = new Pixel(110,30);
- * var distance = pixcel.distanceTo(pixcel2);
- *
- * @param {Pixel} px - 需要计算的 pixel。
- * @returns {number} 作为参数传入的像素与当前像素点的距离。
- */
- distanceTo(px) {
- return Math.sqrt(Math.pow(this.x - px.x, 2) + Math.pow(this.y - px.y, 2));
- }
- /**
- * @function Pixel.prototype.add
- * @description 在原来像素坐标基础上,x 值加上传入的 x 参数,y 值加上传入的 y 参数。
- * @example
- * var pixcel = new Pixel(100,50);
- * //pixcel2是新的对象
- * var pixcel2 = pixcel.add(20,30);
- *
- * @param {number} x - 传入的 x 值。
- * @param {number} y - 传入的 y 值。
- * @returns {Pixel} 新的 pixel 对象,该 pixel 是由当前的 pixel 与传入的 x,y 相加得到。
- */
- add(x, y) {
- if (x == null || y == null) {
- throw new TypeError('Pixel.add cannot receive null values');
- }
- return new Pixel(this.x + x, this.y + y);
- }
- /**
- * @function Pixel.prototype.offset
- * @description 通过传入的 {@link Pixel} 参数对原屏幕坐标进行偏移。
- * @example
- * var pixcel = new Pixel(100,50);
- * var pixcel2 = new Pixel(130,20);
- * //pixcel3 是新的对象
- * var pixcel3 = pixcel.offset(pixcel2);
- *
- * @param {Pixel} px - 传入的 {@link Pixel} 对象。
- * @returns {Pixel} 新的 pixel,该 pixel 是由当前的 pixel 对象的 x,y 值与传入的 Pixel 对象的 x,y 值相加得到。
- */
- offset(px) {
- var newPx = this.clone();
- if (px) {
- newPx = this.add(px.x, px.y);
- }
- return newPx;
- }
- /**
- *
- * @function Pixel.prototype.destroy
- * @description 销毁此对象。销毁后此对象的所有属性为 null,而不是初始值。
- * @example
- * var pixcel = new Pixel(100,50);
- * pixcel.destroy();
- */
- destroy() {
- this.x = null;
- this.y = null;
- this.mode = null;
- }
- }
- /**
- * @enum Mode
- * @memberOf Pixel
- * @readonly
- * @description 模式。
- * @type {string}
- */
- Pixel.Mode = {
- /** 左上模式。*/
- LeftTop: 'lefttop',
- /** 右上模式。 */
- RightTop: 'righttop',
- /** 右下模式。 */
- RightBottom: 'rightbottom',
- /** 左下模式。 */
- LeftBottom: 'leftbottom'
- };
- ;// CONCATENATED MODULE: ./src/common/commontypes/BaseTypes.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
-
- /**
- * @function inherit
- * @description 除了 C 和 P 两个必要参数外,可以传递任意数量的对象,这些对象都将继承C。
- * @param {Object} C - 继承的类。
- * @param {Object} P - 被继承的父类。
- * @private
- */
- var inheritExt = function (C, P) {
- var F = function () {
- };
- F.prototype = P.prototype;
- C.prototype = new F;
- var i, l, o;
- for (i = 2, l = arguments.length; i < l; i++) {
- o = arguments[i];
- if (typeof o === "function") {
- o = o.prototype;
- }
- Util.extend(C.prototype, o);
- }
- };
- /**
- * @function mixinExt
- * @description 实现多重继承。
- * @param {Class|Object} ...mixins - 继承的类。
- * @private
- */
- var mixinExt = function (...mixins) {
- class Mix {
- constructor(options) {
- for (var index = 0; index < mixins.length; index++) {
- copyProperties(this, new mixins[index](options));
- }
- }
- }
- for (var index = 0; index < mixins.length; index++) {
- var mixin = mixins[index];
- copyProperties(Mix, mixin);
- copyProperties(Mix.prototype, mixin.prototype);
- copyProperties(Mix.prototype, new mixin());
- }
- return Mix;
- function copyProperties(target, source) {
- var ownKeys = Object.getOwnPropertyNames(source);
- if (Object.getOwnPropertySymbols) {
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source));
- }
- for (var index = 0; index < ownKeys.length; index++) {
- var key = ownKeys[index];
- if (key !== "constructor"
- && key !== "prototype"
- && key !== "name" && key !== "length") {
- let desc = Object.getOwnPropertyDescriptor(source, key);
- if (window["ActiveXObject"]) {
- Object.defineProperty(target, key, desc || {});
- } else {
- Object.defineProperty(target, key, desc);
- }
- }
- }
- }
- };
- /**
- * @name String
- * @namespace
- * @category BaseTypes Util
- * @description 字符串操作的一系列常用扩展函数。
- * @private
- */
- var StringExt = {
- /**
- * @function StringExt.startsWith
- * @description 判断目标字符串是否以指定的子字符串开头。
- * @param {string} str - 目标字符串。
- * @param {string} sub - 查找的子字符串。
- * @returns {boolean} 目标字符串以指定的子字符串开头,则返回 true;否则返回 false。
- */
- startsWith: function (str, sub) {
- return (str.indexOf(sub) == 0);
- },
- /**
- * @function StringExt.contains
- * @description 判断目标字符串是否包含指定的子字符串。
- * @param {string} str - 目标字符串。
- * @param {string} sub - 查找的子字符串。
- * @returns {boolean} 目标字符串中包含指定的子字符串,则返回 true;否则返回 false。
- */
- contains: function (str, sub) {
- return (str.indexOf(sub) != -1);
- },
- /**
- * @function StringExt.trim
- * @description 删除一个字符串的开头和结尾处的所有空白字符。
- * @param {string} str - (可能)存在空白字符填塞的字符串。
- * @returns {string} 删除开头和结尾处空白字符后的字符串。
- */
- trim: function (str) {
- return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
- },
- /**
- * @function StringExt.camelize
- * @description 骆驼式("-")连字符的字符串处理。
- * 例如:"chicken-head" becomes "chickenHead",
- * "-chicken-head" becomes "ChickenHead"。
- * @param {string} str - 要处理的字符串,原始内容不应被修改。
- * @returns {string}
- */
- camelize: function (str) {
- var oStringList = str.split('-');
- var camelizedString = oStringList[0];
- for (var i = 1, len = oStringList.length; i < len; i++) {
- var s = oStringList[i];
- camelizedString += s.charAt(0).toUpperCase() + s.substring(1);
- }
- return camelizedString;
- },
- /**
- * @function StringExt.format
- * @description 提供带 ${token} 标记的字符串, 返回 context 对象属性中指定标记的属性值。
- * @example
- * 示例:
- * (code)
- * 1、template = "${value,getValue}";
- * context = {value: {getValue:function(){return Math.max.apply(null,argument);}}};
- * args = [2,23,12,36,21];
- * 返回值:36
- * (end)
- * 示例:
- * (code)
- * 2、template = "$${{value,getValue}}";
- * context = {value: {getValue:function(){return Math.max.apply(null,argument);}}};
- * args = [2,23,12,36,21];
- * 返回值:"${36}"
- * (end)
- * 示例:
- * (code)
- * 3、template = "${a,b}";
- * context = {a: {b:"format"}};
- * args = null;
- * 返回值:"format"
- * (end)
- * 示例:
- * (code)
- * 3、template = "${a,b}";
- * context = null;
- * args = null;
- * 返回值:"${a.b}"
- * (end)
- * @param {string} template - 带标记的字符串将要被替换。参数 template 格式为"${token}",此处的 token 标记会替换为 context["token"] 属性的值。
- * @param {Object} [context=window] - 带有属性的可选对象的属性用于匹配格式化字符串中的标记。如果该参数为空,将使用 window 对象。
- * @param {Array.<number>} [args] - 可选参数传递给在 context 对象上找到的函数。
- * @returns {string} 从 context 对象属性中替换字符串标记位的字符串。
- */
- format: function (template, context, args) {
- if (!context) {
- context = window;
- }
- // Example matching:
- // str = ${foo.bar}
- // match = foo.bar
- var replacer = function (str, match) {
- var replacement;
- // Loop through all subs. Example: ${a.b.c}
- // 0 -> replacement = context[a];
- // 1 -> replacement = context[a][b];
- // 2 -> replacement = context[a][b][c];
- var subs = match.split(/\.+/);
- for (var i = 0; i < subs.length; i++) {
- if (i == 0) {
- replacement = context;
- }
- replacement = replacement[subs[i]];
- }
- if (typeof replacement === "function") {
- replacement = args ?
- replacement.apply(null, args) :
- replacement();
- }
- // If replacement is undefined, return the string 'undefined'.
- // This is a workaround for a bugs in browsers not properly
- // dealing with non-participating groups in regular expressions:
- // http://blog.stevenlevithan.com/archives/npcg-javascript
- if (typeof replacement == 'undefined') {
- return 'undefined';
- } else {
- return replacement;
- }
- };
- return template.replace(StringExt.tokenRegEx, replacer);
- },
- /**
- * @member {RegExp} [StringExt.tokenRegEx]
- * @description 寻找带 token 的字符串,默认为 tokenRegEx=/\$\{([\w.]+?)\}/g。
- * @example
- * Examples: ${a}, ${a.b.c}, ${a-b}, ${5}
- */
- tokenRegEx: /\$\{([\w.]+?)\}/g,
- /**
- * @member {RegExp} [StringExt.numberRegEx]
- * @description 判断一个字符串是否只包含一个数值,默认为 numberRegEx=/^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/。
- */
- numberRegEx: /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/,
- /**
- * @function StringExt.isNumeric
- * @description 判断一个字符串是否只包含一个数值。
- * @example
- * (code)
- * StringExt.isNumeric("6.02e23") // true
- * StringExt.isNumeric("12 dozen") // false
- * StringExt.isNumeric("4") // true
- * StringExt.isNumeric(" 4 ") // false
- * (end)
- * @returns {boolean} 字符串包含唯一的数值,返回 true;否则返回 false。
- */
- isNumeric: function (value) {
- return StringExt.numberRegEx.test(value);
- },
- /**
- * @function StringExt.numericIf
- * @description 把一个看似数值型的字符串转化为一个数值。
- * @returns {(number|string)} 如果能转换为数值则返回数值,否则返回字符串本身。
- */
- numericIf: function (value) {
- return StringExt.isNumeric(value) ? parseFloat(value) : value;
- }
- };
- /**
- * @name Number
- * @namespace
- * @category BaseTypes Util
- * @description 数值操作的一系列常用扩展函数。
- * @private
- */
- var NumberExt = {
- /**
- * @member {string} [NumberExt.decimalSeparator='.']
- * @description 格式化数字时默认的小数点分隔符。
- * @constant
- */
- decimalSeparator: ".",
- /**
- * @member {string} [NumberExt.thousandsSeparator=',']
- * @description 格式化数字时默认的千位分隔符。
- * @constant
- */
- thousandsSeparator: ",",
- /**
- * @function NumberExt.limitSigDigs
- * @description 限制浮点数的有效数字位数。
- * @param {number} num - 浮点数。
- * @param {number} sig - 有效位数。
- * @returns {number} 将数字四舍五入到指定数量的有效位数。
- */
- limitSigDigs: function (num, sig) {
- var fig = 0;
- if (sig > 0) {
- fig = parseFloat(num.toPrecision(sig));
- }
- return fig;
- },
- /**
- * @function NumberExt.format
- * @description 数字格式化输出。
- * @param {number} num - 数字。
- * @param {number} [dec=0] - 数字的小数部分四舍五入到指定的位数。设置为 null 值时小数部分不变。
- * @param {string} [tsep=','] - 千位分隔符。
- * @param {string} [dsep='.'] - 小数点分隔符。
- * @returns {string} 数字格式化后的字符串。
- */
- format: function (num, dec, tsep, dsep) {
- dec = (typeof dec != "undefined") ? dec : 0;
- tsep = (typeof tsep != "undefined") ? tsep :
- NumberExt.thousandsSeparator;
- dsep = (typeof dsep != "undefined") ? dsep :
- NumberExt.decimalSeparator;
- if (dec != null) {
- num = parseFloat(num.toFixed(dec));
- }
- var parts = num.toString().split(".");
- if (parts.length === 1 && dec == null) {
- // integer where we do not want to touch the decimals
- dec = 0;
- }
- var integer = parts[0];
- if (tsep) {
- var thousands = /(-?[0-9]+)([0-9]{3})/;
- while (thousands.test(integer)) {
- integer = integer.replace(thousands, "$1" + tsep + "$2");
- }
- }
- var str;
- if (dec == 0) {
- str = integer;
- } else {
- var rem = parts.length > 1 ? parts[1] : "0";
- if (dec != null) {
- rem = rem + new Array(dec - rem.length + 1).join("0");
- }
- str = integer + dsep + rem;
- }
- return str;
- }
- };
- if (!Number.prototype.limitSigDigs) {
- /**
- * APIMethod: Number.limitSigDigs
- * 限制浮点数的有效数字位数.
- * @param {number} sig -有效位数。
- * @returns {number} 将数字四舍五入到指定数量的有效位数。
- * 如果传入值 为 null、0、或者是负数, 返回值 0。
- */
- Number.prototype.limitSigDigs = function (sig) {
- return NumberExt.limitSigDigs(this, sig);
- };
- }
- /**
- * @name Function
- * @namespace
- * @category BaseTypes Util
- * @description 函数操作的一系列常用扩展函数。
- * @private
- */
- var FunctionExt = {
- /**
- * @function FunctionExt.bind
- * @description 绑定函数到对象。方便创建 this 的作用域。
- * @param {function} func - 输入函数。
- * @param {Object} object - 对象绑定到输入函数(作为输入函数的 this 对象)。
- * @returns {function} object 参数作为 func 函数的 this 对象。
- */
- bind: function (func, object) {
- // create a reference to all arguments past the second one
- var args = Array.prototype.slice.apply(arguments, [2]);
- return function () {
- // Push on any additional arguments from the actual function call.
- // These will come after those sent to the bind call.
- var newArgs = args.concat(
- Array.prototype.slice.apply(arguments, [0])
- );
- return func.apply(object, newArgs);
- };
- },
- /**
- * @function FunctionExt.bindAsEventListener
- * @description 绑定函数到对象,在调用该函数时配置并使用事件对象作为第一个参数。
- * @param {function} func - 用于监听事件的函数。
- * @param {Object} object - this 对象的引用。
- * @returns {function}
- */
- bindAsEventListener: function (func, object) {
- return function (event) {
- return func.call(object, event || window.event);
- };
- },
- /**
- * @function FunctionExt.False
- * @description 该函数仅仅返回 false。该函数主要是避免在 IE8 以下浏览中 DOM 事件句柄的匿名函数问题。
- * @example
- * document.onclick = FunctionExt.False;
- * @returns {boolean}
- */
- False: function () {
- return false;
- },
- /**
- * @function FunctionExt.True
- * @description 该函数仅仅返回 true。该函数主要是避免在 IE8 以下浏览中 DOM 事件句柄的匿名函数问题。
- * @example
- * document.onclick = FunctionExt.True;
- * @returns {boolean}
- */
- True: function () {
- return true;
- },
- /**
- * @function FunctionExt.Void
- * @description 可重用函数,仅仅返回 "undefined"。
- * @returns {undefined}
- */
- Void: function () {
- }
- };
- /**
- * @name Array
- * @namespace
- * @category BaseTypes Util
- * @description 数组操作的一系列常用扩展函数。
- * @private
- */
- var ArrayExt = {
- /**
- * @function ArrayExt.filter
- * @description 过滤数组,提供了 ECMA-262 标准中 Array.prototype.filter 函数的扩展。详见:{@link http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array/filter}
- * @param {Array} array - 要过滤的数组。
- * @param {function} callback - 数组中的每一个元素调用该函数。</br>
- * 如果函数的返回值为 true,该元素将包含在返回的数组中。该函数有三个参数: 数组中的元素,元素的索引,数组自身。</br>
- * 如果设置了可选参数 caller,在调用 callback 时,使用可选参数 caller 设置为 callback 的参数。</br>
- * @param {Object} [caller] - 在调用 callback 时,使用参数 caller 设置为 callback 的参数。
- * @returns {Array} callback 函数返回 true 时的元素将作为返回数组中的元素。
- */
- filter: function (array, callback, caller) {
- var selected = [];
- if (Array.prototype.filter) {
- selected = array.filter(callback, caller);
- } else {
- var len = array.length;
- if (typeof callback != "function") {
- throw new TypeError();
- }
- for (var i = 0; i < len; i++) {
- if (i in array) {
- var val = array[i];
- if (callback.call(caller, val, i, array)) {
- selected.push(val);
- }
- }
- }
- }
- return selected;
- }
- };
- ;// CONCATENATED MODULE: ./src/common/commontypes/Geometry.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- // import {WKT} from '../format/WKT';
- // import {Vector} from './Vector';
- /**
- * @class Geometry
- * @deprecatedclass SuperMap.Geometry
- * @category BaseTypes Geometry
- * @classdesc 几何对象类,描述地理对象的几何图形。
- * @usage
- */
- class Geometry {
- constructor() {
- this.CLASS_NAME = "SuperMap.Geometry";
- /**
- * @member {string} Geometry.prototype.id
- * @description 几何对象的唯一标示符。
- *
- */
- this.id = Util.createUniqueID(this.CLASS_NAME + "_");
- /**
- * @member {Geometry} Geometry.prototype.parent
- * @description 父类几何对象。
- */
- this.parent = null;
- /**
- * @member {Bounds} Geometry.prototype.bounds
- * @description 几何对象的范围。
- *
- */
- this.bounds = null;
- /**
- * @member {number} Geometry.prototype.SRID
- * @description 投影坐标参数。通过该参数,服务器判断 Geometry 对象的坐标参考系是否与数据集相同,如果不同,则在数据入库前进行投影变换。
- * @example
- * var geometry= new Geometry();
- * geometry. SRID=4326;
- *
- */
- this.SRID = null;
- }
- /**
- * @function Geometry.prototype.destroy
- * @description 解构 Geometry 类,释放资源。
- */
- destroy() {
- this.id = null;
- this.bounds = null;
- this.SRID = null;
- }
- /**
- * @function Geometry.prototype.clone
- * @description 克隆几何图形。克隆的几何图形不设置非标准的属性。
- * @returns {Geometry} 克隆的几何图形。
- */
- clone() {
- return new Geometry();
- }
- /**
- * @function Geometry.prototype.setBounds
- * @description 设置几何对象的 bounds。
- * @param {Bounds} bounds - 范围。
- */
- setBounds(bounds) {
- if (bounds) {
- this.bounds = bounds.clone();
- }
- }
- /**
- * @function Geometry.prototype.clearBounds
- * @description 清除几何对象的 bounds。
- * 如果该对象有父类,也会清除父类几何对象的 bounds。
- */
- clearBounds() {
- this.bounds = null;
- if (this.parent) {
- this.parent.clearBounds();
- }
- }
- /**
- * @function Geometry.prototype.extendBounds
- * @description 扩展现有边界以包含新边界。如果尚未设置几何边界,则设置新边界。
- * @param {Bounds} newBounds - 几何对象的 bounds。
- */
- extendBounds(newBounds) {
- var bounds = this.getBounds();
- if (!bounds) {
- this.setBounds(newBounds);
- } else {
- this.bounds.extend(newBounds);
- }
- }
- /**
- * @function Geometry.prototype.getBounds
- * @description 获得几何图形的边界。如果没有设置边界,可通过计算获得。
- * @returns {Bounds} 几何对象的边界。
- */
- getBounds() {
- if (this.bounds == null) {
- this.calculateBounds();
- }
- return this.bounds;
- }
- /**
- * @function Geometry.prototype.calculateBounds
- * @description 重新计算几何图形的边界(需要在子类中实现此方法)。
- */
- calculateBounds() {
- //
- // This should be overridden by subclasses.
- //
- }
- /**
- * @function Geometry.prototype.getVertices
- * @description 返回几何图形的所有顶点的列表(需要在子类中实现此方法)。
- * @param {boolean} [nodes] - 如果是 true,线则只返回线的末端点,如果 false,仅仅返回顶点,如果没有设置,则返回顶点。
- * @returns {Array} 几何图形的顶点列表。
- */
- getVertices(nodes) { // eslint-disable-line no-unused-vars
- }
- /**
- * @function Geometry.prototype.getArea
- * @description 计算几何对象的面积 ,此方法需要在子类中定义。
- * @returns {number} 计算后的对象面积。
- */
- getArea() {
- //to be overridden by geometries that actually have an area
- //
- return 0.0;
- }
- // /**
- // * @function Geometry.prototype.toString
- // * @description 返回geometry对象的字符串表述,需要引入{@link WKTFormat}。此方法只能在子类实现,在父类使用会报错。
- // * @returns {string} geometry对象的字符串表述(Well-Known Text)
- // */
- // toString() {
- // var string;
- // if (WKT) {
- // var wkt = new WKT();
- // string = wkt.write(new Vector(this));
- // } else {
- // string = Object.prototype.toString.call(this);
- // }
- // return string;
- // }
- }
- ;// CONCATENATED MODULE: ./src/common/commontypes/Util.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @description 浏览器名称,依赖于 userAgent 属性,BROWSER_NAME 可以是空,或者以下浏览器:
- * * "opera" -- Opera
- * * "msie" -- Internet Explorer
- * * "safari" -- Safari
- * * "firefox" -- Firefox
- * * "mozilla" -- Mozilla
- * @category BaseTypes Constant
- * @constant {Object}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.Browser.name;
- *
- * </script>
- * // ES6 Import
- * import { Browser } from '{npm}';
- *
- * const result = Browser.name;
- * ```
- */
- const Browser = (function () {
- var name = '',
- version = '',
- device = 'pc',
- uaMatch;
- //以下进行测试
- var ua = navigator.userAgent.toLowerCase();
- if (ua.indexOf('msie') > -1 || (ua.indexOf('trident') > -1 && ua.indexOf('rv') > -1)) {
- name = 'msie';
- uaMatch = ua.match(/msie ([\d.]+)/) || ua.match(/rv:([\d.]+)/);
- } else if (ua.indexOf('chrome') > -1) {
- name = 'chrome';
- uaMatch = ua.match(/chrome\/([\d.]+)/);
- } else if (ua.indexOf('firefox') > -1) {
- name = 'firefox';
- uaMatch = ua.match(/firefox\/([\d.]+)/);
- } else if (ua.indexOf('opera') > -1) {
- name = 'opera';
- uaMatch = ua.match(/version\/([\d.]+)/);
- } else if (ua.indexOf('safari') > -1) {
- name = 'safari';
- uaMatch = ua.match(/version\/([\d.]+)/);
- }
- version = uaMatch ? uaMatch[1] : '';
- if (ua.indexOf('ipad') > -1 || ua.indexOf('ipod') > -1 || ua.indexOf('iphone') > -1) {
- device = 'apple';
- } else if (ua.indexOf('android') > -1) {
- uaMatch = ua.match(/version\/([\d.]+)/);
- version = uaMatch ? uaMatch[1] : '';
- device = 'android';
- }
- return { name: name, version: version, device: device };
- })();
- const isSupportCanvas = (function () {
- var checkRes = true,
- broz = Browser;
- if (document.createElement('canvas').getContext) {
- if (broz.name === 'firefox' && parseFloat(broz.version) < 5) {
- checkRes = false;
- }
- if (broz.name === 'safari' && parseFloat(broz.version) < 4) {
- checkRes = false;
- }
- if (broz.name === 'opera' && parseFloat(broz.version) < 10) {
- checkRes = false;
- }
- if (broz.name === 'msie' && parseFloat(broz.version) < 9) {
- checkRes = false;
- }
- } else {
- checkRes = false;
- }
- return checkRes;
- })();
- /**
- * @description 如果 userAgent 捕获到浏览器使用的是 Gecko 引擎则返回 true。
- * @constant {number}
- * @private
- */
- const IS_GECKO = (function () {
- var ua = navigator.userAgent.toLowerCase();
- return ua.indexOf('webkit') === -1 && ua.indexOf('gecko') !== -1;
- })();
- /**
- * @constant {number}
- * @default
- * @description 分辨率与比例尺之间转换的常量。
- * @private
- */
- const DOTS_PER_INCH = 96;
- /**
- * @name CommonUtil
- * @namespace
- * @category BaseTypes Util
- * @description common 工具类。
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.CommonUtil.getElement();
- *
- * // 弃用的写法
- * const result = SuperMap.Util.getElement();
- *
- * </script>
- *
- * // ES6 Import
- * import { CommonUtil } from '{npm}';
- *
- * const result = CommonUtil.getElement();
- * ```
- */
- const Util = {
- /**
- * @memberOf CommonUtil
- * @description 复制源对象的所有属性到目标对象上,源对象上的没有定义的属性在目标对象上也不会被设置。
- * @example
- * 要复制 Size 对象的所有属性到自定义对象上,使用方法如下:
- * var size = new Size(100, 100);
- * var obj = {};
- * CommonUtil.extend(obj, size);
- * @param {Object} [destination] - 目标对象。
- * @param {Object} source - 源对象,其属性将被设置到目标对象上。
- * @returns {Object} 目标对象。
- */
- extend: function (destination, source) {
- destination = destination || {};
- if (source) {
- for (var property in source) {
- var value = source[property];
- if (value !== undefined) {
- destination[property] = value;
- }
- }
- /**
- * IE doesn't include the toString property when iterating over an object's
- * properties with the for(property in object) syntax. Explicitly check if
- * the source has its own toString property.
- */
- /*
- * FF/Windows < 2.0.0.13 reports "Illegal operation on WrappedNative
- * prototype object" when calling hawOwnProperty if the source object
- * is an instance of window.Event.
- */
- var sourceIsEvt = typeof window.Event === 'function' && source instanceof window.Event;
- if (!sourceIsEvt && source.hasOwnProperty && source.hasOwnProperty('toString')) {
- destination.toString = source.toString;
- }
- }
- return destination;
- },
- /**
- * @memberOf CommonUtil
- * @description 对象拷贝。
- * @param {Object} [des] - 目标对象。
- * @param {Object} soc - 源对象。
- */
- copy: function (des, soc) {
- des = des || {};
- var v;
- if (soc) {
- for (var p in des) {
- v = soc[p];
- if (typeof v !== 'undefined') {
- des[p] = v;
- }
- }
- }
- },
- /**
- * @memberOf CommonUtil
- * @description 销毁对象,将其属性置空。
- * @param {Object} [obj] - 目标对象。
- */
- reset: function (obj) {
- obj = obj || {};
- for (var p in obj) {
- if (obj.hasOwnProperty(p)) {
- if (typeof obj[p] === 'object' && obj[p] instanceof Array) {
- for (var i in obj[p]) {
- if (obj[p][i].destroy) {
- obj[p][i].destroy();
- }
- }
- obj[p].length = 0;
- } else if (typeof obj[p] === 'object' && obj[p] instanceof Object) {
- if (obj[p].destroy) {
- obj[p].destroy();
- }
- }
- obj[p] = null;
- }
- }
- },
- /**
- * @memberOf CommonUtil
- * @description 获取 HTML 元素数组。
- * @returns {Array.<HTMLElement>} HTML 元素数组。
- */
- getElement: function () {
- var elements = [];
- for (var i = 0, len = arguments.length; i < len; i++) {
- var element = arguments[i];
- if (typeof element === 'string') {
- element = document.getElementById(element);
- }
- if (arguments.length === 1) {
- return element;
- }
- elements.push(element);
- }
- return elements;
- },
- /**
- * @memberOf CommonUtil
- * @description instance of 的跨浏览器实现。
- * @param {Object} o - 对象。
- * @returns {boolean} 是否是页面元素。
- */
- isElement: function (o) {
- return !!(o && o.nodeType === 1);
- },
- /**
- * @memberOf CommonUtil
- * @description 判断一个对象是否是数组。
- * @param {Object} a - 对象。
- * @returns {boolean} 是否是数组。
- */
- isArray: function (a) {
- return Object.prototype.toString.call(a) === '[object Array]';
- },
- /**
- * @memberOf CommonUtil
- * @description 从数组中删除某一项。
- * @param {Array} array - 数组。
- * @param {Object} item - 数组中要删除的一项。
- * @returns {Array} 执行删除操作后的数组。
- */
- removeItem: function (array, item) {
- for (var i = array.length - 1; i >= 0; i--) {
- if (array[i] === item) {
- array.splice(i, 1);
- //break;more than once??
- }
- }
- return array;
- },
- /**
- * @memberOf CommonUtil
- * @description 获取某对象在数组中的索引值。
- * @param {Array.<Object>} array - 数组。
- * @param {Object} obj - 对象。
- * @returns {number} 某对象在数组中的索引值。
- */
- indexOf: function (array, obj) {
- if (array == null) {
- return -1;
- } else {
- // use the build-in function if available.
- if (typeof array.indexOf === 'function') {
- return array.indexOf(obj);
- } else {
- for (var i = 0, len = array.length; i < len; i++) {
- if (array[i] === obj) {
- return i;
- }
- }
- return -1;
- }
- }
- },
- /**
- * @memberOf CommonUtil
- * @description 修改某 DOM 元素的许多属性。
- * @param {HTMLElement} element - 待修改的 DOM 元素。
- * @param {string} [id] - DOM 元素的 ID。
- * @param {Pixel} [px] - DOM 元素的 style 属性的 left 和 top 属性。
- * @param {Size} [sz] - DOM 元素的 width 和 height 属性。
- * @param {string} [position] - DOM 元素的 position 属性。
- * @param {string} [border] - DOM 元素的 style 属性的 border 属性。
- * @param {string} [overflow] - DOM 元素的 style 属性的 overflow 属性。
- * @param {number} [opacity] - 不透明度值。取值范围为(0.0 - 1.0)。
- */
- modifyDOMElement: function (element, id, px, sz, position, border, overflow, opacity) {
- if (id) {
- element.id = id;
- }
- if (px) {
- element.style.left = px.x + 'px';
- element.style.top = px.y + 'px';
- }
- if (sz) {
- element.style.width = sz.w + 'px';
- element.style.height = sz.h + 'px';
- }
- if (position) {
- element.style.position = position;
- }
- if (border) {
- element.style.border = border;
- }
- if (overflow) {
- element.style.overflow = overflow;
- }
- if (parseFloat(opacity) >= 0.0 && parseFloat(opacity) < 1.0) {
- element.style.filter = 'alpha(opacity=' + opacity * 100 + ')';
- element.style.opacity = opacity;
- } else if (parseFloat(opacity) === 1.0) {
- element.style.filter = '';
- element.style.opacity = '';
- }
- },
- /**
- * @memberOf CommonUtil
- * @description 比较两个对象并合并。
- * @param {Object} [to] - 目标对象。
- * @param {Object} from - 源对象。
- * @returns {Object} 返回合并后的对象。
- */
- applyDefaults: function (to, from) {
- to = to || {};
- /*
- * FF/Windows < 2.0.0.13 reports "Illegal operation on WrappedNative
- * prototype object" when calling hawOwnProperty if the source object is an
- * instance of window.Event.
- */
- var fromIsEvt = typeof window.Event === 'function' && from instanceof window.Event;
- for (var key in from) {
- if (
- to[key] === undefined ||
- (!fromIsEvt && from.hasOwnProperty && from.hasOwnProperty(key) && !to.hasOwnProperty(key))
- ) {
- to[key] = from[key];
- }
- }
- /**
- * IE doesn't include the toString property when iterating over an object's
- * properties with the for(property in object) syntax. Explicitly check if
- * the source has its own toString property.
- */
- if (
- !fromIsEvt &&
- from &&
- from.hasOwnProperty &&
- from.hasOwnProperty('toString') &&
- !to.hasOwnProperty('toString')
- ) {
- to.toString = from.toString;
- }
- return to;
- },
- /**
- * @memberOf CommonUtil
- * @description 将参数对象转换为 HTTP 的 GET 请求中的参数字符串。例如:"key1=value1&key2=value2&key3=value3"。
- * @param {Object} params - 参数对象。
- * @returns {string} HTTP 的 GET 请求中的参数字符串。
- */
- getParameterString: function (params) {
- var paramsArray = [];
- for (var key in params) {
- var value = params[key];
- if (value != null && typeof value !== 'function') {
- var encodedValue;
- if (Array.isArray(value) || value.toString() === '[object Object]') {
- encodedValue = encodeURIComponent(JSON.stringify(value));
- } else {
- /* value is a string; simply encode */
- encodedValue = encodeURIComponent(value);
- }
- paramsArray.push(encodeURIComponent(key) + '=' + encodedValue);
- }
- }
- return paramsArray.join('&');
- },
- /**
- * @memberOf CommonUtil
- * @description 给 URL 追加查询参数。
- * @param {string} url - 待追加参数的 URL 字符串。
- * @param {string} paramStr - 待追加的查询参数。
- * @returns {string} 新的 URL。
- */
- urlAppend: function (url, paramStr) {
- var newUrl = url;
- if (paramStr) {
- if (paramStr.indexOf('?') === 0) {
- paramStr = paramStr.substring(1);
- }
- var parts = (url + ' ').split(/[?&]/);
- newUrl += parts.pop() === ' ' ? paramStr : parts.length ? '&' + paramStr : '?' + paramStr;
- }
- return newUrl;
- },
- /**
- * @memberOf CommonUtil
- * @description 给 URL 追加 path 参数。
- * @param {string} url - 待追加参数的 URL 字符串。
- * @param {string} paramStr - 待追加的path参数。
- * @returns {string} 新的 URL。
- */
- urlPathAppend: function (url, pathStr) {
- let newUrl = url;
- if (!pathStr) {
- return newUrl;
- }
- if (pathStr.indexOf('/') === 0) {
- pathStr = pathStr.substring(1);
- }
- const parts = url.split('?');
- if (parts[0].indexOf('/', parts[0].length - 1) < 0) {
- parts[0] += '/';
- }
- newUrl = `${parts[0]}${pathStr}${parts.length > 1 ? `?${parts[1]}` : ''}`;
- return newUrl;
- },
- /**
- * @memberOf CommonUtil
- * @description 为了避免浮点精度错误而保留的有效位数。
- * @type {number}
- * @default 14
- */
- DEFAULT_PRECISION: 14,
- /**
- * @memberOf CommonUtil
- * @description 将字符串以接近的精度转换为数字。
- * @param {string} number - 字符串。
- * @param {number} [precision=14] - 精度。
- * @returns {number} 转化后的数字。
- */
- toFloat: function (number, precision) {
- if (precision == null) {
- precision = Util.DEFAULT_PRECISION;
- }
- if (typeof number !== 'number') {
- number = parseFloat(number);
- }
- return precision === 0 ? number : parseFloat(number.toPrecision(precision));
- },
- /**
- * @memberOf CommonUtil
- * @description 角度转弧度。
- * @param {number} x - 角度。
- * @returns {number} 转化后的弧度。
- */
- rad: function (x) {
- return (x * Math.PI) / 180;
- },
- /**
- * @memberOf CommonUtil
- * @description 从 URL 字符串中解析出参数对象。
- * @param {string} url - URL。
- * @returns {Object} 解析出的参数对象。
- */
- getParameters: function (url) {
- // if no url specified, take it from the location bar
- url = url === null || url === undefined ? window.location.href : url;
- //parse out parameters portion of url string
- var paramsString = '';
- if (StringExt.contains(url, '?')) {
- var start = url.indexOf('?') + 1;
- var end = StringExt.contains(url, '#') ? url.indexOf('#') : url.length;
- paramsString = url.substring(start, end);
- }
- var parameters = {};
- var pairs = paramsString.split(/[&;]/);
- for (var i = 0, len = pairs.length; i < len; ++i) {
- var keyValue = pairs[i].split('=');
- if (keyValue[0]) {
- var key = keyValue[0];
- try {
- key = decodeURIComponent(key);
- } catch (err) {
- key = unescape(key);
- }
- // being liberal by replacing "+" with " "
- var value = (keyValue[1] || '').replace(/\+/g, ' ');
- try {
- value = decodeURIComponent(value);
- } catch (err) {
- value = unescape(value);
- }
- // follow OGC convention of comma delimited values
- value = value.split(',');
- //if there's only one value, do not return as array
- if (value.length == 1) {
- value = value[0];
- }
- parameters[key] = value;
- }
- }
- return parameters;
- },
- /**
- * @memberOf CommonUtil
- * @description 不断递增计数变量,用于生成唯一 ID。
- * @type {number}
- * @default 0
- */
- lastSeqID: 0,
- /**
- * @memberOf CommonUtil
- * @description 创建唯一 ID 值。
- * @param {string} [prefix] - 前缀。
- * @returns {string} 唯一的 ID 值。
- */
- createUniqueID: function (prefix) {
- if (prefix == null) {
- prefix = 'id_';
- }
- Util.lastSeqID += 1;
- return prefix + Util.lastSeqID;
- },
- /**
- * @memberOf CommonUtil
- * @description 判断并转化比例尺。
- * @param {number} scale - 比例尺。
- * @returns {number} 正常的 scale 值。
- */
- normalizeScale: function (scale) {
- var normScale = scale > 1.0 ? 1.0 / scale : scale;
- return normScale;
- },
- /**
- * @memberOf CommonUtil
- * @description 比例尺转分辨率。
- * @param {number} scale - 比例尺。
- * @param {string} [units='degrees'] - 比例尺单位。
- * @returns {number} 转化后的分辨率。
- */
- getResolutionFromScale: function (scale, units) {
- var resolution;
- if (scale) {
- if (units == null) {
- units = 'degrees';
- }
- var normScale = Util.normalizeScale(scale);
- resolution = 1 / (normScale * INCHES_PER_UNIT[units] * DOTS_PER_INCH);
- }
- return resolution;
- },
- /**
- * @memberOf CommonUtil
- * @description 分辨率转比例尺。
- * @param {number} resolution - 分辨率。
- * @param {string} [units='degrees'] - 分辨率单位。
- * @returns {number} 转化后的比例尺。
- */
- getScaleFromResolution: function (resolution, units) {
- if (units == null) {
- units = 'degrees';
- }
- var scale = resolution * INCHES_PER_UNIT[units] * DOTS_PER_INCH;
- return scale;
- },
- /**
- * @memberOf CommonUtil
- * @description 获取浏览器相关信息。支持的浏览器包括:Opera,Internet Explorer,Safari,Firefox。
- * @returns {Object} 浏览器名称、版本、设备名称。对应的属性分别为 name, version, device。
- */
- getBrowser: function () {
- return Browser;
- },
- /**
- * @memberOf CommonUtil
- * @description 浏览器是否支持 Canvas。
- * @returns {boolean} 当前浏览器是否支持 HTML5 Canvas。
- */
- isSupportCanvas,
- /**
- * @memberOf CommonUtil
- * @description 判断;浏览器是否支持 Canvas。
- * @returns {boolean} 当前浏览器是否支持 HTML5 Canvas 。
- */
- supportCanvas: function () {
- return Util.isSupportCanvas;
- },
- /**
- * @memberOf CommonUtil
- * @description 判断一个 URL 请求是否在当前域中。
- * @param {string} url - URL 请求字符串。
- * @returns {boolean} URL 请求是否在当前域中。
- */
- isInTheSameDomain: function (url) {
- if (!url) {
- return true;
- }
- var index = url.indexOf('//');
- var documentUrl = document.location.toString();
- var documentIndex = documentUrl.indexOf('//');
- if (index === -1) {
- return true;
- } else {
- var protocol;
- var substring = (protocol = url.substring(0, index));
- var documentSubString = documentUrl.substring(documentIndex + 2);
- documentIndex = documentSubString.indexOf('/');
- var documentPortIndex = documentSubString.indexOf(':');
- var documentDomainWithPort = documentSubString.substring(0, documentIndex);
- //var documentPort;
- var documentprotocol = document.location.protocol;
- if (documentPortIndex !== -1) {
- // documentPort = +documentSubString.substring(documentPortIndex, documentIndex);
- } else {
- documentDomainWithPort += ':' + (documentprotocol.toLowerCase() === 'http:' ? 80 : 443);
- }
- if (documentprotocol.toLowerCase() !== substring.toLowerCase()) {
- return false;
- }
- substring = url.substring(index + 2);
- var portIndex = substring.indexOf(':');
- index = substring.indexOf('/');
- var domainWithPort = substring.substring(0, index);
- var domain;
- if (portIndex !== -1) {
- domain = substring.substring(0, portIndex);
- } else {
- domain = substring.substring(0, index);
- domainWithPort += ':' + (protocol.toLowerCase() === 'http:' ? 80 : 443);
- }
- var documentDomain = document.domain;
- if (domain === documentDomain && domainWithPort === documentDomainWithPort) {
- return true;
- }
- }
- return false;
- },
- /**
- * @memberOf CommonUtil
- * @description 计算 iServer 服务的 REST 图层的显示分辨率,需要从 iServer 的 REST 图层表述中获取 viewBounds、viewer、scale、coordUnit、datumAxis 五个参数,来进行计算。
- * @param {Bounds} viewBounds - 地图的参照可视范围,即地图初始化时默认的地图显示范围。
- * @param {Size} viewer - 地图初始化时默认的地图图片的尺寸。
- * @param {number} scale - 地图初始化时默认的显示比例尺。
- * @param {string} [coordUnit='degrees'] - 投影坐标系统的地图单位。
- * @param {number} [datumAxis=6378137] - 地理坐标系统椭球体长半轴。用户自定义地图的 Options 时,若未指定该参数的值,则系统默认为 WGS84 参考系的椭球体长半轴 6378137。
- * @returns {number} 图层显示分辨率。
- */
- calculateDpi: function (viewBounds, viewer, scale, coordUnit, datumAxis) {
- //10000 是 0.1毫米与米的转换。DPI的计算公式:Viewer / DPI * 0.0254 * 10000 = ViewBounds * scale ,公式中的10000是为了提高计算结果的精度,以下出现的ratio皆为如此。
- if (!viewBounds || !viewer || !scale) {
- return;
- }
- var ratio = 10000,
- rvbWidth = viewBounds.getWidth(),
- rvbHeight = viewBounds.getHeight(),
- rvWidth = viewer.w,
- rvHeight = viewer.h;
- //用户自定义地图的Options时,若未指定该参数的值,则系统默认为6378137米,即WGS84参考系的椭球体长半轴。
- datumAxis = datumAxis || 6378137;
- coordUnit = coordUnit || 'degrees';
- var dpi;
- if (
- coordUnit.toLowerCase() === 'degree' ||
- coordUnit.toLowerCase() === 'degrees' ||
- coordUnit.toLowerCase() === 'dd'
- ) {
- let num1 = rvbWidth / rvWidth,
- num2 = rvbHeight / rvHeight,
- resolution = num1 > num2 ? num1 : num2;
- dpi = (0.0254 * ratio) / resolution / scale / ((Math.PI * 2 * datumAxis) / 360) / ratio;
- } else {
- let resolution = rvbWidth / rvWidth;
- dpi = (0.0254 * ratio) / resolution / scale / ratio;
- }
- return dpi;
- },
- /**
- * @memberOf CommonUtil
- * @description 将对象转换成 JSON 字符串。
- * @param {Object} obj - 要转换成 JSON 的 Object 对象。
- * @returns {string} 转换后的 JSON 对象。
- */
- toJSON: function (obj) {
- var objInn = obj;
- if (objInn == null) {
- return null;
- }
- switch (objInn.constructor) {
- case String:
- //s = "'" + str.replace(/(["\\])/g, "\\$1") + "'"; string含有单引号出错
- objInn = '"' + objInn.replace(/(["\\])/g, '\\$1') + '"';
- objInn = objInn.replace(/\n/g, '\\n');
- objInn = objInn.replace(/\r/g, '\\r');
- objInn = objInn.replace('<', '<');
- objInn = objInn.replace('>', '>');
- objInn = objInn.replace(/%/g, '%25');
- objInn = objInn.replace(/&/g, '%26');
- return objInn;
- case Array:
- var arr = '';
- for (var i = 0, len = objInn.length; i < len; i++) {
- arr += Util.toJSON(objInn[i]);
- if (i !== objInn.length - 1) {
- arr += ',';
- }
- }
- return "[" + arr + "]";
- case Number:
- return isFinite(objInn) ? String(objInn) : null;
- case Boolean:
- return String(objInn);
- case Date:
- var dateStr =
- '{' +
- '\'__type\':"System.DateTime",' +
- "'Year':" +
- objInn.getFullYear() +
- ',' +
- "'Month':" +
- (objInn.getMonth() + 1) +
- ',' +
- "'Day':" +
- objInn.getDate() +
- ',' +
- "'Hour':" +
- objInn.getHours() +
- ',' +
- "'Minute':" +
- objInn.getMinutes() +
- ',' +
- "'Second':" +
- objInn.getSeconds() +
- ',' +
- "'Millisecond':" +
- objInn.getMilliseconds() +
- ',' +
- "'TimezoneOffset':" +
- objInn.getTimezoneOffset() +
- '}';
- return dateStr;
- default:
- if (objInn['toJSON'] != null && typeof objInn['toJSON'] === 'function') {
- return objInn.toJSON();
- }
- if (typeof objInn === 'object') {
- if (objInn.length) {
- let arr = [];
- for (let i = 0, len = objInn.length; i < len; i++) {
- arr.push(Util.toJSON(objInn[i]));
- }
- return '[' + arr.join(',') + ']';
- }
- let arr = [];
- for (let attr in objInn) {
- //为解决Geometry类型头json时堆栈溢出的问题,attr == "parent"时不进行json转换
- if (typeof objInn[attr] !== 'function' && attr !== 'CLASS_NAME' && attr !== 'parent') {
- arr.push("'" + attr + "':" + Util.toJSON(objInn[attr]));
- }
- }
- if (arr.length > 0) {
- return '{' + arr.join(',') + '}';
- } else {
- return '{}';
- }
- }
- return objInn.toString();
- }
- },
- /**
- * @memberOf CommonUtil
- * @description 根据比例尺和 dpi 计算屏幕分辨率。
- * @category BaseTypes Util
- * @param {number} scale - 比例尺。
- * @param {number} dpi - 图像分辨率,表示每英寸内的像素个数。
- * @param {string} [coordUnit] - 投影坐标系统的地图单位。
- * @param {number} [datumAxis=6378137] - 地理坐标系统椭球体长半轴。用户自定义地图的 Options 时,若未指定该参数的值,则 DPI 默认按照 WGS84 参考系的椭球体长半轴 6378137 来计算。
- * @returns {number} 当前比例尺下的屏幕分辨率。
- */
- getResolutionFromScaleDpi: function (scale, dpi, coordUnit, datumAxis) {
- var resolution = null,
- ratio = 10000;
- //用户自定义地图的Options时,若未指定该参数的值,则系统默认为6378137米,即WGS84参考系的椭球体长半轴。
- datumAxis = datumAxis || 6378137;
- coordUnit = coordUnit || '';
- if (scale > 0 && dpi > 0) {
- scale = Util.normalizeScale(scale);
- if (
- coordUnit.toLowerCase() === 'degree' ||
- coordUnit.toLowerCase() === 'degrees' ||
- coordUnit.toLowerCase() === 'dd'
- ) {
- //scale = Util.normalizeScale(scale);
- resolution = (0.0254 * ratio) / dpi / scale / ((Math.PI * 2 * datumAxis) / 360) / ratio;
- return resolution;
- } else {
- resolution = (0.0254 * ratio) / dpi / scale / ratio;
- return resolution;
- }
- }
- return -1;
- },
- /**
- * @memberOf CommonUtil
- * @description 根据 resolution、dpi、coordUnit 和 datumAxis 计算比例尺。
- * @param {number} resolution - 用于计算比例尺的地图分辨率。
- * @param {number} dpi - 图像分辨率,表示每英寸内的像素个数。
- * @param {string} [coordUnit] - 投影坐标系统的地图单位。
- * @param {number} [datumAxis=6378137] - 地理坐标系统椭球体长半轴。用户自定义地图的 Options 时,若未指定该参数的值,则 DPI 默认按照 WGS84 参考系的椭球体长半轴 6378137 来计算。
- * @returns {number} 当前屏幕分辨率下的比例尺。
- */
- getScaleFromResolutionDpi: function (resolution, dpi, coordUnit, datumAxis) {
- var scale = null,
- ratio = 10000;
- //用户自定义地图的Options时,若未指定该参数的值,则系统默认为6378137米,即WGS84参考系的椭球体长半轴。
- datumAxis = datumAxis || 6378137;
- coordUnit = coordUnit || '';
- if (resolution > 0 && dpi > 0) {
- if (
- coordUnit.toLowerCase() === 'degree' ||
- coordUnit.toLowerCase() === 'degrees' ||
- coordUnit.toLowerCase() === 'dd'
- ) {
- scale = (0.0254 * ratio) / dpi / resolution / ((Math.PI * 2 * datumAxis) / 360) / ratio;
- return scale;
- } else {
- scale = (0.0254 * ratio) / dpi / resolution / ratio;
- return scale;
- }
- }
- return -1;
- },
- /**
- * @memberOf CommonUtil
- * @description 转换查询结果。
- * @param {Object} result - 查询结果。
- * @returns {Object} 转换后的查询结果。
- */
- transformResult: function (result) {
- if (result.responseText && typeof result.responseText === 'string') {
- result = JSON.parse(result.responseText);
- }
- return result;
- },
- /**
- * @memberOf CommonUtil
- * @description 属性拷贝,不拷贝方法类名(CLASS_NAME)等。
- * @param {Object} [destination] - 拷贝目标。
- * @param {Object} source - 源对象。
- *
- */
- copyAttributes: function (destination, source) {
- destination = destination || {};
- if (source) {
- for (var property in source) {
- var value = source[property];
- if (value !== undefined && property !== 'CLASS_NAME' && typeof value !== 'function') {
- destination[property] = value;
- }
- }
- }
- return destination;
- },
- /**
- * @memberOf CommonUtil
- * @description 将源对象上的属性拷贝到目标对象上。(不拷贝 CLASS_NAME 和方法)
- * @param {Object} [destination] - 目标对象。
- * @param {Object} source - 源对象。
- * @param {Array.<string>} clip - 源对象中禁止拷贝到目标对象的属性,目的是防止目标对象上不可修改的属性被篡改。
- *
- */
- copyAttributesWithClip: function (destination, source, clip) {
- destination = destination || {};
- if (source) {
- for (var property in source) {
- //去掉禁止拷贝的属性
- var isInClip = false;
- if (clip && clip.length) {
- for (var i = 0, len = clip.length; i < len; i++) {
- if (property === clip[i]) {
- isInClip = true;
- break;
- }
- }
- }
- if (isInClip === true) {
- continue;
- }
- var value = source[property];
- if (value !== undefined && property !== 'CLASS_NAME' && typeof value !== 'function') {
- destination[property] = value;
- }
- }
- }
- return destination;
- },
- /**
- * @memberOf CommonUtil
- * @description 克隆一个 Object 对象
- * @param {Object} obj - 需要克隆的对象。
- * @returns {Object} 对象的拷贝对象,注意是新的对象,不是指向。
- */
- cloneObject: function (obj) {
- // Handle the 3 simple types, and null or undefined
- if (null === obj || 'object' !== typeof obj) {
- return obj;
- }
- // Handle Date
- if (obj instanceof Date) {
- let copy = new Date();
- copy.setTime(obj.getTime());
- return copy;
- }
- // Handle Array
- if (obj instanceof Array) {
- let copy = obj.slice(0);
- return copy;
- }
- // Handle Object
- if (obj instanceof Object) {
- let copy = {};
- for (var attr in obj) {
- if (obj.hasOwnProperty(attr)) {
- copy[attr] = Util.cloneObject(obj[attr]);
- }
- }
- return copy;
- }
- throw new Error("Unable to copy obj! Its type isn't supported.");
- },
- /**
- * @memberOf CommonUtil
- * @description 判断两条线段是不是有交点。
- * @param {GeometryPoint} a1 - 第一条线段的起始节点。
- * @param {GeometryPoint} a2 - 第一条线段的结束节点。
- * @param {GeometryPoint} b1 - 第二条线段的起始节点。
- * @param {GeometryPoint} b2 - 第二条线段的结束节点。
- * @returns {Object} 如果相交返回交点,如果不相交返回两条线段的位置关系。
- */
- lineIntersection: function (a1, a2, b1, b2) {
- var intersectValue = null;
- var k1;
- var k2;
- var b = (b2.x - b1.x) * (a1.y - b1.y) - (b2.y - b1.y) * (a1.x - b1.x);
- var a = (a2.x - a1.x) * (a1.y - b1.y) - (a2.y - a1.y) * (a1.x - b1.x);
- var ab = (b2.y - b1.y) * (a2.x - a1.x) - (b2.x - b1.x) * (a2.y - a1.y);
- //ab==0代表两条线断的斜率一样
- if (ab != 0) {
- k1 = b / ab;
- k2 = a / ab;
- if (k1 >= 0 && k2 <= 1 && k1 <= 1 && k2 >= 0) {
- intersectValue = new Geometry.Point(a1.x + k1 * (a2.x - a1.x), a1.y + k1 * (a2.y - a1.y));
- } else {
- intersectValue = 'No Intersection';
- }
- } else {
- if (b == 0 && a == 0) {
- var maxy = Math.max(a1.y, a2.y);
- var miny = Math.min(a1.y, a2.y);
- var maxx = Math.max(a1.x, a2.x);
- var minx = Math.min(a1.x, a2.x);
- if (
- (((b1.y >= miny && b1.y <= maxy) || (b2.y >= miny && b2.y <= maxy)) && b1.x >= minx && b1.x <= maxx) ||
- (b2.x >= minx && b2.x <= maxx)
- ) {
- intersectValue = 'Coincident'; //重合
- } else {
- intersectValue = 'Parallel'; //平行
- }
- } else {
- intersectValue = 'Parallel'; //平行
- }
- }
- return intersectValue;
- },
- /**
- * @memberOf CommonUtil
- * @description 获取文本外接矩形宽度与高度。
- * @param {ThemeStyle} style - 文本样式。
- * @param {string} text - 文本内容。
- * @param {Object} element - DOM 元素。
- * @returns {Object} 裁剪后的宽度,高度信息。
- */
- getTextBounds: function (style, text, element) {
- document.body.appendChild(element);
- element.style.width = 'auto';
- element.style.height = 'auto';
- if (style.fontSize) {
- element.style.fontSize = style.fontSize;
- }
- if (style.fontFamily) {
- element.style.fontFamily = style.fontFamily;
- }
- if (style.fontWeight) {
- element.style.fontWeight = style.fontWeight;
- }
- element.style.position = 'relative';
- element.style.visibility = 'hidden';
- //fix 在某些情况下,element内的文本变成竖起排列,导致宽度计算不正确的bug
- element.style.display = 'inline-block';
- element.innerHTML = text;
- var textWidth = element.clientWidth;
- var textHeight = element.clientHeight;
- document.body.removeChild(element);
- return {
- textWidth: textWidth,
- textHeight: textHeight
- };
- },
- /**
- * @memberOf CommonUtil
- * @description 获取转换后的path路径。
- * @param {string} path - 待转换的path, 包含`{param}`。
- * @param {Object} pathParams - path中待替换的参数。
- * @returns {string} 转换后的path路径
- */
- convertPath: function (path, pathParams) {
- if (!pathParams) {
- return path;
- }
- return path.replace(/\{([\w-\.]+)\}/g, (fullMatch, key) => {
- var value;
- if (pathParams.hasOwnProperty(key)) {
- value = paramToString(pathParams[key]);
- } else {
- value = fullMatch;
- }
- return encodeURIComponent(value);
- });
- }
- };
- /**
- * @enum INCHES_PER_UNIT
- * @description 每单位的英尺数。
- * @type {number}
- * @private
- */
- const INCHES_PER_UNIT = {
- inches: 1.0,
- ft: 12.0,
- mi: 63360.0,
- m: 39.3701,
- km: 39370.1,
- dd: 4374754,
- yd: 36
- };
- INCHES_PER_UNIT['in'] = INCHES_PER_UNIT.inches;
- INCHES_PER_UNIT['degrees'] = INCHES_PER_UNIT.dd;
- INCHES_PER_UNIT['nmi'] = 1852 * INCHES_PER_UNIT.m;
- // Units from CS-Map
- const METERS_PER_INCH = 0.0254000508001016002;
- Util.extend(INCHES_PER_UNIT, {
- Inch: INCHES_PER_UNIT.inches,
- Meter: 1.0 / METERS_PER_INCH, //EPSG:9001
- Foot: 0.30480060960121920243 / METERS_PER_INCH, //EPSG:9003
- IFoot: 0.3048 / METERS_PER_INCH, //EPSG:9002
- ClarkeFoot: 0.3047972651151 / METERS_PER_INCH, //EPSG:9005
- SearsFoot: 0.30479947153867624624 / METERS_PER_INCH, //EPSG:9041
- GoldCoastFoot: 0.30479971018150881758 / METERS_PER_INCH, //EPSG:9094
- IInch: 0.0254 / METERS_PER_INCH,
- MicroInch: 0.0000254 / METERS_PER_INCH,
- Mil: 0.0000000254 / METERS_PER_INCH,
- Centimeter: 0.01 / METERS_PER_INCH,
- Kilometer: 1000.0 / METERS_PER_INCH, //EPSG:9036
- Yard: 0.91440182880365760731 / METERS_PER_INCH,
- SearsYard: 0.914398414616029 / METERS_PER_INCH, //EPSG:9040
- IndianYard: 0.91439853074444079983 / METERS_PER_INCH, //EPSG:9084
- IndianYd37: 0.91439523 / METERS_PER_INCH, //EPSG:9085
- IndianYd62: 0.9143988 / METERS_PER_INCH, //EPSG:9086
- IndianYd75: 0.9143985 / METERS_PER_INCH, //EPSG:9087
- IndianFoot: 0.30479951 / METERS_PER_INCH, //EPSG:9080
- IndianFt37: 0.30479841 / METERS_PER_INCH, //EPSG:9081
- IndianFt62: 0.3047996 / METERS_PER_INCH, //EPSG:9082
- IndianFt75: 0.3047995 / METERS_PER_INCH, //EPSG:9083
- Mile: 1609.34721869443738887477 / METERS_PER_INCH,
- IYard: 0.9144 / METERS_PER_INCH, //EPSG:9096
- IMile: 1609.344 / METERS_PER_INCH, //EPSG:9093
- NautM: 1852.0 / METERS_PER_INCH, //EPSG:9030
- 'Lat-66': 110943.316488932731 / METERS_PER_INCH,
- 'Lat-83': 110946.25736872234125 / METERS_PER_INCH,
- Decimeter: 0.1 / METERS_PER_INCH,
- Millimeter: 0.001 / METERS_PER_INCH,
- Dekameter: 10.0 / METERS_PER_INCH,
- Decameter: 10.0 / METERS_PER_INCH,
- Hectometer: 100.0 / METERS_PER_INCH,
- GermanMeter: 1.0000135965 / METERS_PER_INCH, //EPSG:9031
- CaGrid: 0.999738 / METERS_PER_INCH,
- ClarkeChain: 20.1166194976 / METERS_PER_INCH, //EPSG:9038
- GunterChain: 20.11684023368047 / METERS_PER_INCH, //EPSG:9033
- BenoitChain: 20.116782494375872 / METERS_PER_INCH, //EPSG:9062
- SearsChain: 20.11676512155 / METERS_PER_INCH, //EPSG:9042
- ClarkeLink: 0.201166194976 / METERS_PER_INCH, //EPSG:9039
- GunterLink: 0.2011684023368047 / METERS_PER_INCH, //EPSG:9034
- BenoitLink: 0.20116782494375872 / METERS_PER_INCH, //EPSG:9063
- SearsLink: 0.2011676512155 / METERS_PER_INCH, //EPSG:9043
- Rod: 5.02921005842012 / METERS_PER_INCH,
- IntnlChain: 20.1168 / METERS_PER_INCH, //EPSG:9097
- IntnlLink: 0.201168 / METERS_PER_INCH, //EPSG:9098
- Perch: 5.02921005842012 / METERS_PER_INCH,
- Pole: 5.02921005842012 / METERS_PER_INCH,
- Furlong: 201.1684023368046 / METERS_PER_INCH,
- Rood: 3.778266898 / METERS_PER_INCH,
- CapeFoot: 0.3047972615 / METERS_PER_INCH,
- Brealey: 375.0 / METERS_PER_INCH,
- ModAmFt: 0.304812252984505969011938 / METERS_PER_INCH,
- Fathom: 1.8288 / METERS_PER_INCH,
- 'NautM-UK': 1853.184 / METERS_PER_INCH,
- '50kilometers': 50000.0 / METERS_PER_INCH,
- '150kilometers': 150000.0 / METERS_PER_INCH
- });
- //unit abbreviations supported by PROJ.4
- Util.extend(INCHES_PER_UNIT, {
- mm: INCHES_PER_UNIT['Meter'] / 1000.0,
- cm: INCHES_PER_UNIT['Meter'] / 100.0,
- dm: INCHES_PER_UNIT['Meter'] * 100.0,
- km: INCHES_PER_UNIT['Meter'] * 1000.0,
- kmi: INCHES_PER_UNIT['nmi'], //International Nautical Mile
- fath: INCHES_PER_UNIT['Fathom'], //International Fathom
- ch: INCHES_PER_UNIT['IntnlChain'], //International Chain
- link: INCHES_PER_UNIT['IntnlLink'], //International Link
- 'us-in': INCHES_PER_UNIT['inches'], //U.S. Surveyor's Inch
- 'us-ft': INCHES_PER_UNIT['Foot'], //U.S. Surveyor's Foot
- 'us-yd': INCHES_PER_UNIT['Yard'], //U.S. Surveyor's Yard
- 'us-ch': INCHES_PER_UNIT['GunterChain'], //U.S. Surveyor's Chain
- 'us-mi': INCHES_PER_UNIT['Mile'], //U.S. Surveyor's Statute Mile
- 'ind-yd': INCHES_PER_UNIT['IndianYd37'], //Indian Yard
- 'ind-ft': INCHES_PER_UNIT['IndianFt37'], //Indian Foot
- 'ind-ch': 20.11669506 / METERS_PER_INCH //Indian Chain
- });
- //将服务端的地图单位转成SuperMap的地图单位
- INCHES_PER_UNIT['degree'] = INCHES_PER_UNIT.dd;
- INCHES_PER_UNIT['meter'] = INCHES_PER_UNIT.m;
- INCHES_PER_UNIT['foot'] = INCHES_PER_UNIT.ft;
- INCHES_PER_UNIT['inch'] = INCHES_PER_UNIT.inches;
- INCHES_PER_UNIT['mile'] = INCHES_PER_UNIT.mi;
- INCHES_PER_UNIT['kilometer'] = INCHES_PER_UNIT.km;
- INCHES_PER_UNIT['yard'] = INCHES_PER_UNIT.yd;
- function paramToString(param) {
- if (param == undefined || param == null) {
- return '';
- }
- if (param instanceof Date) {
- return param.toJSON();
- }
- if (canBeJsonified(param)) {
- return JSON.stringify(param);
- }
- return param.toString();
- }
- function canBeJsonified(str) {
- if (typeof str !== 'string' && typeof str !== 'object') {
- return false;
- }
- try {
- const type = str.toString();
- return type === '[object Object]' || type === '[object Array]';
- } catch (err) {
- return false;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/commontypes/LonLat.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class LonLat
- * @category BaseTypes Geometry
- * @classdesc 这个类用来表示经度和纬度对。
- * @param {number|Array.<number>} [lon=0.0] - 地图单位上的 X 轴坐标或者横纵坐标组成的数组;如果地图是地理投影,则此值是经度,否则,此值是地图地理位置的 x 坐标。
- * @param {number} [lat=0.0] - 地图单位上的 Y 轴坐标,如果地图是地理投影,则此值是纬度,否则,此值是地图地理位置的 y 坐标。
- * @example
- * var lonLat = new LonLat(30,45);
- * @usage
- */
- class LonLat {
- constructor(lon, lat) {
- if (Util.isArray(lon)) {
- lat = lon[1];
- lon = lon[0];
- }
- /**
- * @member {number} [LonLat.prototype.lon=0.0]
- * @description 地图的单位的 X 轴(横轴)坐标。
- */
- this.lon = lon ? Util.toFloat(lon) : 0.0;
- /**
- * @member {number} [LonLat.prototype.lat=0.0]
- * @description 地图的单位的 Y 轴(纵轴)坐标。
- */
- this.lat = lat ? Util.toFloat(lat) : 0.0;
- this.CLASS_NAME = "SuperMap.LonLat";
- }
- /**
- * @function LonLat.prototype.toString
- * @description 返回此对象的字符串形式
- * @example
- * var lonLat = new LonLat(100,50);
- * var str = lonLat.toString();
- * @returns {string} 例如: "lon=100,lat=50"
- */
- toString() {
- return ("lon=" + this.lon + ",lat=" + this.lat);
- }
- /**
- * @function LonLat.prototype.toShortString
- * @description 将经度纬度转换成简单字符串。
- * @example
- * var lonLat = new LonLat(100,50);
- * var str = lonLat.toShortString();
- * @returns {string} 处理后的经纬度字符串。例如:"100,50"
- */
- toShortString() {
- return (this.lon + "," + this.lat);
- }
- /**
- * @function LonLat.prototype.clone
- * @description 复制坐标对象,并返回复制后的新对象。
- * @example
- * var lonLat1 = new LonLat(100,50);
- * var lonLat2 = lonLat1.clone();
- * @returns {LonLat} 相同坐标值的新的坐标对象。
- */
- clone() {
- return new LonLat(this.lon, this.lat);
- }
- /**
- * @function LonLat.prototype.add
- * @description 在已有坐标对象的经纬度基础上加上新的坐标经纬度,并返回新的坐标对象。
- * @example
- * var lonLat1 = new LonLat(100,50);
- * //lonLat2 是新的对象
- * var lonLat2 = lonLat1.add(100,50);
- * @param {number} lon - 经度参数。
- * @param {number} lat - 纬度参数。
- * @returns {LonLat} 新的 LonLat 对象,此对象的经纬度是由传入的经纬度与当前的经纬度相加所得。
- */
- add(lon, lat) {
- if ((lon == null) || (lat == null)) {
- throw new TypeError('LonLat.add cannot receive null values');
- }
- return new LonLat(this.lon + Util.toFloat(lon),
- this.lat + Util.toFloat(lat));
- }
- /**
- * @function LonLat.prototype.equals
- * @description 判断两个坐标对象是否相等。
- * @example
- * var lonLat1 = new LonLat(100,50);
- * var lonLat2 = new LonLat(100,50);
- * var isEquals = lonLat1.equals(lonLat2);
- * @param {LonLat} ll - 需要进行比较的坐标对象。
- * @returns {boolean} 如果LonLat对象的经纬度和传入的经纬度一致则返回true,不一
- * 致或传入的ll参数为NULL则返回false。
- */
- equals(ll) {
- var equals = false;
- if (ll != null) {
- equals = ((this.lon === ll.lon && this.lat === ll.lat) ||
- (isNaN(this.lon) && isNaN(this.lat) && isNaN(ll.lon) && isNaN(ll.lat)));
- }
- return equals;
- }
- /**
- * @function LonLat.prototype.wrapDateLine
- * @description 通过传入的范围对象对坐标对象转换到该范围内。
- * 如果经度小于给定范围最小精度,则在原经度基础上加上范围宽度,直到精度在范围内为止,如果经度大于给定范围则在原经度基础上减去范围宽度。
- * 即指将不在经度范围内的坐标转换到范围以内(只会转换 lon,不会转换 lat,主要用于转移到日界线以内)。
- * @example
- * var lonLat1 = new LonLat(420,50);
- * var lonLat2 = lonLat1.wrapDateLine(
- * new Bounds(-180,-90,180,90)
- * );
- * @param {Bounds} maxExtent - 最大边界的范围。
- * @returns {LonLat} 将坐标转换到范围对象以内,并返回新的坐标。
- */
- wrapDateLine(maxExtent) {
- var newLonLat = this.clone();
- if (maxExtent) {
- //shift right?
- while (newLonLat.lon < maxExtent.left) {
- newLonLat.lon += maxExtent.getWidth();
- }
- //shift left?
- while (newLonLat.lon > maxExtent.right) {
- newLonLat.lon -= maxExtent.getWidth();
- }
- }
- return newLonLat;
- }
- /**
- *
- * @function LonLat.prototype.destroy
- * @description 销毁此对象。
- * 销毁后此对象的所有属性为 null,而不是初始值。
- * @example
- * var lonLat = new LonLat(100,50);
- * lonLat.destroy();
- */
- destroy() {
- this.lon = null;
- this.lat = null;
- }
- /**
- * @function LonLat.fromString
- * @description 通过字符串生成一个 {@link LonLat} 对象。
- * @example
- * var str = "100,50";
- * var lonLat = LonLat.fromString(str);
- * @param {string} str - 字符串的格式:Lon+","+Lat。如:"100,50"。
- * @returns {LonLat} {@link LonLat} 对象。
- */
- static fromString(str) {
- var pair = str.split(",");
- return new LonLat(pair[0], pair[1]);
- }
- /**
- * @function LonLat.fromArray
- * @description 通过数组生成一个 {@link LonLat} 对象。
- * @param {Array.<number>} arr - 数组的格式,长度只能为2,:[Lon,Lat]。如:[5,-42]。
- * @returns {LonLat} {@link LonLat} 对象。
- */
- static fromArray(arr) {
- var gotArr = Util.isArray(arr),
- lon = gotArr && arr[0],
- lat = gotArr && arr[1];
- return new LonLat(lon, lat);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/commontypes/Bounds.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class Bounds
- * @deprecatedclass SuperMap.Bounds
- * @category BaseTypes Geometry
- * @classdesc 表示边界类实例。使用 bounds 之前需要设置 left,bottom,right,top 四个属性,这些属性的初始值为 null。
- * @param {number|Array.<number>} [left] - 如果是number,则表示左边界,注意考虑宽度,理论上小于 right 值。如果是数组,则表示 [left, bottom, right, top] 左下右上组成的数组。
- * @param {number} [bottom] - 下边界。考虑高度,理论上小于 top 值。
- * @param {number} [right] - 右边界。
- * @param {number} [top] - 上边界。
- * @example
- * var bounds = new Bounds();
- * bounds.extend(new LonLat(4,5));
- * bounds.extend(new LonLat(5,6));
- * bounds.toBBOX(); // returns 4,5,5,6
- * @usage
- */
- class Bounds {
- constructor(left, bottom, right, top) {
- if (Util.isArray(left)) {
- top = left[3];
- right = left[2];
- bottom = left[1];
- left = left[0];
- }
- /**
- * @member {number} Bounds.prototype.left
- * @description 最小的水平坐标系。
- */
- this.left = left != null ? Util.toFloat(left) : this.left;
- /**
- * @member {number} Bounds.prototype.bottom
- * @description 最小的垂直坐标系。
- */
- this.bottom = bottom != null ? Util.toFloat(bottom) : this.bottom;
- /**
- * @member {number} Bounds.prototype.right
- * @description 最大的水平坐标系。
- */
- this.right = right != null ? Util.toFloat(right) : this.right;
- /**
- * @member {number} Bounds.prototype.top
- * @description 最大的垂直坐标系。
- */
- this.top = top != null ? Util.toFloat(top) : this.top;
- /**
- * @member {LonLat} Bounds.prototype.centerLonLat
- * @description bounds 的地图空间的中心点。用 getCenterLonLat() 获得。
- */
- this.centerLonLat = null;
- this.CLASS_NAME = "SuperMap.Bounds";
- }
- /**
- * @function Bounds.prototype.clone
- * @description 复制当前 bounds 对象。
- * @example
- * var bounds1 = new Bounds(-180,-90,180,90);
- * var bounds2 = bounds1.clone();
- * @returns {Bounds} 克隆后的 bounds。
- */
- clone() {
- return new Bounds(this.left, this.bottom,
- this.right, this.top);
- }
- /**
- * @function Bounds.prototype.equals
- * @description 判断两个 bounds 对象是否相等。
- * @example
- * var bounds1 = new Bounds(-180,-90,180,90);
- * var bounds2 = new Bounds(-180,-90,180,90);
- * var isEquals = bounds1.equals(bounds2);
- * @param {Bounds} bounds - 需要进行计较的 bounds。
- * @returns {boolean} 如果 bounds 对象的边和传入的 bounds 一致则返回 true,不一致或传入的 bounds 参数为 NULL 则返回 false。
- */
- equals(bounds) {
- var equals = false;
- if (bounds != null) {
- equals = ((this.left === bounds.left) &&
- (this.right === bounds.right) &&
- (this.top === bounds.top) &&
- (this.bottom === bounds.bottom));
- }
- return equals;
- }
- /**
- * @function Bounds.prototype.toString
- * @description 返回此对象的字符串形式。
- * @example
- * var bounds = new Bounds(-180,-90,180,90);
- * var str = bounds.toString();
- * @returns {string} 边界对象的字符串表示形式(left,bottom,right,top),例如: "-180,-90,180,90"。
- */
- toString() {
- return [this.left, this.bottom, this.right, this.top].join(",");
- }
- /**
- * @function Bounds.prototype.toArray
- * @description 边界对象的数组表示形式。
- * @example
- * var bounds = new Bounds(-180,-90,100,80);
- * //array1 = [-180,-90,100,80];
- * var array1 = bounds.toArray();
- * //array1 = [-90,-180,80,100];
- * var array2 = bounds.toArray(true);
- * @param {boolean} [reverseAxisOrder=false] - 是否反转轴顺序。
- * 如果设为 true,则倒转顺序(bottom,left,top,right),否则按正常轴顺序(left,bottom,right,top)。
- * @returns {Array.<number>} left, bottom, right, top 数组。
- */
- toArray(reverseAxisOrder) {
- if (reverseAxisOrder === true) {
- return [this.bottom, this.left, this.top, this.right];
- } else {
- return [this.left, this.bottom, this.right, this.top];
- }
- }
- /**
- * @function Bounds.prototype.toBBOX
- * @description 取小数点后 decimal 位数字进行四舍五入再转换为 BBOX 字符串。
- * @example
- * var bounds = new Bounds(-1.1234567,-1.7654321,1.4444444,1.5555555);
- * //str1 = "-1.123457,-1.765432,1.444444,1.555556";
- * var str1 = bounds.toBBOX();
- * //str2 = "-1.1,-1.8,1.4,1.6";
- * var str2 = bounds.toBBOX(1);
- * //str2 = "-1.8,-1.1,1.6,1.4";
- * var str2 = bounds.toBBOX(1,true);
- * @param {number} [decimal=6] - 边界方位坐标的有效数字个数。
- * @param {boolean} [reverseAxisOrder=false] - 是否是反转轴顺序。
- * 如果设为true,则倒转顺序(bottom,left,top,right),否则按正常轴顺序(left,bottom,right,top)。
- * @returns {string} 边界对象的字符串表示形式,如:"5,42,10,45"。
- */
- toBBOX(decimal, reverseAxisOrder) {
- if (decimal == null) {
- decimal = 6;
- }
- var mult = Math.pow(10, decimal);
- var xmin = Math.round(this.left * mult) / mult;
- var ymin = Math.round(this.bottom * mult) / mult;
- var xmax = Math.round(this.right * mult) / mult;
- var ymax = Math.round(this.top * mult) / mult;
- if (reverseAxisOrder === true) {
- return ymin + "," + xmin + "," + ymax + "," + xmax;
- } else {
- return xmin + "," + ymin + "," + xmax + "," + ymax;
- }
- }
- ///**
- // * @function Bounds.prototype.toGeometry
- // * @description 基于当前边界范围创建一个新的多边形对象。
- // * @example
- // * var bounds = new Bounds(-180,-90,100,80);
- // * // Polygon对象
- // * var geo = bounds.toGeometry();
- // * @returns {GeometryPolygon} 基于当前 bounds 坐标创建的新的多边形。
- // */
- // toGeometry() {
- // return new Polygon([
- // new LinearRing([
- // new Point(this.left, this.bottom),
- // new Point(this.right, this.bottom),
- // new Point(this.right, this.top),
- // new Point(this.left, this.top)
- // ])
- // ]);
- // }
- /**
- * @function Bounds.prototype.getWidth
- * @description 获取 bounds 的宽度。
- * @example
- * var bounds = new Bounds(-180,-90,100,80);
- * //width = 280;
- * var width = bounds.getWidth();
- * @returns {number} 获取当前 bounds 的宽度(right 减去 left)。
- */
- getWidth() {
- return (this.right - this.left);
- }
- /**
- * @function Bounds.prototype.getHeight
- * @description 获取 bounds 的高度。
- * @example
- * var bounds = new Bounds(-180,-90,100,80);
- * //height = 170;
- * var height = bounds.getHeight();
- * @returns {number} 边界高度(top 减去 bottom)。
- */
- getHeight() {
- return (this.top - this.bottom);
- }
- /**
- * @function Bounds.prototype.getSize
- * @description 获取边框大小。
- * @example
- * var bounds = new Bounds(-180,-90,100,80);
- * var size = bounds.getSize();
- * @returns {Size} 边框大小。
- */
- getSize() {
- return new Size(this.getWidth(), this.getHeight());
- }
- /**
- * @function Bounds.prototype.getCenterPixel
- * @description 获取像素格式的范围中心点。
- * @example
- * var bounds = new Bounds(-180,-90,100,80);
- * var pixel = bounds.getCenterPixel();
- * @returns {Pixel} 像素格式的当前范围的中心点。
- */
- getCenterPixel() {
- return new Pixel((this.left + this.right) / 2,
- (this.bottom + this.top) / 2);
- }
- /**
- * @function Bounds.prototype.getCenterLonLat
- * @description 获取地理格式的范围中心点。
- * @example
- * var bounds = new Bounds(-180,-90,100,80);
- * var lonlat = bounds.getCenterLonLat();
- * @returns {LonLat} 当前地理范围的中心点。
- */
- getCenterLonLat() {
- if (!this.centerLonLat) {
- this.centerLonLat = new LonLat(
- (this.left + this.right) / 2, (this.bottom + this.top) / 2
- );
- }
- return this.centerLonLat;
- }
- /**
- * @function Bounds.prototype.scale
- * @description 按照比例扩大/缩小出一个新的 bounds。
- * @example
- * var bounds = new Bounds(-50,-50,40,40);
- * var bounds2 = bounds.scale(2);
- * @param {number} [ratio=1] - 需要扩大的比例。
- * @param {(Pixel|LonLat)} [origin] - 扩大时的基准点,默认为当前 bounds 的中心点。
- * @returns {Bounds} 通过 ratio、origin 计算得到的新的边界范围。
- */
- scale(ratio, origin) {
- ratio = ratio ? ratio : 1;
- if (origin == null) {
- origin = this.getCenterLonLat();
- }
- var origx, origy;
- // get origin coordinates
- if (origin.CLASS_NAME === "SuperMap.LonLat") {
- origx = origin.lon;
- origy = origin.lat;
- } else {
- origx = origin.x;
- origy = origin.y;
- }
- var left = (this.left - origx) * ratio + origx;
- var bottom = (this.bottom - origy) * ratio + origy;
- var right = (this.right - origx) * ratio + origx;
- var top = (this.top - origy) * ratio + origy;
- return new Bounds(left, bottom, right, top);
- }
- /**
- * @function Bounds.prototype.add
- * @description 在当前的 Bounds 上按照传入的坐标点进行平移,返回新的范围。
- * @example
- * var bounds1 = new Bounds(-50,-50,40,40);
- * //bounds2 是新的 bounds
- * var bounds2 = bounds.add(20,10);
- * @param {number} x - 坐标点的 x 坐标。
- * @param {number} y - 坐标点的 y 坐标。
- * @returns {Bounds} 新的 bounds,此 bounds 的坐标是由传入的 x,y 参数与当前 bounds 坐标计算所得。
- */
- add(x, y) {
- if ((x == null) || (y == null)) {
- throw new TypeError('Bounds.add cannot receive null values');
- }
- return new Bounds(this.left + x, this.bottom + y,
- this.right + x, this.top + y);
- }
- /**
- * @function Bounds.prototype.extend
- * @description 在当前 bounds 上扩展 bounds,支持 point,lanlat 和 bounds。扩展后的 bounds 的范围是两者的结合。
- * @example
- * var bounds1 = new Bounds(-50,-50,40,40);
- * //bounds 改变
- * bounds.extend(new LonLat(50,60));
- * @param {GeometryPoint|LonLat|Bounds} object - 可以是 point、lonlat 和 bounds。
- */
- extend(object) {
- var bounds = null;
- if (object) {
- // clear cached center location
- switch (object.CLASS_NAME) {
- case "SuperMap.LonLat":
- bounds = new Bounds(object.lon, object.lat,
- object.lon, object.lat);
- break;
- case "SuperMap.Geometry.Point":
- bounds = new Bounds(object.x, object.y,
- object.x, object.y);
- break;
- case "SuperMap.Bounds":
- bounds = object;
- break;
- }
- if (bounds) {
- this.centerLonLat = null;
- if ((this.left == null) || (bounds.left < this.left)) {
- this.left = bounds.left;
- }
- if ((this.bottom == null) || (bounds.bottom < this.bottom)) {
- this.bottom = bounds.bottom;
- }
- if ((this.right == null) || (bounds.right > this.right)) {
- this.right = bounds.right;
- }
- if ((this.top == null) || (bounds.top > this.top)) {
- this.top = bounds.top;
- }
- }
- }
- }
- /**
- * @function Bounds.prototype.containsLonLat
- * @description 判断传入的坐标是否在范围内。
- * @example
- * var bounds1 = new Bounds(-50,-50,40,40);
- * //isContains1 = true
- * //这里的第二个参数可以直接为 boolean 类型,也就是inclusive
- * var isContains1 = bounds.containsLonLat(new LonLat(40,40),true);
- *
- * //(40,40)在范围内,同样(40+360,40)也在范围内
- * var bounds2 = new Bounds(-50,-50,40,40);
- * //isContains2 = true;
- * var isContains2 = bounds2.containsLonLat(
- * new LonLat(400,40),
- * {
- * inclusive:true,
- * //全球的范围
- * worldBounds: new Bounds(-180,-90,180,90)
- * }
- * );
- * @param {(LonLat|Object)} ll - <LonLat> 对象或者是一个包含 'lon' 与 'lat' 属性的对象。
- * @param {Object} options - 可选参数。
- * @param {boolean} [options.inclusive=true] - 是否包含边界。
- * @param {Bounds} [options.worldBounds] - 如果提供 worldBounds 参数, 如果 ll 参数提供的坐标超出了世界边界(worldBounds),
- * 但是通过日界线的转化可以被包含, 它将被认为是包含在该范围内的。
- * @returns {boolean} 传入坐标是否包含在范围内。
- */
- containsLonLat(ll, options) {
- if (typeof options === "boolean") {
- options = {inclusive: options};
- }
- options = options || {};
- var contains = this.contains(ll.lon, ll.lat, options.inclusive),
- worldBounds = options.worldBounds;
- //日界线以外的也有可能算包含,
- if (worldBounds && !contains) {
- var worldWidth = worldBounds.getWidth();
- var worldCenterX = (worldBounds.left + worldBounds.right) / 2;
- //这一步很关键
- var worldsAway = Math.round((ll.lon - worldCenterX) / worldWidth);
- contains = this.containsLonLat({
- lon: ll.lon - worldsAway * worldWidth,
- lat: ll.lat
- }, {inclusive: options.inclusive});
- }
- return contains;
- }
- /**
- * @function Bounds.prototype.containsPixel
- * @description 判断传入的像素是否在范围内。直接匹配大小,不涉及像素和地理转换。
- * @example
- * var bounds = new Bounds(-50,-50,40,40);
- * //isContains = true
- * var isContains = bounds.containsPixel(new Pixel(40,40),true);
- * @param {Pixel} px - 提供的像素参数。
- * @param {boolean} [inclusive=true] - 是否包含边界。
- * @returns {boolean} 传入的 pixel 在当前边界范围之内。
- */
- containsPixel(px, inclusive) {
- return this.contains(px.x, px.y, inclusive);
- }
- /**
- * @function Bounds.prototype.contains
- * @description 判断传入的 x,y 坐标值是否在范围内。
- * @example
- * var bounds = new Bounds(-50,-50,40,40);
- * //isContains = true
- * var isContains = bounds.contains(40,40,true);
- * @param {number} x - x 坐标值。
- * @param {number} y - y 坐标值。
- * @param {boolean} [inclusive=true] - 是否包含边界。
- * @returns {boolean} 传入的 x,y 坐标是否在当前范围内。
- */
- contains(x, y, inclusive) {
- //set default
- if (inclusive == null) {
- inclusive = true;
- }
- if (x == null || y == null) {
- return false;
- }
- //x = Util.toFloat(x);
- //y = Util.toFloat(y);
- var contains = false;
- if (inclusive) {
- contains = ((x >= this.left) && (x <= this.right) &&
- (y >= this.bottom) && (y <= this.top));
- } else {
- contains = ((x > this.left) && (x < this.right) &&
- (y > this.bottom) && (y < this.top));
- }
- return contains;
- }
- /**
- * @function Bounds.prototype.intersectsBounds
- * @description 判断目标边界范围是否与当前边界范围相交。如果两个边界范围中的任意
- * 边缘相交或者一个边界包含了另外一个就认为这两个边界相交。
- * @example
- * var bounds = new Bounds(-180,-90,100,80);
- * var isIntersects = bounds.intersectsBounds(
- * new Bounds(-170,-90,120,80)
- * );
- * @param {Bounds} bounds - 目标边界。
- * @param {Object} options - 参数。
- * @param {boolean} [options.inclusive=true] - 边缘重合也看成相交。如果是false,
- * 两个边界范围没有重叠部分仅仅是在边缘相接(重合),
- * 这种情况被认为没有相交。
- * @param {Bounds} [options.worldBounds] - 提供了 worldBounds 参数, 如果他们相交时
- * 是在全球范围内, 两个边界将被视为相交。这仅适用于交叉或完全不在世界范围的边界。
- * @returns {boolean} 传入的 bounds 对象与当前 bounds 相交。
- */
- intersectsBounds(bounds, options) {
- if (typeof options === "boolean") {
- options = {inclusive: options};
- }
- options = options || {};
- if (options.worldBounds) {
- var self = this.wrapDateLine(options.worldBounds);
- bounds = bounds.wrapDateLine(options.worldBounds);
- } else {
- self = this;
- }
- if (options.inclusive == null) {
- options.inclusive = true;
- }
- var intersects = false;
- var mightTouch = (
- self.left === bounds.right ||
- self.right === bounds.left ||
- self.top === bounds.bottom ||
- self.bottom === bounds.top
- );
- // if the two bounds only touch at an edge, and inclusive is false,
- // then the bounds don't *really* intersect.
- if (options.inclusive || !mightTouch) {
- // otherwise, if one of the boundaries even partially contains another,
- // inclusive of the edges, then they do intersect.
- var inBottom = (
- ((bounds.bottom >= self.bottom) && (bounds.bottom <= self.top)) ||
- ((self.bottom >= bounds.bottom) && (self.bottom <= bounds.top))
- );
- var inTop = (
- ((bounds.top >= self.bottom) && (bounds.top <= self.top)) ||
- ((self.top > bounds.bottom) && (self.top < bounds.top))
- );
- var inLeft = (
- ((bounds.left >= self.left) && (bounds.left <= self.right)) ||
- ((self.left >= bounds.left) && (self.left <= bounds.right))
- );
- var inRight = (
- ((bounds.right >= self.left) && (bounds.right <= self.right)) ||
- ((self.right >= bounds.left) && (self.right <= bounds.right))
- );
- intersects = ((inBottom || inTop) && (inLeft || inRight));
- }
- // document me
- if (options.worldBounds && !intersects) {
- var world = options.worldBounds;
- var width = world.getWidth();
- var selfCrosses = !world.containsBounds(self);
- var boundsCrosses = !world.containsBounds(bounds);
- if (selfCrosses && !boundsCrosses) {
- bounds = bounds.add(-width, 0);
- intersects = self.intersectsBounds(bounds, {inclusive: options.inclusive});
- } else if (boundsCrosses && !selfCrosses) {
- self = self.add(-width, 0);
- intersects = bounds.intersectsBounds(self, {inclusive: options.inclusive});
- }
- }
- return intersects;
- }
- /**
- * @function Bounds.prototype.containsBounds
- * @description 判断目标边界是否被当前边界包含在内。
- * @example
- * var bounds = new Bounds(-180,-90,100,80);
- * var isContains = bounds.containsBounds(
- * new Bounds(-170,-90,100,80),true,true
- * );
- * @param {Bounds} bounds - 目标边界。
- * @param {boolean} [partial=false] - 目标边界的任意部分都包含在当前边界中则被认为是包含关系。
- * 如果设为 false,整个目标边界全部被包含在当前边界范围内。
- * @param {boolean} [inclusive=true] - 边缘共享是否被视为包含。
- * @returns {boolean} 传入的边界是否被当前边界包含。
- */
- containsBounds(bounds, partial, inclusive) {
- if (partial == null) {
- partial = false;
- }
- if (inclusive == null) {
- inclusive = true;
- }
- var bottomLeft = this.contains(bounds.left, bounds.bottom, inclusive);
- var bottomRight = this.contains(bounds.right, bounds.bottom, inclusive);
- var topLeft = this.contains(bounds.left, bounds.top, inclusive);
- var topRight = this.contains(bounds.right, bounds.top, inclusive);
- return (partial) ? (bottomLeft || bottomRight || topLeft || topRight)
- : (bottomLeft && bottomRight && topLeft && topRight);
- }
- /**
- * @function Bounds.prototype.determineQuadrant
- * @description 判断传入坐标是否在 bounds 范围内的象限。以 bounds 中心点为坐标原点。
- * @example
- * var bounds = new Bounds(-180,-90,100,80);
- * //str = "tr";
- * var str = bounds.determineQuadrant(
- * new LonLat(20,20)
- * );
- * @param {LonLat} lonlat - 传入的坐标对象。
- * @returns {string} 传入坐标所在的象限("br" "tr" "tl" "bl" 分别对应"右下","右上","左上" "左下")。
- */
- determineQuadrant(lonlat) {
- var quadrant = "";
- var center = this.getCenterLonLat();
- quadrant += (lonlat.lat < center.lat) ? "b" : "t";
- quadrant += (lonlat.lon < center.lon) ? "l" : "r";
- return quadrant;
- }
- /**
- * @function Bounds.prototype.wrapDateLine
- * @description 将当前 bounds 移动到最大边界范围内部(所谓的内部是相交或者内部)。
- * @example
- * var bounds = new Bounds(380,-40,400,-20);
- * var maxExtent = new Bounds(-180,-90,100,80);
- * //新的bounds
- * var newBounds = bounds.wrapDateLine(maxExtent);
- * @param {Bounds} maxExtent - 最大的边界范围(一般是全球范围)。
- * @param {Object} options - 可选选项参数。
- * @param {number} [options.leftTolerance=0] - left 允许的误差。
- * @param {number} [options.rightTolerance=0] - right 允许的误差。
- * @returns {Bounds} 克隆当前边界。如果当前边界完全在最大范围之外此函数则返回一个不同值的边界,
- * 若落在最大边界的左边,则给当前的bounds值加上最大范围的宽度,即向右移动,
- * 若落在右边,则向左移动,即给当前的bounds值加上负的最大范围的宽度。
- */
- wrapDateLine(maxExtent, options) {
- options = options || {};
- var leftTolerance = options.leftTolerance || 0;
- var rightTolerance = options.rightTolerance || 0;
- var newBounds = this.clone();
- if (maxExtent) {
- var width = maxExtent.getWidth();
- //如果 newBounds 在 maxExtent 的左边,那么一直向右移动,直到相交或者包含为止,每次移动width
- //shift right?
- while (newBounds.left < maxExtent.left &&
- newBounds.right - rightTolerance <= maxExtent.left) {
- newBounds = newBounds.add(width, 0);
- }
- //如果 newBounds 在 maxExtent 的右边,那么一直向左移动,直到相交或者包含为止,每次移动width
- //shift left?
- while (newBounds.left + leftTolerance >= maxExtent.right &&
- newBounds.right > maxExtent.right) {
- newBounds = newBounds.add(-width, 0);
- }
- //如果和右边相交,左边又在内部,那么再次向左边移动一次
- // crosses right only? force left
- var newLeft = newBounds.left + leftTolerance;
- if (newLeft < maxExtent.right && newLeft > maxExtent.left &&
- newBounds.right - rightTolerance > maxExtent.right) {
- newBounds = newBounds.add(-width, 0);
- }
- }
- return newBounds;
- }
- /**
- * @function Bounds.prototype.toServerJSONObject
- * @description 转换成对应的 JSON 格式对象。
- * @example
- * var bounds = new Bounds(-180,-90,100,80);
- * var obj = bounds.toServerJSONObject();
- * @returns {Object} JSON 格式的 Object 对象。
- */
- toServerJSONObject() {
- var jsonObject = {
- rightTop: {x: this.right, y: this.top},
- leftBottom: {x: this.left, y: this.bottom},
- left: this.left,
- right: this.right,
- top: this.top,
- bottom: this.bottom
- }
- return jsonObject;
- }
- /**
- *
- * @function Bounds.prototype.destroy
- * @description 销毁此对象。
- * 销毁后此对象的所有属性为 null,而不是初始值。
- * @example
- * var bounds = new Bounds(-180,-90,100,80);
- * bounds.destroy();
- */
- destroy() {
- this.left = null;
- this.right = null;
- this.top = null;
- this.bottom = null;
- this.centerLonLat = null;
- }
- /**
- * @function Bounds.fromString
- * @description 通过字符串参数创建新的 bounds 的构造函数。
- * @example
- * var bounds = Bounds.fromString("-180,-90,100,80");
- * @param {string} str - 边界字符串,用逗号隔开(e.g. <i>"5,42,10,45"</i>)。
- * @param {boolean} [reverseAxisOrder=false] - 是否反转轴顺序。
- * 如果设为true,则倒转顺序(bottom,left,top,right),否则按正常轴顺序(left,bottom,right,top)。
- * @returns {Bounds} 给定的字符串创建的新的边界对象。
- */
- static fromString(str, reverseAxisOrder) {
- var bounds = str.split(",");
- return Bounds.fromArray(bounds, reverseAxisOrder);
- }
- /**
- * @function Bounds.fromArray
- * @description 通过边界框数组创建 Bounds。
- * @example
- * var bounds = Bounds.fromArray([-180,-90,100,80]);
- * @param {Array.<number>} bbox - 边界值数组。(e.g. <i>[5,42,10,45]</i>)。
- * @param {boolean} [reverseAxisOrder=false] - 是否是反转轴顺序。如果设为true,则倒转顺序(bottom,left,top,right),否则按正常轴顺序(left,bottom,right,top)。
- * @returns {Bounds} 根据传入的数组创建的新的边界对象。
- */
- static fromArray(bbox, reverseAxisOrder) {
- return reverseAxisOrder === true ?
- new Bounds(bbox[1], bbox[0], bbox[3], bbox[2]) :
- new Bounds(bbox[0], bbox[1], bbox[2], bbox[3]);
- }
- /**
- * @function Bounds.fromSize
- * @description 通过传入的边界大小来创建新的边界。
- * @example
- * var bounds = Bounds.fromSize(new Size(20,10));
- * @param {Size} size - 边界大小。
- * @returns {Bounds} 根据传入的边界大小的创建新的边界。
- */
- static fromSize(size) {
- return new Bounds(0,
- size.h,
- size.w,
- 0);
- }
- /**
- * @function Bounds.oppositeQuadrant
- * @description 反转象限。"t"和"b" 交换,"r"和"l"交换, 如:"tl"变为"br"。
- * @param {string} quadrant - 代表象限的字符串,如:"tl"。
- * @returns {string} 反转后的象限。
- */
- static oppositeQuadrant(quadrant) {
- var opp = "";
- opp += (quadrant.charAt(0) === 't') ? 'b' : 't';
- opp += (quadrant.charAt(1) === 'l') ? 'r' : 'l';
- return opp;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/Collection.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GeometryCollection
- * @aliasclass Geometry.Collection
- * @deprecatedclass SuperMap.Geometry.Collection
- * @classdesc 几何对象集合类,存储在本地的 components 属性中(可作为参数传递给构造函数)。<br>
- * 随着新的几何图形添加到集合中,将不能被克隆,当移动几何图形时,需要指定参照物。<br>
- * getArea 和 getLength 函数只能通过遍历存储几何对象的 components 数组,总计所有几何图形的面积和长度。
- * @category BaseTypes Geometry
- * @extends {Geometry}
- * @param {Array.<Geometry>} components - 几何对象数组。
- * @example
- * var point1 = new GeometryPoint(10,20);
- * var point2 = new GeometryPoint(30,40);
- * var col = new GeometryCollection([point1,point2]);
- * @usage
- */
- class Collection extends Geometry {
- constructor(components) {
- super();
- /**
- * @description 存储几何对象的数组。
- * @member {Array.<Geometry>} GeometryCollection.prototype.components
- */
- this.components = [];
- /**
- * @member {Array.<string>} GeometryCollection.prototype.componentTypes
- * @description components 存储的的几何对象所支持的几何类型数组,为空表示类型不受限制。
- */
- this.componentTypes = null;
- if (components != null) {
- this.addComponents(components);
- }
- this.CLASS_NAME = "SuperMap.Geometry.Collection";
- this.geometryType = "Collection";
- }
- /**
- * @function GeometryCollection.prototype.destroy
- * @description 销毁几何图形。
- */
- destroy() {
- this.components.length = 0;
- this.components = null;
- super.destroy();
- }
- /**
- * @function GeometryCollection.prototype.clone
- * @description 克隆当前几何对象。
- * @returns {GeometryCollection} 克隆的几何对象集合。
- */
- clone() {
- var geometry = new Collection();
- for (var i = 0, len = this.components.length; i < len; i++) {
- geometry.addComponent(this.components[i].clone());
- }
- // catch any randomly tagged-on properties
- Util.applyDefaults(geometry, this);
- return geometry;
- }
- /**
- * @function GeometryCollection.prototype.getComponentsString
- * @description 获取 components 字符串。
- * @returns {string} components 字符串。
- */
- getComponentsString() {
- var strings = [];
- for (var i = 0, len = this.components.length; i < len; i++) {
- strings.push(this.components[i].toShortString());
- }
- return strings.join(",");
- }
- /**
- * @function GeometryCollection.prototype.calculateBounds
- * @description 通过遍历数组重新计算边界,在遍历每一子项中时调用 extend 方法。
- */
- calculateBounds() {
- this.bounds = null;
- var bounds = new Bounds();
- var components = this.components;
- if (components) {
- for (var i = 0, len = components.length; i < len; i++) {
- bounds.extend(components[i].getBounds());
- }
- }
- // to preserve old behavior, we only set bounds if non-null
- // in the future, we could add bounds.isEmpty()
- if (bounds.left != null && bounds.bottom != null &&
- bounds.right != null && bounds.top != null) {
- this.setBounds(bounds);
- }
- }
- /**
- * @function GeometryCollection.prototype.addComponents
- * @description 给几何图形对象添加元素。
- * @param {Array.<Geometry>} components - 几何对象组件。
- * @example
- * var geometryCollection = new GeometryCollection();
- * geometryCollection.addComponents(new SuerpMap.Geometry.Point(10,10));
- */
- addComponents(components) {
- if (!(Util.isArray(components))) {
- components = [components];
- }
- for (var i = 0, len = components.length; i < len; i++) {
- this.addComponent(components[i]);
- }
- }
- /**
- * @function GeometryCollection.prototype.addComponent
- * @description 添加几何对象到集合中。如果设置了 componentTypes 类型,则添加的几何对象必须是 componentTypes 中的类型。
- * @param {Geometry} component - 待添加的几何对象。
- * @param {number} [index] - 几何对象插入的位置。
- * @returns {boolean} 是否添加成功。
- */
- addComponent(component, index) {
- var added = false;
- if (component) {
- if (this.componentTypes == null ||
- (Util.indexOf(this.componentTypes,
- component.CLASS_NAME) > -1)) {
- if (index != null && (index < this.components.length)) {
- var components1 = this.components.slice(0, index);
- var components2 = this.components.slice(index,
- this.components.length);
- components1.push(component);
- this.components = components1.concat(components2);
- } else {
- this.components.push(component);
- }
- component.parent = this;
- this.clearBounds();
- added = true;
- }
- }
- return added;
- }
- /**
- * @function GeometryCollection.prototype.removeComponents
- * @description 清除几何对象。
- * @param {Array.<Geometry>} components - 需要清除的几何对象。
- * @returns {boolean} 元素是否被删除。
- */
- removeComponents(components) {
- var removed = false;
- if (!(Util.isArray(components))) {
- components = [components];
- }
- for (var i = components.length - 1; i >= 0; --i) {
- removed = this.removeComponent(components[i]) || removed;
- }
- return removed;
- }
- /**
- * @function GeometryCollection.prototype.removeComponent
- * @description 从集合中移除几何对象。
- * @param {Geometry} component - 要移除的几何对象。
- * @returns {boolean} 几何对象是否移除成功。
- */
- removeComponent(component) {
- Util.removeItem(this.components, component);
- // clearBounds() so that it gets recalculated on the next call
- // to this.getBounds();
- this.clearBounds();
- return true;
- }
- /**
- * @function GeometryCollection.prototype.getArea
- * @description 计算几何对象的面积。注意,这个方法在 {@link GeometryPolygon} 类中需要重写。
- * @returns {number} 几何图形的面积,是几何对象中所有组成部分的面积之和。
- */
- getArea() {
- var area = 0.0;
- for (var i = 0, len = this.components.length; i < len; i++) {
- area += this.components[i].getArea();
- }
- return area;
- }
- /**
- * @function GeometryCollection.prototype.equals
- * @description 判断两个几何图形是否相等。如果所有的 components 具有相同的坐标,则认为是相等的。
- * @param {Geometry} geometry - 需要判断的几何图形。
- * @returns {boolean} 输入的几何图形与当前几何图形是否相等。
- */
- equals(geometry) {
- var equivalent = true;
- if (!geometry || !geometry.CLASS_NAME ||
- (this.CLASS_NAME !== geometry.CLASS_NAME)) {
- equivalent = false;
- } else if (!(Util.isArray(geometry.components)) ||
- (geometry.components.length !== this.components.length)) {
- equivalent = false;
- } else {
- for (var i = 0, len = this.components.length; i < len; ++i) {
- if (!this.components[i].equals(geometry.components[i])) {
- equivalent = false;
- break;
- }
- }
- }
- return equivalent;
- }
- /**
- * @function GeometryCollection.prototype.getVertices
- * @description 返回几何对象的所有结点的列表。
- * @param {boolean} [nodes] - 对于线来说,仅仅返回作为端点的顶点,如果设为 false,则返回非端点的顶点如果没有设置此参数,则返回所有顶点。
- * @returns {Array} 几何对象的顶点列表。
- */
- getVertices(nodes) {
- var vertices = [];
- for (var i = 0, len = this.components.length; i < len; ++i) {
- Array.prototype.push.apply(
- vertices, this.components[i].getVertices(nodes)
- );
- }
- return vertices;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/MultiPoint.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GeometryMultiPoint
- * @aliasclass Geometry.MultiPoint
- * @deprecatedclass SuperMap.Geometry.MultiPoint
- * @classdesc 几何对象多点类。
- * @category BaseTypes Geometry
- * @extends GeometryCollection
- * @param {Array.<GeometryPoint>} components - 点对象数组。
- * @example
- * var point1 = new GeometryPoint(5,6);
- * var poine2 = new GeometryMultiPoint(7,8);
- * var multiPoint = new MultiPoint([point1,point2]);
- * @usage
- */
- class MultiPoint extends Collection {
- constructor(components) {
- super(components);
- /**
- * @member {Array.<string>} [GeometryMultiPoint.prototype.componentTypes=["SuperMap.Geometry.Point"]]
- * @description components 存储的的几何对象所支持的几何类型数组。
- * @readonly
- */
- this.componentTypes = ["SuperMap.Geometry.Point"];
- this.CLASS_NAME = "SuperMap.Geometry.MultiPoint";
- this.geometryType = "MultiPoint";
- }
- /**
- * @function GeometryMultiPoint.prototype.addPoint
- * @description 添加点,封装了 {@link GeometryCollection|GeometryCollection.addComponent} 方法。
- * @param {GeometryPoint} point - 添加的点。
- * @param {number} [index] - 下标。
- */
- addPoint(point, index) {
- this.addComponent(point, index);
- }
- /**
- * @function GeometryMultiPoint.prototype.removePoint
- * @description 移除点,封装了 {@link GeometryCollection|GeometryCollection.removeComponent} 方法。
- * @param {GeometryPoint} point - 移除的点对象。
- */
- removePoint(point) {
- this.removeComponent(point);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/Curve.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GeometryCurve
- * @aliasclass Geometry.Curve
- * @deprecatedclass SuperMap.Geometry.Curve
- * @classdesc 几何对象曲线类。
- * @category BaseTypes Geometry
- * @extends GeometryMultiPoint
- * @param {Array.<GeometryPoint>} components - 几何对象数组。
- * @example
- * var point1 = new GeometryPoint(10,20);
- * var point2 = new GeometryPoint(30,40);
- * var curve = new Curve([point1,point2]);
- * @usage
- */
- class Curve extends MultiPoint {
- constructor(components) {
- super(components);
- /**
- * @member {Array.<string>} [GeometryCurve.prototype.componentTypes=["SuperMap.Geometry.Point", "SuperMap.PointWithMeasure"]]
- * @description components 存储的的几何对象所支持的几何类型数组。
- * @readonly
- */
- this.componentTypes = ["SuperMap.Geometry.Point", "SuperMap.PointWithMeasure"];
- this.CLASS_NAME = "SuperMap.Geometry.Curve";
- this.geometryType = "Curve";
- }
- }
- ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/Point.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GeometryPoint
- * @aliasclass Geometry.Point
- * @deprecatedclass SuperMap.Geometry.Point
- * @classdesc 点几何对象类。
- * @category BaseTypes Geometry
- * @extends {Geometry}
- * @param {number} x - x 坐标。
- * @param {number} y - y 坐标。
- * @param {string} [type = 'Point'] - 点的类型。
- * @param {number} [tag] - 额外的属性,比如差值分析中的 Z 值。
- * @example
- * var point = new GeometryPoint(-111.04, 45.68);
- * @usage
- */
- class Point extends Geometry {
- constructor(x, y, type, tag) {
- super(x, y, type, tag);
- /**
- * @member {number} GeometryPoint.prototype.x
- * @description 横坐标。
- */
- this.x = parseFloat(x);
- /**
- * @member {number} GeometryPoint.prototype.y
- * @description 纵坐标。
- */
- this.y = parseFloat(y);
- /**
- * @member {string} GeometryPoint.prototype.tag
- * @description 用来存储额外的属性,比如差值分析中的 Z 值。
- */
- this.tag = (tag || tag == 0) ? parseFloat(tag) : null;
- /**
- * @member {string} GeometryPoint.prototype.type
- * @description 用来存储点的类型
- */
- this.type = type || "Point";
- this.CLASS_NAME = "SuperMap.Geometry.Point";
- this.geometryType = "Point";
- }
- /**
- * @function GeometryPoint.prototype.clone
- * @description 克隆点对象。
- * @returns {GeometryPoint} 克隆后的点对象。
- */
- clone(obj) {
- if (obj == null) {
- obj = new Point(this.x, this.y);
- }
- // catch any randomly tagged-on properties
- Util.applyDefaults(obj, this);
- return obj;
- }
- /**
- * @function GeometryPoint.prototype.calculateBounds
- * @description 计算点对象的范围。
- */
- calculateBounds() {
- this.bounds = new Bounds(this.x, this.y,
- this.x, this.y);
- }
- /**
- * @function GeometryPoint.prototype.equals
- * @description 判断两个点对象是否相等。如果两个点对象具有相同的坐标,则认为是相等的。
- * @example
- * var point= new GeometryPoint(0,0);
- * var point1={x:0,y:0};
- * var result= point.equals(point1);
- * @param {GeometryPoint} geom - 需要判断的点对象。
- * @returns {boolean} 两个点对象是否相等(true 为相等,false 为不等)。
- */
- equals(geom) {
- var equals = false;
- if (geom != null) {
- equals = ((this.x === geom.x && this.y === geom.y) ||
- (isNaN(this.x) && isNaN(this.y) && isNaN(geom.x) && isNaN(geom.y)));
- }
- return equals;
- }
- /**
- * @function GeometryPoint.prototype.move
- * @description 沿着 x、y 轴的正方向上按照给定的位移移动点对象,move 不仅改变了几何对象的位置并且清理了边界缓存。
- * @param {number} x - x 轴正方向上的偏移量。
- * @param {number} y - y 轴正方向上偏移量。
- */
- move(x, y) {
- this.x = this.x + x;
- this.y = this.y + y;
- this.clearBounds();
- }
- /**
- * @function GeometryPoint.prototype.toShortString
- * @description 将 x/y 坐标转换成简单字符串。
- * @returns {string} 字符串代表点对象。(ex. <i>"5, 42"</i>)
- */
- toShortString() {
- return (this.x + ", " + this.y);
- }
- /**
- * @function GeometryPoint.prototype.destroy
- * @description 释放点对象的资源。
- */
- destroy() {
- this.x = null;
- this.y = null;
- this.tag = null;
- super.destroy();
- }
- /**
- * @function GeometryPoint.prototype.getVertices
- * @description 获取几何图形所有顶点的列表。
- * @returns {Array} 几何图形的顶点列表。
- */
- getVertices() {
- return [this];
- }
- }
- ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/LineString.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GeometryLineString
- * @aliasclass Geometry.LineString
- * @deprecatedclass SuperMap.Geometry.LineString
- * @classdesc 几何对象线串类。
- * @category BaseTypes Geometry
- * @param {Array.<GeometryPoint>} points - 用来生成线串的点数组。
- * @extends GeometryCurve
- * @example
- * var points = [new GeometryPoint(4933.319287022352, -3337.3849141502124),
- * new GeometryPoint(4960.9674060199022, -3349.3316322355736),
- * new GeometryPoint(5006.0235999418364, -3358.8890067038628),
- * new GeometryPoint(5075.3145648369318, -3378.0037556404409),
- * new GeometryPoint(5305.19551436013, -3376.9669111768926)],
- * var roadLine = new GeometryLineString(points);
- * @usage
- */
- class LineString extends Curve {
- constructor(points) {
- super(points);
- this.CLASS_NAME = "SuperMap.Geometry.LineString";
- this.geometryType = "LineString";
- }
- /**
- * @function GeometryLineString.prototype.removeComponent
- * @description 只有在线串上有三个或更多的点的时候,才会允许移除点(否则结果将会是单一的点)。
- * @param {GeometryPoint} point - 将被删除的点。
- * @returns {boolean} 删除的点。
- */
- removeComponent(point) { // eslint-disable-line no-unused-vars
- var removed = this.components && (this.components.length > 2);
- if (removed) {
- super.removeComponent.apply(this, arguments);
- }
- return removed;
- }
- /**
- * @function GeometryLineString.prototype.getSortedSegments
- * @description 获取升序排列的点坐标对象数组。
- * @returns {Array} 升序排列的点坐标对象数组。
- */
- getSortedSegments() {
- var numSeg = this.components.length - 1;
- var segments = new Array(numSeg), point1, point2;
- for (var i = 0; i < numSeg; ++i) {
- point1 = this.components[i];
- point2 = this.components[i + 1];
- if (point1.x < point2.x) {
- segments[i] = {
- x1: point1.x,
- y1: point1.y,
- x2: point2.x,
- y2: point2.y
- };
- } else {
- segments[i] = {
- x1: point2.x,
- y1: point2.y,
- x2: point1.x,
- y2: point1.y
- };
- }
- }
- // more efficient to define this somewhere static
- function byX1(seg1, seg2) {
- return seg1.x1 - seg2.x1;
- }
- return segments.sort(byX1);
- }
- /**
- * @function GeometryLineString.prototype.getVertices
- * @description 返回几何图形的所有顶点的列表。
- * @param {boolean} [nodes] - 对于线来说,仅仅返回作为端点的顶点,如果设为 false,则返回非端点的顶点。如果没有设置此参数,则返回所有顶点。
- * @returns {Array} 几何图形的顶点列表。
- */
- getVertices(nodes) {
- var vertices;
- if (nodes === true) {
- vertices = [
- this.components[0],
- this.components[this.components.length - 1]
- ];
- } else if (nodes === false) {
- vertices = this.components.slice(1, this.components.length - 1);
- } else {
- vertices = this.components.slice();
- }
- return vertices;
- }
- /**
- * @function GeometryLineString.calculateCircle
- * @description 三点画圆弧。
- * @param {Array.<GeometryPoint>} points - 传入的待计算的初始点串。
- * @returns {Array.<GeometryPoint>} 计算出相应的圆弧控制点。
- * @example
- * var points = [];
- * points.push(new GeometryPoint(-50,30));
- * points.push(new GeometryPoint(-30,50));
- * points.push(new GeometryPoint(2,60));
- * var circle = GeometryLineString.calculateCircle(points);
- */
- static calculateCircle(points) {
- if (points.length < 3) {
- return points
- }
- var centerPoint = {},
- p1 = points[0],
- p2 = points[1],
- p3 = points[2];
- var R = 0,
- dStep = 0,
- direc = true,
- dRotation = 0,
- dRotationBegin = 0,
- dRotationAngle = 0,
- nSegmentCount = 72,
- circlePoints = [];
- var KTan13 = (p3.y - p1.y) / (p3.x - p1.x);
- var B13 = p3.y - KTan13 * p3.x;
- if ((((p3.x != p1.x) && (p3.y != p1.y)) && (p2.y == KTan13 * p2.x + B13)) ||
- ((p3.x == p1.x) && (p2.x == p1.x)) || ((p3.y == p1.y) && (p2.y == p1.y)) ||
- ((p3.x == p1.x) && (p3.y == p1.y)) || ((p3.x == p2.x) && (p3.y == p2.y)) || ((p1.x == p2.x) && (p1.y == p2.y))) {
- circlePoints.push(p1);
- circlePoints.push(p2);
- circlePoints.push(p3);
- } else {
- 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) -
- (p1.x * p1.x + p1.y * p1.y)) * (2 * (p2.y - p1.y));
- var E = (2 * (p2.x - p1.x)) * ((p3.x * p3.x + p3.y * p3.y) - (p1.x * p1.x + p1.y * p1.y)) -
- (2 * (p3.x - p1.x)) * ((p2.x * p2.x + p2.y * p2.y) - (p1.x * p1.x + p1.y * p1.y));
- var F = 4 * ((p2.x - p1.x) * (p3.y - p1.y) - (p3.x - p1.x) * (p2.y - p1.y));
- centerPoint.x = D / F;
- centerPoint.y = E / F;
- R = Math.sqrt((p1.x - centerPoint.x) * (p1.x - centerPoint.x) + (p1.y - centerPoint.y) * (p1.y - centerPoint.y));
- var dis = (p1.x - p3.x) * (p1.x - p3.x) + (p1.y - p3.y) * (p1.y - p3.y);
- var cons = (2 * R * R - dis) / (2 * R * R);
- cons = cons >= 1 ? 1 : cons;
- cons = cons <= -1 ? -1 : cons;
- dRotationAngle = Math.acos(cons) * 180 / Math.PI;
- if (p3.x == p1.x) {
- dRotationAngle = ((centerPoint.x > p1.x && p2.x > p1.x) || (centerPoint.x < p1.x && p2.x < p1.x)) ? (360 - dRotationAngle) : dRotationAngle;
- } else {
- dRotationAngle = ((centerPoint.y > (KTan13 * centerPoint.x + B13) && p2.y > (KTan13 * p2.x + B13)) ||
- (centerPoint.y < (KTan13 * centerPoint.x + B13) && p2.y < (KTan13 * p2.x + B13))) ? (360 - dRotationAngle) : dRotationAngle;
- }
- dStep = dRotationAngle / 72;
- if (p3.y != p1.y) {
- if (p3.x == p1.x) {
- if (p3.y > p1.y) {
- if (p2.x < p1.x) {
- direc = false;
- }
- } else {
- if (p2.x > p1.x) {
- direc = false;
- }
- }
- } else if (p3.x < p1.x) {
- if (p2.y < KTan13 * p2.x + B13) {
- direc = false;
- }
- } else {
- if (p2.y > KTan13 * p2.x + B13) {
- direc = false;
- }
- }
- } else {
- if (p3.x > p1.x) {
- if (p2.y > p1.y) {
- direc = false;
- }
- } else {
- if (p2.y < p1.y) {
- direc = false;
- }
- }
- }
- var K10 = (p1.y - centerPoint.y) / (p1.x - centerPoint.x);
- var atan10 = K10 >= 0 ? Math.atan(K10) * 180 / Math.PI : Math.abs(Math.atan(K10) * 180 / Math.PI) + 90;
- var CY = Math.abs(centerPoint.y);
- if ((p1.y == CY) && (CY == p3.y)) {
- if (p1.x < p3.x) {
- atan10 = atan10 + 180;
- }
- }
- var newPY = p1.y - centerPoint.y;
- circlePoints.push(p1);
- for (var i = 1; i < nSegmentCount; i++) {
- dRotation = dStep * i;
- dRotationBegin = atan10;
- if (direc) {
- if (newPY >= 0) {
- if (K10 >= 0) {
- dRotationBegin = dRotationBegin + dRotation;
- } else {
- dRotationBegin = (180 - (dRotationBegin - 90)) + dRotation;
- }
- } else {
- if (K10 > 0) {
- dRotationBegin = (dRotationBegin - 180) + dRotation;
- } else {
- dRotationBegin = (90 - dRotationBegin) + dRotation;
- }
- }
- } else {
- if (newPY >= 0) {
- if (K10 >= 0) {
- dRotationBegin = dRotationBegin - dRotation;
- } else {
- dRotationBegin = (180 - (dRotationBegin - 90)) - dRotation;
- }
- } else {
- if (K10 >= 0) {
- dRotationBegin = (dRotationBegin - 180) - dRotation;
- } else {
- dRotationBegin = (90 - dRotationBegin) - dRotation;
- }
- }
- }
- dRotationBegin = dRotationBegin * Math.PI / 180;
- var x = centerPoint.x + R * Math.cos(dRotationBegin);
- var y = centerPoint.y + R * Math.sin(dRotationBegin);
- circlePoints.push(new Point(x, y));
- }
- circlePoints.push(p3);
- }
- return circlePoints;
- }
- /**
- * @function GeometryLineString.createLineEPS
- * @description 根据点的类型画出不同类型的曲线。
- * 点的类型有三种:LTypeArc,LTypeCurve,NONE。
- * @param {Array.<GeometryPoint>} points - 传入的待计算的初始点串。
- * @returns {Array.<GeometryPoint>} 计算出相应的 lineEPS 控制点。
- * @example
- * var points = [];
- * points.push(new GeometryPoint(-50,30));
- * points.push(new GeometryPoint(-30,50,"LTypeArc"));
- * points.push(new GeometryPoint(2,60));
- * points.push(new GeometryPoint(8,20));
- * var lineEPS = GeometryLineString.createLineEPS(points);
- */
- static createLineEPS(points) {
- var list = [],
- len = points.length;
- if (len < 2) {
- return points;
- }
- for (var i = 0; i < len;) {
- var type = points[i].type;
- if (type == 'LTypeArc') {
- var listObj = LineString.createLineArc(list, i, len, points);
- list = listObj[0];
- i = listObj[1];
- } else {
- list.push(points[i]);
- i++;
- }
- }
- return list;
- }
- static createLineArc(list, i, len, points) {
- if (i == 0) {
- let bezierPtsObj = LineString.addPointEPS(points, i, len, 'LTypeArc');
- Array.prototype.push.apply(list, bezierPtsObj[0]);
- i = bezierPtsObj[1] + 1;
- } else if (i == len - 1) {
- var bezierP = [points[i - 1], points[i]],
- bezierPts = LineString.calculateCircle(bezierP);
- Array.prototype.push.apply(list, bezierPts);
- i++;
- } else {
- let bezierPtsObj = LineString.addPointEPS(points, i, len, 'LTypeArc');
- list.pop();
- Array.prototype.push.apply(list, bezierPtsObj[0]);
- i = bezierPtsObj[1] + 1;
- }
- return [list, i];
- }
- static addPointEPS(points, i, len, type) {
- var bezierP = [], j = i + 1;
- if (i == 0) {
- Array.prototype.push.apply(bezierP, [points[i], points[i + 1]]);
- } else if (i == len - 1) {
- Array.prototype.push.apply(bezierP, [points[i - 1], points[i]]);
- } else {
- Array.prototype.push.apply(bezierP, [points[i - 1], points[i], points[i + 1]]);
- }
- var bezierPts;
- if (type == 'LTypeCurve') {
- bezierPts = LineString.calculatePointsFBZN(bezierP);
- } else if (type == 'LTypeArc') {
- bezierPts = LineString.calculateCircle(bezierP);
- }
- return [bezierPts, j];
- }
- }
- ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/GeoText.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GeometryGeoText
- * @aliasclass Geometry.GeoText
- * @deprecatedclass SuperMap.Geometry.GeoText
- * @classdesc 文本标签类。
- * @category BaseTypes Geometry
- * @extends {Geometry}
- * @param {number} x - x 坐标。
- * @param {number} y - y 坐标。
- * @param {string} text - 标签中的文本内容。
- * @usage
- */
- class GeoText extends Geometry {
- constructor(x, y, text) {
- super(x, y, text);
- /**
- * @member {number} GeometryGeoText.prototype.x
- * @description 横坐标。
- */
- this.x = parseFloat(x);
- /**
- * @member {number} GeometryGeoText.prototype.y
- * @description 纵坐标。
- */
- this.y = parseFloat(y);
- /**
- * @member {string} GeometryGeoText.prototype.text
- * @description 标签中的文本内容。
- */
- this.text = text.toString();
- /**
- * @member {Object} GeometryGeoText.prototype.bsInfo
- * @description 标签范围的基础信息。
- * @property {number} w - bounds 的宽。
- * @property {number} h - bounds 的高度。
- */
- this.bsInfo = {
- "h": null,
- "w": null
- };
- this.element = document.createElement('span');
- this.CLASS_NAME = "SuperMap.Geometry.GeoText";
- this.geometryType = "GeoText";
- }
- /**
- * @function GeometryGeoText.prototype.destroy
- * @description 销毁文本标签类。
- */
- destroy() {
- super.destroy();
- this.x = null;
- this.y = null;
- this.text = null;
- }
- /**
- * @function GeometryGeoText.prototype.getCentroid
- * @description 获取标签对象的质心。
- * @returns {GeometryPoint} 标签对象的质心。
- */
- getCentroid() {
- return new Point(this.x, this.y);
- }
- /**
- * @function GeometryGeoText.prototype.clone
- * @description 克隆标签对象。
- * @returns {GeometryGeoText} 克隆后的标签对象。
- */
- clone(obj) {
- if (obj == null) {
- obj = new GeoText(this.x, this.y, this.text);
- }
- Util.applyDefaults(obj, this);
- return obj;
- }
- /**
- * @function GeometryGeoText.prototype.calculateBounds
- * @description 计算标签对象的范围。
- */
- calculateBounds() {
- this.bounds = new Bounds(this.x, this.y,
- this.x, this.y);
- }
- /**
- * @function GeometryGeoText.prototype.getLabelPxBoundsByLabel
- * @description 根据绘制好的标签获取文字标签的像素范围,参数的单位是像素;此方法相对于 getLabelPxBoundsByText 效率较低,但支持所有格式的文本。
- * @param {Object} locationPixel - 标签的位置点,该对象含有属性 x(横坐标),属性 y(纵坐标)。
- * @param {string} labelWidth - 标签的宽度,如:“90px”。
- * @param {string} labelHeight - 标签的高度。
- * @param {Object} style - 标签的 style。
- * @returns {Bounds} 标签的像素范围。
- */
- getLabelPxBoundsByLabel(locationPixel, labelWidth, labelHeight, style) {
- var labelPxBounds, left, bottom, top, right;
- var locationPx = Util.cloneObject(locationPixel);
- //计算文本行数
- var theText = style.label || this.text;
- var textRows = theText.split('\n');
- var laberRows = textRows.length;
- //处理文字对齐
- labelWidth = parseFloat(labelWidth);
- labelHeight = parseFloat(labelHeight);
- if (laberRows > 1) {
- labelHeight = parseFloat(labelHeight) * laberRows;
- }
- if (style.labelAlign && style.labelAlign !== "cm") {
- switch (style.labelAlign) {
- case "lt":
- locationPx.x += labelWidth / 2;
- locationPx.y += labelHeight / 2;
- break;
- case "lm":
- locationPx.x += labelWidth / 2;
- break;
- case "lb":
- locationPx.x += labelWidth / 2;
- locationPx.y -= labelHeight / 2;
- break;
- case "ct":
- locationPx.y += labelHeight / 2;
- break;
- case "cb":
- locationPx.y -= labelHeight / 2;
- break;
- case "rt":
- locationPx.x -= labelWidth / 2;
- locationPx.y += labelHeight / 2;
- break;
- case "rm":
- locationPx.x -= labelWidth / 2;
- break;
- case "rb":
- locationPx.x -= labelWidth / 2;
- locationPx.y -= labelHeight / 2;
- break;
- default:
- break;
- }
- }
- this.bsInfo.h = labelHeight;
- this.bsInfo.w = labelWidth;
- //bounds的四边
- left = locationPx.x - parseFloat(labelWidth) / 2;
- bottom = locationPx.y + parseFloat(labelHeight) / 2;
- right = locationPx.x + parseFloat(labelWidth) / 2;
- top = locationPx.y - parseFloat(labelHeight) / 2;
- labelPxBounds = new Bounds(left, bottom, right, top);
- return labelPxBounds;
- }
- /**
- * @function GeometryGeoText.prototype.getLabelPxBoundsByText
- * @description 根据文本内容获取文字标签的像素范围。
- * @param {Object} locationPixel - 标签的位置点,该对象含有属性 x(横坐标),属性 y(纵坐标)。
- * @param {Object} style - 标签的样式。
- * @returns {Bounds} 标签的像素范围。
- */
- getLabelPxBoundsByText(locationPixel, style) {
- var labelPxBounds, left, bottom, top, right;
- var labelSize = this.getLabelPxSize(style);
- var locationPx = Util.cloneObject(locationPixel);
- //处理文字对齐
- if (style.labelAlign && style.labelAlign !== "cm") {
- switch (style.labelAlign) {
- case "lt":
- locationPx.x += labelSize.w / 2;
- locationPx.y += labelSize.h / 2;
- break;
- case "lm":
- locationPx.x += labelSize.w / 2;
- break;
- case "lb":
- locationPx.x += labelSize.w / 2;
- locationPx.y -= labelSize.h / 2;
- break;
- case "ct":
- locationPx.y += labelSize.h / 2;
- break;
- case "cb":
- locationPx.y -= labelSize.h / 2;
- break;
- case "rt":
- locationPx.x -= labelSize.w / 2;
- locationPx.y += labelSize.h / 2;
- break;
- case "rm":
- locationPx.x -= labelSize.w / 2;
- break;
- case "rb":
- locationPx.x -= labelSize.w / 2;
- locationPx.y -= labelSize.h / 2;
- break;
- default:
- break;
- }
- }
- this.bsInfo.h = labelSize.h;
- this.bsInfo.w = labelSize.w;
- left = locationPx.x - labelSize.w / 2;
- bottom = locationPx.y + labelSize.h / 2;
- //处理斜体字
- if (style.fontStyle && style.fontStyle === "italic") {
- right = locationPx.x + labelSize.w / 2 + parseInt(parseFloat(style.fontSize) / 2);
- } else {
- right = locationPx.x + labelSize.w / 2;
- }
- top = locationPx.y - labelSize.h / 2;
- labelPxBounds = new Bounds(left, bottom, right, top);
- return labelPxBounds;
- }
- /**
- * @function GeometryGeoText.prototype.getLabelPxSize
- * @description 获取 label 的像素大小。
- * @param {Object} style - 标签样式。
- * @returns {Object} 标签大小对象,属性 w 表示标签的宽度,属性 h 表示标签的高度。
- */
- getLabelPxSize(style) {
- var text,//文本内容
- fontSize,//字体大小
- spacing = 1,//两个字符间的间距(单位:px)
- lineSpacing = 0.2,
- bgstrokeWidth = parseFloat(style.strokeWidth);//标签背景框边框的宽度
- text = style.label || this.text;
- if (style.fontSize) {
- fontSize = parseFloat(style.fontSize);
- } else {
- fontSize = parseFloat("12px");
- }
- //标签宽高
- var labelW, labelH;
- var textRows = text.split('\n');
- var numRows = textRows.length;
- if (numRows > 1) {
- labelH = fontSize * numRows + numRows + bgstrokeWidth + lineSpacing * fontSize;
- } else {
- labelH = fontSize + bgstrokeWidth + lineSpacing * fontSize + 1;
- }
- //取最大宽度
- labelW = 0;
- if (this.labelWTmp && labelW < this.labelWTmp) {
- labelW = this.labelWTmp;
- }
- for (var i = 0; i < numRows; i++) {
- var textCharC = this.getTextCount(textRows[i]);
- var labelWTmp = this.labelWTmp = Util.getTextBounds(style, textRows[i], this.element).textWidth + textCharC.textC * spacing + bgstrokeWidth;
- if (labelW < labelWTmp) {
- labelW = labelWTmp;
- }
- }
- var labelSize = new Object(); //标签大小
- labelSize.h = labelH;
- labelSize.w = labelW;
- return labelSize;
- }
- /**
- * @function GeometryGeoText.prototype.getTextCount
- * @description 获取 text 中的字符个数。
- * @param {string} text - 字符串。
- * @returns {Object} 字符个数统计结果,属性 cnC 表示中文字符个数,属性 enC 表示英文字符个数,属性 textC 表示字符总个数。
- */
- getTextCount(text) {
- var textCharCount = {};
- var cnCount = 0;
- var enCount = 0;
- for (var i = 0; i < text.length; i++) {
- if (text.charCodeAt(i) > 255) { //遍历判断字符串中每个字符的Unicode码,大于255则为中文
- cnCount++;
- } else {
- enCount++;
- }
- }
- //中午字符个数
- textCharCount.cnC = cnCount;
- //英文字符个数
- textCharCount.enC = enCount;
- //字符总个数
- textCharCount.textC = text.length;
- return textCharCount;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/LinearRing.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GeometryLinearRing
- * @aliasclass Geometry.LinearRing
- * @deprecatedclass SuperMap.Geometry.LinearRing
- * @classdesc 几何对象线环类,是一个特殊的封闭的线串,在每次 addPoint/removePoint 之后会通过添加一个点(此点是复制的第一个点得到的)
- * 作为最后的一个点来自动关闭线环。
- * @category BaseTypes Geometry
- * @extends GeometryLineString
- * @param {Array.<GeometryPoint>} points - 组成线性环的点。
- * @example
- * var points = [new GeometryPoint(4933.319287022352, -3337.3849141502124),
- * new GeometryPoint(4960.9674060199022, -3349.3316322355736),
- * new GeometryPoint(5006.0235999418364, -3358.8890067038628),
- * new GeometryPoint(5075.3145648369318, -3378.0037556404409),
- * new GeometryPoint(5305.19551436013, -3376.9669111768926)],
- * var linearRing = new GeometryLinearRing(points);
- * @usage
- */
- class LinearRing extends LineString {
- constructor(points) {
- super(points);
- /**
- * @member {Array.<string>} [GeometryLinearRing.prototype.componentTypes=["SuperMap.Geometry.Point"]]
- * @description components 存储的的几何对象所支持的几何类型数组,为空表示类型不受限制。
- * @readonly
- */
- this.componentTypes = ["SuperMap.Geometry.Point"];
- this.CLASS_NAME = "SuperMap.Geometry.LinearRing";
- this.geometryType = "LinearRing";
- }
- /**
- * @function GeometryLinearRing.prototype.addComponent
- * @description 添加一个点到几何图形数组中,如果这个点将要被添加到组件数组的末端,并且与数组中已经存在的最后一个点相同,
- * 重复的点是不能被添加的。这将影响未关闭环的关闭。
- * 这个方法可以通过将非空索引(组件数组的下标)作为第二个参数重写。
- * @param {GeometryPoint} point - 点对象。
- * @param {number} [index] - 插入组件数组的下标。
- * @returns {boolean} 点对象是否添加成功。
- */
- addComponent(point, index) {
- var added = false;
- //remove last point
- var lastPoint = this.components.pop();
- // given an index, add the point
- // without an index only add non-duplicate points
- if (index != null || !point.equals(lastPoint)) {
- added = super.addComponent.apply(this, arguments);
- }
- //append copy of first point
- var firstPoint = this.components[0];
- super.addComponent.apply(this, [firstPoint]);
- return added;
- }
- /**
- * @function GeometryLinearRing.prototype.removeComponent
- * @description 从几何组件中删除一个点。
- * @param {GeometryPoint} point - 点对象。
- * @returns {boolean} 点对象是否删除。
- */
- removeComponent(point) { // eslint-disable-line no-unused-vars
- var removed = this.components && (this.components.length > 3);
- if (removed) {
- //remove last point
- this.components.pop();
- //remove our point
- super.removeComponent.apply(this, arguments);
- //append copy of first point
- var firstPoint = this.components[0];
- super.addComponent.apply(this, [firstPoint]);
- }
- return removed;
- }
- /**
- * @function GeometryLinearRing.prototype.getArea
- * @description 获得当前几何对象区域大小,如果是沿顺时针方向的环则是正值,否则为负值。
- * @returns {number} 环的面积。
- */
- getArea() {
- var area = 0.0;
- if (this.components && (this.components.length > 2)) {
- var sum = 0.0;
- for (var i = 0, len = this.components.length; i < len - 1; i++) {
- var b = this.components[i];
- var c = this.components[i + 1];
- sum += (b.x + c.x) * (c.y - b.y);
- }
- area = -sum / 2.0;
- }
- return area;
- }
- /**
- * @function GeometryLinearRing.prototype.getVertices
- * @description 返回几何图形的所有点的列表。
- * @param {boolean} [nodes] - 对于线来说,仅仅返回作为端点的顶点,如果设为 false ,则返回非端点的顶点,如果没有设置此参数,则返回所有顶点。
- * @returns {Array} 几何对象所有点的列表。
- */
- getVertices(nodes) {
- return (nodes === true) ? [] : this.components.slice(0, this.components.length - 1);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/MultiLineString.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GeometryMultiLineString
- * @aliasclass Geometry.MultiLineString
- * @deprecatedclass SuperMap.Geometry.MultiLineString
- * @classdesc 几何对象多线类。
- * @category BaseTypes Geometry
- * @extends GeometryCollection
- * @param {Array.<GeometryLineString>} components - GeometryLineString 数组。
- * @example
- * var multi = new GeometryMultiLineString([
- * new GeometryLineString([
- * new GeometryPoint(1, 0),
- * new GeometryPoint(0, 1)
- * ])
- * ]);
- * @usage
- */
- class MultiLineString extends Collection {
- constructor(components) {
- super(components);
- /**
- * @member {Array.<string>} [GeometryMultiLineString.prototype.componentTypes=["SuperMap.Geometry.LineString"]]
- * @description components 存储的的几何对象所支持的几何类型数组。
- * @readonly
- */
- this.componentTypes = ["SuperMap.Geometry.LineString"];
- this.CLASS_NAME = "SuperMap.Geometry.MultiLineString";
- this.geometryType = "MultiLineString";
- }
- }
- ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/MultiPolygon.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GeometryMultiPolygon
- * @aliasclass Geometry.MultiPolygon
- * @deprecatedclass SuperMap.Geometry.MultiPolygon
- * @classdesc 几何对象多多边形类。
- * @category BaseTypes Geometry
- * @extends GeometryCollection
- * @param {Array.<GeometryPolygon>} components - 形成 GeometryMultiPolygon 的多边形数组。
- * @example
- * var points1 = [new GeometryPoint(10,10),new GeometryPoint(0,0)];
- * var points2 = [new GeometryPoint(10,10),new GeometryPoint(0,0),new GeometryPoint(3,3),new GeometryPoint(10,10)];
- *
- * var linearRing1 = new GeometryLinearRing(points1);
- * var linearRing2 = new GeometryLinearRing(points2);
- *
- * var polygon1 = new GeometryPolygon([linearRing1]);
- * var polygon2 = new GeometryPolygon([linearRing2]);
- *
- * var multiPolygon1 = new GeometryMultiPolygon([polygon1,polygon2]);
- * @usage
- */
- class MultiPolygon extends Collection {
- constructor(components) {
- super(components);
- /**
- * @member {Array.<string>} [GeometryMultiPolygon.prototype.componentTypes=["SuperMap.Geometry.Polygon"]]
- * @description components 存储的的几何对象所支持的几何类型数组。
- * @readonly
- */
- this.componentTypes = ["SuperMap.Geometry.Polygon"];
- this.CLASS_NAME = "SuperMap.Geometry.MultiPolygon";
- this.geometryType = "MultiPolygon";
- }
- }
- ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/Polygon.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GeometryPolygon
- * @aliasclass Geometry.Polygon
- * @deprecatedclass SuperMap.Geometry.Polygon
- * @classdesc 多边形几何对象类。
- * @category BaseTypes Geometry
- * @extends GeometryCollection
- * @param {Array.<GeometryLinearRing>} components - 多边形的线环数组。
- * @example
- * var points =[new GeometryPoint(0,4010338),
- * new GeometryPoint(1063524,4010338),
- * new GeometryPoint(1063524,3150322),
- * new GeometryPoint(0,3150322)
- * ],
- * var linearRings = new GeometryLinearRing(points),
- * var region = new GeometryPolygon([linearRings]);
- * @usage
- */
- class Polygon extends Collection {
- constructor(components) {
- super(components);
- /**
- * @member {Array.<string>} [GeometryPolygon.prototype.componentTypes=["SuperMap.Geometry.LinearRing"]]
- * @description components 存储的的几何对象所支持的几何类型数组。
- * @readonly
- */
- this.componentTypes = ["SuperMap.Geometry.LinearRing"];
- this.CLASS_NAME = "SuperMap.Geometry.Polygon";
- this.geometryType = "Polygon";
- }
- /**
- * @function GeometryMultiPoint.prototype.getArea
- * @description 获得区域面积,从区域的外部口径减去计此区域内部口径算所得的面积。
- * @returns {number} 几何对象的面积。
- */
- getArea() {
- var area = 0.0;
- if (this.components && (this.components.length > 0)) {
- area += Math.abs(this.components[0].getArea());
- for (var i = 1, len = this.components.length; i < len; i++) {
- area -= Math.abs(this.components[i].getArea());
- }
- }
- return area;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/Rectangle.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GeometryRectangle
- * @aliasclass Geometry.Rectangle
- * @deprecatedclass SuperMap.Geometry.Rectangle
- * @classdesc 矩形几何对象类。
- * @category BaseTypes Geometry
- * @param {number} x - 矩形左下角点的横坐标。
- * @param {number} y - 矩形左下角点的纵坐标。
- * @param {number} width - 矩形的宽度。
- * @param {number} height - 矩形的高度。
- * @extends {Geometry}
- * @example
- * //x 为矩形左下角点的横坐标;y 为矩形左下角点的纵坐标;w 为矩形的宽度;h 为矩形的高度
- * var x = 1;
- * var y = 2;
- * var w = 10;
- * var h = 20;
- * var recttangle = new GeometryRectangle(x, y, w, h);
- * @usage
- */
- class Rectangle extends Geometry {
- constructor(x, y, width, height) {
- super(x, y, width, height);
- /**
- * @member {number} GeometryRectangle.prototype.x
- * @description 矩形左下角点的横坐标。
- */
- this.x = x;
- /**
- * @member {number} GeometryRectangle.prototype.y
- * @description 矩形左下角点的纵坐标。
- */
- this.y = y;
- /**
- * @member {number} GeometryRectangle.prototype.width
- * @description 矩形的宽度。
- */
- this.width = width;
- /**
- * @member {number} GeometryRectangle.prototype.height
- * @description 矩形的高度。
- */
- this.height = height;
- this.CLASS_NAME = "SuperMap.Geometry.Rectangle";
- this.geometryType = "Rectangle";
- }
- /**
- * @function GeometryRectangle.prototype.calculateBounds
- * @description 计算出此矩形对象的 bounds。
- */
- calculateBounds() {
- this.bounds = new Bounds(this.x, this.y,
- this.x + this.width,
- this.y + this.height);
- }
- /**
- * @function GeometryRectangle.prototype.getArea
- * @description 获取矩形对象的面积。
- * @returns {number} 矩形对象面积。
- */
- getArea() {
- var area = this.width * this.height;
- return area;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/index.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- ;// CONCATENATED MODULE: ./src/common/commontypes/Credential.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class Credential
- * @deprecatedclass SuperMap.Credential
- * @category Security
- * @classdesc SuperMap 的安全证书类,其中包括 token 等安全验证信息。</br>
- * 需要使用用户名和密码在:"http://localhost:8090/iserver/services/security/tokens" 下申请 value。</br>
- * 获得形如:"2OMwGmcNlrP2ixqv1Mk4BuQMybOGfLOrljruX6VcYMDQKc58Sl9nMHsqQaqeBx44jRvKSjkmpZKK1L596y7skQ.." 的 value。</br>
- * 目前支持的功能包括:地图服务、专题图、量算、查询、公交换乘、空间分析、网络分析,不支持轮询功能。</br>
- * @param {string} value - 访问受安全限制的服务时用于通过安全认证的验证信息。
- * @param {string} [name='token'] - 验证信息前缀,name=value 部分的 name 部分。
- * @example
- * var pixcel = new Credential("valueString","token");
- * pixcel.destroy();
- * @usage
- */
- class Credential {
- constructor(value, name) {
- /**
- * @member {string} Credential.prototype.value
- * @description 访问受安全限制的服务时用于通过安全认证的验证信息。
- */
- this.value = value ? value : "";
- /**
- * @member {string} [Credential.prototype.name='token']
- * @description 验证信息前缀,name=value 部分的 name 部分。
- */
- this.name = name ? name : "token";
- this.CLASS_NAME = "SuperMap.Credential";
- }
- /**
- * @function Credential.prototype.getUrlParameters
- * @description 获取 name=value 的表达式。
- * @example
- * var credential = new Credential("valueString","token");
- * //这里 str = "token=valueString";
- * var str = credential.getUrlParameters();
- * @returns {string} 安全信息组成的 url 片段。
- */
- getUrlParameters() {
- //当需要其他安全信息的时候,则需要return this.name + "=" + this.value + "&" + "...";的形式添加。
- return this.name + "=" + this.value;
- }
- /**
- * @function Credential.prototype.getValue
- * @description 获取 value。
- * @example
- * var credential = new Credential("2OMwGmcNlrP2ixqv1Mk4BuQMybOGfLOrljruX6VcYMDQKc58Sl9nMHsqQaqeBx44jRvKSjkmpZKK1L596y7skQ..","token");
- * //这里 str = "2OMwGmcNlrP2ixqv1Mk4BuQMybOGfLOrljruX6VcYMDQKc58Sl9nMHsqQaqeBx44jRvKSjkmpZKK1L596y7skQ..";
- * var str = credential.getValue();
- * @returns {string} value 字符串,在 iServer 服务下该 value 值即为 token 值。
- */
- getValue() {
- return this.value;
- }
- /**
- *
- * @function Credential.prototype.destroy
- * @description 销毁此对象。销毁后此对象的所有属性为 null,而不是初始值。
- * @example
- * var credential = new Credential("valueString","token");
- * credential.destroy();
- */
- destroy() {
- this.value = null;
- this.name = null;
- }
- }
- /**
- * @member {Credential} Credential.CREDENTIAL
- * @description 这个对象保存一个安全类的实例,在服务端需要安全验证的时候必须进行设置。
- * @example
- * 代码实例:
- * // 当iServer启用服务安全的时候,下边的代码是必须的。安全证书类能够接收一个value和一个name参数。
- * var value = "(以iServer为例,这里是申请的token值)";
- * var name = "token";
- * // 默认name参数为token,所以当使用iServer服务的时候可以不进行设置。
- * Credential.CREDENTIAL = new Credential(value, name);
- *
- */
- Credential.CREDENTIAL = null;
- ;// CONCATENATED MODULE: ./src/common/commontypes/Date.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @name Date
- * @namespace
- * @category BaseTypes Util
- * @description 包含 parse、toISOString 方法的实现,两个方法用来解析 RFC 3339 日期,遵循 ECMAScript 5 规范。
- * @private
- */
- var DateExt = {
- /**
- * @description 生成代表一个具体的日期字符串,该日期遵循 ISO 8601 标准(详情查看{@link http://tools.ietf.org/html/rfc3339})。
- * @example
- * var dateString = DateExt.toISOString(new Date());
- * @param {Date} date - 日期对象。
- * @returns {string} 一个代表日期的字符串。(例如 "2010-08-07T16:58:23.123Z")。
- */
- toISOString: (function () {
- //标准的Date会存在toISOString方法,可以直接调用
- if ("toISOString" in Date.prototype) {
- return function (date) {
- return date.toISOString();
- };
- } else {// 部分浏览器没有,就得自己组合,组合后的字符串规则不变
- function pad(num, len) {
- var str = num + "";
- while (str.length < len) {
- str = "0" + str;
- }
- return str;
- }
- return function (date) {
- var str;
- if (isNaN(date.getTime())) {
- // ECMA-262 says throw RangeError, Firefox returns
- // "Invalid Date"
- str = "Invalid Date";
- } else {
- str =
- date.getUTCFullYear() + "-" +
- pad(date.getUTCMonth() + 1, 2) + "-" +
- pad(date.getUTCDate(), 2) + "T" +
- pad(date.getUTCHours(), 2) + ":" +
- pad(date.getUTCMinutes(), 2) + ":" +
- pad(date.getUTCSeconds(), 2) + "." +
- pad(date.getUTCMilliseconds(), 3) + "Z";
- }
- return str;
- };
- }
- })(),
- /**
- * @description 从一个字符串生成一个日期对象。
- * @example
- * var date = DateExt.parse("2010-08-07");
- * @param {string} str - 日期的字符串。(例如: "2010", "2010-08", "2010-08-07", "2010-08-07T16:58:23.123Z","2010-08-07T11:58:23.123-06")。
- * @returns {Date} 日期对象,如果字符串无法被解析,则返回一个无效的日期。(例如 isNaN(date.getTime()))。
- */
- parse: function (str) {
- var date;
- 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)?$/);
- if (match && (match[1] || match[7])) { // must have at least year or time
- var year = parseInt(match[1], 10) || 0;
- var month = (parseInt(match[2], 10) - 1) || 0;
- var day = parseInt(match[3], 10) || 1;
- date = new Date(Date.UTC(year, month, day));
- // optional time
- var type = match[7];
- if (type) {
- var hours = parseInt(match[4], 10);
- var minutes = parseInt(match[5], 10);
- var secFrac = parseFloat(match[6]);
- var seconds = secFrac | 0;
- var milliseconds = Math.round(1000 * (secFrac - seconds));
- date.setUTCHours(hours, minutes, seconds, milliseconds);
- // check offset
- if (type !== "Z") {
- var hoursOffset = parseInt(type, 10);
- var minutesOffset = parseInt(match[8], 10) || 0;
- var offset = -1000 * (60 * (hoursOffset * 60) + minutesOffset * 60);
- date = new Date(date.getTime() + offset);
- }
- }
- } else {
- date = new Date("invalid");
- }
- return date;
- }
- };
- ;// CONCATENATED MODULE: ./src/common/commontypes/Event.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
-
- /**
- * @name Event
- * @namespace
- * @category BaseTypes Events
- * @description 事件处理函数.
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const element = {namespace}.Event.element();
- *
- * // 弃用的写法
- * const result = SuperMap.Event.element();
- *
- * </script>
- *
- * // ES6 Import
- * import { Event } from '{npm}';
- *
- * const result = Event.element();
- * ```
- */
- var Event = {
- /**
- * @description 事件观察者列表。
- * @type {Object}
- * @default false
- */
- observers: false,
- /**
- * @description KEY_SPACE
- * @type {number}
- * @default 32
- */
- KEY_SPACE: 32,
- /**
- * @description KEY_BACKSPACE
- * @type {number}
- * @default 8
- */
- KEY_BACKSPACE: 8,
- /**
- * @description KEY_TAB
- * @type {number}
- * @default 9
- */
- KEY_TAB: 9,
- /**
- * @description KEY_RETURN
- * @type {number}
- * @default 13
- */
- KEY_RETURN: 13,
- /**
- * @description KEY_ESC
- * @type {number}
- * @default 27
- */
- KEY_ESC: 27,
- /**
- * @description KEY_LEFT
- * @type {number}
- * @default 37
- */
- KEY_LEFT: 37,
- /**
- * @description KEY_UP
- * @type {number}
- * @default 38
- */
- KEY_UP: 38,
- /**
- * @description KEY_RIGHT
- * @type {number}
- * @default 39
- */
- KEY_RIGHT: 39,
- /**
- * @description KEY_DOWN
- * @type {number}
- * @default 40
- */
- KEY_DOWN: 40,
- /**
- * @description KEY_DELETE
- * @type {number}
- * @default 46
- */
- KEY_DELETE: 46,
- /**
- * @description 监听浏览器 DOM 事件。
- * @param {Event} event - Event 对象。
- * @returns {HTMLElement} 触发事件的 DOM 元素。
- */
- element: function (event) {
- return event.target || event.srcElement;
- },
- /**
- * @description 判断事件是否由单次触摸引起。
- * @param {Event} event - Event 对象。
- * @returns {boolean} 是否有且只有一个当前在与触摸表面接触的 Touch 对象。
- */
- isSingleTouch: function (event) {
- return event.touches && event.touches.length === 1;
- },
- /**
- * @description 判断事件是否由多点触控引起。
- * @param {Event} event - Event 对象。
- * @returns {boolean} 是否存在多个当前在与触摸表面接触的 Touch 对象。
- */
- isMultiTouch: function (event) {
- return event.touches && event.touches.length > 1;
- },
- /**
- * @description 确定事件是否由左键单击引起。
- * @param {Event} event - Event 对象。
- * @returns {boolean} 是否点击鼠标左键。
- */
- isLeftClick: function (event) {
- return (((event.which) && (event.which === 1)) ||
- ((event.button) && (event.button === 1)));
- },
- /**
- * @description 确定事件是否由鼠标右键单击引起。
- * @param {Event} event - Event 对象。
- * @returns {boolean} 是否点击鼠标右键。
- */
- isRightClick: function (event) {
- return (((event.which) && (event.which === 3)) ||
- ((event.button) && (event.button === 2)));
- },
- /**
- * @description 阻止事件冒泡。
- * @param {Event} event - Event 对象。
- * @param {boolean} allowDefault - 默认为 false,表示阻止事件的默认行为。
- */
- stop: function (event, allowDefault) {
- if (!allowDefault) {
- if (event.preventDefault) {
- event.preventDefault();
- } else {
- event.returnValue = false;
- }
- }
- if (event.stopPropagation) {
- event.stopPropagation();
- } else {
- event.cancelBubble = true;
- }
- },
- /**
- * @description 查询触发指定事件的 DOM 元素。
- * @param {Event} event - Event 对象。
- * @param {string} tagName - html 标签名。
- * @returns {HTMLElement} DOM 元素。
- */
- findElement: function (event, tagName) {
- var element = Event.element(event);
- while (element.parentNode && (!element.tagName ||
- (element.tagName.toUpperCase() != tagName.toUpperCase()))) {
- element = element.parentNode;
- }
- return element;
- },
- /**
- * @description 监听事件,注册事件处理方法。
- * @param {(HTMLElement|string)} elementParam - 待监听的 DOM 对象或者其 ID 标识。
- * @param {string} name - 监听事件的类别名称。
- * @param {function} observer - 注册的事件处理方法。
- * @param {boolean} [useCapture=false] - 是否捕获。
- */
- observe: function (elementParam, name, observer, useCapture) {
- var element = Util.getElement(elementParam);
- useCapture = useCapture || false;
- if (name === 'keypress' &&
- (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
- || element.attachEvent)) {
- name = 'keydown';
- }
- //if observers cache has not yet been created, create it
- if (!this.observers) {
- this.observers = {};
- }
- //if not already assigned, make a new unique cache ID
- if (!element._eventCacheID) {
- var idPrefix = "eventCacheID_";
- if (element.id) {
- idPrefix = element.id + "_" + idPrefix;
- }
- element._eventCacheID = Util.createUniqueID(idPrefix);
- }
- var cacheID = element._eventCacheID;
- //if there is not yet a hash entry for this element, add one
- if (!this.observers[cacheID]) {
- this.observers[cacheID] = [];
- }
- //add a new observer to this element's list
- this.observers[cacheID].push({
- 'element': element,
- 'name': name,
- 'observer': observer,
- 'useCapture': useCapture
- });
- //add the actual browser event listener
- if (element.addEventListener) {
- if(name === 'mousewheel'){
- // https://www.chromestatus.com/features/6662647093133312
- element.addEventListener(name, observer, {useCapture: useCapture, passive: false} );
- } else {
- element.addEventListener(name, observer, useCapture);
- }
- } else if (element.attachEvent) {
- element.attachEvent('on' + name, observer);
- }
- },
- /**
- * @description 移除给定 DOM 元素的监听事件。
- * @param {(HTMLElement|string)} elementParam - 待监听的 DOM 对象或者其 ID 标识。
- */
- stopObservingElement: function (elementParam) {
- var element = Util.getElement(elementParam);
- var cacheID = element._eventCacheID;
- this._removeElementObservers(Event.observers[cacheID]);
- },
- _removeElementObservers: function (elementObservers) {
- if (elementObservers) {
- for (var i = elementObservers.length - 1; i >= 0; i--) {
- var entry = elementObservers[i];
- var args = new Array(entry.element, entry.name, entry.observer, entry.useCapture);
- Event.stopObserving.apply(this, args);
- }
- }
- },
- /**
- * @description 移除事件监听和注册的事件处理方法。注意:事件的移除和监听相对应,移除时的各属性信息必须监听时
- * 保持一致才能确保事件移除成功。
- * @param {(HTMLElement|string)} elementParam - 被监听的 DOM 元素或者其 ID。
- * @param {string} name - 需要移除的被监听事件名称。
- * @param {function} observer - 需要移除的事件处理方法。
- * @param {boolean} [useCapture=false] - 是否捕获。
- * @returns {boolean} 监听事件是否被移除。
- */
- stopObserving: function (elementParam, name, observer, useCapture) {
- useCapture = useCapture || false;
- var element = Util.getElement(elementParam);
- var cacheID = element._eventCacheID;
- if (name === 'keypress') {
- if (navigator.appVersion.match(/Konqueror|Safari|KHTML/) ||
- element.detachEvent) {
- name = 'keydown';
- }
- }
- // find element's entry in this.observers cache and remove it
- var foundEntry = false;
- var elementObservers = Event.observers[cacheID];
- if (elementObservers) {
- // find the specific event type in the element's list
- var i = 0;
- while (!foundEntry && i < elementObservers.length) {
- var cacheEntry = elementObservers[i];
- if ((cacheEntry.name === name) &&
- (cacheEntry.observer === observer) &&
- (cacheEntry.useCapture === useCapture)) {
- elementObservers.splice(i, 1);
- if (elementObservers.length == 0) {
- delete Event.observers[cacheID];
- }
- foundEntry = true;
- break;
- }
- i++;
- }
- }
- //actually remove the event listener from browser
- if (foundEntry) {
- if (element.removeEventListener) {
- element.removeEventListener(name, observer, useCapture);
- } else if (element && element.detachEvent) {
- element.detachEvent('on' + name, observer);
- }
- }
- return foundEntry;
- },
- /**
- * @description 移除缓存中的监听事件。
- */
- unloadCache: function () {
- // check for Event before checking for observers, because
- // Event may be undefined in IE if no map instance was
- // created
- if (Event && Event.observers) {
- for (var cacheID in Event.observers) {
- var elementObservers = Event.observers[cacheID];
- Event._removeElementObservers.apply(this,
- [elementObservers]);
- }
- Event.observers = false;
- }
- },
- CLASS_NAME: "SuperMap.Event"
- };
- /* prevent memory leaks in IE */
- Event.observe(window, 'resize', Event.unloadCache, false);
- ;// CONCATENATED MODULE: ./src/common/commontypes/Events.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class Events
- * @deprecatedclass SuperMap.Events
- * @classdesc 事件类。
- * @category BaseTypes Events
- * @param {Object} object - 当前事件对象被添加到的 JS 对象。
- * @param {HTMLElement} element - 响应浏览器事件的 DOM 元素。
- * @param {Array.<string>} eventTypes - 自定义应用事件的数组。
- * @param {boolean} [fallThrough=false] - 是否允许事件处理之后向上传递(冒泡),为 false 的时候阻止事件冒泡。
- * @param {Object} options - 事件对象选项。
- * @usage
- */
- class Events {
- constructor(object, element, eventTypes, fallThrough, options) {
- /**
- * @member {Array.<string>} Events.prototype.BROWSER_EVENTS
- * @description 支持的事件。
- * @constant
- * @default [
- "mouseover", "mouseout","mousedown", "mouseup", "mousemove",
- "click", "dblclick", "rightclick", "dblrightclick","resize",
- "focus", "blur","touchstart", "touchmove", "touchend","keydown",
- "MSPointerDown", "MSPointerUp", "pointerdown", "pointerup",
- "MSGestureStart", "MSGestureChange", "MSGestureEnd","contextmenu"
- ]
- */
- this.BROWSER_EVENTS = [
- "mouseover", "mouseout",
- "mousedown", "mouseup", "mousemove",
- "click", "dblclick", "rightclick", "dblrightclick",
- "resize", "focus", "blur",
- "touchstart", "touchmove", "touchend",
- "keydown", "MSPointerDown", "MSPointerUp", "pointerdown", "pointerup",
- "MSGestureStart", "MSGestureChange", "MSGestureEnd",
- "contextmenu"
- ];
- /**
- * @member {Object} Events.prototype.listeners
- * @description 事件监听器函数
- */
- this.listeners = {};
- /**
- * @member {Object} Events.prototype.object
- * @description 发布应用程序事件的对象。
- */
- this.object = object;
- /**
- * @member {HTMLElement} Events.prototype.element
- * @description 接受浏览器事件的 DOM 节点。
- */
- this.element = null;
- /**
- * @member {Array.<string>} Events.prototype.eventTypes
- * @description 支持的事件类型列表。
- */
- this.eventTypes = [];
- /**
- * @member {function} Events.prototype.eventHandler
- * @description 绑定在元素上的事件处理器对象。
- */
- this.eventHandler = null;
- /**
- * @member {boolean} [Events.prototype.fallThrough=false]
- * @description 是否允许事件处理之后向上传递(冒泡),为 false 的时候阻止事件冒泡。
- */
- this.fallThrough = fallThrough;
- /**
- * @member {boolean} [Events.prototype.includeXY=false]
- * @description 判断是否让 xy 属性自动创建到浏览器上的鼠标事件,一般设置为 false,如果设置为 true,鼠标事件将会在事件传递过程中自动产生 xy 属性。
- * 可根据事件对象的 'evt.object' 属性在相关的事件句柄上调用 getMousePosition 函数。这个选项习惯默认为 false 的原因在于,当创建一个
- * 事件对象,其主要目的是管理。在一个 div 的相对定位的鼠标事件,将其设为 true 也是有意义的。这个选项也可以用来控制是否抵消缓存。如果
- * 设为 false 不抵消,如果设为 true,用 this.clearMouseCache() 清除缓存偏移(边界元素偏移,元素在页面的位置偏移)。
- * @example
- * function named(evt) {
- * this.xy = this.object.events.getMousePosition(evt);
- * }
- */
- this.includeXY = false;
- /**
- * @member {Object} Events.prototype.extensions
- * @description 事件扩展。Keys 代表事件类型,values 代表事件对象。
- */
- this.extensions = {};
- /**
- * @member {Object} Events.prototype.extensionCount
- * @description 事件扩展数量。
- */
- this.extensionCount = {};
- /**
- * @member {Object} Events.prototype.clearMouseListener
- * @description 待移除的鼠标监听事件。
- */
- this.clearMouseListener = null;
- Util.extend(this, options);
- if (eventTypes != null) {
- for (var i = 0, len = eventTypes.length; i < len; i++) {
- this.addEventType(eventTypes[i]);
- }
- }
- if (element != null) {
- this.attachToElement(element);
- }
- this.CLASS_NAME = "SuperMap.Events";
- }
- /**
- * @function Events.prototype.destroy
- * @description 移除当前要素 element 上的所有事件监听和处理。
- */
- destroy() {
- for (var e in this.extensions) {
- if (typeof this.extensions[e] !== "boolean") {
- this.extensions[e].destroy();
- }
- }
- this.extensions = null;
- if (this.element) {
- Event.stopObservingElement(this.element);
- if (this.element.hasScrollEvent) {
- Event.stopObserving(
- window, "scroll", this.clearMouseListener
- );
- }
- }
- this.element = null;
- this.listeners = null;
- this.object = null;
- this.eventTypes = null;
- this.fallThrough = null;
- this.eventHandler = null;
- }
- /**
- * @function Events.prototype.addEventType
- * @description 在此事件对象中添加新的事件类型,如果这个事件类型已经添加过了,则不做任何事情。
- * @param {string} eventName - 事件名。
- */
- addEventType(eventName) {
- if (!this.listeners[eventName]) {
- this.eventTypes.push(eventName);
- this.listeners[eventName] = [];
- }
- }
- /**
- * @function Events.prototype.attachToElement
- * @description 给 DOM 元素绑定浏览器事件。
- * @param {HTMLElement} element - 绑定浏览器事件的 DOM 元素。
- */
- attachToElement(element) {
- if (this.element) {
- Event.stopObservingElement(this.element);
- } else {
- // keep a bound copy of handleBrowserEvent() so that we can
- // pass the same function to both Event.observe() and .stopObserving()
- this.eventHandler = FunctionExt.bindAsEventListener(
- this.handleBrowserEvent, this
- );
- // to be used with observe and stopObserving
- this.clearMouseListener = FunctionExt.bind(
- this.clearMouseCache, this
- );
- }
- this.element = element;
- for (var i = 0, len = this.BROWSER_EVENTS.length; i < len; i++) {
- var eventType = this.BROWSER_EVENTS[i];
- // every browser event has a corresponding application event
- // (whether it's listened for or not).
- this.addEventType(eventType);
- // use Prototype to register the event cross-browser
- Event.observe(element, eventType, this.eventHandler);
- }
- // disable dragstart in IE so that mousedown/move/up works normally
- Event.observe(element, "dragstart", Event.stop);
- }
- /**
- * @function Events.prototype.on
- * @description 在一个相同的范围内注册监听器的方法,此方法调用 register 函数。
- * @example
- * // 注册一个 "loadstart" 监听事件
- * events.on({"loadstart": loadStartListener});
- *
- * // 同样注册一个 "loadstart" 监听事件
- * events.register("loadstart", undefined, loadStartListener);
- *
- * // 同时为对象注册多个监听事件
- * events.on({
- * "loadstart": loadStartListener,
- * "loadend": loadEndListener,
- * scope: object
- * });
- *
- * // 同时为对象注册多个监听事件,多次调用 register 方法
- * events.register("loadstart", object, loadStartListener);
- * events.register("loadend", object, loadEndListener);
- *
- *
- * @param {Object} object - 添加监听的对象。
- */
- on(object) {
- for (var type in object) {
- if (type !== "scope" && object.hasOwnProperty(type)) {
- this.register(type, object.scope, object[type]);
- }
- }
- }
- /**
- * @function Events.prototype.register
- * @description 在事件对象上注册一个事件。当事件被触发时,'func' 函数被调用,假设我们触发一个事件,
- * 指定 Bounds 作为 "obj",当事件被触发时,回调函数的上下文作为 Bounds 对象。
- * @param {string} type - 事件注册者的名字。
- * @param {Object} [obj=this.object] - 对象绑定的回调。
- * @param {function} [func] - 回调函数,如果没有特定的回调,则这个函数不做任何事情。
- * @param {(boolean|Object)} [priority] - 当为 true 时将新的监听加在事件队列的前面。
- */
- register(type, obj, func, priority) {
- if (type in Events && !this.extensions[type]) {
- this.extensions[type] = new Events[type](this);
- }
- if ((func != null) &&
- (Util.indexOf(this.eventTypes, type) !== -1)) {
- if (obj == null) {
- obj = this.object;
- }
- var listeners = this.listeners[type];
- if (!listeners) {
- listeners = [];
- this.listeners[type] = listeners;
- this.extensionCount[type] = 0;
- }
- var listener = {obj: obj, func: func};
- if (priority) {
- listeners.splice(this.extensionCount[type], 0, listener);
- if (typeof priority === "object" && priority.extension) {
- this.extensionCount[type]++;
- }
- } else {
- listeners.push(listener);
- }
- }
- }
- /**
- * @function Events.prototype.registerPriority
- * @description 相同的注册方法,但是在前面增加新的监听者事件查询而代替到方法的结束。
- * @param {string} type - 事件注册者的名字。
- * @param {Object} [obj=this.object] - 对象绑定的回调。
- * @param {function} [func] - 回调函数,如果没有特定的回调,则这个函数不做任何事情。
- */
- registerPriority(type, obj, func) {
- this.register(type, obj, func, true);
- }
- /**
- * @function Events.prototype.un
- * @description 在一个相同的范围内取消注册监听器的方法,此方法调用 unregister 函数。
- * @example
- * // 移除 "loadstart" 事件监听
- * events.un({"loadstart": loadStartListener});
- *
- * // 使用 "unregister" 方法移除 "loadstart" 事件监听
- * events.unregister("loadstart", undefined, loadStartListener);
- *
- * // 取消对象多个事件监听
- * events.un({
- * "loadstart": loadStartListener,
- * "loadend": loadEndListener,
- * scope: object
- * });
- *
- * // 取消对象多个事件监听,多次调用unregister方法。
- * events.unregister("loadstart", object, loadStartListener);
- * events.unregister("loadend", object, loadEndListener);
- *
- * @param {Object} object - 移除监听的对象。
- */
- un(object) {
- for (var type in object) {
- if (type !== "scope" && object.hasOwnProperty(type)) {
- this.unregister(type, object.scope, object[type]);
- }
- }
- }
- /**
- * @function Events.prototype.unregister
- * @description 取消注册。
- * @param {string} type - 事件类型。
- * @param {Object} [obj=this.object] - 对象绑定的回调。
- * @param {function} [func] - 回调函数,如果没有特定的回调,则这个函数不做任何事情。
- */
- unregister(type, obj, func) {
- if (obj == null) {
- obj = this.object;
- }
- var listeners = this.listeners[type];
- if (listeners != null) {
- for (var i = 0, len = listeners.length; i < len; i++) {
- if (listeners[i].obj === obj && listeners[i].func === func) {
- listeners.splice(i, 1);
- break;
- }
- }
- }
- }
- /**
- * @function Events.prototype.remove
- * @description 删除某个事件类型的所有监听,如果该事件类型没有注册,则不做任何操作。
- * @param {string} type - 事件类型。
- */
- remove(type) {
- if (this.listeners[type] != null) {
- this.listeners[type] = [];
- }
- }
- /**
- * @function Events.prototype.triggerEvent
- * @description 触发一个特定的注册事件。
- * @param {string} type - 触发事件类型。
- * @param {Event} evt - 事件对象。
- * @returns {Event|boolean} 监听对象,如果返回是 false,则停止监听。
- */
- triggerEvent(type, evt) {
- var listeners = this.listeners[type];
- // fast path
- if (!listeners || listeners.length == 0) {
- return undefined;
- }
- // prep evt object with object & div references
- if (evt == null) {
- evt = {};
- }
- evt.object = this.object;
- evt.element = this.element;
- if (!evt.type) {
- evt.type = type;
- }
- // execute all callbacks registered for specified type
- // get a clone of the listeners array to
- // allow for splicing during callbacks
- listeners = listeners.slice();
- var continueChain;
- for (var i = 0, len = listeners.length; i < len; i++) {
- var callback = listeners[i];
- // bind the context to callback.obj
- continueChain = callback.func.apply(callback.obj, [evt]);
- if ((continueChain != undefined) && (continueChain === false)) {
- // if callback returns false, execute no more callbacks.
- break;
- }
- }
- // don't fall through to other DOM elements
- if (!this.fallThrough) {
- Event.stop(evt, true);
- }
- return continueChain;
- }
- /**
- * @function Events.prototype.handleBrowserEvent
- * @description 对 triggerEvent 函数的包装,给事件对象设置了 xy 属性(即当前鼠标点的 xy 坐标)。
- * @param {Event} evt - 事件对象。
- */
- handleBrowserEvent(evt) {
- var type = evt.type, listeners = this.listeners[type];
- if (!listeners || listeners.length == 0) {
- // noone's listening, bail out
- return;
- }
- // add clientX & clientY to all events - corresponds to average x, y
- var touches = evt.touches;
- if (touches && touches[0]) {
- var x = 0;
- var y = 0;
- var num = touches.length;
- var touch;
- for (var i = 0; i < num; ++i) {
- touch = touches[i];
- x += touch.clientX;
- y += touch.clientY;
- }
- evt.clientX = x / num;
- evt.clientY = y / num;
- }
- if (this.includeXY) {
- evt.xy = this.getMousePosition(evt);
- }
- this.triggerEvent(type, evt);
- }
- /**
- * @function Events.prototype.clearMouseCache
- * @description 清除鼠标缓存。
- */
- clearMouseCache() {
- this.element.scrolls = null;
- this.element.lefttop = null;
- var body = document.body;
- if (body && !((body.scrollTop != 0 || body.scrollLeft != 0) &&
- navigator.userAgent.match(/iPhone/i))) {
- this.element.offsets = null;
- }
- }
- /**
- * @function Events.prototype.getMousePosition
- * @description 获取当前鼠标的位置。
- * @param {Event} evt - 事件对象。
- * @returns {Pixel} 当前的鼠标的 xy 坐标点。
- */
- getMousePosition(evt) {
- if (!this.includeXY) {
- this.clearMouseCache();
- } else if (!this.element.hasScrollEvent) {
- Event.observe(window, "scroll", this.clearMouseListener);
- this.element.hasScrollEvent = true;
- }
- if (!this.element.scrolls) {
- var viewportElement = Util.getViewportElement();
- this.element.scrolls = [
- viewportElement.scrollLeft,
- viewportElement.scrollTop
- ];
- }
- if (!this.element.lefttop) {
- this.element.lefttop = [
- (document.documentElement.clientLeft || 0),
- (document.documentElement.clientTop || 0)
- ];
- }
- if (!this.element.offsets) {
- this.element.offsets = Util.pagePosition(this.element);
- }
- return new Pixel(
- (evt.clientX + this.element.scrolls[0]) - this.element.offsets[0]
- - this.element.lefttop[0],
- (evt.clientY + this.element.scrolls[1]) - this.element.offsets[1]
- - this.element.lefttop[1]
- );
- }
- }
- Events.prototype.BROWSER_EVENTS = [
- "mouseover", "mouseout",
- "mousedown", "mouseup", "mousemove",
- "click", "dblclick", "rightclick", "dblrightclick",
- "resize", "focus", "blur",
- "touchstart", "touchmove", "touchend",
- "keydown", "MSPointerDown", "MSPointerUp", "pointerdown", "pointerup",
- "MSGestureStart", "MSGestureChange", "MSGestureEnd",
- "contextmenu"
- ];
- ;// CONCATENATED MODULE: ./src/common/commontypes/Feature.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class Feature
- * @deprecatedclass SuperMap.Feature
- * @category BaseTypes Geometry
- * @classdesc 要素类组合了地理和属性,Feature 类同时具有 marker 和 lonlat 属性。
- * @param {SuperMap.Layer} layer - 图层。
- * @param {LonLat} lonlat - 经纬度。
- * @param {Object} data - 数据对象。
- * @usage
- */
- class Feature {
- constructor(layer, lonlat, data) {
- this.CLASS_NAME = "SuperMap.Feature";
- /**
- * @deprecated
- * @member {SuperMap.Layer} Feature.prototype.layer
- * @description 图层。
- */
- this.layer = layer;
- /**
- * @member {string} Feature.prototype.id
- * @description 要素 ID。
- */
- this.id = Util.createUniqueID(this.CLASS_NAME + "_");
- /**
- * @member {LonLat} Feature.prototype.lonlat
- * @description 经纬度。
- *
- */
- this.lonlat = lonlat;
- /**
- * @member {Object} Feature.prototype.data
- * @description 数据对象。
- */
- this.data = (data != null) ? data : {};
- }
- /**
- * @function Feature.prototype.destroy
- * @description 释放相关资源。
- */
- destroy() {
- this.id = null;
- this.lonlat = null;
- this.data = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/commontypes/Vector.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FeatureVector
- * @aliasclass Feature.Vector
- * @deprecatedclass SuperMap.Feature.Vector
- * @category BaseTypes Geometry
- * @classdesc 矢量要素类。该类具有 Geometry 属性存放几何信息,
- * attributes 属性存放非几何信息,另外还包含了 style 属性,用来定义矢量要素的样式,
- * 其中,默认的样式在 {@link FeatureVector.style} 类中定义,如果没有特别的指定将使用默认的样式。
- * @extends {Feature}
- * @param {Geometry} geometry - 要素的几何信息。
- * @param {Object} [attributes] - 描述要素的任意的可序列化属性,将要映射到 attributes 属性中的对象。
- * @param {Object} [style] - 样式对象。
- * @example
- * var geometry = new GeometryPoint(-115,10);
- * var style = {
- * strokeColor:"#339933",
- * strokeOpacity:1,
- * strokeWidth:3,
- * pointRadius:6
- * }
- * var pointFeature = new FeatureVector(geometry,null,style);
- * vectorLayer.addFeatures(pointFeature);
- * @usage
- */
- // TRASH THIS
- const State = {
- /** states */
- UNKNOWN: 'Unknown',
- INSERT: 'Insert',
- UPDATE: 'Update',
- DELETE: 'Delete'
- };
- class Vector extends Feature {
- constructor(geometry, attributes, style) {
- super(null, null, attributes);
- /**
- * @member {string} FeatureVector.prototype.fid
- * @description fid
- */
- this.fid = null;
- /**
- * @member {Geometry} FeatureVector.prototype.geometry
- * @description 存放几何信息。
- */
- this.geometry = geometry ? geometry : null;
- /**
- * @member {Object} FeatureVector.prototype.attributes
- * @description 描述要素的任意的可序列化属性。
- */
- this.attributes = {};
- if (attributes) {
- this.attributes = Util.extend(this.attributes, attributes);
- }
- /**
- * @member {Bounds} FeatureVector.prototype.bounds
- * @description 限制要素几何的边界。
- */
- this.bounds = null;
- /**
- * @member {string} FeatureVector.prototype.state
- * @description state
- */
- this.state = null;
- /**
- * @member {Object} FeatureVector.prototype.style
- * @description 要素的样式属性,地图查询返回的 feature 的 style,8C 变为null。
- */
- this.style = style ? style : null;
- /**
- * @member {string} FeatureVector.prototype.url
- * @description 如果设置了这个属性,在更新或者删除要素时需要考虑 {@link HTTP} 。
- */
- this.url = null;
- this.lonlat = null;
- this.CLASS_NAME = "SuperMap.Feature.Vector";
- Vector.style = {
- 'default': {
- fillColor: "#ee9900",
- fillOpacity: 0.4,
- hoverFillColor: "white",
- hoverFillOpacity: 0.8,
- strokeColor: "#ee9900",
- strokeOpacity: 1,
- strokeWidth: 1,
- strokeLinecap: "round",
- strokeDashstyle: "solid",
- hoverStrokeColor: "red",
- hoverStrokeOpacity: 1,
- hoverStrokeWidth: 0.2,
- pointRadius: 6,
- hoverPointRadius: 1,
- hoverPointUnit: "%",
- pointerEvents: "visiblePainted",
- cursor: "inherit",
- fontColor: "#000000",
- labelAlign: "cm",
- labelOutlineColor: "white",
- labelOutlineWidth: 3
- },
- 'select': {
- fillColor: "blue",
- fillOpacity: 0.4,
- hoverFillColor: "white",
- hoverFillOpacity: 0.8,
- strokeColor: "blue",
- strokeOpacity: 1,
- strokeWidth: 2,
- strokeLinecap: "round",
- strokeDashstyle: "solid",
- hoverStrokeColor: "red",
- hoverStrokeOpacity: 1,
- hoverStrokeWidth: 0.2,
- pointRadius: 6,
- hoverPointRadius: 1,
- hoverPointUnit: "%",
- pointerEvents: "visiblePainted",
- cursor: "pointer",
- fontColor: "#000000",
- labelAlign: "cm",
- labelOutlineColor: "white",
- labelOutlineWidth: 3
- },
- 'temporary': {
- fillColor: "#66cccc",
- fillOpacity: 0.2,
- hoverFillColor: "white",
- hoverFillOpacity: 0.8,
- strokeColor: "#66cccc",
- strokeOpacity: 1,
- strokeLinecap: "round",
- strokeWidth: 2,
- strokeDashstyle: "solid",
- hoverStrokeColor: "red",
- hoverStrokeOpacity: 1,
- hoverStrokeWidth: 0.2,
- pointRadius: 6,
- hoverPointRadius: 1,
- hoverPointUnit: "%",
- pointerEvents: "visiblePainted",
- //cursor:"inherit",
- cursor: "default",
- fontColor: "#000000",
- labelAlign: "cm",
- labelOutlineColor: "white",
- labelOutlineWidth: 3
- },
- 'delete': {
- display: "none"
- }
- };
- }
- /**
- * @function FeatureVector.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- if (this.layer) {
- this.layer.removeFeatures(this);
- this.layer = null;
- }
- this.geometry = null;
- super.destroy();
- }
- /**
- * @function FeatureVector.prototype.clone
- * @description 复制矢量要素,并返回复制后的新对象。
- * @returns {FeatureVector} 相同要素的新的矢量要素。
- */
- clone() {
- return new Vector(
- this.geometry ? this.geometry.clone() : null,
- this.attributes,
- this.style);
- }
- /**
- * @function FeatureVector.prototype.toState
- * @description 设置新状态。
- * @param {string} state - 状态。
- */
- toState(state) {
- if (state === State.UPDATE) {
- switch (this.state) {
- case State.UNKNOWN:
- case State.DELETE:
- this.state = state;
- break;
- case State.UPDATE:
- case State.INSERT:
- break;
- }
- } else if (state === State.INSERT) {
- switch (this.state) {
- case State.UNKNOWN:
- break;
- default:
- this.state = state;
- break;
- }
- } else if (state === State.DELETE) {
- switch (this.state) {
- case State.INSERT:
- // the feature should be destroyed
- break;
- case State.DELETE:
- break;
- case State.UNKNOWN:
- case State.UPDATE:
- this.state = state;
- break;
- }
- } else if (state === State.UNKNOWN) {
- this.state = state;
- }
- }
- }
- /**
- *
- * @typedef {Object} FeatureVector.style
- * @description Feature 有大量的样式属性,如果没有特别的指定将使用默认的样式,
- * 大部分样式通过 SVG 标准定义属性。
- * - fill properties 资料介绍:{@link http://www.w3.org/TR/SVG/painting.html#FillProperties}
- * - stroke properties 资料介绍:{@link http://www.w3.org/TR/SVG/painting.html#StrokeProperties}
- * @property {boolean} [fill] - 不需要填充则设置为 false。
- * @property {string} [fillColor='#ee9900'] - 十六进制填充颜色。
- * @property {number} [fillOpacity=0.4] - 填充不透明度。
- * @property {boolean} [stroke] - 不需要描边则设为 false。
- * @property {string} [strokeColor='#ee9900'] - 十六进制描边颜色。
- * @property {number} [strokeOpacity=0.4] - 描边的不透明度(0-1)。
- * @property {number} [strokeWidth=1] - 像素描边宽度。
- * @property {string} [strokeLinecap='round'] - strokeLinecap 有三种类型 butt,round,square。
- * @property {string} [strokeDashstyle='solid'] - 有 dot,dash,dashdot,longdash,longdashdot,solid 几种样式。
- * @property {boolean} [graphic] - 不需要则设置为 false。
- * @property {number} [pointRadius=6] - 像素点半径。
- * @property {string} [pointerEvents='visiblePainted'] - pointerEvents。
- * @property {string} [cursor] - cursor。
- * @property {boolean} [allowRotate='false'] - 是否允许图标随着运行方向旋转。用于时空数据图层。
- * @property {string} [externalGraphic] - 连接到用来渲染点的外部的图形。
- * @property {number} [graphicWidth] - 外部图表的像素宽度。
- * @property {number} [graphicHeight] - 外部图表的高宽度。
- * @property {number} [graphicOpacity] - 外部图表的不透明度(0-1)。
- * @property {number} [graphicXOffset] - 外部图表沿着x方向的偏移量。
- * @property {number} [graphicYOffset] - 外部图表沿着y方向的偏移量 Pixel。
- * @property {number} [rotation] - 一个图表沿着其中心点(或者偏移中心指定点)在顺时针方向旋转。
- * @property {number} [graphicZIndex] - 渲染时使用的索引值。
- * @property {string} [graphicName='circle'] - 渲染点时图标使用的名字。支持"circle" , "square", "star", "x", "cross", "triangle"。
- * @property {string} [graphicTitle] - 外部图表的提示框。
- * @property {string} [backgroundGraphic] - 外部图表的背景。
- * @property {number} [backgroundGraphicZIndex] - 背景图渲染时使用的索引值。
- * @property {number} [backgroundXOffset] - 背景图在 x 轴的偏移量。
- * @property {number} [backgroundYOffset] - 背景图在 y 轴的偏移量。
- * @property {number} [backgroundHeight] - 背景图的高度。如果没有设置,将用 graphicHeight。
- * @property {number} [backgroundWidth] - 背景图的宽度。如果没有设置,将用 graphicWidth。
- * @property {boolean} [isUnicode=false] - 这个属性要配合 label 属性来用,当为 true时,label 就可以使用 unicode 编码,
- * 比如 "a" 的 unicode 十六进制编码为 61,则 label 属性可以为 "a",其中 "&#" 为前缀,标志这个为 unicode 编码,
- * "x" 是指 16 进制,这时页面显示的是 "a";当此值为 false 的时候,label 的内容会被直接输出,
- * 比如,label 为 "a",这时页面显示的也是 "a"。
- * @property {string} [label] - 可选的标签文本。
- * @property {string} [labelAlign='cm'] - 标签对齐,是由两个字符组成的字符串,如:"lt", "cm", "rb",
- * 其中第一个字符代表水平方向上的对齐,"l"=left, "c"=center, "r"=right;
- * 第二个字符代表垂直方向上的对齐,"t"=top, "m"=middle, "b"=bottom。
- * @property {number} [labelXOffset] - 标签在 x 轴方向的偏移量。
- * @property {number} [labelYOffset] - 标签在 y 轴方向的偏移量。
- * @property {boolean} [labelSelect=false] - 如果设为 true,标签可以选用 SelectFeature 或者 similar 控件。
- * @property {string} [fontColor='#000000'] - 标签字体颜色。
- * @property {number} [fontOpacity] - 标签透明度 (0-1)。
- * @property {string} [fontFamily] - 标签的字体类型。
- * @property {string} [fontSize] - 标签的字体大小。
- * @property {string} [fontStyle] - 标签的字体样式。
- * @property {string} [fontWeight] - 标签的字体粗细。
- * @property {string} [display] - 如果 display 属性设置为 “none”,符号将没有任何效果。
- * @example
- * // label的用法如下:
- * function addGeoTest(){
- * var geometry = new GeometryPoint(105, 35);
- * var pointFeature = new FeatureVector(geometry);
- * var styleTest = {
- * label:"supermap",
- * fontColor:"#0000ff",
- * fontOpacity:"0.5",
- * fontFamily:"隶书",
- * fontSize:"8em",
- * fontWeight:"bold",
- * fontStyle:"italic",
- * labelSelect:"true",
- * }
- * pointFeature.style = styleTest;
- * vectorLayer.addFeatures([pointFeature]);
- * }
- */
- ;// CONCATENATED MODULE: ./src/common/commontypes/index.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- ;// CONCATENATED MODULE: ./src/common/format/Format.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class Format
- * @deprecatedclass SuperMap.Format
- * @classdesc 读写各种格式的格式类基类。其子类应该包含并实现 read 和 write 方法。
- * @category BaseTypes Format
- * @param {Object} options - 可选参数。
- * @param {boolean} [options.keepData=false] - 如果设置为 true, data 属性会指向被解析的对象(例如 JSON 或 xml 数据对象)。
- * @param {Object} [options.data] - 当 keepData 属性设置为 true,这是传递给 read 操作的要被解析的字符串。
- * @usage
- */
- class Format {
- constructor(options) {
- /**
- * @member {Object} Format.prototype.data
- * @description 当 keepData 属性设置为 true,这是传递给 read 操作的要被解析的字符串。
- */
- this.data = null;
- /**
- * @member {Object} [Format.prototype.keepData=false]
- * @description 保持最近读到的数据的引用(通过 data 属性)。
- */
- this.keepData = false;
- Util.extend(this, options);
- this.options = options;
- this.CLASS_NAME = "SuperMap.Format";
- }
- /**
- * @function Format.prototype.destroy
- * @description 销毁该格式类,释放相关资源。
- */
- destroy() {
- //用来销毁该格式类,释放相关资源
- }
- /**
- * @function Format.prototype.read
- * @description 来从字符串中读取数据。
- * @param {string} data - 读取的数据。
- */
- read(data) { // eslint-disable-line no-unused-vars
- //用来从字符串中读取数据
- }
- /**
- * @function Format.prototype.write
- * @description 将对象写成字符串。
- * @param {Object} object - 可序列化的对象。
- * @returns {string} 对象转化后的字符串。
- */
- write(object) { // eslint-disable-line no-unused-vars
- //用来写字符串
- }
- }
- ;// CONCATENATED MODULE: ./src/common/format/JSON.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class JSONFormat
- * @aliasclass Format.JSON
- * @deprecatedclass SuperMap.Format.JSON
- * @classdesc 安全的读写 JSON 的解析类。使用 {@link JSONFormat} 构造函数创建新实例。
- * @category BaseTypes Format
- * @param {Object} [options] - 可选参数。
- * @param {string} [options.indent=" "] - 用于格式化输出,indent 字符串会在每次缩进的时候使用一次。
- * @param {string} [options.space=" "] - 用于格式化输出,space 字符串会在名值对的 ":" 后边添加。
- * @param {string} [options.newline="\n"] - 用于格式化输出, newline 字符串会用在每一个名值对或数组项末尾。
- * @param {number} [options.level=0] - 用于格式化输出, 表示的是缩进级别。
- * @param {boolean} [options.pretty=false] - 是否在序列化的时候使用额外的空格控制结构。在 write 方法中使用。
- * @param {boolean} [options.nativeJSON] - 需要被注册的监听器对象。
- * @extends {Format}
- * @usage
- */
- class JSONFormat extends Format {
- constructor(options) {
- super(options);
- /**
- * @member {string} [JSONFormat.prototype.indent=" "]
- * @description 用于格式化输出,indent 字符串会在每次缩进的时候使用一次。
- */
- this.indent = " ";
- /**
- * @member {string} [JSONFormat.prototype.space=" "]
- * @description 用于格式化输出,space 字符串会在名值对的 ":" 后边添加。
- */
- this.space = " ";
- /**
- * @member {string} [JSONFormat.prototype.newline="\n"]
- * @description 用于格式化输出, newline 字符串会用在每一个名值对或数组项末尾。
- */
- this.newline = "\n";
- /**
- * @member {number} [JSONFormat.prototype.level=0]
- * @description 用于格式化输出, 表示的是缩进级别。
- */
- this.level = 0;
- /**
- * @member {boolean} [JSONFormat.prototype.pretty=false]
- * @description 是否在序列化的时候使用额外的空格控制结构。在 write 方法中使用。
- */
- this.pretty = false;
- /**
- * @member {boolean} JSONFormat.prototype.nativeJSON
- * @description 判断浏览器是否原生支持 JSON 格式数据。
- */
- this.nativeJSON = (function () {
- return !!(window.JSON && typeof JSON.parse === "function" && typeof JSON.stringify === "function");
- })();
- this.CLASS_NAME = "SuperMap.Format.JSON";
- /**
- * @member JSONFormat.prototype.serialize
- * @description 提供一些类型对象转 JSON 字符串的方法。
- */
- this.serialize = {
- /**
- * @function JSONFormat.serialize.object
- * @description 把对象转换为 JSON 字符串。
- * @param {Object} object - 可序列化的对象。
- * @returns {string} JSON 字符串。
- */
- 'object': function (object) {
- // three special objects that we want to treat differently
- if (object == null) {
- return "null";
- }
- if (object.constructor === Date) {
- return this.serialize.date.apply(this, [object]);
- }
- if (object.constructor === Array) {
- return this.serialize.array.apply(this, [object]);
- }
- var pieces = ['{'];
- this.level += 1;
- var key, keyJSON, valueJSON;
- var addComma = false;
- for (key in object) {
- if (object.hasOwnProperty(key)) {
- // recursive calls need to allow for sub-classing
- keyJSON = this.write.apply(this,
- [key, this.pretty]);
- valueJSON = this.write.apply(this,
- [object[key], this.pretty]);
- if (keyJSON != null && valueJSON != null) {
- if (addComma) {
- pieces.push(',');
- }
- pieces.push(this.writeNewline(), this.writeIndent(),
- keyJSON, ':', this.writeSpace(), valueJSON);
- addComma = true;
- }
- }
- }
- this.level -= 1;
- pieces.push(this.writeNewline(), this.writeIndent(), '}');
- return pieces.join('');
- },
- /**
- * @function JSONFormat.serialize.array
- * @description 把数组转换成 JSON 字符串。
- * @param {Array} array - 可序列化的数组。
- * @returns {string} JSON 字符串。
- */
- 'array': function (array) {
- var json;
- var pieces = ['['];
- this.level += 1;
- for (var i = 0, len = array.length; i < len; ++i) {
- // recursive calls need to allow for sub-classing
- json = this.write.apply(this,
- [array[i], this.pretty]);
- if (json != null) {
- if (i > 0) {
- pieces.push(',');
- }
- pieces.push(this.writeNewline(), this.writeIndent(), json);
- }
- }
- this.level -= 1;
- pieces.push(this.writeNewline(), this.writeIndent(), ']');
- return pieces.join('');
- },
- /**
- * @function JSONFormat.serialize.string
- * @description 把字符串转换成 JSON 字符串。
- * @param {string} string - 可序列化的字符串。
- * @returns {string} JSON 字符串。
- */
- 'string': function (string) {
- // If the string contains no control characters, no quote characters, and no
- // backslash characters, then we can simply slap some quotes around it.
- // Otherwise we must also replace the offending characters with safe
- // sequences.
- var m = {
- '\b': '\\b',
- '\t': '\\t',
- '\n': '\\n',
- '\f': '\\f',
- '\r': '\\r',
- '"': '\\"',
- '\\': '\\\\'
- };
- /*eslint-disable no-control-regex*/
- if (/["\\\x00-\x1f]/.test(string)) {
- return '"' + string.replace(/([\x00-\x1f\\"])/g, function (a, b) {
- var c = m[b];
- if (c) {
- return c;
- }
- c = b.charCodeAt();
- return '\\u00' +
- Math.floor(c / 16).toString(16) +
- (c % 16).toString(16);
- }) + '"';
- }
- return '"' + string + '"';
- },
- /**
- * @function JSONFormat.serialize.number
- * @description 把数字转换成 JSON 字符串。
- * @param {number} number - 可序列化的数字。
- * @returns {string} JSON 字符串。
- */
- 'number': function (number) {
- return isFinite(number) ? String(number) : "null";
- },
- /**
- * @function JSONFormat.serialize.boolean
- * @description Transform a boolean into a JSON string.
- * @param {boolean} bool - The boolean to be serialized.
- * @returns {string} A JSON string representing the boolean.
- */
- 'boolean': function (bool) {
- return String(bool);
- },
- /**
- * @function JSONFormat.serialize.object
- * @description 将日期对象转换成 JSON 字符串。
- * @param {Date} date - 可序列化的日期对象。
- * @returns {string} JSON 字符串。
- */
- 'date': function (date) {
- function format(number) {
- // Format integers to have at least two digits.
- return (number < 10) ? '0' + number : number;
- }
- return '"' + date.getFullYear() + '-' +
- format(date.getMonth() + 1) + '-' +
- format(date.getDate()) + 'T' +
- format(date.getHours()) + ':' +
- format(date.getMinutes()) + ':' +
- format(date.getSeconds()) + '"';
- }
- };
- }
- /**
- * @function JSONFormat.prototype.read
- * @description 将一个符合 JSON 结构的字符串进行解析。
- * @param {string} json - 符合 JSON 结构的字符串。
- * @param {function} filter - 过滤方法,最终结果的每一个键值对都会调用该过滤方法,并在对应的值的位置替换成该方法返回的值。
- * @returns {(Object|string|Array|number|boolean)} 对象,数组,字符串或数字。
- */
- read(json, filter) {
- var object;
- if (this.nativeJSON) {
- try {
- object = JSON.parse(json, filter);
- } catch (e) {
- // Fall through if the regexp test fails.
- return { data: json}
- }
- }
- if (this.keepData) {
- this.data = object;
- }
- return object;
- }
- /**
- * @function JSONFormat.prototype.write
- * @description 序列化一个对象到一个符合 JSON 格式的字符串。
- * @param {Object|string|Array|number|boolean} value - 需要被序列化的对象,数组,字符串,数字,布尔值。
- * @param {boolean} [pretty=false] - 是否在序列化的时候使用额外的空格控制结构。在 write 方法中使用。
- * @returns {string} 符合 JSON 格式的字符串。
- *
- */
- write(value, pretty) {
- this.pretty = !!pretty;
- var json = null;
- var type = typeof value;
- if (this.serialize[type]) {
- try {
- json = (!this.pretty && this.nativeJSON) ?
- JSON.stringify(value) :
- this.serialize[type].apply(this, [value]);
- } catch (err) {
- //console.error("Trouble serializing: " + err);
- }
- }
- return json;
- }
- /**
- * @function JSONFormat.prototype.writeIndent
- * @description 根据缩进级别输出一个缩进字符串。
- * @private
- * @returns {string} 一个适当的缩进字符串。
- */
- writeIndent() {
- var pieces = [];
- if (this.pretty) {
- for (var i = 0; i < this.level; ++i) {
- pieces.push(this.indent);
- }
- }
- return pieces.join('');
- }
- /**
- * @function JSONFormat.prototype.writeNewline
- * @description 在格式化输出模式情况下输出代表新一行的字符串。
- * @private
- * @returns {string} 代表新的一行的字符串。
- */
- writeNewline() {
- return (this.pretty) ? this.newline : '';
- }
- /**
- * @function JSONFormat.prototype.writeSpace
- * @private
- * @description 在格式化输出模式情况下输出一个代表空格的字符串。
- * @returns {string} 空格字符串。
- */
- writeSpace() {
- return (this.pretty) ? this.space : '';
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ServerColor.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ServerColor
- * @deprecatedclass SuperMap.ServerColor
- * @category iServer Map Theme
- * @classdesc 颜色类。该类使用三原色( RGB )来表达颜色。
- * @param {Object} options - 可选参数。
- * @param {number} [options.red=255] - 获取或设置红色值。
- * @param {number} [options.green=0] - 获取或设置绿色值。
- * @param {number} [options.blue=0] - 获取或设置蓝色值。
- * @usage
- */
- class ServerColor {
- constructor(red, green, blue) {
- /**
- * @member {number} [ServerColor.prototype.red=255]
- * @description 获取或设置红色值。
- */
- this.red = (!red && red != 0)?255:red;
- /**
- * @member {number} [ServerColor.prototype.green=0]
- * @description 获取或设置绿色值。
- */
- this.green = green||0;
- /**
- * @member {number} [ServerColor.prototype.blue=0]
- * @description 获取或设置蓝色值。
- */
- this.blue = blue||0;
- this.CLASS_NAME = "SuperMap.ServerColor";
- }
- /**
- * @function ServerColor.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.red = null;
- me.green = null;
- me.blue = null;
- }
- /**
- * @function ServerColor.formJson
- * @description 将 JSON 对象转化为 ServerColor 对象。
- * @param {Object} jsonObject - 要转换的 JSON 对象。
- * @returns {ServerColor} 转化后的 ServerColor 对象。
- */
- static fromJson(jsonObject) {
- if (!jsonObject) {
- return;
- }
- var color = new ServerColor();
- var red = 255;
- if (jsonObject.red !== null) {
- red = Number(jsonObject.red);
- }
- color.red = red;
- var green = 0;
- if (jsonObject.green !== null) {
- green = Number(jsonObject.green);
- }
- color.green = green;
- var blue = 0;
- if (jsonObject.blue !== null) {
- blue = Number(jsonObject.blue);
- }
- color.blue = blue;
- return color;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ServerStyle.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ServerStyle
- * @deprecatedclass SuperMap.ServerStyle
- * @category iServer Map Theme
- * @classdesc 服务端矢量要素风格类。该类用于定义点状符号、线状符号、填充符号风格及其相关属性。
- * @param {Object} options - 参数。
- * @param {FillGradientMode} options.fillGradientMode - 渐变填充风格的渐变类型。
- * @param {ServerColor} [options.fillBackColor=[255,255,255]] - 填充背景颜色。
- * @param {boolean} [options.fillBackOpaque=false] - 背景是否不透明。
- * @param {ServerColor} [options.fillForeColor=[255,0,0]] - 填充颜色。
- * @param {number} [options.fillGradientAngle=0] - 渐变填充的旋转角度。
- * @param {number} [options.fillGradientOffsetRatioX=0] - 渐变填充中心点相对于填充区域范围中心点的水平偏移百分比。
- * @param {number} [options.fillGradientOffsetRatioY=0] - 填充中心点相对于填充区域范围中心点的垂直偏移百分比。
- * @param {number} [options.fillOpaqueRate=100] - 填充不透明度。
- * @param {number} [options.fillSymbolID=0] - 填充符号的编码。
- * @param {ServerColor} [options.lineColor] - 矢量要素的边线颜色。默认 lineColor = new ServerColor(0, 0, 0)。
- * @param {number} [options.lineSymbolID=0] - 线状符号的编码。
- * @param {number} [options.lineWidth=1] - 边线的宽度。
- * @param {number} [options.markerAngle=0] - 点状符号的旋转角度。
- * @param {number} [options.markerSize=1] - 点状符号的大小。
- * @param {number} [options.markerSymbolID=-1] - 点状符号的编码。
- * @usage
- */
- class ServerStyle {
- constructor(options) {
- /**
- * @member {ServerColor} ServerStyle.prototype.fillBackColor
- * @description 填充背景颜色。当填充模式为渐变填充时,该颜色为填充终止色。
- */
- this.fillBackColor = new ServerColor(255, 255, 255);
- /**
- * @member {boolean} [ServerStyle.prototype.fillBackOpaque=false]
- * @description 背景是否不透明。false 表示透明。
- */
- this.fillBackOpaque = false;
- /**
- * @member {ServerColor} ServerStyle.prototype.fillForeColor
- * @description 填充颜色。当填充模式为渐变填充时,该颜色为填充起始颜色。
- */
- this.fillForeColor = new ServerColor(255, 0, 0);
- /**
- * @member {FillGradientMode} ServerStyle.prototype.fillGradientMode
- * @description 渐变填充风格的渐变类型。
- */
- this.fillGradientMode = null;
- /**
- * @member {number} ServerStyle.prototype.fillGradientAngle -
- * @description 渐变填充的旋转角度。单位为度,精确到 0.1 度,逆时针方向为正方向。
- */
- this.fillGradientAngle = 0;
- /**
- * @member {number} ServerStyle.prototype.fillGradientOffsetRatioX
- * @description 渐变填充中心点相对于填充区域范围中心点的水平偏移百分比。它们的关系如下:设填充区域范围中心点的坐标为(x0, y0),
- * 填充中心点的坐标为(x, y),填充区域范围的宽度为 a,水平偏移百分比为 dx,则 x=x0 + a*dx/100。
- */
- this.fillGradientOffsetRatioX = 0;
- /**
- * @member {number} ServerStyle.prototype.fillGradientOffsetRatioY
- * @description 填充中心点相对于填充区域范围中心点的垂直偏移百分比。它们的关系如下:<br>
- * 设填充区域范围中心点的坐标为(x0, y0),填充中心点的坐标为(x, y),填充区域范围的高度为 b,垂直偏移百分比为 dy,则 y=y0 + b*dx/100。
- */
- this.fillGradientOffsetRatioY = 0;
- /**
- * @member {number} [ServerStyle.prototype.fillOpaqueRate=100]
- * @description 填充不透明度。合法值为 0 - 100 的数值。其中为 0 表示完全透明;
- * 100 表示完全不透明。赋值小于 0 时按照 0 处理,大于 100 时按照 100 处理。
- */
- this.fillOpaqueRate = 100;
- /**
- * @member {number} ServerStyle.prototype.fillSymbolID
- * @description 填充符号的编码。此编码用于唯一标识各普通填充风格的填充符号。
- * 关于填充符号的样式与对应的 ID 号请在 SuperMap 桌面软件中查找。
- */
- this.fillSymbolID = 0;
- /**
- * @member {ServerColor} ServerStyle.prototype.lineColor
- * @description 矢量要素的边线颜色。如果等级符号是点符号,点符号的颜色由 lineColor 控制。
- */
- this.lineColor = new ServerColor(0, 0, 0);
- /**
- * @member {number} [ServerStyle.prototype.lineSymbolID=0]
- * @description 线状符号的编码。此编码用于唯一标识各普通填充风格的填充符号。
- * 关于线状符号的样式与对应的 ID 号请在 SuperMap 桌面软件中查找。
- */
- this.lineSymbolID = 0;
- /**
- * @member {number} [ServerStyle.prototype.lineWidth=1.0]
- * @description 边线的宽度。单位为毫米,精度到 0.1。
- */
- this.lineWidth = 1;
- /**
- * @member {number} [ServerStyle.prototype.markerAngle=0]
- * @description 点状符号的旋转角度。以度为单位,精确到 0.1 度,逆时针方向为正方向。
- */
- this.markerAngle = 0;
- /**
- * @member {number} [ServerStyle.prototype.markerSize=1.0]
- * @description 点状符号的大小。单位为毫米,精度为 0.1。当该属性设置为0时,采用符号默认大小 1.0 显示。
- * 当该属性设置为非法值时,交由服务器默认处理。
- */
- this.markerSize = 1;
- /**
- * @member {number} [ServerStyle.prototype.markerSymbolID=-1]
- * @description 点状符号的编码。此编码用于唯一标识各点状符号。
- * 关于线状符号的样式与对应的 ID 号请在 SuperMap 桌面软件中查找。
- */
- this.markerSymbolID = -1;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.ServerStyle";
- }
- /**
- * @function ServerStyle.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- if (me.fillBackColor) {
- me.fillBackColor.destroy();
- me.fillBackColor = null;
- }
- me.fillBackOpaque = null;
- if (me.fillForeColor) {
- me.fillForeColor.destroy();
- me.fillForeColor = null;
- }
- me.fillGradientMode = null;
- me.fillGradientAngle = null;
- me.fillGradientOffsetRatioX = null;
- me.fillGradientOffsetRatioY = null;
- me.fillOpaqueRate = null;
- me.fillSymbolID = null;
- if (me.lineColor) {
- me.lineColor.destroy();
- me.lineColor = null;
- }
- me.lineSymbolID = null;
- me.lineWidth = null;
- me.markerAngle = null;
- me.markerSize = null;
- me.markerSymbolID = null;
- }
- /**
- * @function ServerStyle.prototype.toServerJSONObject
- * @description 转换成对应的 JSON 格式对象。
- * @returns {Object} 对应的 JSON 格式对象.
- */
- toServerJSONObject() {
- var styleObj = {};
- styleObj = Util.copyAttributes(styleObj, this);
- //暂时先忽略serverColor往Json的转换
- return styleObj;
- }
- /**
- * @function ServerStyle.fromJson
- * @description 将JSON对象转换为 ServerStyle 对象。
- * @param {Object} jsonObject - 要转换的 JSON 对象。
- * @returns {ServerStyle} 转化后的 ServerStyle 对象。
- */
- static fromJson(jsonObject) {
- if (!jsonObject) {
- return;
- }
- return new ServerStyle({
- fillBackColor: ServerColor.fromJson(jsonObject.fillBackColor),
- fillBackOpaque: jsonObject.fillBackOpaque,
- fillForeColor: ServerColor.fromJson(jsonObject.fillForeColor),
- fillGradientMode: jsonObject.fillGradientMode,
- fillGradientAngle: jsonObject.fillGradientAngle,
- fillGradientOffsetRatioX: jsonObject.fillGradientOffsetRatioX,
- fillGradientOffsetRatioY: jsonObject.fillGradientOffsetRatioY,
- fillOpaqueRate: jsonObject.fillOpaqueRate,
- fillSymbolID: jsonObject.fillSymbolID,
- lineColor: ServerColor.fromJson(jsonObject.lineColor),
- lineSymbolID: jsonObject.lineSymbolID,
- lineWidth: jsonObject.lineWidth,
- markerAngle: jsonObject.markerAngle,
- markerSize: jsonObject.markerSize,
- markerSymbolID: jsonObject.markerSymbolID
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/PointWithMeasure.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class PointWithMeasure
- * @deprecatedclass SuperMap.PointWithMeasure
- * @category iServer SpatialAnalyst RouteLocator
- * @classdesc 路由点类。路由点是指具有线性度量值 (Measure) 的二维地理坐标点。
- * @param {Object} options - 参数。
- * @param {number} options.measure - 度量值,即路由对象属性值 M。
- * @param {number} options.x - 地理坐标系下的 X 坐标值。
- * @param {number} options.y - 地理坐标系下的 Y 坐标值。
- * @extends {GeometryPoint}
- * @usage
- */
- class PointWithMeasure extends Point {
- constructor(options) {
- super(options);
- /**
- * @member {number} PointWithMeasure.prototype.measure
- * @description 度量值,即路由对象属性值 M。
- */
- this.measure = null;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.PointWithMeasure";
- }
- /**
- * @function PointWithMeasure.prototype.equals
- * @description 判断两个路由点对象是否相等。如果两个路由点对象具有相同的坐标以及度量值,则认为是相等的。
- * @param {PointWithMeasure} geom - 需要判断的路由点对象。
- * @returns {boolean} 两个路由点对象是否相等(true 为相等,false 为不等)。
- */
- equals(geom) {
- var equals = false;
- if (geom != null) {
- var isValueEquals = this.x === geom.x && this.y === geom.y && this.measure === geom.measure;
- var isNaNValue = isNaN(this.x) && isNaN(this.y) && isNaN(this.measure);
- var isNaNGeometry = isNaN(geom.x) && isNaN(geom.y) && isNaN(geom.measure);
- equals = ( isValueEquals || ( isNaNValue && isNaNGeometry ));
- }
- return equals;
- }
- /**
- * @function PointWithMeasure.prototype.toJson
- * @description 转换为 JSON 对象。
- * */
- toJson() {
- var result = "{";
- if (this.measure != null && this.measure != undefined) {
- result += "\"measure\":" + this.measure + ",";
- }
- result += "\"x\":" + this.x + ",";
- result += "\"y\":" + this.y;
- result += "}";
- return result;
- }
- /**
- * @function PointWithMeasure.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.measure = null;
- me.x = null;
- me.y = null;
- }
- /**
- * @function PointWithMeasure.fromJson
- * @description 将 JSON 对象转换为{@link PointWithMeasure} 对象。
- * @param {Object} jsonObject - JSON 对象表示的路由点。
- * @returns {PointWithMeasure} 转化后的 PointWithMeasure 对象。
- */
- static fromJson(jsonObject) {
- if (!jsonObject) {
- return;
- }
- return new PointWithMeasure({
- x: jsonObject.x,
- y: jsonObject.y,
- measure: jsonObject.measure
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/Route.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class Route
- * @deprecatedclass SuperMap.Route
- * @category iServer SpatialAnalyst RouteCalculateMeasure
- * @classdesc 路由对象类。路由对象为一系列有序的带有属性值 M 的 x,y 坐标对,其中 M 值为该结点的距离属性(到已知点的距离)。
- * @param {Array.<Geometry>} points - 形成路由对象的线数组。
- * @param {Object} options - 参数。
- * @param {number} options.id - 路由对象在数据库中的 id。
- * @param {number} options.length - 路由对象的长度。单位与数据集的单位相同。
- * @param {number} [options.maxM] - 最大线性度量值,即所有结点到起始点的量算距离中最大值。
- * @param {number} [options.minM] - 最小线性度量值,即所有结点到起始点的量算距离中最小值。
- * @param {string} [options.type] - 数据类型,如:"LINEM"。
- * @extends GeometryCollection
- * @usage
- */
- class Route extends Collection {
- constructor(points, options) {
- super(points, options);
- /**
- * @member {number} Route.prototype.id
- * @description 路由对象在数据库中的 ID。
- */
- this.id = null;
- /**
- * @member {number} Route.prototype.center
- * @description 路由对象的中心点。
- */
- this.center = null;
- /**
- * @member {string} Route.prototype.style
- * @description 路由对象的样式。
- */
- this.style = null;
- /**
- * @member {number} Route.prototype.length
- * @description 路由对象的长度。单位与数据集的单位相同。
- */
- this.length = null;
- /**
- * @member {number} Route.prototype.maxM
- * @description 最大线性度量值,即所有结点到起始点的量算距离中最大值。
- */
- this.maxM = null;
- /**
- * @member {number} Route.prototype.minM
- * @description 最小线性度量值,即所有结点到起始点的量算距离中最小值。
- */
- this.minM = null;
- /**
- * @member {Array.<number>} Route.prototype.parts
- * @description 服务端几何对象中各个子对象所包含的节点个数。
- */
- this.parts = null;
- /**
- * @member {Array.<Object>} Route.prototype.points
- * @description 路由对象的所有路由点。
- * @example
- * (start code)
- * [
- * {
- * "measure": 0,
- * "y": -4377.027184298267,
- * "x": 4020.0045221720466
- * },
- * {
- * "measure": 37.33288381391519,
- * "y": -4381.569363260499,
- * "x": 4057.0600591960642
- * }
- * ]
- * (end)
- */
- this.points = null;
- /**
- * @member {string} Route.prototype.type
- * @description 服务端几何对象类型。
- */
- this.type = null;
- /**
- * @member {Array.<string>} [Route.prototype.componentTypes=LineString]
- * @description components 存储的的几何对象所支持的几何类型数组。
- */
- this.componentTypes = ["SuperMap.Geometry.LinearRing", "SuperMap.Geometry.LineString"];
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.Route";
- this.geometryType = "LINEM";
- }
- /**
- *
- * @function Route.prototype.toJson
- * @description 转换为 JSON 对象。
- * @returns {Object} JSON 对象。
- */
- toJson() {
- var result = "{";
- if (this.id != null && this.id != undefined) {
- result += "\"id\":" + this.id + ",";
- }
- if (this.center != null && this.center != undefined) {
- result += "\"center\":" + this.center + ",";
- }
- if (this.style != null && this.style != undefined) {
- result += "\"style\":" + this.style + ",";
- }
- if (this.length != null && this.length != undefined) {
- result += "\"length\":" + this.length + ",";
- }
- if (this.maxM != null && this.maxM != undefined) {
- result += "\"maxM\":" + this.maxM + ",";
- }
- if (this.minM != null && this.minM != undefined) {
- result += "\"minM\":" + this.minM + ",";
- }
- if (this.type != null && this.type != undefined) {
- result += "\"type\":\"" + this.type + "\",";
- }
- if (this.parts != null && this.parts != undefined) {
- result += "\"parts\":[" + this.parts[0];
- for (var i = 1; i < this.parts.length; i++) {
- result += "," + this.parts[i];
- }
- result += "],";
- }
- if (this.components != null && this.components.length > 0) {
- result += "\"points\":[";
- for (var j = 0, len = this.components.length; j < len; j++) {
- for (var k = 0, len2 = this.components[j].components.length; k < len2; k++) {
- result += this.components[j].components[k].toJson() + ",";
- }
- }
- result = result.replace(/,$/g, '');
- result += "]";
- }
- result = result.replace(/,$/g, '');
- result += "}";
- return result;
- }
- /**
- * @function Route.prototype.destroy
- * @override
- */
- destroy() {
- var me = this;
- me.id = null;
- me.center = null;
- me.style = null;
- me.length = null;
- me.maxM = null;
- me.minM = null;
- me.type = null;
- me.parts = null;
- me.components.length = 0;
- me.components = null;
- me.componentTypes = null;
- }
- /**
- * @function Route.fromJson
- * @description 将 JSON 对象转换为 Route 对象。
- * @param {Object} [jsonObject] - JSON 对象表示的路由对象。
- * @returns {Route} 转化后的 Route 对象。
- */
- static fromJson(jsonObject) {
- if (!jsonObject) {
- return;
- }
- var geoParts = jsonObject.parts || [],
- geoPoints = jsonObject.points || [],
- len = geoParts.length,
- lineList = [];
- if (len > 0) {
- for (var i = 0, pointIndex = 0, pointList = []; i < len; i++) {
- for (var j = 0; j < geoParts[i]; j++) {
- pointList.push(PointWithMeasure.fromJson(geoPoints[pointIndex + j]));
- }
- pointIndex += geoParts[i];
- //判断线是否闭合,如果闭合,则返回LinearRing,否则返回LineString
- if (pointList[0].equals(pointList[geoParts[i] - 1])) {
- lineList.push(new LinearRing(pointList));
- } else {
- lineList.push(new LineString(pointList));
- }
- pointList = [];
- }
- } else {
- return null;
- }
- return new Route(lineList, {
- id: jsonObject.id,
- center: jsonObject.center,
- style: jsonObject.style,
- length: jsonObject.length,
- maxM: jsonObject.maxM,
- minM: jsonObject.minM,
- type: jsonObject.type,
- parts: jsonObject.parts
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ServerGeometry.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ServerGeometry
- * @deprecatedclass SuperMap.ServerGeometry
- * @category iServer Data Feature
- * @classdesc 服务端几何对象类。该类描述几何对象(矢量)的特征数据(坐标点对、几何对象的类型等)。基于服务端的空间分析、空间关系运算、查询等 GIS 服务功能使用服务端几何对象。
- * @param {Object} options - 参数。
- * @param {string} options.id - 服务端几何对象唯一标识符。
- * @param {Array.<number>} options.parts - 服务端几何对象中各个子对象所包含的节点个数。
- * @param {Array.<GeometryPoint>} options.points - 组成几何对象的节点的坐标对数组。
- * @param {GeometryType} options.type - 几何对象的类型。
- * @param {ServerStyle} [options.style] - 服务端几何对象的风格。
- * @usage
- */
- class ServerGeometry {
- constructor(options) {
- /**
- * @member {string} ServerGeometry.prototype.id
- * @description 服务端几何对象唯一标识符。
- */
- this.id = 0;
- /**
- * @member {ServerStyle} [ServerGeometry.prototype.style]
- * @description 服务端几何对象的风格(ServerStyle)。
- */
- this.style = null;
- /**
- * @member {Array.<number>} ServerGeometry.prototype.parts
- * @description 服务端几何对象中各个子对象所包含的节点个数。<br>
- * 1.几何对象从结构上可以分为简单几何对象和复杂几何对象。
- * 简单几何对象与复杂几何对象的区别:简单的几何对象一般为单一对象,
- * 而复杂的几何对象由多个简单对象组成或经过一定的空间运算之后产生,
- * 如:矩形为简单的区域对象,而中空的矩形为复杂的区域对象。<br>
- * 2.通常情况,一个简单几何对象的子对象就是它本身,
- * 因此对于简单对象来说的该字段为长度为1的整型数组,
- * 该字段的值就是这个简单对象节点的个数。
- * 如果一个几何对象是由几个简单对象组合而成的,
- * 例如,一个岛状几何对象由 3 个简单的多边形组成而成,
- * 那么这个岛状的几何对象的 Parts 字段值就是一个长度为 3 的整型数组,
- * 数组中每个成员的值分别代表这三个多边形所包含的节点个数。
- */
- this.parts = null;
- /**
- * @member {Array.<GeometryPoint>} ServerGeometry.prototype.points
- * @description 组成几何对象的节点的坐标对数组。<br>
- * 1.所有几何对象(点、线、面)都是由一些简单的点坐标组成的,
- * 该字段存放了组成几何对象的点坐标的数组。
- * 对于简单的面对象,他的起点和终点的坐标点相同。<br>
- * 2.对于复杂的几何对象,根据 Parts 属性来确定每一个组成复杂几何对象的简单对象所对应的节点的个数,
- * 从而确定 Points 字段中坐标对的分配归属问题。
- */
- this.points = null;
- /**
- * @member {GeometryType} ServerGeometry.prototype.type
- * @description 几何对象的类型(GeometryType)。
- */
- this.type = null;
- /**
- * @member {Object} ServerGeometry.prototype.prjCoordSys
- * @description 投影坐标参数,现仅在缓冲区分析中有效。
- */
- this.prjCoordSys = null;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = 'SuperMap.ServerGeometry';
- }
- /**
- * @function ServerGeometry.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.id = null;
- me.style = null;
- me.parts = null;
- me.partTopo = null;
- me.points = null;
- me.type = null;
- me.prjCoordSys = null;
- }
- /**
- * @function ServerGeometry.prototype.toGeometry
- * @description 将服务端几何对象 ServerGeometry 转换为客户端几何对象 Geometry。
- * @returns {Geometry} 转换后的客户端几何对象。
- */
- toGeometry() {
- var me = this,
- geoType = me.type;
- switch (geoType.toUpperCase()) {
- case GeometryType.POINT:
- return me.toGeoPoint();
- case GeometryType.LINE:
- return me.toGeoLine();
- case GeometryType.LINEM:
- return me.toGeoLinem();
- case GeometryType.REGION:
- return me.toGeoRegion();
- case GeometryType.POINTEPS:
- return me.toGeoPoint();
- case GeometryType.LINEEPS:
- return me.toGeoLineEPS();
- case GeometryType.REGIONEPS:
- return me.toGeoRegionEPS();
- case GeometryType.GEOCOMPOUND:
- return me.transformGeoCompound();
- }
- }
- /**
- * @function ServerGeometry.prototype.toGeoPoint
- * @description 将服务端的点几何对象转换为客户端几何对象。包括 Point、MultiPoint。
- * @returns {Geometry} 转换后的客户端几何对象。
- */
- toGeoPoint() {
- var me = this,
- geoParts = me.parts || [],
- geoPoints = me.points || [],
- len = geoParts.length;
- if (len > 0) {
- if (len === 1) {
- return new Point(geoPoints[0].x, geoPoints[0].y);
- } else {
- var pointList = [];
- for (let i = 0; i < len; i++) {
- pointList.push(new Point(geoPoints[i].x, geoPoints[i].y));
- }
- return new MultiPoint(pointList);
- }
- } else {
- return null;
- }
- }
- /**
- * @function ServerGeometry.prototype.toGeoLine
- * @description 将服务端的线几何对象转换为客户端几何对象。包括 GeometryLinearRing、GeometryLineString、GeometryMultiLineString。
- * @returns {Geometry} 转换后的客户端几何对象。
- */
- toGeoLine() {
- var me = this,
- geoParts = me.parts || [],
- geoPoints = me.points || [],
- len = geoParts.length;
- if (len > 0) {
- if (len === 1) {
- let pointList = [];
- for (let i = 0; i < geoParts[0]; i++) {
- pointList.push(new Point(geoPoints[i].x, geoPoints[i].y));
- }
- //判断线是否闭合,如果闭合,则返回LinearRing,否则返回LineString
- if (pointList[0].equals(pointList[geoParts[0] - 1])) {
- return new LinearRing(pointList);
- } else {
- return new LineString(pointList);
- }
- } else {
- let lineList = [];
- for (let i = 0; i < len; i++) {
- let pointList = [];
- for (let j = 0; j < geoParts[i]; j++) {
- pointList.push(new Point(geoPoints[j].x, geoPoints[j].y));
- }
- lineList.push(new LineString(pointList));
- geoPoints.splice(0, geoParts[i]);
- }
- return new MultiLineString(lineList);
- }
- } else {
- return null;
- }
- }
- /**
- * @function ServerGeometry.prototype.toGeoLineEPS
- * @description 将服务端的线几何对象转换为客户端几何对象。包括 GeometryLinearRing、GeometryLineString、GeometryMultiLineString。
- * @returns {Geometry} 转换后的客户端几何对象。
- */
- toGeoLineEPS() {
- var me = this,
- geoParts = me.parts || [],
- geoPoints = me.points || [],
- i,
- j,
- pointList,
- lineList,
- lineEPS,
- len = geoParts.length;
- if (len > 0) {
- if (len === 1) {
- for (i = 0, pointList = []; i < geoParts[0]; i++) {
- pointList.push(new Point(geoPoints[i].x, geoPoints[i].y, geoPoints[i].type));
- }
- //判断线是否闭合,如果闭合,则返回LinearRing,否则返回LineString
- if (pointList[0].equals(pointList[geoParts[0] - 1])) {
- lineEPS = LineString.createLineEPS(pointList);
- return new LinearRing(lineEPS);
- } else {
- lineEPS = LineString.createLineEPS(pointList);
- return new LineString(lineEPS);
- }
- } else {
- for (i = 0, lineList = []; i < len; i++) {
- for (j = 0, pointList = []; j < geoParts[i]; j++) {
- pointList.push(new Point(geoPoints[j].x, geoPoints[j].y));
- }
- lineEPS = LineString.createLineEPS(pointList);
- lineList.push(new LineString(lineEPS));
- geoPoints.splice(0, geoParts[i]);
- }
- return new MultiLineString(lineList);
- }
- } else {
- return null;
- }
- }
- /**
- * @function ServerGeometry.prototype.toGeoLinem
- * @description 将服务端的路由线几何对象转换为客户端几何对象。包括 LinearRing、LineString、MultiLineString。
- * @returns {Geometry} 转换后的客户端几何对象。
- */
- toGeoLinem() {
- var me = this;
- return Route.fromJson(me);
- }
- /**
- * @function ServerGeometry.prototype.toGeoRegion
- * @description 将服务端的面几何对象转换为客户端几何对象。类型为 GeometryPolygon。
- * @returns {Geometry} 转换后的客户端几何对象。
- */
- toGeoRegion() {
- var me = this,
- geoParts = me.parts || [],
- geoTopo = me.partTopo || [],
- geoPoints = me.points || [],
- len = geoParts.length;
- if (len <= 0) {
- return null;
- }
- var polygonArray = [];
- var pointList = [];
- if (len == 1) {
- for (let i = 0; i < geoPoints.length; i++) {
- pointList.push(new Point(geoPoints[i].x, geoPoints[i].y));
- }
- polygonArray.push(new Polygon([new LinearRing(pointList)]));
- return new MultiPolygon(polygonArray);
- }
- //处理复杂面
- var CCWArray = [];
- var areaArray = [];
- var polygonArrayTemp = [];
- var polygonBounds = [];
- //polyon岛洞标识数组,初始都是岛。
- var CCWIdent = [];
- for (let i = 0, pointIndex = 0; i < len; i++) {
- for (let j = 0; j < geoParts[i]; j++) {
- pointList.push(new Point(geoPoints[pointIndex + j].x, geoPoints[pointIndex + j].y));
- }
- pointIndex += geoParts[i];
- var polygon = new Polygon([new LinearRing(pointList)]);
- pointList = [];
- polygonArrayTemp.push(polygon);
- if (geoTopo.length === 0) {
- polygonBounds.push(polygon.getBounds());
- }
- CCWIdent.push(1);
- areaArray.push(polygon.getArea());
- }
- //iServer 9D新增字段
- if (geoTopo.length === 0) {
- //根据面积排序
- ServerGeometry.bubbleSort(areaArray, polygonArrayTemp, geoTopo, polygonBounds);
- //岛洞底层判断原则:将所有的子对象按照面积排序,面积最大的直接判定为岛(1),从面积次大的开始处理,
- // 如果发现该对象在某个面积大于它的对象之中(即被包含),则根据包含它的对象的标识(1 or -1),指定其标识(-1 or 1),
- // 依次处理完所有对象,就得到了一个标识数组,1表示岛,-1表示洞
- //目标polygon索引列表 -1标示没有被任何polygon包含,
- var targetArray = [];
- for (let i = 1; i < polygonArrayTemp.length; i++) {
- for (let j = i - 1; j >= 0; j--) {
- targetArray[i] = -1;
- if (polygonBounds[j].containsBounds(polygonBounds[i])) {
- CCWIdent[i] = CCWIdent[j] * -1;
- if (CCWIdent[i] < 0) {
- targetArray[i] = j;
- }
- break;
- }
- }
- }
- for (let i = 0; i < polygonArrayTemp.length; i++) {
- if (CCWIdent[i] > 0) {
- polygonArray.push(polygonArrayTemp[i]);
- } else {
- polygonArray[targetArray[i]].components = polygonArray[targetArray[i]].components.concat(
- polygonArrayTemp[i].components
- );
- //占位
- polygonArray.push('');
- }
- }
- } else {
- polygonArray = new Array();
- for (let i = 0; i < polygonArrayTemp.length; i++) {
- if (geoTopo[i] && geoTopo[i] == -1) {
- CCWArray = CCWArray.concat(polygonArrayTemp[i].components);
- } else {
- if (CCWArray.length > 0 && polygonArray.length > 0) {
- polygonArray[polygonArray.length - 1].components =
- polygonArray[polygonArray.length - 1].components.concat(CCWArray);
- CCWArray = [];
- }
- polygonArray.push(polygonArrayTemp[i]);
- }
- if (i == len - 1) {
- var polyLength = polygonArray.length;
- if (polyLength) {
- polygonArray[polyLength - 1].components =
- polygonArray[polyLength - 1].components.concat(CCWArray);
- } else {
- for (let k = 0, length = CCWArray.length; k < length; k++) {
- polygonArray.push(new Polygon(CCWArray));
- }
- }
- }
- }
- }
- return new MultiPolygon(polygonArray);
- }
- /**
- * @function ServerGeometry.prototype.toGeoRegionEPS
- * @description 将服务端的面几何对象转换为客户端几何对象。类型为 Polygon。
- * @returns {Geometry} 转换后的客户端几何对象。
- */
- toGeoRegionEPS() {
- var me = this,
- geoParts = me.parts || [],
- geoTopo = me.partTopo || [],
- geoPoints = me.points || [],
- len = geoParts.length;
- if (len <= 0) {
- return null;
- }
- var polygonArray = [];
- var pointList = [];
- var lineEPS;
- if (len == 1) {
- for (var i = 0; i < geoPoints.length; i++) {
- pointList.push(new Point(geoPoints[i].x, geoPoints[i].y));
- }
- lineEPS = LineString.createLineEPS(pointList);
- polygonArray.push(new Polygon([new LinearRing(lineEPS)]));
- return new MultiPolygon(polygonArray);
- }
- //处理复杂面
- var CCWArray = [];
- var areaArray = [];
- var polygonArrayTemp = [];
- var polygonBounds = [];
- //polyon岛洞标识数组,初始都是岛。
- var CCWIdent = [];
- for (let i = 0, pointIndex = 0; i < len; i++) {
- for (let j = 0; j < geoParts[i]; j++) {
- pointList.push(new Point(geoPoints[pointIndex + j].x, geoPoints[pointIndex + j].y));
- }
- pointIndex += geoParts[i];
- lineEPS = LineString.createLineEPS(pointList);
- var polygon = new Polygon([new LinearRing(lineEPS)]);
- pointList = [];
- polygonArrayTemp.push(polygon);
- if (geoTopo.length === 0) {
- polygonBounds.push(polygon.getBounds());
- }
- CCWIdent.push(1);
- areaArray.push(polygon.getArea());
- }
- //iServer 9D新增字段
- if (geoTopo.length === 0) {
- //根据面积排序
- ServerGeometry.bubbleSort(areaArray, polygonArrayTemp, geoTopo, polygonBounds);
- //岛洞底层判断原则:将所有的子对象按照面积排序,面积最大的直接判定为岛(1),从面积次大的开始处理,
- // 如果发现该对象在某个面积大于它的对象之中(即被包含),则根据包含它的对象的标识(1 or -1),指定其标识(-1 or 1),
- // 依次处理完所有对象,就得到了一个标识数组,1表示岛,-1表示洞
- //目标polygon索引列表 -1标示没有被任何polygon包含,
- var targetArray = [];
- for (let i = 1; i < polygonArrayTemp.length; i++) {
- for (let j = i - 1; j >= 0; j--) {
- targetArray[i] = -1;
- if (polygonBounds[j].containsBounds(polygonBounds[i])) {
- CCWIdent[i] = CCWIdent[j] * -1;
- if (CCWIdent[i] < 0) {
- targetArray[i] = j;
- }
- break;
- }
- }
- }
- for (let i = 0; i < polygonArrayTemp.length; i++) {
- if (CCWIdent[i] > 0) {
- polygonArray.push(polygonArrayTemp[i]);
- } else {
- polygonArray[targetArray[i]].components = polygonArray[targetArray[i]].components.concat(
- polygonArrayTemp[i].components
- );
- //占位
- polygonArray.push('');
- }
- }
- } else {
- polygonArray = new Array();
- for (let i = 0; i < polygonArrayTemp.length; i++) {
- if (geoTopo[i] && geoTopo[i] == -1) {
- CCWArray = CCWArray.concat(polygonArrayTemp[i].components);
- } else {
- if (CCWArray.length > 0 && polygonArray.length > 0) {
- polygonArray[polygonArray.length - 1].components =
- polygonArray[polygonArray.length - 1].components.concat(CCWArray);
- CCWArray = [];
- }
- polygonArray.push(polygonArrayTemp[i]);
- }
- if (i == len - 1) {
- var polyLength = polygonArray.length;
- if (polyLength) {
- polygonArray[polyLength - 1].components =
- polygonArray[polyLength - 1].components.concat(CCWArray);
- } else {
- for (let k = 0, length = CCWArray.length; k < length; k++) {
- polygonArray.push(new Polygon(CCWArray));
- }
- }
- }
- }
- }
- return new MultiPolygon(polygonArray);
- }
- transformGeoCompound() {
- const me = this,
- geoParts = me.geoParts || [],
- len = geoParts.length;
- if (len <= 0) {
- return null;
- }
- const geometryList = [];
- for (let index = 0; index < len; index++) {
- const geometry = geoParts[index];
- geometryList.push(new ServerGeometry(geometry).toGeometry());
- }
- return new Collection(geometryList);
- }
- /**
- * @function ServerGeometry.prototype.fromJson
- * @description 将 JSON 对象表示服务端几何对象转换为 ServerGeometry。
- * @param {Object} jsonObject - 要转换的 JSON 对象。
- * @returns {ServerGeometry} 转换后的 ServerGeometry 对象。
- */
- static fromJson(jsonObject) {
- if (!jsonObject) {
- return;
- }
- return new ServerGeometry({
- id: jsonObject.id,
- style: ServerStyle.fromJson(jsonObject.style),
- parts: jsonObject.parts,
- partTopo: jsonObject.partTopo,
- points: jsonObject.points,
- center: jsonObject.center,
- length: jsonObject.length,
- maxM: jsonObject.maxM,
- minM: jsonObject.minM,
- type: jsonObject.type
- });
- }
- /**
- * @function ServerGeometry.prototype.fromGeometry
- * @description 将客户端 Geometry 转换成服务端 ServerGeometry。
- * @param {Geometry} geometry - 要转换的客户端 Geometry 对象。
- * @returns {ServerGeometry} 转换后的 ServerGeometry 对象。
- */
- static fromGeometry(geometry) {
- if (!geometry) {
- return;
- }
- var id = 0,
- parts = [],
- points = [],
- type = null,
- icomponents = geometry.components,
- className = geometry.CLASS_NAME,
- prjCoordSys = { epsgCode: geometry.SRID };
- if (!isNaN(geometry.id)) {
- id = geometry.id;
- }
- //坑爹的改法,没法,为了支持态势标绘,有时间就得全改
- if (
- className != 'SuperMap.Geometry.LinearRing' &&
- className != 'SuperMap.Geometry.LineString' &&
- (geometry instanceof MultiPoint || geometry instanceof MultiLineString)
- ) {
- let ilen = icomponents.length;
- for (let i = 0; i < ilen; i++) {
- const vertices = icomponents[i].getVertices();
- let partPointsCount = vertices.length;
- parts.push(partPointsCount);
- for (let j = 0; j < partPointsCount; j++) {
- points.push(new Point(vertices[j].x, vertices[j].y));
- }
- }
- //这里className不是多点就全部是算线
- type = className == 'SuperMap.Geometry.MultiPoint' ? GeometryType.POINT : GeometryType.LINE;
- } else if (geometry instanceof MultiPolygon) {
- let ilen = icomponents.length;
- for (let i = 0; i < ilen; i++) {
- let polygon = icomponents[i],
- linearRingOfPolygon = polygon.components,
- linearRingOfPolygonLen = linearRingOfPolygon.length;
- for (let j = 0; j < linearRingOfPolygonLen; j++) {
- const vertices = linearRingOfPolygon[j].getVertices();
- const partPointsCount = vertices.length + 1;
- parts.push(partPointsCount);
- for (let k = 0; k < partPointsCount - 1; k++) {
- points.push(new Point(vertices[k].x, vertices[k].y));
- }
- points.push(
- new Point(vertices[0].x, vertices[0].y)
- );
- }
- }
- type = GeometryType.REGION;
- } else if (geometry instanceof Polygon) {
- let ilen = icomponents.length;
- for (let i = 0; i < ilen; i++) {
- const vertices = icomponents[i].getVertices();
- let partPointsCount = vertices.length + 1;
- parts.push(partPointsCount);
- for (let j = 0; j < partPointsCount - 1; j++) {
- points.push(new Point(vertices[j].x, vertices[j].y));
- }
- points.push(new Point(vertices[0].x, vertices[0].y));
- }
- type = GeometryType.REGION;
- } else {
- const vertices = geometry.getVertices();
- let geometryVerticesCount = vertices.length;
- for (let j = 0; j < geometryVerticesCount; j++) {
- points.push(new Point(vertices[j].x, vertices[j].y));
- }
- if (geometry instanceof LinearRing) {
- points.push(new Point(vertices[0].x, vertices[0].y));
- geometryVerticesCount++;
- }
- parts.push(geometryVerticesCount);
- type = geometry instanceof Point ? GeometryType.POINT : GeometryType.LINE;
- }
- return new ServerGeometry({
- id: id,
- style: null,
- parts: parts,
- points: points,
- type: type,
- prjCoordSys: prjCoordSys
- });
- }
- /**
- * @function ServerGeometry.prototype.IsClockWise
- * @description 判断 linearRing 中的点的顺序。返回值大于 0,逆时针;小于 0,顺时针。
- * @param {Geometry} geometry - 要转换的客户端 Geometry 对象。
- * @returns {number} 返回值大于 0,逆时针;小于 0,顺时针。
- */
- static IsClockWise(points) {
- var length = points.length;
- if (length < 3) {
- return 0.0;
- }
- var s = points[0].y * (points[length - 1].x - points[1].x);
- points.push(points[0]);
- for (var i = 1; i < length; i++) {
- s += points[i].y * (points[i - 1].x - points[i + 1].x);
- }
- return s * 0.5;
- }
- static bubbleSort(areaArray, pointList, geoTopo, polygonBounds) {
- for (var i = 0; i < areaArray.length; i++) {
- for (var j = 0; j < areaArray.length; j++) {
- if (areaArray[i] > areaArray[j]) {
- var d = areaArray[j];
- areaArray[j] = areaArray[i];
- areaArray[i] = d;
- var b = pointList[j];
- pointList[j] = pointList[i];
- pointList[i] = b;
- if (geoTopo && geoTopo.length > 0) {
- var c = geoTopo[j];
- geoTopo[j] = geoTopo[i];
- geoTopo[i] = c;
- }
- if (polygonBounds && polygonBounds.length > 0) {
- var f = polygonBounds[j];
- polygonBounds[j] = polygonBounds[i];
- polygonBounds[i] = f;
- }
- }
- }
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/format/GeoJSON.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GeoJSONFormat
- * @aliasclass Format.GeoJSON
- * @deprecatedclass SuperMap.Format.GeoJSON
- * @classdesc GeoJSON 的读和写。使用 {@link GeoJSONObject} 构造器创建一个 GeoJSON 解析器。
- * @category BaseTypes Format
- * @param {Object} [options] - 可选参数。
- * @param {string} [options.indent=" "] - 用于格式化输出,indent 字符串会在每次缩进的时候使用一次。
- * @param {string} [options.space=" "] - 用于格式化输出,space 字符串会在名值对的 ":" 后边添加。
- * @param {string} [options.newline="\n"] - 用于格式化输出, newline 字符串会用在每一个名值对或数组项末尾。
- * @param {number} [options.level=0] - 用于格式化输出, 表示的是缩进级别。
- * @param {boolean} [options.pretty=false] - 是否在序列化的时候使用额外的空格控制结构。在 write 方法中使用。
- * @param {boolean} [options.nativeJSON] - 需要被注册的监听器对象。
- * @param {boolean} [options.ignoreExtraDims=true] - 忽略维度超过 2 的几何要素。
- * @extends {JSONFormat}
- * @usage
- */
- class GeoJSON extends JSONFormat {
- constructor(options) {
- super(options);
- /**
- * @member {boolean} [GeoJSONFormat.prototype.ignoreExtraDims=true]
- * @description 忽略维度超过 2 的几何要素。
- */
- this.ignoreExtraDims = true;
- this.CLASS_NAME = "SuperMap.Format.GeoJSON";
- /**
- * @member {Object} GeoJSONFormat.prototype.parseCoords
- * @private
- * @description 一个属性名对应着 GeoJSON 对象的几何类型的对象。每个属性其实都是一个实际上做解析用的方法。
- */
- this.parseCoords = {
- /**
- * @function GeoJSONFormat.parseCoords.point
- * @description 将一组坐标转成一个 {@link Geometry} 对象。
- * @param {Object} array - GeoJSON 片段中的一组坐标。
- * @returns {Geometry} 一个几何对象。
- */
- "point": function (array) {
- if (this.ignoreExtraDims === false &&
- array.length != 2) {
- throw "Only 2D points are supported: " + array;
- }
- return new Point(array[0], array[1]);
- },
- /**
- * @function GeoJSONFormat.parseCoords.multipoint
- * @description 将坐标组数组转化成为一个 {@link Geometry} 对象。
- * @param {Object} array - GeoJSON 片段中的坐标组数组。
- * @returns {Geometry} 一个几何对象。
- */
- "multipoint": function (array) {
- var points = [];
- var p = null;
- for (var i = 0, len = array.length; i < len; ++i) {
- try {
- p = this.parseCoords["point"].apply(this, [array[i]]);
- } catch (err) {
- throw err;
- }
- points.push(p);
- }
- return new MultiPoint(points);
- },
- /**
- * @function GeoJSONFormat.parseCoords.linestring
- * @description 将坐标组数组转化成为一个 {@link Geometry} 对象。
- * @param {Object} array - GeoJSON 片段中的坐标组数组。
- * @returns {Geometry} 一个几何对象。
- */
- "linestring": function (array) {
- var points = [];
- var p = null;
- for (var i = 0, len = array.length; i < len; ++i) {
- try {
- p = this.parseCoords["point"].apply(this, [array[i]]);
- } catch (err) {
- throw err;
- }
- points.push(p);
- }
- return new LineString(points);
- },
- /**
- * @function GeoJSONFormat.parseCoords.multilinestring
- * @description 将坐标组数组转化成为一个 {@link Geometry} 对象。
- * @param {Object} array - GeoJSON 片段中的坐标组数组。
- * @returns {Geometry} 一个几何对象。
- */
- "multilinestring": function (array) {
- var lines = [];
- var l = null;
- for (var i = 0, len = array.length; i < len; ++i) {
- try {
- l = this.parseCoords["linestring"].apply(this, [array[i]]);
- } catch (err) {
- throw err;
- }
- lines.push(l);
- }
- return new MultiLineString(lines);
- },
- /**
- * @function GeoJSONFormat.parseCoords.polygon
- * @description 将坐标组数组转化成为一个 {@link Geometry} 对象。
- * @returns {Geometry} 一个几何对象。
- */
- "polygon": function (array) {
- var rings = [];
- var r, l;
- for (var i = 0, len = array.length; i < len; ++i) {
- try {
- l = this.parseCoords["linestring"].apply(this, [array[i]]);
- } catch (err) {
- throw err;
- }
- r = new LinearRing(l.components);
- rings.push(r);
- }
- return new Polygon(rings);
- },
- /**
- * @function GeoJSONFormat.parseCoords.multipolygon
- * @description 将坐标组数组转化成为一个 {@link Geometry} 对象。
- * @param {Object} array - GeoJSON 片段中的坐标组数组。
- * @returns {Geometry} 一个几何对象。
- */
- "multipolygon": function (array) {
- var polys = [];
- var p = null;
- for (var i = 0, len = array.length; i < len; ++i) {
- try {
- p = this.parseCoords["polygon"].apply(this, [array[i]]);
- } catch (err) {
- throw err;
- }
- polys.push(p);
- }
- return new MultiPolygon(polys);
- },
- /**
- * @function GeoJSONFormat.parseCoords.box
- * @description 将坐标组数组转化成为一个 {@link Geometry} 对象。
- * @param {Array} array - GeoJSON 片段中的坐标组数组。
- * @returns {Geometry} 一个几何对象。
- */
- "box": function (array) {
- if (array.length != 2) {
- throw "GeoJSON box coordinates must have 2 elements";
- }
- return new Polygon([
- new LinearRing([
- new Point(array[0][0], array[0][1]),
- new Point(array[1][0], array[0][1]),
- new Point(array[1][0], array[1][1]),
- new Point(array[0][0], array[1][1]),
- new Point(array[0][0], array[0][1])
- ])
- ]);
- }
- };
- /**
- * @member {Object} GeoJSONFormat.prototype.extract
- * @private
- * @description 一个属性名对应着GeoJSON类型的对象。其值为相应的实际的解析方法。
- */
- this.extract = {
- /**
- * @function GeoJSONFormat.extract.feature
- * @description 返回一个表示单个要素对象的 GeoJSON 的一部分。
- * @param {SuperMap.ServerFeature} feature - iServer 要素对象。
- * @returns {Object} 一个表示点的对象。
- */
- 'feature': function (feature) {
- var geom = this.extract.geometry.apply(this, [feature.geometry]);
- var json = {
- "type": "Feature",
- "properties": this.createAttributes(feature),
- "geometry": geom
- };
- if (feature.geometry && feature.geometry.type === 'TEXT') {
- json.properties.texts = feature.geometry.texts;
- json.properties.textStyle = feature.geometry.textStyle;
- }
- if (feature.fid) {
- json.id = feature.fid;
- }
- if (feature.ID) {
- json.id = feature.ID;
- }
- return json;
- },
- /**
- * @function GeoJSONFormat.extract.geometry
- * @description 返回一个表示单个几何对象的 GeoJSON 的一部分。
- * @param {Object} geometry - iServer 几何对象。
- * @returns {Object} 一个表示几何体的对象。
- */
- 'geometry': function (geometry) {
- if (geometry == null) {
- return null;
- }
- if (!geometry.parts && geometry.points) {
- geometry.parts = [geometry.points.length];
- }
- var geo = geometry.hasOwnProperty('geometryType')
- ? geometry
- : new ServerGeometry(geometry).toGeometry() || geometry;
- var geometryType = geo.geometryType || geo.type;
- var data;
- if (geometryType === "LinearRing") {
- geometryType = "LineString";
- }
- if (geometryType === "LINEM") {
- geometryType = "MultiLineString";
- }
- data = this.extract[geometryType.toLowerCase()].apply(this, [geo]);
- geometryType = geometryType === 'TEXT' ? 'Point' : geometryType;
- var json;
- if (geometryType === "Collection") {
- json = {
- "type": "GeometryCollection",
- "geometries": data
- };
- } else {
- json = {
- "type": geometryType,
- "coordinates": data
- };
- }
- return json;
- },
- /**
- * @function GeoJSONFormat.extract.point
- * @description 从一个点对象中返回一个坐标组。
- * @param {GeometryPoint} point - 一个点对象。
- * @returns {Array} 一个表示一个点的坐标组。
- */
- 'point': function (point) {
- var p = [point.x, point.y];
- for (var name in point) {
- if (name !== "x" && name !== "y" && point[name] !== null && !isNaN(point[name])) {
- p.push(point[name]);
- }
- }
- return p;
- },
- /**
- * @function GeoJSONFormat.extract.point
- * @description 从一个文本对象中返回一个坐标组。
- * @param {Object} geo - 一个文本对象。
- * @returns {Array} 一个表示一个点的坐标组。
- */
- 'text': function (geo) {
- return [geo.points[0].x, geo.points[0].y];
- },
- /**
- * @function GeoJSONFormat.extract.multipoint
- * @description 从一个多点对象中返一个坐标组数组。
- * @param {GeometryMultiPoint} multipoint - 多点对象。
- * @returns {Array} 一个表示多点的坐标组数组。
- */
- 'multipoint': function (multipoint) {
- var array = [];
- for (var i = 0, len = multipoint.components.length; i < len; ++i) {
- array.push(this.extract.point.apply(this, [multipoint.components[i]]));
- }
- return array;
- },
- /**
- * @function GeoJSONFormat.extract.linestring
- * @description 从一个线对象中返回一个坐标组数组。
- * @param {Linestring} linestring - 线对象。
- * @returns {Array} 一个表示线对象的坐标组数组。
- */
- 'linestring': function (linestring) {
- var array = [];
- for (var i = 0, len = linestring.components.length; i < len; ++i) {
- array.push(this.extract.point.apply(this, [linestring.components[i]]));
- }
- return array;
- },
- /**
- * @function GeoJSONFormat.extract.multilinestring
- * @description 从一个多线对象中返回一个线数组。
- * @param {GeometryMultiLineString} multilinestring - 多线对象。
- *
- * @returns {Array} 一个表示多线的线数组。
- */
- 'multilinestring': function (multilinestring) {
- var array = [];
- for (var i = 0, len = multilinestring.components.length; i < len; ++i) {
- array.push(this.extract.linestring.apply(this, [multilinestring.components[i]]));
- }
- return array;
- },
- /**
- * @function GeoJSONFormat.extract.polygon
- * @description 从一个面对象中返回一组线环。
- * @param {GeometryPolygon} polygon - 面对象。
- * @returns {Array} 一组表示面的线环。
- */
- 'polygon': function (polygon) {
- var array = [];
- for (var i = 0, len = polygon.components.length; i < len; ++i) {
- array.push(this.extract.linestring.apply(this, [polygon.components[i]]));
- }
- return array;
- },
- /**
- * @function GeoJSONFormat.extract.multipolygon
- * @description 从一个多面对象中返回一组面。
- * @param {GeometryMultiPolygon} multipolygon - 多面对象。
- * @returns {Array} 一组表示多面的面。
- */
- 'multipolygon': function (multipolygon) {
- var array = [];
- for (var i = 0, len = multipolygon.components.length; i < len; ++i) {
- array.push(this.extract.polygon.apply(this, [multipolygon.components[i]]));
- }
- return array;
- },
- /**
- * @function GeoJSONFormat.extract.collection
- * @description 从一个几何要素集合中一组几何要素数组。
- * @param {GeometryCollection} collection - 几何要素集合。
- * @returns {Array} 一组表示几何要素集合的几何要素数组。
- */
- 'collection': function (collection) {
- var len = collection.components.length;
- var array = new Array(len);
- for (var i = 0; i < len; ++i) {
- array[i] = this.extract.geometry.apply(this, [collection.components[i]]);
- }
- return array;
- }
- };
- }
- /**
- * @function GeoJSONFormat.prototype.read
- * @description 将 GeoJSON 对象或者GeoJSON 对象字符串转换为 SuperMap Feature 对象。
- * @param {GeoJSONObject} json - GeoJSON 对象。
- * @param {string} [type='FeaureCollection'] - 可选的字符串,它决定了输出的格式。支持的值有:"Geometry","Feature",和 "FeatureCollection",如果此值为null。
- * @param {function} filter - 对象中每个层次每个键值对都会调用此函数得出一个结果。每个值都会被 filter 函数的结果所替换掉。这个函数可被用来将某些对象转化成某个类相应的对象,或者将日期字符串转化成Date对象。
- * @returns {Object} 返回值依赖于 type 参数的值。
- * -如果 type 等于 "FeatureCollection",返回值将会是 {@link FeatureVector} 数组。
- * -如果 type 为 "Geometry",输入的 JSON 对象必须表示一个唯一的几何体,然后返回值就会是 {@link Geometry}。
- * -如果 type 为 "Feature",输入的 JSON 对象也必须表示的一个要素,这样返回值才会是 {@link FeatureVector}。
- */
- read(json, type, filter) {
- type = (type) ? type : "FeatureCollection";
- var results = null;
- var obj = null;
- if (typeof json == "string") {
- obj = super.read(json, filter);
- } else {
- obj = json;
- }
- if (!obj) {
- //console.error("Bad JSON: " + json);
- } else if (typeof (obj.type) != "string") {
- //console.error("Bad GeoJSON - no type: " + json);
- } else if (this.isValidType(obj, type)) {
- switch (type) {
- case "Geometry":
- try {
- results = this.parseGeometry(obj);
- } catch (err) {
- //console.error(err);
- }
- break;
- case "Feature":
- try {
- results = this.parseFeature(obj);
- results.type = "Feature";
- } catch (err) {
- //console.error(err);
- }
- break;
- case "FeatureCollection":
- // for type FeatureCollection, we allow input to be any type
- results = [];
- switch (obj.type) {
- case "Feature":
- try {
- results.push(this.parseFeature(obj));
- } catch (err) {
- results = null;
- //console.error(err);
- }
- break;
- case "FeatureCollection":
- for (var i = 0, len = obj.features.length; i < len; ++i) {
- try {
- results.push(this.parseFeature(obj.features[i]));
- } catch (err) {
- results = null;
- // console.error(err);
- }
- }
- break;
- default:
- try {
- var geom = this.parseGeometry(obj);
- results.push(new Vector(geom));
- } catch (err) {
- results = null;
- //console.error(err);
- }
- }
- break;
- default:
- break;
- }
- }
- return results;
- }
- /**
- * @function GeoJSONFormat.prototype.write
- * @description iServer Geometry JSON 对象 转 GeoJSON对象字符串。
- * @param {Object} obj - iServer Geometry JSON 对象。
- * @param {boolean} [pretty=false] - 是否使用换行和缩进来控制输出。
- * @returns {GeoJSONObject} 一个 GeoJSON 字符串,它表示了输入的几何对象,要素对象,或者要素对象数组。
- */
- write(obj, pretty) {
- return super.write(this.toGeoJSON(obj), pretty);
- }
- /**
- * @function GeoJSONFormat.prototype.fromGeoJSON
- * @version 9.1.1
- * @description 将 GeoJSON 对象或者GeoJSON 对象字符串转换为iServer Feature JSON。
- * @param {GeoJSONObject} json - GeoJSON 对象。
- * @param {string} [type='FeaureCollection'] - 可选的字符串,它决定了输出的格式。支持的值有:"Geometry","Feature",和 "FeatureCollection",如果此值为null。
- * @param {function} filter - 对象中每个层次每个键值对都会调用此函数得出一个结果。每个值都会被 filter 函数的结果所替换掉。这个函数可被用来将某些对象转化成某个类相应的对象,或者将日期字符串转化成Date对象。
- * @returns {Object} iServer Feature JSON。
- */
- fromGeoJSON(json, type, filter) {
- let feature = this.read(json, type, filter);
- if (!Util.isArray(feature)) {
- return this._toiSevrerFeature(feature);
- }
- return feature.map((element) => {
- return this._toiSevrerFeature(element);
- })
- }
- /**
- * @function GeoJSONFormat.prototype.toGeoJSON
- * @version 9.1.1
- * @description 将 iServer Feature JSON 对象转换为 GeoJSON 对象。
- * @param {Object} obj - iServer Feature JSON。
- * @returns {GeoJSONObject} GeoJSON 对象。
- */
- toGeoJSON(obj) {
- var geojson = {
- "type": null
- };
- if (Util.isArray(obj)) {
- geojson.type = "FeatureCollection";
- var numFeatures = obj.length;
- geojson.features = new Array(numFeatures);
- for (var i = 0; i < numFeatures; ++i) {
- var element = obj[i];
- if (isGeometry(element)) {
- let feature = {};
- feature.geometry = element;
- geojson.features[i] = this.extract.feature.apply(this, [feature]);
- } else {
- geojson.features[i] = this.extract.feature.apply(this, [element]);
- }
- }
- } else if (isGeometry(obj)) {
- let feature = {};
- feature.geometry = obj;
- geojson = this.extract.feature.apply(this, [feature]);
- } else {
- geojson = this.extract.feature.apply(this, [obj]);
- }
- function isGeometry(input) {
- return (input.hasOwnProperty("parts") && input.hasOwnProperty("points")) || input.hasOwnProperty("geoParts");
- }
- return geojson;
- }
- /**
- * @function GeoJSONFormat.prototype.isValidType
- * @description 检查一个 GeoJSON 对象是否和给定的类型相符的合法的对象。
- * @returns {boolean} GeoJSON 是否是给定类型的合法对象。
- * @private
- */
- isValidType(obj, type) {
- var valid = false;
- switch (type) {
- case "Geometry":
- if (Util.indexOf(
- ["Point", "MultiPoint", "LineString", "MultiLineString",
- "Polygon", "MultiPolygon", "Box", "GeometryCollection"
- ],
- obj.type) == -1) {
- // unsupported geometry type
- //console.error("Unsupported geometry type: " +
- // obj.type);
- } else {
- valid = true;
- }
- break;
- case "FeatureCollection":
- // allow for any type to be converted to a feature collection
- valid = true;
- break;
- default:
- // for Feature types must match
- if (obj.type == type) {
- valid = true;
- } else {
- //console.error("Cannot convert types from " +
- //obj.type + " to " + type);
- }
- }
- return valid;
- }
- /**
- * @function GeoJSONFormat.prototype.parseFeature
- * @description 将一个 GeoJSON 中的 feature 转化成 {@link FeatureVector}> 对象。
- * @private
- * @param {GeoJSONObject} obj - 从 GeoJSON 对象中创建一个对象。
- * @returns {FeatureVector} 一个要素。
- */
- parseFeature(obj) {
- var feature, geometry, attributes, bbox;
- attributes = (obj.properties) ? obj.properties : {};
- bbox = (obj.geometry && obj.geometry.bbox) || obj.bbox;
- try {
- geometry = this.parseGeometry(obj.geometry);
- } catch (err) {
- // deal with bad geometries
- throw err;
- }
- feature = new Vector(geometry, attributes);
- if (bbox) {
- feature.bounds = Bounds.fromArray(bbox);
- }
- if (obj.id) {
- feature.geometry.id = obj.id;
- feature.fid = obj.id;
- }
- return feature;
- }
- /**
- * @function GeoJSONFormat.prototype.parseGeometry
- * @description 将一个 GeoJSON 中的几何要素转化成 {@link Geometry} 对象。
- * @param {GeoJSONObject} obj - 从 GeoJSON 对象中创建一个对象。
- * @returns {Geometry} 一个几何要素。
- * @private
- */
- parseGeometry(obj) {
- if (obj == null) {
- return null;
- }
- var geometry;
- if (obj.type == "GeometryCollection") {
- if (!(Util.isArray(obj.geometries))) {
- throw "GeometryCollection must have geometries array: " + obj;
- }
- var numGeom = obj.geometries.length;
- var components = new Array(numGeom);
- for (var i = 0; i < numGeom; ++i) {
- components[i] = this.parseGeometry.apply(
- this, [obj.geometries[i]]
- );
- }
- geometry = new Collection(components);
- } else {
- if (!(Util.isArray(obj.coordinates))) {
- throw "Geometry must have coordinates array: " + obj;
- }
- if (!this.parseCoords[obj.type.toLowerCase()]) {
- throw "Unsupported geometry type: " + obj.type;
- }
- try {
- geometry = this.parseCoords[obj.type.toLowerCase()].apply(
- this, [obj.coordinates]
- );
- } catch (err) {
- // deal with bad coordinates
- throw err;
- }
- }
- return geometry;
- }
- /**
- * @function GeoJSONFormat.prototype.createCRSObject
- * @description 从一个要素对象中创建一个坐标参考系对象。
- * @param {FeatureVector} object - 要素对象。
- * @private
- * @returns {GeoJSONObject} 一个可作为 GeoJSON 对象的 CRS 属性使用的对象。
- */
- createCRSObject(object) {
- var proj = object.layer.projection.toString();
- var crs = {};
- if (proj.match(/epsg:/i)) {
- var code = parseInt(proj.substring(proj.indexOf(":") + 1));
- if (code == 4326) {
- crs = {
- "type": "name",
- "properties": {
- "name": "urn:ogc:def:crs:OGC:1.3:CRS84"
- }
- };
- } else {
- crs = {
- "type": "name",
- "properties": {
- "name": "EPSG:" + code
- }
- };
- }
- }
- return crs;
- }
- _toiSevrerFeature(feature) {
- const attributes = feature.attributes;
- const attrNames = [];
- const attrValues = [];
- for (var attr in attributes) {
- attrNames.push(attr);
- attrValues.push(attributes[attr]);
- }
- const newFeature = {
- fieldNames: attrNames,
- fieldValues: attrValues,
- geometry: ServerGeometry.fromGeometry(feature.geometry)
- };
- newFeature.geometry.id = feature.fid;
- return newFeature;
- }
- createAttributes(feature) {
- if (!feature) {
- return null;
- }
- var attr = {};
- processFieldsAttributes(feature, attr);
- var exceptKeys = ["fieldNames", "fieldValues", "geometry", "stringID", "ID"];
- for (var key in feature) {
- if (exceptKeys.indexOf(key) > -1) {
- continue;
- }
- attr[key] = feature[key];
- }
- function processFieldsAttributes(feature, attributes) {
- if (!(feature.hasOwnProperty("fieldNames") && feature.hasOwnProperty("fieldValues"))) {
- return;
- }
- var names = feature.fieldNames,
- values = feature.fieldValues;
- for (var i in names) {
- attributes[names[i]] = values[i];
- }
- }
- return attr;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/format/WKT.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class WKTFormat
- * @aliasclass Format.WKT
- * @deprecatedclass SuperMap.Format.WKT
- * @classdesc 用于读写常见文本的类。通过 {@link WKTFormat} 构造器来创建一个新的实例。
- * @category BaseTypes Format
- * @extends {Format}
- * @param {Object} options - 可选的选项对象,其属性将被设置到实例。option 具体配置项继承自 {@link Format}。
- * @usage
- */
- class WKT extends Format {
- constructor(options) {
- super(options);
- this.regExes = {
- 'typeStr': /^\s*(\w+)\s*\(\s*(.*)\s*\)\s*$/,
- 'spaces': /\s+/,
- 'parenComma': /\)\s*,\s*\(/,
- 'doubleParenComma': /\)\s*\)\s*,\s*\(\s*\(/, // can't use {2} here
- 'trimParens': /^\s*\(?(.*?)\)?\s*$/
- };
- this.CLASS_NAME = "SuperMap.Format.WKT"; /**
- * @private
- * @description Object with properties corresponding to the geometry types.
- * Property values are functions that do the actual data extraction.
- */
- this.extract = {
- /**
- * @description Return a space delimited string of point coordinates.
- * @param {GeometryPoint} point
- * @returns {string} A string of coordinates representing the point
- */
- 'point': function (point) {
- return point.x + ' ' + point.y;
- },
- /**
- * @description Return a comma delimited string of point coordinates from a multipoint.
- * @param {GeometryMultiPoint} multipoint
- * @returns {string} A string of point coordinate strings representing
- * the multipoint
- */
- 'multipoint'(multipoint) {
- var array = [];
- for (var i = 0, len = multipoint.components.length; i < len; ++i) {
- array.push('(' +
- this.extract.point.apply(this, [multipoint.components[i]]) +
- ')');
- }
- return array.join(',');
- },
- /**
- * @description Return a comma delimited string of point coordinates from a line.
- * @param {GeometryLineString} linestring
- * @returns {string} A string of point coordinate strings representing
- * the linestring
- */
- 'linestring'(linestring) {
- var array = [];
- for (var i = 0, len = linestring.components.length; i < len; ++i) {
- array.push(this.extract.point.apply(this, [linestring.components[i]]));
- }
- return array.join(',');
- },
- /**
- * @description Return a comma delimited string of linestring strings from a multilinestring.
- * @param {GeometryMultiLineString} multilinestring
- * @returns {string} A string of of linestring strings representing
- * the multilinestring
- */
- 'multilinestring'(multilinestring) {
- var array = [];
- for (var i = 0, len = multilinestring.components.length; i < len; ++i) {
- array.push('(' +
- this.extract.linestring.apply(this, [multilinestring.components[i]]) +
- ')');
- }
- return array.join(',');
- },
- /**
- * @description Return a comma delimited string of linear ring arrays from a polygon.
- * @param {GeometryPolygon} polygon
- * @returns {string} An array of linear ring arrays representing the polygon
- */
- 'polygon'(polygon) {
- var array = [];
- for (var i = 0, len = polygon.components.length; i < len; ++i) {
- array.push('(' +
- this.extract.linestring.apply(this, [polygon.components[i]]) +
- ')');
- }
- return array.join(',');
- },
- /**
- * @description Return an array of polygon arrays from a multipolygon.
- * @param {GeometryMultiPolygon} multipolygon
- * @returns {string} An array of polygon arrays representing
- * the multipolygon
- */
- 'multipolygon'(multipolygon) {
- var array = [];
- for (var i = 0, len = multipolygon.components.length; i < len; ++i) {
- array.push('(' +
- this.extract.polygon.apply(this, [multipolygon.components[i]]) +
- ')');
- }
- return array.join(',');
- },
- /**
- * @description Return the WKT portion between 'GEOMETRYCOLLECTION(' and ')' for an <GeometryCollection>
- * @param {GeometryCollection} collection
- * @returns {string} internal WKT representation of the collection
- */
- 'collection'(collection) {
- var array = [];
- for (var i = 0, len = collection.components.length; i < len; ++i) {
- array.push(this.extractGeometry.apply(this, [collection.components[i]]));
- }
- return array.join(',');
- }
- };
- /**
- * @private
- * @description Object with properties corresponding to the geometry types.
- * Property values are functions that do the actual parsing.
- */
- this.parse = {
- /**
- * @private
- * @description Return point feature given a point WKT fragment.
- * @param {string} str A WKT fragment representing the point
- * @returns {FeatureVector} A point feature
- *
- */
- 'point': function (str) {
- var coords = StringExt.trim(str).split(this.regExes.spaces);
- return new Vector(new Point(coords[0], coords[1])
- );
- },
- /**
- * @description Return a multipoint feature given a multipoint WKT fragment.
- * @param {string} A WKT fragment representing the multipoint
- * @returns {FeatureVector} A multipoint feature
- * @private
- */
- 'multipoint': function (str) {
- var point;
- var points = StringExt.trim(str).split(',');
- var components = [];
- for (var i = 0, len = points.length; i < len; ++i) {
- point = points[i].replace(this.regExes.trimParens, '$1');
- components.push(this.parse.point.apply(this, [point]).geometry);
- }
- return new Vector(
- new MultiPoint(components)
- );
- },
- /**
- * @description Return a linestring feature given a linestring WKT fragment.
- * @param {string} A WKT fragment representing the linestring
- * @returns {FeatureVector} A linestring feature
- * @private
- */
- 'linestring': function (str) {
- var points = StringExt.trim(str).split(',');
- var components = [];
- for (var i = 0, len = points.length; i < len; ++i) {
- components.push(this.parse.point.apply(this, [points[i]]).geometry);
- }
- return new Vector(
- new LineString(components)
- );
- },
- /**
- * @description Return a multilinestring feature given a multilinestring WKT fragment.
- * @param {string} A WKT fragment representing the multilinestring
- * @returns {FeatureVector} A multilinestring feature
- * @private
- */
- 'multilinestring': function (str) {
- var line;
- var lines = StringExt.trim(str).split(this.regExes.parenComma);
- var components = [];
- for (var i = 0, len = lines.length; i < len; ++i) {
- line = lines[i].replace(this.regExes.trimParens, '$1');
- components.push(this.parse.linestring.apply(this, [line]).geometry);
- }
- return new Vector(
- new MultiLineString(components)
- );
- },
- /**
- * @description Return a polygon feature given a polygon WKT fragment.
- * @param {string} A WKT fragment representing the polygon
- * @returns {FeatureVector} A polygon feature
- * @private
- */
- 'polygon': function (str) {
- var ring, linestring, linearring;
- var rings = StringExt.trim(str).split(this.regExes.parenComma);
- var components = [];
- for (var i = 0, len = rings.length; i < len; ++i) {
- ring = rings[i].replace(this.regExes.trimParens, '$1');
- linestring = this.parse.linestring.apply(this, [ring]).geometry;
- linearring = new LinearRing(linestring.components);
- components.push(linearring);
- }
- return new Vector(
- new Polygon(components)
- );
- },
- /**
- * @private
- * @description Return a multipolygon feature given a multipolygon WKT fragment.
- * @param {string} A WKT fragment representing the multipolygon
- * @returns {FeatureVector} A multipolygon feature
- *
- */
- 'multipolygon': function (str) {
- var polygon;
- var polygons = StringExt.trim(str).split(this.regExes.doubleParenComma);
- var components = [];
- for (var i = 0, len = polygons.length; i < len; ++i) {
- polygon = polygons[i].replace(this.regExes.trimParens, '$1');
- components.push(this.parse.polygon.apply(this, [polygon]).geometry);
- }
- return new Vector(
- new MultiPolygon(components)
- );
- },
- /**
- * @description Return an array of features given a geometrycollection WKT fragment.
- * @param {string} A WKT fragment representing the geometrycollection
- * @returns {Array} An array of FeatureVector
- * @private
- */
- 'geometrycollection': function (str) {
- // separate components of the collection with |
- str = str.replace(/,\s*([A-Za-z])/g, '|$1');
- var wktArray = StringExt.trim(str).split('|');
- var components = [];
- for (var i = 0, len = wktArray.length; i < len; ++i) {
- components.push(this.read(wktArray[i]));
- }
- return components;
- }
- };
- }
- /**
- * @function WKTFormat.prototype.read
- * @description 反序列化 WKT 字符串并返回向量特征或向量特征数组。 支持 POINT、MULTIPOINT、LINESTRING、MULTILINESTRING、POLYGON、MULTIPOLYGON 和 GEOMETRYCOLLECTION 的 WKT。
- * @param {string} wkt - WKT 字符串。
- * @returns {FeatureVector|Array} GEOMETRYCOLLECTION WKT 的矢量要素或者矢量要素数组。
- */
- read(wkt) {
- var features, type, str;
- wkt = wkt.replace(/[\n\r]/g, " ");
- var matches = this.regExes.typeStr.exec(wkt);
- if (matches) {
- type = matches[1].toLowerCase();
- str = matches[2];
- if (this.parse[type]) {
- features = this.parse[type].apply(this, [str]);
- }
- }
- return features;
- }
- /**
- * @function WKTFormat.prototype.write
- * @description 将矢量要素或矢量要素数组序列化为 WKT 字符串。
- * @param {(FeatureVector|Array)} features - 矢量要素或矢量要素数组。
- * @returns {string} 表示几何的 WKT 字符串。
- */
- write(features) {
- var collection, geometry, isCollection;
- if (features.constructor === Array) {
- collection = features;
- isCollection = true;
- } else {
- collection = [features];
- isCollection = false;
- }
- var pieces = [];
- if (isCollection) {
- pieces.push('GEOMETRYCOLLECTION(');
- }
- for (var i = 0, len = collection.length; i < len; ++i) {
- if (isCollection && i > 0) {
- pieces.push(',');
- }
- geometry = collection[i].geometry;
- pieces.push(this.extractGeometry(geometry));
- }
- if (isCollection) {
- pieces.push(')');
- }
- return pieces.join('');
- }
- /**
- * @function WKTFormat.prototype.extractGeometry
- * @description 为单个 Geometry 对象构造 WKT 的入口点。
- * @param {Geometry} geometry - Geometry 对象。
- * @returns {string} 表示几何的 WKT 字符串。
- */
- extractGeometry(geometry) {
- var type = geometry.CLASS_NAME.split('.')[2].toLowerCase();
- if (!this.extract[type]) {
- return null;
- }
- var wktType = type === 'collection' ? 'GEOMETRYCOLLECTION' : type.toUpperCase();
- var data = wktType + '(' + this.extract[type].apply(this, [geometry]) + ')';
- return data;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/format/index.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- ;// CONCATENATED MODULE: ./src/common/control/TimeControlBase.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class TimeControlBase
- * @deprecatedclass SuperMap.TimeControlBase
- * @classdesc 时间控制基类类。
- * @category Control
- * @param {Object} options - 可选参数。
- * @param {number} [options.speed=1] - 速度。不能小于 0,(每帧渲染的数据之间的间隔为1),设置越大速度越快。
- * @param {number} [options.frequency=1000] - 刷新频率(单位 ms),服务器刷新的时间间隔。
- * @param {number} [options.startTime=0] - 起始时间,必须为数字,且小于等于 endTime。如果不设置,初始化时为 0,建议设置。
- * @param {number} [options.endTime] - 结束时间,必须为数字,且大于等于 startTime。如果不设置,初始化时以当前时间进行设置,建议设置。
- * @param {boolean} [options.repeat=true] - 是否重复循环。
- * @param {boolean} [options.reverse=false] - 是否反向。
- * @usage
- */
- class TimeControlBase {
- constructor(options) {
- //设置步长,刷新频率、开始结束时间、是否循环、是否反向
- var me = this;
- options = options || {};
- /**
- * @member {number} [TimeControlBase.prototype.speed=1]
- * @description 步长,必须为非负数,默认为1(表示前后两次渲染的数据之间的间隔为1)
- */
- this.speed = (options.speed && options.speed >= 0) ? options.speed : 1;
- /**
- * @member {number} [TimeControlBase.prototype.frequency=1000]
- * @description 刷新频率(单位ms),服务器刷新的时间间隔。
- */
- this.frequency = (options.speed && options.frequency >= 0) ? options.frequency : 1000;
- /**
- * @member {number} [TimeControlBase.prototype.startTime=0]
- * @description 记录的起始时间,必须为数字,
- * 如果不设置,初始化时为0,建议设置
- */
- this.startTime = (options.startTime && options.startTime != null) ? options.startTime : 0;
- /**
- * @member {number} TimeControlBase.prototype.endTime
- * @description 记录的结束时间,必须为数字,
- * 如果不设置,初始化时以当前时间进行设置,建议设置
- */
- this.endTime = (options.endTime && options.endTime != null && options.endTime >= me.startTime) ? options.endTime : +new Date();
- /**
- * @member {boolean} [TimeControlBase.prototype.repeat=true]
- * @description 是否重复循环。
- */
- this.repeat = (options.repeat !== undefined) ? options.repeat : true;
- /**
- * @member {boolean} [TimeControlBase.prototype.reverse=false]
- * @description 是否反向。
- */
- this.reverse = (options.reverse !== undefined) ? options.reverse : false;
- /**
- * @member {number} TimeControlBase.prototype.currentTime
- * @description 记录近期的时间,也就是当前帧运行到的时间。
- */
- this.currentTime = null;
- /**
- * @member {number} TimeControlBase.prototype.oldTime
- * @description 记录上一帧的时间,也就是之前运行到的时间。
- */
- this.oldTime = null;
- /**
- * @member {boolean} [TimeControlBase.prototype.running=false]
- * @description 记录当前是否处于运行中。
- */
- this.running = false;
- /**
- * @private
- * @member {Array.<string>} TimeControlBase.prototype.EVENT_TYPES
- * @description 此类支持的事件类型。
- *
- */
- this.EVENT_TYPES = ["start", "pause", "stop"];
- /**
- * @private
- * @member {Events} TimeControlBase.prototype.events
- * @description 事件
- */
- me.events = new Events(this, null, this.EVENT_TYPES);
- me.speed = Number(me.speed);
- me.frequency = Number(me.frequency);
- me.startTime = Number(me.startTime);
- me.endTime = Number(me.endTime);
- me.startTime = Date.parse(new Date(me.startTime));
- me.endTime = Date.parse(new Date(me.endTime));
- //初始化当前时间
- me.currentTime = me.startTime;
- this.CLASS_NAME = "SuperMap.TimeControlBase";
- }
- /**
- * @function TimeControlBase.prototype.updateOptions
- * @description 更新参数。
- * @param {Object} options - 设置参数得可选参数。设置步长,刷新频率、开始结束时间、是否循环、是否反向。
- */
- updateOptions(options) {
- //设置步长,刷新频率、开始结束时间、是否循环、是否反向
- var me = this;
- options = options || {};
- if (options.speed && options.speed >= 0) {
- me.speed = options.speed;
- me.speed = Number(me.speed);
- }
- if (options.speed && options.frequency >= 0) {
- me.frequency = options.frequency;
- me.frequency = Number(me.frequency);
- }
- if (options.startTime && options.startTime != null) {
- me.startTime = options.startTime;
- me.startTime = Date.parse(new Date(me.startTime));
- }
- if (options.endTime && options.endTime != null && options.endTime >= me.startTime) {
- me.endTime = options.endTime;
- me.endTime = Date.parse(new Date(me.endTime));
- }
- if (options.repeat != null) {
- me.repeat = options.repeat;
- }
- if (options.reverse != null) {
- me.reverse = options.reverse;
- }
- }
- /**
- * @function TimeControlBase.prototype.start
- * @description 开始。
- */
- start() {
- var me = this;
- if (!me.running) {
- me.running = true;
- me.tick();
- me.events.triggerEvent('start', me.currentTime);
- }
- }
- /**
- * @function TimeControlBase.prototype.pause
- * @description 暂停。
- */
- pause() {
- var me = this;
- me.running = false;
- me.events.triggerEvent('pause', me.currentTime);
- }
- /**
- * @function TimeControlBase.prototype.stop
- * @description 停止,停止后返回起始状态。
- */
- stop() {
- var me = this;
- //停止时 时间设置为开始时间
- me.currentTime = me.startTime;
- //如果正在运行,修改为初始时间即可绘制一帧
- if (me.running) {
- me.running = false;
- }
- me.events.triggerEvent('stop', me.currentTime);
- }
- /**
- * @function TimeControlBase.prototype.toggle
- * @description 开关切换,切换的是开始和暂停。
- */
- toggle() {
- var me = this;
- if (me.running) {
- me.pause();
- } else {
- me.start();
- }
- }
- /**
- * @function TimeControlBase.prototype.setSpeed
- * @description 设置步长。
- * @param {number} [speed=1] - 步长,必须为非负数。
- * @returns {boolean} true 代表设置成功,false 设置失败(speed 小于 0 时失败)。
- */
- setSpeed(speed) {
- var me = this;
- if (speed >= 0) {
- me.speed = speed;
- return true;
- }
- return false;
- }
- /**
- * @function TimeControlBase.prototype.getSpeed
- * @description 获取步长。
- * @returns {number} 返回当前的步长
- */
- getSpeed() {
- return this.speed;
- }
- /**
- * @function TimeControlBase.prototype.setFrequency
- * @description 设置刷新频率。
- * @param {number} [frequency=1000] - 刷新频率,单位为 ms。
- * @returns {boolean} true 代表设置成功,false 设置失败(frequency 小于 0 时失败)。
- */
- setFrequency(frequency) {
- var me = this;
- if (frequency >= 0) {
- me.frequency = frequency;
- return true;
- }
- return false;
- }
- /**
- * @function TimeControlBase.prototype.getFrequency
- * @description 获取刷新频率。
- * @returns {number} 返回当前的刷新频率。
- */
- getFrequency() {
- return this.frequency;
- }
- /**
- * @function TimeControlBase.prototype.setStartTime
- * @description 设置起始时间,设置完成后如果当前时间小于起始时间,则从起始时间开始。
- * @param {number} startTime - 需要设置的起始时间。
- * @returns {boolean} true 代表设置成功,false 设置失败(startTime 大于结束时间时失败)。
- */
- setStartTime(startTime) {
- var me = this;
- startTime = Date.parse(new Date(startTime));
- //起始时间不得大于结束时间
- if (startTime > me.endTime) {
- return false;
- }
- me.startTime = startTime;
- //如果当前时间小于了起始时间,则从当前起始时间开始
- if (me.currentTime < me.startTime) {
- me.currentTime = me.startTime;
- me.tick();
- }
- return true;
- }
- /**
- * @function TimeControlBase.prototype.getStartTime
- * @description 获取起始时间。
- * @returns {number} 返回当前的起始时间。
- */
- getStartTime() {
- return this.startTime;
- }
- /**
- * @function TimeControlBase.prototype.setEndTime
- * @description 设置结束时间,设置完成后如果当前时间大于结束,则从起始时间开始。
- * @param {number} endTime - 需要设置的结束时间。
- * @returns {boolean} true 代表设置成功,false 设置失败(endTime 小于开始时间时失败)。
- */
- setEndTime(endTime) {
- var me = this;
- me.endTime = Date.parse(new Date(me.endTime));
- //结束时间不得小于开始时间
- if (endTime < me.startTime) {
- return false;
- }
- me.endTime = endTime;
- //如果当前时间大于了结束时间,则从起始时间开始
- if (me.currentTime >= me.endTime) {
- me.currentTime = me.startTime;
- me.tick();
- }
- return true;
- }
- /**
- * @function TimeControlBase.prototype.getEndTime
- * @description 获取结束时间。
- * @returns {number} 返回当前的结束时间。
- */
- getEndTime() {
- return this.endTime;
- }
- /**
- * @function TimeControlBase.prototype.setCurrentTime
- * @description 设置当前时间。
- * @param {number} currentTime - 需要设置的当前时间。
- * @returns {boolean} true 代表设置成功,false 设置失败。
- */
- setCurrentTime(currentTime) {
- var me = this;
- me.currentTime = Date.parse(new Date(me.currentTime));
- //结束时间不得小于开始时间
- if (currentTime >= me.startTime && currentTime <= me.endTime) {
- me.currentTime = currentTime;
- me.startTime = me.currentTime;
- me.tick();
- return true;
- }
- return false;
- }
- /**
- * @function TimeControlBase.prototype.getCurrentTime
- * @description 获取当前时间。
- * @returns {number} 返回当前时间。
- */
- getCurrentTime() {
- return this.currentTime;
- }
- /**
- * @function TimeControlBase.prototype.setRepeat
- * @description 设置是否重复循环。
- * @param {boolean} [repeat=true] - 是否重复循环。
- */
- setRepeat(repeat) {
- this.repeat = repeat;
- }
- /**
- * @function TimeControlBase.prototype.getRepeat
- * @description 获取是否重复循环,默认是 true。
- * @returns {boolean} 返回是否重复循环。
- */
- getRepeat() {
- return this.repeat;
- }
- /**
- * @function TimeControlBase.prototype.setReverse
- * @description 设置是否反向。
- * @param {boolean} [reverse=false] - 是否反向。
- */
- setReverse(reverse) {
- this.reverse = reverse;
- }
- /**
- * @function TimeControlBase.prototype.getReverse
- * @description 获取是否反向,默认是false。
- * @returns {boolean} 返回是否反向。
- */
- getReverse() {
- return this.reverse;
- }
- /**
- * @function TimeControlBase.prototype.getRunning
- * @description 获取运行状态。
- * @returns {boolean} true 代表正在运行,false 发表没有运行。
- */
- getRunning() {
- return this.running;
- }
- /**
- * @function TimeControlBase.prototype.destroy
- * @description 销毁 Animator 对象,释放资源。
- */
- destroy() {
- var me = this;
- me.speed = null;
- me.frequency = null;
- me.startTime = null;
- me.endTime = null;
- me.currentTime = null;
- me.repeat = null;
- me.running = false;
- me.reverse = null;
- }
- tick() {
- //TODO 每次刷新执行的操作。子类实现
- }
- }
- ;// CONCATENATED MODULE: ./src/common/control/TimeFlowControl.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class TimeFlowControl
- * @deprecatedclass SuperMap.TimeFlowControl
- * @category Control
- * @classdesc 时间管理类。此类只负责时间上的控制,具体执行的操作需要用户在初始化时的回调函数内部进行实现。
- * 如设置起始时间为 1000,结束时间是 2000,步长设置为 1,
- * 那么表示按照每次1年(可以通过 setSpeed 进行修改)的变化从公元 1000 年开始到公元 2000 年为止,默认每 1 秒会 1 次(通过 setFrequency 修改)
- * @extends {TimeControlBase}
- * @param {function} callback - 每次刷新回调函数。具体的效果需要用户在此回调函数里面实现。
- * @param {Object} options - 可选参数。
- * @param {number} [options.speed=1] - 步长(单位 ms)。不能小于 0,(每次刷新的数据之间的间隔为 1ms)。
- * @param {number} [options.frequency=1000] - 刷新频率(单位 ms)。
- * @param {number} [options.startTime=0] - 起始时间,必须为数字,且小于等于 endTime。如果不设置,初始化时为 0,建议设置。
- * @param {number} [options.endTime] - 结束时间,必须为数字,且大于等于 startTime。如果不设置,初始化时使用 new Date() 以当前时间进行设置,建议设置。
- * @param {boolean} [options.repeat=true] - 是否重复循环。
- * @param {boolean} [options.reverse=false] - 是否反向。
- * @usage
- */
- class TimeFlowControl extends TimeControlBase {
- constructor(callback, options) {
- super(options);
- var me = this;
- /**
- * @member TimeFlowControl.prototype.callback -{function}
- * @description 每次刷新执行的回调函数。
- */
- me.callback = callback;
- //先让IE下支持bind方法
- if (!Function.prototype.bind) {
- Function.prototype.bind = function (oThis) {
- if (typeof this !== "function") {
- throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
- }
- var aArgs = Array.prototype.slice.call(arguments, 1),
- fToBind = this,
- fNOP = function () {
- //empty Function
- },
- fBound = function () {
- return fToBind.apply(this instanceof fNOP && oThis
- ? this
- : oThis,
- aArgs.concat(Array.prototype.slice.call(arguments)));
- };
- fNOP.prototype = this.prototype;
- fBound.prototype = new fNOP();
- return fBound;
- };
- }
- //保证 this.tick 的上下文还是 TimeControl 这个对象
- me.update = me.update.bind(me);
- me.oldTime = me.currentTime;
- me.CLASS_NAME = "SuperMap.TimeFlowControl";
- }
- /**
- * @function TimeFlowControl.prototype.updateOptions
- * @override
- */
- updateOptions(options) {
- options = options || {};
- super.updateOptions(options);
- }
- /**
- * @function TimeFlowControl.prototype.start
- * @override
- */
- start() {
- var me = this;
- if (me.running) {
- return;
- }
- me.running = true;
- if (me.reverse) {
- if (me.currentTime === me.startTime) {
- me.oldTime = me.endTime;
- me.currentTime = me.oldTime;
- }
- } else {
- if (me.oldTime === me.endTime) {
- me.currentTime = me.startTime;
- me.oldTime = me.currentTime;
- }
- }
- me.tick();
- }
- /**
- * @function TimeFlowControl.prototype.stop
- * @override
- */
- stop() {
- super.stop();
- var me = this;
- me.oldTime = me.currentTime;
- if (me.running) {
- me.running = false;
- }
- //清除定时tick
- me.intervalId && window.clearTimeout(me.intervalId);
- }
- /**
- * @function TimeFlowControl.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- var me = this;
- me.oldTime = null;
- me.callback = null;
- }
- /**
- * @function TimeFlowControl.prototype.tick
- * @description 定时刷新。
- */
- tick() {
- var me = this;
- me.intervalId && window.clearInterval(me.intervalId);
- me.intervalId = null;
- me.update();
- me.intervalId = window.setInterval(me.update, me.frequency);
- }
- /**
- * @function TimeFlowControl.prototype.update
- * @description 更新控件。
- */
- update() {
- var me = this;
- //判定是否还需要继续
- if (!me.running) {
- return;
- }
- //调用回调函数
- me.callback && me.callback(me.currentTime); //destroy之后callback就为空,所以需要判定一下
- if (!me.reverse) {
- //如果相等,则代表上一帧已经运行到了最后,下一帧运行初始化的状态
- if (me.currentTime === me.endTime) {
- //不循环时
- if (!me.repeat) {
- me.running = false;
- me.stop();
- return null;
- }
- me.stop();
- me.currentTime = me.startTime;
- me.oldTime = me.currentTime;
- me.start();
- } else {//否则时间递增
- me.oldTime = me.currentTime;
- me.currentTime += me.speed;
- }
- if (me.currentTime >= me.endTime) {
- me.currentTime = me.endTime;
- }
- } else {
- //如果相等,则代表上一帧已经运行到了最前,下一帧运行结束的状态
- if (me.currentTime === me.startTime) {
- //不循环时
- if (!me.repeat) {
- me.running = false;
- return null;
- }
- me.oldTime = me.endTime;
- me.currentTime = me.oldTime;
- } else {//否则时间递减
- me.currentTime = me.oldTime;
- me.oldTime -= me.speed;
- }
- if (me.oldTime <= me.startTime) {
- me.oldTime = me.startTime;
- }
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/control/index.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- // EXTERNAL MODULE: ./node_modules/promise-polyfill/dist/polyfill.js
- var polyfill = __webpack_require__(107);
- // EXTERNAL MODULE: ./node_modules/fetch-ie8/fetch.js
- var fetch = __webpack_require__(693);
- // EXTERNAL MODULE: ./node_modules/fetch-jsonp/build/fetch-jsonp.js
- var fetch_jsonp = __webpack_require__(144);
- var fetch_jsonp_default = /*#__PURE__*/__webpack_require__.n(fetch_jsonp);
- ;// CONCATENATED MODULE: ./src/common/util/FetchRequest.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- let FetchRequest_fetch = window.fetch;
- var setFetch = function (newFetch) {
- FetchRequest_fetch = newFetch;
- }
- var RequestJSONPPromise = {
- limitLength: 1500,
- queryKeys: [],
- queryValues: [],
- supermap_callbacks: {},
- addQueryStrings: function (values) {
- var me = this;
- for (var key in values) {
- me.queryKeys.push(key);
- if (typeof values[key] !== 'string') {
- values[key] = Util.toJSON(values[key]);
- }
- var tempValue = encodeURIComponent(values[key]);
- me.queryValues.push(tempValue);
- }
- },
- issue: function (config) {
- var me = this,
- uid = me.getUid(),
- url = config.url,
- splitQuestUrl = [];
- var p = new Promise(function (resolve) {
- me.supermap_callbacks[uid] = function (response) {
- delete me.supermap_callbacks[uid];
- resolve(response);
- };
- });
- // me.addQueryStrings({
- // callback: "RequestJSONPPromise.supermap_callbacks[" + uid + "]"
- // });
- var sectionURL = url,
- keysCount = 0; //此次sectionURL中有多少个key
- var length = me.queryKeys ? me.queryKeys.length : 0;
- for (var i = 0; i < length; i++) {
- if (sectionURL.length + me.queryKeys[i].length + 2 >= me.limitLength) {
- //+2 for ("&"or"?")and"="
- if (keysCount == 0) {
- return false;
- }
- splitQuestUrl.push(sectionURL);
- sectionURL = url;
- keysCount = 0;
- i--;
- } else {
- if (sectionURL.length + me.queryKeys[i].length + 2 + me.queryValues[i].length > me.limitLength) {
- var leftValue = me.queryValues[i];
- while (leftValue.length > 0) {
- var leftLength = me.limitLength - sectionURL.length - me.queryKeys[i].length - 2; //+2 for ("&"or"?")and"="
- if (sectionURL.indexOf('?') > -1) {
- sectionURL += '&';
- } else {
- sectionURL += '?';
- }
- var tempLeftValue = leftValue.substring(0, leftLength);
- //避免 截断sectionURL时,将类似于%22这样的符号截成两半,从而导致服务端组装sectionURL时发生错误
- if (tempLeftValue.substring(leftLength - 1, leftLength) === '%') {
- leftLength -= 1;
- tempLeftValue = leftValue.substring(0, leftLength);
- } else if (tempLeftValue.substring(leftLength - 2, leftLength - 1) === '%') {
- leftLength -= 2;
- tempLeftValue = leftValue.substring(0, leftLength);
- }
- sectionURL += me.queryKeys[i] + '=' + tempLeftValue;
- leftValue = leftValue.substring(leftLength);
- if (tempLeftValue.length > 0) {
- splitQuestUrl.push(sectionURL);
- sectionURL = url;
- keysCount = 0;
- }
- }
- } else {
- keysCount++;
- if (sectionURL.indexOf('?') > -1) {
- sectionURL += '&';
- } else {
- sectionURL += '?';
- }
- sectionURL += me.queryKeys[i] + '=' + me.queryValues[i];
- }
- }
- }
- splitQuestUrl.push(sectionURL);
- me.send(
- splitQuestUrl,
- 'RequestJSONPPromise.supermap_callbacks[' + uid + ']',
- config && config.proxy
- );
- return p;
- },
- getUid: function () {
- var uid = new Date().getTime(),
- random = Math.floor(Math.random() * 1e17);
- return uid * 1000 + random;
- },
- send: function (splitQuestUrl, callback, proxy) {
- var len = splitQuestUrl.length;
- if (len > 0) {
- var jsonpUserID = new Date().getTime();
- for (var i = 0; i < len; i++) {
- var url = splitQuestUrl[i];
- if (url.indexOf('?') > -1) {
- url += '&';
- } else {
- url += '?';
- }
- url += 'sectionCount=' + len;
- url += '§ionIndex=' + i;
- url += '&jsonpUserID=' + jsonpUserID;
- if (proxy) {
- url = decodeURIComponent(url);
- url = proxy + encodeURIComponent(url);
- }
- fetch_jsonp_default()(url, {
- jsonpCallbackFunction: callback,
- timeout: 30000
- });
- }
- }
- },
- GET: function (config) {
- var me = this;
- me.queryKeys.length = 0;
- me.queryValues.length = 0;
- me.addQueryStrings(config.params);
- return me.issue(config);
- },
- POST: function (config) {
- var me = this;
- me.queryKeys.length = 0;
- me.queryValues.length = 0;
- me.addQueryStrings({
- requestEntity: config.data
- });
- return me.issue(config);
- },
- PUT: function (config) {
- var me = this;
- me.queryKeys.length = 0;
- me.queryValues.length = 0;
- me.addQueryStrings({
- requestEntity: config.data
- });
- return me.issue(config);
- },
- DELETE: function (config) {
- var me = this;
- me.queryKeys.length = 0;
- me.queryValues.length = 0;
- me.addQueryStrings({
- requestEntity: config.data
- });
- return me.issue(config);
- }
- };
- var CORS;
- var RequestTimeout;
- /**
- * @function setCORS
- * @description 设置是否允许跨域请求,全局配置,优先级低于 service 下的 crossOring 参数。
- * @category BaseTypes Util
- * @param {boolean} cors - 是否允许跨域请求。
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * {namespace}.setCORS(cors);
- *
- * // 弃用的写法
- * SuperMap.setCORS(cors);
- *
- * </script>
- *
- * // ES6 Import
- * import { setCORS } from '{npm}';
- *
- * setCORS(cors);
- * ```
- */
- var setCORS = function (cors) {
- CORS = cors;
- }
- /**
- * @function isCORS
- * @description 是是否允许跨域请求。
- * @category BaseTypes Util
- * @returns {boolean} 是否允许跨域请求。
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.isCORS();
- *
- * // 弃用的写法
- * const result = SuperMap.isCORS();
- *
- * </script>
- *
- * // ES6 Import
- * import { isCORS } from '{npm}';
- *
- * const result = isCORS();
- * ```
- */
- var isCORS = function () {
- if (CORS != undefined) {
- return CORS;
- }
- return window.XMLHttpRequest && 'withCredentials' in new window.XMLHttpRequest();
- }
- /**
- * @function setRequestTimeout
- * @description 设置请求超时时间。
- * @param {number} [timeout=45] - 请求超时时间,单位秒。
- * @private
- * @usage
- * ```
- * // 浏览器
- <script type="text/javascript" src="{cdn}"></script>
- <script>
- {namespace}.setRequestTimeout(timeout);
- // 弃用的写法
- SuperMap.setRequestTimeout(timeout);
- </script>
- // ES6 Import
- import { setRequestTimeout } from '{npm}';
- setRequestTimeout(timeout);
- * ```
- */
- var setRequestTimeout = function (timeout) {
- return RequestTimeout = timeout;
- }
- /**
- * @function getRequestTimeout
- * @description 获取请求超时时间。
- * @returns {number} 请求超时时间。
- * @private
- * @usage
- * ```
- * // 浏览器
- <script type="text/javascript" src="{cdn}"></script>
- <script>
- {namespace}.getRequestTimeout();
- // 弃用的写法
- SuperMap.getRequestTimeout();
- </script>
- // ES6 Import
- import { getRequestTimeout } from '{npm}';
- getRequestTimeout();
- * ```
- */
- var getRequestTimeout = function () {
- return RequestTimeout || 45000;
- }
- /**
- * @name FetchRequest
- * @namespace
- * @category BaseTypes Util
- * @description 获取请求。
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.FetchRequest.commit(method, url, params, options);
- *
- * </script>
- *
- * // ES6 Import
- * import { FetchRequest } from '{npm}';
- *
- * const result = FetchRequest.commit(method, url, params, options);
- *
- * ```
- */
- var FetchRequest = {
- /**
- * @function FetchRequest.commit
- * @description commit 请求。
- * @param {string} method - 请求方法。
- * @param {string} url - 请求地址。
- * @param {string} params - 请求参数。
- * @param {Object} options - 请求的配置属性。
- * @returns {Promise} Promise 对象。
- */
- commit: function (method, url, params, options) {
- method = method ? method.toUpperCase() : method;
- switch (method) {
- case 'GET':
- return this.get(url, params, options);
- case 'POST':
- return this.post(url, params, options);
- case 'PUT':
- return this.put(url, params, options);
- case 'DELETE':
- return this.delete(url, params, options);
- default:
- return this.get(url, params, options);
- }
- },
- /**
- * @function FetchRequest.supportDirectRequest
- * @description supportDirectRequest 请求。
- * @param {string} url - 请求地址。
- * @param {Object} options - 请求的配置属性。
- * @returns {boolean} 是否允许跨域请求。
- */
- supportDirectRequest: function (url, options) {
- if (Util.isInTheSameDomain(url)) {
- return true;
- }
- if (options.crossOrigin != undefined) {
- return options.crossOrigin;
- } else {
- return isCORS() || options.proxy;
- }
- },
- /**
- * @function FetchRequest.get
- * @description get 请求。
- * @param {string} url - 请求地址。
- * @param {string} params - 请求参数。
- * @param {Object} options - 请求的配置属性。
- * @returns {Promise} Promise 对象。
- */
- get: function (url, params, options) {
- options = options || {};
- var type = 'GET';
- url = Util.urlAppend(url, this._getParameterString(params || {}));
- url = this._processUrl(url, options);
- if (!this.supportDirectRequest(url, options)) {
- url = url.replace('.json', '.jsonp');
- var config = {
- url: url,
- data: params
- };
- return RequestJSONPPromise.GET(config);
- }
- if (!this.urlIsLong(url)) {
- return this._fetch(url, params, options, type);
- } else {
- return this._postSimulatie(type, url.substring(0, url.indexOf('?')), Util.getParameters(url), options);
- }
- },
- /**
- * @function FetchRequest.delete
- * @description delete 请求。
- * @param {string} url - 请求地址。
- * @param {string} params - 请求参数。
- * @param {Object} options -请求的配置属性。
- * @returns {Promise} Promise 对象。
- */
- delete: function (url, params, options) {
- options = options || {};
- var type = 'DELETE';
- url = Util.urlAppend(url, this._getParameterString(params || {}));
- url = this._processUrl(url, options);
- if (!this.supportDirectRequest(url, options)) {
- url = url.replace('.json', '.jsonp');
- var config = {
- url: url += "&_method=DELETE",
- data: params
- };
- return RequestJSONPPromise.DELETE(config);
- }
- if (this.urlIsLong(url)) {
- return this._postSimulatie(type, url.substring(0, url.indexOf('?')), Util.getParameters(url), options);
- }
- return this._fetch(url, params, options, type);
- },
- /**
- * @function FetchRequest.post
- * @description post 请求。
- * @param {string} url - 请求地址。
- * @param {string} params - 请求参数。
- * @param {Object} options - 请求的配置属性。
- * @returns {Promise} Promise 对象。
- */
- post: function (url, params, options) {
- options = options || {};
- if (!this.supportDirectRequest(url, options)) {
- url = url.replace('.json', '.jsonp');
- var config = {
- url: url += "&_method=POST",
- data: params
- };
- return RequestJSONPPromise.POST(config);
- }
- return this._fetch(this._processUrl(url, options), params, options, 'POST');
- },
- /**
- * @function FetchRequest.put
- * @description put 请求。
- * @param {string} url - 请求地址。
- * @param {string} params - 请求参数。
- * @param {Object} options - 请求的配置属性。
- * @returns {Promise} Promise 对象。
- */
- put: function (url, params, options) {
- options = options || {};
- url = this._processUrl(url, options);
- if (!this.supportDirectRequest(url, options)) {
- url = url.replace('.json', '.jsonp');
- var config = {
- url: url += "&_method=PUT",
- data: params
- };
- return RequestJSONPPromise.PUT(config);
- }
- return this._fetch(url, params, options, 'PUT');
- },
- /**
- * @function FetchRequest.urlIsLong
- * @description url 的字节长度是否太长。
- * @param {string} url - 请求地址。
- * @returns {boolean} url 的字节长度是否太长。
- */
- urlIsLong: function (url) {
- //当前url的字节长度。
- var totalLength = 0,
- charCode = null;
- for (var i = 0, len = url.length; i < len; i++) {
- //转化为Unicode编码
- charCode = url.charCodeAt(i);
- if (charCode < 0x007f) {
- totalLength++;
- } else if ((0x0080 <= charCode) && (charCode <= 0x07ff)) {
- totalLength += 2;
- } else if ((0x0800 <= charCode) && (charCode <= 0xffff)) {
- totalLength += 3;
- }
- }
- return totalLength < 2000 ? false : true;
- },
- _postSimulatie: function (type, url, params, options) {
- var separator = url.indexOf('?') > -1 ? '&' : '?';
- url += separator + '_method=' + type;
- if (typeof params !== 'string') {
- params = JSON.stringify(params);
- }
- return this.post(url, params, options);
- },
- _processUrl: function (url, options) {
- if (this._isMVTRequest(url)) {
- return url;
- }
- if (url.indexOf('.json') === -1 && !options.withoutFormatSuffix) {
- if (url.indexOf('?') < 0) {
- url += '.json';
- } else {
- var urlArrays = url.split('?');
- if (urlArrays.length === 2) {
- url = urlArrays[0] + '.json?' + urlArrays[1];
- }
- }
- }
- if (options && options.proxy) {
- if (typeof options.proxy === 'function') {
- url = options.proxy(url);
- } else {
- url = decodeURIComponent(url);
- url = options.proxy + encodeURIComponent(url);
- }
- }
- return url;
- },
- _fetch: function (url, params, options, type) {
- options = options || {};
- options.headers = options.headers || {};
- if (!options.headers['Content-Type'] && !FormData.prototype.isPrototypeOf(params)) {
- options.headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8';
- }
- if (options.timeout) {
- return this._timeout(
- options.timeout,
- FetchRequest_fetch(url, {
- method: type,
- headers: options.headers,
- body: type === 'PUT' || type === 'POST' ? params : undefined,
- credentials: this._getWithCredentials(options),
- mode: 'cors',
- timeout: getRequestTimeout()
- }).then(function (response) {
- return response;
- })
- );
- }
- return FetchRequest_fetch(url, {
- method: type,
- body: type === 'PUT' || type === 'POST' ? params : undefined,
- headers: options.headers,
- credentials: this._getWithCredentials(options),
- mode: 'cors',
- timeout: getRequestTimeout()
- }).then(function (response) {
- return response;
- });
- },
- _getWithCredentials: function (options) {
- if (options.withCredentials === true) {
- return 'include';
- }
- if (options.withCredentials === false) {
- return 'omit';
- }
- return 'same-origin';
- },
- _fetchJsonp: function (url, options) {
- options = options || {};
- return fetch_jsonp_default()(url, {
- method: 'GET',
- timeout: options.timeout
- }).then(function (response) {
- return response;
- });
- },
- _timeout: function (seconds, promise) {
- return new Promise(function (resolve, reject) {
- setTimeout(function () {
- reject(new Error('timeout'));
- }, seconds);
- promise.then(resolve, reject);
- });
- },
- _getParameterString: function (params) {
- var paramsArray = [];
- for (var key in params) {
- var value = params[key];
- if (value != null && typeof value !== 'function') {
- var encodedValue;
- if (Array.isArray(value) || value.toString() === '[object Object]') {
- encodedValue = encodeURIComponent(JSON.stringify(value));
- } else {
- encodedValue = encodeURIComponent(value);
- }
- paramsArray.push(encodeURIComponent(key) + '=' + encodedValue);
- }
- }
- return paramsArray.join('&');
- },
- _isMVTRequest: function (url) {
- return url.indexOf('.mvt') > -1 || url.indexOf('.pbf') > -1;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/security/SecurityManager.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class SecurityManager
- * @deprecatedclass SuperMap.SecurityManager
- * @category Security
- * @classdesc 安全管理中心,提供 iServer,iPortal,Online 统一权限认证管理。
- * > 使用说明:
- * > 创建任何一个服务之前调用 {@link SecurityManager.registerToken}或
- * > {@link SecurityManager.registerKey}注册凭据。
- * > 发送请求时根据 url 或者服务 id 获取相应的 key 或者 token 并自动添加到服务地址中。
- * @usage
- */
- class SecurityManager {
- /**
- * @description 从服务器获取一个token,在此之前要注册服务器信息。
- * @function SecurityManager.generateToken
- * @param {string} url - 服务器域名+端口,如:http://localhost:8092。
- * @param {TokenServiceParameter} tokenParam - token 申请参数。
- * @returns {Promise} 包含 token 信息的 Promise 对象。
- */
- static generateToken(url, tokenParam) {
- var serverInfo = this.servers[url];
- if (!serverInfo) {
- return;
- }
- return FetchRequest.post(serverInfo.tokenServiceUrl, JSON.stringify(tokenParam.toJSON())).then(function(
- response
- ) {
- return response.text();
- });
- }
- /**
- * @description 注册安全服务器相关信息。
- * @function SecurityManager.registerServers
- * @param {ServerInfo} serverInfos - 服务器信息。
- */
- static registerServers(serverInfos) {
- this.servers = this.servers || {};
- if (!Util.isArray(serverInfos)) {
- serverInfos = [serverInfos];
- }
- for (var i = 0; i < serverInfos.length; i++) {
- var serverInfo = serverInfos[i];
- this.servers[serverInfo.server] = serverInfo;
- }
- }
- /**
- * @description 服务请求都会自动带上这个 token。
- * @function SecurityManager.registerToken
- * @param {string} url -服务器域名+端口:如http://localhost:8090。
- * @param {string} token - token
- */
- static registerToken(url, token) {
- this.tokens = this.tokens || {};
- if (!url || !token) {
- return;
- }
- var domain = this._getTokenStorageKey(url);
- this.tokens[domain] = token;
- }
- /**
- * @description 注册 key,ids 为数组(存在一个 key 对应多个服务)。
- * @function SecurityManager.registerKey
- * @param {Array} ids - 可以是服务 id 数组或者 url 地址数组或者 webAPI 类型数组。
- * @param {string} key - key
- */
- static registerKey(ids, key) {
- this.keys = this.keys || {};
- if (!ids || ids.length < 1 || !key) {
- return;
- }
- ids = Util.isArray(ids) ? ids : [ids];
- for (var i = 0; i < ids.length; i++) {
- var id = this._getUrlRestString(ids[0]) || ids[0];
- this.keys[id] = key;
- }
- }
- /**
- * @description 获取服务器信息。
- * @function SecurityManager.getServerInfo
- * @param {string} url - 服务器域名+端口,如:http://localhost:8092。
- * @returns {ServerInfo} 服务器信息。
- */
- static getServerInfo(url) {
- this.servers = this.servers || {};
- return this.servers[url];
- }
- /**
- * @description 根据 Url 获取token。
- * @function SecurityManager.getToken
- * @param {string} url - 服务器域名+端口,如:http://localhost:8092。
- * @returns {string} token
- */
- static getToken(url) {
- if (!url) {
- return;
- }
- this.tokens = this.tokens || {};
- var domain = this._getTokenStorageKey(url);
- return this.tokens[domain];
- }
- /**
- * @description 根据 Url 获取 key。
- * @function SecurityManager.getKey
- * @param {string} id - id
- * @returns {string} key
- */
- static getKey(id) {
- this.keys = this.keys || {};
- var key = this._getUrlRestString(id) || id;
- return this.keys[key];
- }
- /**
- * @description iServer 登录验证。
- * @function SecurityManager.loginiServer
- * @param {string} url - iServer 首页地址,如:http://localhost:8090/iserver。
- * @param {string} username - 用户名。
- * @param {string} password - 密码。
- * @param {boolean} [rememberme=false] - 是否记住。
- * @returns {Promise} 包含 iServer 登录请求结果的 Promise 对象。
- */
- static loginiServer(url, username, password, rememberme) {
- url = Util.urlPathAppend(url, 'services/security/login');
- var loginInfo = {
- username: username && username.toString(),
- password: password && password.toString(),
- rememberme: rememberme
- };
- loginInfo = JSON.stringify(loginInfo);
- var requestOptions = {
- headers: {
- 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
- }
- };
- return FetchRequest.post(url, loginInfo, requestOptions).then(function(response) {
- return response.json();
- });
- }
- /**
- * @description iServer登出。
- * @function SecurityManager.logoutiServer
- * @param {string} url - iServer 首页地址,如:http://localhost:8090/iserver。
- * @returns {Promise} 是否登出成功。
- */
- static logoutiServer(url) {
- url = Util.urlPathAppend(url, 'services/security/logout');
- var requestOptions = {
- headers: {
- 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
- },
- withoutFormatSuffix: true
- };
- return FetchRequest.get(url, '', requestOptions)
- .then(function() {
- return true;
- })
- .catch(function() {
- return false;
- });
- }
- /**
- * @description Online 登录验证。
- * @function SecurityManager.loginOnline
- * @param {string} callbackLocation - 跳转位置。
- * @param {boolean} [newTab=true] - 是否新窗口打开。
- */
- static loginOnline(callbackLocation, newTab) {
- var loginUrl = SecurityManager.SSO + '/login?service=' + callbackLocation;
- this._open(loginUrl, newTab);
- }
- /**
- * @description iPortal登录验证。
- * @function SecurityManager.loginiPortal
- * @param {string} url - iportal 首页地址,如:http://localhost:8092/iportal.
- * @param {string} username - 用户名。
- * @param {string} password - 密码。
- * @returns {Promise} 包含 iPortal 登录请求结果的 Promise 对象。
- */
- static loginiPortal(url, username, password) {
- url = Util.urlPathAppend(url, 'web/login');
- var loginInfo = {
- username: username && username.toString(),
- password: password && password.toString()
- };
- loginInfo = JSON.stringify(loginInfo);
- var requestOptions = {
- headers: {
- 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
- },
- withCredentials: true
- };
- return FetchRequest.post(url, loginInfo, requestOptions).then(function(response) {
- return response.json();
- });
- }
- /**
- * @description iPortal 登出。
- * @function SecurityManager.logoutiPortal
- * @param {string} url - iportal 首页地址,如:http://localhost:8092/iportal.
- * @returns {Promise} 如果登出成功,返回 true;否则返回 false。
- */
- static logoutiPortal(url) {
- url = Util.urlPathAppend(url, 'services/security/logout');
- var requestOptions = {
- headers: {
- 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
- },
- withCredentials: true,
- withoutFormatSuffix: true
- };
- return FetchRequest.get(url, '', requestOptions)
- .then(function() {
- return true;
- })
- .catch(function() {
- return false;
- });
- }
- /**
- * @description iManager 登录验证。
- * @function SecurityManager.loginManager
- * @param {string} url - iManager 地址。地址参数为 iManager 首页地址,如: http://localhost:8390/imanager。
- * @param {Object} [loginInfoParams] - iManager 登录参数。
- * @param {string} loginInfoParams.userName - 用户名。
- * @param {string} loginInfoParams.password - 密码。
- * @param {Object} options
- * @param {boolean} [options.isNewTab=true] - 不同域时是否在新窗口打开登录页面。
- * @returns {Promise} 包含 iManager 登录请求结果的 Promise 对象。
- */
- static loginManager(url, loginInfoParams, options) {
- if (!Util.isInTheSameDomain(url)) {
- var isNewTab = options ? options.isNewTab : true;
- this._open(url, isNewTab);
- return;
- }
- var requestUrl = Util.urlPathAppend(url, 'icloud/security/tokens');
- var params = loginInfoParams || {};
- var loginInfo = {
- username: params.userName && params.userName.toString(),
- password: params.password && params.password.toString()
- };
- loginInfo = JSON.stringify(loginInfo);
- var requestOptions = {
- headers: {
- Accept: '*/*',
- 'Content-Type': 'application/json'
- }
- };
- var me = this;
- return FetchRequest.post(requestUrl, loginInfo, requestOptions).then(function(response) {
- response.text().then(function(result) {
- me.imanagerToken = result;
- return result;
- });
- });
- }
- /**
- * @description 清空全部验证信息。
- * @function SecurityManager.destroyAllCredentials
- */
- static destroyAllCredentials() {
- this.keys = null;
- this.tokens = null;
- this.servers = null;
- }
- /**
- * @description 清空令牌信息。
- * @function SecurityManager.destroyToken
- * @param {string} url - iportal 首页地址,如:http://localhost:8092/iportal.
- */
- static destroyToken(url) {
- if (!url) {
- return;
- }
- var domain = this._getTokenStorageKey(url);
- this.tokens = this.tokens || {};
- if (this.tokens[domain]) {
- delete this.tokens[domain];
- }
- }
- /**
- * @description 清空服务授权码。
- * @function SecurityManager.destroyKey
- * @param {string} url - iServer 首页地址,如:http://localhost:8090/iserver。
- */
- static destroyKey(url) {
- if (!url) {
- return;
- }
- this.keys = this.keys || {};
- var key = this._getUrlRestString(url) || url;
- if (this.keys[key]) {
- delete this.keys[key];
- }
- }
- /**
- * @description 服务URL追加授权信息,授权信息需先通过SecurityManager.registerKey或SecurityManager.registerToken注册。
- * @version 10.1.2
- * @function SecurityManager.appendCredential
- * @param {string} url - 服务URL
- * @returns {string} 绑定了token或者key的服务URL
- */
- static appendCredential(url) {
- var newUrl = url;
- var value = this.getToken(url);
- var credential = value ? new Credential(value, 'token') : null;
- if (!credential) {
- value = this.getKey(url);
- credential = value ? new Credential(value, 'key') : null;
- }
- if (credential) {
- newUrl = Util.urlAppend(newUrl, credential.getUrlParameters());
- }
- return newUrl;
- }
- static _open(url, newTab) {
- newTab = newTab != null ? newTab : true;
- var offsetX = window.screen.availWidth / 2 - this.INNER_WINDOW_WIDTH / 2;
- var offsetY = window.screen.availHeight / 2 - this.INNER_WINDOW_HEIGHT / 2;
- var options =
- 'height=' +
- this.INNER_WINDOW_HEIGHT +
- ', width=' +
- this.INNER_WINDOW_WIDTH +
- ',top=' +
- offsetY +
- ', left=' +
- offsetX +
- ',toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no';
- if (newTab) {
- window.open(url, 'login');
- } else {
- window.open(url, 'login', options);
- }
- }
- static _getTokenStorageKey(url) {
- var patten = /(.*?):\/\/([^\/]+)/i;
- var result = url.match(patten);
- if (!result) {
- return url;
- }
- return result[0];
- }
- static _getUrlRestString(url) {
- if (!url) {
- return url;
- }
- // var patten = /http:\/\/(.*\/rest)/i;
- var patten = /(http|https):\/\/(.*\/rest)/i;
- var result = url.match(patten);
- if (!result) {
- return url;
- }
- return result[0];
- }
- }
- SecurityManager.INNER_WINDOW_WIDTH = 600;
- SecurityManager.INNER_WINDOW_HEIGHT = 600;
- SecurityManager.SSO = 'https://sso.supermap.com';
- SecurityManager.ONLINE = 'https://www.supermapol.com';
- ;// CONCATENATED MODULE: ./src/common/iManager/iManagerServiceBase.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class IManagerServiceBase
- * @aliasclass iManagerServiceBase
- * @deprecatedclass SuperMap.iManagerServiceBase
- * @classdesc iManager 服务基类(有权限限制的类需要实现此类)。
- * @category iManager
- * @param {string} url - iManager 首页地址,如:http://localhost:8390/imanager。
- * @param {Object} options - 可选参数。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class IManagerServiceBase {
- constructor(url,options) {
- if (url) {
- var end = url.substr(url.length - 1, 1);
- this.serviceUrl = end === "/" ? url.substr(0, url.length - 2) : url;
- }
- this.options = options || {};
- this.CLASS_NAME = "SuperMap.iManagerServiceBase";
- }
- /**
- * @function IManagerServiceBase.prototype.request
- * @description 子类统一通过该方法发送请求。
- * @param {string} url - 请求 URL。
- * @param {string} [method='GET'] - 请求类型。
- * @param {Object} [requestOptions] - 请求选项。
- * @param {Object} param - 请求参数。
- * @description 发送请求。
- * @returns {Promise} Promise 对象。
- */
- request(method, url, param, requestOptions) {
- requestOptions = requestOptions || {
- headers: {
- 'Accept': '*/*',
- 'Content-Type': 'application/json'
- }
- };
- if (!requestOptions.hasOwnProperty("withCredentials")) {
- requestOptions['withCredentials'] = true;
- }
- requestOptions['crossOrigin'] = this.options.crossOrigin;
- requestOptions['headers'] = this.options.headers;
- var token = SecurityManager.imanagerToken;
- if (token) {
- if (!requestOptions.headers) {
- requestOptions.headers = [];
- }
- requestOptions.headers['X-Auth-Token'] = token;
- }
- if (param) {
- param = JSON.stringify(param);
- }
- return FetchRequest.commit(method, url, param, requestOptions).then(function (response) {
- return response.json();
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iManager/iManagerCreateNodeParam.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class IManagerCreateNodeParam
- * @aliasclass iManagerCreateNodeParam
- * @deprecatedclass SuperMap.iManagerCreateNodeParam
- * @classdesc iManager 创建节点参数。
- * @category iManager
- * @param {Object} [params] - 节点参数。
- * @usage
- */
- class IManagerCreateNodeParam {
- constructor(params) {
- params = params || {};
- this.nodeSpec = 'SMALL'; //取值范围: ['SMALL','MEDIUM','LARGE'] 以及自定义的环境规格名称
- this.nodeCount = 1; //要创建vm的个数
- this.nodeName = ''; //vm名称
- this.password = ''; //vm的密码,空表示随机分配
- this.description = ''; //描述信息
- this.physicalMachineName = ''; //vm所属的物理机名称.
- this.ips = []; //vm的ip,空数组表示随机分配
- this.userName = ''; //vm所属用户
- Util.extend(this, params);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iManager/iManager.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class IManager
- * @aliasclass iManager
- * @deprecatedclass SuperMap.iManager
- * @classdesc iManager 服务类。
- * @category iManager
- * @param {string} serviceUrl - iManager 首页地址。
- * @usage
- */
- class IManager extends IManagerServiceBase {
- constructor(iManagerUrl) {
- super(iManagerUrl);
- }
- /**
- * @function IManager.prototype.load
- * @description 获取所有服务接口,验证是否已登录授权。
- * @returns {Promise} Promise 对象。
- */
- load() {
- return this.request("GET", this.serviceUrl + '/web/api/service.json');
- }
- /**
- * @function IManager.prototype.createIServer
- * @param {IManagerCreateNodeParam} createParam - 创建参数。
- * @description 创建 iServer。
- * @returns {Promise} Promise 对象。
- */
- createIServer(createParam) {
- return this.request("POST", this.serviceUrl + '/icloud/web/nodes/server.json', new IManagerCreateNodeParam(createParam));
- }
- /**
- * @function IManager.prototype.createIPortal
- * @param {IManagerCreateNodeParam} createParam - 创建参数。
- * @description 创建 iPortal。
- * @returns {Promise} Promise 对象。
- */
- createIPortal(createParam) {
- return this.request("POST", this.serviceUrl + '/icloud/web/nodes/portal.json', new IManagerCreateNodeParam(createParam));
- }
- /**
- * @function IManager.prototype.iServerList
- * @description 获取所有创建的 iServer。
- * @returns {Promise} Promise 对象。
- */
- iServerList() {
- return this.request("GET", this.serviceUrl + '/icloud/web/nodes/server.json');
- }
- /**
- * @function IManager.prototype.iPortalList
- * @description 获取所有创建的 iPortal。
- * @returns {Promise} Promise 对象。
- */
- iPortalList() {
- return this.request("GET", this.serviceUrl + '/icloud/web/nodes/portal.json');
- }
- /**
- * @function IManager.prototype.startNodes
- * @param {Array.<string>} ids - 需要启动节点的 ID 数组。e.g:['1']。
- * @description 启动节点。
- * @returns {Promise} Promise 对象。
- */
- startNodes(ids) {
- return this.request("POST", this.serviceUrl + '/icloud/web/nodes/started.json', ids);
- }
- /**
- * @function IManager.prototype.stopNodes
- * @param {Array.<string>} ids - 需要停止节点的 ID 数组。e.g:['1']。
- * @description 停止节点。
- * @returns {Promise} Promise 对象。
- */
- stopNodes(ids) {
- return this.request("POST", this.serviceUrl + '/icloud/web/nodes/stopped.json', ids);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iManager/index.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalServiceBase.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class IPortalServiceBase
- * @aliasclass iPortalServiceBase
- * @deprecatedclass SuperMap.iPortalServiceBase
- * @classdesc iPortal 服务基类(有权限限制的类需要实现此类)。
- * @category iPortal/Online Core
- * @param {string} url - 服务地址。
- * @param {Object} options - 可选参数。
- * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class IPortalServiceBase {
- constructor(url, options) {
- options = options || {};
- this.serviceUrl = url;
- this.CLASS_NAME = "SuperMap.iPortalServiceBase";
- this.withCredentials = options.withCredentials || false;
- this.crossOrigin = options.crossOrigin
- this.headers = options.headers
- }
- /**
- * @function IPortalServiceBase.prototype.request
- * @description 子类统一通过该方法发送请求。
- * @param {string} [method='GET'] - 请求类型。
- * @param {string} url - 服务地址。
- * @param {Object} param - 请求参数。
- * @param {Object} [requestOptions] - fetch 请求配置项。
- * @returns {Promise} 返回包含请求结果的 Promise 对象。
- */
- request(method, url, param, requestOptions = {headers: this.headers, crossOrigin: this.crossOrigin, withCredentials: this.withCredentials }) {
- url = SecurityManager.appendCredential(url);
- return FetchRequest.commit(method, url, param, requestOptions).then(function (response) {
- return response.json();
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalQueryParam.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class IPortalQueryParam
- * @aliasclass iPortalQueryParam
- * @deprecatedclass SuperMap.iPortalQueryParam
- * @classdesc iPortal 资源查询参数。
- * @version 10.0.1
- * @category iPortal/Online Resources ResourcesQuery
- * @param {Object} params - 可选参数。
- * @param {ResourceType} [params.resourceType] - 资源类型
- * @param {number} [params.pageSize] - 分页中每页大小。
- * @param {number} [params.currentPage] - 分页页码。
- * @param {OrderBy} [params.orderBy] - 排序字段。
- * @param {OrderType} [params.orderType] - 根据升序还是降序过滤。
- * @param {SearchType} [params.searchType] - 根据查询的范围进行过滤。
- * @param {Array} [params.tags] - 标签。
- * @param {Array} [params.dirIds] - 目录 id
- * @param {Array} [params.resourceSubTypes] - 根据资源的子类型进行过滤。
- * @param {AggregationTypes} [params.aggregationTypes] - 聚合查询的类型。
- * @param {string} [params.text] - 搜索的关键词。
- * @param {Array} [params.groupIds] - 根据群组进行过滤。
- * @param {Array} [params.departmentIds] - 根据部门进行过滤。
- * @usage
- */
- class IPortalQueryParam {
- constructor(params) {
- params = params || {};
- this.resourceType = ""; // 空为全部 MAP SERVICE SCENE DATA INSIGHTS_WORKSPACE MAP_DASHBOARD
- this.pageSize = 12; // 每页多少条
- this.currentPage = 1; // 第几页
- this.orderBy = "UPDATETIME"; // UPDATETIME HEATLEVEL
- this.orderType = "DESC"; // DESC ASC
- this.searchType = "PUBLIC"; // PUBLIC SHARETOME_RES MYDEPARTMENT_RES MYGROUP_RES MY_RES
- this.tags = []; // 标签
- this.dirIds = []; // 类别
- this.resourceSubTypes = []; // 类型
- this.aggregationTypes = []; // TAG TYPE SUBTYPE
- this.text = ""; // 搜索字段
- this.groupIds = []; // 群组Id过滤
- this.departmentIds = []; // 部门Id过滤
- Util.extend(this, params);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalQueryResult.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class IPortalQueryResult
- * @aliasclass iPortalQueryResult
- * @deprecatedclass SuperMap.iPortalQueryResult
- * @classdesc iPortal 资源结果集封装类。
- * @version 10.0.1
- * @category iPortal/Online Resources ResourcesQuery
- * @param {Object} queryResult - 可选参数。
- * @param {Array} [queryResult.content] - 页面内容。
- * @param {number} [queryResult.total] - 总记录数。
- * @param {number} [queryResult.currentPage] - 当前第几页。
- * @param {number} [queryResult.pageSize] - 每页大小。
- * @param {Object} [queryResult.aggregations] - 聚合查询的结果。
- * @usage
- */
- class IPortalQueryResult {
- constructor(queryResult) {
- queryResult = queryResult || {};
- this.content = [];
- this.total = 0;
- this.currentPage = 1;
- this.pageSize = 12;
- this.aggregations = null;
- Util.extend(this, queryResult);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalResource.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class IPortalResource
- * @aliasclass iPortalResource
- * @deprecatedclass SuperMap.iPortalResource
- * @classdesc iPortal 资源详情类。
- * @version 10.0.1
- * @category iPortal/Online Resources
- * @param {string} portalUrl - 服务地址。
- * @param {Object} resourceInfo - 可选参数。
- * @param {Array} [resourceInfo.authorizeSetting] - 资源的授权信息
- * @param {string} [resourceInfo.bounds] - 资源的坐标范围
- * @param {string} [resourceInfo.bounds4326] - 资源的坐标范围,转换为EPSG 4326坐标系统后的地理范围。
- * @param {string} [resourceInfo.checkStatus] - 资源的审核状态,可以是:空,SUCCESSFUL,UNCHECKED,FAILED
- * @param {Date} [resourceInfo.createTime] - 资源的创建时间
- * @param {string} [resourceInfo.description] - 资源描述
- * @param {number} [resourceInfo.dirId] - 资源所在的门户目录的id
- * @param {number} [resourceInfo.epsgCode] - 门户资源基于的坐标系的EPSG值。
- * @param {number} [resourceInfo.heatLevel] - 记录资源的访问量或下载量。
- * @param {string} [resourceInfo.id] - 资源存储到ElasticSearch中的文档id
- * @param {string} [resourceInfo.name] - 资源名称
- * @param {number} [resourceInfo.personalDirId] - 资源所在的个人目录的id
- * @param {number} [resourceInfo.resourceId] - 资源表(maps,services等)里的id
- * @param {string} [resourceInfo.resourceSubType] - 某类资源的具体子类型。
- * @param {ResourceType} [resourceInfo.resourceType] - 资源类型
- * @param {number} [resourceInfo.serviceRootUrlId] - 批量注册服务时,服务根地址的ID
- * @param {Array} [resourceInfo.tags] - 资源的标签
- * @param {string} [resourceInfo.thumbnail] - 资源的缩略图
- * @param {Date} [resourceInfo.updateTime] - 资源的更新时间
- * @param {string} [resourceInfo.userName] - 搜索的关键词
- * @param {Object} [resourceInfo.sourceJSON] - 提供了门户项目返回的所有信息。
- * @extends {IPortalServiceBase}
- * @usage
- */
- class IPortalResource extends IPortalServiceBase {
- constructor(portalUrl, resourceInfo) {
- super(portalUrl);
- resourceInfo = resourceInfo || {};
- this.authorizeSetting = [];
- this.bounds = "";
- this.bounds4326 = "";
- this.checkStatus = "";
- this.createTime = 0;
- this.description = null;
- this.dirId = null;
- this.epsgCode = 0;
- this.heatLevel = 0;
- this.id = 0;
- this.name = "";
- this.personalDirId = null;
- this.resourceId = 0;
- this.resourceSubType = null;
- this.resourceType = null;
- this.serviceRootUrlId = null;
- this.tags = null;
- this.thumbnail = null;
- this.updateTime = 0;
- this.userName = "";
- this.sourceJSON = {};//返回门户资源详细信息
- Util.extend(this, resourceInfo); // INSIGHTS_WORKSPACE MAP_DASHBOARD
- this.resourceUrl = portalUrl + "/web/"+this.resourceType.replace("_","").toLowerCase()+"s/" + this.resourceId;
- if (this.withCredentials) {
- this.resourceUrl = portalUrl + "/web/mycontent/"+this.resourceType.replace("_","").toLowerCase()+"s/" + this.resourceId;
- }
- // if (this.id) {
- // this.mapUrl = mapUrl + "/" + this.id;
- // }
- }
- /**
- * @function IPortalResource.prototype.load
- * @description 加载资源信息。
- * @returns {Promise} 返回 Promise 对象。如果成功,Promise 没有返回值,请求返回结果自动填充到该类的属性中;如果失败,Promise 返回值包含错误信息。
- */
- load() {
- var me = this;
- return me.request("GET", me.resourceUrl + ".json")
- .then(function (resourceInfo) {
- if (resourceInfo.error) {
- return resourceInfo;
- }
- me.sourceJSON = resourceInfo;
- });
- }
- /**
- * @function IPortalResource.prototype.update
- * @description 更新资源属性信息。
- * @returns {Promise} 返回包含更新操作状态的 Promise 对象。
- */
- update() {
- var resourceName = this.resourceType.replace("_","").toLowerCase();
- var options = {
- headers: {'Content-Type': 'application/x-www-form-urlencoded'}
- };
- if( resourceName === 'data') {
- this.resourceUrl = this.resourceUrl + "/attributes.json";
- }
- var entity = JSON.stringify(this.sourceJSON);
- //对服务资源进行编辑时,请求体内容只留关键字字段(目前如果是全部字段 更新返回成功 但其实没有真正的更新)
- if( resourceName === 'service') {
- var serviceInfo = {
- authorizeSetting:this.sourceJSON.authorizeSetting,
- metadata:this.sourceJSON.metadata,
- tags:this.sourceJSON.tags,
- thumbnail:this.sourceJSON.thumbnail,
- tokenRefreshUrl:this.sourceJSON.tokenRefreshUrl
- };
- entity = JSON.stringify(serviceInfo);
- }
- return this.request("PUT", this.resourceUrl, entity, options);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalShareParam.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class IPortalShareParam
- * @aliasclass iPortalShareParam
- * @deprecatedclass SuperMap.iPortalShareParam
- * @classdesc iPortal 资源共享参数。
- * @version 10.0.1
- * @category iPortal/Online Resources ResourcesShare
- * @param {Object} params - 可选参数。
- * @param {ResourceType} [params.resourceType] - 资源类型。
- * @param {Array} [params.ids] - 资源的id数组。
- * @param {IPortalShareEntity} [params.entities] - 资源的实体共享参数
- * @usage
- */
- class IPortalShareParam {
- constructor(params) {
- params = params || {};
- this.ids = [];
- this.entities = [];
- this.resourceType = ""; // MAP SERVICE SCENE DATA INSIGHTS_WORKSPACE MAP_DASHBOARD
- Util.extend(this, params);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iPortal/iPortal.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class IPortal
- * @aliasclass iPortal
- * @deprecatedclass SuperMap.iPortal
- * @classdesc 对接 SuperMap iPortal 基础服务。
- * @category iPortal/Online Resources
- * @extends {IPortalServiceBase}
- * @param {string} iportalUrl - 服务地址。
- * @param {Object} options - 可选参数。
- * @param {boolean} [options.withCredentials] - 请求是否携带 cookie。
- * @usage
- */
- class IPortal extends IPortalServiceBase {
- constructor(iportalUrl, options) {
- super(iportalUrl, options);
- this.iportalUrl = iportalUrl;
- options = options || {};
- this.withCredentials = options.withCredentials || false;
- }
- /**
- * @function IPortal.prototype.load
- * @description 加载页面。
- * @returns {Promise} 包含 iportal web 资源信息的 Promise 对象。
- */
- load() {
- return FetchRequest.get(this.iportalUrl + "/web");
- }
- /**
- * @function IPortal.prototype.queryResources
- * @description 查询资源。
- * @version 10.0.1
- * @param {IPortalQueryParam} queryParams - 查询参数。
- * @returns {Promise} 包含所有资源结果的 Promise 对象。
- */
- queryResources(queryParams) {
- if (!(queryParams instanceof IPortalQueryParam)) {
- return new Promise( function(resolve){
- resolve(
- "queryParams is not instanceof iPortalQueryParam !"
- );
- });
- }
- var me = this;
- var resourceUrl = this.iportalUrl + "/gateway/catalog/resource/search.json";
- queryParams.t = new Date().getTime();
- return this.request("GET", resourceUrl, queryParams).then(function(result) {
- var content = [];
- result.content.forEach(function(item) {
- content.push(new IPortalResource(me.iportalUrl, item));
- });
- let queryResult = new IPortalQueryResult();
- queryResult.content = content;
- queryResult.total = result.total;
- queryResult.currentPage = result.currentPage;
- queryResult.pageSize = result.pageSize;
- queryResult.aggregations = result.aggregations;
- return queryResult;
- });
- }
- /**
- * @function IPortal.prototype.updateResourcesShareSetting
- * @description 更新共享设置。
- * @version 10.0.1
- * @param {IPortalShareParam} shareParams - 共享的参数。
- * @returns {Promise} 包含共享资源结果的 Promise 对象。
- */
- updateResourcesShareSetting(shareParams) {
- if (!(shareParams instanceof IPortalShareParam)) {
- return new Promise( function(resolve){
- resolve(
- "shareParams is not instanceof iPortalShareParam !"
- );
- });
- }
- var resourceUrlName = shareParams.resourceType.replace("_","").toLowerCase()+"s";
- if(resourceUrlName === "datas"){
- resourceUrlName = "mycontent/"+resourceUrlName;
- }
- var cloneShareParams = {
- ids: shareParams.ids,
- entities: shareParams.entities
- }
- var shareUrl = this.iportalUrl + "/web/"+resourceUrlName+"/sharesetting.json";
- return this.request("PUT", shareUrl, JSON.stringify(cloneShareParams)).then(function(result) {
- return result;
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalShareEntity.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class IPortalShareEntity
- * @aliasclass iPortalShareEntity
- * @deprecatedclass SuperMap.iPortalShareEntity
- * @classdesc iPortal 资源共享实体参数。
- * @version 10.0.1
- * @category iPortal/Online Resources ResourcesShare
- * @param {Object} shareEntity - 可选参数。
- * @param {PermissionType} [shareEntity.permissionType] - 权限类型。
- * @param {EntityType} [shareEntity.entityType] - 实体类型。
- * @param {string} [shareEntity.entityName] - 实体 Name。对应的 USER(用户)、 ROLE(角色)、GROUP(用户组)、IPORTALGROUP(群组)的名称。
- * @param {number} [shareEntity.entityId] - 实体的 id。用于群组的授权。
- * @usage
- */
- class IPortalShareEntity {
- constructor(shareEntity) {
- shareEntity = shareEntity || {};
- this.permissionType = ""; // SEARCH READ READWRITE DOWNLOAD
- this.entityType = ""; // USER DEPARTMENT IPORTALGROUP
- this.entityName = "GUEST"; // GUEST or 具体用户 name
- this.entityId = null;
- Util.extend(this, shareEntity);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalAddResourceParam.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
-
- /**
- * @class IPortalAddResourceParam
- * @aliasclass iPortalAddResourceParam
- * @deprecatedclass SuperMap.iPortalAddResourceParam
- * @classdesc iPortal 添加资源参数。
- * @version 10.0.1
- * @category iPortal/Online Resources ResourcesShare
- * @param {Object} params - 可选参数。
- * @param {string} [params.rootUrl] - 服务地址。
- * @param {Array} [params.tags] - 标签。
- * @param {IPortalShareEntity} [params.entities] - 资源的实体共享参数
- * @usage
- */
- class IPortalAddResourceParam {
- constructor(params) {
- params = params || {};
- this.rootUrl = "";
- this.tags = [];
- this.entities = [];
- Util.extend(this, params);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalRegisterServiceParam.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class IPortalRegisterServiceParam
- * @aliasclass iPortalRegisterServiceParam
- * @deprecatedclass SuperMap.iPortalRegisterServiceParam
- * @classdesc iPortal 注册服务参数。
- * @version 10.0.1
- * @category iPortal/Online Resources Data
- * @param {Object} params - 可选参数。
- * @param {string} [params.type] - 服务类型。
- * @param {Array} [params.tags] - 服务标签。
- * @param {IPortalShareEntity} [params.entities] - 资源的实体共享参数
- * @param {Object} [params.metadata] - 服务元信息。
- * @param {Array} [params.addedMapNames] - 地图服务列表。
- * @param {Array} [params.addedSceneNames] - 场景服务列表。
- * @usage
- */
- class IPortalRegisterServiceParam {
- constructor(params) {
- params = params || {};
- this.type = ""; // SUPERMAP_REST ARCGIS_REST WMS WFS WCS WPS WMTS OTHERS
- this.tags = [];
- this.entities = [];
- this.metadata = {};
- this.addedMapNames = [];
- this.addedSceneNames = [];
- Util.extend(this, params);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalAddDataParam.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
-
- /**
- * @class IPortalAddDataParam
- * @aliasclass iPortalAddDataParam
- * @deprecatedclass SuperMap.iPortalAddDataParam
- * @classdesc iPortal 上传/注册数据所需的参数。
- * @version 10.0.1
- * @category iPortal/Online Resources Data
- * @param {Object} params - 参数。
- * @param {string} params.fileName - 文件名称
- * @param {DataItemType} params.type - 数据类型。
- * @param {Array} [params.tags] - 数据的标签
- * @param {IPortalDataMetaInfoParam} [params.dataMetaInfo] - 数据元信息
- * @usage
- */
- class IPortalAddDataParam {
- constructor(params) {
- params = params || {};
- this.fileName = "";
- this.type = "";
- this.tags = [];
- this.dataMetaInfo = {};
- Util.extend(this, params);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalDataMetaInfoParam.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
-
- /**
- * @class IPortalDataMetaInfoParam
- * @aliasclass iPortalDataMetaInfoParam
- * @deprecatedclass SuperMap.iPortalDataMetaInfoParam
- * @classdesc iPortal 上传数据/注册数据元信息所需的参数。
- * @version 10.0.1
- * @category iPortal/Online Resources Data
- * @param {Object} params - 参数。
- * @param {string} params.xField - X 坐标字段
- * @param {string} params.yField - Y 坐标字段
- * @param {number} params.xIndex - x所在列(关系型存储下CSV或EXCEL数据时必填)
- * @param {number} params.yIndex - y所在列(关系型存储下CSV或EXCEL数据时必填)
- * @param {Array.<string>} [params.fieldTypes] - 设置字段类型(关系型存储下CSV或EXCEL数据时可选填)。默认类型为:WTEXT。该参数按照CSV文件字段顺序从左到右依次设置,其中默认字段类型可省略不设置。例如,CSV文件中有10个字段,如果只需设定第1,2,4个字段,可设置为['a','b',,'c']。
- * @param {string} params.separator - 分隔符(关系型存储下CSV数据时必填)
- * @param {boolean} params.firstRowIsHead - 是否带表头(关系型存储下CSV数据时必填)
- * @param {boolean} params.url - HDFS注册目录地址
- * @param {IPortalDataStoreInfoParam} params.dataStoreInfo - 注册数据时的数据存储信息
- * @usage
- */
- class IPortalDataMetaInfoParam {
- constructor(params) {
- params = params || {};
- this.xField = "";
- this.yField = "";
- this.fileEncoding = "UTF-8";
- this.xIndex = 1;
- this.yIndex = 1;
- this.fieldTypes = [];
- this.separator = "";
- this.firstRowIsHead = true;
- this.url = "";
- this.dataStoreInfo = {};
- Util.extend(this, params);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalDataStoreInfoParam.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
-
- /**
- * @class IPortalDataStoreInfoParam
- * @aliasclass iPortalDataStoreInfoParam
- * @deprecatedclass SuperMap.iPortalDataStoreInfoParam
- * @classdesc iPortal 注册一个HBASE HDFS数据存储类。
- * @version 10.0.1
- * @category iPortal/Online Resources Data
- * @param {Object} params - 参数。
- * @param {string} params.type - 大数据文件共享类型和空间数据库类型,包括大数据文件共享HDFS 目录(HDFS)和空间数据库HBASE
- * @param {string} params.url - HDFS数据存储目录地址
- * @param {IPortalDataConnectionInfoParam} [params.connectionInfo] - HBASE空间数据库服务的连接信息
- * @usage
- */
- class IPortalDataStoreInfoParam {
- constructor(params) {
- params = params || {};
- this.type = "";
- this.url = "";
- this.connectionInfo = {};
- Util.extend(this, params);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalDataConnectionInfoParam.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
-
- /**
- * @class IPortalDataConnectionInfoParam
- * @aliasclass iPortalDataConnectionInfoParam
- * @deprecatedclass SuperMap.iPortalDataConnectionInfoParam
- * @classdesc iPortal HBASE数据源连接信息类。
- * @version 10.0.1
- * @category iPortal/Online Resources Data
- * @param {Object} params - 参数。
- * @param {string} params.dataBase - 数据源连接的数据库名。
- * @param {string} params.server - 服务地址。
- * @usage
- */
- class IPortalDataConnectionInfoParam {
- constructor(params) {
- params = params || {};
- this.dataBase = "";
- this.server = "";
- Util.extend(this, params);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalUser.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class IPortalUser
- * @aliasclass iPortalUser
- * @deprecatedclass SuperMap.iPortalUser
- * @classdesc iPortal 门户中用户信息的封装类。用于管理用户资源,包括可删除,添加资源。
- * @version 10.0.1
- * @category iPortal/Online Resources
- * @param {string} iportalUrl - 服务地址。
- * @extends {IPortalServiceBase}
- * @usage
- */
- class IPortalUser extends IPortalServiceBase {
- constructor(iportalUrl) {
- super(iportalUrl);
- this.iportalUrl = iportalUrl;
- }
- /**
- * @function IPortalUser.prototype.deleteResources
- * @description 删除资源。
- * @param {Object} params - 删除资源所需的参数对象:{ids,resourceType}。
- * @returns {Promise} 返回包含删除操作状态的 Promise 对象。
- */
- deleteResources(params) {
- var resourceName = params.resourceType.replace("_","").toLowerCase();
- var deleteResourceUrl = this.iportalUrl+"/web/" + resourceName +"s.json?ids=" + encodeURI(JSON.stringify(params.ids));
- if( resourceName === 'data') {
- deleteResourceUrl = this.iportalUrl + "/web/mycontent/datas/delete.json";
- return this.request("POST", deleteResourceUrl, JSON.stringify(params.ids));
- }
- return this.request("DELETE", deleteResourceUrl);
- }
- /**
- * @function IPortalUser.prototype.addMap
- * @description 添加地图。
- * @version 10.1.0
- * @param {IPortalAddResourceParam} addMapParams - 添加地图的参数。
- * @returns {Promise} 返回包含添加地图结果的 Promise 对象。
- */
- addMap(addMapParams) {
- if (!(addMapParams instanceof IPortalAddResourceParam)) {
- return this.getErrMsgPromise("addMapParams is not instanceof IPortalAddResourceParam !");
- }
- let cloneAddMapParams = {
- rootUrl: addMapParams.rootUrl,
- tags: addMapParams.tags,
- authorizeSetting: addMapParams.entities
- }
- let addMapUrl = this.iportalUrl + "/web/maps/batchaddmaps.json";
- return this.request("POST", addMapUrl, JSON.stringify(cloneAddMapParams)).then(function(result) {
- return result;
- });
- }
- /**
- * @function IPortalUser.prototype.addScene
- * @description 添加场景。
- * @version 10.1.0
- * @param {IPortalAddResourceParam} addSceneParams - 添加场景的参数。
- * @returns {Promise} 返回包含添加场景结果的 Promise 对象。
- */
- addScene(addSceneParams) {
- if (!(addSceneParams instanceof IPortalAddResourceParam)) {
- return this.getErrMsgPromise("addSceneParams is not instanceof IPortalAddResourceParam !");
- }
- let cloneAddSceneParams = {
- rootUrl: addSceneParams.rootUrl,
- tags: addSceneParams.tags,
- authorizeSetting: addSceneParams.entities
- }
- let addSceneUrl = this.iportalUrl + "/web/scenes/batchaddscenes.json";
- return this.request("POST", addSceneUrl, JSON.stringify(cloneAddSceneParams)).then(function(result) {
- return result;
- });
- }
- /**
- * @function IPortalUser.prototype.registerService
- * @description 注册服务。
- * @version 10.1.0
- * @param {IPortalRegisterServiceParam} registerParams - 注册服务的参数。
- * @returns {Promise} 返回包含注册服务结果的 Promise 对象。
- */
- registerService(registerParams) {
- if(!(registerParams instanceof IPortalRegisterServiceParam)) {
- return this.getErrMsgPromise("registerParams is not instanceof IPortalRegisterServiceParam !");
- }
- let cloneRegisterParams = {
- type: registerParams.type,
- tags: registerParams.tags,
- authorizeSetting: registerParams.entities,
- metadata: registerParams.metadata,
- addedMapNames: registerParams.addedMapNames,
- addedSceneNames: registerParams.addedSceneNames
- }
- let registerUrl = this.iportalUrl + "/web/services.json";
- return this.request("POST", registerUrl, JSON.stringify(cloneRegisterParams)).then(result => {
- return result;
- });
- }
- /**
- * @function IPortalUser.prototype.getErrMsgPromise
- * @description 获取包含错误信息的Promise对象。
- * @version 10.1.0
- * @param {string} errMsg - 传入的错误信息。
- * @returns {Promise} 返回包含错误信息的 Promise 对象。
- */
- getErrMsgPromise(errMsg) {
- return new Promise(resolve => {
- resolve(errMsg);
- })
- }
- /**
- * @function IPortalUser.prototype.uploadDataRequest
- * @description 上传数据。
- * @version 10.1.0
- * @param {number} id - 上传数据的资源id。
- * @param {Object} formData - 请求体为文本数据流。
- * @returns {Promise} 返回包含上传数据操作的 Promise 对象。
- */
- uploadDataRequest(id,formData) {
- var uploadDataUrl = this.iportalUrl + "/web/mycontent/datas/"+id+"/upload.json";
- return this.request("POST",uploadDataUrl,formData);
- }
- /**
- * @function IPortalUser.prototype.addData
- * @description 上传/注册数据。
- * @version 10.1.0
- * @param {IPortalAddDataParam} params - 上传/注册数据所需的参数。
- * @param {Object} [formData] - 请求体为文本数据流(上传数据时传入)。
- * @returns {Promise} 返回上传/注册数据的 Promise 对象。
- */
- addData(params,formData) {
- if(!(params instanceof IPortalAddDataParam)){
- return this.getErrMsgPromise("params is not instanceof iPortalAddDataParam !");
- }
- var datasUrl = this.iportalUrl + "/web/mycontent/datas.json";
- var entity = {
- fileName:params.fileName,
- tags:params.tags,
- type:params.type
- };
- var type = params.type.toLowerCase();
- var dataMetaInfo;
- if(type === "excel" || type === "csv"){
- if(!(params.dataMetaInfo instanceof IPortalDataMetaInfoParam)){
- return this.getErrMsgPromise("params.dataMetaInfo is not instanceof iPortalDataMetaInfoParam !");
- }
- dataMetaInfo = {
- xField:params.dataMetaInfo.xField,
- yField:params.dataMetaInfo.yField
- }
- if(type === 'csv') {
- dataMetaInfo.fileEncoding = params.dataMetaInfo.fileEncoding
- }
- entity.coordType = "WGS84";
- entity.dataMetaInfo = dataMetaInfo;
- }else if(type === "hdfs" || type === "hbase") {
- if(!(params.dataMetaInfo instanceof IPortalDataMetaInfoParam)){
- return this.getErrMsgPromise("params.dataMetaInfo is not instanceof iPortalDataMetaInfoParam !");
- }
- if(!(params.dataMetaInfo.dataStoreInfo instanceof IPortalDataStoreInfoParam)){
- return this.getErrMsgPromise("params.dataMetaInfo.dataStoreInfo is not instanceof iPortalDataStoreInfoParam !");
- }
- var dataStoreInfo = {
- type:params.dataMetaInfo.dataStoreInfo.type
- }
- switch (type) {
- case "hdfs":
- dataStoreInfo.url = params.dataMetaInfo.dataStoreInfo.url;
- dataMetaInfo = {
- url: params.dataMetaInfo.url,
- dataStoreInfo:dataStoreInfo
- }
- break;
- case "hbase":
- if(!(params.dataMetaInfo.dataStoreInfo.connectionInfo instanceof IPortalDataConnectionInfoParam)){
- return this.getErrMsgPromise("params.dataMetaInfo.dataStoreInfo.connectionInfo is not instanceof iPortalDataConnectionInfoParam !");
- }
- dataStoreInfo.connectionInfo = {
- dataBase:params.dataMetaInfo.dataStoreInfo.connectionInfo.dataBase,
- server:params.dataMetaInfo.dataStoreInfo.connectionInfo.server,
- engineType:'HBASE'
- }
- dataStoreInfo.datastoreType = "SPATIAL";//该字段SPATIAL表示HBASE注册
- dataMetaInfo = {
- dataStoreInfo:dataStoreInfo
- }
- break;
- }
- entity.dataMetaInfo = dataMetaInfo;
- }
- return this.request("POST",datasUrl,JSON.stringify(entity)).then(res=>{
- if(type === "hdfs" || type === "hbase"){
- return res;
- }else {
- if(res.childID) {
- return this.uploadDataRequest(res.childID,formData);
- }else {
- return res.customResult;
- }
- }
- })
- }
- /**
- * @function IPortalUser.prototype.publishOrUnpublish
- * @description 发布/取消发布。
- * @version 10.1.0
- * @param {Object} options - 发布/取消发布数据服务所需的参数。
- * @param {Object} options.dataId - 数据项id。
- * @param {Object} options.serviceType - 发布的服务类型,目前支持发布的服务类型包括:RESTDATA, RESTMAP, RESTREALSPACE, RESTSPATIALANALYST。
- * @param {Object} [options.dataServiceId] - 发布的服务 id。
- * @param {boolean} forPublish - 是否取消发布。
- * @returns {Promise} 返回发布/取消发布数据服务的 Promise 对象。
- */
- publishOrUnpublish(option,forPublish){
- if(!option.dataId || !option.serviceType) {
- return this.getErrMsgPromise("option.dataID and option.serviceType are Required!");
- }
- var dataId = option.dataId;
- var dataServiceId = option.dataServiceId;
- var serviceType = option.serviceType;
- var publishUrl = this.iportalUrl + "/web/mycontent/datas/" + dataId + "/publishstatus.json?serviceType=" + serviceType;
- if (dataServiceId) {
- publishUrl += "&dataServiceId=" + dataServiceId;
- }
- return this.request("PUT",publishUrl,JSON.stringify(forPublish)).then(res=>{
- // 发起服务状态查询
- if(forPublish) {
- // 发布服务的结果异步处理
- // var publishStateUrl = this.iportalUrl + "web/mycontent/datas/" + dataId + "/publishstatus.rjson";
- if (!dataServiceId) { // 发布服务时会回传serviceIDs,发布服务之前serviceIDs为空
- dataServiceId = res.customResult;
- }
- return dataServiceId;
- }else {
- // 取消发布的结果同步处理
- return res;
- }
- });
- }
- /**
- * @function IPortalUser.prototype.getDataPublishedStatus
- * @description 查询服务状态,发起服务状态查询。
- * @version 10.1.0
- * @param {number} dataId - 查询服务状态的数据项id。
- * @param {string} dataServiceId - 发布的服务id。
- * @returns {Promise} 返回查询服务状态的 Promise 对象。
- */
- getDataPublishedStatus(dataId,dataServiceId){
- var publishStateUrl = this.iportalUrl + "/web/mycontent/datas/" + dataId + "/publishstatus.json?dataServiceId="+dataServiceId+"&forPublish=true";
- return this.request("GET",publishStateUrl);
- }
- /**
- * @function IPortalUser.prototype.unPublishedDataService
- * @description 取消发布。
- * @version 10.1.0
- * @param {Object} options - 取消发布服务具体参数。
- * @param {Object} options.dataId - 数据项id。
- * @param {Object} options.serviceType - 发布的服务类型,目前支持发布的服务类型包括:RESTDATA, RESTMAP, RESTREALSPACE, RESTSPATIALANALYST。
- * @param {Object} [options.dataServiceId] - 发布的服务 id。
- * @returns {Promise} 返回取消发布数据服务的 Promise 对象。
- */
- unPublishDataService(option){
- return this.publishOrUnpublish(option,false);
- }
- /**
- * @function IPortalUser.prototype.publishedDataService
- * @description 发布数据服务。
- * @version 10.1.0
- * @param {Object} options - 发布数据服务具体参数。
- * @param {Object} options.dataId - 数据项id。
- * @param {Object} options.serviceType - 发布的服务类型,目前支持发布的服务类型包括:RESTDATA, RESTMAP, RESTREALSPACE, RESTSPATIALANALYST。
- * @param {Object} [options.dataServiceId] - 发布的服务 id。
- * @returns {Promise} 返回发布数据服务的 Promise 对象。
- */
- publishDataService(option){
- return this.publishOrUnpublish(option,true);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iPortal/index.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- ;// CONCATENATED MODULE: ./src/common/iServer/CommonServiceBase.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class CommonServiceBase
- * @deprecatedclass SuperMap.CommonServiceBase
- * @category iServer Core
- * @classdesc 对接 iServer 各种服务的 Service 的基类。
- * @param {string} url - 服务地址。
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
- * @param {string} [options.proxy] - 服务代理地址。
- * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class CommonServiceBase {
- constructor(url, options) {
- let me = this;
- this.EVENT_TYPES = ['processCompleted', 'processFailed'];
- this.events = null;
- this.eventListeners = null;
- this.url = null;
- this.urls = null;
- this.proxy = null;
- this.index = null;
- this.length = null;
- this.options = null;
- this.totalTimes = null;
- this.POLLING_TIMES = 3;
- this._processSuccess = null;
- this._processFailed = null;
- this.isInTheSameDomain = null;
- this.withCredentials = false;
- if (Util.isArray(url)) {
- me.urls = url;
- me.length = url.length;
- me.totalTimes = me.length;
- if (me.length === 1) {
- me.url = url[0];
- } else {
- me.index = parseInt(Math.random() * me.length);
- me.url = url[me.index];
- }
- } else {
- me.totalTimes = 1;
- me.url = url;
- }
- if (Util.isArray(url) && !me.isServiceSupportPolling()) {
- me.url = url[0];
- me.totalTimes = 1;
- }
- options = options || {};
- this.crossOrigin = options.crossOrigin;
- this.headers = options.headers;
- Util.extend(this, options);
- me.isInTheSameDomain = Util.isInTheSameDomain(me.url);
- me.events = new Events(me, null, me.EVENT_TYPES, true);
- if (me.eventListeners instanceof Object) {
- me.events.on(me.eventListeners);
- }
- this.CLASS_NAME = 'SuperMap.CommonServiceBase';
- }
- /**
- * @function CommonServiceBase.prototype.destroy
- * @description 释放资源,将引用的资源属性置空。
- */
- destroy() {
- let me = this;
- if (Util.isArray(me.urls)) {
- me.urls = null;
- me.index = null;
- me.length = null;
- me.totalTimes = null;
- }
- me.url = null;
- me.options = null;
- me._processSuccess = null;
- me._processFailed = null;
- me.isInTheSameDomain = null;
- me.EVENT_TYPES = null;
- if (me.events) {
- me.events.destroy();
- me.events = null;
- }
- if (me.eventListeners) {
- me.eventListeners = null;
- }
- }
- /**
- * @function CommonServiceBase.prototype.request
- * @description: 该方法用于向服务发送请求。
- * @param {Object} options - 参数。
- * @param {string} [options.method='GET'] - 请求方式,包括 "GET","POST","PUT","DELETE"。
- * @param {string} [options.url] - 发送请求的地址。
- * @param {Object} [options.params] - 作为查询字符串添加到 URL 中的一组键值对,此参数只适用于 GET 方式发送的请求。
- * @param {string} [options.data] - 发送到服务器的数据。
- * @param {function} options.success - 请求成功后的回调函数。
- * @param {function} options.failure - 请求失败后的回调函数。
- * @param {Object} [options.scope] - 如果回调函数是对象的一个公共方法,设定该对象的范围。
- * @param {boolean} [options.isInTheSameDomain] - 请求是否在当前域中。
- * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- */
- request(options) {
- let me = this;
- options.url = options.url || me.url;
- options.proxy = options.proxy || me.proxy;
- options.withCredentials = options.withCredentials != undefined ? options.withCredentials : me.withCredentials;
- options.crossOrigin = options.crossOrigin != undefined ? options.crossOrigin : me.crossOrigin;
- options.headers = options.headers || me.headers;
- options.isInTheSameDomain = me.isInTheSameDomain;
- options.withoutFormatSuffix = options.scope.withoutFormatSuffix || false;
- //为url添加安全认证信息片段
- options.url = SecurityManager.appendCredential(options.url);
- me.calculatePollingTimes();
- me._processSuccess = options.success;
- me._processFailed = options.failure;
- options.scope = me;
- options.success = me.getUrlCompleted;
- options.failure = me.getUrlFailed;
- me.options = options;
- me._commit(me.options);
- }
- /**
- * @function CommonServiceBase.prototype.getUrlCompleted
- * @description 请求成功后执行此方法。
- * @param {Object} result - 服务器返回的结果对象。
- */
- getUrlCompleted(result) {
- let me = this;
- me._processSuccess(result);
- }
- /**
- * @function CommonServiceBase.prototype.getUrlFailed
- * @description 请求失败后执行此方法。
- * @param {Object} result - 服务器返回的结果对象。
- */
- getUrlFailed(result) {
- let me = this;
- if (me.totalTimes > 0) {
- me.totalTimes--;
- me.ajaxPolling();
- } else {
- me._processFailed(result);
- }
- }
- /**
- *
- * @function CommonServiceBase.prototype.ajaxPolling
- * @description 请求失败后,如果剩余请求失败次数不为 0,重新获取 URL 发送请求
- */
- ajaxPolling() {
- let me = this,
- url = me.options.url,
- re = /^http:\/\/([a-z]{9}|(\d+\.){3}\d+):\d{0,4}/;
- me.index = parseInt(Math.random() * me.length);
- me.url = me.urls[me.index];
- url = url.replace(re, re.exec(me.url)[0]);
- me.options.url = url;
- me.options.isInTheSameDomain = Util.isInTheSameDomain(url);
- me._commit(me.options);
- }
- /**
- * @function CommonServiceBase.prototype.calculatePollingTimes
- * @description 计算剩余请求失败执行次数。
- */
- calculatePollingTimes() {
- let me = this;
- if (me.times) {
- if (me.totalTimes > me.POLLING_TIMES) {
- if (me.times > me.POLLING_TIMES) {
- me.totalTimes = me.POLLING_TIMES;
- } else {
- me.totalTimes = me.times;
- }
- } else {
- if (me.times < me.totalTimes) {
- me.totalTimes = me.times;
- }
- }
- } else {
- if (me.totalTimes > me.POLLING_TIMES) {
- me.totalTimes = me.POLLING_TIMES;
- }
- }
- me.totalTimes--;
- }
- /**
- * @function CommonServiceBase.prototype.isServiceSupportPolling
- * @description 判断服务是否支持轮询。
- */
- isServiceSupportPolling() {
- let me = this;
- return !(
- me.CLASS_NAME === 'SuperMap.REST.ThemeService' || me.CLASS_NAME === 'SuperMap.REST.EditFeaturesService'
- );
- }
- /**
- * @function CommonServiceBase.prototype.serviceProcessCompleted
- * @description 状态完成,执行此方法。
- * @param {Object} result - 服务器返回的结果对象。
- */
- serviceProcessCompleted(result) {
- result = Util.transformResult(result);
- this.events.triggerEvent('processCompleted', {
- result: result
- });
- }
- /**
- * @function CommonServiceBase.prototype.serviceProcessFailed
- * @description 状态失败,执行此方法。
- * @param {Object} result - 服务器返回的结果对象。
- */
- serviceProcessFailed(result) {
- result = Util.transformResult(result);
- let error = result.error || result;
- this.events.triggerEvent('processFailed', {
- error: error
- });
- }
- _commit(options) {
- if (options.method === 'POST' || options.method === 'PUT' || options.method === 'PATCH') {
- if (options.params) {
- options.url = Util.urlAppend(options.url, Util.getParameterString(options.params || {}));
- }
- if (typeof options.data === 'object') {
- try {
- options.params = Util.toJSON(options.data);
- } catch (e) {
- console.log('不是json对象');
- }
- } else {
- options.params = options.data;
- }
- }
- FetchRequest.commit(options.method, options.url, options.params, {
- headers: options.headers,
- withoutFormatSuffix: options.withoutFormatSuffix,
- withCredentials: options.withCredentials,
- crossOrigin: options.crossOrigin,
- timeout: options.async ? 0 : null,
- proxy: options.proxy
- })
- .then(function (response) {
- if (response.text) {
- return response.text();
- }
- if (response.json) {
- return response.json();
- }
- return response;
- })
- .then(function (text) {
- let requestResult = text;
- if (typeof text === 'string') {
- requestResult = new JSONFormat().read(text);
- }
- if (
- !requestResult ||
- requestResult.error ||
- (requestResult.code >= 300 && requestResult.code !== 304)
- ) {
- if (requestResult && requestResult.error) {
- requestResult = {
- error: requestResult.error
- };
- } else {
- requestResult = {
- error: requestResult
- };
- }
- }
- return requestResult;
- })
- .catch(function (e) {
- return { error: e };
- })
- .then((requestResult) => {
- if (requestResult.error) {
- var failure = options.scope ? FunctionExt.bind(options.failure, options.scope) : options.failure;
- failure(requestResult);
- } else {
- requestResult.succeed = requestResult.succeed == undefined ? true : requestResult.succeed;
- var success = options.scope ? FunctionExt.bind(options.success, options.scope) : options.success;
- success(requestResult);
- }
- });
- }
- }
- /**
- * 服务器请求回调函数
- * @callback RequestCallback
- * @category BaseTypes Util
- * @example
- * var requestCallback = function (serviceResult){
- * console.log(serviceResult.result);
- * }
- * new QueryService(url).queryByBounds(param, requestCallback);
- * @param {Object} serviceResult
- * @param {Object} serviceResult.result 服务器返回结果。
- * @param {Object} serviceResult.object 发布应用程序事件的对象。
- * @param {Object} serviceResult.type 事件类型。
- * @param {Object} serviceResult.element 接受浏览器事件的 DOM 节点。
- */
- ;// CONCATENATED MODULE: ./src/common/iServer/GeoCodingParameter.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GeoCodingParameter
- * @deprecatedclass SuperMap.GeoCodingParameter
- * @category iServer AddressMatch
- * @classdesc 地理正向匹配参数类。
- * @param {Object} options - 参数。
- * @param {string} options.address - 地点关键词。
- * @param {number} [options.fromIndex] - 设置返回对象的起始索引值。
- * @param {number} [options.toIndex] - 设置返回对象的结束索引值。
- * @param {Array.<string>} [options.filters] - 过滤字段,限定查询区域。
- * @param {string} [options.prjCoordSys] - 查询结果的坐标系。
- * @param {number} [options.maxReturn] - 最大返回结果数。
- * @usage
- */
- class GeoCodingParameter {
- constructor(options) {
- if (options.filters && typeof(options.filters) === 'string') {
- options.filters = options.filters.split(',');
- }
- /**
- * @member {string} GeoCodingParameter.prototype.address
- * @description 地点关键词。
- */
- this.address = null;
- /**
- * @member {number} [GeoCodingParameter.prototype.fromIndex]
- * @description 设置返回对象的起始索引值。
- */
- this.fromIndex = null;
- /**
- * @member {number} [GeoCodingParameter.prototype.toIndex]
- * @description 设置返回对象的结束索引值。
- */
- this.toIndex = null;
- /**
- * @member {Array.<string>} [GeoCodingParameter.prototype.filters]
- * @description 过滤字段,限定查询区域。
- */
- this.filters = null;
- /**
- * @member {string} [GeoCodingParameter.prototype.prjCoordSys]
- * @description 查询结果的坐标系。
- */
- this.prjCoordSys = null;
- /**
- * @member {number} [GeoCodingParameter.prototype.maxReturn]
- * @description 最大返回结果数。
- */
- this.maxReturn = null;
- Util.extend(this, options);
- }
- /**
- * @function GeoCodingParameter.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- this.address = null;
- this.fromIndex = null;
- this.toIndex = null;
- this.filters = null;
- this.prjCoordSys = null;
- this.maxReturn = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/GeoDecodingParameter.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GeoDecodingParameter
- * @deprecatedclass SuperMap.GeoDecodingParameter
- * @category iServer AddressMatch
- * @classdesc 地理反向匹配参数类。
- * @param {Object} options - 参数。
- * @param {number} options.x - 查询位置的横坐标。
- * @param {number} options.y - 查询位置的纵坐标。
- * @param {number} [options.fromIndex] - 设置返回对象的起始索引值。
- * @param {Array.<string>} [options.filters] - 过滤字段,限定查询区域。
- * @param {string} [options.prjCoordSys] - 查询结果的坐标系。
- * @param {number} [options.maxReturn] - 最大返回结果数。
- * @param {number} [options.geoDecodingRadius] - 查询半径。
- * @usage
- */
- class GeoDecodingParameter {
- constructor(options) {
- if (options.filters) {
- options.filters = options.filters.split(',');
- }
- /**
- * @member {number} GeoDecodingParameter.prototype.x
- * @description 查询位置的横坐标。
- */
- this.x = null;
- /**
- * @member {number} GeoDecodingParameter.prototype.y
- * @description 查询位置的纵坐标。
- */
- this.y = null;
- /**
- * @member {number} [GeoDecodingParameter.prototype.fromIndex]
- * @description 设置返回对象的起始索引值。
- */
- this.fromIndex = null;
- /**
- * @member {number} [GeoDecodingParameter.prototype.toIndex]
- * @description 设置返回对象的结束索引值。
- */
- this.toIndex = null;
- /**
- * @member {Array.<string>} [GeoDecodingParameter.prototype.filters]
- * @description 过滤字段,限定查询区域。
- */
- this.filters = null;
- /**
- * @member {string} [GeoDecodingParameter.prototype.prjCoordSys]
- * @description 查询结果的坐标系。
- */
- this.prjCoordSys = null;
- /**
- * @member {number} [GeoDecodingParameter.prototype.maxReturn]
- * @description 最大返回结果数。
- */
- this.maxReturn = null;
- /**
- * @member {number} GeoDecodingParameter.prototype.geoDecodingRadius
- * @description 查询半径。
- */
- this.geoDecodingRadius = null;
- Util.extend(this, options);
- }
- /**
- * @function GeoDecodingParameter.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- this.x = null;
- this.y = null;
- this.fromIndex = null;
- this.toIndex = null;
- this.filters = null;
- this.prjCoordSys = null;
- this.maxReturn = null;
- this.geoDecodingRadius = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/AddressMatchService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class AddressMatchService
- * @deprecatedclass SuperMap.AddressMatchService
- * @category iServer AddressMatch
- * @classdesc 地址匹配服务,包括正向匹配和反向匹配。
- * @param {string} url - 服务地址。
- * @param {Object} options - 可选参数。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class AddressMatchService extends CommonServiceBase {
- constructor(url, options) {
- super(url, options);
- this.options = options || {};
- this.CLASS_NAME = 'SuperMap.AddressMatchService';
- }
- /**
- * @function AddressMatchService.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function AddressMatchService.prototype.code
- * @param {string} url - 正向地址匹配服务地址。
- * @param {GeoCodingParameter} params - 正向地址匹配服务参数。
- */
- code(url, params) {
- if (!(params instanceof GeoCodingParameter)) {
- return;
- }
- this.processAsync(url, params);
- }
- /**
- * @function AddressMatchService.prototype.decode
- * @param {string} url - 反向地址匹配服务地址。
- * @param {GeoDecodingParameter} params - 反向地址匹配服务参数。
- */
- decode(url, params) {
- if (!(params instanceof GeoDecodingParameter)) {
- return;
- }
- this.processAsync(url, params);
- }
- /**
- * @function AddressMatchService.prototype.processAsync
- * @description 负责将客户端的动态分段服务参数传递到服务端。
- * @param {string} url - 服务地址。
- * @param {Object} params - 参数。
- */
- processAsync(url, params) {
- this.request({
- method: 'GET',
- url,
- params,
- scope: this,
- success: this.serviceProcessCompleted,
- failure: this.serviceProcessFailed
- });
- }
- /**
- * @function AddressMatchService.prototype.serviceProcessCompleted
- * @param {Object} result - 服务器返回的结果对象。
- * @description 服务流程是否完成
- */
- serviceProcessCompleted(result) {
- if (result.succeed) {
- delete result.succeed;
- }
- super.serviceProcessCompleted(result);
- }
- /**
- * @function AddressMatchService.prototype.serviceProcessCompleted
- * @param {Object} result - 服务器返回的结果对象。
- * @description 服务流程是否失败
- */
- serviceProcessFailed(result) {
- super.serviceProcessFailed(result);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/AggregationParameter.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class AggregationParameter
- * @deprecatedclass SuperMap.AggregationParameter
- * @classdesc 聚合查询参数设置,该参数仅支持数据来源 Elasticsearch 服务的数据服务。
- * @category iServer Data FeatureResults
- * @param {Object} options - 参数。
- * @param {string} options.aggName - 聚合名称。
- * @param {string} options.aggFieldName - 聚合字段。
- * @usage
- */
- class AggregationParameter {
- constructor(options) {
- /**
- * @member {string} AggregationParameter.prototype.aggName
- * @description 聚合名称。
- */
- this.aggName = null;
- /**
- * @member {string} AggregationParameter.prototype.aggFieldName
- * @description 聚合字段。
- */
- this.aggFieldName = null;
- this.CLASS_NAME = 'SuperMap.AggregationParameter';
- Util.extend(this, options);
- }
- destroy() {
- var me = this;
- me.aggName = null;
- me.aggFieldName = null;
- me.aggType = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/BucketAggParameter.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class BucketAggParameter
- * @deprecatedclass SuperMap.BucketAggParameter
- * @classdesc 子聚合类查询参数设置,该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
- * @category iServer Data FeatureResults
- * @param {Object} options - 参数。
- * @param {Array.<MetricsAggParameter>} options.subAggs - 子聚合类集合。
- * @extends {AggregationParameter}
- * @usage
- */
- class BucketAggParameter extends AggregationParameter {
- constructor(options) {
- super();
- /**
- * @member {Array.<MetricsAggParameter>} BucketAggParameter.prototype.subAggs
- * @description 子聚合类集合。
- */
- this.subAggs = null;
- this.aggType = null;
- this.CLASS_NAME = 'SuperMap.BucketAggParameter';
- Util.extend(this, options);
- }
- destroy() {
- var me = this;
- if (me.subAggs) {
- me.subAggs = null;
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/MetricsAggParameter.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class MetricsAggParameter
- * @deprecatedclass SuperMap.MetricsAggParameter
- * @classdesc 指标聚合查询参数类,该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
- * @category iServer Data FeatureResults
- * @param {Object} options - 可选参数。
- * @param {MetricsAggType} [options.aggType = 'avg'] - 聚合类型。
- * @extends {AggregationParameter}
- * @usage
- */
- class MetricsAggParameter extends AggregationParameter {
- constructor(option) {
- super();
- /**
- * @member {MetricsAggType} [MetricsAggParameter.prototype.aggType=MetricsAggType.AVG]
- * @description 指标聚合类型。
- */
- this.aggType = MetricsAggType.AVG;
- Util.extend(this, option);
- this.CLASS_NAME = 'SuperMap.MetricsAggParameter';
- }
- destroy() {
- super.destroy();
- var me = this;
- me.aggType = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/AreaSolarRadiationParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class AreaSolarRadiationParameters
- * @deprecatedclass SuperMap.AreaSolarRadiationParameters
- * @category iServer SpatialAnalyst SolarRadiationAnalyst
- * @classdesc 地区太阳辐射参数类。
- * @param {Object} options - 参数。
- * @param {string} options.dataset - 要用来做地区太阳辐射数据源中数据集的名称。该名称用形如"数据集名称@数据源别名"的形式来表示,例如:JingjinTerrain@Jingjin。
- * @param {string} options.targetDatasourceName - 指定的存储结果数据集的数据源名称, 例如:"Jingjin"。
- * @param {string} options.totalGridName - 指定地区太阳辐射总辐射量数据集的名称。
- * @param {string} options.diffuseDatasetGridName - 指定地区太阳辐射散射辐射量数据集的名称。
- * @param {string} options.durationDatasetGridName - 指定地区太阳辐射太阳直射持续时间数据集的名称。
- * @param {string} options.directDatasetGridName - 指定地区太阳辐射直射辐射量数据集的名称。
- * @param {number} options.latitude - 待计算区域的纬度值。
- * @param {string} [options.timeMode = 'MULTIDAYS'] - 时间模式。可选值"WITHINDAY"(单日)或"MULTIDAYS"(多日)。
- * @param {number} options.dayStart - 起始日期(年内的第几天)。
- * @param {number} options.dayEnd - 结束日期(年内的第几天)。
- * @param {number} [options.hourStart] - 起始时间(一天中的第几个小时)。
- * @param {number} [options.hourEnd] - 结束时间(一天中的第几个小时)。
- * @param {number} [options.transmittance] - 太阳辐射穿过大气的透射率。
- * @param {number} [options.hourInterval=0.5] - 计算时的小时间隔(设置的越小计算量越大并且计算结果更精确,如果修改此参数,必须使用整数)。
- * @param {number} [options.dayInterval=5] - 计算时的天数间隔(设置的越小计算量越大并且计算结果更精确,必须使用整数)。
- * @param {boolean} [options.deleteExistResultDataset=false] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
- * @usage
- */
- class AreaSolarRadiationParameters {
- constructor(options) {
- /**
- * @member {string} AreaSolarRadiationParameters.prototype.dataset
- * @description 要用来做地区太阳辐射数据源中数据集的名称。该名称用形如“数据集名称@数据源别名”形式来表示,例如:JingjinTerrain@Jingjin。注:地区太阳辐射数据必须为栅格数据集。
- */
- this.dataset = null;
- /**
- * @member {string} AreaSolarRadiationParameters.prototype.targetDatasourceName
- * @description 指定的存储结果数据集的数据源名称,例如:"Jingjin"。
- */
- this.targetDatasourceName = null;
- /**
- * @member {string} AreaSolarRadiationParameters.prototype.totalGridName
- * @description 指定地区太阳辐射总辐射量数据集的名称。
- */
- this.totalGridName = null;
- /**
- * @member {string} AreaSolarRadiationParameters.prototype.diffuseDatasetGridName
- * @description 指定地区太阳辐射散射辐射量数据集的名称。
- */
- this.diffuseDatasetGridName = null;
- /**
- * @member {string} AreaSolarRadiationParameters.prototype.durationDatasetGridName
- * @description 指定地区太阳辐射太阳直射持续时间数据集的名称。
- */
- this.durationDatasetGridName = null;
- /**
- * @member {string} AreaSolarRadiationParameters.prototype.directDatasetGridName
- * @description 指定地区太阳辐射直射辐射量数据集的名称。
- */
- this.directDatasetGridName = null;
- /**
- * @member {number} AreaSolarRadiationParameters.prototype.latitude
- * @description 待计算区域的纬度值。
- */
- this.latitude = null;
- /**
- * @member {string} [AreaSolarRadiationParameters.prototype.timeMode='MULTIDAYS']
- * @description 时间模式。可选值"WITHINDAY"(单日)或"MULTIDAYS"(多日)。
- */
- this.timeMode = "MULTIDAYS";
- /**
- * @member {number} AreaSolarRadiationParameters.prototype.dayStart
- * @description 起始日期(年内的第几天)。
- */
- this.dayStart = null;
- /**
- * @member {number} AreaSolarRadiationParameters.prototype.dayEnd
- * @description 结束日期(年内的第几天)。
- */
- this.dayEnd = null;
- /**
- * @member {number} [AreaSolarRadiationParameters.prototype.hourStart]
- * @description 起始时间(一天中的第几个小时)。
- */
- this.hourStart = null;
- /**
- * @member {number} [AreaSolarRadiationParameters.prototype.hourEnd]
- * @description 结束时间(一天中的第几个小时)。
- */
- this.hourEnd = null;
- /**
- * @member {number} [AreaSolarRadiationParameters.prototype.transmittance]
- * @description 太阳辐射穿过大气的透射率。
- */
- this.transmittance = null;
- /**
- * @member {number} [AreaSolarRadiationParameters.prototype.hourInterval=0.5]
- * @description 计算时的小时间隔(设置的越小计算量越大并且计算结果更精确, 如果修改此参数,必须使用整数)
- */
- this.hourInterval = null;
- /**
- * @member {number} [AreaSolarRadiationParameters.prototype.dayInterval=5]
- * @description 计算时的天数间隔(设置的越小计算量越大并且计算结果更精确, 必须使用整数)
- */
- this.dayInterval = null;
- /**
- * @member {boolean} [AreaSolarRadiationParameters.prototype.deleteExistResultDataset=false]
- * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
- */
- this.deleteExistResultDataset = false;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.AreaSolarRadiationParameters";
- }
- /**
- * @function AreaSolarRadiationParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.dataset = null;
- me.zFactor = 1.0;
- me.averageCurvatureName = null;
- me.profileCurvatureName = null;
- me.planCurvatureName = null;
- me.deleteExistResultDataset = true;
- }
- /**
- * @function AreaSolarRadiationParameters.toObject
- * @param {AreaSolarRadiationParameters} param - 地区太阳辐射参数类。
- * @param {AreaSolarRadiationParameters} tempObj - 地区太阳辐射参数对象。
- * @returns {Object} JSON对象。
- * @description 将AreaSolarRadiationParameters对象转换成JSON对象。
- */
- static toObject(param, tempObj) {
- var parameter = {};
- for (var name in param) {
- if (name !== "dataset") {
- var name1 = (name === "latitude" || name === "timeMode" || name === "dayStart");
- var name2 = (name === "dayEnd" || name === "hourStart" || name === "hourEnd");
- var name3 = (name === "transmittance" || name === "hourInterval" || name === "dayInterval");
- if (name1 || name2 || name3) {
- parameter[name] = param[name];
- } else {
- tempObj[name] = param[name];
- }
- }
- }
- tempObj["parameter"] = parameter;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/SpatialAnalystBase.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class SpatialAnalystBase
- * @deprecatedclass SuperMap.SpatialAnalystBase
- * @category iServer Core
- * @classdesc 空间分析服务基类。
- * @param {string} url - 地址。
- * @param {Object} options - 可选参数。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @extends {CommonServiceBase}
- * @usage
- */
- class SpatialAnalystBase extends CommonServiceBase {
- constructor(url, options) {
- super(url, options);
- /**
- * @member {DataFormat} [SpatialAnalystBase.prototype.format=DataFormat.GEOJSON]
- * @description 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式,参数格式为 "ISERVER","GEOJSON"。
- */
- this.format = DataFormat.GEOJSON;
- this.CLASS_NAME = "SuperMap.SpatialAnalystBase";
- }
- /**
- * @function SpatialAnalystBase.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- this.format = null;
- }
- /**
- * @function SpatialAnalystBase.prototype.serviceProcessCompleted
- * @description 分析完成,执行此方法。
- * @param {Object} result - 服务器返回的结果对象。
- */
- serviceProcessCompleted(result) {
- var me = this, analystResult;
- result = Util.transformResult(result);
- if (result && me.format === DataFormat.GEOJSON && typeof me.toGeoJSONResult === 'function') {
- //批量分析时会返回多个结果
- if (Util.isArray(result)) {
- for (var i = 0; i < result.length; i++) {
- result[i] = me.toGeoJSONResult(result[i])
- }
- analystResult = result;
- } else {
- analystResult = me.toGeoJSONResult(result);
- }
- }
- if (!analystResult) {
- analystResult = result;
- }
- me.events.triggerEvent("processCompleted", {result: analystResult});
- }
- /**
- * @function SpatialAnalystBase.prototype.toGeoJSONResult
- * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
- * @param {Object} result - 服务器返回的结果对象。
- *
- */
- toGeoJSONResult(result) {
- if (!result) {
- return null;
- }
- //批量叠加分析时结果这样处理
- if (result.result && result.result.resultGeometry) {
- result = result.result
- }
- var geoJSONFormat = new GeoJSON();
- if (result.recordsets) {
- for (var i = 0, recordsets = result.recordsets, len = recordsets.length; i < len; i++) {
- if (recordsets[i].features) {
- recordsets[i].features = geoJSONFormat.toGeoJSON(recordsets[i].features);
- }
- }
- } else if (result.recordset && result.recordset.features) {
- result.recordset.features =geoJSONFormat.toGeoJSON(result.recordset.features);
- }
- if (result.resultGeometry) {
- result.resultGeometry = geoJSONFormat.toGeoJSON(result.resultGeometry);
- }
- if (result.regions) {
- result.regions = geoJSONFormat.toGeoJSON(result.regions);
- }
- return result;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/AreaSolarRadiationService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class AreaSolarRadiationService
- * @deprecatedclass SuperMap.AreaSolarRadiationService
- * @category iServer SpatialAnalyst SolarRadiationAnalyst
- * @classdesc 地区太阳辐射服务类。
- * @param {string} url - 服务的访问地址。如:</br>http://localhost:8090/iserver/services/spatialanalyst-sample/restjsr/spatialanalyst。</br>
- * @param {Object} options - 参数。</br>
- * @param {Object} options.eventListeners - 需要被注册的监听器对象。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @extends {SpatialAnalystBase}
- * @example 例如:
- * (start code)
- * var myAreaSolarRadiationService = new AreaSolarRadiationService(url);
- * myAreaSolarRadiationService.on({
- * "processCompleted": processCompleted,
- * "processFailed": processFailed
- * }
- * );
- * (end)
- * @usage
- */
- class AreaSolarRadiationService extends SpatialAnalystBase {
- constructor(url, options) {
- super(url, options);
- this.CLASS_NAME = "SuperMap.AreaSolarRadiationService";
- }
- /**
- * @function AreaSolarRadiationService.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function AreaSolarRadiationService.prototype.processAsync
- * @description 负责将客户端的查询参数传递到服务端。
- * @param {AreaSolarRadiationParameters} parameter - 地区太阳辐射参数。
- */
- processAsync(parameter) {
- if (!(parameter instanceof AreaSolarRadiationParameters)) {
- return;
- }
- var me = this;
- var parameterObject = {};
- if (parameter instanceof AreaSolarRadiationParameters) {
- me.url = Util.urlPathAppend(me.url, `datasets/${parameter.dataset}/solarradiation`);
- }
- me.url = Util.urlAppend(me.url, 'returnContent=true');
- AreaSolarRadiationParameters.toObject(parameter, parameterObject);
- var jsonParameters = Util.toJSON(parameterObject);
- me.request({
- method: 'POST',
- data: jsonParameters,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/BufferDistance.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class BufferDistance
- * @deprecatedclass SuperMap.BufferDistance
- * @category iServer SpatialAnalyst BufferAnalyst
- * @classdesc 缓冲区分析的缓冲距离类。通过该类可以设置缓冲区分析的缓冲距离,距离可以是数值也可以是数值型的字段表达式。
- * @param {Object} options - 可选参数。
- * @param {string} [options.exp] - 以数值型的字段表达式作为缓冲区分析的距离值。
- * @param {number} [options.value=100] - 以数值作为缓冲区分析的距离值。单位:米。
- * @usage
- */
- class BufferDistance {
- constructor(options) {
- /**
- * @member {string} [BufferDistance.prototype.exp]
- * @description 以数值型的字段表达式作为缓冲区分析的距离值。
- */
- this.exp = null;
- /**
- * @member {number} [BufferDistance.prototype.value=100]
- * @description 以数值作为缓冲区分析的距离值。单位:米。
- */
- this.value = 100;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.BufferDistance";
- }
- /**
- * @function BufferDistance.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- this.exp = null;
- this.value = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/BufferSetting.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class BufferSetting
- * @deprecatedclass SuperMap.BufferSetting
- * @category iServer SpatialAnalyst BufferAnalyst
- * @classdesc 缓冲区分析通用设置类。
- * @param {Object} options - 可选参数。
- * @param {BufferEndType} [options.endType=BufferEndType.FLAT] - 缓冲区端点枚举值。
- * @param {BufferDistance} [options.leftDistance=100] - 左侧缓冲距离。
- * @param {BufferDistance} [options.rightDistance=100] - 右侧缓冲距离。
- * @param {number} [options.semicircleLineSegment=4] - 圆头缓冲圆弧处线段的个数。
- * @param {BufferRadiusUnit} [options.radiusUnit=BufferRadiusUnit.METER] - 缓冲半径单位。
- * @usage
- */
- class BufferSetting {
- constructor(options) {
- /**
- * @member {BufferEndType} [BufferSetting.prototype.endType = BufferEndType.FLAT]
- * @description 缓冲区端点枚举值。分为平头和圆头两种。
- */
- this.endType = BufferEndType.FLAT;
- /**
- * @member {BufferDistance} [BufferSetting.prototype.leftDistance=100]
- * @description 左侧缓冲距离。
- * 当为 GeometryBufferAnalyst 时,单位为默认地图的投影系的单位(如3857为米,4326为度),
- * 当为 DatasetBufferAnalyst 时,单位通过{@link BufferSetting.radiusUnit}设置(默认全部为米)。
- */
- this.leftDistance = new BufferDistance();
- /**
- * @member {BufferDistance} [BufferSetting.prototype.rightDistance=100]
- * @description 右侧缓冲距离。
- * 当为 GeometryBufferAnalyst 时,单位为默认地图的投影系的单位(如3857为米,4326为度),
- * 当为 DatasetBufferAnalyst 时,单位通过{@link BufferSetting#radiusUnit}设置(默认全部为米)。
- */
- this.rightDistance = new BufferDistance();
- /**
- * @member {number} [BufferSetting.prototype.semicircleLineSegment=4]
- * @description 圆头缓冲圆弧处线段的个数。即用多少个线段来模拟一个半圆。
- */
- this.semicircleLineSegment = 4;
- /**
- * @member {BufferRadiusUnit} [BufferSetting.prototype.radiusUnit = BufferRadiusUnit.METER]
- * @description 缓冲半径单位,可以是{@link BufferRadiusUnit.METER}、{@link BufferRadiusUnit.MILLIMETER}、
- * {@link BufferRadiusUnit.CENTIMETER}、{@link BufferRadiusUnit.DECIMETER}、{@link BufferRadiusUnit.KILOMETER}、
- * {@link BufferRadiusUnit.FOOT}、{@link BufferRadiusUnit.INCH}、{@link BufferRadiusUnit.MILE}、{@link BufferRadiusUnit.YARD}。
- * 仅对BufferAnalyst有效。
- */
- this.radiusUnit = BufferRadiusUnit.METER;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.BufferSetting";
- }
- /**
- * @function BufferSetting.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- let me = this;
- me.endType = null;
- if (me.leftDistance) {
- me.leftDistance.destroy();
- me.leftDistance = null;
- }
- if (me.rightDistance) {
- me.rightDistance.destroy();
- me.rightDistance = null;
- }
- me.semicircleLineSegment = null;
- me.radiusUnit = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/BufferAnalystParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class BufferAnalystParameters
- * @deprecatedclass SuperMap.BufferAnalystParameters
- * @category iServer SpatialAnalyst BufferAnalyst
- * @classdesc 缓冲区分析参数基类。
- * @param {Object} options - 参数。
- * @param {BufferSetting} [options.bufferSetting] - 设置缓冲区通用参数。为缓冲区分析提供必要的参数信息,包括左缓冲距离、右缓冲距离、端点类型、圆头缓冲圆弧处线段的个数信息。
- * @usage
- */
- class BufferAnalystParameters {
- constructor(options) {
- var me = this;
- /**
- * @member {BufferSetting} [BufferAnalystParameters.prototype.bufferSetting]
- * @description 设置缓冲区通用参数。为缓冲区分析提供必要的参数信息,包括左缓冲距离、右缓冲距离、端点类型、圆头缓冲圆弧处线段的个数信息。
- */
- me.bufferSetting = new BufferSetting();
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.BufferAnalystParameters";
- }
- /**
- * @function BufferAnalystParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- if (me.bufferSetting) {
- me.bufferSetting.destroy();
- me.bufferSetting = null;
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/DataReturnOption.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class DataReturnOption
- * @deprecatedclass SuperMap.DataReturnOption
- * @category iServer Data Dataset
- * @classdesc 数据返回设置类。
- * @param {Object} options - 参数。
- * @param {number} [options.expectCount=1000] - 设置返回的最大记录数,小于或者等于 0 时表示返回所有记录数。
- * @param {string} [options.dataset] - 设置结果数据集标识,当 dataReturnMode 为 {@link DataReturnMode.DATASET_ONLY}或{@link DataReturnMode.DATASET_AND_RECORDSET}时有效,
- * 作为返回数据集的名称。该名称用形如“数据集名称@数据源别名”形式来表示。
- * @param {DataReturnMode} [options.dataReturnMode=DataReturnMode.RECORDSET_ONLY] - 数据返回模式。
- * @param {boolean} [options.deleteExistResultDataset=true] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
- * @usage
- */
- class DataReturnOption {
- constructor(options) {
- /**
- * @member {number} [DataReturnOption.prototype.expectCount=1000]
- * @description 设置返回的最大记录数,小于或者等于0时表示返回所有记录数。
- */
- this.expectCount = 1000;
- /**
- * @member {string} [DataReturnOption.prototype.dataset]
- * @description 设置结果数据集标识,当dataReturnMode为 {@link DataReturnMode.DATASET_ONLY}
- * 或{@link DataReturnMode.DATASET_AND_RECORDSET}时有效,
- * 作为返回数据集的名称。该名称用形如"数据集名称@数据源别名"形式来表示。
- */
- this.dataset = null;
- /**
- * @member {DataReturnMode} [DataReturnOption.prototype.dataReturnMode=DataReturnMode.RECORDSET_ONLY]
- * @description 数据返回模式。
- */
- this.dataReturnMode = DataReturnMode.RECORDSET_ONLY;
- /**
- * @member {boolean} [DataReturnOption.prototype.deleteExistResultDataset=true]
- * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
- */
- this.deleteExistResultDataset = true;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.DataReturnOption";
- }
- /**
- * @function DataReturnOption.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.expectCount = null;
- me.dataset = null;
- me.dataReturnMode = null;
- me.deleteExistResultDataset = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/FilterParameter.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FilterParameter
- * @deprecatedclass SuperMap.FilterParameter
- * @category iServer Data FeatureResults
- * @classdesc 查询过滤条件参数类。该类用于设置查询数据集的查询过滤参数。
- * @param {Object} options - 参数。
- * @param {string} options.attributeFilter - 属性过滤条件。
- * @param {string} options.name - 查询数据集名称或者图层名称。
- * @param {Array.<JoinItem>} [options.joinItems] - 与外部表的连接信息 JoinItem 数组。
- * @param {Array.<LinkItem>} [options.linkItems] - 与外部表的关联信息 LinkItem 数组。
- * @param {Array.<string>} [options.ids] - 查询 id 数组,即属性表中的 SmID 值。
- * @param {string} [options.orderBy] - 查询排序的字段,orderBy 的字段须为数值型的。
- * @param {string} [options.groupBy] - 查询分组条件的字段。
- * @param {Array.<string>} [options.fields] - 查询字段数组。
- * @usage
- */
- class FilterParameter {
- constructor(options) {
- /**
- * @member {string} FilterParameter.prototype.attributeFilter
- * @description 属性过滤条件。
- * 相当于 SQL 语句中的 WHERE 子句,其格式为:WHERE <条件表达式>,
- * attributeFilter 就是其中的“条件表达式”。
- * 该字段的用法为 attributeFilter = "过滤条件"。
- * 例如,要查询字段 fieldValue 小于100的记录,设置 attributeFilter = "fieldValue < 100";
- * 要查询字段 name 的值为“酒店”的记录,设置 attributeFilter = "name like '%酒店%'",等等。
- */
- this.attributeFilter = null;
- /**
- * @member {string} FilterParameter.prototype.name
- * @description 查询数据集名称或者图层名称,根据实际的查询对象而定。
- * 一般情况下该字段为数据集名称,但在进行与地图相关功能的操作时,
- * 需要设置为图层名称(图层名称格式:数据集名称@数据源别名)。
- * 因为一个地图的图层可能是来自于不同数据源的数据集,
- * 而不同的数据源中可能存在同名的数据集,
- * 使用数据集名称不能唯一的确定数据集,
- * 所以在进行与地图相关功能的操作时,该值需要设置为图层名称。
- */
- this.name = null;
- /**
- * @member {Array.<JoinItem>} [FilterParameter.prototype.joinItems]
- * @description 与外部表的连接信息 JoinItem 数组。
- */
- this.joinItems = null;
- /**
- * @member {Array.<LinkItem>} [FilterParameter.prototype.linkItems]
- * @description 与外部表的关联信息 LinkItem 数组。
- */
- this.linkItems = null;
- /**
- * @member {Array.<string>} [FilterParameter.prototype.ids]
- * @description 查询 id 数组,即属性表中的 SmID 值。
- */
- this.ids = null;
- /**
- * @member {string} [FilterParameter.prototype.orderBy]
- * @description 查询排序的字段,orderBy的字段须为数值型的。
- * 相当于 SQL 语句中的 ORDER BY 子句,其格式为:ORDER BY <列名>,
- * 列名即属性表中每一列的名称,列又可称为属性,在 SuperMap 中又称为字段。
- * 对单个字段排序时,该字段的用法为 orderBy = "字段名";
- * 对多个字段排序时,字段之间以英文逗号进行分割,用法为 orderBy = "字段名1, 字段名2"。
- * 例如,现有一个国家数据集,它有两个字段分别为“SmArea”和“pop_1994”,
- * 分别表示国家的面积和1994年的各国人口数量。
- * 如果要按照各国人口数量对记录进行排序,则 orderBy = "pop_1994";
- * 如果要以面积和人口进行排序,则 orderBy = "SmArea, pop_1994"。
- */
- this.orderBy = null;
- /**
- * @member {string} [FilterParameter.prototype.groupBy]
- * @description 查询分组条件的字段。
- * 相当于 SQL 语句中的 GROUP BY 子句,其格式为:GROUP BY <列名>,
- * 列名即属性表中每一列的名称,列又可称为属性,在 SuperMap 中又称为字段。
- * 对单个字段分组时,该字段的用法为 groupBy = "字段名";
- * 对多个字段分组时,字段之间以英文逗号进行分割,用法为 groupBy = "字段名1, 字段名2"。
- * 例如,现有一个全球城市数据集,该数据集有两个字段分别为“Continent”和“Country”,
- * 分别表示某个城市所属的洲和国家。
- * 如果要按照国家对全球的城市进行分组, 可以设置 groupBy = "Country";
- * 如果以洲和国家对城市进行分组,设置 groupBy = "Continent, Country"。
- */
- this.groupBy = null;
- /**
- * @member {Array.<string>} [FilterParameter.prototype.fields]
- * @description 查询字段数组,如果不设置则使用系统返回的所有字段。
- */
- this.fields = null;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.FilterParameter";
- }
- /**
- * @function FilterParameter.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.attributeFilter = null;
- me.name = null;
- if (me.joinItems) {
- for (let i = 0, joinItems = me.joinItems, len = joinItems.length; i < len; i++) {
- joinItems[i].destroy();
- }
- me.joinItems = null;
- }
- if (me.linkItems) {
- for (let i = 0, linkItems = me.linkItems, len = linkItems.length; i < len; i++) {
- linkItems[i].destroy();
- }
- me.linkItems = null;
- }
- me.ids = null;
- me.orderBy = null;
- me.groupBy = null;
- me.fields = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/DatasetBufferAnalystParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class DatasetBufferAnalystParameters
- * @deprecatedclass SuperMap.DatasetBufferAnalystParameters
- * @category iServer SpatialAnalyst BufferAnalyst
- * @classdesc 数据集缓冲区分析参数类。
- * @param {Object} options - 参数。
- * @param {string} options.dataset - 要用来做缓冲区分析的数据源中数据集的名称。该名称用形如“数据集名称@数据源别名”形式来表示。
- * @param {FilterParameter} [options.filterQueryParameter] - 设置数据集中几何对象的过滤条件。只有满足此条件的几何对象才参与缓冲区分析。
- * @param {DataReturnOption} [options.resultSetting] - 结果返回设置类。
- * @param {boolean} [options.isAttributeRetained=true] - 是否保留进行缓冲区分析的对象的字段属性。当 isUnion 字段为 false 时该字段有效。
- * @param {boolean} [options.isUnion=false] - 是否将缓冲区与源记录集中的对象合并后返回。对于面对象而言,要求源数据集中的面对象不相交。
- * @param {BufferSetting} [options.bufferSetting] - 设置缓冲区通用参数。
- *
- * @extends {BufferAnalystParameters}
- * @usage
- */
- class DatasetBufferAnalystParameters extends BufferAnalystParameters {
- constructor(options) {
- super(options);
- /**
- * @member {string} DatasetBufferAnalystParameters.prototype.dataset
- * @description 要用来做缓冲区分析的数据源中数据集的名称。该名称用形如“数据集名称@数据源别名”形式来表示。
- */
- this.dataset = null;
- /**
- * @member {FilterParameter} [DatasetBufferAnalystParameters.prototype.filterQueryParameter]
- * @description 设置数据集中几何对象的过滤条件。只有满足此条件的几何对象才参与缓冲区分析。
- */
- this.filterQueryParameter = new FilterParameter();
- /**
- * @member {DataReturnOption} [DatasetBufferAnalystParameters.prototype.resultSetting]
- * @description 结果返回设置类。
- */
- this.resultSetting = new DataReturnOption();
- /**
- * @member {boolean} [DatasetBufferAnalystParameters.prototype.isAttributeRetained=true]
- * @description 是否保留进行缓冲区分析的对象的字段属性。当 isUnion 字段为 false 时该字段有效。
- */
- this.isAttributeRetained = true;
- /**
- * @member {boolean} [DatasetBufferAnalystParameters.prototype.isUnion=false]
- * @description 是否将缓冲区与源记录集中的对象合并后返回。对于面对象而言,要求源数据集中的面对象不相交。
- */
- this.isUnion = false;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.DatasetBufferAnalystParameters";
- }
- /**
- * @function DatasetBufferAnalystParameters.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- var me = this;
- me.dataset = null;
- if (me.filterQueryParameter) {
- me.filterQueryParameter.destroy();
- me.filterQueryParameter = null;
- }
- if (me.resultSetting) {
- me.resultSetting.destroy();
- me.resultSetting = null;
- }
- me.isAttributeRetained = null;
- me.isUnion = null;
- }
- /**
- * @function DatasetBufferAnalystParameters.toObject
- * @param {DatasetBufferAnalystParameters} datasetBufferAnalystParameters - 数据集缓冲区分析参数类。
- * @param {DatasetBufferAnalystParameters} tempObj - 数据集缓冲区分析参数对象。
- * @description 将数据集缓冲区分析参数对象转换为 JSON 对象。
- * @returns {Object} JSON 对象。
- */
- static toObject(datasetBufferAnalystParameters, tempObj) {
- for (var name in datasetBufferAnalystParameters) {
- if (name === "bufferSetting") {
- datasetBufferAnalystParameters.bufferSetting.radiusUnit = datasetBufferAnalystParameters.bufferSetting.radiusUnit.toUpperCase();
- tempObj.bufferAnalystParameter = datasetBufferAnalystParameters.bufferSetting;
- } else if (name === "resultSetting") {
- tempObj.dataReturnOption = datasetBufferAnalystParameters.resultSetting;
- } else if (name === "dataset") {
- continue;
- } else {
- tempObj[name] = datasetBufferAnalystParameters[name];
- }
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/GeometryBufferAnalystParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GeometryBufferAnalystParameters
- * @deprecatedclass SuperMap.GeometryBufferAnalystParameters
- * @category iServer SpatialAnalyst BufferAnalyst
- * @classdesc 几何对象缓冲区分析参数类
- * 对指定的某个几何对象做缓冲区分析。通过该类可以指定要做缓冲区分析的几何对象、缓冲区参数等。
- * @param {Object} options - 参数。
- * @param {GeoJSONObject} options.sourceGeometry - 要做缓冲区分析的几何对象。
- * @param {number} options.sourceGeometrySRID - 缓冲区几何对象投影坐标参数, 如 4326,3857。
- * @param {BufferSetting} [options.bufferSetting] - 设置缓冲区通用参数。
- * @extends {BufferAnalystParameters}
- * @usage
- */
- class GeometryBufferAnalystParameters extends BufferAnalystParameters {
- constructor(options) {
- super(options);
- /**
- * @member {GeoJSONObject} GeometryBufferAnalystParameters.prototype.sourceGeometry
- * @description 要做缓冲区分析的几何对象。<br>
- * 点类型可以是:{@link GeometryPoint}|{@link L.Marker}|{@link L.CircleMarker}|{@link L.Circle}|{@link L.GeoJSON}|{@link ol.geom.Point}|{@link ol.format.GeoJSON}。</br>
- * 线类型可以是:{@link GeometryLineString}|{@link GeometryLinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}。</br>
- * 面类型可以是:{@link GeometryPolygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}。
- */
- this.sourceGeometry = null;
- /**
- * @member {number} GeometryBufferAnalystParameters.prototype.sourceGeometrySRID
- * @description 缓冲区几何对象投影坐标参数, 如 4326,3857。
- */
- this.sourceGeometrySRID = null;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = " SuperMap.GeometryBufferAnalystParameters";
- }
- /**
- * @function GeometryBufferAnalystParameters.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- var me = this;
- if (me.sourceGeometry) {
- me.sourceGeometry.destroy();
- me.sourceGeometry = null;
- }
- }
- /**
- * @function GeometryBufferAnalystParameters.toObject
- * @param {GeometryBufferAnalystParameters} geometryBufferAnalystParameters - 几何对象缓冲区分析参数类。
- * @param {GeometryBufferAnalystParameters} tempObj - 几何对象缓冲区分析参数对象。
- * @description 将几何对象缓冲区分析参数对象转换为 JSON 对象。
- * @returns {Object} JSON 对象。
- */
- static toObject(geometryBufferAnalystParameters, tempObj) {
- for (var name in geometryBufferAnalystParameters) {
- if (name === "bufferSetting") {
- var tempBufferSetting = {};
- for (var key in geometryBufferAnalystParameters.bufferSetting) {
- tempBufferSetting[key] = geometryBufferAnalystParameters.bufferSetting[key];
- }
- tempObj.analystParameter = tempBufferSetting;
- } else if (name === "sourceGeometry") {
- tempObj.sourceGeometry = ServerGeometry.fromGeometry(geometryBufferAnalystParameters.sourceGeometry);
- } else {
- tempObj[name] = geometryBufferAnalystParameters[name];
- }
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/BufferAnalystService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class BufferAnalystService
- * @deprecatedclass SuperMap.BufferAnalystService
- * @category iServer SpatialAnalyst BufferAnalyst
- * @classdesc 缓冲区分析服务类。
- * 该类负责将客户设置的缓冲区分析参数传递给服务端,并接收服务端返回的缓冲区分析结果数据。
- * 缓冲区分析结果通过该类支持的事件的监听函数参数获取。
- * @param {string} url - 服务的访问地址。如:http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 需要被注册的监听器对象。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @extends {SpatialAnalystBase}
- * @example 例如:
- * (start code)
- * var myBufferAnalystService = new BufferAnalystService(url, {
- * eventListeners: {
- * "processCompleted": bufferCompleted,
- * "processFailed": bufferFailed
- * }
- * });
- * (end)
- * @usage
- */
- class BufferAnalystService extends SpatialAnalystBase {
- constructor(url, options) {
- super(url, options);
- /**
- * @member {string} BufferAnalystService.prototype.mode
- * @description 缓冲区分析类型
- */
- this.mode = null;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.BufferAnalystService";
- }
- /**
- * @function BufferAnalystService.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- this.mode = null;
- }
- /**
- * @method BufferAnalystService.prototype.processAsync
- * @description 负责将客户端的查询参数传递到服务端。
- * @param {BufferAnalystParameters} parameter - 缓冲区分析参数
- */
- processAsync(parameter) {
- var parameterObject = {};
- var me = this;
- if (parameter instanceof DatasetBufferAnalystParameters) {
- me.mode = 'datasets';
- me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/buffer');
- DatasetBufferAnalystParameters.toObject(parameter, parameterObject);
- } else if (parameter instanceof GeometryBufferAnalystParameters) {
- me.mode = 'geometry';
- me.url = Util.urlPathAppend(me.url, 'geometry/buffer');
- GeometryBufferAnalystParameters.toObject(parameter, parameterObject);
- }
- var jsonParameters = Util.toJSON(parameterObject);
- me.url = Util.urlAppend(me.url, 'returnContent=true');
- me.request({
- method: "POST",
- data: jsonParameters,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/DatasourceConnectionInfo.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- // eslint-disable-line no-unused-vars
- /**
- * @class DatasourceConnectionInfo
- * @deprecatedclass SuperMap.DatasourceConnectionInfo
- * @category iServer Data Datasource
- * @classdesc 数据源连接信息类。该类包括了进行数据源连接的所有信息,如所要连接的服务器名称、数据库名称、用户名以及密码等。
- * 当保存为工作空间时, 工作空间中的数据源的连接信息都将存储到工作空间文件中。对于不同类型的数据源,其连接信息有所区别。
- * 所以在使 用该类所包含的成员时,请注意该成员所适用的数据源类型。对于从数据源对象中返回的数据连接信息对象,只有 connect 方法可以被修改,
- * 其他内容是不可以被修改的。对于用户创建的数据源连接信息对象,其内容都可以修改。
- * @param {Object} options - 参数。
- * @param {string} options.alias - 数据源别名。
- * @param {string} options.dataBase - 数据源连接的数据库名。
- * @param {boolean} [options.connect] - 数据源是否自动连接数据。
- * @param {string} [options.driver] - 使用 ODBC(Open Database Connectivity,开放数据库互连)的数据库的驱动程序名。
- * @param {EngineType} [options.engineType] - 数据源连接的引擎类型。
- * @param {boolean} [options.exclusive] - 是否以独占方式打开数据源。
- * @param {boolean} [options.OpenLinkTable] - 是否把数据库中的其他非 SuperMap 数据表作为 LinkTable 打开。
- * @param {string} [options.password] - 登录数据源连接的数据库或文件的密码。
- * @param {boolean} [options.readOnly] - 是否以只读方式打开数据源。
- * @param {string} [options.server] - 数据库服务器名或 SDB 文件名。
- * @param {string} [options.user] - 登录数据库的用户名。
- * @usage
- */
- class DatasourceConnectionInfo {
- constructor(options) {
- /**
- * @member {string} DatasourceConnectionInfo.prototype.alias
- * @description 数据源别名。
- */
- this.alias = null;
- /**
- * @member {boolean} [DatasourceConnectionInfo.prototype.connect]
- * @description 数据源是否自动连接数据。
- */
- this.connect = null;
- /**
- * @member {string} DatasourceConnectionInfo.prototype.dataBase
- * @description 数据源连接的数据库名。
- */
- this.dataBase = null;
- /**
- * @member {string} [DatasourceConnectionInfo.prototype.driver]
- * @description 使用 ODBC(Open Database Connectivity,开放数据库互连) 的数据库的驱动程序名。
- * 其中,对于 SQL Server 数据库与 iServer 发布的 WMTS 服务,此为必设参数。
- * 对于 SQL Server 数据库,它使用 ODBC 连接,所设置的驱动程序名为 "SQL Server" 或 "SQL Native Client";
- * 对于 iServer 发布的 WMTS 服务,设置的驱动名称为 "WMTS"。
- */
- this.driver = null;
- /**
- * @member {EngineType} [DatasourceConnectionInfo.prototype.engineType]
- * @description 数据源连接的引擎类型。
- */
- this.engineType = null;
- /**
- * @member {boolean} [DatasourceConnectionInfo.prototype.exclusive]
- * @description 是否以独占方式打开数据源。
- */
- this.exclusive = null;
- /**
- * @member {boolean} [DatasourceConnectionInfo.prototype.OpenLinkTable]
- * @description 是否把数据库中的其他非 SuperMap 数据表作为 LinkTable 打开。
- */
- this.OpenLinkTable = null;
- /**
- * @member {string} [DatasourceConnectionInfo.prototype.password]
- * @description 登录数据源连接的数据库或文件的密码。
- */
- this.password = null;
- /**
- * @member {boolean} [DatasourceConnectionInfo.prototype.readOnly]
- * @description 是否以只读方式打开数据源。
- */
- this.readOnly = null;
- /**
- * @member {string} [DatasourceConnectionInfo.prototype.server]
- * @description 数据库服务器名、文件名或服务地址。
- * 1.对于 SDB 和 UDB 文件,为其文件的绝对路径。注意:当绝对路径的长度超过 UTF-8 编码格式的 260 字节长度,该数据源无法打开。
- * 2.对于 Oracle 数据库,其服务器名为其 TNS 服务名称。
- * 3.对于 SQL Server 数据库,其服务器名为其系统的 DSN(Database Source Name) 名称。
- * 4.对于 PostgreSQL 数据库,其服务器名为 “IP:端口号”,默认的端口号是 5432。
- * 5.对于 DB2 数据库,已经进行了编目,所以不需要进行服务器的设置。
- * 6.对于 Kingbase 数据库,其服务器名为其 IP 地址。
- * 7.对于 GoogleMaps 数据源,其服务器地址,默认设置为 “{@link http://maps.google.com}”,且不可更改。
- * 8.对于 SuperMapCould 数据源,为其服务地址。
- * 9.对于 MAPWORLD 数据源,为其服务地址,默认设置为 “{@link http://www.tianditu.cn}”,且不可更改。
- * 10.对于 OGC 和 REST 数据源,为其服务地址。
- */
- this.server = null;
- /**
- * @member {string} DatasourceConnectionInfo.prototype.user
- * @description 登录数据库的用户名。
- */
- this.user = null;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.DatasourceConnectionInfo";
- }
- /**
- * @function DatasourceConnectionInfo.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.alias = null;
- me.connect = null;
- me.dataBase = null;
- me.driver = null;
- me.engineType = null;
- me.exclusive = null;
- me.OpenLinkTable = null;
- me.password = null;
- me.readOnly = null;
- me.server = null;
- me.user = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/OutputSetting.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class OutputSetting
- * @deprecatedclass SuperMap.OutputSetting
- * @category iServer ProcessingService
- * @classdesc 分布式分析输出类型设置类。
- * @param {Object} options - 参数。
- * @param {DatasourceConnectionInfo} options.datasourceInfo - 数据源连接信息。
- * @param {string} [options.datasetName='analystResult'] - 结果数据集名称。
- * @param {OutputType} [options.type=OutputType.UDB] - 输出类型。
- * @param {string} [options.outputPath] - 分析结果输出路径。
- * @usage
- */
- class OutputSetting {
- constructor(options) {
- /**
- * @member {OutputType} OutputSetting.prototype.type
- * @description 分布式分析的输出类型。
- */
- this.type = OutputType.UDB;
- /**
- * @member {string} [OutputSetting.prototype.datasetName='analystResult']
- * @description 分布式分析的输出结果数据集名称。
- */
- this.datasetName = "analystResult";
- /**
- * @member {DatasourceConnectionInfo} OutputSetting.prototype.datasourceInfo
- * @description 分布式分析的输出结果数据源连接信息。
- */
- this.datasourceInfo = null;
- /**
- * @member {string} [OutputSetting.prototype.outputPath]
- * @description 分布式分析的分析结果输出路径。
- */
- this.outputPath = "";
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.OutputSetting";
- }
- /**
- * @function OutputSetting.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.type = null;
- me.datasetName = null;
- me.outputPath = null;
- if (me.datasourceInfo instanceof DatasourceConnectionInfo) {
- me.datasourceInfo.destroy();
- me.datasourceInfo = null;
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/MappingParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class MappingParameters
- * @deprecatedclass SuperMap.MappingParameters
- * @category iServer ProcessingService
- * @classdesc 分析后结果可视化的参数类。
- * @param {Object} options - 参数。
- * @param {Array.<ThemeGridRangeItem>} [options.items] - 栅格分段专题图子项数组。
- * @param {number} [options.numericPrecision=1] - 精度,此字段用于设置分析结果标签专题图中标签数值的精度,如“1”表示精确到小数点的后一位。
- * @param {RangeMode} [options.rangeMode=RangeMode.EQUALINTERVAL] - 专题图分段模式。
- * @param {number} [options.rangeCount] - 专题图分段个数。
- * @param {ColorGradientType} [options.colorGradientType=ColorGradientType.YELLOW_RED] - 专题图颜色渐变模式。
- * @usage
- */
- class MappingParameters {
- constructor(options) {
- /**
- * @member {Array.<ThemeGridRangeItem>} [MappingParameters.prototype.items]
- * @description 栅格分段专题图子项数组。
- */
- this.items = null;
- /**
- * @member {number} [MappingParameters.prototype.numericPrecision=1]
- * @description 精度,此字段用于设置分析结果标签专题图中标签数值的精度,如“1”表示精确到小数点的后一位。
- */
- this.numericPrecision = 1;
- /**
- * @member {RangeMode} [MappingParameters.prototype.RangeMode=RangeMode.EQUALINTERVAL]
- * @description 专题图分段模式。
- */
- this.rangeMode = RangeMode.EQUALINTERVAL;
- /**
- * @member {number} [MappingParameters.prototype.rangeCount]
- * @description 专题图分段个数。
- */
- this.rangeCount = "";
- /**
- * @member {ColorGradientType} [MappingParameters.prototype.colorGradientType=ColorGradientType.YELLOW_RED]
- * @description 专题图颜色渐变模式。
- */
- this.colorGradientType = ColorGradientType.YELLOW_RED;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.MappingParameters";
- }
- /**
- * @function MappingParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- if (me.items) {
- if (me.items.length > 0) {
- for (var item in me.items) {
- me.items[item].destroy();
- me.items[item] = null;
- }
- }
- me.items = null;
- }
- me.numericPrecision = null;
- me.rangeMode = null;
- me.rangeCount = null;
- me.colorGradientType = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/BuffersAnalystJobsParameter.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class BuffersAnalystJobsParameter
- * @deprecatedclass SuperMap.BuffersAnalystJobsParameter
- * @category iServer ProcessingService BufferAnalyst
- * @classdesc 缓冲区分析任务参数类。
- * @param {Object} options - 参数。
- * @param {string} options.datasetName - 数据集名。
- * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} [options.bounds] - 分析范围(默认为全图范围)。
- * @param {string} [options.distance='15'] - 缓冲距离,或缓冲区半径。
- * @param {string} [options.distanceField='pickup_latitude'] - 缓冲区分析距离字段。
- * @param {AnalystSizeUnit} [options.distanceUnit=AnalystSizeUnit.METER] - 缓冲距离单位单位。
- * @param {OutputSetting} [options.output] - 输出参数设置。
- * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
- * @usage
- */
- class BuffersAnalystJobsParameter {
- constructor(options) {
- /**
- * @member {string} BuffersAnalystJobsParameter.prototype.datasetName
- * @description 数据集名。
- */
- this.datasetName = '';
- /**
- * @member {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} BuffersAnalystJobsParameter.prototype.bounds
- * @description 分析范围。
- */
- this.bounds = '';
- /**
- * @member {string} [BuffersAnalystJobsParameter.prototype.distance='15']
- * @description 缓冲距离,或称为缓冲区半径。当缓冲距离字段位空时,此参数有效。
- */
- this.distance = '';
- /**
- * @member {string} [BuffersAnalystJobsParameter.prototype.distanceField='pickup_latitude']
- * @description 缓冲距离字段。
- */
- this.distanceField = '';
- /**
- * @member {AnalystSizeUnit} [BuffersAnalystJobsParameter.prototype.distanceUnit=AnalystSizeUnit.METER]
- * @description 缓冲距离单位。
- */
- this.distanceUnit = AnalystSizeUnit.METER;
- /**
- * @member {string} BuffersAnalystJobsParameter.prototype.dissolveField
- * @description 融合字段,根据字段值对缓冲区结果面对象进行融合。
- */
- this.dissolveField = '';
- /**
- * @member {OutputSetting} [BuffersAnalystJobsParameter.prototype.output]
- * @description 输出参数设置类。
- */
- this.output = null;
- /**
- * @member {MappingParameters} [BuffersAnalystJobsParameter.prototype.mappingParameters]
- * @description 分析后结果可视化的参数类。
- */
- this.mappingParameters = null;
- if (!options) {
- return this;
- }
- Util.extend(this, options);
- this.CLASS_NAME = 'SuperMap.BuffersAnalystJobsParameter';
- }
- /**
- * @function BuffersAnalystJobsParameter.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- this.datasetName = null;
- this.bounds = null;
- this.distance = null;
- this.distanceField = null;
- this.distanceUnit = null;
- this.dissolveField = null;
- if (this.output instanceof OutputSetting) {
- this.output.destroy();
- this.output = null;
- }
- if (this.mappingParameters instanceof MappingParameters) {
- this.mappingParameters.destroy();
- this.mappingParameters = null;
- }
- }
- /**
- * @function BuffersAnalystJobsParameter.toObject
- * @param {BuffersAnalystJobsParameter} BuffersAnalystJobsParameter - 缓冲区分析任务参数。
- * @param {Object} tempObj - 目标对象。
- * @description 生成缓冲区分析任务对象。
- */
- static toObject(BuffersAnalystJobsParameter, tempObj) {
- for (var name in BuffersAnalystJobsParameter) {
- if (name === 'datasetName') {
- tempObj['input'] = tempObj['input'] || {};
- tempObj['input'][name] = BuffersAnalystJobsParameter[name];
- continue;
- }
- if (name === 'output') {
- tempObj['output'] = tempObj['output'] || {};
- tempObj['output'] = BuffersAnalystJobsParameter[name];
- continue;
- }
- tempObj['analyst'] = tempObj['analyst'] || {};
- if (name === 'bounds' && BuffersAnalystJobsParameter[name]) {
- tempObj['analyst'][name] = BuffersAnalystJobsParameter[name].toBBOX();
- } else {
- tempObj['analyst'][name] = BuffersAnalystJobsParameter[name];
- }
- if (name === 'mappingParameters') {
- tempObj['analyst'][name] = tempObj['analyst'][name] || {};
- tempObj['analyst']['mappingParameters'] = BuffersAnalystJobsParameter[name];
- }
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ProcessingServiceBase.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ProcessingServiceBase
- * @deprecatedclass SuperMap.ProcessingServiceBase
- * @category iServer Core
- * @classdesc 分布式分析服务基类
- * @extends {CommonServiceBase}
- * @param {string} url - 服务地址。
- * @param {Object} options - 参数。
- * @param {Events} options.events - 处理所有事件的对象。
- * @param {number} options.index - 服务访问地址在数组中的位置。
- * @param {number} options.length - 服务访问地址数组长度。
- * @param {Object} [options.eventListeners] - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class ProcessingServiceBase extends CommonServiceBase {
- constructor(url, options) {
- options = options || {};
- /*
- * Constant: EVENT_TYPES
- * {Array.<string>}
- * 此类支持的事件类型
- * - *processCompleted* 创建成功后触发的事件。
- * - *processFailed* 创建失败后触发的事件 。
- * - *processRunning* 创建过程的整个阶段都会触发的事件,用于获取创建过程的状态 。
- */
- options.EVENT_TYPES = ["processCompleted", "processFailed", "processRunning"];
- super(url, options);
- this.CLASS_NAME = "SuperMap.ProcessingServiceBase";
- }
- /**
- * @function ProcessingServiceBase.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function ProcessingServiceBase.prototype.getJobs
- * @description 获取分布式分析任务。
- * @param {string} url - 资源地址。
- */
- getJobs(url) {
- var me = this;
- FetchRequest.get(SecurityManager.appendCredential(url), null, {
- proxy: me.proxy
- }).then(function (response) {
- return response.json();
- }).then(function (result) {
- me.events.triggerEvent("processCompleted", {
- result: result
- });
- }).catch(function (e) {
- me.eventListeners.processFailed({
- error: e
- });
- });
- }
- /**
- * @function ProcessingServiceBase.prototype.addJob
- * @description 添加分布式分析任务。
- * @param {string} url - 资源根地址。
- * @param {Object} params - 创建一个空间分析的请求参数。
- * @param {string} paramType - 请求参数类型。
- * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
- */
- addJob(url, params, paramType, seconds) {
- var me = this,
- parameterObject = null;
- if (params && params instanceof paramType) {
- parameterObject = new Object();
- paramType.toObject(params, parameterObject);
- }
- let headers = Object.assign({
- 'Content-Type': 'application/x-www-form-urlencoded'
- }, me.headers || {})
- var options = {
- proxy: me.proxy,
- headers,
- withCredentials: me.withCredentials,
- crossOrigin: me.crossOrigin,
- isInTheSameDomain: me.isInTheSameDomain
- };
- FetchRequest.post(SecurityManager.appendCredential(url), JSON.stringify(parameterObject), options).then(function (response) {
- return response.json();
- }).then(function (result) {
- if (result.succeed) {
- me.serviceProcessCompleted(result, seconds);
- } else {
- me.serviceProcessFailed(result);
- }
- }).catch(function (e) {
- me.serviceProcessFailed({
- error: e
- });
- });
- }
- serviceProcessCompleted(result, seconds) {
- result = Util.transformResult(result);
- seconds = seconds || 1000;
- var me = this;
- if (result) {
- var id = setInterval(function () {
- FetchRequest.get(SecurityManager.appendCredential(result.newResourceLocation), {
- _t: new Date().getTime()
- })
- .then(function (response) {
- return response.json();
- }).then(function (job) {
- me.events.triggerEvent("processRunning", {
- id: job.id,
- state: job.state
- });
- if (job.state.runState === 'LOST' || job.state.runState === 'KILLED' || job.state.runState === 'FAILED') {
- clearInterval(id);
- me.events.triggerEvent("processFailed", {
- error: job.state.errorMsg,
- state: job.state.runState
- });
- }
- if (job.state.runState === 'FINISHED' && job.setting.serviceInfo) {
- clearInterval(id);
- me.events.triggerEvent("processCompleted", {
- result: job
- });
- }
- }).catch(function (e) {
- clearInterval(id);
- me.events.triggerEvent("processFailed", {
- error: e
- });
- });
- }, seconds);
- }
- }
- serviceProcessFailed(result) {
- super.serviceProcessFailed(result);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/BuffersAnalystJobsService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class BuffersAnalystJobsService
- * @deprecatedclass SuperMap.BuffersAnalystJobsService
- * @category iServer ProcessingService BufferAnalyst
- * @classdesc 缓冲区分析服务类
- * @extends {ProcessingServiceBase}
- * @param {string} url - 服务地址。
- * @param {Object} options - 参数。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class BuffersAnalystJobsService extends ProcessingServiceBase {
- constructor(url, options) {
- super(url, options);
- this.url = Util.urlPathAppend(this.url, 'spatialanalyst/buffers');
- this.CLASS_NAME = 'SuperMap.BuffersAnalystJobsService';
- }
- /**
- *@override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function BuffersAnalystJobsService.prototype.getBufferJobs
- * @description 获取缓冲区分析所有任务
- */
- getBuffersJobs() {
- super.getJobs(this.url);
- }
- /**
- * @function BuffersAnalystJobsService.prototype.getBufferJob
- * @description 获取指定id的缓冲区分析服务
- * @param {string} id - 指定要获取数据的id。
- */
- getBuffersJob(id) {
- super.getJobs(Util.urlPathAppend(this.url, id));
- }
- /**
- * @function BuffersAnalystJobsService.prototype.addBufferJob
- * @description 新建缓冲区分析服务
- * @param {BuffersAnalystJobsParameter} params - 创建一个空间分析的请求参数。
- * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
- */
- addBuffersJob(params, seconds) {
- super.addJob(this.url, params, BuffersAnalystJobsParameter, seconds);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/BurstPipelineAnalystParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class BurstPipelineAnalystParameters
- * @deprecatedclass SuperMap.BurstPipelineAnalystParameters
- * @category iServer NetworkAnalyst BurstAnalyse
- * @classdesc 爆管分析参数类。
- * @param {Object} options - 参数。
- * @param {Array.<number>} options.sourceNodeIDs - 指定的设施点 ID 数组。
- * @param {number} [options.edgeID] - 指定的弧段ID,edgeID 与 nodeID 必须指定一个。
- * @param {number} [options.nodeID] - 指定的结点ID,edgeID 与 nodeID 必须指定一个。
- * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。
- * @usage
- */
- class BurstPipelineAnalystParameters {
- constructor(options) {
- var me = this;
- /**
- * @member {Array.<number>} BurstPipelineAnalystParameters.prototype.sourceNodeIDs
- * @description 指定的设施点 ID 数组。
- */
- this.sourceNodeIDs = null;
- /**
- * @member {number} [BurstPipelineAnalystParameters.prototype.edgeID]
- * @description 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
- */
- this.edgeID = null;
- /**
- * @member {number} [BurstPipelineAnalystParameters.prototype.nodeID]
- * @description 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
- */
- this.nodeID = null;
- /**
- * @member {boolean} [BurstPipelineAnalystParameters.prototype.isUncertainDirectionValid=false]
- * @description 指定不确定流向是否有效。
- * 指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行。
- * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
- */
- this.isUncertainDirectionValid = false;
- Util.extend(me, options);
- this.CLASS_NAME = "SuperMap.BurstPipelineAnalystParameters";
- }
- /**
- * @function BurstPipelineAnalystParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.sourceNodeIDs = null;
- me.edgeID = null;
- me.nodeID = null;
- me.isUncertainDirectionValid = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/NetworkAnalystServiceBase.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class NetworkAnalystServiceBase
- * @deprecatedclass SuperMap.NetworkAnalystServiceBase
- * @category iServer Core
- * @classdesc 网络分析服务基类。
- * @extends {CommonServiceBase}
- * @param {string} url - 服务地址。
- * @param {Object} options - 可选参数。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class NetworkAnalystServiceBase extends CommonServiceBase {
- constructor(url, options) {
- super(url, options);
- /**
- * @member {DataFormat} [NetworkAnalystServiceBase.prototype.format=DataFormat.GEOJSON]
- * @description 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式,参数格式为 "ISERVER","GEOJSON"
- */
- this.format = DataFormat.GEOJSON;
- this.CLASS_NAME = "SuperMap.NetworkAnalystServiceBase";
- }
- /**
- * @function NetworkAnalystServiceBase.prototype.destroy
- * @description 释放资源,将引用的资源属性置空。
- */
- destroy() {
- super.destroy();
- this.format = null;
- }
- /**
- * @function NetworkAnalystServiceBase.prototype.serviceProcessCompleted
- * @description 分析完成,执行此方法。
- * @param {Object} result - 服务器返回的结果对象。
- */
- serviceProcessCompleted(result) {
- var me = this, analystResult;
- result = Util.transformResult(result);
- if (result && me.format === DataFormat.GEOJSON && typeof me.toGeoJSONResult === 'function') {
- analystResult = me.toGeoJSONResult(result);
- }
- if (!analystResult) {
- analystResult = result;
- }
- me.events.triggerEvent("processCompleted", {result: analystResult});
- }
- /**
- * @function NetworkAnalystServiceBase.prototype.toGeoJSONResult
- * @description 将含有 geometry 的数据转换为 GeoJSON 格式。只处理结果中的路由,由子类实现。
- * @param {Object} result - 服务器返回的结果对象。
- * @returns {GeoJSONObject} GeoJSON 对象。
- */
- toGeoJSONResult(result) { // eslint-disable-line no-unused-vars
- return null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/BurstPipelineAnalystService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class BurstPipelineAnalystService
- * @deprecatedclass SuperMap.BurstPipelineAnalystService
- * @category iServer NetworkAnalyst BurstAnalyse
- * @classdesc 爆管分析服务类,即将给定弧段或节点作为爆管点来进行分析,返回关键结点 ID 数组、普通结点 ID 数组及其上下游弧段 ID 数组。
- * @extends {NetworkAnalystServiceBase}
- * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
- * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源},
- * 例如: "http://localhost:8090/iserver/services/test/rest/networkanalyst/WaterNet@FacilityNet"。
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 需要被注册的监听器对象。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class BurstPipelineAnalystService extends NetworkAnalystServiceBase {
- constructor(url, options) {
- super(url, options);
- this.CLASS_NAME = "SuperMap.BurstPipelineAnalystService";
- }
- /**
- * @function BurstPipelineAnalystService.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function BurstPipelineAnalystService.prototype.processAsync
- * @description 负责将客户端的查询参数传递到服务端。
- * @params {BurstPipelineAnalystParameters} params - 爆管分析参数类
- */
- processAsync(params) {
- if (!(params instanceof BurstPipelineAnalystParameters)) {
- return null;
- }
- var me = this, jsonObject;
- me.url = Util.urlPathAppend(me.url, 'burstAnalyse');
- jsonObject = {
- sourceNodeIDs: params.sourceNodeIDs,
- isUncertainDirectionValid: params.isUncertainDirectionValid
- };
- //必传参数不正确,就终止
- if (params.edgeID !== null && params.nodeID !== null) {
- throw new Error('edgeID and nodeID cannot be null at the same time.');
- }
- if (params.edgeID === null && params.nodeID === null) {
- throw new Error('edgeID and nodeID cannot be null at the same time.');
- }
- if (params.edgeID !== null) {
- jsonObject.edgeID = params.edgeID;
- } else {
- jsonObject.nodeID = params.nodeID;
- }
- me.request({
- method: "GET",
- params: jsonObject,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ChartFeatureInfoSpecsService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ChartFeatureInfoSpecsService
- * @deprecatedclass SuperMap.ChartFeatureInfoSpecsService
- * @category iServer Map Chart
- * @classdesc 海图物标信息服务类,通过该服务类可以查询到服务端支持的所有海图物标信息。
- * 用户可以通过两种方式获取查询结果:
- * 一种是通过监听 ChartFeatureInfoSpecsEvent.PROCESS_COMPLETE 事件;
- * 另一种是使用 AsyncResponder 类实现异步处理。
- * @extends {CommonServiceBase}
- * @param {string} url - 地图(特指海图)服务地址。
- * 如:"http://localhost:8090/iserver/services/map-ChartW/rest/maps/海图"。
- * 发送请求格式类似于:"http://localhost:8090/iserver/services/map-ChartW/rest/maps/海图/chartFeatureInfoSpecs.json"。
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
- * @param {DataFormat} [options.format] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式,参数格式为"ISERVER","GEOJSON"。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class ChartFeatureInfoSpecsService extends CommonServiceBase {
- constructor(url, options) {
- super(url, options);
- this.CLASS_NAME = "SuperMap.ChartFeatureInfoSpecsService";
- }
- /**
- * @function ChartFeatureInfoSpecsService.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- Util.reset(this);
- }
- /**
- * @function ChartFeatureInfoSpecsService.prototype.processAsync
- * @description 根据地图(特指海图)服务地址与服务端完成异步通讯,获取物标信息。
- * 当查询物标信息成功时,将触发 ChartFeatureInfoSpecsEvent.PROCESS_COMPLETE
- * 事件。用可以通过户两种方式获取图层信息:
- * 1. 通过 AsyncResponder 类获取(推荐使用);
- * 2. 通过监听 ChartFeatureInfoSpecsEvent.PROCESS_COMPLETE 事件获取。
- */
- processAsync() {
- var me = this, method = "GET";
- if (!me.isTempLayers) {
- Util.urlPathAppend(me.url,'chartFeatureInfoSpecs');
- }
- me.request({
- method: method,
- params: null,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ChartQueryFilterParameter.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ChartQueryFilterParameter
- * @deprecatedclass SuperMap.ChartQueryFilterParameter
- * @category iServer Map Chart
- * @classdesc 海图查询过滤参数类,用于设置海图查询的过滤参数。包括:物标代码、物标可应用对象的选择(是否查询点、线或面)、属性字段过滤条件。
- * @param {Object} options - 参数。
- * @param {string} options.attributeFilter - 属性字段过滤条件。
- * @param {number} options.chartFeatureInfoSpecCode - 查询的物标代号。
- * @param {boolean} [options.isQueryPoint] - 是否查询点。
- * @param {boolean} [options.isQueryLine] - 是否查询线。
- * @param {boolean} [options.isQueryRegion] - 是否查询面。
- * @usage
- */
- class ChartQueryFilterParameter {
- constructor(options) {
- /**
- * @member {boolean} [ChartQueryFilterParameter.prototype.isQueryPoint]
- * @description 是否查询点。
- */
- this.isQueryPoint = null;
- /**
- * @member {boolean} [ChartQueryFilterParameter.prototype.isQueryLine]
- * @description 是否查询线。
- */
- this.isQueryLine = null;
- /**
- * @member {boolean} [ChartQueryFilterParameter.prototype.isQueryRegion]
- * @description 是否查询面。
- */
- this.isQueryRegion = null;
- /**
- * @member {string} ChartQueryFilterParameter.prototype.attributeFilter
- * @description 属性字段过滤条件。
- */
- this.attributeFilter = null;
- /**
- * @member {number} ChartQueryFilterParameter.prototype.chartFeatureInfoSpecCode
- * @description 查询的物标代号。
- */
- this.chartFeatureInfoSpecCode = null;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.ChartQueryFilterParameter";
- }
- /**
- * @function ChartQueryFilterParameter.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.isQueryPoint = null;
- me.isQueryLine = null;
- me.isQueryRegion = null;
- me.attributeFilter = null;
- me.chartFeatureInfoSpecCode = null;
- }
- /**
- * @function ChartQueryFilterParameter.prototype.toJson
- * @description 将属性信息转化成 JSON 格式字符串。
- */
- toJson() {
- var json = "";
- json += "\"isQueryPoint\":" + this.isQueryPoint + ",";
- json += "\"isQueryLine\":" + this.isQueryLine + ",";
- json += "\"isQueryRegion\":" + this.isQueryRegion + ",";
- if (this.attributeFilter) {
- json += "\"attributeFilter\": \"" + this.attributeFilter + "\",";
- }
- json += "\"chartFeatureInfoSpecCode\":" + this.chartFeatureInfoSpecCode;
- json = "{" + json + "}";
- return json;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ChartQueryParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ChartQueryParameters
- * @deprecatedclass SuperMap.ChartQueryParameters
- * @category iServer Map Chart
- * @classdesc 海图查询参数类,该类用于设置海图查询时的相关参数,海图查询分为海图属性查询和海图范围查询两类,通过属性 queryMode 指定查询模式。
- * 必设属性有:queryMode、chartLayerNames、chartQueryFilterParameters。当进行海图范围查询时,必设属性还包括 bounds。
- * @param {Object} options - 参数。
- * @param {string} options.queryMode - 海图查询模式类型,支持两种查询方式:海图属性查询("ChartAttributeQuery")和海图空间查询("ChartBoundsQuery")。
- * @param {Array.<string>} options.chartLayerNames - 查询的海图图层的名称。
- * @param {Array.<ChartQueryFilterParameter>} options.chartQueryFilterParameters - 海图查询过滤参数。包括:物标代码、物标可应用对象的选择(是否查询点、线或面)、属性字段过滤条件。
- * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} options.bounds - 海图查询范围。当进行海图范围查询时,此为必选参数。
- * @param {boolean} [options.returnContent=true] - 获取或设置是返回查询结果记录集 recordsets,还是返回查询结果的资源 resourceInfo。
- * @param {number} [options.startRecord=0] - 查询起始记录位置。
- * @param {number} [options.expectCount] - 期望查询结果返回的记录数,该值大于0。
- * @usage
- */
- class ChartQueryParameters {
- constructor(options) {
- /**
- * @member {string} ChartQueryParameters.prototype.queryMode
- * @description 海图查询模式类型,支持两种查询方式:海图属性查询("ChartAttributeQuery")和海图空间查询("ChartBoundsQuery") 。
- */
- this.queryMode = null;
- /**
- * @member {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} ChartQueryParameters.prototype.bounds
- * @description 海图查询范围。
- */
- this.bounds = null;
- /**
- * @member {Array.<string>} ChartQueryParameters.prototype.chartLayerNames
- * @description 查询的海图图层的名称。
- */
- this.chartLayerNames = null;
- /**
- * @member {Array.<ChartQueryFilterParameter>} ChartQueryParameters.prototype.chartQueryFilterParameters
- * @description 海图查询过滤参数。包括:物标代码、物标可应用对象的选择(是否查询点、线或面)、属性字段过滤条件。
- */
- this.chartQueryFilterParameters = null;
- /**
- * @member {boolean} [ChartQueryParameters.prototype.returnContent=true]
- * @description 获取或设置是返回查询结果记录集 recordsets,还是返回查询结果的资源 resourceInfo。
- */
- this.returnContent = true;
- /**
- * @member {number} [ChartQueryParameters.prototype.startRecord=0]
- * @description 查询起始记录位置。
- */
- this.startRecord = 0;
- /**
- * @member {number} [ChartQueryParameters.prototype.expectCount]
- * @description 期望查询结果返回的记录数,该值大于0。
- */
- this.expectCount = null;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.ChartQueryParameters";
- }
- /**
- * @function ChartQueryParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.queryMode = null;
- me.bounds = null;
- me.chartLayerNames = null;
- me.chartQueryFilterParameters = null;
- me.returnContent = true;
- me.startRecord = 0;
- me.expectCount = null;
- }
- /**
- * @function ChartQueryParameters.prototype.getVariablesJson
- * @description 将属性信息转换成能够被服务识别的 JSON 格式字符串。
- * @returns {string} JSON 字符串。
- */
- getVariablesJson() {
- var json = "";
- json += "\"queryMode\":\"" + this.queryMode + "\",";
- if (this.chartLayerNames && this.chartLayerNames.length) {
- var chartLayersArray = [];
- var layerLength = this.chartLayerNames.length;
- for (var i = 0; i < layerLength; i++) {
- chartLayersArray.push("\"" + this.chartLayerNames[i] + "\"");
- }
- var layerNames = "[" + chartLayersArray.join(",") + "]";
- json += "\"chartLayerNames\":" + layerNames + ",";
- }
- if (this.queryMode === "ChartBoundsQuery" && this.bounds) {
- json += "\"bounds\":" + "{" + "\"leftBottom\":" + "{" + "\"x\":" + this.bounds.left + "," +
- "\"y\":" + this.bounds.bottom + "}" + "," + "\"rightTop\":" + "{" + "\"x\":" + this.bounds.right + "," +
- "\"y\":" + this.bounds.top + "}" + "},";
- }
- if (this.chartQueryFilterParameters && this.chartQueryFilterParameters.length) {
- var chartParamArray = [];
- var chartLength = this.chartQueryFilterParameters.length;
- for (var j = 0; j < chartLength; j++) {
- var chartQueryFilterParameter = this.chartQueryFilterParameters[j];
- if (!(chartQueryFilterParameter instanceof ChartQueryFilterParameter)) {
- continue;
- }
- chartParamArray.push(chartQueryFilterParameter.toJson());
- }
- var chartParamsJson = "[" + chartParamArray.join(",") + "]";
- chartParamsJson = "\"chartQueryParams\":" + chartParamsJson + ",";
- chartParamsJson += "\"startRecord\":" + this.startRecord + ",";
- chartParamsJson += "\"expectCount\":" + this.expectCount;
- chartParamsJson = "{" + chartParamsJson + "}";
- json += "\"chartQueryParameters\":" + chartParamsJson;
- }
- json = "{" + json + "}";
- return json;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/QueryParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class QueryParameters
- * @deprecatedclass SuperMap.QueryParameters
- * @category iServer Map QueryResults
- * @classdesc 查询参数基类。距离查询、SQL 查询、几何地物查询等各自的参数均继承此类。
- * @param {Object} options - 参数。
- * @param {Array.<FilterParameter>} options.queryParams - 查询过滤条件参数数组。
- * @param {string} [options.customParams] - 自定义参数,供扩展使用。
- * @param {Object} [options.prjCoordSys] - 自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
- * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
- * @param {GeometryType} [options.networkType=GeometryType.LINE] - 网络数据集对应的查询类型。
- * @param {QueryOption} [options.queryOption=QueryOption.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
- * @param {number} [options.startRecord=0] - 查询起始记录号。
- * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
- * @param {boolean} [options.returnCustomResult=false] - 仅供三维使用。
- * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
- * @usage
- */
- class QueryParameters {
- constructor(options) {
- if (!options) {
- return;
- }
- /**
- * @member {string} [QueryParameters.prototype.customParams]
- * @description 自定义参数,供扩展使用。
- */
- this.customParams = null;
- /**
- * @member {Object} [QueryParameters.prototype.prjCoordSys]
- * @description 自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}
- */
- this.prjCoordSys = null;
- /**
- * @member {number} [QueryParameters.prototype.expectCount=100000]
- * @description 期望返回结果记录个数,默认返回100000条查询记录,
- * 如果实际不足100000条则返回实际记录条数。
- */
- this.expectCount = 100000;
- /**
- * @member {GeometryType} [QueryParameters.prototype.networkType=GeometryType.LINE]
- * @description 网络数据集对应的查询类型,分为点和线两种类型。
- */
- this.networkType = GeometryType.LINE;
- /**
- * @member {QueryOption} [QueryParameters.prototype.queryOption=QueryOption.ATTRIBUTEANDGEOMETRY]
- * @description 查询结果类型枚举类。
- * 该类描述查询结果返回类型,包括只返回属性、
- * 只返回几何实体以及返回属性和几何实体。
- */
- this.queryOption = QueryOption.ATTRIBUTEANDGEOMETRY;
- /**
- * @member {Array.<FilterParameter>} QueryParameters.prototype.queryParams
- * @description 查询过滤条件参数数组。
- * 该类用于设置查询数据集的查询过滤参数。
- */
- this.queryParams = null;
- /**
- * @member {number} [QueryParameters.prototype.startRecord=0]
- * @description 查询起始记录号。
- */
- this.startRecord = 0;
- /**
- * @member {number} [QueryParameters.prototype.holdTime=10]
- * @description 资源在服务端保存的时间,单位为分钟。
- */
- this.holdTime = 10;
- /**
- * @member {boolean} [QueryParameters.prototype.returnCustomResult=false]
- * @description 仅供三维使用。
- */
- this.returnCustomResult = false;
- /**
- * @member {boolean} [QueryParameters.prototype.returnFeatureWithFieldCaption=false]
- * @description 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
- */
- this.returnFeatureWithFieldCaption = false;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.QueryParameters";
- }
- /**
- * @function QueryParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.customParams = null;
- me.expectCount = null;
- me.networkType = null;
- me.queryOption = null;
- if (me.queryParams) {
- for (var i = 0, qps = me.queryParams, len = qps.length; i < len; i++) {
- qps[i].destroy();
- }
- me.queryParams = null;
- }
- me.startRecord = null;
- me.holdTime = null;
- me.returnCustomResult = null;
- me.prjCoordSys = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ChartQueryService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ChartQueryService
- * @deprecatedclass SuperMap.ChartQueryService
- * @category iServer Map Chart
- * @classdesc 海图查询服务类。该类负责将海图查询所需参数(ChartQueryParameters)传递至服务端,并获取服务端的返回结果。
- * 用户可以通过两种方式获取查询结果:
- * 1.通过 AsyncResponder 类获取(推荐使用);
- * 2.通过监听 QueryEvent.PROCESS_COMPLETE 事件获取。
- * @extends {CommonServiceBase}
- * @param {string} url - 地图查询服务访问地址。如:"http://localhost:8090/iserver/services/map-ChartW/rest/maps/海图"。
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
- * @param {DataFormat} [options.format] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为"ISERVER","GEOJSON"。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @example
- * 下面示例显示了如何进行海图属性查询:
- * var nameArray = ["GB4X0000_52000"];
- * var chartQueryFilterParameter = new ChartQueryFilterParameter({
- * isQueryPoint:true,
- * isQueryLine:true,
- * isQueryRegion:true,
- * attributeFilter:"SmID<10",
- * chartFeatureInfoSpecCode:1
- * });
- *
- * var chartQueryParameters = new ChartQueryParameters({
- * queryMode:"ChartAttributeQuery",
- * chartLayerNames:nameArray,
- * returnContent:true,
- * chartQueryFilterParameters:[chartQueryFilterParameter]
- * });
- *
- * var chartQueryService = new ChartQueryService(url);
- *
- * chartQueryService.events.on({
- * "processCompleted":processCompleted,
- * "processFailed":processFailed
- * });
- * chartQueryService.processAsync(chartQueryParameters);
- * @usage
- */
- class ChartQueryService extends CommonServiceBase {
- constructor(url, options) {
- super(url, options);
- options = options || {};
- /**
- * @member {boolean} ChartQueryService.prototype.returnContent
- * @description 是否立即返回新创建资源的表述还是返回新资源的URI。
- */
- this.returnContent = null;
- /**
- * @member {DataFormat} ChartQueryService.prototype.format
- * @description 查询结果返回格式,目前支持iServerJSON 和GeoJSON两种格式
- * 参数格式为"ISERVER","GEOJSON",GEOJSON
- */
- this.format = DataFormat.GEOJSON;
- Util.extend(this, options);
- var me = this;
- if (options.format) {
- me.format = options.format.toUpperCase();
- }
- if (!me.url) {
- return;
- }
- me.url = Util.urlPathAppend(me.url, 'queryResults');
- this.CLASS_NAME = "SuperMap.ChartQueryService";
- }
- /**
- * @function ChartQueryService.prototype.destroy
- * @override
- */
- destroy() {
- var me = this;
- CommonServiceBase.prototype.destroy.apply(this, arguments);
- me.returnContent = null;
- me.format = null;
- }
- /**
- * @function ChartQueryService.prototype.processAsync
- * @description 使用服务地址 URL 实例化 ChartQueryService 对象。
- * @param {ChartQueryParameters} params - 查询参数。
- */
- processAsync(params) {
- //todo重点需要添加代码的地方
- if (!(params instanceof ChartQueryParameters)) {
- return;
- }
- var me = this, jsonParameters;
- me.returnContent = params.returnContent;
- jsonParameters = params.getVariablesJson();
- if (me.returnContent) {
- me.url = Util.urlAppend(me.url, 'returnContent=true');
- }
- me.request({
- method: "POST",
- data: jsonParameters,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- /**
- * @function ChartQueryService.prototype.serviceProcessCompleted
- * @description 查询完成,执行此方法。
- * @param {Object} result - 服务器返回的结果对象。
- */
- serviceProcessCompleted(result) {
- var me = this;
- result = Util.transformResult(result);
- if (result && result.recordsets && me.format === DataFormat.GEOJSON) {
- for (var i = 0, recordsets = result.recordsets, len = recordsets.length; i < len; i++) {
- if (recordsets[i].features) {
- var geoJSONFormat = new GeoJSON();
- recordsets[i].features = geoJSONFormat.toGeoJSON(recordsets[i].features);
- }
- }
- }
- me.events.triggerEvent("processCompleted", {result: result});
- }
- /**
- * @function ChartQueryService.prototype.getQueryParameters
- * @description 将 JSON 对象表示的查询参数转化为 QueryParameters 对象。
- * @param {Object} params - JSON 字符串表示的查询参数。
- * @returns {QueryParameters} 返回查询结果
- */
- getQueryParameters(params) {
- return new QueryParameters({
- queryMode: params.queryMode,
- bounds: params.bounds,
- chartLayerNames: params.chartLayerNames,
- chartQueryFilterParameters: params.chartQueryFilterParameters,
- returnContent: params.returnContent
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ClipParameter.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ClipParameter
- * @deprecatedclass SuperMap.ClipParameter
- * @category iServer SpatialAnalyst InterpolationAnalyst
- * @classdesc 用于裁剪的参数。优先使用用户指定的裁剪区域多边形进行裁剪,也可以通过指定数据源和数据集名,从而使用指定数据集的边界多边形进行裁剪。
- * @param {Object} options - 可选参数。
- * @param {string} [options.clipDatasetName] - 裁剪的数据集名。
- * @param {string} [options.clipDatasourceName] - 裁剪的数据集所在数据源的名字。
- * @param {GeometryPolygon|L.Polygon|L.GeoJSON|ol.geom.Polygon|ol.format.GeoJSON|GeoJSONObject}} [options.clipRegion] - 用户指定的裁剪区域。
- * @param {boolean} [options.isClipInRegion=true] - 是否对裁剪区内的数据集进行裁剪。
- * @param {boolean} [options.isExactClip=true] - 是否使用精确裁剪。
- * @usage
- */
- class ClipParameter {
- constructor(options) {
- /**
- * @member {string} ClipParameter.prototype.clipDatasetName
- * @description 用于裁剪的数据集名,clipDatasetName 与 clipRegion 必须设置一个。
- */
- this.clipDatasetName = null;
- /**
- * @member {string} ClipParameter.prototype.clipDatasourceName
- * @description 用于裁剪的数据集所在数据源的名字。当 clipRegion 不设置时起作用。
- */
- this.clipDatasourceName = null;
- /**
- * @member {GeometryPolygon|L.Polygon|L.GeoJSON|ol.geom.Polygon|ol.format.GeoJSON|GeoJSONObject} ClipParameter.prototype.clipRegion
- * @description 用户指定的裁剪区域,优先使用,clipDatasetName 与 clipRegion 必须设置一个。
- */
- this.clipRegion = null;
- /**
- * @member {boolean} [ClipParameter.prototype.isClipInRegion=true]
- * @description 是否对裁剪区内的数据集进行裁剪。若为 true,则对裁剪区域内的结果进行裁剪,若为 false,则对裁剪区域外的结果进行裁剪。
- */
- this.isClipInRegion = true;
- /**
- * @member {boolean} [ClipParameter.prototype.isExactClip=true]
- * @description 是否使用精确裁剪。
- */
- this.isExactClip = null;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.ClipParameter";
- }
- /**
- * @function ClipParameter.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.clipDatasetName = null;
- me.clipDatasourceName = null;
- me.clipRegion = null;
- me.isClipInRegion = null;
- me.isExactClip = null;
- }
- /**
- * @function ClipParameter.prototype.toJSON
- * @description 将 ClipParameter 对象转化为 JSON 字符串。
- * @returns {string} 返回转换后的 JSON 字符串。
- */
- toJSON() {
- return Util.toJSON({
- isClipInRegion: this.isClipInRegion,
- clipDatasetName: this.clipDatasetName,
- clipDatasourceName: this.clipDatasourceName,
- isExactClip: this.isExactClip,
- clipRegion: ServerGeometry.fromGeometry(this.clipRegion)
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ColorDictionary.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ColorDictionary
- * @deprecatedclass SuperMap.ColorDictionary
- * @category iServer Map Theme
- * @classdesc 颜色对照表类。颜色对照表中的键名为具体的高程值,键值表示该高程值要显示的颜色。
- * 对于栅格图层中高程值小于颜色对照表中高程最小值的点使用颜色对照表中高程最小值对应的颜色,
- * 对于栅格图层中高程值大于颜色对照表中高程最大值的点使用颜色对照表中高程最大值对应的颜色,
- * 对于栅格图层中高程值在颜色对照表中没有对应颜色的点,则查找颜色对照表中与当前高程值相邻的两个高程对应的颜色,
- * 然后通过渐变运算要显示的颜色。如果设置了颜色对照表的话,则颜色表设置无效。
- * @param {Object} options - 参数。
- * @param {number} options.elevation - 高程值。
- * @param {ServerColor} options.color - 服务端颜色类。
- * @usage
- */
- class ColorDictionary {
- constructor(options) {
- options = options || {};
- /**
- * @member {number} ColorDictionary.prototype.elevation
- * @description 高程值。
- */
- this.elevation = null;
- /**
- * @member {ServerColor} ColorDictionary.prototype.color
- * @description 服务端颜色类。
- */
- this.color = null;
- Util.extend(this, options);
- var me = this,
- c = me.color;
- if (c) {
- me.color = new ServerColor(c.red, c.green, c.blue);
- }
- this.CLASS_NAME = "SuperMap.ColorDictionary";
- }
- /**
- * @function ColorDictionary.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- Util.reset(this);
- }
- /**
- * @function ColorDictionary.prototype.toServerJSONObject
- * @description 转换成对应的 JSON 格式对象。
- * @returns {Object} JSON 对象。
- */
- toServerJSONObject() {
- var dataObj = {};
- dataObj = Util.copyAttributes(dataObj, this);
- return dataObj;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/TransportationAnalystResultSetting.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class TransportationAnalystResultSetting
- * @deprecatedclass SuperMap.TransportationAnalystResultSetting
- * @category iServer NetworkAnalyst
- * @classdesc 交通网络分析结果参数类。通过该类设置交通网络分析返回的结果,包括是否返回图片、是否返回弧段空间信息、是否返回结点空间信息等。
- * @param {Object} options - 可选参数。
- * @param {boolean} [options.returnEdgeFeatures=false] - 是否在分析结果中包含弧段要素集合。
- * @param {boolean} [options.returnEdgeGeometry=false] - 返回的弧段要素集合中是否包含几何对象信息。
- * @param {boolean} [options.returnEdgeIDs=false] - 返回结果中是否包含经过弧段 ID 集合。
- * @param {boolean} [options.returnNodeFeatures=false] - 是否在分析结果中包含结点要素集合。
- * @param {boolean} [options.returnNodeGeometry=false] - 返回的结点要素集合中是否包含几何对象信息。
- * @param {boolean} [options.returnNodeIDs=false] - 返回结果中是否包含经过结点 ID 集合。
- * @param {boolean} [options.returnPathGuides=false] - 返回分析结果中是否包含行驶导引集合。
- * @param {boolean} [options.returnRoutes=false] - 返回分析结果中是否包含路由对象的集合。
- * @usage
- */
- class TransportationAnalystResultSetting {
- constructor(options) {
- if (!options) {
- return;
- }
- /**
- * @member {boolean} TransportationAnalystResultSetting.prototype.returnEdgeFeatures
- * @description 是否在分析结果中包含弧段要素集合。弧段要素包括弧段的空间信息和属性信息。
- */
- this.returnEdgeFeatures = false;
- /**
- * @member {boolean} [TransportationAnalystResultSetting.prototype.returnEdgeGeometry=false]
- * @description 返回的弧段要素集合中是否包含几何对象信息。
- */
- this.returnEdgeGeometry = false;
- /**
- * @member {boolean} [TransportationAnalystResultSetting.prototype.returnEdgeIDs=false]
- * @description 返回结果中是否包含经过弧段 ID 集合。
- */
- this.returnEdgeIDs = false;
- /**
- * @member {boolean} [TransportationAnalystResultSetting.prototype.returnNodeFeatures=false]
- * @description 是否在分析结果中包含结点要素集合。
- * 结点要素包括结点的空间信息和属性信息。其中返回的结点要素是否包含空间信息可通过 returnNodeGeometry 字段设置。
- */
- this.returnNodeFeatures = false;
- /**
- * @member {boolean} [TransportationAnalystResultSetting.prototype.returnNodeGeometry=false]
- * @description 返回的结点要素集合中是否包含几何对象信息。
- */
- this.returnNodeGeometry = false;
- /**
- * @member {boolean} [TransportationAnalystResultSetting.prototype.returnNodeIDs=false]
- * @description 返回结果中是否包含经过结点 ID 集合。
- */
- this.returnNodeIDs = false;
- /**
- * @member {boolean} TransportationAnalystResultSetting.prototype.returnPathGuides
- * @description 返回分析结果中是否包含行驶导引集合。
- */
- this.returnPathGuides = false;
- /**
- * @member {boolean} TransportationAnalystResultSetting.prototype.returnRoutes
- * @description 返回分析结果中是否包含路由对象的集合。
- */
- this.returnRoutes = false;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.TransportationAnalystResultSetting";
- }
- /**
- * @function TransportationAnalystResultSetting.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.returnEdgeFeatures = null;
- me.returnEdgeGeometry = null;
- me.returnEdgeIDs = null;
- me.returnNodeFeatures = null;
- me.returnNodeGeometry = null;
- me.returnNodeIDs = null;
- me.returnPathGuides = null;
- me.returnRoutes = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/TransportationAnalystParameter.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class TransportationAnalystParameter
- * @deprecatedclass SuperMap.TransportationAnalystParameter
- * @category iServer NetworkAnalyst
- * @classdesc 交通网络分析通用参数类。该类主要用来提供交通网络分析所需的通用参数。
- * 通过本类可以设置障碍边、障碍点、权值字段信息的名称标识、转向权值字段等信息,还可以对分析结果包含的内容进行一些设置。
- * @param {Object} options - 参数。
- * @param {Array.<number>} options.barrierEdgeIDs - 网络分析中障碍弧段的 ID 数组。
- * @param {Array.<number>} options.barrierNodeIDs - 网络分析中障碍点的 ID 数组。
- * @param {string} options.turnWeightField - 转向权重字段的名称。
- * @param {TransportationAnalystResultSetting} options.resultSetting - 分析结果返回内容。
- * @param {Array.<GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} [options.barrierPoints] - 网络分析中 Point2D 类型的障碍点数组。
- * @param {string} [options.weightFieldName] - 阻力字段的名称。
- * @usage
- */
- class TransportationAnalystParameter {
- constructor(options) {
- if (!options) {
- return;
- }
- /**
- * @member {Array.<number>} TransportationAnalystParameter.prototype.barrierEdgeIDs
- * @description 网络分析中障碍弧段的 ID 数组。弧段设置为障碍边之后,表示双向都不通。
- */
- this.barrierEdgeIDs = null;
- /**
- * @member {Array.<number>} TransportationAnalystParameter.prototype.barrierNodeIDs
- * @description 网络分析中障碍点的 ID 数组。结点设置为障碍点之后,表示任何方向都不能通过此结点。
- */
- this.barrierNodeIDs = null;
- /**
- * @member {Array.<GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} TransportationAnalystParameter.prototype.barrierPoints
- * @description 网络分析中 Point2D 类型的障碍点数组。障碍点表示任何方向都不能通过此点。</br>
- * 当各网络分析参数类中的 isAnalyzeById 属性设置为 false 时,该属性才生效。
- */
- this.barrierPoints = null;
- /**
- * @member {string} [TransportationAnalystParameter.prototype.weightFieldName]
- * @description 阻力字段的名称,标识了进行网络分析时所使用的阻力字段,例如表示时间、长度等的字段都可以用作阻力字段。
- * 该字段默值为服务器发布的所有耗费字段的第一个字段。
- */
- this.weightFieldName = null;
- /**
- * @member {string} TransportationAnalystParameter.prototype.turnWeightField
- * @description 转向权重字段的名称。
- */
- this.turnWeightField = null;
- /**
- * @member {TransportationAnalystResultSetting} TransportationAnalystParameter.prototype.resultSetting
- * @description 分析结果返回内容。
- */
- this.resultSetting = new TransportationAnalystResultSetting();
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.TransportationAnalystParameter";
- }
- /**
- * @function TransportationAnalystParameter.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.barrierEdgeIDs = null;
- me.barrierNodeIDs = null;
- me.weightFieldName = null;
- me.turnWeightField = null;
- if (me.resultSetting) {
- me.resultSetting.destroy();
- me.resultSetting = null;
- }
- if (me.barrierPoints && me.barrierPoints.length) {
- for (var i in me.barrierPoints) {
- me.barrierPoints[i].destroy();
- }
- }
- me.barrierPoints = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ComputeWeightMatrixParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ComputeWeightMatrixParameters
- * @deprecatedclass SuperMap.ComputeWeightMatrixParameters
- * @category iServer NetworkAnalyst WeightMatrix
- * @classdesc 耗费矩阵分析参数类。根据交通网络分析参数中的耗费字段返回一个耗费矩阵。该矩阵是一个二维数组,用来存储任意两点间的资源消耗。
- * @param {Object} options - 参数。
- * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 指定路径分析的结点。
- * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} options.nodes - 要计算耗费矩阵的点数组。
- * @param {TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
- * @usage
- */
- class ComputeWeightMatrixParameters {
- constructor(options) {
- /**
- * @member {boolean} [ComputeWeightMatrixParameters.prototype.isAnalyzeById=false]
- * @description 是否通过节点 ID 指定路径分析的结点,即通过坐标点指定。
- */
- this.isAnalyzeById = false;
- /**
- * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} ComputeWeightMatrixParameters.prototype.nodes
- * @description 要计算耗费矩阵的点数组。
- * 当 {@link ComputeWeightMatrixParameters.isAnalyzeById} = false 时,nodes 应为点的坐标数组;
- * 当 {@link ComputeWeightMatrixParameters.isAnalyzeById} = true 时,nodes 应为点的 ID 数组。
- */
- this.nodes = null;
- /**
- * @member {TransportationAnalystParameter} ComputeWeightMatrixParameters.prototype.parameter
- * @description 交通网络分析通用参数。
- */
- this.parameter = new TransportationAnalystParameter();
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.ComputeWeightMatrixParameters";
- }
- /**
- * @function ComputeWeightMatrixParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.isAnalyzeById = null;
- me.nodes = null;
- if (me.parameter) {
- me.parameter.destroy();
- me.parameter = null;
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ComputeWeightMatrixService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ComputeWeightMatrixService
- * @deprecatedclass SuperMap.ComputeWeightMatrixService
- * @category iServer NetworkAnalyst WeightMatrix
- * @classdesc 耗费矩阵分析服务类。
- * 耗费矩阵是根据交通网络分析参数中的耗费字段来计算一个二维数组,
- * 用来存储指定的任意两点间的资源消耗。
- * 耗费矩阵分析结果通过该类支持的事件的监听函数参数获取
- * @extends {NetworkAnalystServiceBase}
- * @example
- * var mycomputeWeightMatrixService = new ComputeWeightMatrixService(url,{
- * eventListeners: {
- * "processCompleted": computeWeightMatrixCompleted,
- * "processFailed": computeWeightMatrixnError
- * }
- * });
- * @param {string} url - 耗费矩阵分析服务地址。请求服务的URL应为:
- * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
- * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 需要被注册的监听器对象。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class ComputeWeightMatrixService extends NetworkAnalystServiceBase {
- constructor(url, options) {
- super(url, options);
- this.CLASS_NAME = "SuperMap.ComputeWeightMatrixService";
- }
- /**
- * @function ComputeWeightMatrixService.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function ComputeWeightMatrixService.prototype.processAsync
- * @description 负责将客户端的查询参数传递到服务端。
- * @param {ComputeWeightMatrixParameters} params - 耗费矩阵分析参数类
- */
- processAsync(params) {
- if (!(params instanceof ComputeWeightMatrixParameters)) {
- return;
- }
- var me = this,
- jsonObject;
- me.url = Util.urlPathAppend(me.url, 'weightmatrix');
- jsonObject = {
- parameter: Util.toJSON(params.parameter),
- nodes: me.getJson(params.isAnalyzeById, params.nodes)
- };
- me.request({
- method: "GET",
- params: jsonObject,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- /**
- * @function ComputeWeightMatrixService.prototype.getJson
- * @description 将对象转化为JSON字符串。
- * @param {boolean} isAnalyzeById - 是否通过id分析
- * @param {Array.<ComputeWeightMatrixParameters>} params - 分析参数数组
- * @returns {string} 转化后的JSON字符串。
- */
- getJson(isAnalyzeById, params) {
- var jsonString = "[",
- len = params ? params.length : 0;
- if (isAnalyzeById === false) {
- for (let i = 0; i < len; i++) {
- if (i > 0) {
- jsonString += ",";
- }
- jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
- }
- } else if (isAnalyzeById === true) {
- for (let i = 0; i < len; i++) {
- if (i > 0) {
- jsonString += ",";
- }
- jsonString += params[i];
- }
- }
- jsonString += ']';
- return jsonString;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/DataFlowService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class DataFlowService
- * @deprecatedclass SuperMap.DataFlowService
- * @category iServer DataFlow
- * @classdesc 数据流服务类
- * @extends {CommonServiceBase}
- * @param {string} url - 数据流服务地址
- * @param {Object} options - 参数。
- * @param {function} options.style - 设置数据加载样式。
- * @param {function} [options.onEachFeature] - 设置每个数据加载popup等。
- * @param {GeoJSONObject} [options.geometry] - 指定几何范围,该范围内的要素才能被订阅。
- * @param {Object} [options.excludeField] - -排除字段。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class DataFlowService extends CommonServiceBase {
- constructor(url, options) {
- options = options || {};
- /*
- * @constant EVENT_TYPES
- * {Array.<string>}
- * 此类支持的事件类型
- */
- options.EVENT_TYPES = ["broadcastSocketConnected", "broadcastSocketClosed", "broadcastSocketError", "broadcastFailed", "broadcastSucceeded", "subscribeSocketConnected", "subscribeSocketClosed", "subscribeSocketError", "messageSucceeded", "setFilterParamSucceeded"]
- super(url, options);
- /**
- * @member {GeoJSONObject} DataFlowService.prototype.geometry
- * @description 指定几何范围,该范围内的要素才能被订阅。
- */
- this.geometry = null;
- /**
- * @member {Object} DataFlowService.prototype.prjCoordSys
- * @description 动态投影参数
- */
- this.prjCoordSys = null;
- /**
- * @member {Object} DataFlowService.prototype.excludeField
- * @description 排除字段
- */
- this.excludeField = null;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.DataFlowService";
- }
- /**
- * @function DataFlowService.prototype.initBroadcast
- * @description 初始化广播
- * @returns {DataFlowService}
- */
- initBroadcast() {
- var me = this;
- this.broadcastWebSocket = this._connect(Util.urlPathAppend(me.url, 'broadcast'));
- this.broadcastWebSocket.onopen = function (e) {
- me.broadcastWebSocket.isOpen = true;
- e.eventType = 'broadcastSocketConnected';
- me.events.triggerEvent('broadcastSocketConnected', e);
- };
- this.broadcastWebSocket.onclose = function (e) {
- if (me.broadcastWebSocket) {
- me.broadcastWebSocket.isOpen = false;
- }
- e.eventType = 'broadcastSocketClosed';
- me.events.triggerEvent('broadcastSocketClosed', e);
- };
- this.broadcastWebSocket.onerror = function (e) {
- e.eventType = 'broadcastSocketError';
- me.events.triggerEvent('broadcastSocketError', e);
- };
- return this;
- }
- /**
- * @function DataFlowService.prototype.broadcast
- * @description 加载广播数据。
- * @param {GeoJSONObject} geoJSONFeature - JSON 格式的要素数据。
- */
- broadcast(geoJSONFeature) {
- if (!this.broadcastWebSocket||!this.broadcastWebSocket.isOpen) {
- this.events.triggerEvent('broadcastFailed');
- return;
- }
- this.broadcastWebSocket.send(JSON.stringify(geoJSONFeature));
- this.events.triggerEvent('broadcastSucceeded');
- }
- /**
- * @function DataFlowService.prototype.initSubscribe
- * @description 初始化订阅数据
- * @returns {DataFlowService} DataFlowService的实例对象。
- */
- initSubscribe() {
- var me = this;
- this.subscribeWebSocket = this._connect(Util.urlPathAppend(me.url, 'subscribe'));
- this.subscribeWebSocket.onopen = function (e) {
- me.subscribeWebSocket.send(me._getFilterParams());
- e.eventType = 'subscribeSocketConnected';
- me.events.triggerEvent('subscribeSocketConnected', e);
- };
- this.subscribeWebSocket.onclose = function (e) {
- e.eventType = 'subscribeWebSocketClosed';
- me.events.triggerEvent('subscribeWebSocketClosed', e);
- };
- this.subscribeWebSocket.onerror = function (e) {
- e.eventType = 'subscribeSocketError';
- me.events.triggerEvent('subscribeSocketError', e);
- };
- this.subscribeWebSocket.onmessage = function (e) {
- me._onMessage(e);
- };
- return this;
- }
- /**
- * @function DataFlowService.prototype.setExcludeField
- * @description 设置排除字段
- * @param {Object} excludeField - 排除字段
- * @returns {DataFlowService} DataFlowService的实例对象。
- */
- setExcludeField(excludeField) {
- this.excludeField = excludeField;
- this.subscribeWebSocket.send(this._getFilterParams());
- return this;
- }
- /**
- * @function DataFlowService.prototype.setGeometry
- * @description 设置添加的几何要素数据
- * @param {GeoJSONObject} geometry - 指定几何范围,该范围内的要素才能被订阅。
- * @returns {DataFlowService} DataFlowService的实例对象。
- */
- setGeometry(geometry) {
- this.geometry = geometry;
- this.subscribeWebSocket.send(this._getFilterParams());
- return this;
- }
- /**
- * @function DataFlowService.prototype.unSubscribe
- * @description 结束订阅数据
- */
- unSubscribe() {
- if (!this.subscribeWebSocket) {
- return;
- }
- this.subscribeWebSocket.close();
- this.subscribeWebSocket = null;
- }
- /**
- * @function DataFlowService.prototype.unBroadcast
- * @description 结束加载广播
- */
- unBroadcast() {
- if (!this.broadcastWebSocket) {
- return;
- }
- this.broadcastWebSocket.close();
- this.broadcastWebSocket = null;
- }
- /**
- * @function DataFlowService.prototype.destroy
- * @override
- */
- destroy() {
- CommonServiceBase.prototype.destroy.apply(this, arguments);
- var me = this;
- me.geometry = null;
- me.prjCoordSys = null;
- me.excludeField = null;
- this.unBroadcast();
- this.unSubscribe();
- }
- _getFilterParams() {
- var filter = {
- filterParam: {
- prjCoordSys: this.prjCoordSys,
- excludeField: this.excludeField,
- geometry: this.geometry
- }
- };
- return Util.toJSON(filter);
- }
- _onMessage(e) {
- if (e.data && e.data.indexOf("filterParam") >= 0) {
- var filterParam = JSON.parse(e.data);
- e.filterParam = filterParam;
- e.eventType = 'setFilterParamSucceeded';
- this.events.triggerEvent('setFilterParamSucceeded', e);
- return;
- }
- var feature = JSON.parse(e.data);
- e.featureResult = feature;
- e.eventType = 'messageSucceeded';
- this.events.triggerEvent('messageSucceeded', e);
- }
- _connect(url) {
- url = SecurityManager.appendCredential(url);
- if ("WebSocket" in window) {
- return new WebSocket(url);
- } else if ("MozWebSocket" in window) {
- var mozWebSocket = window.MozWebSocket;
- return new mozWebSocket(url);
- } else {
- console.log("no WebSocket");
- return null;
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/DatasetInfo.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class DatasetInfo
- * @deprecatedclass SuperMap.DatasetInfo
- * @category iServer Data Dataset
- * @classdesc 数据集信息类。
- * 数据集一般为存储在一起的相关数据的集合;根据数据类型的不同,分为矢量数据集、栅格数据集(griddataset)和
- * 影像数据集(image dataset),以及为了处理特定问题而设计的数据集,如拓扑数据集,网络数据集等。
- * 数据集是 GIS 数据组织的最小单位。其中矢量数据集是由同种类型空间要素组成的集合,
- * 所以也可以称为要素集。根据要素的空间特征的不同,矢量数据集又分为点数据集,
- * 线数据集,面数据集等,各矢量数据集是空间特征和性质相同的数据组织起来的集合。
- * 目前版本支持的数据集主要有点数据集,线数据集,面数据集,文本数据集,复合数据集(CAD 数据集)、
- * 网络数据集,栅格数据集(grid dataset)和影像数据集(image dataset)。
- * @param {Object} options - 参数。
- * @param {Bounds} [options.bounds] - 数据集范围。
- * @param {string} [options.dataSourceName] - 数据源名称。
- * @param {string} [options.description] - 数据集的描述信息。
- * @param {string} [options.encodeType] - 数据集存储时的压缩编码方式。
- * @param {boolean} [options.isReadOnly] - 数据集是否为只读。
- * @param {string} options.name - 数据集名称。
- * @param {Object} [options.prjCoordSys] - 数据集的投影信息。如:prjCoordSys={"epsgCode":3857}。
- * @param {string} [options.tableName] - 表名。
- * @param {string} options.type - 数据集类型。主要有点数据集,线数据集,面数据集,文本数据集,复合数据集(CAD 数据集)、网络数据集,栅格数据集(grid dataset)和影像数据集(image dataset)。
- * @usage
- */
- class DatasetInfo {
- constructor(options) {
- options = options || {};
- /**
- * @member {Bounds} [DatasetInfo.prototype.bounds]
- * @description 数据集范围,该字段只读。
- */
- this.bounds = null;
- /**
- * @member {string} [DatasetInfo.prototype.dataSourceName]
- * @description 数据源名称,该字段只读。
- */
- this.dataSourceName = null;
- /**
- * @member {string} [DatasetInfo.prototype.description]
- * @description 数据集的描述信息。
- */
- this.description = null;
- /**
- * @member {string} [DatasetInfo.prototype.encodeType]
- * @description 数据集存储时的压缩编码方式,该字段只读。
- */
- this.encodeType = null;
- /**
- * @member {boolean} [DatasetInfo.prototype.isReadOnly]
- * @description 数据集是否为只读。
- */
- this.isReadOnly = null;
- /**
- * @member {string} DatasetInfo.prototype.name
- * @description 数据集名称,该字段必须且只读。
- */
- this.name = null;
- /**
- * @member {Object} [DatasetInfo.prototype.prjCoordSys]
- * @description 数据集的投影信息。
- */
- this.prjCoordSys = null;
- /**
- * @member {string} [DatasetInfo.prototype.tableName]
- * @description 表名,该字段只读。
- */
- this.tableName = null;
- /**
- * @member {string} DatasetInfo.prototype.type
- * @description 数据集类型,该字段必设。主要有点数据集,线数据集,面数据集,文本数据集,复合数据集(CAD 数据集)、网络数据集,栅格数据集(grid dataset)和影像数据集(image dataset)。
- */
- this.type = null;
- Util.extend(this, options);
- var b = this.bounds;
- if (b) {
- this.bounds = new Bounds(b.leftBottom.x, b.leftBottom.y, b.rightTop.x, b.rightTop.y);
- }
- this.CLASS_NAME = "SuperMap.DatasetInfo";
- }
- /**
- * @function DatasetInfo.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- Util.reset(this);
- }
- /**
- * @function DatasetInfo.prototype.toServerJSONObject
- * @description 转换成对应的 JSON 格式对象。
- * @returns {Object} JSON 对象。
- */
- toServerJSONObject() {
- var dataObj = {};
- dataObj = Util.copyAttributes(dataObj, this);
- if (dataObj.bounds) {
- if (dataObj.bounds.toServerJSONObject) {
- dataObj.bounds = dataObj.bounds.toServerJSONObject();
- }
- }
- return dataObj;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/OverlayAnalystParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class OverlayAnalystParameters
- * @deprecatedclass SuperMap.OverlayAnalystParameters
- * @category iServer SpatialAnalyst OverlayAnalyst
- * @classdesc 叠加分析参数基类。数据集叠加分析参数和几何对象叠加分析参数均继承此基类。
- * @param {Object} options - 参数。
- * @usage
- */
- class OverlayAnalystParameters {
- constructor(options) {
- /**
- * @member {OverlayOperationType} [OverlayAnalystParameters.prototype.operation=OverlayOperationType.UNION]
- * @description 指定叠加分析操作类型。
- */
- this.operation = OverlayOperationType.UNION;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.OverlayAnalystParameters";
- }
- /**
- * @function OverlayAnalystParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.operation = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/DatasetOverlayAnalystParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class DatasetOverlayAnalystParameters
- * @deprecatedclass SuperMap.DatasetOverlayAnalystParameters
- * @category iServer SpatialAnalyst OverlayAnalyst
- * @classdesc 数据集叠加分析参数类。
- * @param {Object} options - 参数。
- * @param {string} options.operateDataset -数据集名称。
- * @param {string} options.sourceDataset - 源数据集名称。
- * @param {Array.<string>} [options.operateDatasetFields] - 叠加分析中操作数据集保留在结果数据集中的字段名列表。
- * @param {FilterParameter} [options.operateDatasetFilter] - 设置操作数据集中空间对象过滤条件。
- * @param {Array.<GeometryPolygon|L.Polygon|ol.geom.Polygon|GeoJSONObject>} [options.operateRegions] - 操作面对象集合,表示与这些面对象进行叠加分析。与 operateDataset 参数互斥,冲突时以 operateDataset 为准。
- * @param {Array.<string>} [options.sourceDatasetFields] - 叠加分析中源数据集保留在结果数据集中的字段名列表。
- * @param {FilterParameter} [options.sourceDatasetFilter] - 设置源数据集中空间对象过滤条件。
- * @param {number} [options.tolerance=0] - 容限。
- * @param {OverlayOperationType} options.operation - 叠加操作枚举值。
- * @param {DataReturnOption} [options.resultSetting] - 结果返回设置类。
- * @extends {GetFeaturesParametersBase}
- * @usage
- */
- class DatasetOverlayAnalystParameters extends OverlayAnalystParameters {
- constructor(options) {
- super(options);
- /**
- * @member {string} DatasetOverlayAnalystParameters.prototype.operateDataset
- * @description 叠加分析中操作数据集的名称。
- */
- this.operateDataset = null;
- /**
- * @member {Array.<string>} [DatasetOverlayAnalystParameters.prototype.operateDatasetFields]
- * @description 叠加分析中操作数据集保留在结果数据集中的字段名列表。
- */
- this.operateDatasetFields = [];
- /**
- * @member {FilterParameter} DatasetOverlayAnalystParameters.prototype.operateDatasetFilter
- * @description 设置操作数据集中空间对象过滤条件。
- */
- this.operateDatasetFilter = new FilterParameter();
- /**
- * @member {Array.<GeometryPolygon|L.Polygon|ol.geom.Polygon|GeoJSONObject>} [DatasetOverlayAnalystParameters.prototype.operateRegions]
- * @description 操作面对象集合,表示与这些面对象进行叠加分析。与 operateDataset 参数互斥,冲突时以 operateDataset 为准。
- */
- this.operateRegions = [];
- /**
- * @member {string} DatasetOverlayAnalystParameters.prototype.sourceDataset
- * @description 叠加分析中源数据集的名称。
- */
- this.sourceDataset = null;
- /**
- * @member {Array.<string>} [DatasetOverlayAnalystParameters.prototype.sourceDatasetFields]
- * @description 叠加分析中源数据集保留在结果数据集中的字段名列表。
- */
- this.sourceDatasetFields = [];
- /**
- * @member {FilterParameter} [DatasetOverlayAnalystParameters.prototype.filterQueryParameter]
- * @description 设置源数据集中空间对象过滤条件。
- */
- this.sourceDatasetFilter = new FilterParameter();
- /**
- * @member {number} [DatasetOverlayAnalystParameters.prototype.tolerance=0]
- * @description 容限。
- */
- this.tolerance = 0;
- /**
- * @member {DataReturnOption} [DatasetOverlayAnalystParameters.prototype.resultSetting]
- * @description 结果返回设置类。
- */
- this.resultSetting = new DataReturnOption();
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.DatasetOverlayAnalystParameters";
- }
- /**
- * @function DatasetOverlayAnalystParameters.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- var me = this;
- me.operateDataset = null;
- me.operateDatasetFields = null;
- if (me.operateDatasetFilter) {
- me.operateDatasetFilter.destroy();
- me.operateDatasetFilter = null;
- }
- if (me.operateRegions) {
- for (var i = 0, opRegions = me.operateRegions, len = opRegions.length; i < len; i++) {
- opRegions[i].destroy();
- }
- me.operateRegions = null;
- }
- me.sourceDataset = null;
- me.sourceDatasetFields = null;
- if (me.sourceDatasetFilter) {
- me.sourceDatasetFilter.destroy();
- me.sourceDatasetFilter = null;
- }
- me.tolerance = null;
- if (me.resultSetting) {
- me.resultSetting.destroy();
- me.resultSetting = null;
- }
- }
- /**
- * @function DatasetOverlayAnalystParameters.toObject
- * @param {DatasetOverlayAnalystParameters} datasetOverlayAnalystParameters - 数据集叠加分析参数类。
- * @param {DatasetOverlayAnalystParameters} tempObj - 数据集叠加分析参数对象。
- * @description 将数据集叠加分析参数类转换为 JSON 对象。
- * @returns {Object} JSON 对象。
- */
- static toObject(datasetOverlayAnalystParameters, tempObj) {
- for (var name in datasetOverlayAnalystParameters) {
- if (name === "sourceDataset") {
- continue;
- } else if (name === "operateRegions") {
- tempObj.operateRegions = [];
- var ors = datasetOverlayAnalystParameters.operateRegions;
- for (var index in ors) {
- if (ors.hasOwnProperty(index)) { //icl542
- tempObj.operateRegions[index] = ServerGeometry.fromGeometry(ors[index]);
- }
- }
- } else if (name === "resultSetting") {
- tempObj.dataReturnOption = datasetOverlayAnalystParameters.resultSetting;
- } else {
- tempObj[name] = datasetOverlayAnalystParameters[name];
- }
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/SurfaceAnalystParametersSetting.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class SurfaceAnalystParametersSetting
- * @deprecatedclass SuperMap.SurfaceAnalystParametersSetting
- * @category iServer SpatialAnalyst SurfaceAnalyst
- * @classdesc 表面分析参数设置类。
- * 通过该类可以设置表面分析提取等值线、提取等值面的一些参数,包括基准值、等值距、光滑度、光滑方法等。
- * @param {Object} options - 参数。
- * @param {GeometryPolygon|L.Polygon|ol.geom.Polygon|GeoJSONObject} [options.clipRegion] - 裁剪面对象,如果不需要对操作结果进行裁剪,可以使用 null 值取代该参数。
- * @param {number} [options.datumValue=0] - 提取等值线、提取等值面的基准值。
- * @param {Array.<number>} options.expectedZValues - 期望分析结果的 Z 值集合。
- * @param {number} [options.interval=0] - 等值距。等值距是两条等值线之间的间隔值。
- * @param {number} [options.resampleTolerance=0] - 重采样容限。
- * @param {SmoothMethod} [options.smoothMethod=SmoothMethod.BSPLINE] - 光滑处理所使用的方法。
- * @param {number} [options.smoothness=0] - 等值线或等值面的边界线的光滑度。
- * @usage
- */
- class SurfaceAnalystParametersSetting {
- constructor(options) {
- /**
- * @member {GeometryPolygon|L.Polygon|ol.geom.Polygon|GeoJSONObject} [SurfaceAnalystParametersSetting.prototype.clipRegion]
- * @description 获取或设置裁剪面对象,如果不需要对操作结果进行裁剪,可以使用 null 值取代该参数。
- */
- this.clipRegion = null;
- /**
- * @member {number} [SurfaceAnalystParametersSetting.prototype.datumValue=0]
- * @description 获取或设置表面分析中提取等值线、提取等值面的基准值。
- * 基准值是作为一个生成等值线的初始起算值,并不一定是最小等值线的值。 例如,高程范围为 220 -1550 的 DEM 栅格数据,
- * 如果设基准值为 0, 等值距为 50,则提取等值线时,以基准值 0 为起点,等值距 50 为间隔提取等值线,
- * 因为给定高程的最小值是 220,所以,在给定范围内提取等值线的最小高程是 250。
- * 提取等值线的结果是:最小等值线值为 250,最大等值线值为 1550。
- */
- this.datumValue = 0;
- /**
- * @member {Array.<number>} SurfaceAnalystParametersSetting.prototype.expectedZValues
- * @description 获取或设置期望分析结果的 Z 值集合。
- * Z 值集合存储一系列数值,该数值为待提取等值线的值。即仅高程值在 Z 值集合中的等值线会被提取。
- */
- this.expectedZValues = null;
- /**
- * @member {number} [SurfaceAnalystParametersSetting.prototype.interval=0]
- * @description 获取或设置等值距。等值距是两条等值线之间的间隔值。
- */
- this.interval = 0;
- /**
- * @member {number} [SurfaceAnalystParametersSetting.prototype.resampleTolerance=0]
- * @description 获取或设置重采样容限。
- * 容限值越大,采样结果数据越简化。当分析结果出现交叉时,可通过调整重采样容限为较小的值来处理。
- */
- this.resampleTolerance = 0;
- /**
- * @member {SmoothMethod} [SurfaceAnalystParametersSetting.prototype.smoothMethod=SmoothMethod.BSPLINE]
- * @description 获取或设置光滑处理所使用的方法。
- */
- this.smoothMethod = SmoothMethod.BSPLINE;
- /**
- * @member {number} [SurfaceAnalystParametersSetting.prototype.smoothness=0]
- * @description 获取或设置表面分析中等值线或等值面的边界线的光滑度。
- * 以为 0-5 为例,光滑度为 0 表示不进行光滑操作,值越大表示光滑度越高。
- * 随着光滑度的增加,提取的等值线越光滑.当然光滑度越大,
- * 计算所需的时间和占用的内存也就越大。而且,当等值距较小时,
- * 光滑度太高会出现等值线相交的问题。
- */
- this.smoothness = 0;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.SurfaceAnalystParametersSetting";
- }
- /**
- * @function SurfaceAnalystParametersSetting.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- if (me.clipRegion) {
- me.clipRegion.destroy();
- me.clipRegion = null;
- }
- me.datumValue = null;
- me.expectedZValues = null;
- me.interval = null;
- me.resampleTolerance = null;
- me.smoothMethod = null;
- me.smoothness = null;
- }
- /**
- * @function SurfaceAnalystParametersSetting.prototype.toJSON
- * @description 将对象转化为 JSON 字符串。
- * @returns {string} 对象 JSON 字符串。
- */
- toJSON() {
- let json = "'datumValue':" + Util.toJSON(this.datumValue);
- json += ",'interval':" + Util.toJSON(this.interval);
- json += ",'resampleTolerance':" + Util.toJSON(this.resampleTolerance);
- json += ",'smoothMethod':" + Util.toJSON(this.smoothMethod);
- json += ",'smoothness':" + Util.toJSON(this.smoothness);
- if (this.expectedZValues != null) {
- json += "," + "'expectedZValues':" + Util.toJSON(this.expectedZValues);
- }
- if (this.clipRegion != null) {
- var serverGeometry = this.clipRegion;
- if (this.clipRegion instanceof Geometry && this.clipRegion.components) {
- serverGeometry = ServerGeometry.fromGeometry(this.clipRegion)
- }
- json += ",'clipRegion':" + Util.toJSON(serverGeometry);
- }
- return "{" + json + "}";
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/SurfaceAnalystParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class SurfaceAnalystParameters
- * @deprecatedclass SuperMap.SurfaceAnalystParameters
- * @category iServer SpatialAnalyst SurfaceAnalyst
- * @classdesc 表面分析提取操作参数类。通过该类可以为进行表面分析提供参数信息,包括表面分析的方法提取等值线、提取等值面和中间结果的分辨率,
- * {@link DatasetSurfaceAnalystParameters} 和 {@link GeometrySurfaceAnalystParameters} 继承自该类。
- * @param {Object} options - 参数。
- * @param {SurfaceAnalystParametersSetting} options.extractParameter - 表面分析参数设置类。
- * @param {number} options.resolution - 指定中间结果(栅格数据集)的分辨率。
- * @param {DataReturnOption} options.resultSetting - 结果返回设置类。
- * @param {SurfaceAnalystMethod} [options.surfaceAnalystMethod=SurfaceAnalystMethod.ISOLINE] - 获取或设置表面分析的提取方法,提取等值线和提取等值面。
- * @usage
- */
- class SurfaceAnalystParameters {
- constructor(options) {
- /**
- * @member {number} SurfaceAnalystParameters.prototype.resolution
- * @description 获取或设置指定中间结果(栅格数据集)的分辨率。
- */
- this.resolution = 0;
- /**
- * @member {SurfaceAnalystParametersSetting} SurfaceAnalystParameters.prototype.extractParameter
- * @description 获取或设置表面分析参数。
- * 在进行点数据集进行提取等值面分析时,暂时不支持 SurfaceAnalystParametersSetting 类中的 expectedZValues 字段。
- */
- this.extractParameter = new SurfaceAnalystParametersSetting();
- /**
- * @member {DataReturnOption} SurfaceAnalystParameters.prototype.resultSetting
- * @description 结果返回设置类。
- */
- this.resultSetting = new DataReturnOption();
- /**
- * @member {SurfaceAnalystMethod} [SurfaceAnalystParameters.prototype.surfaceAnalystMethod=SurfaceAnalystMethod.ISOLINE]
- * @description 获取或设置表面分析的提取方法,提取等值线和提取等值面。
- */
- this.surfaceAnalystMethod = SurfaceAnalystMethod.ISOLINE;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.SurfaceAnalystParameters";
- }
- /**
- * @function SurfaceAnalystParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.resolution = null;
- if (me.extractParameter) {
- me.extractParameter.destroy();
- me.extractParameter = null;
- }
- if (me.resultSetting) {
- me.resultSetting.destroy();
- me.resultSetting = null;
- }
- me.surfaceAnalystMethod = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/DatasetSurfaceAnalystParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class DatasetSurfaceAnalystParameters
- * @deprecatedclass SuperMap.DatasetSurfaceAnalystParameters
- * @category iServer SpatialAnalyst SurfaceAnalyst
- * @classdesc 数据集表面分析参数类。该类对数据集表面分析所用到的参数进行设置。
- * @param {Object} options - 参数。
- * @param {string} options.dataset - 数据集名称。
- * @param {string} options.zValueFieldName - 字段名称。
- * @param {number} options.resolution - 指定中间结果(栅格数据集)的分辨率。
- * @param {SurfaceAnalystParametersSetting} options.extractParameter - 表面分析参数设置类。获取或设置表面分析参数。
- * @param {FilterParameter} [options.filterQueryParameter] - 查询过滤条件参数。
- * @param {DataReturnOption} [options.resultSetting] - 结果返回设置类。
- * @param {SurfaceAnalystMethod} [options.surfaceAnalystMethod=SurfaceAnalystMethod.ISOLINE] - 表面分析的提取方法,提取等值线和提取等值面。
- * @extends {SurfaceAnalystParameters}
- * @usage
- */
- class DatasetSurfaceAnalystParameters extends SurfaceAnalystParameters {
- constructor(options) {
- super(options);
- /**
- * @member {string} DatasetSurfaceAnalystParameters.prototype.dataset
- * @description 要用来做数据集表面分析的数据源中数据集的名称。该名称用形如 "数据集名称@数据源别名" 形式来表示,例如:Country@World。
- */
- this.dataset = null;
- /**
- * @member {FilterParameter} DatasetSurfaceAnalystParameters.prototype.filterQueryParameter
- * @description 获取或设置查询过滤条件参数。
- */
- this.filterQueryParameter = new FilterParameter();
- /**
- * @member {string} DatasetSurfaceAnalystParameters.prototype.zValueFieldName
- * @description 获取或设置用于提取操作的字段名称。提取等值线时,将使用该字段中的值,对点记录集中的点数据进行插值分析,得到栅格数据集(中间结果),接着从栅格数据集提取等值线。
- */
- this.zValueFieldName = null;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.DatasetSurfaceAnalystParameters";
- }
- /**
- * @function DatasetSurfaceAnalystParameters.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- var me = this;
- me.dataset = null;
- if (me.filterQueryParameter) {
- me.filterQueryParameter.destroy();
- me.filterQueryParameter = null;
- }
- me.zValueFieldName = null;
- }
- /**
- * @function DatasetSurfaceAnalystParameters.toObject
- * @param {DatasetSurfaceAnalystParameters} datasetSurfaceAnalystParameters - 数据集表面分析参数类。
- * @param {DatasetSurfaceAnalystParameters} tempObj - 数据集表面分析参数对象。
- * @description 将数据集表面分析参数对象转换为 JSON 对象。
- * @returns JSON 对象。
- */
- static toObject(datasetSurfaceAnalystParameters, tempObj) {
- for (var name in datasetSurfaceAnalystParameters) {
- if (name === "filterQueryParameter") {
- tempObj.filterQueryParameter = datasetSurfaceAnalystParameters.filterQueryParameter;
- }
- if (name === "extractParameter") {
- if (datasetSurfaceAnalystParameters.extractParameter.clipRegion instanceof Geometry && datasetSurfaceAnalystParameters.extractParameter.clipRegion.components) {
- datasetSurfaceAnalystParameters.extractParameter.clipRegion = ServerGeometry.fromGeometry(datasetSurfaceAnalystParameters.extractParameter.clipRegion);
- }
- tempObj.extractParameter = datasetSurfaceAnalystParameters.extractParameter;
- } else if (name === "dataset") {
- continue;
- } else if (name === "surfaceAnalystMethod") {
- continue;
- } else {
- tempObj[name] = datasetSurfaceAnalystParameters[name];
- }
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ThiessenAnalystParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ThiessenAnalystParameters
- * @deprecatedclass SuperMap.ThiessenAnalystParameters
- * @category iServer SpatialAnalyst ThiessenPolygonAnalyst
- * @classdesc 泰森多边形分析参数基类。
- * @param {Object} options - 可选参数。
- * @param {GeometryPolygon|L.Polygon|ol.geom.Polygon|GeoJSONObject} [options.clipRegion] - 结果数据裁剪区域,可以为 null,表示不对结果进行裁剪。
- * @param {boolean} [options.createResultDataset=false] - 是否返回结果数据集。
- * @param {string} [options.resultDatasetName] - 指定结果数据集名称。
- * @param {string} [options.resultDatasourceName] - 指定结果数据集所在数据源,默认为当前数据源。
- * @param {boolean} [options.returnResultRegion=true] - 是否返回分析得到的多边形面数组。
- * @usage
- */
- class ThiessenAnalystParameters {
- constructor(options) {
- if (!options) {
- return;
- }
- /**
- * @member {GeometryPolygon|L.Polygon|ol.geom.Polygon|GeoJSONObject} [ThiessenAnalystParameters.prototype.clipRegion]
- * @description 结果数据裁剪区域,可以为 null,表示不对结果进行裁剪。
- */
- this.clipRegion = null;
- /**
- * @member {boolean} [ThiessenAnalystParameters.prototype.createResultDataset=false]
- * @description 是否返回结果数据集。如果为 true,则必须设置属性 resultDatasetName 和 resultDatasourceName。
- */
- this.createResultDataset = false;
- /**
- * @member {string} ThiessenAnalystParameters.prototype.resultDatasetName
- * @description 指定结果数据集名称。
- */
- this.resultDatasetName = null;
- /**
- * @member {string} ThiessenAnalystParameters.prototype.resultDatasourceName
- * @description 指定结果数据集所在数据源。
- */
- this.resultDatasourceName = null;
- /**
- * @member {boolean} ThiessenAnalystParameters.prototype.returnResultRegion
- * @description 是否返回分析得到的多边形面数组。
- */
- this.returnResultRegion = true;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.ThiessenAnalystParameters";
- }
- /**
- * @function ThiessenAnalystParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- if (me.clipRegion) {
- me.clipRegion.destroy();
- me.clipRegion = null;
- }
- me.createResultDataset = null;
- me.resultDatasetName = null;
- me.resultDatasourceName = null;
- me.returnResultRegion = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/DatasetThiessenAnalystParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class DatasetThiessenAnalystParameters
- * @deprecatedclass SuperMap.DatasetThiessenAnalystParameters
- * @category iServer SpatialAnalyst ThiessenAnalyst
- * @classdesc 数据集泰森多边形分析参数类。
- * @param {Object} options - 参数。
- * @param {FilterParameter} [options.filterQueryParameter] - 过滤参数类,即对数据集中的所有点进行分析。
- * @extends {ThiessenAnalystParameters}
- * @usage
- */
- class DatasetThiessenAnalystParameters extends ThiessenAnalystParameters {
- constructor(options) {
- super(options);
- /**
- * @member {FilterParameter} [DatasetThiessenAnalystParameters.prototype.filterQueryParameter]
- * @description 过滤条件,对待分析数据集中的点进行过滤,即对数据集中的所有点进行分析。
- * @example
- * var filterQueryParameter = new FilterParameter({
- * name: "Countries@World",
- * attributeFilter: "SmID>100"
- * });
- */
- this.filterQueryParameter = null;
- /**
- * @member {string} DatasetThiessenAnalystParameters.prototype.dataset
- * @description 数据集名称待分析的数据集名称,请使用 "datasetName@datasourceName" 格式来表示。
- */
- this.dataset = null;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.DatasetThiessenAnalystParameters";
- }
- /**
- * @function DatasetThiessenAnalystParameters.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- var me = this;
- if (me.filterQueryParameter) {
- me.filterQueryParameter.destroy();
- me.filterQueryParameter = null;
- }
- }
- /**
- * @function DatasetThiessenAnalystParameters.toObject
- * @param {DatasetThiessenAnalystParameters} datasetThiessenAnalystParameters - 泰森多边形分析服务参数类。
- * @param {DatasetThiessenAnalystParameters} tempObj - 泰森多边形分析服务参数对象。
- * @description 将泰森多边形分析服务参数对象转换为 JSON 对象。
- * @returns JSON 对象。
- */
- static toObject(datasetThiessenAnalystParameters, tempObj) {
- for (var name in datasetThiessenAnalystParameters) {
- if (name === "clipRegion") {
- tempObj.clipRegion = ServerGeometry.fromGeometry(datasetThiessenAnalystParameters.clipRegion);
- } else {
- tempObj[name] = datasetThiessenAnalystParameters[name];
- }
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/DatasourceService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class DatasourceService
- * @deprecatedclass SuperMap.DatasourceService
- * @category iServer Data Datasource
- * @classdesc 数据源查询服务。
- * @param {string} url - 服务地址。如访问World Data服务,只需将url设为:http://localhost:8090/iserver/services/data-world/rest/data 即可。
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
- * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
- * @param {string} options.datasource - 要查询的数据集所在的数据源名称。
- * @param {string} options.dataset - 要查询的数据集名称。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @extends {CommonServiceBase}
- * @usage
- */
- class DatasourceService extends CommonServiceBase {
- constructor(url, options) {
- super(url, options);
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.DatasourceService";
- }
- /**
- * @function DatasourceService.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function DatasourceService.prototype.getDatasourceService
- * @description 获取指定数据源信息。
- */
- getDatasourceService(datasourceName) {
- var me = this;
- me.url = Util.urlPathAppend(me.url,`datasources/name/${datasourceName}`);
- me.request({
- method: "GET",
- data: null,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- /**
- * @function DatasourceService.prototype.getDatasourcesService
- * @description 获取所有数据源信息。
- */
- getDatasourcesService() {
- var me = this;
- me.url = Util.urlPathAppend(me.url,`datasources`);
- me.request({
- method: "GET",
- data: null,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- /**
- * @function DatasourceService.prototype.setDatasourceService
- * @description 更新数据源信息。
- */
- setDatasourceService(params) {
- if (!params) {
- return;
- }
- var me = this;
- var jsonParamsStr = Util.toJSON(params);
- me.request({
- method: "PUT",
- data: jsonParamsStr,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/DensityKernelAnalystParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class DensityKernelAnalystParameters
- * @deprecatedclass SuperMap.DensityKernelAnalystParameters
- * @category iServer SpatialAnalyst DensityAnalyst
- * @classdesc 核密度分析参数类。
- * @param {Object} options - 参数。
- * @param {string} options.dataset - 要用来做核密度分析数据源中数据集的名称。该名称用形如 "数据集名称@数据源别名" 形式来表示,例如:BaseMap_P@Jingjin。
- * @param {string} options.fieldName - 用于进行核密度分析的测量值的字段名称,核密度分析不支持文本类型的字段。
- * @param {string} options.resultGridName - 指定结果数据集名称。
- * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} [options.bounds] - 核密度分析的范围,用于确定结果栅格数据集的范围。如果缺省,则默认为原数据集的范围。
- * @param {number} [options.searchRadius] - 栅格邻域内用于计算密度的查找半径,单位与当前数据集相同。默认值为当前数据集的长宽中的最大值除30。
- * @param {number} [options.resultGridDatasetResolution] - 密度分析结果栅格数据的分辨率,单位与当前数据集相同。默认值为当前数据集的长宽中的最小值除500。
- * @param {string} [options.targetDatasource] - 指定的存储结果数据集的数据源,默认为当前分析的数据集所在的数据源。
- * @param {boolean} [options.deleteExistResultDataset=false] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
- * @usage
- */
- class DensityKernelAnalystParameters {
- constructor(options) {
- /**
- * @member {string} DensityKernelAnalystParameters.prototype.dataset
- * @description 要用来做核密度分析数据源中数据集的名称。
- * 该名称用形如 "数据集名称@数据源别名" 形式来表示,例如:Railway@Changchun。
- * 注:核密度分析支持点数据集和线数据集。
- */
- this.dataset = null;
- /**
- * @member {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} [DensityKernelAnalystParameters.prototype.bounds]
- * @description 核密度分析的范围,用于确定结果栅格数据集的范围。
- * 如果缺省,则默认为原数据集的范围。
- */
- this.bounds = null;
- /**
- * @member {string} DensityKernelAnalystParameters.prototype.fieldName
- * @description 用于进行核密度分析的测量值的字段名称,核密度分析不支持文本类型的字段。
- */
- this.fieldName = null;
- /**
- * @member {number} [DensityKernelAnalystParameters.prototype.resultGridDatasetResolution]
- * @description 密度分析结果栅格数据的分辨率,单位与当前数据集相同。默认值为当前数据集的长宽中的最小值除500。
- */
- this.resultGridDatasetResolution = null;
- /**
- * @member {number} [DensityKernelAnalystParameters.prototype.searchRadius]
- * @description 栅格邻域内用于计算密度的查找半径,单位与当前数据集相同。默认值为当前数据集的长宽中的最大值除30。
- */
- this.searchRadius = null;
- /**
- * @member {string} [DensityKernelAnalystParameters.prototype.targetDatasource]
- * @description 指定的存储结果数据集的数据源,默认为当前分析的数据集所在的数据源。
- */
- this.targetDatasource = null;
- /**
- * @member {string} DensityKernelAnalystParameters.prototype.resultGridName
- * @description 指定结果数据集名称。
- */
- this.resultGridName = null;
- /**
- * @member {boolean} [DensityKernelAnalystParameters.prototype.deleteExistResultDataset=false]
- * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
- */
- this.deleteExistResultDataset = false;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.DensityKernelAnalystParameters";
- }
- /**
- * @function DensityKernelAnalystParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.dataset = null;
- me.bounds = null;
- me.fieldName = null;
- me.resultGridDatasetResolution = null;
- me.searchRadius = null;
- me.targetDatasource = null;
- me.resultGridName = null;
- me.deleteExistResultDataset = null;
- }
- /**
- * @function DensityKernelAnalystParameters.toObject
- * @param {DensityKernelAnalystParameters} densityKernelAnalystParameters -核密度分析参数类。
- * @param {DensityKernelAnalystParameters} tempObj - 核密度分析参数对象。
- * @description 将核密度分析参数对象转换成 JSON 对象。
- * @returns JSON 对象。
- */
- static toObject(densityKernelAnalystParameters, tempObj) {
- for (var name in densityKernelAnalystParameters) {
- if (name !== "dataset") {
- tempObj[name] = densityKernelAnalystParameters[name];
- }
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/DensityAnalystService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class DensityAnalystService
- * @deprecatedclass SuperMap.DensityAnalystService
- * @category iServer SpatialAnalyst DensityAnalyst
- * @classdesc
- * 密度分析服务类,密度分析可计算每个输出栅格像元周围圆形邻域内输入的点或线对象的密度。
- * 密度分析,在某种意义上来说,相当于在表面上将输入的点线对象的测量值散开来,将每个点或线对象的测量量分布在整个研究区域,并计算输出栅格中每个像元的密度值。目前提供1种密度分析:核密度分析(Kernel)。
- * @param {string} url - 服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst 。
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 需要被注册的监听器对象。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @extends {SpatialAnalystBase}
- * @example 例如:
- * var myDensityAnalystService = new DensityAnalystService(url);
- * myDensityAnalystService.on({
- * "processCompleted": processCompleted,
- * "processFailed": processFailed
- * }
- * );
- * @usage
- */
- class DensityAnalystService extends SpatialAnalystBase {
- constructor(url, options) {
- super(url, options);
- /**
- * @member {string} DensityAnalystService.prototype.mode
- * @description 密度分析类型。
- */
- this.mode = null;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.DensityAnalystService";
- }
- /**
- * @function DensityAnalystService.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- super.destroy();
- this.mode = null;
- }
- /**
- * @function DensityAnalystService.prototype.processAsync
- * @description 负责将客户端的查询参数传递到服务端。
- * @param {DensityKernelAnalystParameters} parameter - 核密度分析参数。
- */
- processAsync(parameter) {
- var me = this;
- var parameterObject = new Object();
- if (parameter instanceof DensityKernelAnalystParameters) {
- me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/densityanalyst/kernel');
- me.mode = "kernel";
- }
- DensityKernelAnalystParameters.toObject(parameter, parameterObject);
- var jsonParameters = Util.toJSON(parameterObject);
- me.url = Util.urlAppend(me.url, 'returnContent=true');
- me.request({
- method: "POST",
- data: jsonParameters,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/EditFeaturesParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class EditFeaturesParameters
- * @deprecatedclass SuperMap.EditFeaturesParameters
- * @category iServer Data Feature
- * @classdesc 数据集添加、修改、删除参数类。
- * @param {Object} options - 参数。
- * @param {Array.<FeatureVector|GeoJSONObject|ol.Feature>} options.features - 当前需要创建或者是修改的要素集。
- * @param {boolean} [options.returnContent=false] - 是否返回要素内容。如果为true则返回创建要素的 ID 数组,否则返回 featureResult 资源的 URI。
- * @param {EditType} [options.editType=EditType.ADD] - POST 动作类型 (ADD、UPDATE、DELETE)。
- * @param {Array.<string|number>} [options.IDs] - 删除要素时的要素的 ID 数组。
- * @usage
- */
- class EditFeaturesParameters {
- constructor(options) {
- /**
- * @member {string} EditFeaturesParameters.prototype.dataSourceName
- * @description 当前需要创建或者是修改的要素的数据源。
- */
- this.dataSourceName = null;
- /**
- * @member {string} EditFeaturesParameters.prototype.dataSetName
- * @description 当前需要创建或者是修改的要素的数据集。
- */
- this.dataSetName = null;
- /**
- * @member {Array.<FeatureVector|GeoJSONObject|ol.Feature>} EditFeaturesParameters.prototype.features
- * @description 当前需要创建或者是修改的要素集。
- */
- this.features = null;
- /**
- * @member {EditType} [EditFeaturesParameters.prototype.editType=EditType.ADD]
- * @description 要素集更新类型 (add、update、delete)。
- */
- this.editType = EditType.ADD;
- /**
- * @member {Array.<string|number>} [EditFeaturesParameters.prototype.IDs]
- * @description 执行删除时要素集 ID 集合。
- */
- this.IDs = null;
- /**
- * @member {boolean} [EditFeaturesParameters.prototype.returnContent=false]
- * @description 要素添加时,isUseBatch 不传或传为 false 的情况下有效。
- * true 表示直接返回新创建的要素的 ID 数组;false 表示返回创建的 featureResult 资源的 URI。
- */
- this.returnContent = false;
- /**
- * @member {boolean} [EditFeaturesParameters.prototype.isUseBatch=false]
- * @description 是否使用批量添加要素功能,要素添加时有效。批量添加能够提高要素编辑效率。true 表示批量添加;false 表示不使用批量添加。
- */
- this.isUseBatch = false;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.EditFeaturesParameters";
- }
- /**
- * @function EditFeaturesParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.dataSourceName = null;
- me.dataSetName = null;
- me.features = null;
- me.editType = null;
- me.IDs = null;
- me.returnContent = null;
- }
- /**
- * @function EditFeaturesParameters.prototype.toJsonParameters
- * @description 将 EditFeaturesParameters 对象参数转换为 JSON 字符串。
- * @param {EditFeaturesParameters} params - 地物编辑参数。
- * @returns {string} JSON 字符串。
- */
- static toJsonParameters(params) {
- var feature,
- len,
- features,
- editType = params.editType;
- if (editType === EditType.DELETE) {
- if (params.IDs === null) {
- return;
- }
- features = {ids: params.IDs};
- } else {
- features = [];
- if (params.features) {
- len = params.features.length;
- for (var i = 0; i < len; i++) {
- feature = params.features[i];
- feature.geometry = ServerGeometry.fromGeometry(feature.geometry);
- features.push(feature);
- }
- }
- }
- return Util.toJSON(features);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/EditFeaturesService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class EditFeaturesService
- * @deprecatedclass SuperMap.EditFeaturesService
- * @category iServer Data Feature
- * @classdesc 数据服务中数据集添加、更新、删除服务类。
- * @extends {CommonServiceBase}
- * @param {string} url - 服务端的数据服务资源地址。请求数据服务中数据集编辑服务,URL 应为:</br>
- * http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/datasources/name/{数据源名}/datasets/name/{数据集名} 。</br>
- * 例如:http://localhost:8090/iserver/services/data-jingjin/rest/data/datasources/name/Jingjin/datasets/name/Landuse_R
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
- * @param {DataFormat} [format] -查询结果返回格式,目前支持iServerJSON 和GeoJSON两种格式。参数格式为"ISERVER","GEOJSON"。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @example
- * var myService = new EditFeaturesService(url, {eventListeners: {
- * "processCompleted": editFeatureCompleted,
- * "processFailed": editFeatureError
- * }
- * };
- * @usage
- */
- class EditFeaturesService extends CommonServiceBase {
- constructor(url, options) {
- super(url, options);
- /**
- * @member {boolean} [EditFeaturesService.prototype.returnContent=false]
- * @description要素添加时,isUseBatch 不传或传为 false 的情况下有效。true 表示直接返回新创建的要素的 ID 数组;false 表示返回创建的 featureResult 资源的 URI。
- */
- this.returnContent = false;
- /**
- * @member {boolean} [EditFeaturesService.prototype.isUseBatch=false]
- * @description 是否使用批量添加要素功能,要素添加时有效。
- * 批量添加能够提高要素编辑效率。
- * true 表示批量添加;false 表示不使用批量添加。
- */
- this.isUseBatch = false;
- if (options) {
- Util.extend(this, options);
- }
- this.url = Util.urlPathAppend(this.url, 'features');
- this.CLASS_NAME = "SuperMap.EditFeaturesService";
- }
- /**
- * @function EditFeaturesService.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- var me = this;
- me.returnContent = null;
- me.isUseBatch = null;
- me.fromIndex = null;
- me.toIndex = null;
- }
- /**
- * @function EditFeaturesService.prototype.processAsync
- * @description 负责将客户端的更新参数传递到服务端。
- * @param {EditFeaturesParameters} params - 编辑要素参数。
- */
- processAsync(params) {
- if (!(params instanceof EditFeaturesParameters)) {
- return;
- }
- var me = this,
- method = "POST",
- ids = "",
- editType = params.editType,
- jsonParameters = null;
- me.returnContent = params.returnContent;
- me.isUseBatch = params.isUseBatch;
- jsonParameters = EditFeaturesParameters.toJsonParameters(params);
- if (editType === EditType.DELETE) {
- ids = Util.toJSON(params.IDs);
- jsonParameters = ids;
- var urlWithIds = Util.urlAppend(me.url, Util.getParameterString({ids}))
- if(FetchRequest.urlIsLong(urlWithIds)) {
- me.url = Util.urlAppend(me.url, Util.getParameterString({_method: 'DELETE'}));
- method = "POST";
- } else{
- me.url = urlWithIds;
- method = "DELETE";
- }
-
- } else if (editType === EditType.UPDATE) {
- method = "PUT";
- } else {
- if (me.isUseBatch) {
- me.url = Util.urlAppend(me.url, `isUseBatch=${me.isUseBatch}`);
- me.returnContent = false;
- }
- if (me.returnContent) {
- me.url = Util.urlAppend(me.url, 'returnContent=true');
- method = "POST";
- }
- }
- me.request({
- method: method,
- data: jsonParameters,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalyst3DParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FacilityAnalyst3DParameters
- * @deprecatedclass SuperMap.FacilityAnalyst3DParameters
- * @category iServer FacilityAnalyst3D
- * @classdesc 最近设施分析参数基类。最近设施分析是指在网络上给定一个事件点和一组设施点,查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
- * 设施点一般为学校、超市、加油站等服务设施;事件点为需要服务设施的事件位置。例如事件发生点是一起交通事故,要求查找在 10 分钟内能到达的最近医院,
- * 超过 10 分钟能到达的都不予考虑。此例中,事故发生地即是一个事件点,周边的医院则是设施点。最近设施查找实际上也是一种路径分析,因此对路径分析起
- * 作用的障碍边、障碍点、转向表、耗费等属性在最近设施分析时同样可设置。
- * @param {Object} options - 参数。
- * @param {string} options.weightName - 指定的权值字段信息对象的名称。
- * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
- * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
- * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
- * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
- * @usage
- */
- class FacilityAnalyst3DParameters {
- constructor(options) {
- /**
- * @member {number} [FacilityAnalyst3DParameters.prototype.edgeID]
- * @description 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
- */
- this.edgeID = null;
- /**
- * @member {number} [FacilityAnalyst3DParameters.prototype.nodeID]
- * @description 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
- */
- this.nodeID = null;
- /**
- * @member {string} FacilityAnalyst3DParameters.prototype.weightName
- * @description 指定的权值字段信息对象的名称。
- */
- this.weightName = null;
- /**
- * @member {boolean} [FacilityAnalyst3DParameters.prototype.isUncertainDirectionValid=false]
- * @description 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
- * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找
- */
- this.isUncertainDirectionValid = false;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.FacilityAnalyst3DParameters";
- }
- /**
- * @function FacilityAnalyst3DParameters.prototype.destroy
- * @description 释放资源,将资源的属性置空。
- */
- destroy() {
- var me = this;
- me.edgeID = null;
- me.nodeID = null;
- me.weightName = null;
- me.isUncertainDirectionValid = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystSinks3DParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FacilityAnalystSinks3DParameters
- * @deprecatedclass SuperMap.FacilityAnalystSinks3DParameters
- * @category iServer FacilityAnalyst3D Sinks
- * @classdesc 最近设施分析参数类(汇查找资源)。最近设施分析是指在网络上给定一个事件点和一组设施点,查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
- * 设施点一般为学校、超市、加油站等服务设施;事件点为需要服务设施的事件位置。例如事件发生点是一起交通事故,要求查找在10分钟内能到达的最近医院,超过10分钟
- * 能到达的都不予考虑。此例中,事故发生地即是一个事件点,周边的医院则是设施点。最近设施查找实际上也是一种路径分析,因此对路径分析起作用的障碍边、障碍点、
- * 转向表、耗费等属性在最近设施分析时同样可设置。
- * @extends {FacilityAnalyst3DParameters}
- * @param {Object} options - 参数。
- * @param {string} options.weightName - 指定的权值字段信息对象的名称。
- * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
- * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
- * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
- * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
- * @usage
- */
- class FacilityAnalystSinks3DParameters extends FacilityAnalyst3DParameters {
- constructor(options) {
- super(options);
- this.CLASS_NAME = "SuperMap.FacilityAnalystSinks3DParameters";
- }
- /**
- * @function FacilityAnalystSinks3DParameters.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystSinks3DService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FacilityAnalystSinks3DService
- * @deprecatedclass SuperMap.FacilityAnalystSinks3DService
- * @category iServer FacilityAnalyst3D Sinks
- * @classdesc 最近设施分析服务类(汇查找资源)<br>
- * 最近设施分析是指在网络上给定一个事件点和一组设施点,
- * 查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
- * 该类负责将客户端指定的最近设施分析参数传递给服务端,并接收服务端返回的结果数据。
- * 最近设施分析结果通过该类支持的事件的监听函数参数获取
- * @extends {CommonServiceBase}
- * @example
- * var myFacilityAnalystSinks3DService = new FacilityAnalystSinks3DService(url, {
- * eventListeners: {
- * "processCompleted": facilityAnalystSinks3DCompleted,
- * "processFailed": facilityAnalystSinks3DError
- * }
- * });
- * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:<br>
- * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};<br>
- * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。<br>
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 需要被注册的监听器对象。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class FacilityAnalystSinks3DService extends CommonServiceBase {
- constructor(url, options) {
- super(url, options);
- this.CLASS_NAME = "SuperMap.FacilityAnalystSinks3DService";
- }
- /**
- * @function FacilityAnalystSinks3DService.prototype.destroy
- * @override
- */
- destroy() {
- CommonServiceBase.prototype.destroy.apply(this, arguments);
- }
- /**
- * @function FacilityAnalystSinks3DService.prototype.processAsync
- * @description 负责将客户端的查询参数传递到服务端。
- * @param {FacilityAnalystSinks3DParameters} params - 最近设施分析参数类(汇查找资源)
- */
- processAsync(params) {
- if (!(params instanceof FacilityAnalystSinks3DParameters)) {
- return;
- }
- var me = this, jsonObject;
- me.url = Util.urlPathAppend(me.url, 'sinks');
- jsonObject = {
- edgeID: params.edgeID,
- nodeID: params.nodeID,
- weightName: params.weightName,
- isUncertainDirectionValid: params.isUncertainDirectionValid
- };
- me.request({
- method: "GET",
- params: jsonObject,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystSources3DParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FacilityAnalystSources3DParameters
- * @deprecatedclass SuperMap.FacilityAnalystSources3DParameters
- * @category iServer FacilityAnalyst3D Sources
- * @classdesc 最近设施分析参数类(源查找资源)。最近设施分析是指在网络上给定一个事件点和一组设施点,查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
- * 设施点一般为学校、超市、加油站等服务设施;事件点为需要服务设施的事件位置。例如事件发生点是一起交通事故,要求查找在10分钟内能到达的最近医院,超过10分
- * 钟能到达的都不予考虑。此例中,事故发生地即是一个事件点,周边的医院则是设施点。最近设施查找实际上也是一种路径分析,因此对路径分析起作用的障碍边、障碍
- * 点、转向表、耗费等属性在最近设施分析时同样可设置。
- * @extends {FacilityAnalyst3DParameters}
- * @param {Object} options - 参数。
- * @param {string} options.weightName - 指定的权值字段信息对象的名称。
- * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
- * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
- * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
- * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
- * @usage
- */
- class FacilityAnalystSources3DParameters extends FacilityAnalyst3DParameters {
- constructor(options) {
- super(options);
- this.CLASS_NAME = "SuperMap.FacilityAnalystSources3DParameters";
- }
- /**
- * @function FacilityAnalystSources3DParameters.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystSources3DService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FacilityAnalystSources3DService
- * @deprecatedclass SuperMap.FacilityAnalystSources3DService
- * @category iServer FacilityAnalyst3D Sources
- * @classdesc 最近设施分析服务类(源查找资源)
- * 最近设施分析是指在网络上给定一个事件点和一组设施点,
- * 查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
- * 该类负责将客户端指定的最近设施分析参数传递给服务端,并接收服务端返回的结果数据。
- * 最近设施分析结果通过该类支持的事件的监听函数参数获取。
- * @extends {CommonServiceBase}
- * @param {string} url - 服务地址。请求网络分析服务,URL应为:
- * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
- * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 需要被注册的监听器对象。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class FacilityAnalystSources3DService extends CommonServiceBase {
- constructor(url, options) {
- super(url, options);
- this.CLASS_NAME = "SuperMap.FacilityAnalystSources3DService";
- }
- /**
- * @function FacilityAnalystSources3DService.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function FacilityAnalystSources3DService.prototype.processAsync
- * @description 负责将客户端的查询参数传递到服务端。
- * @param {FacilityAnalystSources3DParameters} params - 最近设施分析参数类(源查找资源)
- */
- processAsync(params) {
- if (!(params instanceof FacilityAnalystSources3DParameters)) {
- return;
- }
- var me = this, jsonObject;
- me.url = Util.urlPathAppend(me.url, 'sources');
- jsonObject = {
- edgeID: params.edgeID,
- nodeID: params.nodeID,
- weightName: params.weightName,
- isUncertainDirectionValid: params.isUncertainDirectionValid
- };
- me.request({
- method: "GET",
- params: jsonObject,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystStreamParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FacilityAnalystStreamParameters
- * @deprecatedclass SuperMap.FacilityAnalystStreamParameters
- * @category iServer NetworkAnalyst UpstreamCirticalFaclilities
- * @classdesc 上游/下游关键设施查找资源参数类。
- * @param {Object} options - 参数。
- * @param {Array.<number>} options.sourceNodeIDs - 指定的设施点 ID 数组。
- * @param {number} options.queryType - 分析类型,只能是 0 (上游关键设施查询) 或者是 1(下游关键设施查询)。
- * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
- * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
- * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。
- * @usage
- */
- class FacilityAnalystStreamParameters {
- constructor(options) {
- /**
- * @member {Array.<number>} [FacilityAnalystStreamParameters.prototype.sourceNodeIDs]
- * @description 指定的设施点 ID 数组。
- */
- this.sourceNodeIDs = null;
- /**
- * @member {number} [FacilityAnalystStreamParameters.prototype.edgeID]
- * @description 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
- */
- this.edgeID = null;
- /**
- * @member {number} [FacilityAnalystStreamParameters.prototype.nodeID]
- * @description 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
- */
- this.nodeID = null;
- /**
- * @member {boolean} [FacilityAnalystStreamParameters.prototype.isUncertainDirectionValid=false]
- * @description 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
- * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
- */
- this.isUncertainDirectionValid = false;
- /**
- * @member {number} FacilityAnalystStreamParameters.prototype.queryType
- * @description 分析类型,只能是 0 (上游关键设施查询) 或者是 1(下游关键设施查询)。
- */
- this.queryType = null;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.FacilityAnalystStreamParameters";
- }
- /**
- * @function FacilityAnalystStreamParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.edgeID = null;
- me.nodeID = null;
- me.weightName = null;
- me.isUncertainDirectionValid = null;
- me.type = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystStreamService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FacilityAnalystStreamService
- * @deprecatedclass SuperMap.FacilityAnalystStreamService
- * @category iServer NetworkAnalyst UpstreamCirticalFaclilities
- * @classdesc 上游/下游 关键设施查找资源服务类;即查找给定弧段或节点的上游/下游中的关键设施结点,返回关键结点 ID 数组及其下游弧段 ID 数组。
- * @extends NetworkAnalystServiceBase
- * @param {string} url - 服务地址。请求网络分析服务,URL应为:
- * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
- * 例如: "http://localhost:8090/iserver/services/test/rest/networkanalyst/WaterNet@FacilityNet";
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 需要被注册的监听器对象。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class FacilityAnalystStreamService extends NetworkAnalystServiceBase {
- constructor(url, options) {
- super(url, options);
- this.CLASS_NAME = "SuperMap.FacilityAnalystStreamService";
- }
- /**
- * @function FacilityAnalystStreamService.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function FacilityAnalystStreamService.prototype.processAsync
- * @description 负责将客户端的查询参数传递到服务端。
- * @param {FacilityAnalystStreamParameters} params - 上游/下游关键设施查找资源参数类。
- */
- processAsync(params) {
- if (!(params instanceof FacilityAnalystStreamParameters)) {
- return;
- }
- var me = this,
- jsonObject;
- //URL 通过参数类型来判断是 上游 还是下游 查询
- if (params.queryType === 0) {
- me.url = Util.urlPathAppend(me.url, 'upstreamcirticalfaclilities');
- } else if (params.queryType === 1) {
- me.url = Util.urlPathAppend(me.url, 'downstreamcirticalfaclilities');
- } else {
- return;
- }
- jsonObject = {
- sourceNodeIDs: params.sourceNodeIDs,
- isUncertainDirectionValid: params.isUncertainDirectionValid
- };
- if (params.edgeID !== null && params.nodeID !== null) {
- return;
- }
- if (params.edgeID === null && params.nodeID === null) {
- return;
- }
- if (params.edgeID !== null) {
- jsonObject.edgeID = params.edgeID;
- } else {
- jsonObject.nodeID = params.nodeID;
- }
- me.request({
- method: "GET",
- params: jsonObject,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystTracedown3DParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FacilityAnalystTracedown3DParameters
- * @deprecatedclass SuperMap.FacilityAnalystTracedown3DParameters
- * @category iServer FacilityAnalyst3D TraceDownResult
- * @classdesc 下游追踪资源参数类。
- * @extends {FacilityAnalyst3DParameters}
- * @param {Object} options - 参数。
- * @param {string} options.weightName - 指定的权值字段信息对象的名称。
- * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
- * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
- * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
- * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
- * @usage
- */
- class FacilityAnalystTracedown3DParameters extends FacilityAnalyst3DParameters {
- constructor(options) {
- super(options);
- this.CLASS_NAME = "SuperMap.FacilityAnalystTracedown3DParameters";
- }
- /**
- * @function FacilityAnalystTracedown3DParameters.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystTracedown3DService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FacilityAnalystTracedown3DService
- * @deprecatedclass SuperMap.FacilityAnalystTracedown3DService
- * @category iServer FacilityAnalyst3D TraceDownResult
- * @classdesc 下游追踪资源服务类
- * @extends {CommonServiceBase}
- * @param {string} url - 服务地址。请求网络分析服务,URL应为:
- * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
- * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 需要被注册的监听器对象。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class FacilityAnalystTracedown3DService extends CommonServiceBase {
- constructor(url, options) {
- super(url, options);
- this.CLASS_NAME = "SuperMap.FacilityAnalystTracedown3DService";
- }
- /**
- * @function FacilityAnalystTracedown3DService.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function FacilityAnalystTracedown3DService.prototype.processAsync
- * @description 负责将客户端的查询参数传递到服务端。
- * @param {FacilityAnalystTracedown3DParameters} params - 下游追踪资源参数类。
- */
- processAsync(params) {
- if (!(params instanceof FacilityAnalystTracedown3DParameters)) {
- return;
- }
- var me = this, jsonObject;
- me.url = Util.urlPathAppend(me.url, 'tracedownresult');
- jsonObject = {
- edgeID: params.edgeID,
- nodeID: params.nodeID,
- weightName: params.weightName,
- isUncertainDirectionValid: params.isUncertainDirectionValid
- };
- me.request({
- method: "GET",
- params: jsonObject,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystTraceup3DParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FacilityAnalystTraceup3DParameters
- * @deprecatedclass SuperMap.FacilityAnalystTraceup3DParameters
- * @category iServer FacilityAnalyst3D TraceUpResult
- * @classdesc 上游追踪资源参数类。
- * @extends {FacilityAnalyst3DParameters}
- * @param {Object} options - 参数。
- * @param {string} options.weightName - 指定的权值字段信息对象的名称。
- * @param {number} [options.edgeID] - 指定的弧段ID,edgeID 与 nodeID 必须指定一个。
- * @param {number} [options.nodeID] - 指定的结点ID,edgeID 与 nodeID 必须指定一个。
- * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
- * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
- * @usage
- */
- class FacilityAnalystTraceup3DParameters extends FacilityAnalyst3DParameters {
- constructor(options) {
- super(options);
- this.CLASS_NAME = "SuperMap.FacilityAnalystTraceup3DParameters";
- }
- /**
- * @function FacilityAnalystTraceup3DParameters.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystTraceup3DService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FacilityAnalystTraceup3DService
- * @deprecatedclass SuperMap.FacilityAnalystTraceup3DService
- * @category iServer FacilityAnalyst3D TraceUpResult
- * @classdesc 上游追踪资源服务类
- * @extends {CommonServiceBase}
- * @param {string} url - 服务地址。请求网络分析服务,URL应为:
- * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
- * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 需要被注册的监听器对象。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class FacilityAnalystTraceup3DService extends CommonServiceBase {
- constructor(url, options) {
- super(url, options);
- this.CLASS_NAME = "SuperMap.FacilityAnalystTraceup3DService";
- }
- /**
- * @function FacilityAnalystTraceup3DService.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function FacilityAnalystTraceup3DService.prototype.processAsync
- * @description 负责将客户端的查询参数传递到服务端。
- * @param {FacilityAnalystTraceup3DParameters} params - 上游追踪资源参数类
- */
- processAsync(params) {
- if (!(params instanceof FacilityAnalystTraceup3DParameters)) {
- return;
- }
- var me = this, jsonObject;
- me.url = Util.urlPathAppend(me.url, 'traceupresult');
- jsonObject = {
- edgeID: params.edgeID,
- nodeID: params.nodeID,
- weightName: params.weightName,
- isUncertainDirectionValid: params.isUncertainDirectionValid
- };
- me.request({
- method: "GET",
- params: jsonObject,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystUpstream3DParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FacilityAnalystUpstream3DParameters
- * @deprecatedclass SuperMap.FacilityAnalystUpstream3DParameters
- * @category iServer FacilityAnalyst3D UpstreamCirticalFaclilities
- * @classdesc 上游关键设施查找资源参数类。
- * @extends {FacilityAnalyst3DParameters}
- * @param {Object} options - 参数。
- * @param {Array.<number>} options.sourceNodeIDs - 指定的设施点 ID 数组。
- * @param {number} [options.edgeID] - 指定的弧段ID。edgeID 与 nodeID 必须指定一个。
- * @param {number} [options.nodeID] - 指定的结点ID。edgeID 与 edgeID 必须指定一个。
- * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
- * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
- * @usage
- */
- class FacilityAnalystUpstream3DParameters extends FacilityAnalyst3DParameters {
- constructor(options) {
- super(options);
- options = options || {};
- this.sourceNodeIDs = null;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.FacilityAnalystUpstream3DParameters";
- }
- /**
- * @function FacilityAnalystUpstream3DParameters.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- this.sourceNodeIDs = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystUpstream3DService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FacilityAnalystUpstream3DService
- * @deprecatedclass SuperMap.FacilityAnalystUpstream3DService
- * @category iServer FacilityAnalyst3D UpstreamCirticalFaclilities
- * @classdesc 上游关键设施查找资源服务类
- * @extends {CommonServiceBase}
- * @param {string} url - 服务地址。请求网络分析服务,URL应为:
- * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
- * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 需要被注册的监听器对象。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class FacilityAnalystUpstream3DService extends CommonServiceBase {
- constructor(url, options) {
- super(url, options);
- this.CLASS_NAME = "SuperMap.FacilityAnalystUpstream3DService";
- }
- /**
- * @function FacilityAnalystUpstream3DService.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function FacilityAnalystUpstream3DService.prototype.processAsync
- * @description 负责将客户端的查询参数传递到服务端。
- * @param {FacilityAnalystUpstream3DParameters} params - 上游关键设施查找资源参数类
- */
- processAsync(params) {
- if (!(params instanceof FacilityAnalystUpstream3DParameters)) {
- return;
- }
- var me = this, jsonObject;
- me.url = Util.urlPathAppend(me.url, 'upstreamcirticalfaclilities');
- jsonObject = {
- sourceNodeIDs: params.sourceNodeIDs,
- edgeID: params.edgeID,
- nodeID: params.nodeID,
- isUncertainDirectionValid: params.isUncertainDirectionValid
- };
- me.request({
- method: "GET",
- params: jsonObject,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/FieldParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FieldParameters
- * @deprecatedclass SuperMap.FieldParameters
- * @category iServer Data Field
- * @classdesc 字段信息查询参数类。
- * @param {Object} options - 参数。
- * @param {string} options.datasource - 数据源名称。
- * @param {string} options.dataset - 数据集名称。
- * @usage
- */
- class FieldParameters {
- constructor(options) {
- /**
- * @member {string} FieldParameters.prototype.datasource
- * @description 要查询的数据集所在的数据源名称。
- */
- this.datasource = null;
- /**
- * @member {string} FieldParameters.prototype.dataset
- * @description 要查询的数据集名称。
- */
- this.dataset = null;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.FieldParameters";
- }
- /**
- * @function FieldParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.datasource = null;
- me.dataset = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/FieldStatisticsParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FieldStatisticsParameters
- * @deprecatedclass SuperMap.FieldStatisticsParameters
- * @category iServer Data Field
- * @classdesc 字段统计信息查询参数类。
- * @param {Object} options - 参数。
- * @param {string} options.datasource - 数据源名称。
- * @param {string} options.dataset - 数据集名称。
- * @param {string} options.fieldName - 字段名。
- * @param {(string.<StatisticMode>|Array.<string.<StatisticMode>>)} statisticMode - 字段统计方法类型。
- * @extends {FieldParameters}
- * @usage
- */
- class FieldStatisticsParameters extends FieldParameters {
- constructor(options) {
- super(options);
- /**
- * @member {string} FieldStatisticsParameters.prototype.fieldName
- * @description 字段名
- */
- this.fieldName = null;
- /**
- * @member {(string.<StatisticMode>|Array.<string.<StatisticMode>>)} FieldStatisticsParameters.prototype.statisticMode
- * @description 字段统计方法类型
- */
- this.statisticMode = null;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.FieldStatisticsParameters";
- }
- /**
- * @function FieldStatisticsParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.fieldName = null;
- me.statisticMode = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/FieldStatisticService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FieldStatisticService
- * @deprecatedclass SuperMap.FieldStatisticService
- * @category iServer Data Field
- * @classdesc 字段查询统计服务类。用来完成对指定数据集指定字段的查询统计分析,即求平均值,最大值等。
- * @extends {CommonServiceBase}
- * @param {string} url - 服务地址。如访问 World Map 服务,只需将 url 设为:http://localhost:8090/iserver/services/data-world/rest/data 即可。
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
- * @param {DataFormat} [options.format] - 查询结果返回格式,目前支持 iServerJSON 和GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
- * @param {string} options.datasource - 数据集所在的数据源名称。
- * @param {string} options.dataset - 数据集名称。
- * @param {string} options.field - 查询统计的目标字段名称。
- * @param {StatisticMode} options.statisticMode - 字段查询统计的方法类型。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @example
- * var myService = new FieldStatisticService(url, {eventListeners: {
- * "processCompleted": fieldStatisticCompleted,
- * "processFailed": fieldStatisticError
- * },
- * datasource: "World",
- * dataset: "Countries",
- * field: "SmID",
- * statisticMode: StatisticMode.AVERAGE
- * };
- * @usage
- */
- class FieldStatisticService extends CommonServiceBase {
- constructor(url, options) {
- super(url, options);
- /**
- * @member {string} FieldStatisticService.prototype.datasource
- * @description 数据集所在的数据源名称。
- */
- this.datasource = null;
- /**
- * @member {string} FieldStatisticService.prototype.dataset
- * @description 数据集名称。
- */
- this.dataset = null;
- /**
- * @member {string} FieldStatisticService.prototype.field
- * @description 查询统计的目标字段名称。
- */
- this.field = null;
- /**
- * @member {StatisticMode} FieldStatisticService.prototype.statisticMode
- * @description 字段查询统计的方法类型。
- */
- this.statisticMode = null;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.FieldStatisticService";
- }
- /**
- * @function FieldStatisticService.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- var me = this;
- me.datasource = null;
- me.dataset = null;
- me.field = null;
- me.statisticMode = null;
- }
- /**
- * @function FieldStatisticService.prototype.processAsync
- * @description 执行服务,进行指定字段的查询统计。
- */
- processAsync() {
- var me = this,
- fieldStatisticURL = "datasources/" + me.datasource + "/datasets/" + me.dataset + "/fields/" + me.field + "/" + me.statisticMode;
- me.url = Util.urlPathAppend(me.url, fieldStatisticURL);
- me.request({
- method: "GET",
- data: null,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/FindClosestFacilitiesParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FindClosestFacilitiesParameters
- * @deprecatedclass SuperMap.FindClosestFacilitiesParameters
- * @category iServer NetworkAnalyst ClosestFacility
- * @classdesc 最近设施分析参数类。
- * @param {Object} options - 参数。
- * @param {GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>} options.event - 事件点,一般为需要获得服务设施服务的事件位置。
- * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} options.facilities - 设施点集合,一般为提供服务的服务设施位置。
- * @param {number} [options.expectFacilityCount=1] - 要查找的设施点数量。
- * @param {boolean} [options.fromEvent=false] - 是否从事件点到设施点进行查找。
- * @param {boolean} [options.isAnalyzeById=false] - 事件点和设施点是否通过节点 ID 号来指定。
- * @param {number} [options.maxWeight=0] - 查找半径。单位与该类中 parameter 字段(交通网络分析通用参数)中设置的耗费字段一致。
- * @param {TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
- * @usage
- */
- class FindClosestFacilitiesParameters {
- constructor(options) {
- /**
- * @member {GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>} FindClosestFacilitiesParameters.prototype.event
- * @description 事件点,一般为需要获得服务设施服务的事件位置。
- * 可以通过两种方式赋予事件点:当该类中字段 isAnalyzeById = true 时,应输入事件点 ID 号;当 isAnalyzeById = false 时,应输入事件点坐标。
- */
- this.event = null;
- /**
- * @member {number} [FindClosestFacilitiesParameters.prototype.expectFacilityCount=1]
- * @description 要查找的设施点数量。
- */
- this.expectFacilityCount = 1;
- /**
- * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} [FindClosestFacilitiesParameters.prototype.facilities=false]
- * @description 设施点集合,一般为提供服务的服务设施位置。
- * 可以通过两种方式赋予设施点:当该类中字段 isAnalyzeById = true 时,应输入设施点 ID 号;当 isAnalyzeById = false 时,应输入设施点坐标。
- */
- this.facilities = null;
- /**
- * @member {boolean} [FindClosestFacilitiesParameters.prototype.fromEvent=false]
- * @description 是否从事件点到设施点进行查找。最近设施分析主要是通过设施点和事件点之间最优的路线来分析在一定范围内哪个或哪些设施与事件点有最优路线的关系。
- * 这个行走线路是通过网络图层进行网络分析算法计算出来的两点间的最优路线。由于存在从 A 点到 B 点与从 B 点到 A 点的耗费不一样的情况,因此起止点
- * 不同可能会得到不同的最优路线。因此在进行最近设施分析之前,需要设置获取的最优路线的方向,即是以事件点作为起点到最近设施点的方向分析,还是以最
- * 近设施点为起点到事件点的方向分析。如果需要以事件点作为起点到设施点方向进行查找,设置该字段值为 true;设置为 false,表示从设施点到事件点进行查找。
- */
- this.fromEvent = false;
- /**
- * @member {boolean} [FindClosestFacilitiesParameters.prototype.isAnalyzeById=false]
- * @description 事件点和设施点是否通过节点 ID 号来指定,设置为 false,表示通过坐标点指定事件点和设施点。
- */
- this.isAnalyzeById = false;
- /**
- * @member {number} [FindClosestFacilitiesParameters.prototype.maxWeight=0]
- * @description 查找半径。单位与该类中 parameter 字段(交通网络分析通用参数)中设置的耗费字段一致。
- * 例如事件发生点是一起交通事故,要求查找在 10 分钟内能到达的最近医院,超过 10 分钟能到达的都不予考虑。
- * 那么需要将网络分析参数中 parameter.weightFieldName 设置为表示时间的字段,然后设置查找范围的半径值为10。
- */
- this.maxWeight = 0;
- /**
- * @member {TransportationAnalystParameter} [FindClosestFacilitiesParameters.prototype.parameter]
- * @description 交通网络分析通用参数。通过本类可以设置障碍边、障碍点、权值字段信息的名称标识、转向权值字段等信息。
- * 它为 TransportationAnalystParameter 类型,虽然为可选参数,但是如果不设置其中的 resultSetting 字段,
- * 则返回结果空间信息等都为空。
- */
- this.parameter = new TransportationAnalystParameter();
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.FindClosestFacilitiesParameters";
- }
- /**
- * @function FindClosestFacilitiesParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.event = null;
- me.expectFacilityCount = null;
- me.facilities = null;
- me.fromEvent = null;
- me.isAnalyzeById = null;
- me.maxWeight = null;
- if (me.parameter) {
- me.parameter.destroy();
- me.parameter = null;
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/FindClosestFacilitiesService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FindClosestFacilitiesService
- * @deprecatedclass SuperMap.FindClosestFacilitiesService
- * @category iServer NetworkAnalyst ClosestFacility
- * @classdesc 最近设施分析服务类。
- * 最近设施分析是指在网络上给定一个事件点和一组设施点,
- * 查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
- * 该类负责将客户端指定的最近设施分析参数传递给服务端,并接收服务端返回的结果数据。
- * 最近设施分析结果通过该类支持的事件的监听函数参数获取
- * @extends {NetworkAnalystServiceBase}
- * @example
- * var myfindClosestFacilitiesService = new FindClosestFacilitiesService(url, {
- * eventListeners: {
- * "processCompleted": findClosestFacilitiesCompleted,
- * "processFailed": findClosestFacilitiesError
- * }
- * });
- * @param {string} url - 服务地址。请求网络分析服务,URL应为:
- * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
- * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 需要被注册的监听器对象。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class FindClosestFacilitiesService extends NetworkAnalystServiceBase {
- constructor(url, options) {
- super(url, options);
- this.CLASS_NAME = "SuperMap.FindClosestFacilitiesService";
- }
- /**
- * @function FindClosestFacilitiesService.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function FindClosestFacilitiesService.prototype.processAsync
- * @description 负责将客户端的查询参数传递到服务端。
- * @param {FindClosestFacilitiesParameters} params - 最近设施分析服务参数类
- */
- processAsync(params) {
- if (!(params instanceof FindClosestFacilitiesParameters)) {
- return;
- }
- var me = this,
- jsonObject;
- me.url = Util.urlPathAppend(me.url, 'closestfacility');
- jsonObject = {
- expectFacilityCount: params.expectFacilityCount,
- fromEvent: params.fromEvent,
- maxWeight: params.maxWeight,
- parameter: Util.toJSON(params.parameter),
- event: Util.toJSON(params.event),
- facilities: me.getJson(params.isAnalyzeById, params.facilities)
- };
- me.request({
- method: "GET",
- params: jsonObject,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- /**
- * @function FindClosestFacilitiesService.prototype.getJson
- * @description 将对象转化为JSON字符串。
- * @param {boolean} isAnalyzeById - 是否通过ID来分析
- * @param {Array.<Object>} params - 分析参数数组
- * @returns {Object} 转化后的JSON字符串。
- */
- getJson(isAnalyzeById, params) {
- var jsonString = "[",
- len = params ? params.length : 0;
- if (isAnalyzeById === false) {
- for (let i = 0; i < len; i++) {
- if (i > 0) {
- jsonString += ",";
- }
- jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
- }
- } else if (isAnalyzeById === true) {
- for (let i = 0; i < len; i++) {
- if (i > 0) {
- jsonString += ",";
- }
- jsonString += params[i];
- }
- }
- jsonString += ']';
- return jsonString;
- }
- /**
- * @function FindClosestFacilitiesService.prototype.toGeoJSONResult
- * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
- * @param {Object} result - 服务器返回的结果对象。
- */
- toGeoJSONResult(result) {
- if (!result || !result.facilityPathList) {
- return result;
- }
- var geoJSONFormat = new GeoJSON();
- result.facilityPathList.map(function (path) {
- if (path.route) {
- path.route = geoJSONFormat.toGeoJSON(path.route);
- }
- if (path.pathGuideItems) {
- path.pathGuideItems = geoJSONFormat.toGeoJSON(path.pathGuideItems);
- }
- if (path.edgeFeatures) {
- path.edgeFeatures = geoJSONFormat.toGeoJSON(path.edgeFeatures);
- }
- if (path.nodeFeatures) {
- path.nodeFeatures = geoJSONFormat.toGeoJSON(path.nodeFeatures);
- }
- return path;
- });
- return result;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/FindLocationParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FindLocationParameters
- * @deprecatedclass SuperMap.FindLocationParameters
- * @category iServer NetworkAnalyst Location
- * @classdesc 选址分区分析参数类。
- * @param {Object} options - 参数。
- * @param {string} options.turnWeightField - 转向权值字段的名称。
- * @param {string} options.weightName - 阻力字段的名称,标识了进行网络分析时所使用的阻力字段。
- * @param {Array.<SupplyCenter>} options.supplyCenters - 资源供给中心集合。
- * @param {number} [options.expectedSupplyCenterCount=1] - 期望用于最终设施选址的资源供给中心数量。
- * @param {boolean} [options.isFromCenter=false] - 是否从中心点开始分配资源。
- * @usage
- */
- class FindLocationParameters {
- constructor(options) {
- /**
- * @member {number} [FindLocationParameters.prototype.expectedSupplyCenterCount=1]
- * @description 期望用于最终设施选址的资源供给中心数量。
- * 当输入值为 0 时,最终设施选址的资源供给中心数量默认为覆盖分析区域内的所需最少的供给中心数。
- */
- this.expectedSupplyCenterCount = null;
- /**
- * @member {boolean} [FindLocationParameters.prototype.isFromCenter=false]
- * @description 是否从中心点开始分配资源。
- * 由于网路数据中的弧段具有正反阻力,即弧段的正向阻力值与其反向阻力值可能不同,
- * 因此,在进行分析时,从资源供给中心开始分配资源到需求点与从需求点向资源供给中心分配这两种分配形式下,所得的分析结果会不同。
- */
- this.isFromCenter = false;
- /**
- * @member {Array.<SupplyCenter>} FindLocationParameters.prototype.supplyCenters
- * @description 资源供给中心集合。
- * 资源供给中心是提供资源和服务的设施,对应于网络结点,
- * 资源供给中心的相关信息包括资源量、最大阻力值、资源供给中心类型,资源供给中心在网络中所处结点的 ID 等,以便在进行选址分区分析时使用。
- */
- this.supplyCenters = null;
- /**
- * @member {string} FindLocationParameters.prototype.turnWeightField
- * @description 转向权值字段的名称。
- */
- this.turnWeightField = null;
- /**
- * @member {string} FindLocationParameters.prototype.weightName
- * @description 阻力字段的名称,标识了进行网络分析时所使用的阻力字段。
- */
- this.weightName = null;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.FindLocationParameters";
- }
- /**
- * @function FindLocationParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.expectedSupplyCenterCount = null;
- me.isFromCenter = null;
- me.turnWeightField = null;
- me.weightName = null;
- if (me.supplyCenters) {
- for (var i = 0, supplyCenters = me.supplyCenters, len = supplyCenters.length; i < len; i++) {
- supplyCenters[i].destroy();
- }
- me.supplyCenters = null;
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/FindLocationService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FindLocationService
- * @deprecatedclass SuperMap.FindLocationService
- * @category iServer NetworkAnalyst Location
- * @classdesc 选址分区分析服务类。
- * 选址分区分析是为了确定一个或多个待建设施的最佳或最优位置,使得设施可以用一种最经济有效的方式为需求方提供服务或者商品。
- * 选址分区不仅仅是一个选址过程,还要将需求点的需求分配到相应的新建设施的服务区中,因此称之为选址与分区。
- * 选址分区分析结果通过该类支持的事件的监听函数参数获取
- * @extends {NetworkAnalystServiceBase}
- * @example
- * (start code)
- * var findLocationService = new FindLocationService(url, {
- * eventListeners: {
- * "processCompleted": findLocationCompleted,
- * "processFailed": findLocationError
- * }
- * });
- * (end)
- * @param {string} url - 服务地址。
- * 如 http://localhost:8090/iserver/services/transportationanalyst-sample/rest/networkanalyst/RoadNet@Changchun 。
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 需要被注册的监听器对象。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class FindLocationService extends NetworkAnalystServiceBase {
- constructor(url, options) {
- super(url, options);
- this.CLASS_NAME = "SuperMap.FindLocationService";
- }
- /**
- * @function FindLocationService.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function FindLocationService.prototype.processAsync
- * @description 负责将客户端的查询参数传递到服务端。
- * @param {FindLocationParameters} params - 选址分区分析服务参数类
- */
- processAsync(params) {
- if (!(params instanceof FindLocationParameters)) {
- return;
- }
- var me = this,
- jsonObject;
- me.url = Util.urlPathAppend(me.url, 'location');
- jsonObject = {
- isFromCenter: params.isFromCenter,
- expectedSupplyCenterCount: params.expectedSupplyCenterCount,
- weightName: params.weightName,
- turnWeightField: params.turnWeightField,
- returnEdgeFeature: true,
- returnEdgeGeometry: true,
- returnNodeFeature: true,
- mapParameter: Util.toJSON(params.mapParameter),
- supplyCenters: me.getCentersJson(params.supplyCenters)
- };
- me.request({
- method: "GET",
- params: jsonObject,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- /**
- * @function FindLocationService.prototype.getCentersJson
- * @description 将数组对象转化为JSON字符串。
- * @param {Array} params - 需要转换的参数
- * @returns {string} 转化后的JSON字符串。
- */
- getCentersJson(params) {
- var json = "[",
- len = params ? params.length : 0;
- for (var i = 0; i < len; i++) {
- if (i > 0) {
- json += ",";
- }
- json += Util.toJSON(params[i]);
- }
- json += "]";
- return json;
- }
- /**
- * @function FindLocationService.prototype.toGeoJSONResult
- * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
- * @param {Object} result - 服务器返回的结果对象。
- */
- toGeoJSONResult(result) {
- if (!result) {
- return null;
- }
- var geoJSONFormat = new GeoJSON();
- if (result.demandResults) {
- result.demandResults = geoJSONFormat.toGeoJSON(result.demandResults);
- }
- if (result.supplyResults) {
- result.supplyResults = geoJSONFormat.toGeoJSON(result.supplyResults);
- }
- return result;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/FindMTSPPathsParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FindMTSPPathsParameters
- * @deprecatedclass SuperMap.FindMTSPPathsParameters
- * @category iServer NetworkAnalyst MTSPPath
- * @classdesc 多旅行商分析参数类
- * @param {Object} options - 参数。
- * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} options.centers - 配送中心集合。
- * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} options.nodes - 配送目标集合。
- * @param {boolean} [options.hasLeastTotalCost=false] - 配送模式是否为总花费最小方案。
- * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 号来指定配送中心点和配送目的点,即通过坐标点指定。
- * @param {TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
- * @usage
- */
- class FindMTSPPathsParameters {
- constructor(options) {
- /**
- * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} FindMTSPPathsParameters.prototype.centers
- * @description 配送中心集合。
- * 当 FindMTSPPathsParameters.isAnalyzeById = false 时,centers 应为点的坐标数组;
- * 当 FindMTSPPathsParameters.isAnalyzeById = true 时,centers 应为点的 ID 数组。
- */
- this.centers = null;
- /**
- * @member {boolean} [FindMTSPPathsParameters.prototype.hasLeastTotalCost=false]
- * @description 配送模式是否为总花费最小方案。
- * 若为 true,则按照总花费最小的模式进行配送,此时可能会出现某几个配送中心点配送的花费较多而其他配送中心点的花费很少的情况。
- * 若为 false,则为局部最优,此方案会控制每个配送中心点的花费,使各个中心点花费相对平均,此时总花费不一定最小。
- */
- this.hasLeastTotalCost = false;
- /**
- * @member {boolean} [FindMTSPPathsParameters.prototype.isAnalyzeById=false]
- * @description 是否通过节点 ID 号来指定配送中心点和配送目的点,即通过坐标点指定。
- */
- this.isAnalyzeById = false;
- /**
- * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} FindMTSPPathsParameters.prototype.nodes
- * @description 配送目标集合。
- * 当 FindMTSPPathsParameters.isAnalyzeById = false 时,nodes 应为点的坐标数组;
- * 当 FindMTSPPathsParameters.isAnalyzeById = true 时,nodes 应为点的 ID 数组。
- */
- this.nodes = null;
- /**
- * @member {TransportationAnalystParameter} [FindMTSPPathsParameters.prototype.parameter]
- * @description 交通网络分析通用参数。
- * 通过本类可以设置障碍边、障碍点、权值字段信息的名称标识、转向权值字段等信息。
- * TransportationAnalystParameter 类型,它虽然为可选参数,但是如果不设置其中的 resultSetting 字段,则返回结果空间信息等都为空。
- */
- this.parameter = new TransportationAnalystParameter();
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.FindMTSPPathsParameters";
- }
- /**
- * @function FindMTSPPathsParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.centers = null;
- me.hasLeastTotalCost = null;
- me.isAnalyzeById = null;
- me.nodes = null;
- me.maxWeight = null;
- if (me.parameter) {
- me.parameter.destroy();
- me.parameter = null;
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/FindMTSPPathsService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FindMTSPPathsService
- * @deprecatedclass SuperMap.FindMTSPPathsService
- * @category iServer NetworkAnalyst MTSPPath
- * @classdesc 多旅行商分析服务类
- * 多旅行商分析也称为物流配送,是指在网络数据集中,给定 M 个配送中心点和 N 个配送目的地(M,N 为大于零的整数)。
- * 查找经济有效的配送路径,并给出相应的行走路线。
- * 物流配送功能就是解决如何合理分配配送次序和送货路线,使配送总花费达到最小或每个配送中心的花费达到最小。
- * 该类负责将客户端指定的多旅行商分析参数传递给服务端,并接收服务端返回的结果数据。
- * 多旅行商分析结果通过该类支持的事件的监听函数参数获取
- * @extends {NetworkAnalystServiceBase}
- * @example
- * var myFindMTSPPathsService = new FindMTSPPathsService(url, {
- * eventListeners: {
- * "processCompleted": findMTSPPathsCompleted,
- * "processFailed": findMTSPPathsError
- * }
- * });
- * @param {string} url - 服务地址。请求网络分析服务,URL应为:
- * http://{服务器地址}:{服务端口号}/iserver/services/网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
- * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
- * @param {Object} options - 互服务时所需可选参数。如:
- * @param {Object} options.eventListeners - 需要被注册的监听器对象。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class FindMTSPPathsService extends NetworkAnalystServiceBase {
- constructor(url, options) {
- super(url, options);
- this.CLASS_NAME = "SuperMap.FindMTSPPathsService";
- }
- /**
- * @function FindMTSPPathsService.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function FindMTSPPathsService..prototype.processAsync
- * @description 负责将客户端的查询参数传递到服务端。
- * @param {FindMTSPPathsParameters} params - 多旅行商分析服务参数类
- */
- processAsync(params) {
- if (!(params instanceof FindMTSPPathsParameters)) {
- return;
- }
- var me = this,
- jsonObject,
- //end = me.url.substr(me.url.length - 1, 1),
- centers = me.getJson(params.isAnalyzeById, params.centers),
- nodes = me.getJson(params.isAnalyzeById, params.nodes);
- me.url = Util.urlPathAppend(me.url, 'mtsppath');
- jsonObject = {
- centers: centers,
- nodes: nodes,
- parameter: Util.toJSON(params.parameter),
- hasLeastTotalCost: params.hasLeastTotalCost
- };
- me.request({
- method: "GET",
- params: jsonObject,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- /**
- * @function FindMTSPPathsService.prototype.getJson
- * @description 将对象转化为JSON字符串。
- * @param {boolean} isAnalyzeById - 是否通过id分析
- * @param {Array} params - 需要转换的数字
- * @returns {Object} 转化后的JSON字符串。
- */
- getJson(isAnalyzeById, params) {
- var jsonString = "[",
- len = params ? params.length : 0;
- if (isAnalyzeById === false) {
- for (let i = 0; i < len; i++) {
- if (i > 0) {
- jsonString += ",";
- }
- jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
- }
- } else if (isAnalyzeById === true) {
- for (let i = 0; i < len; i++) {
- if (i > 0) {
- jsonString += ",";
- }
- jsonString += params[i];
- }
- }
- jsonString += ']';
- return jsonString;
- }
- /**
- * @function FindMTSPPathsService.prototype.toGeoJSONResult
- * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
- * @param {Object} result - 服务器返回的结果对象。
- */
- toGeoJSONResult(result) {
- if (!result || !result.pathList) {
- return null;
- }
- var geoJSONFormat = new GeoJSON();
- result.pathList.map(function (path) {
- if (path.route) {
- path.route = geoJSONFormat.toGeoJSON(path.route);
- }
- if (path.pathGuideItems) {
- path.pathGuideItems = geoJSONFormat.toGeoJSON(path.pathGuideItems);
- }
- if (path.edgeFeatures) {
- path.edgeFeatures = geoJSONFormat.toGeoJSON(path.edgeFeatures);
- }
- if (path.nodeFeatures) {
- path.nodeFeatures = geoJSONFormat.toGeoJSON(path.nodeFeatures);
- }
- return path;
- });
- return result;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/FindPathParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FindPathParameters
- * @deprecatedclass SuperMap.FindPathParameters
- * @category iServer NetworkAnalyst Path
- * @classdesc 最佳路径分析参数类。最佳路径是在网络数据集中指定一些结点,按照顺序访问结点从而求解起止点之间阻抗最小的路径。
- * 例如如果要顺序访问 1、2、3、4 四个结点,则需要分别找到1、2结点间的最佳路径 R1—2,2、3 间的最佳路径 R2—3 和 3、4 结点间的最佳路径 R3—4,
- * 顺序访问 1、2、3、4 四个结点的最佳路径就是 R = R1—2 + R2—3 + R3—4。
- * 阻抗就是指从一点到另一点的耗费,在实际应用中我们可以将距离、时间、花费等作为阻抗条件。
- * 阻抗最小也就可以理解为从一点到另一点距离最短、时间最少、花费最低等。当两点间距离最短时为最短路径,它是最佳路径问题的一个特例。
- * 阻抗值通过 {@link TransportationAnalystParameter#weightFieldName}设置。
- * 计算最佳路径除了受阻抗影响外,还受转向字段的影响。转向值通过 {@link TransportationAnalystParameter#turnWeightField} 设置。
- *
- * @param {Object} options - 参数。
- * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} options.nodes - 最佳路径分析经过的结点或设施点数组。该字段至少包含两个点。
- * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 指定路径分析的结点。
- * @param {boolean} [options.hasLeastEdgeCount=false] - 是否按照弧段数最少的进行最佳路径分析。
- * @param {TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
- * @usage
- */
- class FindPathParameters {
- constructor(options) {
- /**
- * @member {boolean} [FindPathParameters.prototype.isAnalyzeById=false]
- * @description 是否通过节点 ID 指定路径分析的结点。
- * 指定路径分析经过的结点或设施点有两种方式:输入结点 ID 号或直接输入点坐标。
- * 当该字段为 true 时,表示通过结点 ID 指定途经点,即 FindPathParameters.nodes = [ID1,ID2,...];
- * 反之表示通过结点坐标指定途经点,即 FindPathParameters.nodes = [{x1,y1},{x2,y2},...] 。
- */
- this.isAnalyzeById = false;
- /**
- * @member {boolean} [FindPathParameters.prototype.hasLeastEdgeCount=false]
- * @description 是否按照弧段数最少的进行最佳路径分析。
- * true 表示按照弧段数最少进行分析,返回弧段数最少的路径中一个阻抗最小的最佳路径;
- * false 表示直接返回阻抗最小的路径,而不考虑弧段的多少。
- */
- this.hasLeastEdgeCount = null;
- /**
- * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} FindPathParameters.prototype.nodes
- * @description 最佳路径分析经过的结点或设施点数组,必设字段。该字段至少包含两个点。
- * 当 FindPathParameters.isAnalyzeById = false 时,nodes 应为点的坐标数组;
- * 当 FindPathParameters.isAnalyzeById = true 时,nodes 应为点的 ID 数组。
- */
- this.nodes = null;
- /**
- * @member {TransportationAnalystParameter} FindPathParameters.prototype.parameter
- * @description 交通网络分析通用参数。
- */
- this.parameter = new TransportationAnalystParameter();
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.FindPathParameters";
- }
- /**
- * @function FindPathParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.isAnalyzeById = null;
- me.hasLeastEdgeCount = null;
- me.nodes = null;
- if (me.parameter) {
- me.parameter.destroy();
- me.parameter = null;
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/FindPathService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FindPathService
- * @deprecatedclass SuperMap.FindPathService
- * @category iServer NetworkAnalyst Path
- * @classdesc 最佳路径分析服务类。
- * 最佳路径是在网络数据集中指定一些节点,按照节点的选择顺序,
- * 顺序访问这些节点从而求解起止点之间阻抗最小的路经。
- * 该类负责将客户端指定的最佳路径分析参数传递给服务端,并接收服务端返回的结果数据。
- * 最佳路径分析结果通过该类支持的事件的监听函数参数获取
- * @extends {NetworkAnalystServiceBase}
- * @example
- * var myFindPathService = new FindPathService(url, {
- * eventListeners: {
- * "processCompleted": findPathCompleted,
- * "processFailed": findPathError
- * }
- * });
- * @param {string} url - 服务地址。请求网络分析服务,URL应为:
- * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
- * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 需要被注册的监听器对象。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class FindPathService extends NetworkAnalystServiceBase {
- constructor(url, options) {
- super(url, options);
- this.CLASS_NAME = "SuperMap.FindPathService";
- }
- /**
- * @function FindPathService.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function FindPathService.prototype.processAsync
- * @description 负责将客户端的查询参数传递到服务端。
- * @param {FindPathParameters} params - 最佳路径分析服务参数类
- */
- processAsync(params) {
- if (!(params instanceof FindPathParameters)) {
- return;
- }
- var me = this, jsonObject;
- me.url = Util.urlPathAppend(me.url, 'path');
- jsonObject = {
- hasLeastEdgeCount: params.hasLeastEdgeCount,
- parameter: Util.toJSON(params.parameter),
- nodes: me.getJson(params.isAnalyzeById, params.nodes)
- };
- me.request({
- method: "GET",
- params: jsonObject,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- /**
- * @function FindPathService.prototype.getJson
- * @description 将对象转化为JSON字符串。
- * @param {boolean} isAnalyzeById - 是否通过id分析
- * @param {Array} params - 需要转换的数字
- * @returns {Object} 转化后的JSON字符串。
- */
- getJson(isAnalyzeById, params) {
- var jsonString = "[",
- len = params ? params.length : 0;
- if (isAnalyzeById === false) {
- for (let i = 0; i < len; i++) {
- if (i > 0) {
- jsonString += ",";
- }
- jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
- }
- } else if (isAnalyzeById === true) {
- for (let i = 0; i < len; i++) {
- if (i > 0) {
- jsonString += ",";
- }
- jsonString += params[i];
- }
- }
- jsonString += ']';
- return jsonString;
- }
- /**
- * @function FindMTSPPathsService.prototype.toGeoJSONResult
- * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
- * @param {Object} result - 服务器返回的结果对象。
- */
- toGeoJSONResult(result) {
- if (!result || !result.pathList || result.pathList.length < 1) {
- return null;
- }
- var geoJSONFormat = new GeoJSON();
- result.pathList.forEach(function (path) {
- if (path.route) {
- path.route = geoJSONFormat.toGeoJSON(path.route);
- }
- if (path.pathGuideItems) {
- path.pathGuideItems = geoJSONFormat.toGeoJSON(path.pathGuideItems);
- }
- if (path.edgeFeatures) {
- path.edgeFeatures = geoJSONFormat.toGeoJSON(path.edgeFeatures);
- }
- if (path.nodeFeatures) {
- path.nodeFeatures = geoJSONFormat.toGeoJSON(path.nodeFeatures);
- }
- });
- return result;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/FindServiceAreasParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FindServiceAreasParameters
- * @deprecatedclass SuperMap.FindServiceAreasParameters
- * @category iServer NetworkAnalyst ServiceArea
- * @classdesc 服务区分析参数类。
- * 服务区分析是以指定服务站点为中心,在一定服务范围内查找网络上服务站点能够提供服务的区域范围。
- * 例如:计算某快餐店能够在30分钟内送达快餐的区域。
- * @param {Object} options - 参数。
- * @param {Array.<number>} options.weights - 每个服务站点提供服务的阻力半径,超过这个阻力半径的区域不予考虑,其单位与阻力字段一致。
- * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} options.centers - 服务站点数组。
- * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 指定路径分析的结点。
- * @param {boolean} [options.isCenterMutuallyExclusive=false] - 是否中心点互斥。
- * @param {boolean} [options.isFromCenter=false] - 是否从中心点开始分析。
- * @param {TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
- * @usage
- */
- class FindServiceAreasParameters {
- constructor(options) {
- /**
- * @member {boolean} [FindServiceAreasParameters.prototype.isAnalyzeById=false]
- * @description 是否通过节点 ID 指定路径分析的结点。
- * 指定路径分析经过的结点或设施点有两种方式:输入结点 ID 号或直接输入点坐标。
- * 当该字段为 true 时,表示通过结点 ID 指定途经点,即 FindServiceAreasParameters.centers = [ID1,ID2,...];
- * 反之表示通过结点坐标指定途经点,即 FindServiceAreasParameters.centers = [{x1,y1},{x2,y2},...]。
- */
- this.isAnalyzeById = false;
- /**
- * @member {boolean} [FindServiceAreasParameters.prototype.isCenterMutuallyExclusive=false]
- * @description 是否中心点互斥,即按照中心点的距离进行判断是否要进行互斥处理。
- * 若分析出的服务区有重叠的部分,则通过设置该参数进行互斥处理。
- */
- this.isCenterMutuallyExclusive = false;
- /**
- * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} FindServiceAreasParameters.prototype.centers
- * @description 服务站点数组。
- * 当该类的 iSAnalyzeById = true 时,通过结点 ID 号指定服务站点;当 iSAnalyzeById = false 时,通过点坐标指定服务站点。
- */
- this.centers = null;
- /**
- * @member {boolean} [FindServiceAreasParameters.prototype.isFromCenter=false]
- * @description 是否从中心点开始分析。
- * 从中心点开始分析和不从中心点开始分析,体现了服务中心和需要该服务的需求地的关系模式。
- * 从中心点开始分析,是一个服务中心向服务需求地提供服务;
- * 而不从中心点开始分析,是一个服务需求地主动到服务中心获得服务。
- */
- this.isFromCenter = false;
- /**
- * APIProperty: weights
- * @member {Array.<number>} FindServiceAreasParameters.prototype.weights
- * @description 每个服务站点提供服务的阻力半径,即超过这个阻力半径的区域不予考虑,其单位与阻力字段一致。
- * 该字段为一个数组,数组长度跟服务中心个数一致,按照索引顺序与站点一一对应,每个元素表示了在对每个服务中心进行服务区分析时,所用的服务半径。
- */
- this.weights = null;
- /**
- * @member {TransportationAnalystParameter} FindServiceAreasParameters.prototype.parameter
- * @description 交通网络分析通用参数。
- */
- this.parameter = new TransportationAnalystParameter();
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.FindServiceAreasParameters";
- }
- /**
- * @function FindServiceAreasParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.isAnalyzeById = null;
- me.isCenterMutuallyExclusive = null;
- me.centers = null;
- me.isFromCenter = null;
- me.weights = null;
- if (me.parameter) {
- me.parameter.destroy();
- me.parameter = null;
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/FindServiceAreasService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FindServiceAreasService
- * @deprecatedclass SuperMap.FindServiceAreasService
- * @category iServer NetworkAnalyst ServiceArea
- * @classdesc 服务区分析服务类。
- * 服务区分析是以指定服务站点为中心,
- * 在一定服务范围内查找网络上服务站点能够提供服务的区域范围。
- * 该类负责将客户端指定的服务区分析参数传递给服务端,并接收服务端返回的结果数据。
- * 服务区分析结果通过该类支持的事件的监听函数参数获取
- * @extends {NetworkAnalystServiceBase}
- * @example
- * var myFindServiceAreasService = new FindServiceAreasService(url, {
- * eventListeners: {
- * "processCompleted": findServiceAreasCompleted,
- * "processFailed": findServiceAreasError
- * }
- * });
- * @param {string} url - 服务地址。请求网络分析服务,URL应为:
- * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
- * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
- * @param {Object} options - 互服务时所需可选参数。如:
- * @param {Object} options.eventListeners - 需要被注册的监听器对象
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class FindServiceAreasService extends NetworkAnalystServiceBase {
- constructor(url, options) {
- super(url, options);
- this.CLASS_NAME = "SuperMap.FindServiceAreasService";
- }
- /**
- * @function FindServiceAreasService.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function FindServiceAreasService.prototype.processAsync
- * @description 负责将客户端的查询参数传递到服务端。
- * @param {FindServiceAreasParameters} params - 服务区分析服务参数类
- */
- processAsync(params) {
- if (!(params instanceof FindServiceAreasParameters)) {
- return;
- }
- var me = this, jsonObject;
- me.url = Util.urlPathAppend(me.url, 'servicearea');
- jsonObject = {
- isFromCenter: params.isFromCenter,
- isCenterMutuallyExclusive: params.isCenterMutuallyExclusive,
- parameter: Util.toJSON(params.parameter),
- centers: me.getJson(params.isAnalyzeById, params.centers),
- weights: me.getJson(true, params.weights)
- };
- me.request({
- method: "GET",
- params: jsonObject,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- /**
- * @function FindServiceAreasService.prototype.getJson
- * @description 将对象转化为JSON字符串。
- * @param {boolean} isAnalyzeById - 是否通过id分析
- * @param {Array} params - 需要转换的数字
- * @returns {Object} 转化后的JSON字符串。
- */
- getJson(isAnalyzeById, params) {
- var jsonString = "[",
- len = params ? params.length : 0;
- if (isAnalyzeById === false) {
- for (let i = 0; i < len; i++) {
- if (i > 0) {
- jsonString += ",";
- }
- jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
- }
- } else if (isAnalyzeById === true) {
- for (let i = 0; i < len; i++) {
- if (i > 0) {
- jsonString += ",";
- }
- jsonString += params[i];
- }
- }
- jsonString += ']';
- return jsonString;
- }
- /**
- * @function FindServiceAreasService.prototype.toGeoJSONResult
- * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
- * @param {Object} result - 服务器返回的结果对象。。
- */
- toGeoJSONResult(result) {
- if (!result || !result.serviceAreaList) {
- return result;
- }
- var geoJSONFormat = new GeoJSON();
- result.serviceAreaList.map(function (serviceArea) {
- if (serviceArea.serviceRegion) {
- serviceArea.serviceRegion = geoJSONFormat.toGeoJSON(serviceArea.serviceRegion);
- }
- if (serviceArea.edgeFeatures) {
- serviceArea.edgeFeatures = geoJSONFormat.toGeoJSON(serviceArea.edgeFeatures);
- }
- if (serviceArea.nodeFeatures) {
- serviceArea.nodeFeatures = geoJSONFormat.toGeoJSON(serviceArea.nodeFeatures);
- }
- if (serviceArea.routes) {
- serviceArea.routes = geoJSONFormat.toGeoJSON(serviceArea.routes);
- }
- return serviceArea;
- });
- return result;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/FindTSPPathsParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FindTSPPathsParameters
- * @deprecatedclass SuperMap.FindTSPPathsParameters
- * @category iServer NetworkAnalyst TSPPath
- * @classdesc 旅行商分析参数类。
- * 旅行商分析是路径分析的一种,它从起点开始(默认为用户指定的第一点)查找能够遍历所有途经点且花费最小的路径。
- * 旅行商分析也可以指定到达的终点,这时查找从起点能够遍历所有途经点最后到达终点,且花费最小的路径。
- * 旅行商分析和最佳路径分析都是在网络中寻找遍历所有站点的最经济的路径,区别是在遍历网络所有站点的过程中对结点访问顺序不同
- * 最佳路径分析必须按照指定顺序对站点进行访问,而旅行商分析是无序的路径分析。
- * @param {Object} options - 参数。
- * @param {boolean} [options.endNodeAssigned=false] - 是否指定终止点,将指定的途经点的最后一个点作为终止点。true 表示指定终止点,则旅行商必须最后一个访问终止点。
- * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 号来指定配送中心点和配送目的点。
- * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} options.nodes - 配送目标集合。
- * @param {TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
- * @usage
- */
- class FindTSPPathsParameters {
- constructor(options) {
- /**
- * @member {boolean} [FindTSPPathsParameters.prototype.endNodeAssigned=false]
- * @description 是否指定终止点,将指定的途经点的最后一个点作为终止点。
- * true 表示指定终止点,则旅行商必须最后一个访问终止点。
- */
- this.endNodeAssigned = false;
- /**
- * @member {boolean} [FindTSPPathsParameters.prototype.isAnalyzeById=false]
- * @description 是否通过节点 ID 号来指定途经点。
- */
- this.isAnalyzeById = false;
- /**
- * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} FindTSPPathsParameters.prototype.nodes
- * @description 旅行商分析途经点数组。
- * 当 FindTSPPathsParameters.isAnalyzeById = false 时,nodes 应为点的坐标数组;
- * 当 FindTSPPathsParameters.isAnalyzeById = true 时,nodes 应为点的 ID 数组。
- */
- this.nodes = null;
- /**
- * @member {TransportationAnalystParameter} [FindTSPPathsParameters.prototype.parameter]
- * @description 交通网络分析通用参数。通过本类可以设置障碍边、障碍点、权值字段信息的名称标识、转向权值字段等信息。
- * TransportationAnalystParameter 类型,它虽然为可选参数,但是如果不设置其中的 resultSetting
- * 字段,则返回结果空间信息等都为空。
- */
- this.parameter = new TransportationAnalystParameter();
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.FindTSPPathsParameters";
- }
- /**
- * @function FindTSPPathsParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.endNodeAssigned = null;
- me.isAnalyzeById = null;
- me.nodes = null;
- if (me.parameter) {
- me.parameter.destroy();
- me.parameter = null;
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/FindTSPPathsService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FindTSPPathsService
- * @deprecatedclass SuperMap.FindTSPPathsService
- * @category iServer NetworkAnalyst TSPPath
- * @classdesc 旅行商分析服务类
- * 旅行商分析是路径分析的一种,它从起点开始(默认为用户指定的第一点)查找能够遍历所有途经点且花费最小的路径。
- * 旅行商分析也可以指定到达的终点,这时查找从起点能够遍历所有途经点最后到达终点,且花费最小的路径。
- * 该类负责将客户端指定的旅行商分析参数传递给服务端,并接收服务端返回的结果数据。
- * 旅行商分析结果通过该类支持的事件的监听函数参数获取
- * @extends {NetworkAnalystServiceBase}
- * @example
- * (start code)
- * var myFindTSPPathsService = new FindTSPPathsService(url, {
- * eventListeners: {
- * "processCompleted": findTSPPathsCompleted,
- * "processFailed": findTSPPathsError
- * }
- * });
- * (end)
- * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
- * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
- * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 需要被注册的监听器对象。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class FindTSPPathsService extends NetworkAnalystServiceBase {
- constructor(url, options) {
- super(url, options);
- this.CLASS_NAME = "SuperMap.FindTSPPathsService";
- }
- /**
- * @function FindTSPPathsService.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function FindTSPPathsService.prototype.processAsync
- * @description 负责将客户端的查询参数传递到服务端。
- * @param {FindTSPPathsParameters} params - 旅行商分析服务参数类。
- */
- processAsync(params) {
- if (!(params instanceof FindTSPPathsParameters)) {
- return;
- }
- var me = this, jsonObject;
- me.url = Util.urlPathAppend(me.url, 'tsppath');
- jsonObject = {
- parameter: Util.toJSON(params.parameter),
- endNodeAssigned: params.endNodeAssigned,
- nodes: me.getNodesJson(params)
- };
- me.request({
- method: "GET",
- params: jsonObject,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- /**
- * @function FindTSPPathsService.prototype.getNodesJson
- * @description 将节点对象转化为JSON字符串。
- * @param {FindTSPPathsParameters} params - 旅行商分析服务参数类。
- * @returns {string} 转化后的JSON字符串。
- */
- getNodesJson(params) {
- var jsonParameters = "", nodesString, i, len, nodes;
- if (params.isAnalyzeById === false) {
- for (nodesString = "[", i = 0, nodes = params.nodes, len = nodes.length; i < len; i++) {
- if (i > 0) {
- nodesString += ",";
- }
- nodesString += '{"x":' + nodes[i].x + ',"y":' + nodes[i].y + '}';
- }
- nodesString += ']';
- jsonParameters += nodesString;
- } else if (params.isAnalyzeById === true) {
- let nodeIDsString = "[", nodes = params.nodes, len = nodes.length;
- for (let i = 0; i < len; i++) {
- if (i > 0) {
- nodeIDsString += ",";
- }
- nodeIDsString += nodes[i];
- }
- nodeIDsString += ']';
- jsonParameters += nodeIDsString;
- }
- return jsonParameters;
- }
- /**
- * @function FindTSPPathsService.prototype.toGeoJSONResult
- * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
- * @param {Object} result - 服务器返回的结果对象。
- */
- toGeoJSONResult(result) {
- if (!result || !result.tspPathList) {
- return null;
- }
- var geoJSONFormat = new GeoJSON();
- result.tspPathList.forEach(function (path) {
- if (path.route) {
- path.route = geoJSONFormat.toGeoJSON(path.route);
- }
- if (path.pathGuideItems) {
- path.pathGuideItems = geoJSONFormat.toGeoJSON(path.pathGuideItems);
- }
- if (path.edgeFeatures) {
- path.edgeFeatures = geoJSONFormat.toGeoJSON(path.edgeFeatures);
- }
- if (path.nodeFeatures) {
- path.nodeFeatures = geoJSONFormat.toGeoJSON(path.nodeFeatures);
- }
- });
- return result;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/GenerateSpatialDataParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GenerateSpatialDataParameters
- * @deprecatedclass SuperMap.GenerateSpatialDataParameters
- * @category iServer SpatialAnalyst GenerateSpatialData
- * @classdesc 动态分段操作参数类。通过该类可以为动态分段提供参数信息。
- * @param {Object} options - 参数。
- * @param {string} options.routeTable - 路由数据集。
- * @param {string} options.routeIDField - 路由数据集的标识字段。
- * @param {string} options.eventTable - 用于生成空间数据的事件表名。
- * @param {DataReturnOption} options.dataReturnOption - 设置数据返回选项。
- * @param {string} [options.attributeFilter] - 属性过滤条件。
- * @param {string} options.eventRouteIDField - 用于生成空间数据的事件表的路由标识字段。
- * @param {string} [options.measureField] - 用于生成空间数据的事件表的刻度字段,只有当事件为点事件的时候该属性才有意义。
- * @param {string} [options.measureStartField] - 用于生成空间数据的事件表的起始刻度字段,只有当事件为线事件的时候该属性才有意义。
- * @param {string} [options.measureEndField] - 用于生成空间数据的事件表的终止刻度字段,只有当事件为线事件的时候该属性才有意义。
- * @param {string} [options.measureOffsetField] - 刻度偏移量字段。
- * @param {string} [options.errorInfoField] - 错误信息字段,直接写入原事件表,用于描述事件未能生成对应的点或线时的错误信息。
- * @param {Array.<string>} [options.retainedFields] - 欲保留到结果空间数据中的字段集合(系统字段除外)。
- * @usage
- */
- class GenerateSpatialDataParameters {
- constructor(options) {
- /**
- * @member {string} GenerateSpatialDataParameters.prototype.routeTable
- * @description 路由数据集。
- */
- this.routeTable = null;
- /**
- * @member {string} GenerateSpatialDataParameters.prototype.routeIDField
- * @description 路由数据集的标识字段。
- */
- this.routeIDField = null;
- /**
- * @member {string} [GenerateSpatialDataParameters.prototype.attributeFilter]
- * @description 属性过滤条件。
- * 当 {@link GenerateSpatialDataParameters.prototype.dataReturnOption.dataReturnMode} 为 {@link DataReturnMode.DATASET_AND_RECORDSET} 或 {@link DataReturnMode.RECORDSET_ONLY} 时有效。
- */
- this.attributeFilter = null;
- /**
- * @member {string} GenerateSpatialDataParameters.prototype.eventTable
- * @description 用于生成空间数据的事件表名。
- */
- this.eventTable = null;
- /**
- * @member {string} GenerateSpatialDataParameters.prototype.eventRouteIDField
- * @description 用于生成空间数据的事件表的路由标识字段。
- */
- this.eventRouteIDField = null;
- /**
- * @member {string} [GenerateSpatialDataParameters.prototype.measureField]
- * @description 用于生成空间数据的事件表的刻度字段,只有当事件为点事件的时候该属性才有意义
- */
- this.measureField = null;
- /**
- * @member {string} [GenerateSpatialDataParameters.prototype.measureStartField]
- * @description 用于生成空间数据的事件表的起始刻度字段,只有当事件为线事件的时候该属性才有意义。
- */
- this.measureStartField = null;
- /**
- * @member {string} [GenerateSpatialDataParameters.prototype.measureEndField]
- * @description 用于生成空间数据的事件表的终止刻度字段,只有当事件为线事件的时候该属性才有意义。
- */
- this.measureEndField = null;
- /**
- * @member {string} [GenerateSpatialDataParameters.prototype.measureOffsetField]
- * @description 刻度偏移量字段。
- */
- this.measureOffsetField = null;
- /**
- * @member {string} [GenerateSpatialDataParameters.prototype.errorInfoField]
- * @description 错误信息字段,直接写入原事件表,用于描述事件未能生成对应的点或线时的错误信息。
- */
- this.errorInfoField = null;
- /**
- * @member {Array.<string>} [GenerateSpatialDataParameters.prototype.retainedFields]
- * @description 欲保留到结果空间数据中的字段集合(系统字段除外)。
- * 生成空间数据时,无论是否指定保留字段,路由 ID 字段、刻度偏移量字段、刻度值字段(点事件为刻度字段,线事件是起始和终止刻度字段)都会保留到结果空间数据中;
- * 如果没有指定 retainedFields 参数或者 retainedFields 参数数组长度为 0,则返回所有用户字段。
- */
- this.retainedFields = null;
- /**
- * @member {DataReturnOption} GenerateSpatialDataParameters.prototype.dataReturnOption
- * @description 设置数据返回的选项。
- */
- this.dataReturnOption = null;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.GenerateSpatialDataParameters";
- }
- /**
- * @function GenerateSpatialDataParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- if (me.routeTable) {
- me.routeTable = null;
- }
- me.routeIDField = null;
- me.attributeFilter = null;
- me.eventTable = null;
- me.eventRouteIDField = null;
- me.measureField = null;
- me.measureStartField = null;
- me.measureEndField = null;
- me.measureOffsetField = null;
- me.errorInfoField = null;
- if (me.dataReturnOption) {
- me.dataReturnOption.destroy();
- me.dataReturnOption = null;
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/GenerateSpatialDataService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GenerateSpatialDataService
- * @deprecatedclass SuperMap.GenerateSpatialDataService
- * @category iServer SpatialAnalyst GenerateSpatialData
- * @classdesc 动态分段分析服务类。该类负责将客户设置的动态分段分析服务参数传递给服务端,并接收服务端返回的动态分段分析结果数据。
- * 获取的结果数据包括 originResult 、result 两种,其中,originResult 为服务端返回的用 JSON 对象表示的动态分段分析结果数据,result 为服务端返回的动态分段分析结果数据。
- * @param {string} url - 服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
- * @param {Object} options - 参数。</br>
- * @param {Object} options.eventListeners - 需要被注册的监听器对象。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @extends {SpatialAnalystBase}
- * @example 实例化该类如下例所示:
- * (start code)
- * function GenerateSpatialData(){
- *
- * //配置数据返回选项(option)
- * var option = new DataReturnOption({
- * expectCount: 1000,
- * dataset: "generateSpatialData",
- * deleteExistResultDataset: true,
- * dataReturnMode: DataReturnMode.DATASET_ONLY
- * }),
- * //配置动态分段参数(Parameters)
- * parameters = new GenerateSpatialDataParameters({
- * routeTable: "RouteDT_road@Changchun",
- * routeIDField: "RouteID",
- * eventTable: "LinearEventTabDT@Changchun",
- * eventRouteIDField: "RouteID",
- * measureField: "",
- * measureStartField: "LineMeasureFrom",
- * measureEndField: "LineMeasureTo",
- * measureOffsetField: "",
- * errorInfoField: "",
- * retainedFields:[],
- * dataReturnOption: option
- * }),
- * //配置动态分段iService
- * iService = new GenerateSpatialDataService(Changchun_spatialanalyst, {
- * eventListeners: {
- * processCompleted: generateCompleted,
- * processFailed: generateFailded
- * }
- * });
- * //执行
- * iService.processAsync(parameters);
- * function Completed(generateSpatialDataEventArgs){//todo};
- * function Error(generateSpatialDataEventArgs){//todo};
- * (end)
- * @usage
- */
- class GenerateSpatialDataService extends SpatialAnalystBase {
- constructor(url, options) {
- super(url, options);
- this.CLASS_NAME = "SuperMap.GenerateSpatialDataService";
- }
- /**
- * @function GenerateSpatialDataService.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function GenerateSpatialDataService.prototype.processAsync
- * @description 负责将客户端的动态分段服务参数传递到服务端。
- * @param {GenerateSpatialDataParameters} params - 动态分段操作参数类。
- */
- processAsync(params) {
- if (!(params instanceof GenerateSpatialDataParameters)) {
- return;
- }
- var me = this,
- jsonParameters;
- jsonParameters = me.getJsonParameters(params);
- me.request({
- method: "POST",
- data: jsonParameters,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- /**
- * @function GenerateSpatialDataService.prototype.getJsonParameters
- * @description 将参数转化为 JSON 字符串。
- * @param {GenerateSpatialDataParameters} params - 动态分段操作参数类。
- * @returns {string}转化后的JSON字符串。
- */
- getJsonParameters(params) {
- var jsonParameters = "",
- jsonStr = "datasets/" + params.routeTable + "/linearreferencing/generatespatialdata",
- me = this;
- me.url = Util.urlPathAppend(me.url, jsonStr);
- me.url = Util.urlAppend(me.url, 'returnContent=true');
- jsonParameters = Util.toJSON(params);
- return jsonParameters;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/GeoHashGridAggParameter.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GeoHashGridAggParameter
- * @deprecatedclass SuperMap.GeoHashGridAggParameter
- * @classdesc 格网聚合查询参数类,该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
- * @category iServer Data FeatureResults
- * @param {Object} options - 可选参数。
- * @param {number} [options.precision=5] - 精度。
- * @extends {BucketAggParameter}
- * @usage
- */
- class GeoHashGridAggParameter extends BucketAggParameter {
- constructor(options) {
- super();
- /**
- * @member {number} [GeoHashGridAggParameter.prototype.precision=5]
- * @description 网格中数字的精度。
- */
- this.precision = 5;
- Util.extend(this, options);
- /**
- * @member {BucketAggType} [GeoHashGridAggParameter.prototype.aggType=BucketAggType.GEOHASH_GRID]
- * @description 格网聚合类型。
- */
- this.aggType = BucketAggType.GEOHASH_GRID;
- this.CLASS_NAME = 'SuperMap.GeoHashGridAggParameter';
- }
- destroy() {
- super.destroy();
- this.aggType = null;
- this.precision = null;
- }
- /**
- * @function GeoHashGridAggParameter.toJsonParameters
- * @description 将对象转为 JSON 格式。
- * @param param 转换对象。
- * @returns {Object}
- */
- static toJsonParameters(param) {
- var parameters = {
- aggName: param.aggName,
- aggFieldName: param.aggFieldName,
- aggType: param.aggType,
- precision: param.precision
- };
- return Util.toJson(parameters);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/GeometryOverlayAnalystParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GeometryOverlayAnalystParameters
- * @deprecatedclass SuperMap.GeometryOverlayAnalystParameters
- * @category iServer SpatialAnalyst OverlayAnalyst
- * @classdesc
- * 几何对象叠加分析参数类。对指定的某两个几何对象做叠加分析。通过该类可以指定要做叠加分析的几何对象、叠加操作类型。
- * @param {Object} options - 参数。
- * @param {GeoJSONObject} options.operateGeometry - 叠加分析的操作几何对象。<br>
- * 点类型可以是:{@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>
- * 线类型可以是:{@link GeometryLineString}|{@link GeometryLinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link GeoJSONObject}。<br>
- * 面类型可以是:{@link GeometryPolygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link GeoJSONObject}。<br>
- * @param {GeoJSONObject} options.sourceGeometry - 叠加分析的源几何对象。
- * @param {Array.<GeoJSONFeature>} [options.operateGeometries] - 批量叠加分析的操作几何对象数组。
- * @param {Array.<GeoJSONFeature>} [options.sourceGeometries] -批量叠加分析的源几何对象数组。
- * @param {OverlayOperationType} [options.operation] - 叠加操作枚举值。
- * @extends {OverlayAnalystParameters}
- * @usage
- */
- class GeometryOverlayAnalystParameters extends OverlayAnalystParameters {
- constructor(options) {
- super(options);
- if (options && options.operateGeometry) {
- this.operateGeometry = options.operateGeometry;
- }
- if (options && options.sourceGeometry) {
- this.sourceGeometry = options.sourceGeometry;
- }
- if (options && options.operateGeometries) {
- this.operateGeometries = options.operateGeometries;
- }
- if (options && options.sourceGeometries) {
- this.sourceGeometries = options.sourceGeometries;
- }
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.GeometryOverlayAnalystParameters";
- }
- /**
- * @function GeometryOverlayAnalystParameters.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- var me = this;
- if (me.sourceGeometry) {
- me.sourceGeometry.destroy();
- me.sourceGeometry = null;
- }
- if (me.sourceGeometries) {
- me.sourceGeometries.destroy();
- me.sourceGeometries = null;
- }
- if (me.sourceGeometry) {
- me.sourceGeometry.destroy();
- me.sourceGeometry = null;
- }
- if (me.operateGeometries) {
- me.operateGeometries.destroy();
- me.operateGeometries = null;
- }
- }
- /**
- * @function GeometryOverlayAnalystParameters.toObject
- * @param {GeometryOverlayAnalystParameters} geometryOverlayAnalystParameters - 几何对象叠加分析参数类。
- * @param {GeometryOverlayAnalystParameters} tempObj - 几何对象叠加分析参数对象。
- * @description 将几何对象叠加分析参数对象转换为 JSON 对象。
- * @returns {Object} JSON 对象。
- */
- static toObject(geometryOverlayAnalystParameters, tempObj) {
- for (var name in geometryOverlayAnalystParameters) {
- if (name === "sourceGeometry") {
- tempObj.sourceGeometry = ServerGeometry.fromGeometry(geometryOverlayAnalystParameters.sourceGeometry);
- } else if (name === "sourceGeometries") {
- var sourceGeometries = [];
- for (var i = 0; i < geometryOverlayAnalystParameters.sourceGeometries.length; i++) {
- sourceGeometries.push(ServerGeometry.fromGeometry(geometryOverlayAnalystParameters.sourceGeometries[i]));
- }
- tempObj.sourceGeometries = sourceGeometries;
- } else if (name === "operateGeometry") {
- tempObj.operateGeometry = ServerGeometry.fromGeometry(geometryOverlayAnalystParameters.operateGeometry);
- } else if (name === "operateGeometries") {
- var operateGeometries = [];
- for (var j = 0; j < geometryOverlayAnalystParameters.operateGeometries.length; j++) {
- operateGeometries.push(ServerGeometry.fromGeometry(geometryOverlayAnalystParameters.operateGeometries[j]));
- }
- tempObj.operateGeometries = operateGeometries;
- } else {
- tempObj[name] = geometryOverlayAnalystParameters[name];
- }
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/GeometrySurfaceAnalystParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GeometrySurfaceAnalystParameters
- * @deprecatedclass SuperMap.GeometrySurfaceAnalystParameters
- * @category iServer SpatialAnalyst SurfaceAnalyst
- * @classdesc 几何对象表面分析参数类。该类对几何对象表面分析所用到的参数进行设置。
- * @param {Object} options - 参数。
- * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} options.points - 表面分析的坐标点数组。
- * @param {Array.<number>} options.zValues - 表面分析的坐标点的 Z 值数组。
- * @param {number} [options.resolution] - 获取或设置指定中间结果(栅格数据集)的分辨率。
- * @param {DataReturnOption} [options.resultSetting] - 结果返回设置类。
- * @param {SurfaceAnalystParametersSetting} options.extractParameter - 获取或设置表面分析参数。
- * @param {SurfaceAnalystMethod} [options.surfaceAnalystMethod = SurfaceAnalystMethod.ISOLINE] - 获取或设置表面分析的提取方法,提取等值线和提取等值面。
- * @extends {SurfaceAnalystParameters}
- * @usage
- */
- class GeometrySurfaceAnalystParameters extends SurfaceAnalystParameters {
- constructor(options) {
- super(options);
- /**
- * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} GeometrySurfaceAnalystParameters.prototype.points
- * @description 获取或设置用于表面分析的坐标点数组。
- */
- this.points = null;
- /**
- * @member {Array.<number>} GeometrySurfaceAnalystParameters.prototype.zValues
- * @description 获取或设置用于提取操作的值。提取等值线时,将使用该数组中的值,
- * 对几何对象中的坐标点数组进行插值分析,得到栅格数据集(中间结果),接着从栅格数据集提取等值线。
- */
- this.zValues = null;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.GeometrySurfaceAnalystParameters";
- }
- /**
- * @function GeometrySurfaceAnalystParameters.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- var me = this;
- if (me.points) {
- for (var i = 0, points = me.points, len = points.length; i < len; i++) {
- points[i].destroy();
- }
- me.points = null;
- }
- me.zValues = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/GeometryThiessenAnalystParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GeometryThiessenAnalystParameters
- * @deprecatedclass SuperMap.GeometryThiessenAnalystParameters
- * @constructs GeometryThiessenAnalystParameters
- * @category iServer SpatialAnalyst ThiessenPolygonAnalyst
- * @classdesc 几何对象泰森多边形分析参数类。对指定的某个几何对象做泰森多边形分析。通过该类可以指定要做泰森多边形分析的几何对象、返回数据集名称等。
- * @param {Object} options - 参数。
- * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} options.points - 使用点数组进行分析时使用的几何对象。
- * @extends {ThiessenAnalystParameters}
- * @usage
- */
- class GeometryThiessenAnalystParameters extends ThiessenAnalystParameters {
- constructor(options) {
- super(options);
- /**
- * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} GeometryThiessenAnalystParameters.prototype.points
- * @description 使用点数组进行分析时使用的几何对象。
- */
- this.points = null;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.GeometryThiessenAnalystParameters";
- }
- /**
- * @function GeometryThiessenAnalystParameters.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- var me = this;
- if (me.points) {
- for (var i = me.points.length - 1; i >= 0; i--) {
- me.points[i].destroy();
- }
- me.points = null;
- }
- }
- /**
- * @function GeometryThiessenAnalystParameters.toObject
- * @param {GeometryThiessenAnalystParameters} geometryThiessenAnalystParameters - 几何对象泰森多边形分析参数类。
- * @param {GeometryThiessenAnalystParameters} tempObj - 几何对象泰森多边形分析参数对象。
- * @description 将几何对象泰森多边形分析参数对象转换为 JSON 对象。
- * @returns {Object} JSON 对象。
- */
- static toObject(geometryThiessenAnalystParameters, tempObj) {
- for (var name in geometryThiessenAnalystParameters) {
- if (name === "clipRegion") {
- tempObj.clipRegion = ServerGeometry.fromGeometry(geometryThiessenAnalystParameters.clipRegion);
- } else {
- tempObj[name] = geometryThiessenAnalystParameters[name];
- }
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/GeoprocessingService.js
- /**
- * @class GeoprocessingService
- * @deprecatedclass SuperMap.GeoprocessingService
- * @category iServer ProcessingAutomationService
- * @classdesc 处理自动化服务接口的基类。
- * @version 10.1.0
- * @extends {CommonServiceBase}
- * @param {string} url - 服务地址。
- * @param {Object} options - 参数。
- * @param {Events} options.events - 处理所有事件的对象。
- * @param {Object} [options.eventListeners] - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
- * @usage
- */
- class GeoprocessingService extends CommonServiceBase {
- constructor(url, options) {
- options = options || {};
- options.EVENT_TYPES = ['processCompleted', 'processFailed', 'processRunning'];
- super(url, options);
- this.CLASS_NAME = 'SuperMap.GeoprocessingService';
- this.headers = {};
- this.crossOrigin = true;
- }
- /**
- * @function GeoprocessingService.prototype.getTools
- * @description 获取处理自动化工具列表。
- */
- getTools() {
- this._get(`${this.url}/list`);
- }
- /**
- * @function GeoprocessingService.prototype.getTool
- * @description 获取处理自动化工具的ID、名称、描述、输入参数、环境参数和输出结果等相关参数。
- * @param {string} identifier - 处理自动化工具ID。
- */
- getTool(identifier) {
- this._get(`${this.url}/${identifier}`);
- }
- /**
- * @function GeoprocessingService.prototype.execute
- * @description 同步执行处理自动化工具。
- * @param {string} identifier - 处理自动化工具ID。
- * @param {Object} parameter - 处理自动化工具的输入参数。
- * @param {Object} environment - 处理自动化工具的环境参数。
- */
- execute(identifier, parameter, environment) {
- parameter = parameter ? parameter : null;
- environment = environment ? environment : null;
- const executeParamter = { parameter, environment };
- this._get(`${this.url}/${identifier}/execute`, executeParamter);
- }
- /**
- * @function GeoprocessingService.prototype.submitJob
- * @description 异步执行处理自动化工具。
- * @param {string} identifier - 处理自动化工具ID。
- * @param {Object} parameter - 处理自动化工具的输入参数。
- * @param {Object} environments - 处理自动化工具的环境参数。
- */
- submitJob(identifier, parameter, environments) {
- parameter = parameter ? parameter : null;
- environments = environments ? environments : null;
- const asyncParamter = { parameter: parameter, environments: environments };
- this.request({
- url: `${this.url}/${identifier}/jobs`,
- headers: { 'Content-type': 'application/json' },
- method: 'POST',
- data: JSON.stringify(asyncParamter),
- scope: this,
- success: this.serviceProcessCompleted,
- failure: this.serviceProcessFailed
- });
- }
- /**
- * @function GeoprocessingService.prototype.waitForJobCompletion
- * @description 获取处理自动化异步执行状态信息。
- * @param {string} jobId - 处理自动化任务ID。
- * @param {string} identifier - 处理自动化工具ID。
- * @param {Object} options - 状态信息参数。
- * @param {number} options.interval - 定时器时间间隔。
- * @param {function} options.statusCallback - 任务状态的回调函数。
- */
- waitForJobCompletion(jobId, identifier, options) {
- const me = this;
- const timer = setInterval(function () {
- const serviceProcessCompleted = function (serverResult) {
- const state = serverResult.state.runState;
- if (options.statusCallback) {
- options.statusCallback(state);
- }
- switch (state) {
- case 'FINISHED':
- clearInterval(timer);
- me.events.triggerEvent('processCompleted', {
- result: serverResult
- });
- break;
- case 'FAILED':
- clearInterval(timer);
- me.events.triggerEvent('processFailed', {
- result: serverResult
- });
- break;
- case 'CANCELED':
- clearInterval(timer);
- me.events.triggerEvent('processFailed', {
- result: serverResult
- });
- break;
- }
- };
- me._get(`${me.url}/${identifier}/jobs/${jobId}`, null, serviceProcessCompleted);
- }, options.interval);
- }
- /**
- * @function GeoprocessingService.prototype.getJobInfo
- * @description 获取处理自动化任务的执行信息。
- * @param {string} identifier - 处理自动化工具ID。
- * @param {string} jobId - 处理自动化任务ID。
- */
- getJobInfo(identifier, jobId) {
- this._get(`${this.url}/${identifier}/jobs/${jobId}`);
- }
- /**
- * @function GeoprocessingService.prototype.cancelJob
- * @description 取消处理自动化任务的异步执行。
- * @param {string} identifier - 处理自动化工具ID。
- * @param {string} jobId - 处理自动化任务ID。
- */
- cancelJob(identifier, jobId) {
- this._get(`${this.url}/${identifier}/jobs/${jobId}/cancel`);
- }
- /**
- * @function GeoprocessingService.prototype.getJobs
- * @description 获取处理自动化服务任务列表。
- * @param {string} identifier - 处理自动化工具ID。(传参代表identifier算子的任务列表,不传参代表所有任务的列表)
- */
- getJobs(identifier) {
- let url = `${this.url}/jobs`;
- if (identifier) {
- url = `${this.url}/${identifier}/jobs`;
- }
- this._get(url);
- }
- /**
- * @function GeoprocessingService.prototype.getResults
- * @description 处理自动化工具执行的结果等,支持结果过滤。
- * @param {string} identifier - 处理自动化工具ID。
- * @param {string} jobId - 处理自动化任务ID。
- * @param {string} filter - 输出异步结果的id。(可选,传入filter参数时对该处理自动化工具执行的结果进行过滤获取,不填参时显示所有的执行结果)
- */
- getResults(identifier, jobId, filter) {
- let url = `${this.url}/${identifier}/jobs/${jobId}/results`;
- if (filter) {
- url = `${url}/${filter}`;
- }
- this._get(url);
- }
- _get(url, paramter, serviceProcessCompleted, serviceProcessFailed) {
- this.request({
- url: url,
- method: 'GET',
- params: paramter,
- headers: { 'Content-type': 'application/json' },
- scope: this,
- success: serviceProcessCompleted ? serviceProcessCompleted : this.serviceProcessCompleted,
- failure: serviceProcessFailed ? serviceProcessFailed : this.serviceProcessFailed
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/GeoRelationAnalystParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GeoRelationAnalystParameters
- * @deprecatedclass SuperMap.GeoRelationAnalystParameters
- * @category iServer SpatialAnalyst GeoRelationAnalyst
- * @classdesc 空间关系分析服务参数类。使用该类可以为空间关系分析服务提供所需的参数信息。
- * @param {Object} options - 参数。
- * @param {FilterParameter} options.sourceFilter - 空间关系分析中的源数据集查询参数。仅 name, ids, attributeFilter 和 fields 字段有效。
- * @param {FilterParameter} options.referenceFilter - 空间关系分析中的参考数据集查询参数。仅 name, ids, attributeFilter 和 fields 字段有效。
- * @param {SpatialRelationType} options.spatialRelationType - 指定的空间关系类型。
- * @param {boolean} [options.isBorderInside] - 边界处理方式,即位于面边线上的点是否被面包含。此参数仅用于空间关系为包含或被包含的情况。
- * @param {boolean} [options.returnFeature] - 是否返回 Feature 信息。
- * @param {boolean} [options.returnGeoRelatedOnly=true] - 仅返回满足指定空间关系的空间对象。
- * @param {number} [options.startRecord=0] - 分析结果起始记录位置。
- * @param {number} [options.expectCount=500] - 空间关系分析期望返回结果记录数,如果实际不足500条结果则返回所有分析结果。
- * @usage
- */
- class GeoRelationAnalystParameters {
- constructor(options) {
- /**
- * @member {string} GeoRelationAnalystParameters.prototype.dataset
- * @description 源数据集名称。
- */
- this.dataset = null;
- /**
- * @member {FilterParameter} GeoRelationAnalystParameters.prototype.sourceFilter
- * @description 空间关系分析中的源数据集查询参数。仅 ids、attributeFilter 和 fields 字段有效。
- */
- this.sourceFilter = null;
- /**
- * @member {FilterParameter} GeoRelationAnalystParameters.prototype.referenceFilter
- * @description 空间关系分析中的参考数据集查询参数。仅 name,ids,attributeFilter 和 fields 字段有效。
- */
- this.referenceFilter = null;
- /**
- * @member {SpatialRelationType} GeoRelationAnalystParameters.prototype.spatialRelationType
- * @description 指定的空间关系类型。
- */
- this.spatialRelationType = null;
- /**
- * @member {boolean} [GeoRelationAnalystParameters.prototype.isBorderInside]
- * @description 边界处理方式,即位于面边线上的点是否被面包含。此参数仅用于空间关系为包含或被包含的情况。
- */
- this.isBorderInside = null;
- /**
- * @member {boolean} [GeoRelationAnalystParameters.prototype.returnFeature]
- * @description 是否返回 Feature 信息。
- */
- this.returnFeature = null;
- /**
- * @member {boolean} [GeoRelationAnalystParameters.prototype.returnGeoRelatedOnly=true]
- * @description 是否仅返回满足指定空间关系的空间对象。
- */
- this.returnGeoRelatedOnly = null;
- /**
- * @member {number} [GeoRelationAnalystParameters.prototype.returnGeoRelatedOnly=0]
- * @description 分析结果起始记录位置。
- */
- this.startRecord = 0;
- /**
- * @member {number} [GeoRelationAnalystParameters.prototype.expectCount=500]
- * @description 空间关系分析期望返回结果记录数,如果实际不足 500 条结果则返回所有分析结果。
- */
- this.expectCount = 500;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.GeoRelationAnalystParameters";
- }
- /**
- * @function GeoRelationAnalystParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- if (me.sourceFilter) {
- me.sourceFilter.destroy();
- }
- me.sourceFilter = null;
- if (me.referenceFilter) {
- me.referenceFilter.destroy();
- }
- me.referenceFilter = null;
- me.dataset = null;
- me.spatialRelationType = null;
- me.isBorderInside = null;
- me.returnFeature = null;
- me.returnGeoRelatedOnly = null;
- me.startRecord = null;
- me.expectCount = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/GeoRelationAnalystService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GeoRelationAnalystService
- * @deprecatedclass SuperMap.GeoRelationAnalystService
- * @category iServer SpatialAnalyst GeoRelationAnalyst
- * @classdesc 空间关系分析服务类。该类负责将客户设置的空间关系分析服务参数传递给服务端,并接收服务端返回的空间关系分析结果数据。
- * @param {string} url - 服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 需要被注册的监听器对象。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @extends {SpatialAnalystBase}
- * @example 实例化该类如下例所示:
- * (start code)
- * function datasetGeoRelationAnalystProcess() {
- * var referenceFilter = new FilterParameter({
- * name:"Frame_R@Changchun",
- * attributeFilter:"SmID>0"});
- * var sourceFilter = new FilterParameter({
- * attributeFilter:"SmID>0"});
- * //初始化服务类
- * var datasetGeoRelationService = new GeoRelationAnalystService(
- * "http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst/"),
- * //构建参数类
- * datasetGeoRelationParameters = new GeoRelationAnalystParameters({
- * dataset: "Park@Changchun",
- * startRecord: 0,
- * expectCount: 20,
- * sourceFilter: sourceFilter,
- * referenceFilter: referenceFilter,
- * spatialRelationType: SpatialRelationType.INTERSECT,
- * isBorderInside: true,
- * returnFeature: true,
- * returnGeoRelatedOnly: true
- * });
- * datasetGeoRelationService.events.on({
- * "processCompleted": datasetGeoRelationAnalystCompleted,
- * "processFailed": datasetGeoRelationAnalystFailed});
- * //执行
- * datasetGeoRelationService.processAsync(datasetGeoRelationParameters);
- * }
- * function Completed(datasetGeoRelationAnalystCompleted){//todo};
- * function Error(datasetGeoRelationAnalystFailed){//todo};
- * (end)
- * @usage
- */
- class GeoRelationAnalystService extends SpatialAnalystBase {
- constructor(url, options) {
- super(url, options);
- this.CLASS_NAME = "SuperMap.GeoRelationAnalystService";
- }
- /**
- * @function GeoRelationAnalystService.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function GeoRelationAnalystService.prototype.processAsync
- * @description 负责将客户端的空间关系分析参数传递到服务端
- * @param {GeoRelationAnalystParameters} parameter - 空间关系分析所需的参数信息。
- */
- processAsync(parameter) {
- if (!(parameter instanceof GeoRelationAnalystParameters)) {
- return;
- }
- var me = this;
- me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/georelation');
- var jsonParameters = Util.toJSON(parameter);
- me.url = Util.urlAppend(me.url, 'returnContent=true');
- me.request({
- method: "POST",
- data: jsonParameters,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/DatasetService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class DatasetService
- * @deprecatedclass SuperMap.DatasetService
- * @category iServer Data Dataset
- * @classdesc 数据集查询服务。
- * @param {string} url - 服务的访问地址。如访问World Data服务,只需将url设为:http://localhost:8090/iserver/services/data-world/rest/data 即可。
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
- * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
- * @param {string}options.datasource - 数据源名称。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class DatasetService extends CommonServiceBase {
- constructor(url, options) {
- super(url, options);
- if(!options){
- return;
- }
- /**
- * @member {string} DatasetService.prototype.datasource
- * @description 要查询的数据集所在的数据源名称。
- */
- this.datasource = null;
- /**
- * @member {string} DatasetService.prototype.dataset
- * @description 要查询的数据集名称。
- */
- this.dataset = null;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.DatasetService";
- }
- /**
- * @function DatasetService.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- var me = this;
- me.datasource = null;
- me.dataset = null;
- }
- /**
- * @function DatasetService.prototype.getDatasetsService
- * @description 执行服务,查询数据集服务。
- */
- getDatasetsService(params) {
- var me = this;
- me.url = Util.urlPathAppend(me.url,`datasources/name/${params}/datasets`);
- me.request({
- method: "GET",
- data: null,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- /**
- * @function DatasetService.prototype.getDatasetService
- * @description 执行服务,查询数据集信息服务。
- */
- getDatasetService(datasourceName, datasetName) {
- var me = this;
- me.url = Util.urlPathAppend(me.url,`datasources/name/${datasourceName}/datasets/name/${datasetName}`);
- me.request({
- method: "GET",
- data: null,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- /**
- * @function DatasetService.prototype.setDatasetService
- * @description 执行服务,更改数据集信息服务。
- */
- setDatasetService(params) {
- if (!params) {
- return;
- }
- var me = this;
- var jsonParamsStr = Util.toJSON(params);
- me.request({
- method: "PUT",
- data: jsonParamsStr,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- /**
- * @function DatasetService.prototype.deleteDatasetService
- * @description 执行服务,删除数据集信息服务。
- */
- deleteDatasetService() {
- var me = this;
- me.request({
- method: "DELETE",
- data: null,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesParametersBase.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GetFeaturesParametersBase
- * @deprecatedclass SuperMap.GetFeaturesParametersBase
- * @category iServer Data FeatureResults
- * @classdesc 要素查询参数基类。
- * @param {Object} options - 参数。
- * @param {Array.<string>} options.datasetNames - 数据集名称列表。
- * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
- * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
- * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
- * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
- * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。 如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
- * @param {MetricsAggParameter|GeoHashGridAggParameter} [options.aggregations] - 聚合查询参数。该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
- * @usage
- */
- class GetFeaturesParametersBase {
- constructor(options) {
- /**
- * @member {Array.<string>} GetFeaturesParametersBase.prototype.datasetName
- * @description 数据集集合中的数据集名称列表。
- */
- this.datasetNames = null;
- /**
- * @member {string} GetFeaturesParametersBase.prototype.targetEpsgCode
- * @description 动态投影的目标坐标系对应的 EPSG Code,使用时需设置 returnContent 参数为 true。
- */
- this.targetEpsgCode = null;
- /**
- * @member {Object} GetFeaturesParametersBase.prototype.targetPrj
- * @description 动态投影的目标坐标系。使用时需设置 returnContent 参数为 true。 如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
- */
- this.targetPrj = null;
- /**
- * @member {boolean} [GetFeaturesParametersBase.prototype.returnContent=true]
- * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
- * 如果为 true,则直接返回新创建资源,即查询结果的表述。
- * 如果为 false,则返回的是查询结果资源的 URI。
- */
- this.returnContent = true;
- /**
- * @member {number} [GetFeaturesParametersBase.prototype.fromIndex=0]
- * @description 查询结果的最小索引号。如果该值大于查询结果的最大索引号,则查询结果为空。
- */
- this.fromIndex = 0;
- /**
- * @member {number} [GetFeaturesParametersBase.prototype.toIndex=19]
- * @description 查询结果的最大索引号。如果该值大于查询结果的最大索引号,则以查询结果的最大索引号为终止索引号。
- */
- this.toIndex = 19;
- /**
- * @member {boolean} [GetFeaturesParametersBase.prototype.returnCountOnly=false]
- * @description 只返回查询结果的总数。
- */
- this.returnCountOnly = false;
- /**
- * @member {number} [GetFeaturesParametersBase.prototype.maxFeatures=1000]
- * @description 进行 SQL 查询时,用于设置服务端返回查询结果条目数量。
- */
- this.maxFeatures = null;
- /**
- * @member {number} [GetFeaturesParametersBase.prototype.hasGeometry=true]
- * @description 返回结果是否包含Geometry
- */
- this.hasGeometry = true;
- /**
- * @member {MetricsAggParameter|GeoHashGridAggParameter} GetFeaturesParametersBase.prototype.aggregations
- * @description 聚合查询参数,该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
- */
- this.aggregations = null;
- Util.extend(this, options);
- this.CLASS_NAME = 'SuperMap.GetFeaturesParametersBase';
- }
- /**
- *
- * @function GetFeaturesParametersBase.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.datasetNames = null;
- me.returnContent = null;
- me.fromIndex = null;
- me.toIndex = null;
- me.hasGeometry = null;
- me.maxFeatures = null;
- me.targetEpsgCode = null;
- me.targetPrj = null;
- if (me.aggregation) {
- me.aggregation = null;
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByBoundsParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GetFeaturesByBoundsParameters
- * @deprecatedclass SuperMap.GetFeaturesByBoundsParameters
- * @category iServer Data FeatureResults
- * @classdesc 数据集范围查询参数类,该类用于设置数据集范围查询的相关参数。
- * @param {Object} options - 参数。
- * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} options.bounds - 查询的范围对象。
- * @param {Array.<string>} options.datasetNames - 数据集名称列表。
- * @param {string} [options.attributeFilter] - 范围查询属性过滤条件。
- * @param {Array.<string>} [options.fields] - 设置查询结果返回字段。默认返回所有字段。
- * @param {SpatialQueryMode} [options.spatialQueryMode=SpatialQueryMode.CONTAIN] - 空间查询模式常量。
- * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
- * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
- * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
- * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
- * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。 如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
- * @param {MetricsAggParameter|GeoHashGridAggParameter} [options.aggregations] - 聚合查询参数。该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
- * @extends {GetFeaturesParametersBase}
- * @usage
- */
- class GetFeaturesByBoundsParameters extends GetFeaturesParametersBase {
- constructor(options) {
- super(options);
- /**
- * @member {string} GetFeaturesByBoundsParameters.prototype.getFeatureMode
- * @description 数据集查询模式。范围查询有 "BOUNDS","BOUNDS_ATTRIBUTEFILTER" 两种,当用户设置 attributeFilter 时会自动切换到 BOUNDS_ATTRIBUTEFILTER 访问服务。
- */
- this.getFeatureMode = GetFeaturesByBoundsParameters.getFeatureMode.BOUNDS;
- /**
- * @member {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} GetFeaturesByBoundsParameters.prototype.bounds
- * @description 用于查询的范围对象。
- *
- */
- this.bounds = null;
- /**
- * @member {Array.<string>} GetFeaturesByBoundsParameters.prototype.fields
- * @description 设置查询结果返回字段。当指定了返回结果字段后,则 GetFeaturesResult 中的 features 的属性字段只包含所指定的字段。不设置即返回全部字段。
- */
- this.fields = null;
- /**
- * @member {string} GetFeaturesByBoundsParameters.prototype.attributeFilter
- * @description 范围查询属性过滤条件。
- */
- this.attributeFilter = null;
- /**
- * @member {SpatialQueryMode} [GetFeaturesByBoundsParameters.prototype.spatialQueryMode=SpatialQueryMode.CONTAIN]
- * @description 空间查询模式常量。
- */
- this.spatialQueryMode = SpatialQueryMode.CONTAIN;
- Util.extend(this, options);
- this.CLASS_NAME = 'SuperMap.GetFeaturesByBoundsParameters';
- }
- /**
- * @function GetFeaturesByBoundsParameters.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- var me = this;
- if (me.bounds) {
- me.bounds.destroy();
- me.bounds = null;
- }
- if (me.fields) {
- while (me.fields.length > 0) {
- me.fields.pop();
- }
- me.fields = null;
- }
- me.attributeFilter = null;
- me.spatialQueryMode = null;
- me.getFeatureMode = null;
- }
- /**
- * @function GetFeaturesByBoundsParameters.toJsonParameters
- * @description 将 {@link GetFeaturesByBoundsParameters} 对象参数转换为 JSON 字符串。
- * @param {GetFeaturesByBoundsParameters} params - 范围查询参数。
- * @returns {string} 转化后的 JSON 字符串。
- *
- */
- static toJsonParameters(params) {
- var filterParameter, bounds, parasByBounds;
- bounds = {
- leftBottom: { x: params.bounds.left, y: params.bounds.bottom },
- rightTop: { x: params.bounds.right, y: params.bounds.top }
- };
- parasByBounds = {
- datasetNames: params.datasetNames,
- getFeatureMode: GetFeaturesByBoundsParameters.getFeatureMode.BOUNDS,
- bounds: bounds,
- spatialQueryMode: params.spatialQueryMode
- };
- if (params.fields) {
- filterParameter = new FilterParameter();
- filterParameter.name = params.datasetNames;
- filterParameter.fields = params.fields;
- parasByBounds.queryParameter = filterParameter;
- }
- if (params.attributeFilter) {
- parasByBounds.attributeFilter = params.attributeFilter;
- parasByBounds.getFeatureMode = GetFeaturesByBoundsParameters.getFeatureMode.BOUNDS_ATTRIBUTEFILTER;
- }
- if (params.maxFeatures && !isNaN(params.maxFeatures)) {
- parasByBounds.maxFeatures = params.maxFeatures;
- }
- if (typeof params.hasGeometry === 'boolean') {
- parasByBounds.hasGeometry = params.hasGeometry;
- }
- if (params.targetEpsgCode) {
- parasByBounds.targetEpsgCode = params.targetEpsgCode;
- }
- if (!params.targetEpsgCode && params.targetPrj) {
- parasByBounds.targetPrj = params.targetPrj;
- }
- if (params.aggregations) {
- parasByBounds.aggregations = params.aggregations;
- }
- return Util.toJSON(parasByBounds);
- }
- }
- GetFeaturesByBoundsParameters.getFeatureMode = {
- BOUNDS: 'BOUNDS',
- BOUNDS_ATTRIBUTEFILTER: 'BOUNDS_ATTRIBUTEFILTER'
- };
- ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesServiceBase.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GetFeaturesServiceBase
- * @deprecatedclass SuperMap.GetFeaturesServiceBase
- * @category iServer Data FeatureResults
- * @classdesc 数据服务中数据集查询服务基类。获取结果数据类型为 Object。包含 result 属性,result 的数据格式根据 format 参数决定为 GeoJSON 或者 iServerJSON。
- * @extends CommonServiceBase
- * @param {string} url - 服务地址。请求数据服务中数据集查询服务,
- * URL应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/
- * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
- * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @example
- * var myService = new GetFeaturesServiceBase(url, {
- * eventListeners: {
- * "processCompleted": getFeatureCompleted,
- * "processFailed": getFeatureError
- * }
- * });
- * @usage
- */
- class GetFeaturesServiceBase extends CommonServiceBase {
- constructor(url, options) {
- super(url, options);
- options = options || {};
- /**
- * @member {boolean} [GetFeaturesServiceBase.prototype.returnContent=true]
- * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
- * 如果为 true,则直接返回新创建资源,即查询结果的表述。
- * 如果为 false,则返回的是查询结果资源的 URI。
- */
- this.returnContent = true;
- /**
- * @member {number} [GetFeaturesServiceBase.prototype.fromIndex=0]
- * @description 查询结果的最小索引号。如果该值大于查询结果的最大索引号,则查询结果为空。
- */
- this.fromIndex = 0;
- /**
- * @member {number} [GetFeaturesServiceBase.prototype.toIndex=19]
- * @description 查询结果的最大索引号。
- * 如果该值大于查询结果的最大索引号,则以查询结果的最大索引号为终止索引号。
- */
- this.toIndex = 19;
- /**
- * @member {number} [GetFeaturesServiceBase.prototype.hasGeometry=true]
- * @description 返回结果是否包含Geometry
- */
- this.hasGeometry = true;
- /**
- * @member {number} [GetFeaturesServiceBase.prototype.maxFeatures=1000]
- * @description 进行 SQL 查询时,用于设置服务端返回查询结果条目数量。
- */
- this.maxFeatures = null;
- /**
- * @member {string} [GetFeaturesServiceBase.prototype.format=DataFormat.GEOJSON]
- * @description 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。
- * 参数格式为 "ISERVER","GEOJSON"。
- */
- this.format = DataFormat.GEOJSON;
- Util.extend(this, options);
- this.url = Util.urlPathAppend(this.url, 'featureResults');
- this.CLASS_NAME = "SuperMap.GetFeaturesServiceBase";
- }
- /**
- * @function GetFeaturesServiceBase.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- super.destroy();
- var me = this;
- me.returnContent = null;
- me.fromIndex = null;
- me.toIndex = null;
- me.maxFeatures = null;
- me.format = null;
- me.hasGeometry = null;
- }
- /**
- * @function GetFeaturesServiceBase.prototype.processAsync
- * @description 将客户端的查询参数传递到服务端。
- * @param {Object} params - 查询参数。
- */
- processAsync(params) {
- if (!params) {
- return;
- }
- var me = this,
- jsonParameters = null,
- firstPara = true;
- me.returnContent = params.returnContent;
- me.fromIndex = params.fromIndex;
- me.toIndex = params.toIndex;
- me.maxFeatures = params.maxFeatures;
- me.hasGeometry = params.hasGeometry;
- if (me.returnContent) {
- me.url = Util.urlAppend(me.url, 'returnContent=' + me.returnContent);
- firstPara = false;
- }
- var isValidNumber = me.fromIndex != null && me.toIndex != null && !isNaN(me.fromIndex) && !isNaN(me.toIndex);
- if (isValidNumber && me.fromIndex >= 0 && me.toIndex >= 0 && !firstPara) {
- me.url = Util.urlAppend(me.url, `fromIndex=${me.fromIndex}&toIndex=${me.toIndex}`);
- }
- if (params.returnCountOnly) {
- me.url = Util.urlAppend(me.url, "&returnCountOnly=" + params.returnContent)
- }
- jsonParameters = me.getJsonParameters(params);
- me.request({
- method: "POST",
- data: jsonParameters,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- /**
- * @function GetFeaturesServiceBase.prototype.getFeatureComplete
- * @description 查询完成,执行此方法。
- * @param {Object} result - 服务器返回的结果对象。
- */
- serviceProcessCompleted(result) {
- var me = this;
- result = Util.transformResult(result);
- if (me.format === DataFormat.GEOJSON && result.features) {
- var geoJSONFormat = new GeoJSON();
- result.features = geoJSONFormat.toGeoJSON(result.features);
- }
- me.events.triggerEvent("processCompleted", {result: result});
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByBoundsService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GetFeaturesByBoundsService
- * @deprecatedclass SuperMap.GetFeaturesByBoundsService
- * @category iServer Data FeatureResults
- * @classdesc 数据集范围查询服务类,查询与指定范围对象符合一定空间关系的矢量要素。
- * @description 数据集范围查询服务类构造函数。
- * @extends {GetFeaturesServiceBase}
- * @param {string} url - 服务地址。请求数据服务中数据集查询服务,URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/;
- * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
- * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @example
- * var myGetFeaturesByBoundsService = new SuperMa.GetFeaturesByBoundsService(url, {
- * eventListeners: {
- * "processCompleted": getFeatureCompleted,
- * "processFailed": getFeatureError
- * }
- * });
- * function getFeatureCompleted(object){//todo};
- * function getFeatureError(object){//todo}
- * @usage
- */
- class GetFeaturesByBoundsService extends GetFeaturesServiceBase {
- constructor(url, options) {
- super(url, options);
- this.CLASS_NAME = "SuperMap.GetFeaturesByBoundsService";
- }
- /**
- * @function GetFeaturesByBoundsService.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function GetFeaturesByBoundsService.prototype.getJsonParameters
- * @description 将查询参数转化为 JSON 字符串。在本类中重写此方法,可以实现不同种类的查询(ID, SQL, Buffer, Geometry,Bounds等)。
- * @param params {GetFeaturesByBoundsParameters}
- * @returns {string} 转化后的 JSON 字符串。
- *
- */
- getJsonParameters(params) {
- return GetFeaturesByBoundsParameters.toJsonParameters(params);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByBufferParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GetFeaturesByBufferParameters
- * @deprecatedclass SuperMap.GetFeaturesByBufferParameters
- * @category iServer Data FeatureResults
- * @classdesc 数据集缓冲区查询参数类。
- * @param {Object} options - 参数。
- * @param {number} options.bufferDistance - buffer 距离,单位与所查询图层对应的数据集单位相同。
- * @param {GeoJSONObject} options.geometry - 空间查询条件。
- * @param {Array.<string>} options.dataSetNames - 数据集集合中的数据集名称列表。
- * @param {Array.<string>} [options.fields] - 设置查询结果返回字段。默认返回所有字段。
- * @param {string} [options.attributeFilter] - 属性查询条件。
- * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
- * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
- * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
- * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
- * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。 如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
- * @extends {GetFeaturesParametersBase}
- * @usage
- */
- class GetFeaturesByBufferParameters extends GetFeaturesParametersBase {
- constructor(options) {
- super(options);
- /**
- * @member {number} GetFeaturesByBufferParameters.prototype.bufferDistance
- * @description buffer 距离,单位与所查询图层对应的数据集单位相同。
- */
- this.bufferDistance = null;
- /**
- * @member {string} GetFeaturesByBufferParameters.prototype.attributeFilter
- * @description 属性查询条件。
- */
- this.attributeFilter = null;
- /**
- * @member {GeoJSONObject} GetFeaturesByBufferParameters.prototype.geometry
- * @description 空间查询条件。 <br>
- * 点类型可以是:{@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>
- * 线类型可以是:{@link GeometryLineString}|{@link GeometryLinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}|{@link GeoJSONObject}。</br>
- * 面类型可以是:{@link GeometryPolygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}|{@link mapboxgl.LngLatBounds}|{@link GeoJSONObject}。
- */
- this.geometry = null;
- /**
- * @member {Array.<string>} GetFeaturesByBufferParameters.prototype.fields
- * @description 设置查询结果返回字段。当指定了返回结果字段后,则 GetFeaturesResult 中的 features 的属性字段只包含所指定的字段。不设置即返回全部字段。
- */
- this.fields = null;
- Util.extend(this, options);
- this.CLASS_NAME = 'SuperMap.GetFeaturesByBufferParameters';
- }
- /**
- * @function GetFeaturesByBufferParameters.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- var me = this;
- me.bufferDistance = null;
- me.attributeFilter = null;
- if (me.fields) {
- while (me.fields.length > 0) {
- me.fields.pop();
- }
- me.fields = null;
- }
- if (me.geometry) {
- me.geometry.destroy();
- me.geometry = null;
- }
- }
- /**
- * @function GetFeaturesByBufferParameters.toJsonParameters
- * @description 将 GetFeaturesByBufferParameters 对象转换为 JSON 字符串。
- * @param {GetFeaturesByBufferParameters} params - 数据集缓冲区查询参数对象。
- * @returns {string} 转化后的 JSON 字符串。
- */
- static toJsonParameters(params) {
- var filterParameter, paramsByBuffer, geometry;
- geometry = ServerGeometry.fromGeometry(params.geometry);
- paramsByBuffer = {
- datasetNames: params.datasetNames,
- getFeatureMode: 'BUFFER',
- bufferDistance: params.bufferDistance,
- geometry: geometry
- };
- if (params.fields) {
- filterParameter = new FilterParameter();
- filterParameter.name = params.datasetNames;
- filterParameter.fields = params.fields;
- paramsByBuffer.queryParameter = filterParameter;
- }
- if (params.attributeFilter) {
- paramsByBuffer.attributeFilter = params.attributeFilter;
- paramsByBuffer.getFeatureMode = 'BUFFER_ATTRIBUTEFILTER';
- }
- if (params.maxFeatures && !isNaN(params.maxFeatures)) {
- paramsByBuffer.maxFeatures = params.maxFeatures;
- }
- if (typeof params.hasGeometry === 'boolean') {
- paramsByBuffer.hasGeometry = params.hasGeometry;
- }
- if (params.targetEpsgCode) {
- paramsByBuffer.targetEpsgCode = params.targetEpsgCode;
- }
- if (!params.targetEpsgCode && params.targetPrj) {
- paramsByBuffer.targetPrj = params.targetPrj;
- }
- return Util.toJSON(paramsByBuffer);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByBufferService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GetFeaturesByBufferService
- * @deprecatedclass SuperMap.GetFeaturesByBufferService
- * @category iServer Data FeatureResults
- * @classdesc 数据服务中数据集缓冲区查询服务类。
- * @param {string} url - 服务地址。请求数据服务中数据集查询服务,
- * URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/;
- * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
- * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @extends {GetFeaturesServiceBase}
- * @example
- * var myGetFeaturesByBufferService = new GetFeaturesByBufferService(url, {
- * eventListeners: {
- * "processCompleted": GetFeaturesCompleted,
- * "processFailed": GetFeaturesError
- * }
- * });
- * function GetFeaturesCompleted(object){//todo};
- * function GetFeaturesError(object){//todo};
- * @usage
- */
- class GetFeaturesByBufferService extends GetFeaturesServiceBase {
- constructor(url, options) {
- super(url, options);
- this.CLASS_NAME = "SuperMap.GetFeaturesByBufferService";
- }
- /**
- * @function GetFeaturesByBufferService.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function GetFeaturesByBufferService.prototype.getJsonParameters
- * @description 将查询参数转化为 JSON 字符串。在本类中重写此方法,可以实现不同种类的查询(IDs, SQL, Buffer, Geometry等)。
- * @param {GetFeaturesByBufferParameters} params - 数据集缓冲区查询参数类。
- * @returns {Object} 转化后的 JSON 字符串。
- */
- getJsonParameters(params) {
- if (!(params instanceof GetFeaturesByBufferParameters)) {
- return;
- }
- return GetFeaturesByBufferParameters.toJsonParameters(params);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByGeometryParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GetFeaturesByGeometryParameters
- * @deprecatedclass SuperMap.GetFeaturesByGeometryParameters
- * @category iServer Data FeatureResults
- * @classdesc 数据集几何查询参数类。该类用于设置数据集几何查询的相关参数。
- * @param {Object} options - 参数。
- * @param {GeoJSONObject} options.geometry - 查询的几何对象。
- * @param {Array.<string>} options.datasetNames - 数据集集合中的数据集名称列表。
- * @param {string} [options.attributeFilter] - 几何查询属性过滤条件。
- * @param {Array.<string>} [options.fields] - 设置查询结果返回字段。默认返回所有字段。
- * @param {SpatialQueryMode} [options.spatialQueryMode=SpatialQueryMode.CONTAIN] - 空间查询模式常量。
- * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
- * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
- * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
- * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
- * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。 如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
- * @param {MetricsAggParameter|GeoHashGridAggParameter} [options.aggregations] - 聚合查询参数。该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
- * @extends {GetFeaturesParametersBase}
- * @usage
- */
- class GetFeaturesByGeometryParameters extends GetFeaturesParametersBase {
- constructor(options) {
- super(options);
- /**
- * @member {string} GetFeaturesByGeometryParameters.prototype.getFeatureMode
- * @description 数据集查询模式。几何查询有 "SPATIAL","SPATIAL_ATTRIBUTEFILTER" 两种,当用户设置 attributeFilter 时会自动切换到 SPATIAL_ATTRIBUTEFILTER 访问服务。
- */
- this.getFeatureMode = 'SPATIAL';
- /**
- * @member {GeoJSONObject} GetFeaturesByGeometryParameters.prototype.geometry
- * @description 用于查询的几何对象。 </br>
- * 点类型可以是:{@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>
- * 线类型可以是:{@link GeometryLineString}|{@link GeometryLinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}|{@link GeoJSONObject}。</br>
- * 面类型可以是:{@link GeometryPolygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}|{@link mapboxgl.LngLatBounds}|{@link GeoJSONObject}。
- */
- this.geometry = null;
- /**
- * @member {Array.<string>} GetFeaturesByGeometryParameters.prototype.fields
- * @description 设置查询结果返回字段。当指定了返回结果字段后,则 GetFeaturesResult 中的 features 的属性字段只包含所指定的字段。不设置即返回全部字段。
- */
- this.fields = null;
- /**
- * @member {string} GetFeaturesByGeometryParameters.prototype.attributeFilter
- * @description 几何查询属性过滤条件。
- */
- this.attributeFilter = null;
- /**
- * @member {SpatialQueryMode} [GetFeaturesByGeometryParameters.prototype.spatialQueryMode=SpatialQueryMode.CONTAIN]
- * @description 空间查询模式常量。
- */
- this.spatialQueryMode = SpatialQueryMode.CONTAIN;
- Util.extend(this, options);
- this.CLASS_NAME = 'SuperMap.GetFeaturesByGeometryParameters';
- }
- /**
- * @function GetFeaturesByGeometryParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- super.destroy();
- var me = this;
- if (me.geometry) {
- me.geometry.destroy();
- me.geometry = null;
- }
- if (me.fields) {
- while (me.fields.length > 0) {
- me.fields.pop();
- }
- me.fields = null;
- }
- me.attributeFilter = null;
- me.spatialQueryMode = null;
- me.getFeatureMode = null;
- }
- /**
- * @function GetFeaturesByGeometryParameters.toJsonParameters
- * @description 将 GetFeaturesByGeometryParameters 对象参数转换为 JSON 字符串。
- * @param {GetFeaturesByGeometryParameters} params - 查询参数对象。
- * @returns {string} 转化后的 JSON 字符串。
- */
- static toJsonParameters(params) {
- var filterParameter, geometry, parasByGeometry;
- geometry = ServerGeometry.fromGeometry(params.geometry);
- parasByGeometry = {
- datasetNames: params.datasetNames,
- getFeatureMode: 'SPATIAL',
- geometry: geometry,
- spatialQueryMode: params.spatialQueryMode
- };
- if (params.fields) {
- filterParameter = new FilterParameter();
- filterParameter.name = params.datasetNames;
- filterParameter.fields = params.fields;
- parasByGeometry.queryParameter = filterParameter;
- }
- if (params.attributeFilter) {
- parasByGeometry.attributeFilter = params.attributeFilter;
- parasByGeometry.getFeatureMode = 'SPATIAL_ATTRIBUTEFILTER';
- }
- if (params.maxFeatures && !isNaN(params.maxFeatures)) {
- parasByGeometry.maxFeatures = params.maxFeatures;
- }
- if (typeof params.hasGeometry === 'boolean') {
- parasByGeometry.hasGeometry = params.hasGeometry;
- }
- if (params.targetEpsgCode) {
- parasByGeometry.targetEpsgCode = params.targetEpsgCode;
- }
- if (!params.targetEpsgCode && params.targetPrj) {
- parasByGeometry.targetPrj = params.targetPrj;
- }
- if (params.aggregations) {
- parasByGeometry.aggregations = params.aggregations;
- }
- return Util.toJSON(parasByGeometry);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByGeometryService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GetFeaturesByGeometryService
- * @deprecatedclass SuperMap.GetFeaturesByGeometryService
- * @category iServer Data FeatureResults
- * @classdesc 数据集几何查询服务类,查询与指定几何对象符合一定空间关系的矢量要素。
- * @param {string} url - 服务地址。请求数据服务中数据集查询服务。
- * URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data;
- * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data"
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
- * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @extends {GetFeaturesServiceBase}
- * @example
- * var myService = new GetFeaturesByGeometryService(url, {
- * eventListeners: {
- * "processCompleted": getFeatureCompleted,
- * "processFailed": getFeatureError
- * }
- * });
- * function getFeatureCompleted(object){//todo};
- * function getFeatureError(object){//todo}
- * @usage
- */
- class GetFeaturesByGeometryService extends GetFeaturesServiceBase {
- constructor(url, options) {
- super(url, options);
- this.CLASS_NAME = "SuperMap.GetFeaturesByGeometryService";
- }
- /**
- * @function GetFeaturesByGeometryService.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function GetFeaturesByGeometryService.prototype.getJsonParameters
- * @param {GetFeaturesByGeometryParameters} params - 数据集几何查询参数类。
- * @description 将查询参数转化为 JSON 字符串。
- * 在本类中重写此方法,可以实现不同种类的查询(ID, SQL, Buffer, Geometry等)。
- * @returns {Object} 转化后的 JSON 字符串。
- */
- getJsonParameters(params) {
- return GetFeaturesByGeometryParameters.toJsonParameters(params);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByIDsParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GetFeaturesByIDsParameters
- * @deprecatedclass SuperMap.GetFeaturesByIDsParameters
- * @category iServer Data FeatureResults
- * @classdesc ID 查询参数类。
- * @param {Object} options - 参数。
- * @param {Array.<number>} options.IDs - 指定查询的元素 ID 信息。
- * @param {Array.<string>} [options.fields] - 设置查询结果返回字段。默认返回所有字段。
- * @param {Array.<string>} options.dataSetNames - 数据集集合中的数据集名称列表。
- * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
- * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
- * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
- * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
- * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。 如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
- * @param {MetricsAggParameter|GeoHashGridAggParameter} [options.aggregations] - 聚合查询参数。该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
- * @extends {GetFeaturesParametersBase}
- * @usage
- */
- class GetFeaturesByIDsParameters extends GetFeaturesParametersBase {
- constructor(options) {
- super(options);
- /**
- * @member {string} GetFeaturesByIDsParameters.prototype.getFeatureMode
- * @description 数据集查询模式。
- */
- this.getFeatureMode = 'ID';
- /**
- * @member {Array.<number>} GetFeaturesByIDsParameters.prototype.IDs
- * @description 所要查询指定的元素 ID 信息。
- */
- this.IDs = null;
- /**
- * @member {Array.<string>} GetFeaturesByIDsParameters.prototype.fields
- * @description 设置查询结果返回字段。当指定了返回结果字段后,则 GetFeaturesResult 中的 features 的属性字段只包含所指定的字段。不设置即返回全部字段。
- */
- this.fields = null;
- Util.extend(this, options);
- this.CLASS_NAME = 'SuperMap.GetFeaturesByIDsParameters';
- }
- /**
- * @function GetFeaturesByIDsParameters.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- var me = this;
- me.IDs = null;
- me.getFeatureMode = null;
- if (me.fields) {
- while (me.fields.length > 0) {
- me.fields.pop();
- }
- me.fields = null;
- }
- }
- /**
- * @function GetFeaturesByIDsParameters.toJsonParameters
- * @description 将 GetFeaturesByIDsParameters 对象转换为 JSON 字符串。
- * @param {GetFeaturesByIDsParameters} params - ID 查询参数对象。
- * @returns {string} 转化后的 JSON 字符串。
- */
- static toJsonParameters(params) {
- var parasByIDs, filterParameter;
- parasByIDs = {
- datasetNames: params.datasetNames,
- getFeatureMode: 'ID',
- ids: params.IDs
- };
- if (params.fields) {
- filterParameter = new FilterParameter();
- filterParameter.name = params.datasetNames;
- filterParameter.fields = params.fields;
- parasByIDs.queryParameter = filterParameter;
- }
- if (params.targetEpsgCode) {
- parasByIDs.targetEpsgCode = params.targetEpsgCode;
- }
- if (typeof params.hasGeometry === 'boolean') {
- parasByIDs.hasGeometry = params.hasGeometry;
- }
- if (!params.targetEpsgCode && params.targetPrj) {
- parasByIDs.targetPrj = params.targetPrj;
- }
- if (params.aggregations) {
- parasByIDs.aggregations = params.aggregations;
- }
- return Util.toJSON(parasByIDs);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByIDsService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GetFeaturesByIDsService
- * @deprecatedclass SuperMap.GetFeaturesByIDsService
- * @category iServer Data FeatureResults
- * @classdesc 数据集ID查询服务类。在数据集集合中查找指定 ID 号对应的空间地物要素。
- * @param {string} url - 服务地址。请求数据服务中数据集查询服务。
- * URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/;</br>
- * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
- * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @extends {GetFeaturesServiceBase}
- * @example
- * var myGetFeaturesByIDsService = new GetFeaturesByIDsService(url, {
- * eventListeners: {
- * "processCompleted": getFeatureCompleted,
- * "processFailed": getFeatureError
- * }
- * });
- * function getFeatureCompleted(object){//todo};
- * function getFeatureError(object){//todo}
- * @usage
- */
- class GetFeaturesByIDsService extends GetFeaturesServiceBase {
- constructor(url, options) {
- super(url, options);
- this.CLASS_NAME = "SuperMap.GetFeaturesByIDsService";
- }
- /**
- * @function GetFeaturesByIDsService.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function GetFeaturesByIDsService.prototype.getJsonParameters
- * @description 将查询参数转化为 JSON 字符串。
- * 在本类中重写此方法,可以实现不同种类的查询(ID, SQL, Buffer, Geometry等)。
- * @param {GetFeaturesByIDsParameters} params - ID查询参数类。
- * @returns {string} 转化后的 JSON 字符串。
- */
- getJsonParameters(params) {
- return GetFeaturesByIDsParameters.toJsonParameters(params);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesBySQLParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GetFeaturesBySQLParameters
- * @deprecatedclass SuperMap.GetFeaturesBySQLParameters
- * @category iServer Data FeatureResults
- * @classdesc 数据集 SQL 查询参数类。
- * @param {Object} options - 参数。
- * @param {FilterParameter} options.queryParameter - 查询过滤条件参数。
- * @param {Array.<string>} options.datasetNames - 数据集集合中的数据集名称列表。
- * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
- * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
- * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
- * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
- * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。 如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
- * @param {MetricsAggParameter|GeoHashGridAggParameter} [options.aggregations] - 聚合查询参数。该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
- * @extends {GetFeaturesParametersBase}
- * @usage
- */
- class GetFeaturesBySQLParameters extends GetFeaturesParametersBase {
- constructor(options) {
- super(options);
- /**
- * @member {string} GetFeaturesBySQLParameters.prototype.getFeatureMode
- * @description 数据集查询模式。
- */
- this.getFeatureMode = 'SQL';
- /**
- * @member {FilterParameter} GetFeaturesBySQLParameters.prototype.queryParameter
- * @description 查询过滤条件参数类。
- */
- this.queryParameter = null;
- Util.extend(this, options);
- this.CLASS_NAME = 'SuperMap.GetFeaturesBySQLParameters';
- }
- /**
- * @function GetFeaturesBySQLParameters.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- var me = this;
- me.getFeatureMode = null;
- if (me.queryParameter) {
- me.queryParameter.destroy();
- me.queryParameter = null;
- }
- }
- /**
- * @function GetFeaturesBySQLParameters.prototype.toJsonParameters
- * @description 将 GetFeaturesBySQLParameters 对象转换为 JSON 字符串。
- * @param {GetFeaturesBySQLParameters} params - 数据集 SQL 查询参数对象。
- * @returns {string} 转化后的 JSON 字符串。
- */
- static toJsonParameters(params) {
- var paramsBySql = {
- datasetNames: params.datasetNames,
- getFeatureMode: 'SQL',
- queryParameter: params.queryParameter
- };
- if (params.maxFeatures && !isNaN(params.maxFeatures)) {
- paramsBySql.maxFeatures = params.maxFeatures;
- }
- if (typeof params.hasGeometry === 'boolean') {
- paramsBySql.hasGeometry = params.hasGeometry;
- }
- if (params.aggregations) {
- paramsBySql.aggregations = params.aggregations;
- }
- if (params.targetEpsgCode) {
- paramsBySql.targetEpsgCode = params.targetEpsgCode;
- }
- if (!params.targetEpsgCode && params.targetPrj) {
- paramsBySql.targetPrj = params.targetPrj;
- }
- if (params.aggregations) {
- paramsBySql.aggregations = params.aggregations;
- }
- return Util.toJSON(paramsBySql);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesBySQLService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GetFeaturesBySQLService
- * @deprecatedclass SuperMap.GetFeaturesBySQLService
- * @constructs GetFeaturesBySQLService
- * @category iServer Data FeatureResults
- * @classdesc 数据服务中数据集 SQL 查询服务类。在一个或多个指定的图层上查询符合 SQL 条件的空间地物信息。
- * @param {string} url - 服务地址。请求数据服务中数据集查询服务,
- * URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/;</br>
- * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
- * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @extends {GetFeaturesServiceBase}
- * @example
- * var myGetFeaturesBySQLService = new GetFeaturesBySQLService(url, {
- * eventListeners: {
- * "processCompleted": GetFeaturesCompleted,
- * "processFailed": GetFeaturesError
- * }
- * });
- * function getFeaturesCompleted(object){//todo};
- * function getFeaturesError(object){//todo};
- * @usage
- */
- class GetFeaturesBySQLService extends GetFeaturesServiceBase {
- constructor(url, options) {
- super(url, options);
- this.CLASS_NAME = "SuperMap.GetFeaturesBySQLService";
- }
- /**
- * @function GetFeaturesBySQLService.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- }
- /*
- * @function GetFeaturesBySQLService.prototype.getJsonParameters
- * @description 将查询参数转化为 JSON 字符串。
- * 在本类中重写此方法,可以实现不同种类的查询(ID, SQL, Buffer, Geometry等)。
- * @param {GetFeaturesBySQLParameters} params - 数据集SQL查询参数类。
- * @returns {string} 转化后的 JSON 字符串。
- */
- getJsonParameters(params) {
- return GetFeaturesBySQLParameters.toJsonParameters(params);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/GetFieldsService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GetFieldsService
- * @deprecatedclass SuperMap.GetFieldsService
- * @category iServer Data Field
- * @classdesc 字段查询服务,支持查询指定数据集的中所有属性字段(field)的集合。
- * @param {string} url - 服务地址。如访问World Map服务,只需将url设为:http://localhost:8090/iserver/services/data-world/rest/data 即可。
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
- * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
- * @param {string}options.datasource - 数据源名称。
- * @param {string}options.dataset - 数据集名称。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @extends {CommonServiceBase}
- * @example
- * var myService = new GetFieldsService(url, {eventListeners: {
- * "processCompleted": getFieldsCompleted,
- * "processFailed": getFieldsError
- * },
- * datasource: "World",
- * dataset: "Countries"
- * };
- * @usage
- */
- class GetFieldsService extends CommonServiceBase {
- constructor(url, options) {
- super(url, options);
- /**
- * @member {string} GetFieldsService.prototype.datasource
- * @description 要查询的数据集所在的数据源名称。
- */
- this.datasource = null;
- /**
- * @member {string} GetFieldsService.prototype.dataset
- * @description 要查询的数据集名称。
- */
- this.dataset = null;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.GetFieldsService";
- }
- /**
- * @function GetFieldsService.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- var me = this;
- me.datasource = null;
- me.dataset = null;
- }
- /**
- * @function GetFieldsService.prototype.processAsync
- * @description 执行服务,查询指定数据集的字段信息。
- */
- processAsync() {
- var me = this;
- me.url = Util.urlPathAppend(me.url,`datasources/${me.datasource}/datasets/${me.dataset}/fields`);
- me.request({
- method: "GET",
- data: null,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/GetGridCellInfosParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GetGridCellInfosParameters
- * @deprecatedclass SuperMap.GetGridCellInfosParameters
- * @category iServer Data Grid
- * @classdesc 数据服务栅格查询参数类。
- * @param {Object} options - 参数。
- * @param {string} options.datasetName - 数据集名称。
- * @param {string} options.dataSourceName - 数据源名称。
- * @param {number} options.X - 地理位置 X 轴。
- * @param {number} options.Y - 地理位置 Y 轴。
- * @usage
- */
- class GetGridCellInfosParameters {
- constructor(options) {
- /**
- * @member {string} GetGridCellInfosParameters.prototype.datasetName
- * @description 数据集名称。
- */
- this.datasetName = null;
- /**
- * @member {string} GetGridCellInfosParameters.prototype.dataSourceName
- * @description 数据源名称。
- */
- this.dataSourceName = null;
- /**
- * @member {number} GetGridCellInfosParameters.prototype.X
- * @description 要查询的地理位置 X 轴。
- */
- this.X = null;
- /**
- * @member {number} GetGridCellInfosParameters.prototype.Y
- * @description 要查询的地理位置 Y 轴。
- */
- this.Y = null;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.GetGridCellInfosParameters";
- }
- /**
- * @function GetGridCellInfosParameters.prototype.destroy
- * @description 释放资源,将引用的资源属性置空。
- */
- destroy() {
- var me = this;
- me.datasetName = null;
- me.dataSourceName = null;
- me.X = null;
- me.Y = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/GetGridCellInfosService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GetGridCellInfosService
- * @deprecatedclass SuperMap.GetGridCellInfosService
- * @category iServer Data Grid
- * @classdesc 数据栅格查询服务,支持查询指定地理位置的栅格信息。
- * @param {string} url - 服务地址。例如: http://localhost:8090/iserver/services/data-jingjin/rest/data
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。<br>
- * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @extends {CommonServiceBase}
- * @example
- * var myService = new GetGridCellInfosService(url, {eventListeners: {
- * "processCompleted": queryCompleted,
- * "processFailed": queryError
- * }
- * });
- * @usage
- */
- class GetGridCellInfosService extends CommonServiceBase {
- constructor(url, options) {
- super(url, options);
- /**
- * @member {string} GetGridCellInfosService.prototype.datasetName
- * @description 数据集名称。
- */
- this.datasetName = null;
- /**
- * @member {string} GetGridCellInfosService.prototype.dataSourceName
- * @description 数据源名称。
- */
- this.dataSourceName = null;
- /**
- * @member {string} GetGridCellInfosService.prototype.datasetType
- * @description 数据集类型。
- */
- this.datasetType = null;
- /**
- * @member {number} GetGridCellInfosService.prototype.X
- * @description 要查询的地理位置X轴
- */
- this.X = null;
- /**
- * @member {number} GetGridCellInfosService.prototype.Y
- * @description 要查询的地理位置Y轴
- */
- this.Y = null;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.GetGridCellInfosService";
- }
- /**
- * @function GetGridCellInfosService.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- var me = this;
- me.X = null;
- me.Y = null;
- me.datasetName = null;
- me.dataSourceName = null;
- me.datasetType = null;
- }
- /**
- * @function GetGridCellInfosService.prototype.processAsync
- * @description 执行服务,查询数据集信息。
- * @param {GetGridCellInfosParameters} params - 查询参数。
- */
- processAsync(params) {
- if (!(params instanceof GetGridCellInfosParameters)) {
- return;
- }
- Util.extend(this, params);
- var me = this;
- me.url = Util.urlPathAppend(me.url,`datasources/${me.dataSourceName}/datasets/${me.datasetName}`);
- me.queryRequest(me.getDatasetInfoCompleted, me.getDatasetInfoFailed);
- }
- /**
- * @function GetGridCellInfosService.prototype.queryRequest
- * @description 执行服务,查询。
- * @callback {function} successFun - 成功后执行的函数。
- * @callback {function} failedFunc - 失败后执行的函数。
- */
- queryRequest(successFun, failedFunc) {
- var me = this;
- me.request({
- method: "GET",
- data: null,
- scope: me,
- success: successFun,
- failure: failedFunc
- });
- }
- /**
- * @function GetGridCellInfosService.prototype.getDatasetInfoCompleted
- * @description 数据集查询完成,执行此方法。
- * @param {Object} result - 服务器返回的结果对象。
- */
- getDatasetInfoCompleted(result) {
- var me = this;
- result = Util.transformResult(result);
- me.datasetType = result.datasetInfo.type;
- me.queryGridInfos();
- }
- /**
- * @function GetGridCellInfosService.prototype.queryGridInfos
- * @description 执行服务,查询数据集栅格信息信息。
- */
- queryGridInfos() {
- var me = this;
- me.url = Util.urlPathAppend(me.url, me.datasetType == 'GRID' ? 'gridValue' : 'imageValue');
- if (me.X != null && me.Y != null) {
- me.url = Util.urlAppend(me.url, `x=${me.X}&y=${me.Y}`);
- }
- me.queryRequest(me.serviceProcessCompleted, me.serviceProcessFailed);
- }
- /**
- * @function GetGridCellInfosService.prototype.getDatasetInfoFailed
- * @description 数据集查询失败,执行此方法。
- * @param {Object} result - 服务器返回的结果对象。
- */
- getDatasetInfoFailed(result) {
- var me = this;
- me.serviceProcessFailed(result);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/Theme.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class CommonTheme
- * @aliasclass Theme
- * @deprecatedclass SuperMap.Theme
- * @category iServer Map Theme
- * @classdesc 专题图基类。
- * @param {string} type - 专题图类型。
- * @param {Object} options - 可选参数。
- * @param {ThemeMemoryData} [options.memoryData] - 专题图内存数据。
- * @usage
- */
- class Theme {
- constructor(type, options) {
- if (!type) {
- return this;
- }
- /**
- * @member {ThemeMemoryData} CommonTheme.prototype.memoryData
- * @description 专题图内存数据。<br>
- * 用内存数据制作专题图的方式与表达式制作专题图的方式互斥,前者优先级较高。
- * 第一个参数代表专题值,即数据集中用来做专题图的字段或表达式的值;第二个参数代表外部值。在制作专题图时,会用外部值代替专题值来制作相应的专题图。
- */
- this.memoryData = null;
- /**
- * @member {string} CommonTheme.prototype.type
- * @description 专题图类型。
- */
- this.type = type;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.Theme";
- }
- /**
- * @function CommonTheme.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- if (me.memoryData) {
- me.memoryData.destroy();
- me.memoryData = null;
- }
- me.type = null;
- }
- /**
- * @function CommonTheme.prototype.toServerJSONObject
- * @description 转换成对应的 JSON 格式对象。
- * @returns {Object} 对应的 JSON 格式对象。
- */
- toServerJSONObject() {
- //return 子类实现
- return;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ServerTextStyle.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ServerTextStyle
- * @deprecatedclass SuperMap.ServerTextStyle
- * @category iServer Map Theme
- * @classdesc 服务端文本风格类。该类用于定义文本风格的相关属性。
- * @param {Object} options - 可选参数。
- * @param {TextAlignment} [options.align=TextAlignment.BASELINECENTER] - 文本的对齐方式。
- * @param {ServerColor} [options.backColor] - 文本的背景色。默认 backColor = new ServerColor(255, 255, 255)。
- * @param {ServerColor} [options.foreColor] - 文本的前景色。默认 foreColor = new ServerColor(0, 0, 0)。
- * @param {boolean} [options.backOpaque=false] - 文本背景是否不透明。
- * @param {boolean} [options.sizeFixed=true] - 文本大小是否固定。
- * @param {number} [options.fontHeight=6] - 文本字体的高度。
- * @param {number} [options.fontWidth=0] - 文本字体的宽度。
- * @param {number} [options.fontWeight=400] - 文本字体的磅数。
- * @param {string} [options.fontName='Times New Roman'] - 文本字体的名称。
- * @param {boolean} [options.bold=false] - 文本是否为粗体字。
- * @param {boolean} [options.italic=false] - 文本是否采用斜体。
- * @param {number} [options.italicAngle=0] - 字体倾斜角度。
- * @param {boolean} [options.shadow=false] - 文本是否有阴影。
- * @param {boolean} [options.strikeout=false] - 文本字体是否加删除线。
- * @param {boolean} [options.outline=false] - 是否以轮廓的方式来显示文本的背景。
- * @param {number} [options.opaqueRate=0] - 注记文字的不透明度。
- * @param {boolean} [options.underline=false] - 文本字体是否加下划线。
- * @param {number} [options.rotation=0.0] - 文本旋转的角度。
- * @usage
- */
- class ServerTextStyle {
- constructor(options) {
- /**
- * @member {TextAlignment} [ServerTextStyle.prototype.align= TextAlignment.BASELINECENTER]
- * @description 文本的对齐方式。
- */
- this.align = TextAlignment.BASELINECENTER;
- /**
- * @member {ServerColor} [ServerTextStyle.prototype.backColor=(255, 255, 255)]
- * @description 文本的背景色。
- */
- this.backColor = new ServerColor(255, 255, 255);
- /**
- * @member {ServerColor} [ServerTextStyle.prototype.foreColor=(0, 0, 0)]
- * @description 文本的前景色。
- */
- this.foreColor = new ServerColor(0, 0, 0);
- /**
- * @member {boolean} [ServerTextStyle.prototype.backOpaque=false]
- * @description 文本背景是否不透明。true 表示文本背景不透明。
- */
- this.backOpaque = false;
- /**
- * @member {boolean} [ServerTextStyle.prototype.sizeFixed=true]
- * @description 文本大小是否固定。设置为 true,表示图片为固定像素大小,具体大小请参考 fontHeight。当设为 false 时,图片会随着地图缩放而缩放。
- */
- this.sizeFixed = true;
- /**
- * @member {number} [ServerTextStyle.prototype.fontHeight=6]
- * @description 文本字体的高度,单位与 sizeFixed 有关,当 sizeFixed 为 False 时,即非固定文本大小时使用地图坐标单位,
- * 如地理坐标系下的地图中单位为度;当 sizeFixed 为 True 时,单位为毫米(mm)。
- */
- this.fontHeight = 6;
- /**
- * @member {number} [ServerTextStyle.prototype.fontWidth=0]
- * @description 文本字体的宽度。字体的宽度以英文字符为标准,由于一个中文字符相当于两个英文字符。
- */
- this.fontWidth = 0;
- /**
- * @member {number} [ServerTextStyle.prototype.fontWeight=400]
- * @description 文本字体的磅数。表示粗体的具体数值。取值范围为从0-900之间的整百数。
- */
- this.fontWeight = 400;
- /**
- * @member {string} [ServerTextStyle.prototype.fontName="Times New Roman"]
- * @description 文本字体的名称。
- */
- this.fontName = "Times New Roman";
- /**
- * @member {boolean} [ServerTextStyle.prototype.bold=false]
- * @description 文本是否为粗体字。true 表示为粗体。false 表示文本不是粗体字。
- */
- this.bold = false;
- /**
- * @member {boolean} [ServerTextStyle.prototype.italic=false]
- * @description 文本是否采用斜体。true 表示采用斜体。
- */
- this.italic = false;
- /**
- * @member {number} [ServerTextStyle.prototype.italicAngle=0]
- * @description 字体倾斜角度。正负度之间,以度为单位,精确到0.1度。当倾斜角度为0度,为系统默认的字体倾斜样式。
- * 正负度是指以纵轴为起始零度线,其纵轴左侧为正,右侧为负。允许的最大角度为60,最小-60。大于60按照60处理,小于-60按照-60处理。目前只对标签专题图有效。
- */
- this.italicAngle = 0;
- /**
- * @member {boolean} [ServerTextStyle.prototype.shadow=false]
- * @description 文本是否有阴影。true 表示给文本增加阴影。false 表示文本没有阴影。
- */
- this.shadow = false;
- /**
- * @member {boolean} [ServerTextStyle.prototype.strikeout=false]
- * @description 文本字体是否加删除线。true 表示加删除线。false 表示文本字体不加删除线。
- */
- this.strikeout = false;
- /**
- * @member {boolean} [ServerTextStyle.prototype.outline=false]
- * @description 是否以轮廓的方式来显示文本的背景。true 表示以轮廓的方式来显示文本的背景。false 表示不以轮廓的方式来显示文本的背景。
- */
- this.outline = false;
- /**
- * @member {number} [ServerTextStyle.prototype.opaqueRate=0]
- * @description 注记文字的不透明度。不透明度的范围为0-100。0表示透明。
- */
- this.opaqueRate = 0;
- /**
- * @member {boolean} [ServerTextStyle.prototype.underline=false]
- * @description 文本字体是否加下划线。true 表示加下划线。
- */
- this.underline = false;
- /**
- * @member {number} [ServerTextStyle.prototype.rotation=0.0]
- * @description 文本旋转的角度。逆时针方向为正方向,单位为度,精确到0.1度。
- */
- this.rotation = 0.0;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.ServerTextStyle";
- }
- /**
- * @function ServerTextStyle.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.align = null;
- if (me.backColor) {
- me.backColor.destroy();
- me.backColor = null;
- }
- if (me.foreColor) {
- me.foreColor.destroy();
- me.foreColor = null;
- }
- me.backOpaque = null;
- me.sizeFixed = null;
- me.fontHeight = null;
- me.fontWidth = null;
- me.fontWeight = null;
- me.fontName = null;
- me.bold = null;
- me.italic = null;
- me.italicAngle = null;
- me.shadow = null;
- me.strikeout = null;
- me.outline = null;
- me.opaqueRate = null;
- me.underline = null;
- me.rotation = null;
- }
- /**
- * @function ServerTextStyle.fromObj
- * @description 从传入对象获服务端文本风格类。
- * @param {Object} obj - 传入对象
- * @returns {ServerTextStyle} 返回服务端文本风格对象
- */
- static fromObj(obj) {
- var res = new ServerTextStyle(obj);
- Util.copy(res, obj);
- res.backColor = ServerColor.fromJson(obj.backColor);
- res.foreColor = ServerColor.fromJson(obj.foreColor);
- return res;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabelItem.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ThemeLabelItem
- * @deprecatedclass SuperMap.ThemeLabelItem
- * @category iServer Map Theme
- * @classdesc 分段标签专题图的子项。标签专题图用专题值对点、线、面等对象做标注。
- * 值得注意的是,分段标签专题图允许用户通过 rangeExpression 字段指定用于分段的数值型字段,
- * 同一范围段内的标签具有相同的显示风格,其中每一个范围段就是一个专题图子项,
- * 每一个子项都具有其名称、风格、起始值和终止值。注意:每个分段所表示的范围为 [Start, End)。例如:标签专题图的分段点有两个子项,
- * 他们所代表的分段区间分别为[0,5),[5,10)。那么需要分别设置 ThemeLabelItem[0].start=0,
- * ThemeLabelItem[0].end=5,SuperMap.ThemeLabelItem[1].start=5,SuperMap.ThemeLabelItem[1].end=10。
- * @param {Object} options - 可选参数。
- * @param {string} [options.caption] - 子项的名称。
- * @param {number} [options.end=0] - 子项的终止值。
- * @param {number} [options.start=0] - 子项的分段起始值。
- * @param {boolean} [options.visible=true] - 子项是否可见。
- * @param {ServerTextStyle} [options.style] - 子项文本的显示风格。
- * @usage
- */
- class ThemeLabelItem {
- constructor(options) {
- /**
- * @member {string} [ThemeLabelItem.prototype.caption]
- * @description 标签专题子项的标题。
- */
- this.caption = null;
- /**
- * @member {number} [ThemeLabelItem.prototype.end=0]
- * @description 标签专题图子项的终止值。如果该子项是分段中最后一个子项,那么该终止值就是分段的最大值;
- * 如果不是最后一项,该终止值必须与其下一子项的起始值相同,否则系统抛出异常。
- */
- this.end = 0;
- /**
- * @member {number} [ThemeLabelItem.prototype.start=0]
- * @description 标签专题图子项的分段起始值。如果该子项是分段中第一项,那么该起始值就是分段的最小值;
- * 如果该子项的序号大于等于 1 的时候,该起始值必须与前一子项的终止值相同,否则系统会抛出异常。
- */
- this.start = 0;
- /**
- * @member {boolean} [ThemeLabelItem.prototype.visible=true]
- * @description 标签专题图子项是否可见。如果标签专题图子项可见,则为 true,否则为 false。
- */
- this.visible = true;
- /**
- * @member {ServerTextStyle} ThemeLabelItem.prototype.style
- * @description 标签专题图子项文本的显示风格。各种风格的优先级从高到低为:<br>
- * uniformMixedStyle(标签文本的复合风格),ThemeLabelItem.style(分段子项的文本风格),uniformStyle(统一文本风格)。
- */
- this.style = new ServerTextStyle();
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.ThemeLabelItem";
- }
- /**
- * @function ThemeLabelItem.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.caption = null;
- me.end = null;
- me.start = null;
- if (me.style) {
- me.style.destroy();
- me.style = null;
- }
- me.visible = null;
- }
- /**
- * @function ThemeLabelItem.fromObj
- * @description 从传入对象获取分段标签专题图的子项类。
- * @param {Object} obj - 传入对象。
- * @returns {ThemeLabelItem} ThemeLabelItem 对象。
- */
- static fromObj(obj) {
- if (!obj) {
- return;
- }
- var t = new ThemeLabelItem();
- Util.copy(t, obj);
- return t;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ThemeUniqueItem.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ThemeUniqueItem
- * @deprecatedclass SuperMap.ThemeUniqueItem
- * @category iServer Map Theme
- * @classdesc 单值专题图子项类。单值专题图是将专题值相同的要素归为一类,为每一类设定一种渲染风格,其中每一类就是一个专题图子项。比如,利用单值专题图制作行政区划图,Name 字段代表
- * 省/直辖市名,该字段用来做专题变量,如果该字段的字段值总共有 5 种不同值,则该行政区划图有 5 个专题图子项。
- * @param {Object} options - 参数。
- * @param {string} options.unique - 子项的单值字段。
- * @param {string} [options.caption] - 子项的标题。
- * @param {ServerStyle} [options.style] - 子项的风格。
- * @param {boolean} [options.visible=true] - 子项是否可见。
- * @usage
- */
- class ThemeUniqueItem {
- constructor(options) {
- /**
- * @member {string} [ThemeUniqueItem.prototype.caption]
- * @description 单值专题图子项的标题。
- */
- this.caption = null;
- /**
- * @member {ServerStyle} [ThemeUniqueItem.prototype.style]
- * @description 单值专题图子项的显示风格。
- */
- this.style = new ServerStyle();
- /**
- * @member {string} ThemeUniqueItem.prototype.unique
- * @description 单值专题图子项的值,可以为数字、字符串等。
- */
- this.unique = null;
- /**
- * @member {boolean} [ThemeUniqueItem.prototype.visible=true]
- * @description 单值专题图子项的可见性。
- */
- this.visible = true;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.ThemeUniqueItem";
- }
- /**
- * @function ThemeUniqueItem.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.caption = null;
- me.unique = null;
- if (me.style) {
- me.style.destroy();
- me.style = null;
- }
- me.visible = null;
- }
- /**
- * @function ThemeUniqueItem.prototype.toServerJSONObject
- * @description 转换成对应的 JSON 格式对象。
- * @returns {Object} 对应的 JSON 格式对象。
- */
- toServerJSONObject() {
- var obj = {};
- obj = Util.copyAttributes(obj, this);
- if (obj.style) {
- if (obj.style.toServerJSONObject) {
- obj.style = obj.style.toServerJSONObject();
- }
- }
- return obj;
- }
- /**
- * @function ThemeUniqueItem.fromObj
- * @description 从传入对象获取单值专题图子项类。
- * @param {Object} obj - 传入对象。
- * @returns {ThemeUniqueItem} ThemeUniqueItem 对象。
- */
- static fromObj(obj) {
- var res = new ThemeUniqueItem();
- Util.copy(res, obj);
- res.style = ServerStyle.fromJson(obj.style);
- return res;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ThemeOffset.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ThemeOffset
- * @deprecatedclass SuperMap.ThemeOffset
- * @category iServer Map Theme
- * @classdesc 专题图中文本或符号相对于要素内点的偏移量设置类。
- * 通过该类可以设置专题图中标记文本或符号的偏移量以及偏移量是否随地图缩放而改变。
- * @param {Object} options - 可选参数。
- * @param {boolean} [options.offsetFixed=false] - 当前专题图是否固定标记文本或符号的偏移量。
- * @param {string} [options.offsetX='0.0'] - 专题图中文本或符号相对于要素内点的水平偏移量。
- * @param {string} [options.offsetY='0.0'] - 专题图中文本或符号相对于要素内点的垂直偏移量。
- * @usage
- */
- class ThemeOffset {
- constructor(options) {
- /**
- * @member {boolean} [ThemeOffset.prototype.offsetFixed=false]
- * @description 当前专题图是否固定标记文本或符号的偏移量。所谓固定偏移量,则文本或符号的偏移量不随地图的缩放而变化。
- */
- this.offsetFixed = false;
- /**
- * @member {string} [ThemeOffset.prototype.offsetX=0.0]
- * @description 专题图中文本或符号相对于要素内点的水平偏移量。偏移量的单位为地图单位。
- * 该偏移量的值为一个常量值或者字段表达式所表示的值,即如果字段表达式为 SmID,其中 SmID = 2,那么水平偏移量为2。
- */
- this.offsetX = "0.0";
- /**
- * @member {string} [ThemeOffset.prototype.offsetY=0.0]
- * @description 专题图中文本或符号相对于要素内点的垂直偏移量。偏移量的单位为地图单位。
- * 该偏移量的值为一个常量值或者字段表达式所表示的值,即如果字段表达式为 SmID,其中 SmID = 2,那么垂直偏移量为2。
- */
- this.offsetY = "0.0";
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.ThemeOffset";
- }
- /**
- * @function ThemeOffset.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.offsetFixed = null;
- me.offsetX = null;
- me.offsetY = null;
- }
- /**
- * @function ThemeOffset.fromObj
- * @description 从传入对象获取专题图中文本或符号相对于要素内点的偏移量设置类。
- * @param {Object} obj - 传入对象。
- * @returns {ThemeOffset} ThemeOffset 对象。
- */
- static fromObj(obj) {
- if (!obj) {
- return;
- }
- var res = new ThemeOffset();
- Util.copy(res, obj);
- return res;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/LabelMixedTextStyle.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class LabelMixedTextStyle
- * @deprecatedclass SuperMap.LabelMixedTextStyle
- * @category iServer Map Theme
- * @classdesc 标签文本复合风格类。
- * 该类主要用于对标签专题图中标签的文本内容进行风格设置。通过该类用户可以使标签的文字显示不同的风格,比如文本 “喜马拉雅山”,通过本类可以将前三个字用红色显示,后两个字用蓝色显示。对同一文本设置不同的风格实质上是对文本的字符进行分段,同一分段内的字符具有相同的显示风格。对字符分段有两种方式,一种是利用分隔符对文本进行分段;另一种是根据分段索引值进行分段:</br>
- * 1.利用分隔符对文本进行分段: 比如文本 “5&109” 被分隔符 “&” 分为 “5” 和 “109” 两部分,
- * 在显示时,“5” 和分隔符 “&” 使用同一个风格,字符串 “109” 使用相同的风格。<br>
- * 2.利用分段索引值进行分段: 文本中字符的索引值是以0开始的整数,比如文本 “珠穆朗玛峰”,
- * 第一个字符(“珠”)的索引值为 0,第二个字符(“穆”)的索引值为 1,以此类推;当设置分段索引值为 1,3,4,9 时,
- * 字符分段范围相应的就是 (-∞,1),[1,3),[3,4),[4,9),[9,+∞),可以看出索引号为 0 的字符(即“珠” )在第一个分段内,
- * 索引号为 1,2 的字符(即“穆”、“朗”)位于第二个分段内,索引号为 3 的字符(“玛”)在第三个分段内,索引号为 4 的字符(“峰”)在第四个分段内,其余分段中没有字符。
- * @param {Object} options - 可选参数。
- * @param {ServerTextStyle} [options.defaultStyle] - 默认的文本复合风格。
- * @param {string} [options.separator] - 文本的分隔符。
- * @param {boolean} [options.separatorEnabled=false] - 文本的分隔符是否有效。
- * @param {Array.<number>} [options.splitIndexes] - 分段索引值,分段索引值用来对文本中的字符进行分段。
- * @param {Array.<ServerTextStyle>} [options.styles] - 文本样式集合。
- * @usage
- */
- class LabelMixedTextStyle {
- constructor(options) {
- /**
- * @member {ServerTextStyle} LabelMixedTextStyle.prototype.defaultStyle
- * @description 默认的文本复合风格,即 ServerTextStyle 各字段的默认值。
- */
- this.defaultStyle = null;
- /**
- * @member {string} LabelMixedTextStyle.prototype.separator
- * @description 文本的分隔符,分隔符的风格与前一个字符的风格一样。文本的分隔符是一个将文本分割开的符号,
- * 比如文本 “5_109” 被 “ _ ” 分隔为 “5” 和 “109” 两部分,假设有风格数组:style1、style2。
- * 在显示时,“5” 和分隔符 “ _ ” 使用 Style1 风格渲染,字符串 “109” 使用 Style2 的风格。
- */
- this.separator = null;
- /**
- * @member {boolean} [LabelMixedTextStyle.prototype.separatorEnabled=false]
- * @description 文本的分隔符是否有效。分隔符有效时利用分隔符对文本进行分段;无效时根据文本中字符的位置进行分段。
- * 分段后,同一分段内的字符具有相同的显示风格。
- */
- this.separatorEnabled = false;
- /**
- * @member {Array.<number>} LabelMixedTextStyle.prototype.splitIndexes
- * @description 分段索引值,分段索引值用来对文本中的字符进行分段。
- * 文本中字符的索引值是以 0 开始的整数,比如文本“珠穆朗玛峰”,第一个字符(“珠”)的索引值为0,第二个字符(“穆”)的索引值为 1,
- * 以此类推;当设置分段索引值数组为 [1,3,4,9] 时,字符分段范围相应的就是 (-∞,1),[1,3),[3,4),[4,9),[9,+∞),
- * 可以看出索引号为 0 的字符(即 “珠”)在第一个分段内,索引号为 1,2 的字符(即 “穆”、“朗”)位于第二个分段内,
- * 索引号为 3 的字符(“玛”)在第三个分段内,索引号为 4 的字符(“峰”)在第四个分段内,其余分段中没有字符。
- */
- this.splitIndexes = null;
- /**
- * @member {Array.<ServerTextStyle>} LabelMixedTextStyle.prototype.styles
- * @description 文本样式集合。文本样式集合中的样式根据索引与不同分段一一对应,
- * 如果有分段没有风格对应则使用 defaultStyle。
- */
- this.styles = new ServerTextStyle();
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.LabelMixedTextStyle"
- }
- /**
- * @function LabelMixedTextStyle.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- if (me.defaultStyle) {
- me.defaultStyle.destroy();
- me.defaultStyle = null;
- }
- me.separator = null;
- me.separatorEnabled = null;
- if (me.splitIndexes) {
- me.splitIndexes = null;
- }
- if (me.styles) {
- for (var i = 0, styles = me.styles, len = styles.length; i < len; i++) {
- styles[i].destroy();
- }
- me.styles = null;
- }
- }
- /**
- * @function LabelMixedTextStyle.fromObj
- * @description 从传入对象获取标签文本复合风格类。
- * @param {Object} obj - 传入对象。
- * @returns {LabelMixedTextStyle} 返回新的 LabelMixedTextStyle 对象。
- */
- static fromObj(obj) {
- if (!obj) {
- return;
- }
- var res = new LabelMixedTextStyle();
- var stys = obj.styles;
- Util.copy(res, obj);
- res.defaultStyle = new ServerTextStyle(obj.defaultStyle);
- if (stys) {
- res.styles = [];
- for (var i = 0, len = stys.length; i < len; i++) {
- res.styles.push(new ServerTextStyle(stys[i]));
- }
- }
- return res;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabelText.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ThemeLabelText
- * @deprecatedclass SuperMap.ThemeLabelText
- * @category iServer Map Theme
- * @classdesc 标签中文本风格类。
- * 通过该类可以设置标签中的文本字体大小和显示风格。
- * @param {Object} options - 参数。
- * @param {number} [options.maxTextHeight=0] - 标签中文本的最大高度。
- * @param {number} [options.maxTextWidth=0] - 标签中文本的最大宽度。
- * @param {number} [options.minTextHeight=0] - 标签中文本的最小高度。
- * @param {number} [options.minTextWidth=0] - 标签中文本的最小宽度。
- * @param {ServerTextStyle} [options.uniformStyle] - 统一文本风格。
- * @param {LabelMixedTextStyle} [options.uniformMixedStyle] - 标签专题图统一的文本复合风格。
- * @usage
- */
- class ThemeLabelText {
- constructor(options) {
- /**
- * @member {number} [ThemeLabelText.prototype.maxTextHeight=0]
- * @description 标签中文本的最大高度。当标签文本不固定大小时,即 ServerTextStyle.sizeFixed = false 有效,
- * 当放大后的文本高度超过最大高度之后就不再放大。高度单位为毫米。
- */
- this.maxTextHeight = 0;
- /**
- * @member {number} [ThemeLabelText.prototype.maxTextWidth=0]
- * @description 标签中文本的最大宽度。当标签文本不固定大小时,即 ServerTextStyle.sizeFixed = false 有效,
- * 当放大后的文本宽度超过最大高度之后就不再放大。宽度单位为毫米。
- */
- this.maxTextWidth = 0;
- /**
- * @member {number} [ThemeLabelText.prototype.minTextHeight=0]
- * @description 标签中文本的最小高度。当标签文本不固定大小时,即 ServerTextStyle.sizeFixed = false 有效,
- * 当缩小后的文本高度小于最小高度之后就不再缩小。高度单位为毫米。
- */
- this.minTextHeight = 0;
- /**
- * @member {number} [ThemeLabelText.prototype.minTextWidth=0]
- * @description 标签中文本的最小宽度。当标签文本不固定大小时,即 ServerTextStyle.sizeFixed = false 有效,
- * 当缩小后的文本宽度小于最小宽度之后就不再缩小。宽度单位为毫米。
- */
- this.minTextWidth = 0;
- /**
- * @member {ServerTextStyle} [ThemeLabelText.prototype.uniformStyle]
- * @description 统一文本风格。当标签专题图子项的个数大于等于1时,
- * uniformStyle 不起作用,各标签的风格使用子项中设置的风格。各种风格的优先级从高到低为:uniformMixedStyle(标签文本的复合风格),
- * ThemeLabelItem.style(分段子项的文本风格),uniformStyle(统一文本风格)。
- */
- this.uniformStyle = new ServerTextStyle();
- /**
- *@member {LabelMixedTextStyle} [ThemeLabelText.prototype.uniformMixedStyle]
- *@description 标签专题图统一的文本复合风格。通过该类可以使同一个标
- * 签中的文字使用多种风格显示。各种风格的优先级从高到低为:uniformMixedStyle(标签文本的复合风格),
- * ThemeLabelItem.style(分段子项的文本风格),uniformStyle(统一文本风格)。
- */
- this.uniformMixedStyle = null;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.ThemeLabelText";
- }
- /**
- * @function ThemeLabelText.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.maxTextHeight = null;
- me.maxTextWidth = null;
- me.minTextHeight = null;
- me.minTextWidth = null;
- if (me.uniformStyle) {
- me.uniformStyle.destroy();
- me.uniformStyle = null;
- }
- if (me.uniformMixedStyle) {
- me.uniformMixedStyle.destroy();
- me.uniformMixedStyle = null;
- }
- }
- /**
- * @function ThemeLabelText.fromObj
- * @description 从传入对象获取标签中文本风格类。
- * @param {Object} obj - 传入对象。
- * @returns {ThemeLabelText} ThemeLabelText 对象。
- */
- static fromObj(obj) {
- if (!obj) {
- return;
- }
- var res = new ThemeLabelText();
- Util.copy(res, obj);
- res.uniformStyle = ServerTextStyle.fromObj(obj.uniformStyle);
- res.uniformMixedStyle = LabelMixedTextStyle.fromObj(obj.uniformMixedStyle);
- return res;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabelAlongLine.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ThemeLabelAlongLine
- * @deprecatedclass SuperMap.ThemeLabelAlongLine
- * @category iServer Map Theme
- * @classdesc 标签沿线标注样式类。
- * @param {Object} options - 可选参数。
- * @param {boolean} [options.isAlongLine=true] - 是否沿线显示文本。
- * @param {AlongLineDirection} [options.alongLineDirection=AlongLineDirection.LB_TO_RT] - 标签沿线标注方向。
- * @param {boolean} [options.angleFixed=false] - 当沿线显示文本时,是否将文本角度固定。
- * @param {boolean} [options.repeatedLabelAvoided=false] - 沿线循环标注时是否避免标签重复标注。
- * @param {boolean} [options.repeatIntervalFixed=false] - 循环标注间隔是否固定。
- * @param {number} [options.labelRepeatInterval=0] - 沿线且循环标注时循环标注的间隔。
- * @usage
- */
- class ThemeLabelAlongLine {
- constructor(options) {
- /**
- * @member {boolean} [ThemeLabelAlongLine.prototype.isAlongLine=true]
- * @description 是否沿线显示文本。true 表示沿线显示文本,false 表示正常显示文本。
- */
- this.isAlongLine = true;
- /**
- * @member {AlongLineDirection} [ThemeLabelAlongLine.prototype.alongLineDirection=AlongLineDirection.LB_TO_RT]
- * @description 标签沿线标注方向。
- */
- this.alongLineDirection = AlongLineDirection.LB_TO_RT;
- /**
- * @member {boolean} [ThemeLabelAlongLine.prototype.angleFixed=false]
- * @description 当沿线显示文本时,是否将文本角度固定。true 表示按固定文本角度显示文本,false 表示按照沿线角度显示文本。
- * 如果固定角度,则所有标签均按所设置的文本风格中字体的旋转角度来显示,不考虑沿线标注的方向;
- * 如果不固定角度,在显示标签时会同时考虑字体的旋转角度和沿线标注的方向。
- */
- this.angleFixed = false;
- /**
- * @member {boolean} ThemeLabelAlongLine.prototype.repeatedLabelAvoided
- * @description 沿线循环标注时是否避免标签重复标注。
- */
- this.repeatedLabelAvoided = false;
- /**
- * @member {boolean} [ThemeLabelAlongLine.prototype.repeatIntervalFixed=false]
- * @description 循环标注间隔是否固定。true 表示使用固定循环标注间隔,即使用逻辑坐标来显示循环标注间隔;
- * false 表示循环标注间隔随地图的缩放而变化,即使用地理坐标来显示循环标注间隔。
- */
- this.repeatIntervalFixed = false;
- /**
- * @member {number} [ThemeLabelAlongLine.prototype.labelRepeatInterval=0]
- * @description 沿线且循环标注时循环标注的间隔。长度的单位与地图的地理单位一致。只有设定 RepeatedLabelAvoided 为 true
- * 的时候,labelRepeatInterval 属性才有效。
- */
- this.labelRepeatInterval = 0;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.ThemeLabelAlongLine";
- }
- /**
- * @function ThemeLabelAlongLine.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.isAlongLine = null;
- me.alongLineDirection = null;
- me.angleFixed = null;
- me.repeatedLabelAvoided = null;
- me.repeatIntervalFixed = null;
- me.labelRepeatInterval = null;
- }
- /**
- * @function ThemeLabelAlongLine.fromObj
- * @description 从传入对象获取标签沿线标注样式类。
- * @param {Object} obj - 传入对象。
- * @returns {ThemeLabelAlongLine} ThemeLabelAlongLine 对象。
- */
- static fromObj(obj) {
- if (!obj) {
- return;
- }
- var t = new ThemeLabelAlongLine();
- Util.copy(t, obj);
- return t;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabelBackground.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ThemeLabelBackground
- * @deprecatedclass SuperMap.ThemeLabelBackground
- * @category iServer Map Theme
- * @classdesc 标签背景风格类。通过该类可以设置标签的背景形状和风格。
- * @param {Object} options - 可选参数。
- * @param {LabelBackShape} [options.labelBackShape=LabelBackShape.NONE] - 标签专题图中标签背景的形状枚举类。
- * @param {ServerStyle} [options.backStyle] - 标签专题图中标签背景风格。
- * @usage
- */
- class ThemeLabelBackground {
- constructor(options) {
- /**
- * @member {LabelBackShape} [ThemeLabelBackground.prototype.labelBackShape=LabelBackShape.NONE]
- * @description 标签专题图中标签背景风格。当背景形状
- * labelBackShape 属性设为 NONE(即无背景形状) 时,backStyle 属性无效。
- */
- this.labelBackShape = LabelBackShape.NONE;
- /**
- * @member {ServerStyle} [ThemeLabelBackground.prototype.backStyle]
- * @description 标签专题图中标签背景的形状枚举类。背景类型可
- * 以是矩形、圆角矩形、菱形、椭圆形、三角形和符号等,即不使用任何的形状作为标签的背景。
- */
- this.backStyle = new ServerStyle();
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.ThemeLabelBackground";
- }
- /**
- * @function ThemeLabelBackground.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.labelBackShape = null;
- if (me.backStyle) {
- me.backStyle.destroy();
- me.backStyle = null;
- }
- }
- /**
- * @function ThemeLabelBackground.fromObj
- * @description 从传入对象获取标签背景风格类。
- * @param {Object} obj - 传入对象。
- * @returns {ThemeLabelBackground} ThemeLabelBackground 对象。
- */
- static fromObj(obj) {
- if (!obj) {
- return;
- }
- var t = new ThemeLabelBackground();
- t.labelBackShape = obj.labelBackShape;
- t.backStyle = ServerStyle.fromJson(obj.backStyle);
- return t;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabel.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ThemeLabel
- * @deprecatedclass SuperMap.ThemeLabel
- * @category iServer Map Theme
- * @classdesc 标签专题图类。
- * @extends CommonTheme
- * @param {Object} options - 参数。
- * @param {Array.<ThemeLabelItem>} options.items - 子项数组。
- * @param {string} options.labelExpression - 标注字段表达式。
- * @param {Array.<LabelImageCell|LabelSymbolCell|LabelThemeCell>} options.matrixCells - 矩阵标签元素数组。
- * @param {ThemeLabelAlongLine} [options.alongLine] - 标签沿线标注方向样式类。
- * @param {ThemeLabelBackground} [options.background] - 标签的背景风格类。
- * @param {LabelOverLengthMode} [options.labelOverLengthMode=LabelOverLengthMode.NONE] - 超长标签的处理模式枚举类。
- * @param {number} [options.maxLabelLength=256] - 标签在每一行显示的最大长度。
- * @param {number} [options.numericPrecision=0] - 通过该字段设置其显示的精度。
- * @param {ThemeOffset} [options.offset] - 指定标签专题图中标记文本相对于要素内点的偏移量对象。
- * @param {boolean} [options.overlapAvoided=true] - 是否允许以文本避让方式显示文本。
- * @param {string} [options.rangeExpression] - 制作分段标签专题的分段字段或字段表达式。
- * @param {boolean} [options.smallGeometryLabeled=false] - 是否显示长度大于被标注对象本身长度的标签。
- * @param {ThemeLabelText} options.text - 标签中文本风格。
- * @param {number} [options.textSpace=0] - 沿线标注,相邻两个文字之间的间距,单位当前设置的字高。
- * @param {ThemeMemoryData} [options.memoryData] - 专题图内存数据。
- * @usage
- */
- class ThemeLabel extends Theme {
- constructor(options) {
- super("LABEL", options);
- /**
- * @member {ThemeLabelAlongLine} [ThemeLabel.prototype.alongLine]
- * @description 标签沿线标注方向样式类。
- * 在该类中可以设置标签是否沿线标注以及沿线标注的多种方式。沿线标注属性只适用于线数据集专题图。
- */
- this.alongLine = new ThemeLabelAlongLine();
- /**
- * @member {ThemeLabelBackground} [ThemeLabel.prototype.background]
- * @description 标签专题图中标签的背景风格类。通过该字段可以设置标签的背景形状和风格。
- */
- this.background = new ThemeLabelBackground();
- /**
- * @member {Array.<ThemeLabelItem>} [ThemeLabel.prototype.items]
- * @description 分段标签专题图的子项数组。分段标签专题图使用 rangeExpression
- * 指定数字型的字段作为分段数据,items 中的每个子对象的 [start,end) 分段值必须来源于属性 rangeExpression 的字段值。每个子项拥有自己的风格。
- */
- this.items = null;
- /**
- * @member {Array.<ThemeLabelUniqueItem>} ThemeLabel.prototype.uniqueItems
- * @description 单值标签专题图子项数组。单值标签专题图使用 uniqueExpression单值标签专题图子项集合。
- */
- this.uniqueItems = null;
- /**
- * @member {string} ThemeLabel.prototype.labelExpression
- * @description 标注字段表达式。系统将 labelExpression 对应的字段或字段表达式的值以标签的形式显示在图层中。
- */
- this.labelExpression = null;
- /**
- * @member {LabelOverLengthMode} [ThemeLabel.prototype.labelOverLengthMode=LabelOverLengthMode.NONE] - 标签专题图中超长标签的处理模式枚举类。
- * @description 对于标签的长度超过设置的标签最大长度 maxLabelLength 时称为超长标签。
- */
- this.labelOverLengthMode = LabelOverLengthMode.NONE;
- /**
- * @member {Array.<LabelImageCell|LabelSymbolCell|LabelThemeCell>} ThemeLabel.prototype.matrixCells
- * @description 矩阵标签元素数组,用于制作矩阵标签专题图。
- * 数组中可以放置符号类型的矩阵标签元素和图片类型的矩阵标签元素。
- */
- this.matrixCells = null;
- /**
- * @member {number} [ThemeLabel.prototype.maxLabelLength=256]
- * @description 标签在每一行显示的最大长度,一个中文为两个字符。
- * 如果超过最大长度,可以采用两种方式来处理,一种是换行的模式进行显示,另一种是以省略号方式显示。单位为字符。
- */
- this.maxLabelLength = 256;
- /**
- * @member {number} [ThemeLabel.prototype.numericPrecision=0]
- * @description 如果显示的标签内容为数字,通过该字段设置其显示的精度。例如标签对应的数字是8071.64529347,
- * 如果该属性为0时,显示8071;为1时,显示8071.6;为3时,则是8071.645。
- */
- this.numericPrecision = 0;
- /**
- * @member {ThemeOffset} [ThemeLabel.prototype.offset]
- * @description 用于设置标签专题图中标记文本相对于要素内点的偏移量对象。
- */
- this.offset = new ThemeOffset();
- /**
- * @member {boolean} [ThemeLabel.prototype.overlapAvoided=true]
- * @description 是否允许以文本避让方式显示文本。true 表示自动避免文本叠盖。只针对该标签专题图层中的文本数据。
- * 在标签重叠度很大的情况下,即使使用自动避让功能,可能也无法完全避免标签重叠现象。
- */
- this.overlapAvoided = true;
- /**
- * @member {string} ThemeLabel.prototype.rangeExpression
- * @description 制作分段标签专题的分段字段或字段表达式。该表达式对应的字段(或者字段表达式)的值应该为数值型。
- * 该字段与 items 分段子项联合使用,每个子项的起始值 [start,end)来源于 rangeExpression 字段值。
- * 最后 labelExpression 指定的标签字段(标签专题图要显示的具体内容)会根据分段子项的风格进行分段显示。
- */
- this.rangeExpression = null;
- /**
- * @member {string} ThemeLabel.prototype.uniqueExpression
- * @description 用于制作单值专题图的字段或字段表达式。
- * 该字段值的数据类型可以为数值型或字符型。如果设置字段表达式,只能是相同数据类型字段间的运算。必须与labelExpression一起使用。
- */
- this.uniqueExpression = null;
- /**
- * @member {boolean} [ThemeLabel.prototype.smallGeometryLabeled=false]
- * @description 是否显示长度大于被标注对象本身长度的标签。在标签的长度大于线或者面对象本身的长度时,
- * 如果该值为 true,则标签文字会叠加在一起显示,为了清楚完整的显示该标签,
- * 可以采用换行模式来显示标签,但必须保证每行的长度小于对象本身的长度。
- */
- this.smallGeometryLabeled = false;
- /**
- * @member {ThemeLabelText} ThemeLabel.prototype.text
- * @description 标签中文本风格。
- */
- this.text = new ThemeLabelText();
- /**
- * @member {number} [ThemeLabel.prototype.textSpace=0]
- * @description 沿线标注,相邻两个文字之间的间距,单位当前设置的字高。
- */
- this.textSpace = 0;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.ThemeLabel";
- }
- /**
- * @function ThemeLabel.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- var me = this;
- me.alongLine = null;
- if (me.background) {
- me.background.destroy();
- me.background = null;
- }
- if (me.items) {
- for (var i = 0, items = me.items, len = items.length; i < len; i++) {
- items[i].destroy();
- }
- me.items = null;
- }
- if (me.uniqueItems) {
- for (var j = 0, uniqueItems = me.uniqueItems, uniqueLen = uniqueItems.length; j < uniqueLen; j++) {
- uniqueItems[j].destory();
- }
- me.uniqueItems = null;
- }
- me.labelExpression = null;
- me.labelOverLengthMode = null;
- me.matrixCells = null;
- me.maxLabelLength = null;
- me.numericPrecision = null;
- me.overlapAvoided = null;
- me.rangeExpression = null;
- me.uniqueExpression = null;
- if (me.offset) {
- me.offset.destroy();
- me.offset = null;
- }
- me.overlapAvoided = null;
- me.smallGeometryLabeled = null;
- if (me.text) {
- me.text.destroy();
- me.text = null;
- }
- me.textSpace = null;
- }
- /**
- * @function ThemeLabel.prototype.toJSON
- * @description 将themeLabel对象转化为 JSON 字符串。
- * @returns {string} 返回转换后的 JSON 字符串。
- */
- toJSON() {
- return Util.toJSON(this.toServerJSONObject());
- }
- /**
- * @function ThemeLabel.prototype.toServerJSONObject
- * @description 转换成对应的 JSON 格式对象。
- * @returns {Object} 对应的 JSON 格式对象。
- */
- toServerJSONObject() {
- var obj = {};
- obj.type = this.type;
- obj.memoryData = this.memoryData;
- if (this.alongLine) {
- obj.alongLine = this.alongLine.isAlongLine;
- obj.alongLineDirection = this.alongLine.alongLineDirection;
- obj.angleFixed = this.alongLine.angleFixed;
- obj.isLabelRepeated = this.alongLine.isLabelRepeated;
- obj.labelRepeatInterval = this.alongLine.labelRepeatInterval;
- obj.repeatedLabelAvoided = this.alongLine.repeatedLabelAvoided;
- obj.repeatIntervalFixed = this.alongLine.repeatIntervalFixed;
- }
- if (this.offset) {
- obj.offsetFixed = this.offset.offsetFixed;
- obj.offsetX = this.offset.offsetX;
- obj.offsetY = this.offset.offsetY;
- }
- if (this.text) {
- obj.maxTextHeight = this.text.maxTextHeight;
- obj.maxTextWidth = this.text.maxTextWidth;
- obj.minTextHeight = this.text.minTextHeight;
- obj.minTextWidth = this.text.minTextWidth;
- obj.uniformStyle = this.text.uniformStyle;
- obj.uniformMixedStyle = this.text.uniformMixedStyle;
- }
- if (this.background) {
- obj.labelBackShape = this.background.labelBackShape;
- obj.backStyle = this.background.backStyle;
- }
- obj.labelOverLengthMode = this.labelOverLengthMode;
- obj.maxLabelLength = this.maxLabelLength;
- obj.smallGeometryLabeled = this.smallGeometryLabeled;
- obj.rangeExpression = this.rangeExpression;
- obj.uniqueExpression = this.uniqueExpression;
- obj.numericPrecision = this.numericPrecision;
- obj.items = this.items;
- obj.uniqueItems = this.uniqueItems;
- obj.labelExpression = this.labelExpression;
- obj.overlapAvoided = this.overlapAvoided;
- obj.matrixCells = this.matrixCells;
- obj.textSpace = this.textSpace;
- return obj;
- }
- /**
- * @function ThemeLabel.fromObj
- * @description 从传入对象获取标签专题图类。
- * @param {Object} obj - 传入对象。
- * @returns {ThemeLabel} ThemeLabel 对象。
- */
- static fromObj(obj) {
- if (!obj) {
- return;
- }
- var lab = new ThemeLabel();
- var itemsL = obj.items, itemsU = obj.uniqueItems, cells = obj.matrixCells;
- obj.matrixCells = null;
- Util.copy(lab, obj);
- lab.alongLine = ThemeLabelAlongLine.fromObj(obj);
- lab.background = ThemeLabelBackground.fromObj(obj);
- if (itemsL) {
- lab.items = [];
- for (var i = 0, len = itemsL.length; i < len; i++) {
- lab.items.push(ThemeLabelItem.fromObj(itemsL[i]));
- }
- }
- if (itemsU) {
- lab.uniqueItems = [];
- for (let j = 0, uniqueLen = itemsU.length; j < uniqueLen; j++) {
- lab.uniqueItems.push(ThemeUniqueItem.fromObj(itemsU[j]));
- }
- }
- if (cells) {
- lab.matrixCells = [];
- for (let i = 0, len = cells.length; i < len; i++) {
- //TODO
- //lab.matrixCells.push(LabelMatrixCell.fromObj(cells[i]));
- }
- }
- lab.offset = ThemeOffset.fromObj(obj);
- lab.text = ThemeLabelText.fromObj(obj);
- return lab;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ThemeUnique.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ThemeUnique
- * @deprecatedclass SuperMap.ThemeUnique
- * @category iServer Map Theme
- * @classdesc 单值专题图。单值专题图是利用不同的颜色或符号(线型、填充)表示图层中某一属性信息的不同属性值,属性值相同的要素具有相同的渲染风格。单值专题图多用于具有分类属性的地图上,
- * 比如土壤类型分布图、土地利用图、行政区划图等。单值专题图着重表示现象质的差别,一般不表示数量的特征。尤其是有交叉或重叠现象时,此类不推荐使用,例如:民族分布区等。
- * @extends {CommonTheme}
- * @param {Object} options - 参数。
- * @param {Array.<ThemeUniqueItem>} options.items - 子项类数组。
- * @param {string} options.uniqueExpression - 指定单值专题图的字段或字段表达式。
- * @param {ServerStyle} [options.defaultStyle] - 未参与单值专题图制作的对象的显示风格。
- * @param {ColorGradientType} [options.colorGradientType=ColorGradientType.YELLOW_RED] - 渐变颜色枚举类。
- * @param {ThemeMemoryData} [options.memoryData] - 专题图内存数据。
- * @usage
- */
- class ThemeUnique extends Theme {
- constructor(options) {
- super("UNIQUE", options);
- /**
- * @member {ServerStyle} ThemeUnique.prototype.defaultStyle
- * @description 未参与单值专题图制作的对象的显示风格。
- * 通过单值专题图子项数组 (items)可以指定某些要素参与单值专题图制作,对于那些没有被包含的要素,即不参加单值专题表达的要素,使用该风格显示。
- */
- this.defaultStyle = new ServerStyle();
- /**
- * @member {Array.<ThemeUniqueItem>} ThemeUnique.prototype.items
- * @description 单值专题图子项类数组。
- * 单值专题图是将专题值相同的要素归为一类,为每一类设定一种渲染风格,其中每一类就是一个专题图子项。比如,利用单值专题图制作行政区划图,
- * Name 字段代表省/直辖市名,该字段用来做专题变量,如果该字段的字段值总共有5种不同值,则该行政区划图有 5 个专题图子项。
- */
- this.items = null;
- /**
- * @member {string} ThemeUnique.prototype.uniqueExpression
- * @description 用于制作单值专题图的字段或字段表达式。
- * 该字段值的数据类型可以为数值型或字符型。如果设置字段表达式,只能是相同数据类型字段间的运算。
- */
- this.uniqueExpression = null;
- /**
- * @member {ColorGradientType} [ThemeUnique.prototype.colorGradientType=ColorGradientType.YELLOW_RED]
- * @description 渐变颜色枚举类。
- * 渐变色是由起始色根据一定算法逐渐过渡到终止色的一种混合型颜色。
- * 该类作为单值专题图参数类、分段专题图参数类的属性,负责设置单值专题图、分段专题图的配色方案,在默认情况下专题图所有子项会根据这个配色方案完成填充。
- * 但如果为某几个子项的风格进行单独设置后(设置了 ThemeUniqueItem 或 ThemeRangeItem 类中Style属性),
- * 该配色方案对于这几个子项将不起作用。
- */
- this.colorGradientType = ColorGradientType.YELLOW_RED;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.ThemeUnique";
- }
- /**
- * @function ThemeUnique.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- var me = this;
- me.uniqueExpression = null;
- me.colorGradientType = null;
- if (me.items) {
- if (me.items.length > 0) {
- for (var item in me.items) {
- me.items[item].destroy();
- me.items[item] = null;
- }
- }
- me.items = null;
- }
- if (me.defaultStyle) {
- me.defaultStyle.destroy();
- me.defaultStyle = null;
- }
- }
- /**
- * @function ThemeUnique.prototype.toServerJSONObject
- * @description 转换成对应的 JSON 格式对象。
- * @returns {Object} 对应的 JSON 格式对象。
- */
- toServerJSONObject() {
- var obj = {};
- obj = Util.copyAttributes(obj, this);
- if (obj.defaultStyle) {
- if (obj.defaultStyle.toServerJSONObject) {
- obj.defaultStyle = obj.defaultStyle.toServerJSONObject();
- }
- }
- if (obj.items) {
- var items = [],
- len = obj.items.length;
- for (var i = 0; i < len; i++) {
- items.push(obj.items[i].toServerJSONObject());
- }
- obj.items = items;
- }
- return obj;
- }
- /**
- * @function ThemeUnique.fromObj
- * @description 从传入对象获取单值专题图类。
- * @param {Object} obj - 传入对象。
- * @returns {ThemeUnique} ThemeUnique 对象。
- */
- static fromObj(obj) {
- var res = new ThemeUnique();
- var uItems = obj.items;
- var len = uItems ? uItems.length : 0;
- Util.extend(res, obj);
- res.items = [];
- res.defaultStyle = ServerStyle.fromJson(obj.defaultStyle);
- for (var i = 0; i < len; i++) {
- res.items.push(ThemeUniqueItem.fromObj(uItems[i]));
- }
- return res;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraphAxes.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ThemeGraphAxes
- * @deprecatedclass SuperMap.ThemeGraphAxes
- * @category iServer Map Theme
- * @classdesc 统计专题图坐标轴样式类。
- * @param {Object} options - 参数。
- * @param {ServerColor} [options.axesColor=(0, 0, 0)] - 坐标轴颜色。
- * @param {boolean} [options.axesDisplayed=false] - 是否显示坐标轴。
- * @param {boolean} [options.axesGridDisplayed=false] - 是否在统计图坐标轴上显示网格。
- * @param {boolean} [options.axesTextDisplayed=false] - 是否显示坐标轴的文本标注。
- * @param {ServerTextStyle} [options.axesTextStyle] - 统计符号的最大最小尺寸。
- * @usage
- */
- class ThemeGraphAxes {
- constructor(options) {
- /**
- * @member {ServerColor} [ThemeGraphAxes.prototype.axesColor=(0, 0, 0)]
- * @description 坐标轴颜色。当 axesDisplayed = true 时有效。
- */
- this.axesColor = new ServerColor(0, 0, 0);
- /**
- * @member {boolean} [ThemeGraphAxes.prototype.axesDisplayed=false]
- * @description 是否显示坐标轴。<br>
- * 由于饼状图和环状图无坐标轴,故该属性以及所有与坐标轴设置相关的属性都不适用于它们。并且只有当该值为 true 时,其它设置坐标轴的属性才起作用。
- */
- this.axesDisplayed = false;
- /**
- * @member {boolean} [ThemeGraphAxes.prototype.axesGridDisplayed=false]
- * @description 是否在统计图坐标轴上显示网格。
- */
- this.axesGridDisplayed = false;
- /**
- * @member {boolean} [ThemeGraphAxes.prototype.axesTextDisplayed=false]
- * @description 是否显示坐标轴的文本标注。
- */
- this.axesTextDisplayed = false;
- /**
- * @member {ServerTextStyle} ThemeGraphAxes.prototype.axesTextStyle
- * @description 坐标轴文本风格。当 axesTextDisplayed = true 时有效。
- */
- this.axesTextStyle = new ServerTextStyle();
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.ThemeGraphAxes";
- }
- /**
- * @function ThemeGraphAxes.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- if (me.axesColor) {
- me.axesColor.destroy();
- me.axesColor = null;
- }
- me.axesDisplayed = null;
- me.axesGridDisplayed = null;
- me.axesTextDisplayed = null;
- if (me.axesTextStyle) {
- me.axesTextStyle.destroy();
- me.axesTextStyle = null;
- }
- }
- /**
- * @function ThemeGraphAxes.fromObj
- * @description 从传入对象获取统计专题图坐标轴样式类。
- * @param {Object} obj - 传入对象。
- * @returns {ThemeGraphAxes} ThemeGraphAxes 对象。
- */
- static fromObj(obj) {
- if (!obj) {
- return;
- }
- var res = new ThemeGraphAxes();
- Util.copy(res, obj);
- res.axesColor = ServerColor.fromJson(obj.axesColor);
- res.axesTextStyle = ServerTextStyle.fromObj(obj.axesTextStyle);
- return res;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraphSize.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ThemeGraphSize
- * @deprecatedclass SuperMap.ThemeGraphSize
- * @category iServer Map Theme
- * @classdesc 统计专题图符号尺寸类。
- * @param {Object} options - 参数。
- * @param {number} [options.maxGraphSize=0] - 统计图中显示的最大图表尺寸基准值。
- * @param {number} [options.minGraphSize=0] - 统计图中显示的最小图表尺寸基准值。
- * @usage
- */
- class ThemeGraphSize {
- constructor(options) {
- /**
- * @member {number} [ThemeGraphSize.prototype.maxGraphSize=0]
- * @description 获取或设置统计图中显示的最大图表尺寸基准值,单位为像素。
- */
- this.maxGraphSize = 0;
- /**
- * @member {number} [ThemeGraphSize.prototype.minGraphSize=0]
- * @description 获取或设置统计图中显示的最小图表尺寸基准值,单位为像素。
- */
- this.minGraphSize = 0;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.ThemeGraphSize";
- }
- /**
- * @function ThemeGraphSize.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.maxGraphSize = null;
- me.minGraphSize = null;
- }
- /**
- * @function ThemeGraphSize.fromObj
- * @description 从传入对象获统计专题图符号尺寸类。
- * @param {Object} obj - 传入对象。
- * @returns {ThemeGraphSize} ThemeGraphSize 对象。
- */
- static fromObj(obj) {
- var res = new ThemeGraphSize();
- Util.copy(res, obj);
- return res;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraphText.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ThemeGraphText
- * @deprecatedclass SuperMap.ThemeGraphText
- * @category iServer Map Theme
- * @classdesc 统计图文字标注风格类。
- * @param {Object} options - 可选参数。
- * @param {boolean} [options.graphTextDisplayed=false] - 是否显示统计图上的文字标注。
- * @param {ThemeGraphTextFormat} [options.graphTextFormat=ThemeGraphTextFormat.CAPTION] - 统计专题图文本显示格式。
- * @param {ServerTextStyle} [options.graphTextStyle] - 统计图上的文字标注风格。
- * @usage
- */
- class ThemeGraphText {
- constructor(options) {
- /**
- * @member {boolean} [ThemeGraphText.prototype.graphTextDisplayed=false]
- * @description 是否显示统计图上的文字标注。
- */
- this.graphTextDisplayed = false;
- /**
- * @member {ThemeGraphTextFormat} [ThemeGraphText.prototype.graphTextFormat=ThemeGraphTextFormat.CAPTION]
- * @description 统计专题图文本显示格式。
- * 文本显示格式包括百分数、真实数值、标题、标题+百分数、标题+真实数值。
- */
- this.graphTextFormat = ThemeGraphTextFormat.CAPTION;
- /**
- * @member {ServerTextStyle} ThemeGraphText.prototype.graphTextStyle
- * @description 统计图上的文字标注风格。
- */
- this.graphTextStyle = new ServerTextStyle();
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.ThemeGraphText";
- }
- /**
- * @function ThemeGraphText.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.graphTextDisplayed = null;
- me.graphTextFormat = null;
- if (me.graphTextStyle) {
- me.graphTextStyle.destroy();
- me.graphTextStyle = null;
- }
- }
- /**
- * @function ThemeGraphText.fromObj
- * @description 从传入对象获取统计图文字标注风格类。
- * @param {Object} obj - 传入对象。
- * @returns {ThemeGraphText} ThemeGraphText 对象。
- */
- static fromObj(obj) {
- var res = new ThemeGraphText();
- Util.copy(res, obj);
- res.graphTextStyle = ServerTextStyle.fromObj(obj.graphTextStyle);
- return res;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraphItem.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ThemeGraphItem
- * @deprecatedclass SuperMap.ThemeGraphItem
- * @category iServer Map Theme
- * @classdesc 统计专题图子项类。
- * @param {Object} options - 参数。
- * @param {string} [options.caption] - 专题图子项的名称。
- * @param {string} options.graphExpression - 统计专题图的专题变量。
- * @param {Array.<number>} [options.memoryDoubleValues] - 内存数组方式制作专题图时的值数组。
- * @param {ServerStyle} [options.uniformStyle] - 统计专题图子项的显示风格
- * @usage
- */
- class ThemeGraphItem {
- constructor(options) {
- /**
- * @member {string} [ThemeGraphItem.prototype.caption]
- * @description 专题图子项的名称。
- */
- this.caption = null;
- /**
- * @member {string} ThemeGraphItem.prototype.graphExpression
- * @description 统计专题图的专题变量。专题变量可以是一个字段或字段表达式。字段必须为数值型;表达式只能为数值型的字段间的运算。
- */
- this.graphExpression = null;
- /**
- * @member {Array.<number>} [ThemeGraphItem.prototype.memoryDoubleValues]
- * @description 内存数组方式制作专题图时的值数组。<br>
- * 内存数组方式制作专题图时,只对 SmID 值在键数组({@link ThemeGraph#memoryKeys})中的记录制作专题图。
- * 值数组的数值个数必须与键数组中数值的个数一致。 值数组中的值将代替原来的专题值来制作统计专题图。
- * 比如:利用面积字段和周长字段(即有两个统计专题图子项 )作为专题变量制作统计专题图。
- */
- this.memoryDoubleValues = null;
- /**
- * @member {ServerStyle} [ThemeGraphItem.prototype.uniformStyle]
- * @description 统计专题图子项的显示风格。
- * 每一个统计专题图子项都对应一种显示风格。
- */
- this.uniformStyle = new ServerStyle();
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.ThemeGraphItem";
- }
- /**
- * @function ThemeGraphItem.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.caption = null;
- me.graphExpression = null;
- me.memoryDoubleValues = null;
- me.uniformStyle = null;
- }
- /**
- * @function ThemeGraphItem.fromObj
- * @description 从传入对象获取统计专题图子项类。
- * @param {Object} obj - 传入对象。
- * @returns {ThemeGraphItem} ThemeGraphItem 对象。
- */
- static fromObj(obj) {
- if (!obj) {
- return;
- }
- var res = new ThemeGraphItem();
- Util.copy(res, obj);
- res.uniformStyle = ServerStyle.fromJson(obj.uniformStyle);
- return res;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraph.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ThemeGraph
- * @deprecatedclass SuperMap.ThemeGraph
- * @category iServer Map Theme
- * @classdesc 统计专题图类。
- * @extends {CommonTheme}
- * @param {Object} options - 参数。
- * @param {Array.<ThemeGraphItem>} options.items - 统计专题图子项集合。
- * @param {number} [options.barWidth=0] - 柱状专题图中每一个柱的宽度。
- * @param {GraduatedMode} [options.graduatedMode=GraduatedMode.CONSTANT] - 统计图中地理要素的值与图表尺寸间的映射关系。
- * @param {ThemeGraphAxes} [options.graphAxes] - 统计图中坐标轴样式相关信息。
- * @param {ThemeGraphSize} [options.graphSize=0] - 统计符号的最大最小尺寸。
- * @param {boolean} [options.graphSizeFixed=false] - 缩放地图时统计图符号是否固定大小。
- * @param {ThemeGraphText} [options.graphText] - 统计图上的文字是否可以见以及文字标注风格。
- * @param {GraphAxesTextDisplayMode} [options.graphAxesTextDisplayMode=GraphAxesTextDisplayMode.NONE] - 统计专题图坐标轴文本显示模式。
- * @param {ThemeGraphType} [options.graphType=ThemeGraphType.AREA] - 统计专题图类型。
- * @param {Array.<number>} [options.memoryKeys] - 以内存数组方式制作专题图时的键数组。
- * @param {boolean} [options.negativeDisplayed=false] - 专题图中是否显示属性为负值的数据。
- * @param {ThemeOffset} [options.offset] - 统计图相对于要素内点的偏移量。
- * @param {boolean} [options.overlapAvoided=true] - 统计图是否采用避让方式显示。
- * @param {number} [options.roseAngle=0] - 统计图中玫瑰图或三维玫瑰图用于等分的角度。
- * @param {number} [options.startAngle=0] - 饼状统计图扇形的起始角度。
- * @usage
- */
- class ThemeGraph extends Theme {
- constructor(options) {
- super("GRAPH", options);
- /**
- * @member {number} [ThemeGraph.prototype.barWidth=0]
- * @description 柱状专题图中每一个柱的宽度。使用地图坐标单位。
- * 只有选择的统计图类型为柱状图(柱状图、三维柱状图、堆叠柱状图、三维堆叠柱状图)时,此项才可设置。
- */
- this.barWidth = 0;
- /**
- * @member {GraduatedMode} [ThemeGraph.prototype.graduatedMode=GraduatedMode.CONSTANT]
- * @description 统计图中地理要素的值与图表尺寸间的映射关系(常数、对数、平方根),即分级方式。
- * 分级主要是为了减少制作统计专题图中数据大小之间的差异,使得统计图的视觉效果比较好,同时不同类别之间的比较也还是有意义的。
- * 提供三种分级模式:常数、对数和平方根,对于有值为负数的字段,不可以采用对数和平方根的分级方式。不同的等级方式用于确定符号大小的数值是不相同的。
- */
- this.graduatedMode = GraduatedMode.CONSTANT;
- /**
- * @member {ThemeGraphAxes} ThemeGraph.prototype.graphAxes
- * @description 用于设置统计图中坐标轴样式相关信息,如坐标轴颜色、是否显示、坐标文本样式等。
- */
- this.graphAxes = new ThemeGraphAxes();
- /**
- * @member {ThemeGraphSize} [ThemeGraph.prototype.graphSize=0]
- * @description 用于设置统计符号的最大最小尺寸。
- */
- this.graphSize = new ThemeGraphSize();
- /**
- * @member {boolean} [ThemeGraph.prototype.graphSizeFixed=false]
- * @description 缩放地图时统计图符号是否固定大小。即统计图符号将随地图缩放。
- */
- this.graphSizeFixed = false;
- /**
- * @member {ThemeGraphText} ThemeGraph.prototype.graphText
- * @description 统计图上的文字是否可以见以及文字标注风格。
- */
- this.graphText = new ThemeGraphText();
- /**
- * @member {ThemeGraphType} [ThemeGraph.prototype.graphType=ThemeGraphType.AREA]
- * @description 统计专题图类型。SuperMap 提供了多种类型的统计图,
- * 分别为面积图、阶梯图、折线图、点状图、柱状图、三维柱状图、饼图、三维饼图、玫瑰图、三维玫瑰图、堆叠柱状图、三维堆叠柱状图、环状图。默认为面积图。
- */
- this.graphType = ThemeGraphType.AREA;
- /**
- * @member {GraphAxesTextDisplayMode} [ThemeGraph.prototype.graphAxesTextDisplayMode=GraphAxesTextDisplayMode.NONE]
- * @description 统计专题图坐标轴文本显示模式。
- */
- this.graphAxesTextDisplayMode = GraphAxesTextDisplayMode.NONE;
- /**
- * @member {Array.<ThemeGraphItem>} ThemeGraph.prototype.items
- * @description 统计专题图子项集合。
- * 统计专题图可以基于多个变量,反映多种属性,即可以将多个专题变量的值绘制在一个统计图上。每一个专题变量对应的统计图即为一个专题图子项。
- * 对于每个专题图子项可以为其设置标题、风格,甚至可以将该子项再制作成范围分段专题图。
- */
- this.items = null;
- /**
- * @member {Array.<number>} ThemeGraph.prototype.memoryKeys
- * @description 以内存数组方式制作专题图时的键数组。
- * 键数组内的数值代表 SmID 值,它与 {@link ThemeGraphItem} 类中的值数组({@link ThemeGraphItem#memoryDoubleValues})要关联起来应用。
- * 键数组中数值的个数必须要与值数组的数值个数一致。值数组中的值将代替原来的专题值来制作统计专题图。
- * 目前所有的专题图都支持以内存数组的方式制作专题图,但统计专题图与其他专题图指定内存数组的方式不同,
- * 统计专题图使用 memoryKeys 指定内存数组,而其他专题图则使用 memoryData 来指定内存数组。
- * @example
- * memoryKeys 的使用方法如下:
- * function addThemeGraph() {
- * removeTheme();
- * //创建统计专题图对象,ThemeGraph 必设 items。
- * //专题图参数 ThemeParameters 必设 theme(即以设置好的分段专题图对象)、dataSourceName 和 datasetName
- * var style1 = new ServerStyle({
- * fillForeColor: new ServerColor(92,73,234),
- * lineWidth: 0.1
- * }),
- * style2 = new ServerStyle({
- * fillForeColor: new ServerColor(211,111,240),
- * lineWidth: 0.1
- * }),
- * item1 = new ThemeGraphItem({
- * memoryDoubleValues:[1.18,0.95,0.37,1.31,0.8,1.5],
- * caption: "1992-1995人口增长率",
- * graphExpression: "Pop_Rate95",
- * uniformStyle: style1
- * }),
- * item2 = new ThemeGraphItem({
- * //以内存数组方式制作专题图时的值数组
- * memoryDoubleValues:[2.71,0,0.74,3.1,2.2,3.5],
- * caption: "1995-1999人口增长率", //专题图子项的名称
- * graphExpression: "Pop_Rate99", //统计专题图的专题变量
- * uniformStyle: style2 //统计专题图子项的显示风格
- * }),
- * themeGraph = new ThemeGraph({
- * //以内存数组方式制作专题图时的键数组,键数组内的数值代表 SmID 值
- * memoryKeys:[1,2,4,8,10,12],
- * items: new Array(item1,item2),
- * barWidth: 0.03,
- * //统计图中地理要素的值与图表尺寸间的映射关系为平方根
- * graduatedMode: GraduatedMode.SQUAREROOT,
- * //graphAxes用于设置统计图中坐标轴样式相关信息
- * graphAxes: new ThemeGraphAxes({
- * axesDisplayed: true
- * }),
- * graphSize: new ThemeGraphSize({
- * maxGraphSize: 1,
- * minGraphSize: 0.35
- * }),
- * //统计图上的文字是否可以见以及文字标注风格
- * graphText: new ThemeGraphText({
- * graphTextDisplayed: true,
- * graphTextFormat: ThemeGraphTextFormat.VALUE,
- * graphTextStyle: new ServerTextStyle({
- * sizeFixed: true,
- * fontHeight: 9,
- * fontWidth: 5
- * })
- * }),
- * //统计专题图类型为三维柱状图
- * graphType: ThemeGraphType.BAR3D
- * }),
- * //专题图参数对象
- * themeParameters = new ThemeParameters({
- * themes: [themeGraph],
- * dataSourceNames: ["Jingjin"],
- * datasetNames: ["BaseMap_R"]
- * }),
- * //与服务端交互
- * themeService=new ThemeService(url, {
- * eventListeners: {
- * "processCompleted": ThemeCompleted,
- * "processFailed": themeFailed
- * }
- * });
- * themeService.processAsync(themeParameters);
- * }
- */
- this.memoryKeys = null;
- /**
- * @member {boolean} [ThemeGraph.prototype.negativeDisplayed=false]
- * @description 专题图中是否显示属性为负值的数据。true 表示显示;falese 不显示。
- */
- this.negativeDisplayed = false;
- /**
- * @member {ThemeOffset} ThemeGraph.prototype.offset
- * @description 用于设置统计图相对于要素内点的偏移量。
- */
- this.offset = new ThemeOffset();
- /**
- * @member {boolean} ThemeGraph.prototype.overlapAvoided
- * @description 统计图是否采用避让方式显示。<br>
- * 1.对数据集制作统计专题图:当统计图采用避让方式显示时,如果 overlapAvoided 为 true,则在统计图重叠度很大的情况下,
- * 会出现无法完全避免统计图重叠的现象;如果 overlapAvoided 为 false,会过滤掉一些统计图,从而保证所有的统计图均不重叠。<br>
- * 2.对数据集同时制作统计专题图和标签专题图:当统计图不显示子项文本时,标签专题图的标签即使和统计图重叠,两者也都可正常显示;
- * 当统计图显示子项文本时,如果统计图中的子项文本和标签专题图中的标签不重叠,则两者均正常显示;如果重叠,则会过滤掉统计图的子项文本,只显示标签。
- */
- this.overlapAvoided = true;
- /**
- * @member {number} [ThemeGraph.prototype.roseAngle=0]
- * @description 统计图中玫瑰图或三维玫瑰图用于等分的角度,默认为 0 度,精确到 0.1 度。在角度为0或者大于 360 度的情况下均使用 360 度来等分制作统计图的字段数。
- */
- this.roseAngle = 0;
- /**
- * @member {number} [ThemeGraph.prototype.startAngle=0]
- * @description 饼状统计图扇形的起始角度。精确到 0.1 度,以水平方向为正向。只有选择的统计图类型为饼状图(饼图、三维饼图、玫瑰图、三维玫瑰图)时,此项才可设置。
- */
- this.startAngle = 0;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.ThemeGraph";
- }
- /**
- * @function ThemeGraph.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- var me = this;
- me.barWidth = null;
- me.graduatedMode = null;
- if (me.graphAxes) {
- me.graphAxes.destroy();
- me.graphAxes = null;
- }
- if (me.graphSize) {
- me.graphSize.destroy();
- me.graphSize = null;
- }
- me.graphSizeFixed = null;
- if (me.graphText) {
- me.graphText.destroy();
- me.graphText = null;
- }
- me.graphType = null;
- if (me.items) {
- for (var i = 0, items = me.items, len = items.length; i < len; i++) {
- items[i].destroy();
- }
- me.items = null;
- }
- me.memoryKeys = null;
- me.negativeDisplayed = null;
- if (me.offset) {
- me.offset.destroy();
- me.offset = null;
- }
- me.overlapAvoided = null;
- me.roseAngle = null;
- me.startAngle = null;
- me.graphAxesTextDisplayMode = null;
- }
- /**
- * @function ThemeGraph.prototype.toJSON
- * @description 将 ThemeGraph 对象转化为 JSON 字符串。
- * @returns {string} 返回转换后的 JSON 字符串。
- */
- toJSON() {
- return Util.toJSON(this.toServerJSONObject());
- }
- /**
- * @function ThemeGraph.prototype.toServerJSONObject
- * @description 转换成对应的 JSON 格式对象。
- * @returns {Object} 对应的 JSON 格式对象。
- */
- toServerJSONObject() {
- var obj = {};
- obj.type = this.type;
- if (this.graphText) {
- obj.graphTextDisplayed = this.graphText.graphTextDisplayed;
- obj.graphTextFormat = this.graphText.graphTextFormat;
- obj.graphTextStyle = this.graphText.graphTextStyle;
- }
- if (this.graphAxes) {
- obj.axesColor = this.graphAxes.axesColor;
- obj.axesDisplayed = this.graphAxes.axesDisplayed;
- obj.axesGridDisplayed = this.graphAxes.axesGridDisplayed;
- obj.axesTextDisplayed = this.graphAxes.axesTextDisplayed;
- obj.axesTextStyle = this.graphAxes.axesTextStyle;
- }
- if (this.graphSize) {
- obj.maxGraphSize = this.graphSize.maxGraphSize;
- obj.minGraphSize = this.graphSize.minGraphSize;
- }
- if (this.offset) {
- obj.offsetFixed = this.offset.offsetFixed;
- obj.offsetX = this.offset.offsetX;
- obj.offsetY = this.offset.offsetY;
- }
- obj.barWidth = this.barWidth;
- obj.graduatedMode = this.graduatedMode;
- obj.graphSizeFixed = this.graphSizeFixed;
- obj.graphType = this.graphType;
- obj.graphAxesTextDisplayMode = this.graphAxesTextDisplayMode;
- obj.items = this.items;
- obj.memoryKeys = this.memoryKeys;
- obj.negativeDisplayed = this.negativeDisplayed;
- obj.overlapAvoided = this.overlapAvoided;
- obj.roseAngle = this.roseAngle;
- obj.startAngle = this.startAngle;
- return obj;
- }
- /**
- * @function ThemeGraph.fromObj
- * @description 从传入对象获取统计专题图类。
- * @param {Object} obj - 传入对象。
- * @returns {ThemeGraph} ThemeGraph 对象。
- */
- static fromObj(obj) {
- var res = new ThemeGraph();
- var itemsG = obj.items;
- var len = itemsG ? itemsG.length : 0;
- Util.copy(res, obj);
- res.items = [];
- res.graphAxes = ThemeGraphAxes.fromObj(obj);
- res.graphSize = ThemeGraphSize.fromObj(obj);
- res.graphText = ThemeGraphText.fromObj(obj);
- res.offset = ThemeOffset.fromObj(obj);
- for (var i = 0; i < len; i++) {
- res.items.push(ThemeGraphItem.fromObj(itemsG[i]));
- }
- return res;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ThemeDotDensity.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ThemeDotDensity
- * @deprecatedclass SuperMap.ThemeDotDensity
- * @category iServer Map Theme
- * @classdesc 点密度专题图。点密度专题图用一定大小、形状相同的点表示现象分布范围、数量特征和分布密度。点的多少和所代表的意义由地图的内容确定。
- * 点密度专题图利用图层的某一数值属性信息(专题值)映射为不同等级,每一级别使用不同数量或表现为密度的点符号来表示。
- * 该专题值在各个分区内的分布情况,体现不同区域的相对数量差异。多用于具有数量特征的地图上,
- * 比如表示不同地区的粮食产量、GDP、人口等的分级,主要针对区域或面状的要素,因而,点密度专题图适用于面数据集。
- * 注意:点密度专题图中点的分布是随机的,并不代表实际的分布位置。即使在相关设置完全相同的情况下,
- * 每次制作出的专题图,点的数量相同,但点的位置都有差异。
- * @extends {CommonTheme}
- * @param {Object} options - 参数。
- * @param {string} options.dotExpression - 创建点密度专题图的字段或字段表达式。
- * @param {ServerStyle} [options.style] - 点密度专题图中点的风格。
- * @param {number} [options.value] - 专题图中每一个点所代表的数值。
- * @param {ThemeMemoryData} [options.memoryData] - 专题图内存数据。
- * @usage
- */
- class ThemeDotDensity extends Theme {
- constructor(options) {
- super("DOTDENSITY", options);
- /**
- * @member {string} ThemeDotDensity.prototype.dotExpression
- * @description 创建点密度专题图的字段或字段表达式。点的数目或密集程度的来源。
- */
- this.dotExpression = null;
- /**
- * @member {ServerStyle} ThemeDotDensity.prototype.style
- * @description 点密度专题图中点的风格。
- */
- this.style = new ServerStyle();
- /**
- * @member {number} ThemeDotDensity.prototype.value
- * @description 专题图中每一个点所代表的数值。<br>
- * 点值的确定与地图比例尺以及点的大小有关。地图比例尺越大,相应的图面范围也越大,
- * 点相应就可以越多,此时点值就可以设置相对小一些。点形状越大,
- * 点值相应就应该设置的小一些。点值过大或过小都是不合适的。
- */
- this.value = null;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.ThemeDotDensity";
- }
- /**
- * @function ThemeDotDensity.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.dotExpression = null;
- me.value = null;
- if (me.style) {
- me.style.destroy();
- me.style = null;
- }
- }
- /**
- * @function ThemeDotDensity.prototype.toServerJSONObject
- * @description 转换成对应的 JSON 格式对象。
- * @returns {Object} 对应的 JSON 格式对象。
- */
- toServerJSONObject() {
- var obj = {};
- obj = Util.copyAttributes(obj, this);
- if (obj.style) {
- if (obj.style.toServerJSONObject) {
- obj.style = obj.style.toServerJSONObject();
- }
- }
- return obj;
- }
- /**
- * @function ThemeDotDensity.fromObj
- * @description 从传入对象获取点密度专题图中点的风格。
- * @param {Object} obj - 传入对象。
- * @returns {ThemeDotDensity} ThemeDotDensity 对象。
- */
- static fromObj(obj) {
- if (!obj) {
- return;
- }
- var res = new ThemeDotDensity();
- Util.copy(res, obj);
- res.style = ServerStyle.fromJson(obj.style);
- return res;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraduatedSymbolStyle.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ThemeGraduatedSymbolStyle
- * @deprecatedclass SuperMap.ThemeGraduatedSymbolStyle
- * @category iServer Map Theme
- * @classdesc 等级符号专题图正负零值显示风格类。
- * @param {Object} options - 参数。
- * @param {boolean} [options.negativeDisplayed=false] - 是否显示负值。
- * @param {ServerStyle} [options.negativeStyle] - 负值的等级符号风格。
- * @param {ServerStyle} [options.positiveStyle] - 正值的等级符号风格。
- * @param {boolean} [options.zeroDisplayed=false] - 是否显示 0 值。
- * @param {ServerStyle} [options.zeroStyle] - 0 值的等级符号风格。
- * @usage
- */
- class ThemeGraduatedSymbolStyle {
- constructor(options) {
- /**
- * @member {boolean} [ThemeGraduatedSymbolStyle.prototype.negativeDisplayed=false]
- * @description 是否显示负值。
- */
- this.negativeDisplayed = false;
- /**
- * @member {ServerStyle} [ThemeGraduatedSymbolStyle.prototype.negativeStyle]
- * @description 负值的等级符号风格。
- */
- this.negativeStyle = new ServerStyle();
- /**
- * @member {ServerStyle} [ThemeGraduatedSymbolStyle.prototype.positiveStyle]
- * @description 正值的等级符号风格。
- */
- this.positiveStyle = new ServerStyle();
- /**
- * @member {boolean} [ThemeGraduatedSymbolStyle.prototype.zeroDisplayed=false]
- * @description 是否显示 0 值。
- */
- this.zeroDisplayed = false;
- /**
- * @member {ServerStyle} ThemeGraduatedSymbolStyle.prototype.zeroStyle
- * @description 0 值的等级符号风格。
- */
- this.zeroStyle = new ServerStyle();
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.ThemeGraduatedSymbolStyle";
- }
- /**
- * @function ThemeGraduatedSymbolStyle.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.negativeDisplayed = null;
- me.negativeStyle = null;
- me.positiveStyle = null;
- me.zeroDisplayed = null;
- me.zeroStyle = null;
- }
- /**
- * @function ThemeGraduatedSymbolStyle.fromObj
- * @description 从传入对象获取等级符号专题图正负零值显示风格类。
- * @param {Object} obj - 传入对象。
- * @returns {ThemeGraduatedSymbolStyle} ThemeGraduatedSymbolStyle 对象。
- */
- static fromObj(obj) {
- if (!obj) {
- return;
- }
- var res = new ThemeGraduatedSymbolStyle();
- Util.copy(res, obj);
- res.negativeStyle = ServerStyle.fromJson(obj.negativeStyle);
- res.positiveStyle = ServerStyle.fromJson(obj.positiveStyle);
- res.zeroStyle = ServerStyle.fromJson(obj.zeroStyle);
- return res;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraduatedSymbol.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ThemeGraduatedSymbol
- * @deprecatedclass SuperMap.ThemeGraduatedSymbol
- * @category iServer Map Theme
- * @classdesc 等级符号专题图。
- * @extends {CommonTheme}
- * @param {Object} options - 参数。
- * @param {ThemeGraduatedSymbolStyle} options.style - 等级符号专题图正负零值显示风格类。
- * @param {string} options.expression - 等级符号专题图的字段或字段表达式。
- * @param {number} [options.baseValue=0] - 等级符号专题图的基准值,单位同专题变量的单位。
- * @param {GraduatedMode} [options.graduatedMode=GraduatedMode.CONSTANT] - 等级符号专题图分级模式。
- * @param {ThemeOffset} [options.offset] - 指定标签专题图中标记文本相对于要素内点的偏移量对象。
- * @param {ThemeMemoryData} [options.memoryData] - 专题图内存数据。
- * @usage
- */
- class ThemeGraduatedSymbol extends Theme {
- constructor(options) {
- super("GRADUATEDSYMBOL", options);
- /**
- * @member {number} [ThemeGraduatedSymbol.prototype.baseValue=0]
- * @description 等级符号专题图的基准值,单位同专题变量的单位。<br>
- * 依据此值系统会自动根据分级方式计算其余值对应的符号大小,每个符号的显示大小等于
- * ThemeValueSection.positiveStyle(或 zeroStyle,negativeStyle).markerSize * value / basevalue,
- * 其中 value 是 expression 所指定字段对应的值经过分级计算之后的值。默认值为0,建议通过多次尝试设置该值才能达到较好的显示效果。
- */
- this.baseValue = 0;
- /**
- * @member {string} ThemeGraduatedSymbol.prototype.expression
- * @description 用于创建等级符号专题图的字段或字段表达式,字段或字段表达式应为数值型。
- */
- this.expression = null;
- /**
- * @member {GraduatedMode} [ThemeGraduatedSymbol.prototype.graduatedMode=GraduatedMode.CONSTANT]
- * @description 等级符号专题图分级模式。<br>
- * 分级主要是为了减少制作等级符号专题图中数据大小之间的差异。如果数据之间差距较大,则可以采用对数或者平方根的分级方式来进行,
- * 这样就减少了数据之间的绝对大小的差异,使得等级符号图的视觉效果比较好,同时不同类别之间的比较也是有意义的。
- * 有三种分级模式:常数、对数和平方根,对于有值为负数的字段,在用对数或平方根方式分级时,默认对负数取正。
- * 不同的分级模式用于确定符号大小的数值是不相同的:常数按照字段的原始数据进行;对数则是对每条记录对应的专题变量取自然对数;
- * 平方根则是对其取平方根,然后用最终得到的结果来确定其等级符号的大小。
- */
- this.graduatedMode = GraduatedMode.CONSTAN;
- /**
- * @member {ThemeOffset} [ThemeGraduatedSymbol.prototype.offset]
- * @description 用于设置等级符号图相对于要素内点的偏移量。
- */
- this.offset = new ThemeOffset();
- /**
- * @member {ThemeGraduatedSymbolStyle} ThemeGraduatedSymbol.prototype.style
- * @description 用于设置等级符号图正负和零值显示风格。
- */
- this.style = new ThemeGraduatedSymbolStyle();
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.ThemeGraduatedSymbol";
- }
- /**
- * @function ThemeGraduatedSymbol.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- super.destroy();
- var me = this;
- me.expression = null;
- me.graduatedMode = GraduatedMode.CONSTANT;
- if (me.offset) {
- me.offset.destroy();
- me.offset = null;
- }
- if (me.style) {
- me.style.destroy();
- me.style = null;
- }
- }
- /**
- * @function ThemeGraduatedSymbol.prototype.toJSON
- * @description 将 themeLabel 对象转化为 JSON 字符串。
- * @returns {string} 返回转换后的 JSON 字符串。
- */
- toJSON() {
- return Util.toJSON(this.toServerJSONObject());
- }
- /**
- * @function ThemeGraduatedSymbol.prototype.toServerJSONObject
- * @description 转换成对应的 JSON 格式对象。
- * @returns {Object} 对应的 JSON 格式对象。
- */
- toServerJSONObject() {
- var obj = {};
- obj.type = this.type;
- obj.memoryData = this.memoryData;
- obj.baseValue = this.baseValue;
- obj.expression = this.expression;
- obj.graduatedMode = this.graduatedMode;
- if (this.offset) {
- obj.offsetFixed = this.offset.offsetFixed;
- obj.offsetX = this.offset.offsetX;
- obj.offsetY = this.offset.offsetY;
- }
- if (this.style) {
- obj.negativeStyle = this.style.negativeStyle;
- obj.negativeDisplayed = this.style.negativeDisplayed;
- obj.positiveStyle = this.style.positiveStyle;
- obj.zeroDisplayed = this.style.zeroDisplayed;
- obj.zeroStyle = this.style.zeroStyle;
- }
- return obj;
- }
- /**
- * @function ThemeGraduatedSymbol.fromObj
- * @description 从传入对象获取等级符号专题图。
- * @param {Object} obj - 传入对象。
- * @returns {ThemeGraduatedSymbol} 等级符号专题图对象。
- */
- static fromObj(obj) {
- if (!obj) {
- return;
- }
- var res = new ThemeGraduatedSymbol();
- Util.copy(res, obj);
- res.offset = ThemeOffset.fromObj(obj);
- res.style = ThemeGraduatedSymbolStyle.fromObj(obj);
- return res;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ThemeRangeItem.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ThemeRangeItem
- * @deprecatedclass SuperMap.ThemeRangeItem
- * @category iServer Map Theme
- * @classdesc 范围分段专题图子项类。在分段专题图中,字段值按照某种分段模式被分成多个范围段,
- * 每个范围段即为一个子项,同一范围段的要素属于同一个分段专题图子项。
- * 每个子项都有其分段起始值、终止值、名称和风格等。每个分段所表示的范围为[start, end)。
- * @param {Object} options - 参数。
- * @param {string} [options.caption] - 子项的标题。
- * @param {number} [options.end=0] - 子项的终止值。
- * @param {number} [options.start=0] - 子项的起始值。
- * @param {ServerStyle} options.style - 子项的风格。
- * @param {boolean} [options.visible=true] - 子项是否可见。
- * @usage
- */
- class ThemeRangeItem {
- constructor(options) {
- /**
- * @member {string} [ThemeRangeItem.prototype.caption]
- * @description 分段专题图子项的标题。
- */
- this.caption = null;
- /**
- * @member {number} [ThemeRangeItem.prototype.end=0]
- * @description 分段专题图子项的终止值,即该段专题值范围的最大值。<br>
- * 如果该子项是分段中最后一个子项,则该终止值应大于分段字段(ThemeRange 类的 rangeExpression 属性)的最大值,若该终止值小于分段字段最大值,
- * 则剩余部分由内部随机定义其颜色;如果不是最后一项,该终止值必须与其下一子项的起始值相同,否则系统抛出异常;
- * 如果设置了范围分段模式和分段数,则会自动计算每段的范围 [start, end),故无需设置 [start, end);当然可以设置,那么结果就会按您设置的值对分段结果进行调整。
- */
- this.end = 0;
- /**
- * @member {number} [ThemeRangeItem.prototype.start=0]
- * @description 分段专题图子项的起始值,即该段专题值范围的最小值。<br>
- * 如果该子项是分段中第一个子项,那么该起始值就是分段的最小值;如果子项的序号大于等于 1 的时候,该起始值必须与前一子项的终止值相同,否则系统会抛出异常。
- * 如果设置了范围分段模式和分段数,则会自动计算每段的范围 [start, end),故无需设置 [start, end);当然可以设置,那么结果就会按您设置的值对分段结果进行调整。
- */
- this.start = 0;
- /**
- * @member {ServerStyle} ThemeRangeItem.prototype.style
- * @description 分段专题图子项的风格。
- * 每一个分段专题图子项都对应一种显示风格。
- */
- this.style = new ServerStyle();
- /**
- * @member {boolean} [ThemeRangeItem.prototype.visible=true]
- * @description 分段专题图子项是否可见。
- */
- this.visible = true;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.ThemeRangeItem";
- }
- /**
- * @function ThemeRangeItem.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.caption = null;
- me.end = null;
- me.start = null;
- if (me.style) {
- me.style.destroy();
- me.style = null;
- }
- me.visible = null;
- }
- /**
- * @function ThemeRangeItem.prototypetoServerJSONObject
- * @description 转换成对应的 JSON 格式对象。
- * @returns {Object} 对应的 JSON 格式对象。
- */
- toServerJSONObject() {
- var obj = {};
- obj = Util.copyAttributes(obj, this);
- if (obj.style) {
- if (obj.style.toServerJSONObject) {
- obj.style = obj.style.toServerJSONObject();
- }
- }
- return obj;
- }
- /**
- * @function ThemeRangeItem.fromObj
- * @description 从传入对象获取范围分段专题图子项类。
- * @param {Object} obj - 传入对象。
- * @returns {ThemeRangeItem} ThemeRangeItem 对象。
- */
- static fromObj(obj) {
- if (!obj) {
- return;
- }
- var res = new ThemeRangeItem();
- Util.copy(res, obj);
- res.style = ServerStyle.fromJson(obj.style);
- return res;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ThemeRange.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ThemeRange
- * @deprecatedclass SuperMap.ThemeRange
- * @category iServer Map Theme
- * @classdesc 范围分段专题图。
- * 范围分段专题图是按照指定的分段方法(如:等距离分段法)对字段的属性值进行分段,使用不同的颜色或符号(线型、填充)表示不同范围段落的属性值在整体上的分布情况,体现区域的差异。
- * 在分段专题图中,专题值按照某种分段方式被分成多个范围段,要素根据各自的专题值被分配到其中一个范围段中,在同一个范围段中的要素使用相同的颜色,填充,符号等风格进行显示。
- * 分段专题图所基于的专题变量必须为数值型,分段专题图一般用来反映连续分布现象的数量或程度特征,如降水量的分布,土壤侵蚀强度的分布等。
- * @extends {CommonTheme}
- * @param {Object} options - 参数。
- * @param {Array.<ThemeRangeItem>} options.items - 子项数组。
- * @param {string} options.rangeExpression - 分段字段表达式。
- * @param {number} options.rangeParameter - 分段参数。
- * @param {number} options.rangeParameter - 分段参数。
- * @param {RangeMode} [options.rangeMode=RangeMode.EQUALINTERVAL] - 分段模式。
- * @param {ColorGradientType} [options.colorGradientType=ColorGradientType.YELLOW_RED] - 渐变颜色枚举类。
- * @param {ThemeMemoryData} [options.memoryData] - 专题图内存数据。
- * @usage
- */
- class ThemeRange extends Theme {
- constructor(options) {
- super("RANGE", options);
- /**
- * @member {string} ThemeRange.prototype.precision
- * @description 精准度
- */
- this.precision = '1.0E-12';
- /**
- * @member {Array.<ThemeRangeItem>} ThemeRange.prototype.items
- * @description 分段专题图子项数组。<br>
- * 在分段专题图中,字段值按照某种分段模式被分成多个范围段,每个范围段即为一个子项,同一范围段的要素属于同一个分段专题图子项。
- * 每个子项都有其分段起始值、终止值、名称和风格等。每个分段所表示的范围为 [start, end)。
- * 如果设置了范围分段模式和分段数,则会自动计算每段的范围 [start, end),故无需设置 [start, end);当然可以设置,那么结果就会按照您设置的值对分段结果进行调整。
- */
- this.items = null;
- /**
- * @member {string} ThemeRange.prototype.rangeExpression
- * @description 分段字段表达式。<br>
- * 由于范围分段专题图基于各种分段方法根据一定的距离进行分段,因而范围分段专题图所基于的字段值的数据类型必须为数值型。对于字段表达式,只能为数值型的字段间的运算。
- */
- this.rangeExpression = null;
- /**
- * @member {RangeMode} [ThemeRange.prototype.rangeMode=RangeMode.EQUALINTERVAL]
- * @description 分段专题图的分段模式。<br>
- * 在分段专题图中,作为专题变量的字段或表达式的值按照某种分段方式被分成多个范围段。
- * 目前 SuperMap 提供的分段方式包括:等距离分段法、平方根分段法、标准差分段法、对数分段法、等计数分段法和自定义距离法,
- * 显然这些分段方法根据一定的距离进行分段,因而范围分段专题图所基于的专题变量必须为数值型。
- */
- this.rangeMode = RangeMode.EQUALINTERVAL;
- /**
- * @member {number} ThemeRange.prototype.rangeParameter
- * @description 分段参数。
- * 当分段模式为等距离分段法,平方根分段,对数分段法,计数分段法其中一种模式时,该参数用于设置分段个数;当分段模式为标准差分段法时,
- * 该参数不起作用;当分段模式为自定义距离时,该参数用于设置自定义距离。
- */
- this.rangeParameter = 0;
- /**
- * @member {ColorGradientType} [ThemeRange.prototype.colorGradientType=ColorGradientType.YELLOW_RED]
- * @description 渐变颜色枚举类。<br>
- * 渐变色是由起始色根据一定算法逐渐过渡到终止色的一种混合型颜色。
- * 该类作为单值专题图参数类、分段专题图参数类的属性,负责设置单值专题图、分段专题图的配色方案,在默认情况下专题图所有子项会根据这个配色
- * 方案完成填*充。但如果为某几个子项的风格进行单独设置后(设置了 {@link ThemeUniqueItem} 或 {@link ThemeRangeItem} 类中Style属性),
- * 该配色方案对于这几个子项将不起作用。
- */
- this.colorGradientType = ColorGradientType.YELLOW_RED;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.ThemeRange";
- }
- /**
- * @function ThemeRange.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- var me = this;
- if (me.items) {
- if (me.items.length > 0) {
- for (var item in me.items) {
- me.items[item].destroy();
- me.items[item] = null;
- }
- }
- me.items = null;
- }
- me.rangeExpression = null;
- me.rangeMode = null;
- me.rangeParameter = null;
- me.colorGradientType = null;
- }
- /**
- * @function ThemeRange.fromObj
- * @description 从传入对象获取范围分段专题图类。
- * @param {Object} obj - 传入对象。
- * @returns {ThemeRange} ThemeRange 对象。
- */
- static fromObj(obj) {
- if (!obj) {
- return;
- }
- var res = new ThemeRange();
- Util.copy(res, obj);
- var itemsR = obj.items;
- var len = itemsR ? itemsR.length : 0;
- res.items = [];
- for (var i = 0; i < len; i++) {
- res.items.push(ThemeRangeItem.fromObj(itemsR[i]));
- }
- return res;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/UGCLayer.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class UGCLayer
- * @deprecatedclass SuperMap.UGCLayer
- * @category iServer Map Layer
- * @classdesc SuperMap 图层类。
- * @param {Object} options - 参数。
- * @param {Bounds} options.bounds - 图层范围。
- * @param {string} options.name - 图层的名称。
- * @param {UGCLayerType} options.type - 图层类型
- * @param {string} [options.caption] - 图层的标题。
- * @param {string} [options.description] - 图层的描述信息。
- * @param {boolean} [options.queryable] - 图层中的对象是否可以查询。
- * @param {boolean} [options.subUGCLayers] - 是否允许图层的符号大小随图缩放。
- * @param {boolean} [options.visible=false] - 地图对象在同一范围内时,是否重叠显示。
- * @usage
- */
- class UGCLayer {
- constructor(options) {
- options = options || {};
- /**
- * @member {Bounds} UGCLayer.prototype.bounds
- * @description 图层范围。
- */
- this.bounds = null;
- /**
- * @member {string} [UGCLayer.prototype.caption]
- * @description 图层的标题。默认情况下图层的标题与图层的名称一致。在图例、图层控制列表中显示的图层名称就是该图层的标题值。
- */
- this.caption = null;
- /**
- * @member {string} UGCLayer.prototype.description
- * @description 图层的描述信息。
- */
- this.description = null;
- /**
- * @member {string} UGCLayer.prototype.name
- * @description 图层的名称。图层的名称在图层所在的地图中唯一标识此图层。该属性区分大小写。
- */
- this.name = null;
- /**
- * @member {boolean} UGCLayer.prototype.queryable
- * @description 图层中的对象是否可以查询。
- */
- this.queryable = null;
- /**
- * @member {Array} UGCLayer.prototype.subLayers
- * @description 子图层集。
- */
- this.subLayers = null;
- /**
- * @member {UGCLayerType} UGCLayer.prototype.type
- * @description 图层类型。
- */
- this.type = null;
- /**
- * @member {boolean} UGCLayer.prototype.visible
- * @description 地图对象在同一范围内时,是否重叠显示。
- */
- this.visible = null;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.UGCLayer";
- }
- /**
- * @function UGCLayer.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- Util.reset(me);
- }
- /**
- * @function UGCLayer.prototype.fromJson
- * @description 将服务端 JSON 对象转换成当前客户端对象。
- * @param {Object} jsonObject - 要转换的 JSON 对象。
- */
- fromJson(jsonObject) {
- jsonObject = jsonObject ? jsonObject : {};
- Util.extend(this, jsonObject);
- var b = this.bounds;
- if (b) {
- this.bounds = new Bounds(b.leftBottom.x, b.leftBottom.y, b.rightTop.x, b.rightTop.y);
- }
- }
- /**
- * @function UGCLayer.prototype.toServerJSONObject
- * @description 转换成对应的 JSON 格式对象。
- * @returns {Object} 对应的 JSON 格式对象。
- */
- toServerJSONObject() {
- var jsonObject = {};
- jsonObject = Util.copyAttributes(jsonObject, this);
- if (jsonObject.bounds) {
- if (jsonObject.bounds.toServerJSONObject) {
- jsonObject.bounds = jsonObject.bounds.toServerJSONObject();
- }
- }
- return jsonObject;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/UGCMapLayer.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class UGCMapLayer
- * @deprecatedclass SuperMap.UGCMapLayer
- * @category iServer Map Layer
- * @classdesc SuperMap 地图图层类。
- * @extends {UGCLayer}
- * @param {Object} options - 可选参数。
- * @param {boolean} [options.completeLineSymbolDisplayed] - 是否显示完整线型。
- * @param {number} [options.maxScale] - 地图最大比例尺。
- * @param {number} [options.minScale] - 地图最小比例尺。
- * @param {number} [options.minVisibleGeometrySize] - 几何对象的最小可见大小,以像素为单位。
- * @param {number} [options.opaqueRate] - 图层的不透明度。
- * @param {boolean} [options.symbolScalable] - 是否允许图层的符号大小随图缩放。
- * @param {number} [options.symbolScale] - 图层的符号缩放基准比例尺。
- * @param {boolean} [options.overlapDisplayed=false] - 地图对象在同一范围内时,是否重叠显示。
- * @param {OverlapDisplayedOptions} [options.overlapDisplayedOptions] - 地图的压盖过滤显示选项,当overlapDisplayed 为 false 时有效。
- * @usage
- */
- class UGCMapLayer extends UGCLayer {
- constructor(options) {
- options = options || {};
- super(options);
- /**
- * @member {boolean} UGCMapLayer.prototype.completeLineSymbolDisplayed
- * @description 是否显示完整线型。
- */
- this.completeLineSymbolDisplayed = null;
- /**
- * @member {number} UGCMapLayer.prototype.maxScale
- * @description 地图最大比例尺。
- */
- this.maxScale = null;
- /**
- * @member {number} UGCMapLayer.prototype.minScale
- * @description 地图最小比例尺。
- */
- this.minScale = null;
- /**
- * @member {number} UGCMapLayer.prototype.minVisibleGeometrySize
- * @description 几何对象的最小可见大小,以像素为单位。
- */
- this.minVisibleGeometrySize = null;
- /**
- * @member {number} UGCMapLayer.prototype.opaqueRate
- * @description 图层的不透明度。
- */
- this.opaqueRate = null;
- /**
- * @member {boolean} UGCMapLayer.prototype.symbolScalable
- * @description 是否允许图层的符号大小随图缩放。
- */
- this.symbolScalable = null;
- /**
- * @member {number} UGCMapLayer.prototype.symbolScale
- * @description 图层的符号缩放基准比例尺。
- */
- this.symbolScale = null;
- /**
- * @member {boolean} [UGCMapLayer.prototype.overlapDisplayed=false]
- * @description 地图对象在同一范围内时,是否重叠显示。
- */
- this.overlapDisplayed = null;
- /**
- * @member {OverlapDisplayedOptions} UGCMapLayer.prototype.overlapDisplayedOptions
- * @description 地图的压盖过滤显示选项,当 overlapDisplayed 为 false 时有效。
- */
- this.overlapDisplayedOptions = null;
- this.CLASS_NAME = "SuperMap.UGCMapLayer";
- }
- /**
- * @function UGCMapLayer.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- Util.reset(this);
- }
- /**
- * @function UGCMapLayer.prototype.fromJson
- * @description 将服务端 JSON 对象转换成当前客户端对象
- * @param {Object} jsonObject - 要转换的 JSON 对象。
- */
- fromJson(jsonObject) {
- super.fromJson(jsonObject);
- }
- /**
- * @function UGCMapLayer.prototype.toServerJSONObject
- * @description 转换成对应的 JSON 格式对象。
- * @returns {Object} 对应的 JSON 格式对象。
- */
- toServerJSONObject() {
- return super.toServerJSONObject();
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/JoinItem.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class JoinItem
- * @deprecatedclass SuperMap.JoinItem
- * @category iServer Data FeatureResults
- * @classdesc 连接信息类。
- * 该类用于矢量数据集与外部表的连接。外部表可以为另一个矢量数据集(其中纯属性数据集中没有空间几何信息)所对应的 DBMS 表,也可以是用户自建的业务表。
- * 需要注意的是,矢量数据集与外部表必须属于同一数据源。表之间的联系的建立有两种方式,一种是连接(join),一种是关联(link)。
- * 连接,实际上是依据相同的字段将一个外部表追加到指定的表;而关联是基于一个相同的字段定义了两个表格之间的联系,但不是实际的追加。
- * 用于连接两个表的字段的名称不一定相同,但类型必须一致。当两个表格之间建立了连接,通过对主表进行操作,可以对外部表进行查询,制作专题图以及分析等。
- * 当两个表格之间是一对一或多对一的关系时,可以使用 join 连接。当为多对一的关系时,允许指定多个字段之间的关联。
- *(注意:JoinItem 目前支持左连接和内连接,不支持全连接和右连接,UDB 引擎不支持内连接。并且用于建立连接的两个表必须在同一个数据源下。)
- * @param {Object} options - 参数。
- * @param {string} options.foreignTableName - 外部表的名称。
- * @param {string} options.joinFilter - 矢量数据集与外部表之间的连接表达式,即设定两个表之间关联的字段。
- * @param {JoinType} options.joinType - 两个表之间连接类型。
- * @example 下面以 SQL 查询说明 joinItem 的使用方法:
- *(start code)
- * function queryBySQL() {
- * // 设置与外部表的连接信息
- * var joinItem = new JoinItem({
- * foreignTableName: "foreignTable",
- * joinFilter: "foreignTable.CONTINENT = Countries.CONTINENT",
- * joinType: "LEFTJOIN"
- * })
- * var queryParam, queryBySQLParams, queryBySQLService;
- * // 设置查询参数,在查询参数中添加joinItem关联条件信息
- * queryParam = new FilterParameter({
- * name: "Countries@World",
- * joinItems: [joinItem]
- * }),
- * queryBySQLParams = new QueryBySQLParameters({
- * queryParams: [queryParam]
- * }),
- * queryBySQLService = new QueryBySQLService(url, {
- * eventListeners: { "processCompleted": processCompleted, "processFailed": processFailed}
- * });
- * queryBySQLService.processAsync(queryBySQLParams);
- * }
- * function processCompleted(queryEventArgs) {//todo}
- * function processFailed(e) {//todo}
- * (end)
- * @usage
- */
- class JoinItem {
- constructor(options) {
- /**
- * @member {string} JoinItem.prototype.foreignTableName
- * @description 外部表的名称。
- * 如果外部表的名称是以 “表名@数据源名” 命名方式,则该属性只需赋值表名。
- * 例如:外部表 Name@changchun,Name 为表名,changchun 为数据源名称,则该属性的赋值应为:Name。
- */
- this.foreignTableName = null;
- /**
- * @member {string} JoinItem.prototype.joinFilter
- * @description 矢量数据集与外部表之间的连接表达式,即设定两个表之间关联的字段。
- * 例如,将房屋面数据集(Building)的 district 字段与房屋拥有者的纯属性数据集(Owner)的 region 字段相连接,
- * 两个数据集对应的表名称分别为 Table_Building 和 Table_Owner,
- * 则连接表达式为 Table_Building.district = Table_Owner.region。
- * 当有多个字段相连接时,用 AND 将多个表达式相连。
- */
- this.joinFilter = null;
- /**
- * @member {JoinType} JoinItem.prototype.joinType
- * @description 两个表之间连接类型。
- * 连接类型决定了对两个表进行连接查询后返回的记录的情况。
- */
- this.joinType = null;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.JoinItem";
- }
- /**
- * @function JoinItem.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.foreignTableName = null;
- me.joinFilter = null;
- me.joinType = null;
- }
- /**
- * @function JoinItem.prototype.toServerJSONObject
- * @description 转换成对应的 JSON 格式对象。
- */
- toServerJSONObject() {
- var dataObj = {};
- dataObj = Util.copyAttributes(dataObj, this);
- //joinFilter基本是个纯属性对象,这里不再做转换
- return dataObj;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/UGCSubLayer.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class UGCSubLayer
- * @deprecatedclass SuperMap.UGCSubLayer
- * @category iServer Map Layer
- * @classdesc 地图服务图层属性信息类。影像图层(Image)、专题图层(ServerTheme)、栅格图层(Grid)、矢量图层(Vector)等图层均继承该类。
- * @extends {UGCMapLayer}
- * @param {Object} options - 参数。
- * @param {DatasetInfo} options.datasetInfo - 数据集信息。
- * @param {string} [options.displayFilter] - 图层显示过滤条件。
- * @param {JoinItem} [options.joinItems] - 连接信息类。
- * @param {string} [options.representationField] - 存储制图表达信息的字段。
- * @param {LayerType} [options.ugcLayerType] - 图层类型。
- * @usage
- */
- class UGCSubLayer extends UGCMapLayer {
- constructor(options) {
- options = options || {};
- super(options);
- /**
- * @member {DatasetInfo} UGCSubLayer.prototype.datasetInfo
- * @description 数据集信息。
- */
- this.datasetInfo = null;
- /**
- * @member {string} UGCSubLayer.prototype.displayFilter
- * @description 图层显示过滤条件。
- */
- this.displayFilter = null;
- /**
- * @member {JoinItem} UGCSubLayer.prototype.joinItems
- * @description 连接信息类。
- */
- this.joinItems = null;
- /**
- * @member {string} UGCSubLayer.prototype.representationField
- * @description 存储制图表达信息的字段。
- */
- this.representationField = null;
- /**
- * @member {LayerType} UGCSubLayer.prototype.ugcLayerType
- * @description 图层类型。
- */
- this.ugcLayerType = null;
- this.CLASS_NAME = "SuperMap.UGCSubLayer";
- }
- /**
- * @function UGCSubLayer.prototype.fromJson
- * @description 将服务端 JSON 对象转换成当前客户端对象
- * @param {Object} jsonObject - 要转换的 JSON 对象。
- */
- fromJson(jsonObject) {
- super.fromJson(jsonObject);
- if (this.datasetInfo) {
- this.datasetInfo = new DatasetInfo(this.datasetInfo);
- }
- if (this.joinItems && this.joinItems.length) {
- var newJoinItems = [];
- for (var i = 0; i < this.joinItems.length; i++) {
- newJoinItems[i] = new JoinItem(this.joinItems[i]);
- }
- this.joinItems = newJoinItems;
- }
- }
- /**
- * @function UGCSubLayer.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- Util.reset(this);
- }
- /**
- * @function UGCSubLayer.prototype.toServerJSONObject
- * @description 转换成对应的 JSON 格式对象。
- * @returns {Object} 对应的 JSON 格式对象。
- */
- toServerJSONObject() {
- var jsonObject = super.toServerJSONObject();
- if (jsonObject.joinItems) {
- var joinItems = [];
- for (var i = 0; i < jsonObject.joinItems.length; i++) {
- if (jsonObject.joinItems[i].toServerJSONObject) {
- joinItems[i] = jsonObject.joinItems[i].toServerJSONObject();
- }
- }
- jsonObject.joinItems = joinItems;
- }
- if (jsonObject.datasetInfo) {
- if (jsonObject.datasetInfo.toServerJSONObject) {
- jsonObject.datasetInfo = jsonObject.datasetInfo.toServerJSONObject();
- }
- }
- return jsonObject;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ServerTheme.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ServerTheme
- * @deprecatedclass SuperMap.ServerTheme
- * @category iServer Map Theme
- * @classdesc SuperMap 专题图图层类。
- * @extends {UGCSubLayer}
- * @param {CommonTheme} theme - 专题图对象。
- * @param {LonLat} themeElementPosition - 专题图元素位置。
- * @usage
- */
- class ServerTheme extends UGCSubLayer {
- constructor(options) {
- options = options || {};
- super(options);
- /**
- * @member {CommonTheme} ServerTheme.prototype.theme
- * @description 专题图对象。
- */
- this.theme = null;
- /**
- * @member {LonLat} ServerTheme.prototype.themeElementPosition
- * @description 专题图元素位置。
- */
- this.themeElementPosition = null;
- this.CLASS_NAME = "SuperMap.ServerTheme";
- }
- /**
- * @function ServerTheme.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- * @override
- */
- destroy() {
- super.destroy();
- Util.reset(this);
- }
- /**
- * @function ServerTheme.prototype.fromJson
- * @description 将服务端 JSON 对象转换成当前客户端对象
- * @param {Object} jsonObject - 要转换的 JSON 对象。
- */
- fromJson(jsonObject) {
- super.fromJson(jsonObject);
- var themeObj = this.theme;
- var themeT = themeObj && themeObj.type;
- switch (themeT) {
- case 'LABEL':
- this.theme = ThemeLabel.fromObj(themeObj);
- break;
- case 'UNIQUE':
- this.theme = ThemeUnique.fromObj(themeObj);
- break;
- case 'GRAPH':
- this.theme = ThemeGraph.fromObj(themeObj);
- break;
- case 'DOTDENSITY':
- this.theme = ThemeDotDensity.fromObj(themeObj);
- break;
- case 'GRADUATEDSYMBOL':
- this.theme = ThemeGraduatedSymbol.fromObj(themeObj);
- break;
- case 'RANGE':
- this.theme = ThemeRange.fromObj(themeObj);
- break;
- default:
- break;
- }
- if (this.themeElementPosition) {
- //待测试
- this.themeElementPosition = new LonLat(this.themeElementPosition.x, this.themeElementPosition.y);
- }
- }
- /**
- * @function ServerTheme.prototype.toServerJSONObject
- * @description 转换成对应的 JSON 格式对象。
- */
- toServerJSONObject() {
- //普通属性直接赋值
- var jsonObject = super.toServerJSONObject();
- if (jsonObject.themeElementPosition) {
- if (jsonObject.themeElementPosition.toServerJSONObject) {
- jsonObject.themeElementPosition = jsonObject.themeElementPosition.toServerJSONObject();
- }
- }
- if (jsonObject.theme) {
- if (jsonObject.theme.toServerJSONObject) {
- jsonObject.theme = jsonObject.theme.toServerJSONObject();
- }
- }
- return jsonObject;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/Grid.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class Grid
- * @deprecatedclass SuperMap.Grid
- * @category iServer Map Layer
- * @classdesc SuperMap 栅格图层类。
- * @extends {UGCSubLayer}
- * @param {Object} options - 可选参数。
- * @param {Array.<Object>} [options.colorDictionary] - 颜色对照表对象。
- * @param {number} [options.brightness] - Grid 图层的亮度。
- * @param {ColorGradientType} [options.colorGradientType] - 颜色渐变枚举。
- * @param {ServerColor} [options.colors] - 颜色表对象。
- * @param {number} [options.contrast] - Grid 图层的对比度。
- * @param {GridType} [options.gridType] - 格网类型。
- * @param {number} [options.horizontalSpacing] - 格网水平间隔大小。
- * @param {boolean} [options.sizeFixed] - 格网是否固定大小,如果不固定大小,则格网随着地图缩放。
- * @param {ServerStyle} [options.solidStyle] - 格网实线的样式。
- * @param {ServerColor} [options.specialColor] - 栅格数据集无值数据的颜色。
- * @param {number} [options.specialValue] - 图层的特殊值。
- * @param {boolean} [options.specialValueTransparent] - 图层的特殊值(specialValue)所处区域是否透明。
- * @param {number} [options.verticalSpacing] - 格网垂直间隔大小。
- * @usage
- */
- class Grid extends UGCSubLayer {
- constructor(options) {
- options = options || {};
- super(options);
- /**
- * @member {Array.<ColorDictionary>} Grid.prototype.colorDictionarys
- * @description 颜色对照表对象。
- */
- this.colorDictionarys = null;
- /**
- * @member {number} Grid.prototype.brightness
- * @description Grid 图层的亮度。
- */
- this.brightness = null;
- /**
- * @member {ColorGradientType} Grid.prototype.colorGradientType
- * @description 渐变颜色枚举值。
- */
- this.colorGradientType = null;
- /**
- * @member {ServerColor} Grid.prototype.colors
- * @description 颜色表对象。
- */
- this.colors = null;
- /**
- * @member {number} Grid.prototype.contrast
- * @description Grid 图层的对比度。
- */
- this.contrast = null;
- /**
- * @member {ServerStyle} Grid.prototype.dashStyle
- * @description 栅格数据集特殊值数据的颜色。
- */
- this.dashStyle = null;
- /**
- * @member {GridType} Grid.prototype.gridType
- * @description 格网类型。
- */
- this.gridType = null;
- /**
- * @member {number} Grid.prototype.horizontalSpacing
- * @description 格网水平间隔大小。
- */
- this.horizontalSpacing = null;
- /**
- * @member {boolean} Grid.prototype.sizeFixed
- * @description 格网是否固定大小,如果不固定大小,则格网随着地图缩放。
- */
- this.sizeFixed = null;
- /**
- * @member {ServerStyle} Grid.prototype.solidStyle
- * @description 格网实线的样式。
- */
- this.solidStyle = null;
- /**
- * @member {ServerColor} Grid.prototype.specialColor
- * @description 栅格数据集无值数据的颜色。
- */
- this.specialColor = null;
- /**
- * @member {number} Grid.prototype.specialValue
- * @description 图层的特殊值。
- */
- this.specialValue = null;
- /**
- * @member {boolean} Grid.prototype.specialValueTransparent
- * @description 图层的特殊值(specialValue)所处区域是否透明。
- */
- this.specialValueTransparent = null;
- /**
- * @member {number} Grid.prototype.verticalSpacing
- * @description 格网垂直间隔大小。
- */
- this.verticalSpacing = null;
- this.CLASS_NAME = "SuperMap.Grid";
- }
- /**
- * @function Grid.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- super.destroy();
- Util.reset(this);
- }
- /**
- * @function Grid.prototype.fromJson
- * @description 将服务端 JSON 对象转换成当前客户端对象。
- * @param {Object} jsonObject - 要转换的 JSON 对象。
- */
- fromJson(jsonObject) {
- super.fromJson(jsonObject);
- if (this.specialColor) {
- this.specialColor = new ServerColor(this.specialColor.red,
- this.specialColor.green,
- this.specialColor.blue);
- }
- if (this.colors) {
- var colors = [],
- color;
- for (var i in this.colors) {
- color = this.colors[i];
- colors.push(new ServerColor(color.red, color.green, color.blue));
- }
- this.colors = colors;
- }
- if (this.dashStyle) {
- this.dashStyle = new ServerStyle(this.dashStyle);
- }
- if (this.solidStyle) {
- this.solidStyle = new ServerStyle(this.solidStyle);
- }
- if (this.colorDictionary) {
- var colorDics = [],
- colorDic;
- for (var key in this.colorDictionary) {
- colorDic = this.colorDictionary[key];
- colorDics.push(new ColorDictionary({elevation: key, color: colorDic}));
- }
- this.colorDictionarys = colorDics;
- }
- delete this.colorDictionary;
- }
- /**
- * @function Grid.prototype.toServerJSONObject
- * @description 转换成对应的 JSON 对象。
- * @returns JSON 对象。
- */
- toServerJSONObject() {
- var jsonObject = super.toServerJSONObject();
- if (jsonObject.dashStyle) {
- if (jsonObject.dashStyle.toServerJSONObject) {
- jsonObject.dashStyle = jsonObject.dashStyle.toServerJSONObject();
- }
- }
- if (jsonObject.solidStyle) {
- if (jsonObject.solidStyle.toServerJSONObject) {
- jsonObject.solidStyle = jsonObject.solidStyle.toServerJSONObject();
- }
- }
- return jsonObject;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/Image.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class UGCImage
- * @deprecatedclass SuperMap.Image
- * @category iServer Map Layer
- * @classdesc SuperMap 影像图层类
- * @extends {UGCSubLayer}
- * @param {Object} options - 可选参数。
- * @param {ColorSpaceType} [options.colorSpaceType] - 返回影像图层的色彩显示模式。
- * @param {number} [options.brightness] - 影像图层的亮度。
- * @param {Array.<number>} [options.displayBandIndexes] - 返回当前影像图层显示的波段索引。
- * @param {number} [options.contrast] - 影像图层的对比度。
- * @param {boolean} [options.transparent] - 是否背景透明。
- * @param {ServerColor} [options.transparentColor] - 返回背景透明色。
- * @param {number} [options.transparentColorTolerance] - 背景透明色容限。
- * @usage
- * @private
- */
- class UGCImage extends UGCSubLayer {
- constructor(options) {
- options = options || {};
- super(options);
- /**
- * @member {number} UGCImage.prototype.brightness
- * @description 影像图层的亮度。
- */
- this.brightness = null;
- /**
- * @member {ColorSpaceType} UGCImage.prototype.colorSpaceType
- * @description 返回影像图层的色彩显示模式。
- */
- this.colorSpaceType = null;
- /**
- * @member {number} UGCImage.prototype.contrast
- * @description 影像图层的对比度。
- */
- this.contrast = null;
- /**
- * @member {Array.<number>} UGCImage.prototype.displayBandIndexes
- * @description 返回当前影像图层显示的波段索引。
- */
- this.displayBandIndexes = null;
- /**
- * @member {boolean} UGCImage.prototype.transparent
- * @description 是否背景透明。
- */
- this.transparent = null;
- /**
- * @member {ServerColor} UGCImage.prototype.transparentColor
- * @description 返回背景透明色。
- */
- this.transparentColor = null;
- /**
- * @member {number} UGCImage.prototype.transparentColorTolerance
- * @description 背景透明色容限。
- */
- this.transparentColorTolerance = null;
- this.CLASS_NAME = "SuperMap.Image";
- }
- /**
- * @function UGCImage.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- Util.reset(this);
- }
- /**
- * @function UGCImage.prototype.fromJson
- * @description 将服务端 JSON 对象转换成当前客户端对象。
- * @param {Object} jsonObject - 要转换的 JSON 对象。
- */
- fromJson(jsonObject) {
- super.fromJson(jsonObject);
- if (this.transparentColor) {
- this.transparentColor = new ServerColor(this.transparentColor.red,
- this.transparentColor.green,
- this.transparentColor.blue);
- }
- }
- /**
- * @function UGCImage.prototype.toServerJSONObject
- * @description 转换成对应的 JSON 格式对象。
- */
- toServerJSONObject() {
- return super.toServerJSONObject();
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/Vector.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class Vector
- * @deprecatedclass SuperMap.Vector
- * @category iServer Map Layer
- * @classdesc SuperMap 矢量图层类。
- * @extends {UGCSubLayer}
- * @param {Object} options - 可选参数。
- * @param {ServerStyle} [options.style] - 矢量图层的风格。
- * @usage
- */
- class Vector_Vector extends UGCSubLayer {
- constructor(options) {
- options = options || {};
- super(options);
- /**
- * @member {ServerStyle} Vector.prototype.style
- * @description 矢量图层的风格。
- */
- this.style = null;
- this.CLASS_NAME = "SuperMap.Vector";
- }
- /**
- * @function Vector.prototype.destroy
- * @description 销毁对象,将其属性置空。
- * @override
- */
- destroy() {
- super.destroy();
- Util.reset(this);
- }
- /**
- * @function Vector.prototype.fromJson
- * @description 将服务端 JSON 对象转换成当前客户端对象。
- * @param {Object} jsonObject - 要转换的 JSON 对象。
- */
- fromJson(jsonObject) {
- super.fromJson(jsonObject);
- var sty = this.style;
- if (sty) {
- this.style = new ServerStyle(sty);
- }
- }
- /**
- * @function Vector.prototype.toServerJSONObject
- * @description 转换成对应的 JSON 格式对象。
- * @returns {Object} 对应的 JSON 格式对象
- */
- toServerJSONObject() {
- var jsonObject = super.toServerJSONObject();
- if (jsonObject.style) {
- if (jsonObject.style.toServerJSONObject) {
- jsonObject.style = jsonObject.style.toServerJSONObject();
- }
- }
- return jsonObject;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/GetLayersInfoService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GetLayersInfoService
- * @deprecatedclass SuperMap.GetLayersInfoService
- * @category iServer Map Layer
- * @classdesc 获取图层信息服务类构造函数。
- * @extends {CommonServiceBase}
- * @param {string} url - 服务地址。请求地图服务,URL 应为:
- * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名};
- * 如 http://localhost:8090/iserver/services/map-world/rest/maps/World 。
- * 如果查询临时图层的信息,请指定完成的url,包含临时图层ID信息,如:
- * http://localhost:8090/iserver/services/map-world/rest/maps/World/tempLayersSet/resourceID
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
- * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @param {boolean} options.isTempLayers - 当前url对应的图层是否是临时图层。
- * @usage
- */
- class GetLayersInfoService extends CommonServiceBase {
- constructor(url, options) {
- super(url, options);
- /**
- * @member {boolean} GetLayersInfoService.prototype.isTempLayers
- * @description 当前url对应的图层是否是临时图层。
- */
- this.isTempLayers = false;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.GetLayersInfoService";
- }
- /**
- * @function GetLayersInfoService.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- Util.reset(this);
- }
- /**
- * @function GetLayersInfoService.prototype.processAsync
- * @description 负责将客户端的更新参数传递到服务端。
- */
- processAsync() {
- var me = this,
- method = "GET";
- if (!me.isTempLayers) {
- me.url = Util.urlPathAppend(me.url, 'layers');
- }
- me.request({
- method: method,
- params: null,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- /**
- * @function GetLayersInfoService.prototype.serviceProcessCompleted
- * @description 编辑完成,执行此方法。
- * @param {Object} result - 服务器返回的结果对象。
- */
- serviceProcessCompleted(result) {
- var me = this, existRes, layers, len;
- result = Util.transformResult(result);
- existRes = !!result && result.length > 0;
- layers = existRes ? result[0].subLayers.layers : null;
- len = layers ? layers.length : 0;
- me.handleLayers(len, layers);
- me.events.triggerEvent("processCompleted", {result: result[0]});
- }
- /**
- * TODO 专题图时候可能会用到
- * @function GetLayersInfoService.prototype.handleLayers
- * @description 处理 iServer 新增图层组数据 (subLayers.layers 中可能还会含有 subLayers.layers)
- * @param {number} len - subLayers.layers的长度
- * @param {Array.<number>} layers - subLayers.layers的长度数组
- */
- handleLayers(len, layers) {
- var me = this, tempLayer;
- if (len) {
- for (var i = 0; i < len; i++) {
- if (layers[i].subLayers && layers[i].subLayers.layers && layers[i].subLayers.layers.length > 0) {
- me.handleLayers(layers[i].subLayers.layers.length, layers[i].subLayers.layers);
- } else {
- var type = layers[i].ugcLayerType;
- switch (type) {
- case 'THEME':
- tempLayer = new ServerTheme();
- tempLayer.fromJson(layers[i]);
- layers[i] = tempLayer;
- break;
- case 'GRID':
- tempLayer = new Grid();
- tempLayer.fromJson(layers[i]);
- layers[i] = tempLayer;
- break;
- case 'IMAGE':
- tempLayer = new UGCImage();
- tempLayer.fromJson(layers[i]);
- layers[i] = tempLayer;
- break;
- case 'VECTOR':
- tempLayer = new Vector_Vector();
- tempLayer.fromJson(layers[i]);
- layers[i] = tempLayer;
- break;
- default:
- break;
- }
- }
- }
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationAnalystParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class InterpolationAnalystParameters
- * @deprecatedclass SuperMap.InterpolationAnalystParameters
- * @category iServer SpatialAnalyst InterpolationAnalyst
- * @classdesc 插值分析参数类。
- * @param {Object} options - 参数。
- * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
- * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
- * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
- * @param {string} [options.zValueFieldName] - 进行插值分析的字段名称,插值分析不支持文本类型的字段。
- * @param {string} [options.dataset] - 待分析的数据集名称。当插值分析类型(InterpolationAnalystType)为 dataset 时,此为必选参数。
- * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(InterpolationAnalystType)为 geometry 时,此参数为必设参数。
- * @param {number} [options.searchRadius=0] - 查找半径,即参与运算点的查找范围,与点数据集单位相同。
- * @param {number} [options.zValueScale=1] - 进行插值分析值的缩放比率。
- * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
- * @param {FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
- * @param {PixelFormat} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
- * @param {string} [options.InterpolationAnalystType="dataset"] - 插值分析类型("dataset" 或 "geometry")。
- * @usage
- */
- class InterpolationAnalystParameters {
- constructor(options) {
- if (!options) {
- return;
- }
- /**
- * @member {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} InterpolationAnalystParameters.prototype.bounds
- * @description 插值分析的范围,用于确定结果栅格数据集的范围。
- * 如果缺省,则默认为原数据集的范围。鉴于此插值方法为内插方法,原数据集的范围内的插值结果才相对有参考价值,
- * 因此建议此参数不大于原数据集范围。
- */
- this.bounds = null;
- /**
- * @member {number} [InterpolationAnalystParameters.prototype.searchRadius=0]
- * @description 查找半径,即参与运算点的查找范围,与点数据集单位相同。
- * 计算某个位置的Z 值时,会以该位置为圆心,以查找范围的值为半径,落在这个范围内的采样点都将参与运算。
- * 该值需要根据待插值点数据的分布状况和点数据集范围进行设置。
- */
- this.searchRadius = 0;
- /**
- * @member {string} InterpolationAnalystParameters.prototype.zValueFieldName
- * @description 数据集插值分析中,用于指定进行插值分析的目标字段名,插值分析不支持文本类型的字段。
- * 含义为每个插值点在插值过程中的权重,可以将所有点此字段值设置为 1,即所有点在整体插值中权重相同。
- * 当插值分析类型(InterpolationAnalystType)为 dataset 时,此为必选参数。
- */
- this.zValueFieldName = null;
- /**
- * @member {number} [InterpolationAnalystParameters.prototype.zValueScale=1]
- * @description 用于进行插值分析值的缩放比率。
- * 参加插值分析的值将乘以该参数值后再进行插值,也就是对进行插值分析的值进行统一的扩大或缩小。
- */
- this.zValueScale = 1;
- /**
- * @member {number} InterpolationAnalystParameters.prototype.resolution
- * @description 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
- * 该值不能超过待分析数据集的范围边长。
- * 且该值设置时,应该考虑点数据集范围大小来取值,一般为结果栅格行列值(即结果栅格数据集范围除以分辨率),在 500 以内可以较好地体现密度走势。
- */
- this.resolution = null;
- /**
- * @member {FilterParameter} [InterpolationAnalystParameters.prototype.filterQueryParameter]
- * @description 过滤条件,对分析数据集中的点进行过滤,设置为 null 表示对数据集中的所有点进行分析。
- */
- this.filterQueryParameter = null;
- /**
- * @member {string} InterpolationAnalystParameters.prototype.outputDatasetName
- * @description 插值分析结果数据集的名称。
- */
- this.outputDatasetName = null;
- /**
- * @member {string} InterpolationAnalystParameters.prototype.outputDatasourceName
- * @description 插值分析结果数据源的名称。
- */
- this.outputDatasourceName = null;
- /**
- * @member {PixelFormat} [InterpolationAnalystParameters.prototype.pixelFormat]
- * @description 指定结果栅格数据集存储的像素格式。支持存储的像素格式有 BIT16、BIT32、DOUBLE、SINGLE、UBIT1、UBIT4、UBIT8、UBIT24、UBIT32。
- */
- this.pixelFormat = null;
- /**
- * @member {string} [InterpolationAnalystParameters.prototype.dataset]
- * @description 用来做插值分析的数据源中数据集的名称,该名称用形如 "数据集名称@数据源别名" 形式来表示。
- * 当插值分析类型(InterpolationAnalystType)为 dataset 时,此为必选参数。
- */
- this.dataset = null;
- /**
- * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} [InterpolationAnalystParameters.prototype.inputPoints]
- * @description 用于做插值分析的离散点(离散点包括Z值)集合。
- * 当插值分析类型(InterpolationAnalystType)为 geometry 时,此参数为必设参数。
- * 通过离散点直接进行插值分析不需要指定输入数据集inputDatasourceName,inputDatasetName以及zValueFieldName。
- */
- this.inputPoints = null;
- /**
- * @member {string} [InterpolationAnalystParameters.prototype.InterpolationAnalystType="dataset"]
- * @description 插值分析类型。差值分析包括数据集插值分析和几何插值分析两类,
- * "dataset" 表示对数据集进行插值分析,"geometry" 表示对离散点数组进行插值分析。
- */
- this.InterpolationAnalystType = "dataset";
- /**
- * @member {ClipParameter} InterpolationAnalystParameters.prototype.clipParam
- * @description 对插值分析结果进行裁剪的参数。
- */
- this.clipParam = null;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.InterpolationAnalystParameters";
- }
- /**
- * @function InterpolationAnalystParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.bounds = null;
- me.searchRadius = null;
- me.zValueFieldName = null;
- me.zValueScale = null;
- me.resolution = null;
- me.filterQueryParameter = null;
- me.outputDatasetName = null;
- me.pixelFormat = null;
- }
- /**
- * @function InterpolationAnalystParameters.toObject
- * @param {InterpolationAnalystParameters} interpolationAnalystParameters - 插值分析参数类。
- * @param {InterpolationAnalystParameters} tempObj - 插值分析参数对象。
- * @description 将插值分析参数对象转换成 JSON 对象。
- * @returns JSON 对象。
- */
- static toObject(interpolationAnalystParameters, tempObj) {
- for (var name in interpolationAnalystParameters) {
- if (name === "inputPoints" && interpolationAnalystParameters.InterpolationAnalystType === "geometry") {
- var objs = [];
- for (var i = 0; i < interpolationAnalystParameters.inputPoints.length; i++) {
- var item = interpolationAnalystParameters.inputPoints[i];
- var obj = {
- x: item.x,
- y: item.y,
- z: item.tag
- };
- objs.push(obj);
- }
- tempObj[name] = objs;
- } else {
- tempObj[name] = interpolationAnalystParameters[name];
- }
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationRBFAnalystParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class InterpolationRBFAnalystParameters
- * @deprecatedclass SuperMap.InterpolationRBFAnalystParameters
- * @category iServer SpatialAnalyst InterpolationAnalyst
- * @classdesc 样条插值(径向基函数插值法)分析参数类。
- * @extends {InterpolationAnalystParameters}
- * @param {Object} options - 参数。
- * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
- * @param {string} options.searchMode - 插值运算时,查找参与运算点的方式,有固定点数查找、定长查找、块查找。
- * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
- * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
- * @param {string} [options.zValueFieldName] - 存储用于进行插值分析的字段名称,插值分析不支持文本类型的字段。当插值分析类型(SuperMap.InterpolationAnalystType)为 dataset 时,此为必选参数。
- * @param {number} [options.smooth=0.1] - 光滑系数,该值表示插值函数曲线与点的逼近程度,值域为0到1。
- * @param {number} [options.tension=40] - 张力系数,用于调整结果栅格数据表面的特性。
- * @param {number} [options.expectedCount=12] - 【固定点数查找】方式下,设置参与差值运算的点数。
- * @param {number} [options.searchRadius=0] - 【定长查找】方式下,设置参与运算点的查找范围。
- * @param {number} [options.maxPointCountForInterpolation=200] - 【块查找】方式下,设置最多参与插值的点数。
- * @param {number} [options.maxPointCountInNode=50] - 【块查找】方式下,设置单个块内最多参与运算点数。
- * @param {number} [options.zValueScale=1] - 用于进行插值分析值的缩放比率。
- * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
- * @param {FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
- * @param {string} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
- * @param {string} [options.dataset] - 要用来做插值分析的数据源中数据集的名称。该名称用形如”数据集名称@数据源别名”形式来表示。当插值分析类型(InterpolationAnalystType)为 dataset 时。此为必选参数。
- * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(InterpolationAnalystType)为 geometry 时。此为必选参数。
- * @example
- * var myInterpolationRBFAnalystParameters = new InterpolationRBFAnalystParameters({
- * dataset:"SamplesP@Interpolation",
- * smooth: 0.1,
- * tension: 40,
- * searchMode: "QUADTREE",
- * maxPointCountForInterpolation: 20,
- * maxPointCountInNode: 5,
- * pixelFormat: "BIT16",
- * zValueFieldName: "AVG_TMP",
- * resolution: 3000,
- * filterQueryParameter: {
- * attributeFilter: ""
- * },
- * outputDatasetName: "myRBF"
- * });
- * @usage
- */
- class InterpolationRBFAnalystParameters extends InterpolationAnalystParameters {
- constructor(options) {
- super(options);
- /**
- * @member {number} [InterpolationRBFAnalystParameters.prototype.smooth=0.1]
- * @description 光滑系数,值域为 0 到 1,常用取值如 0、0.001、0.01、0.1、和 0.5。
- * 该值表示插值函数曲线与点的逼近程度,此数值越大,函数曲线与点的偏差越大,反之越小。
- */
- this.smooth = 0.1;
- /**
- * @member {number} [InterpolationRBFAnalystParameters.prototype.tension=40]
- * @description 张力系数,常用取值如 0、1、5 和 10。
- * 用于调整结果栅格数据表面的特性,张力越大,插值时每个点对计算结果影响越小,反之越大。
- */
- this.tension = 40;
- /**
- * @member {SearchMode} InterpolationRBFAnalystParameters.prototype.searchMode
- * @description 插值运算时,查找参与运算点的方式,有固定点数查找、定长查找、块查找。必设参数。
- * 具体如下:
- * {KDTREE_FIXED_COUNT} 使用 KDTREE 的固定点数方式查找参与内插分析的点。
- * {KDTREE_FIXED_RADIUS} 使用 KDTREE 的定长方式查找参与内插分析的点。
- * {QUADTREE} 使用 QUADTREE 方式查找参与内插分析的点(块查找)。
- */
- this.searchMode = null;
- /**
- * @member {number} [InterpolationRBFAnalystParameters.prototype.expectedCount=12]
- * @description 【固定点数查找】方式下,设置待查找的点数,即参与差值运算的点数。
- */
- this.expectedCount = 12;
- /**
- * @member {number} [InterpolationRBFAnalystParameters.prototype.maxPointCountForInterpolation=200]
- * @description 【块查找】方式下,最多参与插值的点数。
- */
- this.maxPointCountForInterpolation = 200;
- /**
- * @member {number} [InterpolationRBFAnalystParameters.prototype.maxPointCountInNode=50]
- * @description 【块查找】方式下,单个块内最多参与运算点数。
- */
- this.maxPointCountInNode = 50;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.InterpolationRBFAnalystParameters";
- }
- /**
- * @function InterpolationRBFAnalystParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- super.destroy();
- var me = this;
- me.smooth = null;
- me.tension = null;
- me.searchMode = null;
- me.expectedCount = null;
- me.maxPointCountForInterpolation = null;
- me.maxPointCountInNode = null;
- }
- /**
- * @function InterpolationRBFAnalystParameters.toObject
- * @param {InterpolationRBFAnalystParameters} datasetInterpolationRBFAnalystParameters - 样条插值(径向基函数插值法)分析参数类
- * @param {InterpolationRBFAnalystParameters} tempObj - 样条插值(径向基函数插值法)分析参数对象
- * @description 将样条插值(径向基函数插值法)分析参数对象转换为 JSON 对象。
- * @returns JSON 对象。
- */
- static toObject(datasetInterpolationRBFAnalystParameters, tempObj) {
- for (var name in datasetInterpolationRBFAnalystParameters) {
- tempObj[name] = datasetInterpolationRBFAnalystParameters[name];
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationDensityAnalystParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class InterpolationDensityAnalystParameters
- * @deprecatedclass SuperMap.InterpolationDensityAnalystParameters
- * @category iServer SpatialAnalyst InterpolationAnalyst
- * @classdesc 点密度差值分析参数类。
- * @param {Object} options - 参数。
- * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
- * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
- * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
- * @param {number} [options.searchRadius=0] - 查找半径,即参与运算点的查找范围,与点数据集单位相同。
- * @param {string} [options.zValueFieldName] - 进行插值分析的字段名称,插值分析不支持文本类型的字段。当插值分析类型(InterpolationAnalystParameters.prototype.InterpolationAnalystType)为 dataset 时。此为必选参数。
- * @param {number} [options.zValueScale=1] - 进行插值分析值的缩放比率。
- * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
- * @param {FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
- * @param {string} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
- * @param {string} [options.dataset] - 用来做插值分析的数据源中数据集的名称,该名称用形如 "数据集名称@数据源别名" 形式来表示。当插值分析类型(InterpolationAnalystParameters.prototype.InterpolationAnalystType)为 dataset 时,此为必选参数。
- * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(InterpolationAnalystParameters.prototype.InterpolationAnalystType)为 geometry 时,此为必选参数。
- * @extends {InterpolationAnalystParameters}
- * @example
- * var myInterpolationDensityAnalystParameters = new InterpolationDensityAnalystParameters({
- * dataset: "SamplesP@Interpolation",
- * searchRadius: "100000",
- * pixelFormat: "BIT16",
- * zValueFieldName: "AVG_TMP",
- * resolution: 3000,
- * filterQueryParameter: {
- * attributeFilter: ""
- * },
- * outputDatasetName: "myDensity"
- * });
- * @usage
- */
- class InterpolationDensityAnalystParameters extends InterpolationAnalystParameters {
- constructor(options) {
- super(options);
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.InterpolationDensityAnalystParameters";
- }
- /**
- * @function InterpolationDensityAnalystParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- super.destroy();
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationIDWAnalystParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class InterpolationIDWAnalystParameters
- * @deprecatedclass SuperMap.InterpolationIDWAnalystParameters
- * @category iServer SpatialAnalyst InterpolationAnalyst
- * @classdesc 反距离加权插值(IDW)分析参数类。
- * @param {Object} options - 参数。
- * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
- * @param {string} options.searchMode - 插值运算时,查找参与运算点的方式,支持固定点数查找、定长查找。
- * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
- * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
- * @param {string} [options.zValueFieldName] - 进行插值分析的字段名称,插值分析不支持文本类型的字段。当插值分析类型(SuperMap.InterpolationAnalystType)为 dataset 时,此为必选参数。
- * @param {number} [options.expectedCount=12] - 【固定点数查找】方式下,设置待查找的点数,即参与差值运算的点数。
- * @param {number} [options.searchRadius=0] - 【定长查找】方式下,设置查找半径,即参与运算点的查找范围,与点数据集单位相同。
- * @param {number} [options.power=2] - 距离权重计算的幂次。
- * @param {number} [options.zValueScale=1] - 用于进行插值分析值的缩放比率。
- * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
- * @param {FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
- * @param {string} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
- * @param {string} [options.dataset] - 要用来做插值分析的数据源中数据集的名称。该名称用形如”数据集名称@数据源别名”形式来表示。当插值分析类型(SuperMap.InterpolationAnalystType)为 dataset 时,此为必选参数。
- * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(SuperMap.InterpolationAnalystType)为 geometry 时,此为必选参数。
- * @extends {InterpolationAnalystParameters}
- * @example 例如:
- * var myInterpolationIDWAnalystParameters = new InterpolationIDWAnalystParameters({
- * dataset:"SamplesP@Interpolation",
- * power: 2,
- * searchMode: "KDTREE_FIXED_COUNT",
- * expectedCount: 12,
- * pixelFormat: "BIT16",
- * zValueFieldName: "AVG_TMP",
- * resolution: 3000,
- * filterQueryParameter: {
- * attributeFilter: ""
- * },
- * outputDatasetName: "myIDW"
- * });
- * @usage
- */
- class InterpolationIDWAnalystParameters extends InterpolationAnalystParameters {
- constructor(options) {
- super(options);
- /**
- * @member {number} [InterpolationIDWAnalystParameters.prototype.power=2]
- * @description 距离权重计算的幂次。
- * 该值决定了权值下降的速度,幂次越大,随距离的增大权值下降越快,距离预测点越远的点的权值也越小。
- * 理论上,参数值必须大于0,但是0.5到3之间时运算结果更合理,因此推荐值为0.5~3。
- */
- this.power = 2;
- /**
- * @member {SearchMode} InterpolationIDWAnalystParameters.prototype.searchMode
- * @description 插值运算时,查找参与运算点的方式,支持固定点数查找、定长查找。
- * 具体如下:
- * {KDTREE_FIXED_COUNT} 使用 KDTREE 的固定点数方式查找参与内插分析的点。
- * {KDTREE_FIXED_RADIUS} 使用 KDTREE 的定长方式查找参与内插分析的点。
- */
- this.searchMode = null;
- /**
- * @member {number} [InterpolationIDWAnalystParameters.prototype.expectedCount=12]
- * @description 【固定点数查找】方式下,设置待查找的点数,即参与差值运算的点数。
- */
- this.expectedCount = 12;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.InterpolationIDWAnalystParameters";
- }
- /**
- * @function InterpolationIDWAnalystParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- super.destroy();
- var me = this;
- me.power = null;
- me.searchMode = null;
- me.expectedCount = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationKrigingAnalystParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class InterpolationKrigingAnalystParameters
- * @deprecatedclass SuperMap.InterpolationKrigingAnalystParameters
- * @category iServer SpatialAnalyst InterpolationAnalyst
- * @classdesc 克吕金插值分析参数类。通过该类可以设置克吕金插值分析所需的参数。
- * 克吕金(Kriging)法为地统计学上一种空间数据内插处理方法,主要的目的是利用各数据点间变异数(variance)的大小来推求某一未知点与各已知点的权重关系,
- * 再由各数据点的值和其与未知点的权重关系推求未知点的值。Kriging 法最大的特色不仅是提供一个最小估计误差的预测值,并且可明确的指出误差值的大小。
- * 一般而言,许多地质参数,如地形面,本身即具有连续性,故在一段距离内的任两点必有空间上的关系。反之,在一不规则面上的两点若相距甚远,
- * 则在统计意义上可视为互为独立 (stastically indepedent)。这种随距离而改变的空间上连续性,可用半变异图 (semivariogram) 来表现。
- * 因此,若想由已知的散乱点来推求某一未知点的值,则可利用半变异图推求各已知点与未知点的空间关系,即以下四个参数:<br>
- * 1.块金值(nugget):当采样点间距为0时,理论上半变异函数值为0,但时间上两采样点非常接近时半变异函数值并不为0,即产生了上图所示的块金效应,
- * 对应的半变异函数值为块金值。块金值可能由于测量误差或者空间变异产生。<br>
- * 2.基台值(sill):随着采样点间距的不断增大,半变异函数的值趋向一个稳定的常数,该常数成为基台值。到达基台值后,半变异函数的值不再随采样点间距而改变,
- * 即大于此间距的采样点不再具有空间相关性。<br>
- * 3.偏基台值:基台值与块金值的差值。<br>
- * 4.自相关阈值(range):也称变程,是半变异函数值达到基台值时,采样点的间距。超过自相关阈值的采样点不再具有空间相关性,将不对预测结果产生影响。<br>
- * 然后,由此空间参数推求半变异数,由各数据点间的半变异数可推求未知点与已知点间的权重关系,进而推求出未知点的值。
- * 克吕金法的优点是以空间统计学作为其坚实的理论基础,物理含义明确;不但能估计测定参数的空间变异分布,而且还可以估算参数的方差分布。克吕金法的缺点是计算步骤较烦琐,
- * 计算量大,且变异函数有时需要根据经验人为选定。
- *
- * 由上述可知,半变异函数是克吕金插值的关键,因此选择合适的半变异函数模型非常重要,SuperMap 提供了以下三种半变异函数模型:<br>
- * 1.指数型(EXPONENTIAL):适用于空间相关关系随样本间距的增加成指数递减的情况,其空间自相关关系在样本间距的无穷远处完全消失。<br>
- * 2.球型(SPHERICAL):适用于空间自相关关系随样本间距的增加而逐渐减少,直到超出一定的距离时空间自相关关系消失的情况。<br>
- * 3.高斯型(GAUSSIAN):适用于半变异函数值渐进地逼近基台值的情况。<br>
- *
- * 半变异函数中,有一个关键参数即插值的字段值的期望(平均值),由于对于此参数的不同处理方法而衍生出了不同的 Kriging 方法。SuperMap的差值功能基于以下三种常用 Kriging 算法:<br>
- * 1.简单克吕金(Simple Kriging):该方法假定用于插值的字段值的期望(平均值)已知的某一常数。<br>
- * 2.普通克吕金(Kriging):该方法假定用于插值的字段值的期望(平均值)未知且恒定。它利用一定的数学函数,通过对给定的空间点进行拟合来估算单元格的值,
- * 生成格网数据集。它不仅可以生成一个表面,还可以给出预测结果的精度或者确定性的度量。因此,此方法计算精度较高,常用于地学领域。
- * 3.泛克吕金(Universal Kriging):该方法假定用于插值的字段值的期望(平均值)是未知的变量。在样点数据中存在某种主导趋势且该趋势可以通过某一个确定
- * 的函数或者多项式进行拟合的情况下,适用泛克吕金插值法。<br>
- * @param {Object} options - 参数。
- * @param {string} options.type - 克吕金插值的类型。
- * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
- * @param {string} options.searchMode - 插值运算时,查找参与运算点的方式,有固定点数查找、定长查找、块查找。
- * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
- * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
- * @param {string} [options.zValueFieldName] - 存储用于进行插值分析的字段名称,插值分析不支持文本类型的字段。当插值分析类型(InterpolationAnalystParameters.prototype.InterpolationAnalystType)为 dataset 时,此为必选参数。
- * @param {number} [options.mean] - 【简单克吕金】类型下,插值字段的平均值。
- * @param {number} [options.angle=0] - 克吕金算法中旋转角度值。
- * @param {number} [options.nugget=0] - 克吕金算法中块金效应值。
- * @param {number} [options.range=0] - 克吕金算法中自相关阈值,单位与原数据集单位相同。
- * @param {number} [options.sill=0] - 克吕金算法中基台值。
- * @param {string} [options.variogramMode="SPHERICAL"] - 克吕金插值时的半变函数类型。
- * @param {string} [options.exponent='exp1'] - 【泛克吕金】类型下,用于插值的样点数据中趋势面方程的阶数,可选值为 exp1、exp2。
- * @param {number} [options.expectedCount=12] - 【固定点数查找】方式下,设置待查找的点数;【定长查找】方式下,设置查找的最小点数。
- * @param {number} [options.searchRadius=0] - 【定长查找】方式下,设置参与运算点的查找范围。
- * @param {number} [options.maxPointCountForInterpolation=200] - 【块查找】方式下,设置最多参与插值的点数。
- * @param {number} [options.maxPointCountInNode=50] - 【块查找】方式下,设置单个块内最多参与运算点数。
- * @param {number} [options.zValueScale=1] - 用于进行插值分析值的缩放比率。
- * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
- * @param {FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
- * @param {string} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
- * @param {string} [options.dataset] - 要用来做插值分析的数据源中数据集的名称。该名称用形如 ”数据集名称@数据源别名” 形式来表示。当插值分析类型(InterpolationAnalystParameters.prototype.InterpolationAnalystType)为 dataset 时。
- * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(InterpolationAnalystParameters.prototype.InterpolationAnalystType)为 geometry 时。
- * @extends {InterpolationAnalystParameters}
- * @example 例如:
- * var myInterpolationKrigingAnalystParameters = new InterpolationKrigingAnalystParameters({
- * dataset:"SamplesP@Interpolation",
- * type: "KRIGING",
- * angle: 0,
- * mean: 5,
- * nugget: 30,
- * range: 50,
- * sill: 300,
- * variogramMode: "EXPONENTIAL",
- * searchMode: "QUADTREE",
- * maxPointCountForInterpolation: 20,
- * maxPointCountInNode: 5,
- * pixelFormat: "BIT16",
- * zValueFieldName: "AVG_TMP",
- * resolution: 30000,
- * filterQueryParameter: {
- * attributeFilter: ""
- * },
- * outputDatasetName: "myKriging"
- * });
- * @usage
- */
- class InterpolationKrigingAnalystParameters extends InterpolationAnalystParameters {
- constructor(options) {
- super(options);
- /**
- * @member {InterpolationAlgorithmType} InterpolationKrigingAnalystParameters.prototype.type
- * @description 克吕金插值的类型。
- * 具体如下:<br>
- * {KRIGING} 普通克吕金插值法。
- * {SimpleKriging} 简单克吕金插值法。
- * {UniversalKriging} 泛克吕金插值法。
- */
- this.type = null;
- /**
- * @member {number} InterpolationKrigingAnalystParameters.prototype.mean
- * @description 【简单克吕金】方式下,插值字段的平均值。
- * 即采样点插值字段值总和除以采样点数目。
- */
- this.mean = null;
- /**
- * @member {number} [InterpolationKrigingAnalystParameters.prototype.angle=0]
- * @description 克吕金算法中旋转角度值。
- * 此角度值指示了每个查找邻域相对于水平方向逆时针旋转的角度。
- */
- this.angle = 0;
- /**
- * @member {number} [InterpolationKrigingAnalystParameters.prototype.nugget=0]
- * @description 克吕金算法中块金效应值。
- */
- this.nugget = 0;
- /**
- * @member {number} [InterpolationKrigingAnalystParameters.prototype.range=0]
- * @description 克吕金算法中自相关阈值,单位与原数据集单位相同。
- */
- this.range = 0;
- /**
- * @member {number} [InterpolationKrigingAnalystParameters.prototype.sill=0]
- * @description 克吕金算法中基台值。
- */
- this.sill = 0;
- /**
- * @member {VariogramMode} [InterpolationKrigingAnalystParameters.prototype.variogramMode=VariogramMode.SPHERICAL]
- * @description 克吕金插值时的半变函数类型。
- * 用户所选择的半变函数类型会影响未知点的预测,特别是曲线在原点处的不同形状有重要意义。
- * 曲线在原点处越陡,则较近领域对该预测值的影响就越大,因此输出表面就会越不光滑。
- */
- this.variogramMode = VariogramMode.SPHERICAL;
- /**
- * @member {Exponent} [InterpolationKrigingAnalystParameters.prototype.exponent=Exponent.EXP1]
- * @description 【泛克吕金】类型下,用于插值的样点数据中趋势面方程的阶数。
- */
- this.exponent = Exponent.EXP1;
- /**
- * @member {SearchMode} InterpolationKrigingAnalystParameters.prototype.searchMode
- * @description 插值运算时,查找参与运算点的方式,有固定点数查找、定长查找、块查找。此为必选参数。
- * 简单克吕金和泛克吕金不支持块查找。
- * 具体如下:<br>
- * {KDTREE_FIXED_COUNT} 使用 KDTREE 的固定点数方式查找参与内插分析的点。<br>
- * {KDTREE_FIXED_RADIUS} 使用 KDTREE 的定长方式查找参与内插分析的点。<br>
- * {QUADTREE} 使用 QUADTREE 方式查找参与内插分析的点(块查找)。
- */
- this.searchMode = null;
- /**
- * @member {number} [InterpolationKrigingAnalystParameters.prototype.expectedCount=12]
- * @description 【固定点数查找】方式下,设置待查找的点数,即参与差值运算的点数,默认值为12。
- * 【定长查找】方式下,设置查找的最小点数,默认值为12。
- */
- this.expectedCount = 12;
- /**
- * @member {number} [InterpolationKrigingAnalystParameters.prototype.maxPointCountForInterpolation=200]
- * @description 【块查找】方式下,最多参与插值的点数。
- * 仅用于普通克吕金插值,简单克吕金和泛克吕金不支持块查找。
- */
- this.maxPointCountForInterpolation = 200;
- /**
- * @member {number} [InterpolationKrigingAnalystParameters.prototype.maxPointCountInNode=50]
- * @description 【块查找】方式下,设置单个块内最多参与运算点数。
- * 仅用于普通克吕金插值,简单克吕金和泛克吕金不支持块查找。
- */
- this.maxPointCountInNode = 50;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.InterpolationKrigingAnalystParameters";
- }
- /**
- * @function InterpolationKrigingAnalystParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- super.destroy();
- var me = this;
- me.type = null;
- me.mean = null;
- me.angle = null;
- me.nugget = null;
- me.range = null;
- me.sill = null;
- me.variogramMode = null;
- me.exponent = null;
- me.searchMode = null;
- me.expectedCount = null;
- me.maxPointCountForInterpolation = null;
- me.maxPointCountInNode = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationAnalystService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class InterpolationAnalystService
- * @deprecatedclass SuperMap.InterpolationAnalystService
- * @category iServer SpatialAnalyst InterpolationAnalyst
- * @classdesc 插值分析服务类。
- * 插值分析可以将有限的采样点数据,通过插值算法对采样点周围的数值情况进行预测,可以掌握研究区域内数据的总体分布状况,从而使采样的离散点不仅仅反映其所在位置的数值情况,
- * 还可以反映区域的数值分布。目前SuperMap iServer的插值功能提供从点数据集插值得到栅格数据集的功能,支持以下常用的内插方法,
- * 包括:反距离加权插值、克吕金(Kriging)插值法、样条(径向基函数,Radial Basis Function)插值、点密度插值。
- * @param {string} url - 服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 需要被注册的监听器对象。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @extends {SpatialAnalystBase}
- * @example 例如:
- * (start code)
- * var myTInterpolationAnalystService = new InterpolationAnalystService(url);
- * myTInterpolationAnalystService.events.on({
- * "processCompleted": processCompleted,
- * "processFailed": processFailed
- * }
- * );
- * (end)
- * @usage
- */
- class InterpolationAnalystService extends SpatialAnalystBase {
- constructor(url, options) {
- super(url, options);
- /**
- * @member {string} InterpolationAnalystService.prototype.mode
- * @description 插值分析类型。
- */
- this.mode = null;
- if (options) {
- Util.extend(this, options);
- }
- }
- /**
- * @function InterpolationAnalystService.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- super.destroy();
- this.mode = null;
- this.CLASS_NAME = "SuperMap.InterpolationAnalystService";
- }
- /**
- * @function InterpolationAnalystService.prototype.processAsync
- * @description 负责将客户端的查询参数传递到服务端。
- * @param {InterpolationDensityAnalystParameters|InterpolationIDWAnalystParameters|InterpolationRBFAnalystParameters|InterpolationKrigingAnalystParameters} parameter - 插值分析参数类。
- */
- processAsync(parameter) {
- var parameterObject = {};
- var me = this;
- if (parameter instanceof InterpolationDensityAnalystParameters) {
- me.mode = 'Density';
- if (parameter.InterpolationAnalystType === 'geometry') {
- me.url = Util.urlPathAppend(me.url, 'geometry/interpolation/density');
- } else {
- me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/interpolation/density');
- }
- } else if (parameter instanceof InterpolationIDWAnalystParameters) {
- me.mode = 'IDW';
- if (parameter.InterpolationAnalystType === 'geometry') {
- me.url = Util.urlPathAppend(me.url, 'geometry/interpolation/idw');
- } else {
- me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/interpolation/idw');
- }
- } else if (parameter instanceof InterpolationRBFAnalystParameters) {
- me.mode = 'RBF';
- if (parameter.InterpolationAnalystType === 'geometry') {
- me.url = Util.urlPathAppend(me.url, 'geometry/interpolation/rbf');
- } else {
- me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/interpolation/rbf');
- }
- } else if (parameter instanceof InterpolationKrigingAnalystParameters) {
- me.mode = 'Kriging';
- if (parameter.InterpolationAnalystType === 'geometry') {
- me.url = Util.urlPathAppend(me.url, 'geometry/interpolation/kriging');
- } else {
- me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/interpolation/kriging');
- }
- }
- InterpolationAnalystParameters.toObject(parameter, parameterObject);
- var jsonParameters = Util.toJSON(parameterObject);
- me.url = Util.urlAppend(me.url, 'returnContent=true');
- me.request({
- method: "POST",
- data: jsonParameters,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/KernelDensityJobParameter.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class KernelDensityJobParameter
- * @deprecatedclass SuperMap.KernelDensityJobParameter
- * @category iServer ProcessingService DensityAnalyst
- * @classdesc 核密度分析服务参数类。
- * @param {Object} options - 参数。
- * @param {string} options.datasetName - 数据集名。
- * @param {string} options.fields - 权重索引。
- * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} [options.query] - 分析范围(默认为全图范围)。
- * @param {number} [options.resolution=80] - 分辨率。
- * @param {number} [options.method=0] - 分析方法。
- * @param {number} [options.meshType=0] - 分析类型。
- * @param {number} [options.radius=300] - 分析的影响半径。
- * @param {OutputSetting} [options.output] - 输出参数设置。
- * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
- * @usage
- */
- class KernelDensityJobParameter {
- constructor(options) {
- if (!options) {
- return;
- }
- /**
- * @member {string} KernelDensityJobParameter.prototype.datasetName
- * @description 数据集名。
- */
- this.datasetName = "";
- /**
- * @member {SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject} [KernelDensityJobParameter.prototype.query]
- * @description 分析范围。
- */
- this.query = "";
- /**
- * @member {number} [KernelDensityJobParameter.prototype.resolution=80]
- * @description 网格大小。
- */
- this.resolution = 80;
- /**
- * @member {number} [KernelDensityJobParameter.prototype.method=0]
- * @description 分析方法。
- */
- this.method = 0;
- /**
- * @member {number} [KernelDensityJobParameter.prototype.meshType=0]
- * @description 分析类型。
- */
- this.meshType = 0;
- /**
- * @member {string} KernelDensityJobParameter.prototype.fields
- * @description 权重索引。
- */
- this.fields = "";
- /**
- * @member {number} [KernelDensityJobParameter.prototype.radius=300]
- * @description 分析的影响半径。
- */
- this.radius = 300;
- /**
- * @member {AnalystSizeUnit} [KernelDensityJobParameter.prototype.meshSizeUnit=AnalystSizeUnit.METER]
- * @description 网格大小单位。
- */
- this.meshSizeUnit = AnalystSizeUnit.METER;
- /**
- * @member {AnalystSizeUnit} [KernelDensityJobParameter.prototype.radiusUnit=AnalystSizeUnit.METER]
- * @description 搜索半径单位。
- */
- this.radiusUnit = AnalystSizeUnit.METER;
- /**
- * @member {AnalystAreaUnit} [KernelDensityJobParameter.prototype.areaUnit=AnalystAreaUnit.SQUAREMILE]
- * @description 面积单位。
- */
- this.areaUnit = AnalystAreaUnit.SQUAREMILE;
- /**
- * @member {OutputSetting} KernelDensityJobParameter.prototype.output
- * @description 输出参数设置类
- */
- this.output = null;
- /**
- * @member {MappingParameters} [KernelDensityJobParameter.prototype.mappingParameters]
- * @description 分析后结果可视化的参数类。
- */
- this.mappingParameters = null;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.KernelDensityJobParameter";
- }
- /**
- * @function KernelDensityJobParameter.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- this.datasetName = null;
- this.query = null;
- this.resolution = null;
- this.method = null;
- this.radius = null;
- this.meshType = null;
- this.fields = null;
- this.meshSizeUnit = null;
- this.radiusUnit = null;
- this.areaUnit = null;
- if (this.output instanceof OutputSetting) {
- this.output.destroy();
- this.output = null;
- }
- if (this.mappingParameters instanceof MappingParameters) {
- this.mappingParameters.destroy();
- this.mappingParameters = null;
- }
- }
- /**
- * @function KernelDensityJobParameter.toObject
- * @param {KernelDensityJobParameter} kernelDensityJobParameter - 核密度分析服务参数类。
- * @param {KernelDensityJobParameter} tempObj - 核密度分析服务参数对象。
- * @description 将核密度分析服务参数对象转换为 JSON 对象。
- * @returns JSON 对象。
- */
- static toObject(kernelDensityJobParameter, tempObj) {
- for (var name in kernelDensityJobParameter) {
- if (name === "datasetName") {
- tempObj['input'] = tempObj['input'] || {};
- tempObj['input'][name] = kernelDensityJobParameter[name];
- continue;
- }
- if (name === "output") {
- tempObj['output'] = tempObj['output'] || {};
- tempObj['output'] = kernelDensityJobParameter[name];
- continue;
- }
- tempObj['analyst'] = tempObj['analyst'] || {};
- if (name === 'query' && kernelDensityJobParameter[name]) {
- tempObj['analyst'][name] = kernelDensityJobParameter[name].toBBOX();
- } else {
- tempObj['analyst'][name] = kernelDensityJobParameter[name];
- }
- if (name === 'mappingParameters') {
- tempObj['analyst'][name] = tempObj['analyst'][name] || {};
- tempObj['analyst']['mappingParameters'] = kernelDensityJobParameter[name];
- }
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/KernelDensityJobsService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class KernelDensityJobsService
- * @deprecatedclass SuperMap.KernelDensityJobsService
- * @category iServer ProcessingService DensityAnalyst
- * @classdesc 核密度分析服务类
- * @extends {ProcessingServiceBase}
- * @param {string} url - 服务地址。
- * @param {Object} options - 可选参数。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class KernelDensityJobsService extends ProcessingServiceBase {
- constructor(url, options) {
- super(url, options);
- this.url = Util.urlPathAppend(this.url, 'spatialanalyst/density');
- this.CLASS_NAME = "SuperMap.KernelDensityJobsService";
- }
- /**
- * @function KernelDensityJobsService.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function KernelDensityJobsService.prototype.getKernelDensityJobs
- * @description 获取核密度分析任务
- */
- getKernelDensityJobs() {
- super.getJobs(this.url);
- }
- /**
- * @function KernelDensityJobsService.prototype.getKernelDensityJobs
- * @description 获取指定id的核密度分析服务
- * @param {string} id - 指定要获取数据的id
- */
- getKernelDensityJob(id) {
- super.getJobs(Util.urlPathAppend(this.url, id));
- }
- /**
- * @function KernelDensityJobsService.prototype.addKernelDensityJob
- * @description 新建核密度分析服务
- * @param {KernelDensityJobParameter} params - 核密度分析服务参数类。
- * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
- */
- addKernelDensityJob(params, seconds) {
- super.addJob(this.url, params, KernelDensityJobParameter, seconds);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/LabelMatrixCell.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class LabelMatrixCell
- * @deprecatedclass SuperMap.LabelMatrixCell
- * @category iServer Map Theme
- * @classdesc 矩阵标签元素抽象类。该类可以包含 n*n 个矩阵标签元素,矩阵标签元素的类型可以是图片,符号,标签专题图等。
- * 符号类型的矩阵标签元素类、图片类型的矩阵标签元素类和专题图类型的矩阵标签元素类均继承自该类。
- * @usage
- */
- class LabelMatrixCell {
- constructor() {
- this.CLASS_NAME = "LabelMatrixCell";
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/LabelImageCell.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class LabelImageCell
- * @deprecatedclass SuperMap.LabelImageCell
- * @category iServer Map Theme
- * @classdesc 图片类型的矩阵标签元素类。该类继承自 {@link LabelMatrixCell}类,主要对矩阵标签中的专题图类型的矩阵标签元素进行设置。
- * 矩阵标签专题图是标签专题图(ThemeLabel)的一种,其中矩阵标签中的填充元素又可分为图片类型({@link LabelImageCell})、
- * 符号类型({@link LabelSymbolCell})、专题图类型({@link LabelThemeCell})三种,该类是这三种类型的矩阵标签元素其中的一种,
- * 用于定义符号类型的矩阵标签,如符号 ID 字段名称(符号 ID 与 SuperMap 桌面产品中点、线、面符号的 ID 对应) 、大小等。
- * 用户在实现矩阵标签专题图时只需将定义好的矩阵标签元素赋值予 {@link ThemeLabel#matrixCells} 属性即可。matrixCells 是一个二维数组,
- * 每一维可以是任意类型的矩阵标签元素组成的数组(也可是单个标签元素组成的数组,即数组中只有一个元素)。
- * @extends {LabelMatrixCell}
- * @param {Object} options - 可选参数。
- * @param {number} [options.height=0] - 设置图片的高度,单位为毫米。
- * @param {string} [options.pathField] - 设置矩阵标签元素所使用图片的路径。
- * @param {number} [options.rotation=0.0] - 图片的旋转角度。逆时针方向为正方向,单位为度,精确到0.1度。
- * @param {number} [options.width=0] - 设置图片的宽度,单位为毫米。
- * @param {boolean} [options.sizeFixed=false] - 是否固定图片的大小。
- * @usage
- */
- class LabelImageCell extends LabelMatrixCell {
- constructor(options) {
- super(options);
- /**
- * @member {number} LabelImageCell.prototype.height
- * @description 设置图片的高度,单位为毫米。
- */
- this.height = 0;
- /**
- * @member {string} LabelImageCell.prototype.pathField
- * @description 设置矩阵标签元素所使用的图片路径对应的字段名。
- */
- this.pathField = null;
- /**
- * @member {number} [LabelImageCell.prototype.rotation=0.0]
- * @description 图片的旋转角度。逆时针方向为正方向,单位为度,精确到0.1度。
- */
- this.rotation = 0.0;
- /**
- * @member {number} LabelImageCell.prototype.width
- * @description 设置图片的宽度,单位为毫米。
- */
- this.width = 0;
- /**
- * @member {boolean} [LabelImageCell.prototype.sizeFixed=false]
- * @description 是否固定图片的大小。
- */
- this.sizeFixed = false;
- /**
- * @member {string} LabelImageCell.prototype.type
- * @description 制作矩阵专题图时是必须的。
- */
- this.type = "IMAGE";
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.LabelImageCell";
- }
- /**
- * @function LabelImageCell.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.height = null;
- me.pathField = null;
- me.rotation = null;
- me.width = null;
- me.sizeFixed = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/LabelSymbolCell.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class LabelSymbolCell
- * @deprecatedclass SuperMap.LabelSymbolCell
- * @category iServer Map Theme
- * @classdesc 符号类型的矩阵标签元素类。
- * 该类继承自 {@link LabelMatrixCell}类,主要对矩阵标签中的专题图类型的矩阵标签元素进行设置。
- * 矩阵标签专题图是标签专题图({@link ThemeLabel})的一种,其中矩阵标签中的填充元素又可分为图片类型({@link LabelImageCell})、
- * 符号类型({@link LabelSymbolCell})、专题图类型({@link LabelThemeCell})三种,该类是这三种类型的矩阵标签元素其中的一种,
- * 用于定义符号类型的矩阵标签,如符号 ID 字段名称(符号 ID 与 SuperMap 桌面产品中点、线、面符号的 ID 对应) 、大小等。
- * 用户在实现矩阵标签专题图时只需将定义好的矩阵标签元素赋值予 {@link ThemeLabel#matrixCells} 属性即可。matrixCells 属是一个二维数组,
- * 每一维可以是任意类型的矩阵标签元素组成的数组(也可是单个标签元素组成的数组,即数组中只有一个元素)。
- * @extends {LabelMatrixCell}
- * @param {Object} options - 参数。
- * @param {ServerStyle} options.style - 获取或设置符号样式。
- * @param {string} options.symbolIDField - 符号 ID 或符号 ID 所对应的字段名称。
- * @usage
- */
- class LabelSymbolCell extends LabelMatrixCell {
- constructor(options) {
- super(options);
- /**
- * @member {ServerStyle} LabelSymbolCell.prototype.style
- * @description 获取或设置符号样式—— {@link ServerStyle} 对象,包括符号大小({@link ServerStyle#markerSize})
- * 和符号旋转({@link ServerStyle#markerAngle})角度,其中用于设置符号 ID 的属性({@link ServerStyle#markerSymbolID})在此处不起作用。
- */
- this.style = new ServerStyle();
- /**
- * @member {string} LabelSymbolCell.prototype.symbolIDField
- * @description 获取或设置符号 ID 或符号 ID 所对应的字段名称。
- */
- this.symbolIDField = null;
- /**
- * @member {string} LabelSymbolCell.prototype.type
- * @description 制作矩阵专题图时是必须的。
- */
- this.type = "SYMBOL";
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.LabelSymbolCell";
- }
- /**
- * @function LabelSymbolCell.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- if (me.style) {
- me.style.destroy();
- me.style = null;
- }
- me.symbolIDField = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/LabelThemeCell.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class LabelThemeCell
- * @deprecatedclass SuperMap.LabelThemeCell
- * @category iServer Map Theme
- * @classdesc 专题图类型的矩阵标签元素类。
- * 该类继承自 {@link LabelMatrixCell} 类,主要对矩阵标签中的专题图类型的矩阵标签元素进行设置。
- * 矩阵标签专题图是标签专题图({@link ThemeLabel})的一种,其中矩阵标签中的填充元素又可分为图片类型({@link LabelImageCell})、
- * 符号类型({@link LabelSymbolCell})、专题图类型({@link LabelThemeCell})三种,该类是这三种类型的矩阵标签元素其中的一种,
- * 用于定义符号类型的矩阵标签,如符号 ID 字段名称(符号 ID 与 SuperMap 桌面产品中点、线、面符号的 ID 对应) 、大小等。
- * 用户在实现矩阵标签专题图时只需将定义好的矩阵标签元素赋值予 {@link ThemeLabel#matrixCells} 属性即可。matrixCells 属是一个二维数组,
- * 每一维可以是任意类型的矩阵标签元素组成的数组(也可是单个标签元素组成的数组,即数组中只有一个元素)。
- * @extends {LabelMatrixCell}
- * @param {Object} options -参数。
- * @param {ThemeLabel} options.themeLabel - 作为矩阵标签元素的标签专题图类。
- * @usage
- */
- class LabelThemeCell extends LabelMatrixCell {
- constructor(options) {
- super(options);
- /**
- * @member {ThemeLabel} LabelThemeCell.prototype.themeLabel
- * @description 使用专题图对象作为矩阵标签的一个元素。
- */
- this.themeLabel = new ThemeLabel();
- /**
- * @member {string} LabelThemeCell.prototype.type
- * @description 制作矩阵专题图时是必须的。
- */
- this.type = "THEME";
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = " SuperMap.LabelThemeCell";
- }
- /**
- * @function LabelThemeCell.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- if (me.themeLabel) {
- me.themeLabel.destroy();
- me.themeLabel = null;
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/LayerStatus.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class LayerStatus
- * @deprecatedclass SuperMap.LayerStatus
- * @category iServer Map TempLayersSet
- * @classdesc 子图层显示参数类。该类存储了各个子图层的名字和是否可见的状态。
- * @param {Object} options - 参数。
- * @param {string} options.layerName - 图层名称。
- * @param {boolean} [options.isVisible=true] - 图层是否可见,true 表示可见。
- * @param {string} [options.displayFilter] - 图层显示 SQL 过滤条件。
- * @usage
- */
- class LayerStatus {
- constructor(options) {
- /**
- * @member {string} LayerStatus.prototype.layerName
- * @description 获取或设置图层名称。
- */
- this.layerName = null;
- /**
- * @member {boolean} LayerStatus.prototype.isVisible
- * @description 获取或设置图层是否可见,true 表示可见。
- */
- this.isVisible = null;
- /**
- * @member {string} [LayerStatus.prototype.displayFilter]
- * @description 图层显示 SQL 过滤条件,如 layerStatus.displayFilter = "smid < 10",表示仅显示 smid 值小于 10 的对象。
- */
- this.displayFilter = null;
- /**
- * @member {Object} [LayerStatus.prototype.fieldValuesDisplayFilter]
- * @property {Array.<number>} values - 要过滤的值。
- * @property {string} fieldName - 要过滤的字段名称只支持数字类型的字段。
- * @property {string} fieldValuesDisplayMode - 目前有两个 DISPLAY/DISABLE。当为 DISPLAY 时,表示只显示以上设置的相应属性值的要素,否则表示不显示以上设置的相应属性值的要素。
- */
- this.fieldValuesDisplayFilter = null;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.LayerStatus";
- }
- /**
- * @function LayerStatus.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.layerName = null;
- me.isVisible = null;
- me.displayFilter = null;
- }
- /**
- * @function LayerStatus.prototype.toJSON
- * @description 生成对应的 JSON。
- * @returns {Object} 对应的 JSON。
- */
- toJSON() {
- var json = '{';
- json += '"type":"UGC",';
- var v = [];
- if (this.layerName) {
- v.push('"name":"' + this.layerName + '"');
- v.push('"visible":' + this.isVisible);
- }
- if (this.displayFilter) {
- v.push('"displayFilter":"' + this.displayFilter + '"');
- }
- if (this.minScale || this.minScale == 0) {
- v.push('"minScale":' + this.minScale);
- }
- if (this.maxScale || this.maxScale == 0) {
- v.push('"maxScale":' + this.maxScale);
- }
- if (this.fieldValuesDisplayFilter) {
- v.push('"fieldValuesDisplayFilter":' + Util.toJSON(this.fieldValuesDisplayFilter));
- }
- json += v;
- json += '}';
- return json;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/LinkItem.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class LinkItem
- * @deprecatedclass SuperMap.LinkItem
- * @constructs LinkItem
- * @category iServer Data FeatureResults
- * @classdesc 关联信息类。该类用于矢量数据集与外部表的关联。 外部表是另一个数据集(其中纯属性数据集中没有空间几何信息)中的 DBMS 表,
- * 矢量数据集与外部表可以属于不同的数据源,但数据源类型目前只支持 SQL Server 和 Oracle 类型。使用 LinkItem 时,
- * 空间数据和属性数据必须满足关联条件,即主空间数据集与外部属性表之间存在关联字段。{@link LinkItem}
- * 只支持左连接,UDB、PostgreSQL 和 DB2 数据源不支持 {@link LinkItem};另外,用于建立关联关系的两个表可以不在同一个数据源下。注意:<br>
- * 1.使用 {@link LinkItem} 的约束条件为:空间数据和属性数据必须有关联条件,即主空间数据集与外部属性表之间存在关联字段;<br>
- * 2.使用外关联表制作专题图时,所关联的字段必须设置表名,例如,如果所关联的字段为 BaseMap_R 数据集的 SmID,就要写成 BaseMap_R.SMID。
- * @param {Object} options - 参数。
- * @param {DatasourceConnectionInfo} options.datasourceConnectionInfo - 关联的外部数据源信息。
- * @param {Array.<string>} options.foreignKeys - 主空间数据集的外键。
- * @param {string} options.foreignTable - 关联的外部属性表的名称。
- * @param {Array.<string>} options.linkFields - 欲保留的外部属性表的字段。
- * @param {string} options.linkFilter - 与外部属性表的连接条件。
- * @param {string} options.name - 此关联信息对象的名称。
- * @param {Array.<string>} options.primaryKeys - 关联的外部属性表的主键。
- * @example 下面以 SQL 查询说明 linkitem 的使用方法:
- * function queryBySQL() {
- * // 设置关联的外部数据库信息,alias表示数据库别名
- * var dc = new DatasourceConnectionInfo({
- * dataBase: "RelQuery",
- * server: "{ip}:{port}",
- * user: "sa",
- * password: "map",
- * driver: "SQL Server",
- * connect: true,
- * OpenLinkTable: false,
- * alias: "RelQuery",
- * engineType: EngineType.SQLPLUS,
- * readOnly: false,
- * exclusive: false
- * });
- * // 设置关联信息
- * var linkItem = new LinkItem({
- * datasourceConnectionInfo: dc,
- * foreignKeys: ["name"],
- * foreignTable: "Pop_2011",
- * linkFields: ["SmID as Pid","pop"],
- * name: "link",
- * primatryKeys: ["name"],
- * });
- * // 设置查询参数,在查询参数中添加linkItem关联条件信息
- * var queryParam, queryBySQLParams, queryBySQLService;
- * queryParam = new FilterParameter({
- * name: "Province@RelQuery",
- * fields: ["SmID","name"],
- * attributeFilter: "SmID<7",
- * linkItems: [linkItem]
- * }),
- * queryBySQLParams = new QueryBySQLParameters({
- * queryParams: [queryParam]
- * }),
- * queryBySQLService = new QueryBySQLService(url, {
- * eventListeners: {
- * "processCompleted": processCompleted,
- * "processFailed": processFailed
- * }
- * });
- * queryBySQLService.processAsync(queryBySQLParams);
- * }
- * function processCompleted(queryEventArgs) {//todo}
- * function processFailed(e) {//todo}
- * @usage
- */
- class LinkItem {
- constructor(options) {
- /**
- * @member {DatasourceConnectionInfo} LinkItem.prototype.datasourceConnectionInfo
- * @description 关联的外部数据源信息。
- */
- this.datasourceConnectionInfo = null;
- /**
- * @member {Array.<string>} LinkItem.prototype.foreignKeys
- * @description 主空间数据集的外键。
- */
- this.foreignKeys = null;
- /**
- * @member {string} LinkItem.prototype.foreignTable
- * @description 关联的外部属性表的名称,目前仅支持 Supermap 管理的表,即另一个矢量数据集所对应的 DBMS 表。
- */
- this.foreignTable = null;
- /**
- * @member {Array.<string>} LinkItem.prototype.linkFields
- * @description 欲保留的外部属性表的字段。如果不设置字段或者设置的字段在外部属性表中不存在的话则不返
- * 回任何外部属性表的属性信息。如果欲保留的外部表字段与主表字段存在同名,则还需要指定一个不存在字段名作为外部表的字段别名。
- */
- this.linkFields = null;
- /**
- * @member {string} LinkItem.prototype.linkFilter
- * @description 与外部属性表的连接条件。
- */
- this.linkFilter = null;
- /**
- * @member {string} LinkItem.prototype.name
- * @description 此关联信息对象的名称。
- */
- this.name = null;
- /**
- * @member {Array.<string>} LinkItem.prototype.primaryKeys
- * @description 需要关联的外部属性表的主键。
- */
- this.primaryKeys = null;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.LinkItem";
- }
- /**
- * @function LinkItem.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- if (me.datasourceConnectionInfo instanceof DatasourceConnectionInfo) {
- me.datasourceConnectionInfo.destroy();
- me.datasourceConnectionInfo = null;
- }
- me.foreignKeys = null;
- me.foreignTable = null;
- me.linkFields = null;
- me.linkFilter = null;
- me.name = null;
- me.primaryKeys = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/MapService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class MapService
- * @deprecatedclass SuperMap.MapService
- * @category iServer Map
- * @classdesc 地图信息服务类。
- * @extends {CommonServiceBase}
- * @example
- * var myMapService = new MapService(url, {
- * eventListeners:{
- * "processCompleted": MapServiceCompleted,
- * "processFailed": MapServiceFailed
- * }
- * });
- *
- * @param {string} url - 服务地址。如:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 。
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
- * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class MapService extends CommonServiceBase {
- constructor(url, options) {
- super(url, options);
- /**
- * @member {string} MapService.prototype.projection
- * @description 根据投影参数获取地图状态信息。如"EPSG:4326"
- */
- this.projection = null;
- this.CLASS_NAME = "SuperMap.MapService";
- if (options) {
- Util.extend(this, options);
- }
- var me = this;
- if (me.projection) {
- var arr = me.projection.split(":");
- if (arr instanceof Array) {
- if (arr.length === 2) {
- me.url = Util.urlAppend(me.url,`prjCoordSys=${encodeURIComponent(`{\"epsgCode\":"${arr[1]}"}`)}`)
- }
- if (arr.length === 1) {
- me.url = Util.urlAppend(me.url,`prjCoordSys=${encodeURIComponent(`{\"epsgCode\":"${arr[0]}"}`)}`)
- }
- }
- }
- }
- /**
- * @function destroy
- * @description 释放资源,将引用的资源属性置空。
- */
- destroy() {
- super.destroy();
- var me = this;
- if (me.events) {
- me.events.un(me.eventListeners);
- me.events.listeners = null;
- me.events.destroy();
- me.events = null;
- me.eventListeners = null;
- }
- }
- /**
- * @function MapService.prototype.processAsync
- * @description 负责将客户端的设置的参数传递到服务端,与服务端完成异步通讯。
- */
- processAsync() {
- var me = this;
- me.request({
- method: "GET",
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- /*
- * Method: getMapStatusCompleted
- * 获取地图状态完成,执行此方法。
- *
- * Parameters:
- * {Object} result - 服务器返回的结果对象。
- */
- serviceProcessCompleted(result) {
- var me = this;
- result = Util.transformResult(result);
- var codeStatus = (result.code >= 200 && result.code < 300) || result.code == 0 || result.code === 304;
- var isCodeValid = result.code && codeStatus;
- if (!result.code || isCodeValid) {
- me.events && me.events.triggerEvent("processCompleted", {result: result});
- } else {
- ////在没有token是返回的是200,但是其实是没有权限,所以这里也应该是触发失败事件
- me.events.triggerEvent("processFailed", {error: result});
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/MathExpressionAnalysisParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class MathExpressionAnalysisParameters
- * @deprecatedclass SuperMap.MathExpressionAnalysisParameters
- * @category iServer SpatialAnalyst GridMathAnalyst
- * @classdesc 栅格代数运算参数类。
- * @param {Object} options - 参数。
- * @param {string} options.dataset - 指定栅格代数运算数据源中数据集的名称。该名称用形如"数据集名称@数据源别名"形式来表示,例如:BaseMap_P@Jingjin。
- * @param {string} options.resultGridName - 指定结果数据集名称。
- * @param {string} options.expression - 指定的栅格运算表达式。如:[DatasourceAlias1.Raster1]*2-10。
- * @param {string} options.targetDatasource - 指定存储结果数据集的数据源。
- * @param {GeometryPolygon|L.Polygon|ol.geom.Polygon|GeoJSONObject} [options.extractRegion] - 栅格代数运算的范围,指定数据集中参与栅格代数运算的区域。
- * 如果缺省,则计算全部区域,如果参与运算的数据集范围不一致,将使用所有数据集的范围的交集作为计算区域 。
- * @param {boolean} [options.isZip=false] - 是否对结果数据集进行压缩处理。
- * @param {boolean} [options.ignoreNoValue=false] - 是否忽略无值栅格数据。true 表示忽略无值数据,即无值栅格不参与运算。
- * @param {boolean} [options.deleteExistResultDataset=false] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
- * @usage
- */
- class MathExpressionAnalysisParameters {
- constructor(options) {
- if (!options) {
- return;
- }
- /**
- * @member {string} MathExpressionAnalysisParameters.prototype.dataset
- * @description 要用来做栅格代数运算数据源中数据集的名称。
- * 该名称用形如"数据集名称@数据源别名"形式来表示,例如:JingjinTerrain@Jingjin。
- *
- */
- this.dataset = null;
- /**
- * @member {GeometryPolygon|L.Polygon|ol.geom.Polygon|GeoJSONObject} [MathExpressionAnalysisParameters.prototype.extractRegion]
- * @description 栅格代数运算的范围,指定数据集中参与栅格代数运算的区域。
- * 如果缺省,则计算全部区域,如果参与运算的数据集范围不一致,将使用所有数据集的范围的交集作为计算区域 。
- */
- this.extractRegion = null;
- /**
- * @member {string} MathExpressionAnalysisParameters.prototype.expression
- * @description 指定的栅格运算表达式。如:"[DatasourceAlias1.Raster1]*2-10"。
- */
- this.expression = null;
- /**
- * @member {boolean} [MathExpressionAnalysisParameters.prototype.isZip=false]
- * @description 是否对结果数据集进行压缩处理。
- */
- this.isZip = false;
- /**
- * @member {boolean} [MathExpressionAnalysisParameters.prototype.ignoreNoValue=false]
- * @description 是否忽略无值栅格数据。
- */
- this.ignoreNoValue = false;
- /**
- * @member {string} MathExpressionAnalysisParameters.prototype.targetDatasource
- * @description 指定存储结果数据集的数据源。
- */
- this.targetDatasource = null;
- /**
- * @member {string} MathExpressionAnalysisParameters.prototype.resultGridName
- * @description 指定结果数据集名称。
- */
- this.resultGridName = null;
- /**
- * @member {boolean} [MathExpressionAnalysisParameters.prototype.deleteExistResultDataset=false]
- * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
- */
- this.deleteExistResultDataset = false;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.MathExpressionAnalysisParameters"
- }
- /**
- * @function MathExpressionAnalysisParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.dataset = null;
- me.bounds = null;
- me.expression = null;
- me.isZip = true;
- me.ignoreNoValue = true;
- me.targetDatasource = null;
- me.resultGridName = null;
- me.deleteExistResultDataset = null;
- }
- /**
- * @function MathExpressionAnalysisParameters.toObject
- * @param {Object} mathExpressionAnalysisParameters - 栅格代数运算参数。
- * @param {Object} tempObj - 目标对象。
- * @description 生成栅格代数运算对象。
- */
- static toObject(mathExpressionAnalysisParameters, tempObj) {
- for (var name in mathExpressionAnalysisParameters) {
- if (name !== "dataset") {
- tempObj[name] = mathExpressionAnalysisParameters[name];
- }
- if (name === "extractRegion") {
- if (mathExpressionAnalysisParameters[name]) {
- var bs = mathExpressionAnalysisParameters[name].components[0].components;
- var region = {},
- points = [],
- type = "REGION";
- var len = bs.length;
- for (var i = 0; i < len - 1; i++) {
- var poi = {};
- poi["x"] = bs[i].x;
- poi["y"] = bs[i].y;
- points.push(poi);
- }
- region["points"] = points;
- region["type"] = type;
- tempObj[name] = region;
- }
- }
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/MathExpressionAnalysisService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class MathExpressionAnalysisService
- * @deprecatedclass SuperMap.MathExpressionAnalysisService
- * @category iServer SpatialAnalyst GridMathAnalyst
- * @classdesc 栅格代数运算服务类。
- * @param {string} url - 服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 需要被注册的监听器对象。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @extends {SpatialAnalystBase}
- * @example 例如:
- * (start code)
- * var myMathExpressionAnalysisService = new MathExpressionAnalysisService(url);
- * myMathExpressionAnalysisService.on({
- * "processCompleted": processCompleted,
- * "processFailed": processFailed
- * }
- * );
- * (end)
- * @usage
- */
- class MathExpressionAnalysisService extends SpatialAnalystBase {
- constructor(url, options) {
- super(url, options);
- this.CLASS_NAME = "SuperMap.MathExpressionAnalysisService";
- }
- /**
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function MathExpressionAnalysisService.prototype.processAsync
- * @description 负责将客户端的查询参数传递到服务端。
- * @param {MathExpressionAnalysisParameters} parameter - 栅格代数运算参数类。
- */
- processAsync(parameter) {
- var me = this;
- var parameterObject = {};
- if (parameter instanceof MathExpressionAnalysisParameters) {
- me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/mathanalyst');
- }
- MathExpressionAnalysisParameters.toObject(parameter, parameterObject);
- var jsonParameters = Util.toJSON(parameterObject);
- me.url = Util.urlAppend(me.url, 'returnContent=true');
- me.request({
- method: "POST",
- data: jsonParameters,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/MeasureParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class MeasureParameters
- * @deprecatedclass SuperMap.MeasureParameters
- * @category iServer Map Measure
- * @classdesc 量算参数类。
- * @param {GeoJSONObject} geometry - 要量算的几何对象。
- * @param {Object} options - 可选参数。
- * @param {Unit} [options.unit=Unit.METER] - 量算单位。
- * @param {string} [options.prjCoordSys] - 用来指定该量算操作所使用的投影。
- * @param {string} [options.distanceMode="Geodesic"] - 用来指定量算的方式为按球面长度 'Geodesic' 或者平面长度 'Planar' 来计算。
- * @usage
- */
- class MeasureParameters {
- constructor(geometry, options) {
- if (!geometry) {
- return;
- }
- /**
- * @member {GeoJSONObject} MeasureParameters.prototype.geometry
- * @description 要量算的几何对象。<br>
- * 点类型可以是:{@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>
- * 线类型可以是:{@link GeometryLineString}|{@link GeometryLinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}|{@link GeoJSONObject}。<br>
- * 面类型可以是:{@link GeometryPolygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}|{@link GeoJSONObject}。
- */
- this.geometry = geometry;
- /**
- * @member {Unit} [MeasureParameters.prototype.unit=Unit.METER]
- * @description 量算单位。即量算结果以米为单位。
- */
- this.unit = Unit.METER;
- /**
- * @member {string} [MeasureParameters.prototype.prjCoordSys]
- * @description 用来指定该量算操作所使用的投影。
- */
- this.prjCoordSys = null;
- /**
- * @member {string} [MeasureParameters.prototype.distanceMode="Geodesic"]
- * @description 用来指定量算的方式为按球面长度 'Geodesic' 或者平面长度 'Planar' 来计算。
- * @example
- * var param = new MeasureParameters(getmetry,{distanceMode:'Planar'});
- */
- this.distanceMode = null;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.MeasureParameters";
- }
- /**
- * @function MeasureParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.geometry = null;
- me.unit = null;
- me.prjCoordSys = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/MeasureService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class MeasureService
- * @deprecatedclass SuperMap.MeasureService
- * @category iServer Map Measure
- * @classdesc 量算服务类。
- * 该类负责将量算参数传递到服务端,并获取服务端返回的量算结果。
- * @extends {CommonServiceBase}
- * @example
- * var myMeasuerService = new MeasureService(url, {
- * measureMode: MeasureMode.DISTANCE,
- * eventListeners:{
- * "processCompleted": measureCompleted
- * }
- * });
- * @param {string} url - 服务地址。如:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 。
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
- * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @param {MeasureMode} options.measureMode - 量算模式,包括距离量算模式和面积量算模式。
- * @usage
- */
- class MeasureService extends CommonServiceBase {
- constructor(url, options) {
- super(url, options);
- /**
- * @member {MeasureMode} [MeasureService.prototype.measureMode=MeasureMode.DISTANCE]
- * @description 量算模式,包括距离量算模式和面积量算模式。
- */
- this.measureMode = MeasureMode.DISTANCE;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.MeasureService";
- }
- /**
- * @override
- */
- destroy() {
- super.destroy();
- var me = this;
- me.measureMode = null;
- }
- /**
- * @function MeasureService.prototype.processAsync
- * @description 负责将客户端的量算参数传递到服务端。
- * @param {MeasureParameters} params - 量算参数。
- */
- processAsync(params) {
- if (!(params instanceof MeasureParameters)) {
- return;
- }
- var me = this,
- geometry = params.geometry,
- pointsCount = 0,
- point2ds = null;
- if (!geometry) {
- return;
- }
- me.url = Util.urlPathAppend(me.url, me.measureMode === MeasureMode.AREA ? 'area' : 'distance');
- var serverGeometry = ServerGeometry.fromGeometry(geometry);
- if (!serverGeometry) {
- return;
- }
- pointsCount = serverGeometry.parts[0];
- point2ds = serverGeometry.points.splice(0, pointsCount);
- var prjCoordSysTemp, prjCodeTemp, paramsTemp;
- if (params.prjCoordSys) {
- if (typeof (params.prjCoordSys) === "object") {
- prjCodeTemp = params.prjCoordSys.projCode;
- prjCoordSysTemp = '{"epsgCode"' + prjCodeTemp.substring(prjCodeTemp.indexOf(":"), prjCodeTemp.length) + "}";
- } else if (typeof (params.prjCoordSys) === "string") {
- prjCoordSysTemp = '{"epsgCode"' + params.prjCoordSys.substring(params.prjCoordSys.indexOf(":"), params.prjCoordSys.length) + "}";
- }
- paramsTemp = {
- "point2Ds": Util.toJSON(point2ds),
- "unit": params.unit,
- "prjCoordSys": prjCoordSysTemp,
- "distanceMode": params.distanceMode || 'Geodesic'
- };
- } else {
- paramsTemp = {"point2Ds": Util.toJSON(point2ds), "unit": params.unit, "distanceMode": params.distanceMode || 'Geodesic'};
- }
- me.request({
- method: "GET",
- params: paramsTemp,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/OverlapDisplayedOptions.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class OverlapDisplayedOptions
- * @deprecatedclass SuperMap.OverlapDisplayedOptions
- * @category iServer Map Layer
- * @classdesc 地图压盖过滤显示选项。在文本或专题图元素显示较密集的区域,文本之间或专题元素之间会发生相互压盖的现象,
- * 该类可以分别控制各种类型的对象的压盖显示情况,进而很好地处理地图中各种类型对象的压盖显示问题。
- * @param {Object} options - 可选参数。
- * @param {boolean} [options.allowPointOverlap=true] - 点和点压盖时是否显示压盖的点对象。
- * @param {boolean} [options.allowPointWithTextDisplay=true] - 标签和相应普通图层上的点是否一起过滤显示,如果过滤显示,
- * 只以图层集合中对应数据集的索引最小的图层的点风格来绘制点。
- * @param {boolean} [options.allowTextOverlap=false] - 文本压盖时是否显示压盖的文本对象。
- * @param {boolean} [options.allowTextAndPointOverlap=true] - 文本和点压盖时是否显示压盖的文本或点对象(此属性不处理文本之间的压盖和点之间的压盖)。
- * @param {boolean} [options.allowThemeGraduatedSymbolOverlap=false] - 等级符号元素压盖时是否显示压盖的等级符号元素。
- * @param {boolean} [options.allowThemeGraphOverlap=false] - 统计专题图元素压盖时是否显示压盖的统计专题图元素。
- * @param {number} [options.horizontalOverlappedSpaceSize=0] - 两个对象之间的横向压盖间距,单位为 0.1 毫米,跟 verticalOverlappedSpaceSize 结合使用,
- * 当两个对象的横向间距小于该值,且纵向间距小于 verticalOverlappedSpaceSize 时认为压盖。
- * @param {number} [options.verticalOverlappedSpaceSize=0] - 两个对象之间的纵向压盖间距,单位为 0.1 毫米,跟 horizontalOverlappedSpaceSize 结合使用,
- * 当两个对象的纵向间距小于该值,且横向间距小于 horizontalOverlappedSpaceSize 时认为压盖。
- * @usage
- */
- class OverlapDisplayedOptions {
- constructor(options) {
- options = options || {};
- /**
- * @member {boolean} [OverlapDisplayedOptions.prototype.allowPointOverlap=true]
- * @description 点和点压盖时是否显示压盖的点对象。
- */
- this.allowPointOverlap = true;
- /**
- * @member {boolean} [OverlapDisplayedOptions.prototype.allowPointWithTextDisplay=true]
- * @description 标签和相应普通图层上的点是否一起过滤显示,如果过滤显示,
- * 只以图层集合中对应数据集的索引最小的图层的点风格来绘制点。
- */
- this.allowPointWithTextDisplay = true;
- /**
- * @member {boolean} [OverlapDisplayedOptions.prototype.allowTextOverlap=false]
- * @description 文本压盖时是否显示压盖的文本对象。
- */
- this.allowTextOverlap = false;
- /**
- * @member {boolean} [OverlapDisplayedOptions.prototype.allowTextAndPointOverlap=true]
- * @description 文本和点压盖时是否显示压盖的文本或点对象(此属性不处理文本之间的压盖和点之间的压盖)。
- */
- this.allowTextAndPointOverlap = true;
- /**
- * @member {boolean} [OverlapDisplayedOptions.prototype.allowThemeGraduatedSymbolOverlap=false]
- * @description 等级符号元素压盖时是否显示压盖的等级符号元素。
- */
- this.allowThemeGraduatedSymbolOverlap = false;
- /**
- * @member {boolean} [OverlapDisplayedOptions.prototype.allowThemeGraphOverlap=false]
- * @description 统计专题图元素压盖时是否显示压盖的统计专题图元素。
- */
- this.allowThemeGraphOverlap = false;
- /**
- * @member {number} [OverlapDisplayedOptions.prototype.horizontalOverlappedSpaceSize=0]
- * @description 两个对象之间的横向压盖间距,单位为0.1毫米,跟 verticalOverlappedSpaceSize 结合使用,
- * 当两个对象的横向间距小于该值,且纵向间距小于 verticalOverlappedSpaceSize 时认为压盖。
- */
- this.horizontalOverlappedSpaceSize = 0;
- /**
- * @member {number} [OverlapDisplayedOptions.prototype.verticalOverlappedSpaceSize=0]
- * @description 两个对象之间的纵向压盖间距,单位为0.1毫米,跟 horizontalOverlappedSpaceSize 结合使用,
- * 当两个对象的纵向间距小于该值,且横向间距小于 horizontalOverlappedSpaceSize 时认为压盖。
- */
- this.verticalOverlappedSpaceSize = 0;
- Util.extend(this, options);
- this.ugcLayer = new UGCLayer(options);
- this.CLASS_NAME = "SuperMap.OverlapDisplayedOptions";
- }
- /**
- * @function OverlapDisplayedOptions.prototype.destroy
- * @description 释放资源,将资源的属性置空。
- */
- destroy() {
- Util.reset(this);
- }
- /**
- * @function OverlapDisplayedOptions.prototype.fromJson
- * @description 将服务端 JSON 对象转换成当前客户端对象。
- * @param {Object} jsonObject - 要转换的 JSON 对象。
- */
- fromJson(jsonObject) {
- this.ugcLayer.fromJson.apply(this, [jsonObject]);
- }
- /**
- * @function OverlapDisplayedOptions.prototype.toServerJSONObject
- * @description 转换成对应的 JSON 格式对象。
- * @returns {Object} 对应的 JSON 格式对象。
- */
- toServerJSONObject() {
- var jsonObject = this.ugcLayer.toServerJSONObject.apply(this, arguments);
- return jsonObject;
- }
- /**
- * @function OverlapDisplayedOptions.prototype.toString
- * @description 转换成对应的 tileLayer 请求瓦片时 overlapDisplayedOptions 参数。
- * @returns {string} 对应的 tileLayer 请求瓦片时 overlapDisplayedOptions 参数。
- */
- toString() {
- var jsonObject = this.ugcLayer.toServerJSONObject.apply(this, arguments);
- var str = "{";
- for (var attr in jsonObject) {
- if (jsonObject.hasOwnProperty(attr)) {
- str += "'" + attr + "':" + jsonObject[attr] + ",";
- }
- }
- str = str.substr(0, str.length - 1);
- str += "}";
- return str;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/OverlayAnalystService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class OverlayAnalystService
- * @deprecatedclass SuperMap.OverlayAnalystService
- * @category iServer SpatialAnalyst OverlayAnalyst
- * @classdesc 叠加分析服务类。
- * 该类负责将客户设置的叠加分析参数传递给服务端,并接收服务端返回的叠加分析结果数据。
- * 叠加分析结果通过该类支持的事件的监听函数参数获取
- * @param {string} url - 服务地址。如http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 需要被注册的监听器对象。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @extends {CommonServiceBase}
- * @example 例如:
- * (start code)
- * var myOverlayAnalystService = new OverlayAnalystService(url, {
- * eventListeners: {
- * "processCompleted": OverlayCompleted,
- * "processFailed": OverlayFailed
- * }
- * });
- * (end)
- * @usage
- */
- class OverlayAnalystService extends SpatialAnalystBase {
- constructor(url, options) {
- super(url, options);
- /**
- * @member {string} OverlayAnalystService.prototype.mode
- * @description 叠加分析类型
- */
- this.mode = null;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.OverlayAnalystService";
- }
- /**
- * @override
- */
- destroy() {
- super.destroy();
- this.mode = null;
- }
- /**
- * @function OverlayAnalystService.prototype.processAsync
- * @description 负责将客户端的查询参数传递到服务端。
- * @param {OverlayAnalystParameters} parameter - 叠加分析参数类。
- */
- processAsync(parameter) {
- var parameterObject = {};
- var me = this;
- if (parameter instanceof DatasetOverlayAnalystParameters) {
- me.mode = "datasets";
- me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.sourceDataset + '/overlay');
- DatasetOverlayAnalystParameters.toObject(parameter, parameterObject);
- } else if (parameter instanceof GeometryOverlayAnalystParameters) {
- me.mode = "geometry";
- //支持传入多个几何要素进行叠加分析
- if(parameter.operateGeometries && parameter.sourceGeometries){
- me.url = Util.urlPathAppend(me.url, 'geometry/overlay/batch');
- me.url = Util.urlAppend(me.url, 'ignoreAnalystParam=true');
- }else {
- me.url = Util.urlPathAppend(me.url, 'geometry/overlay');
- }
- GeometryOverlayAnalystParameters.toObject(parameter, parameterObject);
- }
- me.url = Util.urlAppend(me.url, 'returnContent=true');
- var jsonParameters = Util.toJSON(parameterObject);
- me.request({
- method: "POST",
- data: jsonParameters,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/OverlayGeoJobParameter.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class OverlayGeoJobParameter
- * @deprecatedclass SuperMap.OverlayGeoJobParameter
- * @category iServer ProcessingService OverlayAnalyst
- * @classdesc 叠加分析任务参数类。
- * @param {Object} options - 参数。
- * @param {string} options.datasetName - 数据集名。
- * @param {string} options.datasetOverlay - 叠加对象所在的数据集名称。
- * @param {string} options.srcFields - 输入数据需要保留的字段。
- * @param {string} [options.overlayFields] - 叠加数据需要保留的字段。对分析模式为 clip、update、erase 时,此参数无效。
- * @param {string} [options.mode] - 叠加分析模式。
- * @param {OutputSetting} [options.output] - 输出参数设置。
- * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
- * @usage
- */
- class OverlayGeoJobParameter {
- constructor(options) {
- if (!options) {
- return;
- }
- /**
- * @member {string} OverlayGeoJobParameter.prototype.datasetName
- * @description 数据集名。
- */
- this.datasetName = "";
- /**
- * @member {string} OverlayGeoJobParameter.prototype.datasetOverlay
- * @description 叠加对象所在的数据集名称。
- */
- this.datasetOverlay = "";
- /**
- * @member {string} [OverlayGeoJobParameter.prototype.mode]
- * @description 叠加分析模式。
- */
- this.mode = "";
- /**
- * @member {string} OverlayGeoJobParameter.prototype.srcFields
- * @description 输入数据需要保留的字段。
- */
- this.srcFields = "";
- /**
- * @member {string} OverlayGeoJobParameter.prototype.overlayFields
- * @description 叠加数据需要保留的字段,对分析模式为 clip、update、erase 时,此参数无效。
- */
- this.overlayFields = "";
- /**
- * @member {OutputSetting} [OverlayGeoJobParameter.prototype.output]
- * @description 输出参数设置类。
- */
- this.output = null;
- /**
- * @member {MappingParameters} [OverlayGeoJobParameter.prototype.mappingParameters]
- * @description 分析后结果可视化的参数类。
- */
- this.mappingParameters = null;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.OverlayGeoJobParameter";
- }
- /**
- * @function OverlayGeoJobParameter.prototype.destroy
- * @description 释放资源,将资源的属性置空。
- */
- destroy() {
- this.datasetName = null;
- this.datasetOverlay = null;
- this.mode = null;
- this.srcFields = null;
- this.overlayFields = null;
- if (this.output instanceof OutputSetting) {
- this.output.destroy();
- this.output = null;
- }
- if (this.mappingParameters instanceof MappingParameters) {
- this.mappingParameters.destroy();
- this.mappingParameters = null;
- }
- }
- /**
- * @function OverlayGeoJobParameter.toObject
- * @param {Object} OverlayGeoJobParameter - 点聚合分析任务参数。
- * @param {Object} tempObj - 目标对象。
- * @description 生成点聚合分析任务对象。
- */
- static toObject(OverlayGeoJobParameter, tempObj) {
- for (var name in OverlayGeoJobParameter) {
- if (name == "datasetName") {
- tempObj['input'] = tempObj['input'] || {};
- tempObj['input'][name] = OverlayGeoJobParameter[name];
- continue;
- }
- if (name === "output") {
- tempObj['output'] = tempObj['output'] || {};
- tempObj['output'] = OverlayGeoJobParameter[name];
- continue;
- }
- tempObj['analyst'] = tempObj['analyst'] || {};
- tempObj['analyst'][name] = OverlayGeoJobParameter[name];
- if(name === 'mappingParameters'){
- tempObj['analyst'][name] = tempObj['analyst'][name] || {};
- tempObj['analyst']['mappingParameters'] = OverlayGeoJobParameter[name];
- }
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/OverlayGeoJobsService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class OverlayGeoJobsService
- * @deprecatedclass SuperMap.OverlayGeoJobsService
- * @category iServer ProcessingService OverlayAnalyst
- * @classdesc 叠加分析任务类。
- * @param {string} url - 服务地址。
- * @param {Object} options - 参数。
- * @param {Events} options.events - 处理所有事件的对象。
- * @param {Object} [options.eventListeners] - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
- * @param {number} options.index - 服务访问地址在数组中的位置。
- * @param {number} options.length - 服务访问地址数组长度。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class OverlayGeoJobsService extends ProcessingServiceBase {
- constructor(url, options) {
- super(url, options);
- this.url = Util.urlPathAppend(this.url, 'spatialanalyst/overlay');
- this.CLASS_NAME = 'SuperMap.OverlayGeoJobsService';
- }
- /**
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function OverlayGeoJobsService.prototype.getOverlayGeoJobs
- * @description 获取叠加分析任务
- */
- getOverlayGeoJobs() {
- super.getJobs(this.url);
- }
- /**
- * @function OverlayGeoJobsService.prototype.getOverlayGeoJob
- * @description 获取指定id的叠加分析任务
- * @param {string} id - 指定要获取数据的id
- */
- getOverlayGeoJob(id) {
- super.getJobs(Util.urlPathAppend(this.url, id));
- }
- /**
- * @function OverlayGeoJobsService.prototype.addOverlayGeoJob
- * @description 新建点叠加析服务
- * @param {OverlayGeoJobParameter} params - 创建一个叠加分析的请求参数。
- * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
- */
- addOverlayGeoJob(params, seconds) {
- super.addJob(this.url, params, OverlayGeoJobParameter, seconds);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/QueryByBoundsParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class QueryByBoundsParameters
- * @deprecatedclass SuperMap.QueryByBoundsParameters
- * @category iServer Map QueryResults
- * @classdesc Bounds 查询参数类。该类用于设置 Bounds 查询的相关参数。
- * @extends {QueryParameters}
- * @param {Object} options - 参数。
- * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} options.bounds - 指定的查询范围。
- * @param {Array.<FilterParameter>} options.queryParams - 查询过滤条件参数数组。
- * @param {string} [options.customParams] - 自定义参数,供扩展使用。
- * @param {Object} [options.prjCoordSys] -自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
- * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
- * @param {GeometryType} [options.networkType=GeometryType.LINE] - 网络数据集对应的查询类型。
- * @param {QueryOption} [options.queryOption=QueryOption.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
- * @param {number} [options.startRecord=0] - 查询起始记录号。
- * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
- * @param {boolean} [options.returnCustomResult=false] - 仅供三维使用。
- * @param {boolean} [options.returnContent=true] - 是否立即返回新创建资源的表述还是返回新资源的 URI。
- * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
- * @usage
- */
- class QueryByBoundsParameters extends QueryParameters {
- constructor(options) {
- options = options || {};
- super(options);
- /**
- * @member {boolean} [QueryByBoundsParameters.prototype.returnContent=true]
- * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
- * 如果为 true,则直接返回新创建资源,即查询结果的表述。
- * 为 false,则返回的是查询结果资源的 URI。
- */
- this.returnContent = true;
- /**
- * @member {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} QueryByBoundsParameters.prototype.bounds
- * @description 指定的查询范围。
- */
- this.bounds = null;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.QueryByBoundsParameters";
- }
- /**
- * @function QueryByBoundsParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- super.destroy();
- var me = this;
- me.returnContent = null;
- if (me.bounds) {
- me.bounds = null;
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/QueryService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class QueryService
- * @deprecatedclass SuperMap.QueryService
- * @category iServer Map QueryResults
- * @classdesc 查询服务基类。
- * @extends {CommonServiceBase}
- * @param {string} url - 服务地址。请求地图查询服务的 URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名};
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
- * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @example
- * var myService = new QueryService(url, {
- * eventListeners: {
- * "processCompleted": queryCompleted,
- * "processFailed": queryError
- * }
- * };
- * @usage
- */
- class QueryService extends CommonServiceBase {
- constructor(url, options) {
- super(url, options);
- /**
- * @member {boolean} QueryService.prototype.returnContent
- * @description 是否立即返回新创建资源的表述还是返回新资源的URI。
- */
- this.returnContent = false;
- /**
- * @member {string} QueryService.prototype.format
- * @description 查询结果返回格式,目前支持iServerJSON 和GeoJSON两种格式。参数格式为"ISERVER","GEOJSON"。
- */
- this.format = DataFormat.GEOJSON;
- this.returnFeatureWithFieldCaption = false;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.QueryService";
- if (!this.url) {
- return;
- }
- if (options && options.format) {
- this.format = options.format.toUpperCase();
- }
- this.url = Util.urlPathAppend(this.url,'queryResults');
- }
- /**
- * @function QueryService.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- super.destroy();
- var me = this;
- me.returnContent = null;
- me.format = null;
- }
- /**
- * @function QueryService.prototype.processAsync
- * @description 负责将客户端的查询参数传递到服务端。
- * @param {QueryParameters} params - 查询参数。
- */
- processAsync(params) {
- if (!(params instanceof QueryParameters)) {
- return;
- }
- var me = this,
- returnCustomResult = null,
- jsonParameters = null;
- me.returnContent = params.returnContent;
- jsonParameters = me.getJsonParameters(params);
- if (me.returnContent) {
- me.url = Util.urlAppend(me.url, 'returnContent=' + me.returnContent);
- } else {
- //仅供三维使用 获取高亮图片的bounds
- returnCustomResult = params.returnCustomResult;
- if (returnCustomResult) {
- me.url = Util.urlAppend(me.url, 'returnCustomResult=' + returnCustomResult);
- }
- }
- me.returnFeatureWithFieldCaption = params.returnFeatureWithFieldCaption;
- me.request({
- method: "POST",
- data: jsonParameters,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- /**
- * @function QueryService.prototype.serviceProcessCompleted
- * @description 查询完成,执行此方法。
- * @param {Object} result - 服务器返回的结果对象。
- */
- serviceProcessCompleted(result) {
- var me = this;
- result = Util.transformResult(result);
- var geoJSONFormat = new GeoJSON();
- if (result && result.recordsets) {
- for (var i = 0, recordsets = result.recordsets, len = recordsets.length; i < len; i++) {
- if (recordsets[i].features) {
- if (me.returnFeatureWithFieldCaption === true) {
- recordsets[i].features.map((feature) => {
- feature.fieldNames = recordsets[i].fieldCaptions;
- return feature;
- })
- }
- if (me.format === DataFormat.GEOJSON) {
- recordsets[i].features = geoJSONFormat.toGeoJSON(recordsets[i].features);
- }
- }
- }
- }
- me.events.triggerEvent("processCompleted", {
- result: result
- });
- }
- /**
- * @function QueryService.prototype.getQueryParameters
- * @description 将 JSON 对象表示的查询参数转化为 QueryParameters 对象。
- * @param {Object} params - JSON 字符串表示的查询参数。
- * @returns {QueryParameters} 返回转化后的 QueryParameters 对象。
- */
- getQueryParameters(params) {
- return new QueryParameters({
- customParams: params.customParams,
- expectCount: params.expectCount,
- networkType: params.networkType,
- queryOption: params.queryOption,
- queryParams: params.queryParams,
- startRecord: params.startRecord,
- prjCoordSys: params.prjCoordSys,
- holdTime: params.holdTime
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/QueryByBoundsService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class QueryByBoundsService
- * @deprecatedclass SuperMap.QueryByBoundsService
- * @category iServer Map QueryResults
- * @classdesc Bounds 查询服务类。
- * @augments {QueryService}
- * @example
- * (start end)
- * var myQueryByBoundsService = new QueryByBoundsService(url, {
- * eventListeners: {
- * "processCompleted": queryCompleted,
- * "processFailed": queryError
- * }
- * });
- * function queryCompleted(object){//todo};
- * function queryError(object){//todo};
- * (end)
- * @param {string} url - 服务地址。如访问World Map服务,只需将url设为: http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。<br>
- * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class QueryByBoundsService extends QueryService {
- constructor(url, options) {
- super(url, options);
- this.CLASS_NAME = "SuperMap.QueryByBoundsService";
- }
- /**
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function QueryByBoundsService.prototype.getJsonParameters
- * @description 将查询参数转化为 JSON 字符串。
- * 在本类中重写此方法,可以实现不同种类的查询(sql, geometry, distance, bounds 等)。
- * @param {QueryByBoundsParameters} params - Bounds 查询参数。
- * @returns {Object} 转化后的 JSON 字符串。
- */
- getJsonParameters(params) {
- if (!(params instanceof QueryByBoundsParameters)) {
- return null;
- }
- var me = this,
- jsonParameters = "",
- qp = null,
- bounds = params.bounds;
- qp = me.getQueryParameters(params);
- jsonParameters += "'queryMode':'BoundsQuery','queryParameters':";
- jsonParameters += Util.toJSON(qp);
- jsonParameters += ",'bounds': {'rightTop':{'y':" + bounds.top + ",'x':" +
- bounds.right + "},'leftBottom':{'y':" + bounds.bottom + ",'x':" + bounds.left + "}}";
- jsonParameters = "{" + jsonParameters + "}";
- return jsonParameters;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/QueryByDistanceParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class QueryByDistanceParameters
- * @deprecatedclass SuperMap.QueryByDistanceParameters
- * @category iServer Map QueryResults
- * @classdesc Distance 查询参数类。
- * 该类用于设置 Distance 查询的相关参数。
- * @extends {QueryParameters}
- * @param {Object} options - 参数。
- * @param {GeoJSONObject} options.geometry - 用于查询的几何对象。
- * @param {Array.<FilterParameter>} options.queryParams - 查询过滤条件参数数组。
- * @param {number} options.distance - 查询距离,单位与所查询图层对应的数据集单位相同。距离查询时,表示距离地物的距离。最近地物查询时,表示搜索的范围。此为必选参数。
- * @param {string} [options.customParams] - 自定义参数,供扩展使用。
- * @param {Object} [options.prjCoordSys] -自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
- * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
- * @param {GeometryType} [options.networkType=GeometryType.LINE] - 网络数据集对应的查询类型。
- * @param {QueryOption} [options.queryOption=QueryOption.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
- * @param {number} [options.startRecord=0] - 查询起始记录号。
- * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
- * @param {boolean} [options.returnCustomResult=false] -仅供三维使用。
- * @param {boolean} [options.isNearest=false] - 是否为最近距离查询。
- * @param {boolean} [options.returnContent=true] - 是否立即返回新创建资源的表述还是返回新资源的 URI。
- * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
- * @usage
- */
- class QueryByDistanceParameters extends QueryParameters {
- constructor(options) {
- options = options || {};
- super(options);
- /**
- * @member {number} [QueryByDistanceParameters.prototype.distance=0]
- * @description 查询距离,单位与所查询图层对应的数据集单位相同。
- * 距离查询时,表示距离地物的距离。最近地物查询时,表示搜索的范围。
- */
- /**
- * @member {GeoJSONObject} QueryByDistanceParameters.prototype.geometry
- * @description 用于查询的地理对象。<br>
- * 点类型可以是:{@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>
- * 线类型可以是:{@link GeometryLineString}|{@link GeometryLinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}|{@link GeoJSONObject}。<br>
- * 面类型可以是:{@link GeometryPolygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}|{@link mapboxgl.LngLatBounds}|{@link GeoJSONObject}。
- */
- this.geometry = null;
- /**
- * @member {boolean} [QueryByDistanceParameters.prototype.isNearest=false]
- * @description 是否为最近距离查询。<br>
- * 建议该属性与 expectCount(继承自 {@link QueryParameters})属性联合使用。
- * 当该属性为 true 时,即表示查找最近地物,如果查询结果数大于期望返回的结果记录数(expectCount),
- * 则查找结果为查询总记录中距离中心最近的 expectCount 个地物。
- * 当该属性为不为 true 时,如果查询结果数大于期望返回的结果记录数(expectCount),
- * 则查找结果为从查询总记录中随机抽取的 expectCount 个地物。
- * 目前查询结果不支持按远近距离排序。
- */
- this.isNearest = null;
- /**
- * @member {boolean} [QueryByDistanceParameters.prototype.returnContent=true]
- * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
- * 如果为 true,则直接返回新创建资源,即查询结果的表述。
- * 为 false,则返回的是查询结果资源的 URI。
- */
- this.returnContent = true;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.QueryByDistanceParameters";
- }
- /**
- * @function QueryByDistanceParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- super.destroy();
- var me = this;
- me.returnContent = null;
- me.distance = null;
- me.isNearest = null;
- if (me.geometry) {
- me.geometry.destroy();
- me.geometry = null;
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/QueryByDistanceService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class QueryByDistanceService
- * @deprecatedclass SuperMap.QueryByDistanceService
- * @category iServer Map QueryResults
- * @classdesc Distance查询服务类。
- * @extends {QueryService}
- * @example
- * var myQueryByDistService = new QueryByDistanceService(url, {
- * eventListeners: {
- * "processCompleted": queryCompleted,
- * "processFailed": queryError
- * }
- * });
- * function queryCompleted(object){//todo};
- * function queryError(object){//todo};
- * @param {string} url - 服务地址。如访问World Map服务,只需将url设为:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
- * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class QueryByDistanceService extends QueryService {
- constructor(url, options) {
- super(url, options);
- this.CLASS_NAME = "SuperMap.QueryByDistanceService";
- }
- /**
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function QueryByDistanceService.prototype.getJsonParameters
- * @description 将查询参数转化为 JSON 字符串。
- * 在本类中重写此方法,可以实现不同种类的查询(sql, geometry, distance, bounds等)。
- * @param {QueryByDistanceParameters} params - Distance 查询参数类。
- * @returns {Object} 转化后的 JSON 字符串。
- */
- getJsonParameters(params) {
- if (!(params instanceof QueryByDistanceParameters)) {
- return;
- }
- var me = this,
- jsonParameters = "",
- qp = me.getQueryParameters(params);
- var sg = ServerGeometry.fromGeometry(params.geometry);
- jsonParameters += params.isNearest ? "'queryMode':'FindNearest','queryParameters':" : "'queryMode':'DistanceQuery','queryParameters':";
- jsonParameters += Util.toJSON(qp);
- jsonParameters += ",'geometry':" + Util.toJSON(sg) + ",'distance':" + params.distance;
- jsonParameters = "{" + jsonParameters + "}";
- return jsonParameters;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/QueryByGeometryParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class QueryByGeometryParameters
- * @deprecatedclass SuperMap.QueryByGeometryParameters
- * @category iServer Map QueryResults
- * @classdesc Geometry 查询参数类。
- * 该类用于设置 Geometry查询的相关参数。
- * @extends {QueryParameters}
- * @param {Object} options - 参数。
- * @param {Array.<FilterParameter>} options.queryParams - 查询过滤条件参数数组。
- * @param {GeoJSONObject} options.geometry - 查询的几何对象。
- * @param {string} [options.customParams] - 自定义参数,供扩展使用。
- * @param {QueryOption} [options.queryOption=QueryOption.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
- * @param {Object} [options.prjCoordSys] -自定义参数,供SuperMap Online提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
- * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
- * @param {GeometryType} [options.networkType=GeometryType.LINE] - 网络数据集对应的查询类型。
- * @param {boolean} [options.returnCustomResult=false] -仅供三维使用。
- * @param {number} [options.startRecord=0] - 查询起始记录号。
- * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
- * @param {boolean} [options.returnContent=true] - 是否立即返回新创建资源的表述还是返回新资源的 URI。
- * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
- * @param {SpatialQueryMode} [spatialQueryMode=SpatialQueryMode.INTERSECT] - 空间查询模式。
- * @usage
- */
- class QueryByGeometryParameters extends QueryParameters {
- constructor(options) {
- options = options || {};
- super(options);
- /**
- * @member {boolean} [QueryByGeometryParameters.prototype.returnContent=true]
- * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。<br>
- * 如果为 true,则直接返回新创建资源,即查询结果的表述。<br>
- * 为 false,则返回的是查询结果资源的 URI。
- */
- this.returnContent = true;
- /**
- * @member {GeoJSONObject} QueryByGeometryParameters.prototype.geometry
- * @description 用于查询的几何对象。<br>
- * 点类型可以是:{@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>
- * 线类型可以是:{@link GeometryLineString}|{@link GeometryLinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}|{@link GeoJSONObject}。<br>
- * 面类型可以是:{@link GeometryPolygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}|{@link mapboxgl.LngLatBounds}|{@link GeoJSONObject}。
- */
- this.geometry = null;
- /**
- * @member {SpatialQueryMode} [QueryByGeometryParameters.prototype.spatialQueryMode=SpatialQueryMode.INTERSECT]
- * @description 空间查询模式。
- */
- this.spatialQueryMode = SpatialQueryMode.INTERSECT;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.QueryByGeometryParameters";
- }
- /**
- * @function QueryByGeometryParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- super.destroy();
- var me = this;
- me.returnContent = null;
- me.geometry = null;
- me.spatialQueryMode = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/QueryByGeometryService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class QueryByGeometryService
- * @deprecatedclass SuperMap.QueryByGeometryService
- * @category iServer Map QueryResults
- * @classdesc Geometry查询服务类。
- * @extends {QueryService}
- * @example
- * var myQueryByGeometryService = new QueryByGeometryService(url, {
- * eventListeners: {
- * "processCompleted": queryCompleted,
- * "processFailed": queryError
- * }
- * });
- * function queryCompleted(object){//todo};
- * function queryError(object){//todo};
- * @param {string} url - 服务地址。如访问World Map服务,只需将url设为: http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
- * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class QueryByGeometryService extends QueryService {
- constructor(url, options) {
- super(url, options);
- this.CLASS_NAME = "SuperMap.QueryByGeometryService";
- }
- /**
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function QueryByGeometryService.prototype.getJsonParameters
- * @description 将查询参数转化为 JSON 字符串。
- * 在本类中重写此方法,可以实现不同种类的查询(sql, geometry, distance, bounds等)。
- * @param {QueryByGeometryParameters} params - Geometry 查询参数类。
- * @returns {Object} 转化后的 JSON 字符串。
- */
- getJsonParameters(params) {
- if (!(params instanceof QueryByGeometryParameters)) {
- return;
- }
- var me = this,
- jsonParameters = "",
- qp = null,
- geometry = params.geometry,
- sg = ServerGeometry.fromGeometry(geometry);
- qp = me.getQueryParameters(params);
- jsonParameters += "'queryMode':'SpatialQuery','queryParameters':";
- jsonParameters += Util.toJSON(qp) + ",'geometry':" + Util.toJSON(sg)
- + ",'spatialQueryMode':" + Util.toJSON(params.spatialQueryMode);
- jsonParameters = "{" + jsonParameters + "}";
- return jsonParameters;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/QueryBySQLParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class QueryBySQLParameters
- * @deprecatedclass SuperMap.QueryBySQLParameters
- * @category iServer Map QueryResults
- * @classdesc SQL 查询参数类。
- * 该类用于设置 SQL 查询的相关参数。
- * @extends {QueryParameters}
- * @param {Object} options - 参数。
- * @param {Array.<FilterParameter>} options.queryParams - 查询过滤条件参数数组。
- * @param {string} [options.customParams] - 自定义参数,供扩展使用。
- * @param {Object} [options.prjCoordSys] - 自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
- * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
- * @param {GeometryType} [options.networkType=GeometryType.LINE] - 网络数据集对应的查询类型。
- * @param {QueryOption} [options.queryOption=QueryOption.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
- * @param {number} [options.startRecord=0] - 查询起始记录号。
- * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
- * @param {boolean} [options.returnCustomResult=false] - 仅供三维使用。
- * @param {boolean} [options.returnContent=true] - 是否立即返回新创建资源的表述还是返回新资源的 URI。
- * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
- * @usage
- */
- class QueryBySQLParameters extends QueryParameters {
- constructor(options) {
- options = options || {};
- super(options);
- /**
- * @member {boolean} [QueryBySQLParameters.prototype.returnContent=true]
- * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
- * 如果为 true,则直接返回新创建资源,即查询结果的表述。
- * 为 false,则返回的是查询结果资源的 URI。
- */
- this.returnContent = true;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.QueryBySQLParameters";
- }
- /**
- * @function QueryBySQLParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- super.destroy();
- var me = this;
- me.returnContent = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/QueryBySQLService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class QueryBySQLService
- * @deprecatedclass SuperMap.QueryBySQLService
- * @category iServer Map QueryResults
- * @classdesc SQL 查询服务类。在一个或多个指定的图层上查询符合 SQL 条件的空间地物信息。
- * @extends {QueryService}
- * @example
- * var queryParam = new FilterParameter({
- * name: "Countries@World.1",
- * attributeFilter: "Pop_1994>1000000000 and SmArea>900"
- * });
- * var queryBySQLParams = new QueryBySQLParameters({
- * queryParams: [queryParam]
- * });
- * var myQueryBySQLService = new QueryBySQLService(url, {eventListeners: {
- * "processCompleted": queryCompleted,
- * "processFailed": queryError
- * }
- * });
- * queryBySQLService.processAsync(queryBySQLParams);
- * function queryCompleted(object){//todo};
- * function queryError(object){//todo};
- * @param {string} url - 服务地址。如访问World Map服务,只需将url设为: http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
- * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class QueryBySQLService extends QueryService {
- constructor(url, options) {
- super(url, options);
- this.CLASS_NAME = "SuperMap.QueryBySQLService";
- }
- /**
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function QueryBySQLService.prototype.getJsonParameters
- * @description 将查询参数转化为 JSON 字符串。
- * 在本类中重写此方法,可以实现不同种类的查询(sql, geometry, distance, bounds等)。
- * @param {QueryBySQLParameters} params - SQL 查询参数类。
- * @returns {Object} 转化后的 JSON 字符串。
- */
- getJsonParameters(params) {
- if (!(params instanceof QueryBySQLParameters)) {
- return;
- }
- var me = this,
- jsonParameters = "",
- qp = null;
- qp = me.getQueryParameters(params);
- jsonParameters += "'queryMode':'SqlQuery','queryParameters':";
- jsonParameters += Util.toJSON(qp);
- jsonParameters = "{" + jsonParameters + "}";
- return jsonParameters;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/RouteCalculateMeasureParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class RouteCalculateMeasureParameters
- * @deprecatedclass SuperMap.RouteCalculateMeasureParameters
- * @category iServer SpatialAnalyst RouteCalculateMeasure
- * @classdesc 基于路由对象计算指定点 M 值操作的参数类。通过该类提供参数信息。
- * @param {Object} options - 参数。
- * @param {(Route|L.Polyline|ol.geom.LineString|GeoJSONObject)} options.sourceRoute - 路由对象。该对象可以是用户自己生成或在数据源中查询得到的符合标准的路由对象。
- * @param {GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>} options.point - 二维地理坐标点对象,包含 x,y 坐标值属性的对象。
- * @param {number} [options.tolerance] - 容限值。
- * @param {boolean} [options.isIgnoreGap=false] - 是否忽略子对象之间的距离。
- * @usage
- */
- class RouteCalculateMeasureParameters {
- constructor(options) {
- if (!options) {
- return this;
- }
- /**
- * @member {(Route|L.Polyline|ol.geom.LineString|GeoJSONObject)} RouteCalculateMeasureParameters.prototype.sourceRoute
- * @description 路由对象。该对象可以是用户自己生成或在数据源中查询得到的符合标准的路由对象。
- */
- this.sourceRoute = null;
- /**
- * @member {GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>} RouteCalculateMeasureParameters.prototype.point
- * @description 二维地理坐标点对象,包含 x,y 坐标值属性的对象。
- */
- this.point = null;
- /**
- * @member {number} [RouteCalculateMeasureParameters.prototype.tolerance]
- * @description 容限值。
- */
- this.tolerance = null;
- /**
- * @member {boolean} [RouteCalculateMeasureParameters.prototype.isIgnoreGap=false]
- * @description 是否忽略子对象之间的距离。
- */
- this.isIgnoreGap = false;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.RouteCalculateMeasureParameters";
- }
- /**
- * @function RouteCalculateMeasureParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.sourceRoute = null;
- me.point = null;
- if (me.tolerance) {
- me.tolerance = null;
- }
- if (me.isIgnoreGap) {
- me.isIgnoreGap = false;
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/RouteCalculateMeasureService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class RouteCalculateMeasureService
- * @deprecatedclass SuperMap.RouteCalculateMeasureService
- * @category iServer SpatialAnalyst RouteCalculateMeasure
- * @classdesc 基于路由对象计算指定点 M 值操作的服务类。
- * 该类负责将客户设置的计算指定点的 M 值参数传递给服务端,并接收服务端返回的
- * 指定点的 M 值。通过该类支持的事件的监听函数参数获取。
- * @extends {SpatialAnalystBase}
- * @param {string} url - 服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 需要被注册的监听器对象。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @example 实例化该类如下例所示:
- * (start code)
- * var parameters = new RouteCalculateMeasureParameters({
- * "sourceRoute":{
- * "type":"LINEM",
- * "parts":[4],
- * "points":[
- * {
- * "measure":0,
- * "y":-6674.466867067764,
- * "x":3817.3527876130133
- * },
- * {
- * "measure":199.57954019411724,
- * "y":-6670.830929417594,
- * "x":3617.806369901496
- * },
- * {
- * "measure":609.3656478634477,
- * "y":-6877.837541432356,
- * "x":3264.1498746678444
- * },
- * {
- * "measure":936.0174126282958,
- * "y":-7038.687780615184,
- * "x":2979.846206068903
- * }
- * ]
- * },
- * "tolerance":1,
- * "point":{
- * "x":3330.7754269417,
- * "y":-6838.8394457216
- * },
- * "isIgnoreGap":false
- * });
- *
- * var routeCalculateMeasureService = new RouteCalculateMeasureService(spatialAnalystURL, {
- * eventListeners:{
- * processCompleted:calculateCompleted,
- * processFailed:calculateFailded
- * }
- * );
- * routeCalculateMeasureService.processAsync(parameters);
- *
- * //执行
- * function calculateCompleted(){todo}
- * function calculateFailded(){todo}
- * (end)
- * @usage
- */
- class RouteCalculateMeasureService extends SpatialAnalystBase {
- constructor(url, options) {
- super(url, options);
- this.CLASS_NAME = "SuperMap.RouteCalculateMeasureService";
- }
- /**
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function RouteCalculateMeasureService.prototype.processAsync
- * @description 负责将客户端的基于路由对象计算指定点 M 值操作的参数传递到服务端。
- * @param {RouteCalculateMeasureParameters} params - 基于路由对象计算指定点 M 值操作的参数类。
- */
- processAsync(params) {
- if (!(params instanceof RouteCalculateMeasureParameters)) {
- return;
- }
- var me = this, jsonParameters;
- jsonParameters = me.getJsonParameters(params);
- me.request({
- method: "POST",
- data: jsonParameters,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- /**
- * @function RouteCalculateMeasureService.prototype.getJsonParameters
- * @description 将参数转化为 JSON 字符串。
- * @param {RouteCalculateMeasureParameters} params - 基于路由对象计算指定点 M 值操作的参数类。
- * @returns {Object} 转化后的 JSON 字符串。
- */
- getJsonParameters(params) {
- var jsonParameters, jsonStr = "geometry/calculatemeasure", me = this;
- me.url = Util.urlPathAppend(me.url, jsonStr);
- me.url = Util.urlAppend(me.url, 'returnContent=true');
- jsonParameters = Util.toJSON(params);
- return jsonParameters;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/RouteLocatorParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class RouteLocatorParameters
- * @deprecatedclass SuperMap.RouteLocatorParameters
- * @category iServer SpatialAnalyst RouteLocator
- * @classdesc 路由对象定位空间对象的参数类。
- * 参数有两种方式,分别为 Geometry 和 Dataset 两种,前者需要指定 sourceRoute 对象作为参数,后者需要 dataset,routeIDField,routeID 三个参数
- * 如果用户两种参数均设置,优先选择 Dataset 方式。
- * @param {Object} options - 参数。
- * @param {(Route|L.Polyline|ol.geom.LineString|GeoJSONObject)} options.sourceRoute - 路由对象。
- * @param {number} options.measure - 定位点的 M 值。只当路由对象定位点时有意义。
- * @param {string} [options.type] - 类型:点 or 线。
- * @param {number} [options.offset=0] - 定位点偏移量。只当路由对象定位点时有意义。
- * @param {boolean} [options.isIgnoreGap=false] - 是否忽略子对象之间的距离。即不忽略子对象之间的距离。
- * @param {number} [options.startMeasure] - 定位线的起始 M 值。只当路由对象定位线时有意义。
- * @param {number} [options.endMeasure] - 定位线的终止 M 值。只当路由对象定位线时有意义。
- * @usage
- */
- class RouteLocatorParameters {
- constructor(options) {
- if (!options) {
- return this;
- }
- /**
- * @member {(Route|L.Polyline|ol.geom.LineString|GeoJSONObject)} RouteLocatorParameters.prototype.sourceRoute
- * @description 路由对象。
- */
- this.sourceRoute = null;
- /**
- * @member {string} RouteLocatorParameters.prototype.dataset
- * @description 要用来做缓冲区分析的数据源中数据集的名称。该名称用形如"数据集名称@数据源别名"形式来表示。
- */
- this.dataset = null;
- /**
- * @member {string} RouteLocatorParameters.prototype.routeIDField
- * @description 路由对象所在的字段名称。
- *
- */
- this.routeIDField = null;
- /**
- * @member {number} RouteLocatorParameters.prototype.routeID
- * @description 路由对象标识。
- *
- */
- this.routeID = null;
- /**
- * @member {string} [RouteLocatorParameters.prototype.type]
- * @description 类型:点 or 线。
- * 可选值为:
- * LINE :根据起始 M 值及终止 M 值定位线对象。
- * POINT : 根据 M 值定位点对象。
- */
- this.type = null;
- /**
- * @member {number} RouteLocatorParameters.prototype.measure
- * @description 定位点的 M 值。只当路由对象定位点时有意义。
- */
- this.measure = null;
- /**
- * @member {number} [RouteLocatorParameters.prototype.offset=0]
- * @description 定位点偏移量。只当路由对象定位点时有意义。
- */
- this.offset = 0;
- /**
- * @member {boolean} [RouteLocatorParameters.prototype.isIgnoreGap=false]
- * @description 是否忽略子对象之间的距离。
- */
- this.isIgnoreGap = false;
- /**
- * @member {number} [RouteLocatorParameters.prototype.startMeasure]
- * @description 定位线的起始 M 值。只当路由对象定位线时有意义。
- */
- this.startMeasure = null;
- /**
- * @member {number} [RouteLocatorParameters.prototype.endMeasure]
- * @description 定位线的终止 M 值。只当路由对象定位线时有意义。
- */
- this.endMeasure = null;
- var routeFromClient = options.sourceRoute;
- var routeHandle = {};
- if (routeFromClient && routeFromClient instanceof Geometry && routeFromClient.components) {
- routeHandle.type = routeFromClient.type;
- routeHandle.parts = routeFromClient.parts;
- var parts = [];
- for (var i = 0, len = routeFromClient.components.length; i < len; i++) {
- parts = parts.concat(routeFromClient.components[i].components);
- }
- routeHandle.points = parts;
- options.sourceRoute = routeHandle;
- }
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.RouteLocatorParameters";
- }
- /**
- * @function RouteLocatorParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.sourceRoute = null;
- me.type = null;
- me.measure = null;
- me.offset = 0;
- me.isIgnoreGap = false;
- me.startMeasure = null;
- me.endMeasure = null;
- me.dataset = null;
- me.routeID = null;
- me.routeIDField = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/RouteLocatorService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class RouteLocatorService
- * @deprecatedclass SuperMap.RouteLocatorService
- * @category iServer SpatialAnalyst RouteLocator
- * @classdesc 路由对象定位空间对象的服务类。
- * @extends {SpatialAnalystBase}
- * @param {string} url -服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 需要被注册的监听器对象。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @example 实例化该类如下例所示:
- * (start code)
- * var routeLocatorParameters_point = new RouteLocatorParameters({
- * "sourceRoute":{
- * "type":"LINEM",
- * "parts":[4],
- * "points":[
- * {
- * "measure":0,
- * "y":-6674.466867067764,
- * "x":3817.3527876130133
- * },
- * {
- * "measure":199.57954019411724,
- * "y":-6670.830929417594,
- * "x":3617.806369901496
- * },
- * {
- * "measure":609.3656478634477,
- * "y":-6877.837541432356,
- * "x":3264.1498746678444
- * },
- * {
- * "measure":936.0174126282958,
- * "y":-7038.687780615184,
- * "x":2979.846206068903
- * }
- * ]
- * },
- * "type":"POINT",
- * "measure":10,
- * "offset":3,
- * "isIgnoreGap":true
- * });
- * var routeLocatorService = new RouteLocatorService(spatialAnalystURL, {
- * eventListeners:{
- * processCompleted:routeLocatorCompleted,
- * processFailed:routeLocatorFailded
- * }
- * );
- * routeLocatorService.processAsync(routeLocatorParameters_point);
- *
- * //执行
- * function routeLocatorCompleted(){todo}
- * function routeLocatorFailded(){todo}
- * (end)
- * @usage
- */
- class RouteLocatorService extends SpatialAnalystBase {
- constructor(url, options) {
- super(url, options);
- this.CLASS_NAME = "SuperMap.RouteLocatorService";
- }
- /**
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function RouteLocatorService.prototype.processAsync
- * @description 负责将客户端的基于路由对象计算指定点 M 值操作的参数传递到服务端。
- * @param {RouteLocatorParameters} params - 路由对象定位空间对象的参数类。
- */
- processAsync(params) {
- if (!(params instanceof RouteLocatorParameters)) {
- return;
- }
- var me = this, jsonParameters;
- jsonParameters = me.getJsonParameters(params);
- me.request({
- method: "POST",
- data: jsonParameters,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- /**
- * @function RouteLocatorService.prototype.processAsync
- * @description 将参数转化为 JSON 字符串。
- * @param {RouteLocatorParameters} params - 路由对象定位空间对象的参数类。
- * @returns {Object} 转化后的JSON字符串。
- */
- getJsonParameters(params) {
- var jsonParameters, jsonStr = "geometry/routelocator", me = this;
- if (params.dataset) {
- jsonStr = "datasets/" + params.dataset + "/linearreferencing/routelocator";
- params.sourceRoute = null;
- }
- me.url = Util.urlPathAppend(me.url, jsonStr);
- me.url = Util.urlAppend(me.url, 'returnContent=true');
- jsonParameters = Util.toJSON(params);
- return jsonParameters;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ServerFeature.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ServerFeature
- * @deprecatedclass SuperMap.ServerFeature
- * @category iServer Data Feature
- * @classdesc 服务端矢量要素类。该类描述了服务端返回的矢量要素的相关信息,包括字段和几何信息。
- * @param {ServerGeometry} geometry - 矢量要素的几何信息。
- * @param {Object} options - 参数。
- * @param {Array.<string>} [options.fieldNames] - 矢量要素的属性字段名集合。
- * @param {Array.<string>} [options.fieldValues] - 矢量要素的属性字段值集合。
- * @usage
- */
- class ServerFeature {
- constructor(options) {
- /**
- * @member {Array.<string>} [ServerFeature.prototype.fieldNames]
- * @description 矢量要素的属性字段名集合。
- */
- this.fieldNames = null;
- /**
- * @member {Array.<string>} [ServerFeature.prototype.fieldValues]
- * @description 矢量要素的属性字段值集合。
- */
- this.fieldValues = null;
- /**
- * @member {ServerGeometry} ServerFeature.prototype.geometry
- * @description 矢量要素的几何信息。
- */
- this.geometry = null;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.ServerFeature";
- }
- /**
- * @function ServerFeature.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.fieldNames = null;
- me.fieldValues = null;
- if (me.geometry) {
- me.geometry.destroy();
- me.geometry = null;
- }
- }
- /**
- * @function ServerFeature.prototype.toFeature
- * @description 将服务端矢量要素 ServerFeature 转换为客户端矢量要素 Feature。
- * @returns {Vector} 转换后的客户端矢量要素。
- */
- toFeature() {
- var names, values, geo,
- attr = {},
- me = this,
- feature;
- names = me.fieldNames;
- values = me.fieldValues;
- for (var i in names) {
- attr[names[i]] = values[i];
- }
- if (me.geometry) {
- geo = me.geometry.toGeometry();
- }
- feature = new Vector(geo, attr);
- if (me.geometry && me.geometry.id) {
- feature.fid = me.geometry.id;
- }
- return feature;
- }
- /**
- * @function ServerFeature.prototype.fromJson
- * @description 将 JSON 对象表示服务端矢量要素转换为 ServerFeature。
- * @param {Object} jsonObject - 要转换的 JSON 对象。
- * @returns {ServerFeature} 转化后的 ServerFeature 对象。
- */
- static fromJson(jsonObject) {
- var geo = null;
- if (!jsonObject) {
- return;
- }
- geo = jsonObject.geometry;
- if (geo) {
- geo = ServerGeometry.fromJson(geo);
- }
- return new ServerFeature({
- fieldNames: jsonObject.fieldNames,
- fieldValues: jsonObject.fieldValues,
- geometry: geo
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/SetDatasourceParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class SetDatasourceParameters
- * @deprecatedclass SuperMap.SetDatasourceParameters
- * @category iServer Data Datasource
- * @classdesc 设置数据源信息参数类。
- * @param {Object} options - 参数。
- * @param {string} options.datasourceName - 数据源名称。
- * @param {string} options.description - 数据源描述信息。
- * @param {string} options.coordUnit - 坐标单位。
- * @param {string} options.distanceUnit - 距离单位。
- * @usage
- */
- class SetDatasourceParameters {
- constructor(options) {
- if (!options) {
- return;
- }
- /**
- * @member {string} SetDatasourceParameters.prototype.datasourceName
- * @description 数据源名称。
- */
- this.datasourceName = null;
- /**
- * @member {string} SetDatasourceParameters.prototype.description
- * @description 数据源描述信息。
- */
- this.description = null;
- /**
- * @member {string} SetDatasourceParameters.prototype.coordUnit
- * @description 坐标单位。
- */
- this.coordUnit = null;
- /**
- * @member {string} SetDatasourceParameters.prototype.distanceUnit
- * @description 距离单位。
- */
- this.distanceUnit = null;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.SetDatasourceParameters";
- }
- /**
- * @function SetDatasourceParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.datasourceName = null;
- me.description = null;
- me.coordUnit = null;
- me.distanceUnit = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/SetLayerInfoParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class SetLayerInfoParameters
- * @deprecatedclass SuperMap.SetLayerInfoParameters
- * @category iServer Map TempLayersSet
- * @classdesc 设置图层信息参数类。
- * @param {Object} options - 参数。
- * @param {string} options.resourceID - 临时图层的资源 ID。
- * @param {string} options.tempLayerName - 临时图层下的子图层名。
- * @param {string} options.layerInfo - 要更新的图层信息。
- * @usage
- */
- class SetLayerInfoParameters {
- constructor(options) {
- options = options || {};
- /**
- * @member {string} SetLayerInfoParameters.prototype.resourceID
- * @description 临时图层的资源 ID。
- */
- this.resourceID = null;
- /**
- * @member {string} SetLayerInfoParameters.prototype.tempLayerName
- * @description 临时图层下子图层(或者其子图层)名,如:Countries@World.3@@World。
- */
- this.tempLayerName = null;
- /**
- * @member {Object} SetLayerInfoParameters.prototype.layerInfo
- * @description 要更新的图层信息(包含修改和未修改的所有字段)。该参数可以通过图层信息服务获取,然后对返回值中 subLayers.layers[i] 图层信息属性进行修改。
- */
- this.layerInfo = null;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.SetLayerInfoParameters";
- }
- /**
- * @function SetLayerInfoParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.resourceID = null;
- me.tempLayerName = null;
- me.layerInfo = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/SetLayerInfoService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class SetLayerInfoService
- * @deprecatedclass SuperMap.SetLayerInfoService
- * @category iServer Map TempLayersSet
- * @classdesc 设置图层信息服务类。可以实现临时图层中子图层的修改
- * 该类负责将图层设置参数传递到服务端,并获取服务端返回的结果信息。
- * @extends {CommonServiceBase}
- * @param {string} url - 服务地址。请求地图服务,URL 应为:
- * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名}/tempLayersSet/{tempLayerID}/Rivers@World@@World";
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
- * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class SetLayerInfoService extends CommonServiceBase {
- constructor(url, options) {
- super(url, options);
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.SetLayerInfoService";
- }
- /**
- * @override
- */
- destroy() {
- super.destroy();
- Util.reset(this);
- }
- /**
- * @function SetLayerInfoService.prototype.processAsync
- * @description 负责将客户端的更新参数传递到服务端。
- * @param {Object} params - 修改后的图层资源信息。
- * 该参数可以使用获取图层信息服务<{@link GetLayersInfoService}>返回图层信息,解析结果result.subLayers.layers[i],然后对其属性进行修改来获取。
- */
- processAsync(params) {
- if (!params) {
- return;
- }
- var me = this;
- var jsonParamsStr = Util.toJSON(params);
- me.request({
- method: "PUT",
- data: jsonParamsStr,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/SetLayersInfoParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class SetLayersInfoParameters
- * @deprecatedclass SuperMap.SetLayersInfoParameters
- * @category iServer Map TempLayersSet
- * @classdesc 设置图层信息参数类。
- * @param {Object} options - 参数。
- * @param {boolean} [options.isTempLayers=false] - 是否是临时图层。
- * @param {string} options.resourceID - 临时图层资源 ID。
- * @param {Object} options.layersInfo - 要更新的图层信息。
- * @usage
- */
- class SetLayersInfoParameters {
- constructor(options) {
- options = options || {};
- /**
- * @member {boolean} [SetLayersInfoParameters.prototype.isTempLayers=false]
- * @description 是否是临时图层。
- */
- this.isTempLayers = null;
- /**
- * @member {string} SetLayersInfoParameters.prototype.resourceID
- * @description 临时图层资源 ID,
- */
- this.resourceID = null;
- /**
- * @member {Object} SetLayersInfoParameters.prototype.layersInfo
- * @description 要更新的图层信息(包含修改和未修改的所有字段)。该参数可以通过图层信息服务获取,然后对返回值中 subLayers.layers[i] 图层信息属性进行修改。
- */
- this.layersInfo = null;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.SetLayersInfoParameters";
- }
- /**
- * @function SetLayersInfoParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.isTempLayers = null;
- me.resourceID = null;
- me.layersInfo = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/SetLayersInfoService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class SetLayersInfoService
- * @deprecatedclass SuperMap.SetLayersInfoService
- * @category iServer Map TempLayersSet
- * @classdesc 设置图层信息服务类。可以实现创建新的临时图层和对现有临时图层的修改,
- * 当 isTempLayers 为 false的时候执行创建临时图层。当 isTempLayers 为 ture 并且临时图层资源 resourceID 被设置有效时执行对临时图层的编辑。
- * 该类负责将图层设置参数传递到服务端,并获取服务端返回的结果信息。
- * @extends {CommonServiceBase}
- * @param url - {string} 服务地址。请求地图服务,URL 应为:
- * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名};
- * @param {Object} options - 参数。
- * @param {string} options.resourceID - 图层资源ID,临时图层的资源ID标记。
- * @param {boolean} options.isTempLayers - 当前url对应的图层是否是临时图层。
- * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
- * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class SetLayersInfoService extends CommonServiceBase {
- constructor(url, options) {
- super(url, options);
- /**
- * @member {string} SetLayersInfoService.prototype.resourceID
- * @description 图层资源ID,临时图层的资源ID标记。
- */
- this.resourceID = null;
- /**
- * @function {boolean} SetLayersInfoService.prototype.isTempLayers
- * @description 当前url对应的图层是否是临时图层。
- */
- this.isTempLayers = false;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.SetLayersInfoService";
- }
- /**
- * @override
- */
- destroy() {
- super.destroy();
- Util.reset(this);
- }
- /**
- * @function SetLayersInfoService.prototype.processAsync
- * @description 负责将客户端的更新参数传递到服务端。
- * @param {Object} params - 修改后的图层资源信息。该参数可以使用获取图层信息服务 <{@link GetLayersInfoService}>返回图层信息,然后对其属性进行修改来获取。
- */
- processAsync(params) {
- if (!params) {
- return;
- }
- var jsonParams,
- subLayers = [],
- me = this,
- method = "";
- //创建临时图层和设置修改临时图层信息对应不同的资源URL
- if (me.isTempLayers) {
- me.url = Util.urlPathAppend(me.url, "tempLayersSet/" + me.resourceID);
- method = "PUT";
- } else {
- me.url = Util.urlPathAppend(me.url, "tempLayersSet");
- method = "POST";
- }
- if (!params.subLayers) {
- params.subLayers = {layers: []}
- }
- if (!params.subLayers.layers) {
- params.subLayers.layers = [];
- }
- var layers = params.subLayers.layers,
- len = layers.length;
- for (let i in layers) {
- if (layers[i].ugcLayerType === "GRID") {
- var colorDictionary = {};
- var colorDics = layers[i].colorDictionarys;
- for (var j in colorDics) {
- var key = colorDics[j].elevation;
- colorDictionary[key] = colorDics[j].color;
- }
- }
- layers[i].colorDictionary = colorDictionary;
- delete layers[i].colorDictionarys;
- }
- for (let i = 0; i < len; i++) {
- if (layers[i].toJsonObject) {
- //将图层信息转换成服务端能识别的简单json对象
- subLayers.push(layers[i].toJsonObject());
- } else {
- subLayers.push(layers[i]);
- }
- }
- jsonParams = Util.extend(jsonParams, params);
- jsonParams.subLayers = {"layers": subLayers};
- jsonParams.object = null;
- var jsonParamsStr = Util.toJSON([jsonParams]);
- me.request({
- method: method,
- data: jsonParamsStr,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/SetLayerStatusParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class SetLayerStatusParameters
- * @deprecatedclass SuperMap.SetLayerStatusParameters
- * @category iServer Map TempLayersSet
- * @classdesc 子图层显示控制参数类,该类存储了各子图层是否可见的状态。
- * 注意在 SuperMap iClient 系列产品中所说的图层与 SuperMap Deskpro 的地图对应,子图层与 SuperMap Deskpro 的图层对应。
- * @param {Object} options - 参数。
- * @param {Array.<LayerStatus>} options.layerStatusList - 获取或设置图层可见状态({@link LayerStatus})集合,
- * 集合中的每个 {@link LayerStatus} 对象代表一个子图层的可视状态。
- * @param {number} [options.holdTime=15] - 获取或设置资源在服务端保存的时间。
- * @param {string} [options.resourceID] - 获取或设置资源服务 ID。
- * @usage
- */
- class SetLayerStatusParameters {
- constructor(options) {
- /**
- * @member {Array.<LayerStatus>} SetLayerStatusParameters.prototype.layerStatusList
- * @description 获取或设置图层可见状态({@link LayerStatus})集合,集合中的每个 {@link LayerStatus} 对象代表一个子图层的可视状态。
- */
- this.layerStatusList = [];
- /**
- * @member {number} [SetLayerStatusParameters.prototype.holdTime=15]
- * @description 获取或设置资源在服务端保存的时间。单位为分钟。
- */
- this.holdTime = 15;
- /**
- * @member {string} SetLayerStatusParameters.prototype.resourceID
- * @description 获取或设置资源服务ID。如果设置该参数则会在指定的 TempLayer 进行图层的显示控制;
- * 如果不设置该参数,则会首先创建一个 TempLayer ,然后在新创建的 TempLayer 进行图层的显示控制。
- */
- this.resourceID = null;
- if (options) {
- Util.extend(this, options);
- }
- }
- /**
- * @function SetLayerStatusParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.layerStatusList = null;
- me.holdTime = null;
- me.resourceID = null;
- }
- /**
- * @function SetLayerStatusParameters.prototype.toJSON
- * @description 生成 JSON。
- * @returns {Object} 对应的 JSON 对象。
- */
- toJSON() {
- var json = '{';
- json += '"layers":[';
- var v = [];
- for (var i = 0, len = this.layerStatusList.length; i < len; i++) {
- v.push(this.layerStatusList[i].toJSON());
- }
- json += v;
- json += ']';
- json += '}';
- return json;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/SetLayerStatusService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class SetLayerStatusService
- * @deprecatedclass SuperMap.SetLayerStatusService
- * @category iServer Map TempLayersSet
- * @classdesc 子图层显示控制服务类。该类负责将子图层显示控制参数传递到服务端,并获取服务端返回的图层显示状态。
- * 用户获取服务端返回的各子图层显示状态有两种方式:
- * 一种是通过监听 SetLayerEvent.PROCESS_COMPLETE 事件;
- * 一种是使用 AsyncResponder 类实现异步处理。
- * @extends {CommonServiceBase}
- * @param {string} url - 服务地址。请求地图服务,URL 应为:
- * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名};
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
- * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class SetLayerStatusService extends CommonServiceBase {
- constructor(url, options) {
- super(url, options);
- this.lastparams = null;
- this.mapUrl = url;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.SetLayerStatusService";
- }
- /**
- * @override
- */
- destroy() {
- super.destroy();
- Util.reset(this);
- }
- /**
- * @function SetLayerStatusService.prototype.processAsync
- * @description 负责将客户端的更新参数传递到服务端。
- * @param {Object} params - 修改后的图层资源信息。该参数可以使用获取图层信息服务{@link SetLayerStatusParameters}
- * 返回图层信息,然后对其属性进行修改来获取。
- */
- processAsync(params) {
- if (!(params instanceof SetLayerStatusParameters)) {
- return;
- }
- var me = this,
- method = "POST";
- me.url = me.mapUrl;
- if (params.resourceID == null) {
- me.url = Util.urlPathAppend(me.url, 'tempLayersSet');
- me.lastparams = params;
- me.request({
- method: method,
- scope: me,
- success: me.createTempLayerComplete,
- failure: me.serviceProcessFailed
- });
- } else {
- me.url = Util.urlPathAppend(me.url, "tempLayersSet/" + params.resourceID);
- me.url = Util.urlAppend(me.url, "elementRemain=true&reference=" + params.resourceID + "&holdTime=" + params.holdTime.toString());
- var jsonParameters = '[{';
- jsonParameters += '"type":"UGC",';
- if (params.layerStatusList != null && params.layerStatusList.length > 0) {
- jsonParameters += '"subLayers":' + params.toJSON();
- }
- jsonParameters += ',"visible":' + true + ',';
- jsonParameters += '"name":"' + this.getMapName(this.mapUrl) + '"';
- jsonParameters += '}]';
- me.request({
- method: "PUT",
- data: jsonParameters,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- }
- /**
- * @function SetLayerStatusService.prototype.createTempLayerComplete
- * @description 设置完成,执行此方法。
- * @param {Object} result - 服务器返回的结果对象,记录设置操作是否成功。
- */
- createTempLayerComplete(result) {
- var me = this;
- result = Util.transformResult(result);
- if (result.succeed) {
- me.lastparams.resourceID = result.newResourceID;
- }
- me.processAsync(me.lastparams);
- }
- /**
- * @function SetLayerStatusService.prototype.getMapName
- * @description 获取地图名称。
- * @param {Object} url - 服务地址。
- */
- getMapName(url) {
- var mapUrl = url;
- if (mapUrl.charAt(mapUrl.length - 1) === "/") {
- mapUrl = mapUrl.substr(0, mapUrl.length - 1);
- }
- var index = mapUrl.lastIndexOf("/");
- var mapName = mapUrl.substring(index + 1, mapUrl.length);
- return mapName;
- }
- /**
- * @function SetLayerStatusService.prototype.setLayerCompleted
- * @description 设置完成,执行此方法。
- * @param {Object} result - 服务器返回的结果对象,记录设置操作是否成功。
- */
- serviceProcessCompleted(result) {
- var me = this;
- result = Util.transformResult(result);
- if (result != null && me.lastparams != null) {
- result.newResourceID = me.lastparams.resourceID;
- }
- me.events.triggerEvent("processCompleted", {result: result});
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/SingleObjectQueryJobsParameter.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class SingleObjectQueryJobsParameter
- * @deprecatedclass SuperMap.SingleObjectQueryJobsParameter
- * @category iServer ProcessingService Query
- * @classdesc 单对象空间查询分析任务参数类。
- * @param {Object} options - 参数。
- * @param {string} options.datasetName - 数据集名。
- * @param {string} options.datasetQuery - 查询对象所在的数据集名称。
- * @param {SpatialQueryMode} [options.mode=SpatialQueryMode.CONTAIN] - 空间查询模式。
- * @param {OutputSetting} [options.output] - 输出参数设置。
- * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
- * @usage
- */
- class SingleObjectQueryJobsParameter {
- constructor(options) {
- if (!options) {
- return;
- }
- /**
- * @member {string} SingleObjectQueryJobsParameter.prototype.datasetName
- * @description 数据集名。
- */
- this.datasetName = "";
- /**
- * @member {string} SingleObjectQueryJobsParameter.prototype.datasetQuery
- * @description 查询对象所在的数据集名称。
- */
- this.datasetQuery = "";
- /**
- * @member {string} SingleObjectQueryJobsParameter.prototype.geometryQuery
- * @description 查询对象所在的几何对象。
- */
- this.geometryQuery = "";
- /**
- * @member {SpatialQueryMode} [SingleObjectQueryJobsParameter.prototype.mode=SpatialQueryMode.CONTAIN]
- * @description 空间查询模式 。
- */
- this.mode = SpatialQueryMode.CONTAIN;
- /**
- * @member {OutputSetting} [SingleObjectQueryJobsParameter.prototype.output]
- * @description 输出参数设置类。
- */
- this.output = null;
- /**
- * @member {MappingParameters} [SingleObjectQueryJobsParameter.prototype.mappingParameters]
- * @description 分析后结果可视化的参数类。
- */
- this.mappingParameters = null;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.SingleObjectQueryJobsParameter";
- }
- /**
- * @function SingleObjectQueryJobsParameter.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- this.datasetName = null;
- this.datasetQuery = null;
- this.geometryQuery = null;
- this.mode = null;
- if (this.output instanceof OutputSetting) {
- this.output.destroy();
- this.output = null;
- }
- if (this.mappingParameters instanceof MappingParameters){
- this.mappingParameters.destroy();
- this.mappingParameters = null;
- }
- }
- /**
- * @function SingleObjectQueryJobsParameter.toObject
- * @param {Object} singleObjectQueryJobsParameter - 单对象空间查询分析任务参数。
- * @param {Object} tempObj - 目标对象。
- * @description 生成单对象空间查询分析任务对象。
- */
- static toObject(singleObjectQueryJobsParameter, tempObj) {
- for (var name in singleObjectQueryJobsParameter) {
- if (name === "datasetName") {
- tempObj['input'] = tempObj['input'] || {};
- tempObj['input'][name] = singleObjectQueryJobsParameter[name];
- continue;
- }
- if (name === "output"){
- tempObj['output'] = tempObj['output'] || {};
- tempObj['output'] = singleObjectQueryJobsParameter[name];
- continue;
- }
- tempObj['analyst'] = tempObj['analyst'] || {};
- tempObj['analyst'][name] = singleObjectQueryJobsParameter[name];
- if(name === 'mappingParameters'){
- tempObj['analyst'][name] = tempObj['analyst'][name] || {};
- tempObj['analyst']['mappingParameters'] = singleObjectQueryJobsParameter[name];
- }
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/SingleObjectQueryJobsService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class SingleObjectQueryJobsService
- * @deprecatedclass SuperMap.SingleObjectQueryJobsService
- * @category iServer ProcessingService Query
- * @classdesc 单对象查询分析服务类
- * @extends {ProcessingServiceBase}
- * @param {string} url - 服务地址。
- * @param {Object} options - 可选参数。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class SingleObjectQueryJobsService extends ProcessingServiceBase {
- constructor(url, options) {
- super(url, options);
- this.url = Util.urlPathAppend(this.url, 'spatialanalyst/query');
- this.CLASS_NAME = 'SuperMap.SingleObjectQueryJobsService';
- }
- /**
- *@override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function SingleObjectQueryJobsService.protitype.getQueryJobs
- * @description 获取单对象空间查询分析所有任务
- */
- getQueryJobs() {
- super.getJobs(this.url);
- }
- /**
- * @function KernelDensityJobsService.protitype.getQueryJob
- * @description 获取指定id的单对象空间查询分析服务
- * @param {string} id - 指定要获取数据的id
- */
- getQueryJob(id) {
- super.getJobs(Util.urlPathAppend(this.url, id));
- }
- /**
- * @function SingleObjectQueryJobsService.protitype.addQueryJob
- * @description 新建单对象空间查询分析服务
- * @param {SingleObjectQueryJobsParameter} params - 创建一个空间分析的请求参数。
- * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
- */
- addQueryJob(params, seconds) {
- super.addJob(this.url, params, SingleObjectQueryJobsParameter, seconds);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/StopQueryParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class StopQueryParameters
- * @deprecatedclass SuperMap.StopQueryParameters
- * @category iServer TrafficTransferAnalyst TransferStops
- * @classdesc 站点查询参数类。
- * @param {Object} options - 参数。
- * @param {string} options.keyWord - 站点名称关键字。
- * @param {boolean} [options.returnPosition=false] - 是否返回站点坐标信息。
- * @usage
- */
- class StopQueryParameters {
- constructor(options) {
- options = options || {};
- /**
- * @member {string} StopQueryParameters.prototype.keyWord
- * @description 站点名称关键字。
- */
- this.keyWord = null;
- /**
- * @member {boolean} [StopQueryParameters.prototype.returnPosition=false]
- * @description 是否返回站点坐标信息。
- */
- this.returnPosition = false;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.StopQueryParameters";
- }
- /**
- * @function StopQueryParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- Util.reset(this);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/StopQueryService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class StopQueryService
- * @deprecatedclass SuperMap.StopQueryService
- * @category iServer TrafficTransferAnalyst TransferStops
- * @classdesc 站点查询服务类。
- * 返回结果通过该类支持的事件的监听函数参数获取
- * @extends {CommonServiceBase}
- * @param {string} url - 服务地址。
- * 例如:</br>"http://localhost:8090/iserver/services/traffictransferanalyst-sample/restjsr/traffictransferanalyst/Traffic-Changchun"。
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 需要被注册的监听器对象。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @example 例如:
- * (start code)
- * var myService = new StopQueryService(url, {eventListeners: {
- * "processCompleted": StopQueryCompleted,
- * "processFailed": StopQueryError
- * }
- * };
- * (end)
- * @usage
- *
- */
- class StopQueryService extends CommonServiceBase {
- constructor(url, options) {
- super(url, options);
- options = options || {};
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.StopQueryService";
- }
- /**
- *@override
- */
- destroy() {
- super.destroy();
- Util.reset(this);
- }
- /**
- * @function StopQueryService.prototype.processAsync
- * @description 负责将客户端的更新参数传递到服务端。
- * @param {StopQueryParameters} params - 交通换乘参数。
- */
- processAsync(params) {
- if (!(params instanceof StopQueryParameters)) {
- return;
- }
- var me = this;
- me.url = Util.urlPathAppend(me.url, 'stops/keyword/' + params.keyWord);
- me.request({
- method: "GET",
- params: {returnPosition: params.returnPosition},
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/SummaryAttributesJobsParameter.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class SummaryAttributesJobsParameter
- * @deprecatedclass SuperMap.SummaryAttributesJobsParameter
- * @category iServer ProcessingService SummaryAttributes
- * @classdesc 属性汇总分析任务参数类。
- * @param {Object} options - 参数。
- * @param {string} options.datasetName - 数据集名。
- * @param {string} options.groupField - 分组字段。
- * @param {string} options.attributeField - 属性字段。
- * @param {string} options.statisticModes - 统计模式。
- * @param {OutputSetting} [options.output] -输出参数设置。
- * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
- * @usage
- */
- class SummaryAttributesJobsParameter {
- constructor(options) {
- if (!options) {
- return;
- }
- /**
- * @member {string} SummaryAttributesJobsParameter.prototype.datasetName
- * @description 汇总数据集名称。
- */
- this.datasetName = "";
- /**
- * @member {string} SummaryAttributesJobsParameter.prototype.groupField
- * @description 分组字段。
- */
- this.groupField = "";
- /**
- * @member {string} SummaryAttributesJobsParameter.prototype.attributeField
- * @description 属性字段。
- */
- this.attributeField = "";
- /**
- * @member {string} SummaryAttributesJobsParameter.prototype.statisticModes
- * @description 属性汇总统计模式。
- */
- this.statisticModes = "";
- /**
- * @member {OutputSetting} SummaryAttributesJobsParameter.prototype.output
- * @description 输出参数设置类。
- */
- this.output = null;
- /**
- * @member {MappingParameters} [SummaryAttributesJobsParameter.prototype.mappingParameters]
- * @description 分析后结果可视化的参数类。
- */
- this.mappingParameters = null;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.SummaryAttributesJobsParameter";
- }
- /**
- * @function SummaryAttributesJobsParameter.prototype.destroy
- * @description 释放资源,将资源的属性置空。
- */
- destroy() {
- this.datasetName = null;
- this.groupField = null;
- this.attributeField = null;
- this.statisticModes = null;
- if (this.output instanceof OutputSetting) {
- this.output.destroy();
- this.output = null;
- }
- if (this.mappingParameters instanceof MappingParameters){
- this.mappingParameters.destroy();
- this.mappingParameters = null;
- }
- }
- /**
- * @function SummaryAttributesJobsParameter.toObject
- * @param {Object} SummaryAttributesJobsParameter - 属性汇总任务参数。
- * @param {Object} tempObj - 目标对象。
- * @description 生成属性汇总分析任务对象。
- */
- static toObject(SummaryAttributesJobsParameter, tempObj) {
- for (var name in SummaryAttributesJobsParameter) {
- if (name === "datasetName") {
- tempObj['input'] = tempObj['input'] || {};
- tempObj['input'][name] = SummaryAttributesJobsParameter[name];
- continue;
- }
- if (name === "output") {
- tempObj['output'] = tempObj['output'] || {};
- tempObj['output'] = SummaryAttributesJobsParameter[name];
- continue;
- }
- tempObj['analyst'] = tempObj['analyst'] || {};
- tempObj['analyst'][name] = SummaryAttributesJobsParameter[name];
- if(name === 'mappingParameters'){
- tempObj['analyst'][name] = tempObj['analyst'][name] || {};
- tempObj['analyst']['mappingParameters'] = SummaryAttributesJobsParameter[name];
- }
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/SummaryAttributesJobsService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class SummaryAttributesJobsService
- * @deprecatedclass SuperMap.SummaryAttributesJobsService
- * @category iServer ProcessingService SummaryAttributes
- * @classdesc 属性汇总分析服务类
- * @extends {ProcessingServiceBase}
- * @param {string} url - 服务地址。
- * @param {Object} options - 可选参数。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class SummaryAttributesJobsService extends ProcessingServiceBase {
- constructor(url, options) {
- super(url, options);
- this.url = Util.urlPathAppend(this.url, 'spatialanalyst/summaryattributes');
- this.CLASS_NAME = "SuperMap.SummaryAttributesJobsService";
- }
- /**
- *@override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function SummaryAttributesJobsService.protitype.getSummaryAttributesJobs
- * @description 获取属性汇总分析所有任务
- */
- getSummaryAttributesJobs (){
- super.getJobs(this.url);
- }
- /**
- * @function SummaryAttributesJobsService.protitype.getSummaryAttributesJob
- * @description 获取指定id的属性汇总分析服务
- * @param {string} id - 指定要获取数据的id
- */
- getSummaryAttributesJob(id) {
- super.getJobs(Util.urlPathAppend(this.url, id));
- }
- /**
- * @function SummaryAttributesJobsService.protitype.addSummaryAttributesJob
- * @description 新建属性汇总分析服务
- * @param {SummaryAttributesJobsParameter} params - 属性汇总分析任务参数类。
- * @param {number} seconds - 创建成功结果的时间间隔。
- */
- addSummaryAttributesJob(params, seconds) {
- super.addJob(this.url, params, SummaryAttributesJobsParameter, seconds);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/SummaryMeshJobParameter.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class SummaryMeshJobParameter
- * @deprecatedclass SuperMap.SummaryMeshJobParameter
- * @category iServer ProcessingService AggregatePoints
- * @classdesc 点聚合分析任务参数类。
- * @param {Object} options - 参数。
- * @param {string} options.datasetName - 数据集名。
- * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} [options.query] - 分析范围(默认为全图范围)。
- * @param {number} options.fields - 权重索引。
- * @param {number} [options.resolution=100] - 分辨率。
- * @param {StatisticAnalystMode} [options.statisticModes=StatisticAnalystMode.AVERAGE] - 分析模式。
- * @param {number} [options.meshType=0] - 分析类型。
- * @param {SummaryType} [options.type=SummaryType.SUMMARYMESH] - 聚合类型。
- * @param {OutputSetting} [options.output] - 输出参数设置。
- * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
- * @usage
- */
- class SummaryMeshJobParameter {
- constructor(options) {
- if (!options) {
- return;
- }
- /**
- * @member {string} SummaryMeshJobParameter.prototype.datasetName
- * @description 数据集名。
- */
- this.datasetName = "";
- /**
- * @member {string} SummaryMeshJobParameter.prototype.regionDataset
- * @description 聚合面数据集(聚合类型为多边形聚合时使用的参数)。
- */
- this.regionDataset = "";
- /**
- * @member {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} SummaryMeshJobParameter.prototype.query
- * @description 分析范围(聚合类型为网格面聚合时使用的参数)。
- */
- this.query = "";
- /**
- * @member {number} [SummaryMeshJobParameter.prototype.resolution=100]
- * @description 分辨率(聚合类型为网格面聚合时使用的参数)。
- */
- this.resolution = 100;
- /**
- * @member {number} [SummaryMeshJobParameter.prototype.meshType=0]
- * @description 网格面类型(聚合类型为网格面聚合时使用的参数),取值:0 或 1。
- */
- this.meshType = 0;
- /**
- * @member {StatisticAnalystMode} [SummaryMeshJobParameter.prototype.statisticModes=StatisticAnalystMode.AVERAGE]
- * @description 统计模式。
- */
- this.statisticModes = StatisticAnalystMode.AVERAGE;
- /**
- * @member {number} SummaryMeshJobParameter.prototype.fields
- * @description 权重字段。
- */
- this.fields = "";
- /**
- * @member {SummaryType} [SummaryMeshJobParameter.prototype.type=SummaryType.SUMMARYMESH]
- * @description 聚合类型。
- */
- this.type = SummaryType.SUMMARYMESH;
- /**
- * @member {OutputSetting} [SummaryMeshJobParameter.prototype.output]
- * @description 输出参数设置类。
- */
- this.output = null;
- /**
- * @member {MappingParameters} [SummaryMeshJobParameter.prototype.mappingParameters]
- * @description 分析后结果可视化的参数类。
- */
- this.mappingParameters = null;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.SummaryMeshJobParameter";
- }
- /**
- * @function SummaryMeshJobParameter.prototype.destroy
- * @description 释放资源,将资源的属性置空。
- */
- destroy() {
- this.datasetName = null;
- this.query = null;
- this.resolution = null;
- this.statisticModes = null;
- this.meshType = null;
- this.fields = null;
- this.regionDataset = null;
- this.type = null;
- if (this.output instanceof OutputSetting) {
- this.output.destroy();
- this.output = null;
- }
- if (this.mappingParameters instanceof MappingParameters){
- this.mappingParameters.destroy();
- this.mappingParameters = null;
- }
- }
- /**
- * @function SummaryMeshJobParameter.toObject
- * @param {Object} summaryMeshJobParameter - 点聚合分析任务参数。
- * @param {Object} tempObj - 目标对象。
- * @description 生成点聚合分析任务对象。
- */
- static toObject(summaryMeshJobParameter, tempObj) {
- for (var name in summaryMeshJobParameter) {
- if (name === "datasetName") {
- tempObj['input'] = tempObj['input'] || {};
- tempObj['input'][name] = summaryMeshJobParameter[name];
- continue;
- }
- if (name === "type") {
- tempObj['type'] = summaryMeshJobParameter[name];
- continue;
- }
- if (name === "output") {
- tempObj['output'] = tempObj['output'] || {};
- tempObj['output'] = summaryMeshJobParameter[name];
- continue;
- }
- if (summaryMeshJobParameter.type === 'SUMMARYMESH' && name !== 'regionDataset' || summaryMeshJobParameter.type === 'SUMMARYREGION' && !contains(['meshType', 'resolution', 'query'], name)) {
- tempObj['analyst'] = tempObj['analyst'] || {};
- if (name === 'query' && summaryMeshJobParameter[name]) {
- tempObj['analyst'][name] = summaryMeshJobParameter[name].toBBOX();
- } else {
- tempObj['analyst'][name] = summaryMeshJobParameter[name];
- }
- if(name === 'mappingParameters'){
- tempObj['analyst'][name] = tempObj['analyst'][name] || {};
- tempObj['analyst']['mappingParameters'] = summaryMeshJobParameter[name];
- }
- }
- }
- function contains(arr, obj) {
- var i = arr.length;
- while (i--) {
- if (arr[i] === obj) {
- return true;
- }
- }
- return false;
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/SummaryMeshJobsService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class SummaryMeshJobsService
- * @deprecatedclass SuperMap.SummaryMeshJobsService
- * @category iServer ProcessingService AggregatePoints
- * @classdesc 点聚合分析任务类。
- * @param {string} url - 服务地址。
- * @param {Object} options - 参数。
- * @param {Events} options.events - 处理所有事件的对象。
- * @param {Object} [options.eventListeners] - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
- * @param {number} options.index - 服务地址在数组中的位置。
- * @param {number} options.length - 服务地址数组长度。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class SummaryMeshJobsService extends ProcessingServiceBase {
- constructor(url, options) {
- super(url, options);
- this.url = Util.urlPathAppend(this.url, 'spatialanalyst/aggregatepoints');
- this.CLASS_NAME = 'SuperMap.SummaryMeshJobsService';
- }
- /**
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function SummaryMeshJobsService.prototype.getSummaryMeshJobs
- * @description 获取点聚合分析任务
- */
- getSummaryMeshJobs() {
- super.getJobs(this.url);
- }
- /**
- * @function SummaryMeshJobsService.prototype.getSummaryMeshJob
- * @description 获取指定ip的点聚合分析任务
- * @param {string} id - 指定要获取数据的id
- */
- getSummaryMeshJob(id) {
- super.getJobs(Util.urlPathAppend(this.url, id));
- }
- /**
- * @function SummaryMeshJobsService.prototype.addSummaryMeshJob
- * @description 新建点聚合分析服务
- * @param {SummaryMeshJobParameter} params - 创建一个空间分析的请求参数。
- * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
- */
- addSummaryMeshJob(params, seconds) {
- super.addJob(this.url, params, SummaryMeshJobParameter, seconds);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/SummaryRegionJobParameter.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class SummaryRegionJobParameter
- * @deprecatedclass SuperMap.SummaryRegionJobParameter
- * @category iServer ProcessingService SummaryRegion
- * @classdesc 区域汇总分析任务参数类。
- * @param {Object} options - 参数。
- * @param {string} options.datasetName - 数据集名。
- * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} [options.query] - 分析范围(默认为全图范围)。
- * @param {string} [options.standardFields] - 标准属性字段名称。
- * @param {string} [options.weightedFields] - 权重字段名称。
- * @param {StatisticAnalystMode} [options.standardStatisticModes] - 标准属性字段的统计模式。standardSummaryFields 为 true 时必填。
- * @param {StatisticAnalystMode} [options.weightedStatisticModes] - 权重字段的统计模式。weightedSummaryFields 为 true 时必填。
- * @param {boolean} [options.sumShape=true] - 是否统计长度或面积。
- * @param {boolean} [options.standardSummaryFields=false] - 是否以标准属字段统计。
- * @param {boolean} [options.weightedSummaryFields=false] - 是否以权重字段统计。
- * @param {number} [options.resolution=100] - 网格大小。
- * @param {number} [options.meshType=0] - 网格面汇总类型。
- * @param {AnalystSizeUnit} [options.meshSizeUnit=AnalystSizeUnit.METER] - 网格大小单位。
- * @param {SummaryType} [options.type=SummaryType.SUMMARYMESH] - 汇总类型。
- * @param {OutputSetting} [options.output] - 输出参数设置。
- * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
- * @usage
- */
- class SummaryRegionJobParameter {
- constructor(options) {
- if (!options) {
- return;
- }
- /**
- * @member {string} SummaryRegionJobParameter.prototype.datasetName
- * @description 数据集名。
- */
- this.datasetName = "";
- /**
- * @member {string} SummaryRegionJobParameter.prototype.regionDataset
- * @description 汇总数据源(多边形汇总时用到的参数)。
- */
- this.regionDataset = "";
- /**
- * @member {boolean} [SummaryRegionJobParameter.prototype.sumShape=true]
- * @description 是否统计长度或面积。
- */
- this.sumShape = true;
- /**
- * @member {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} SummaryRegionJobParameter.prototype.query
- * @description 分析范围。
- */
- this.query = "";
- /**
- * @member {boolean} [SummaryRegionJobParameter.prototype.standardSummaryFields=false]
- * @description 是否以标准属字段统计。
- */
- this.standardSummaryFields = false;
- /**
- * @member {string} SummaryRegionJobParameter.prototype.standardFields
- * @description 标准属性字段名称。仅支持系统字段以外的整形、长整形、浮点型的字段的名称。standardSummaryFields 为 true 时必填。
- */
- this.standardFields = "";
- /**
- * @member {StatisticAnalystMode} SummaryRegionJobParameter.prototype.standardStatisticModes
- * @description 标准属性字段的统计模式。standardSummaryFields 为 true 时必填。
- */
- this.standardStatisticModes = "";
- /**
- * @member {boolean} [SummaryRegionJobParameter.prototype.weightedSummaryFields=false]
- * @description 是否以权重字段统计。
- */
- this.weightedSummaryFields = false;
- /**
- * @member {string} SummaryRegionJobParameter.prototype.weightedFields
- * @description 权重字段名称。仅支持系统字段以外的整形、长整形、浮点型的字段的名称。weightedSummaryFields 为 true 时必填。
- */
- this.weightedFields = "";
- /**
- * @member {StatisticAnalystMode} SummaryRegionJobParameter.prototype.weightedStatisticModes
- * @description 以权重字段统计的统计模式。权重字段的统计模式。weightedSummaryFields 为 true 时必填。
- */
- this.weightedStatisticModes = "";
- /**
- * @member {number} [SummaryRegionJobParameter.prototype.meshType=0]
- * @description 网格面汇总类型。
- */
- this.meshType = 0;
- /**
- * @member {number} [SummaryRegionJobParameter.prototype.resolution=100]
- * @description 网格大小。
- */
- this.resolution = 100;
- /**
- * @member {AnalystSizeUnit} [SummaryRegionJobParameter.prototype.meshSizeUnit=AnalystSizeUnit.METER]
- * @description 网格大小单位。
- */
- this.meshSizeUnit = AnalystSizeUnit.METER;
- /**
- * @member {SummaryType} [SummaryRegionJobParameter.prototype.type=SummaryType.SUMMARYMESH]
- * @description 汇总类型。
- */
- this.type = SummaryType.SUMMARYMESH;
- /**
- * @member {OutputSetting} SummaryRegionJobParameter.prototype.output
- * @description 输出参数设置类
- */
- this.output = null;
- /**
- * @member {MappingParameters} [SummaryRegionJobParameter.prototype.mappingParameters]
- * @description 分析后结果可视化的参数类。
- */
- this.mappingParameters = null;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.SummaryRegionJobParameter";
- }
- /**
- * @function SummaryRegionJobParameter.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- this.datasetName = null;
- this.sumShape = null;
- this.regionDataset = null;
- this.query = null;
- this.standardSummaryFields = null;
- this.standardFields = null;
- this.standardStatisticModes = null;
- this.weightedSummaryFields = null;
- this.weightedFields = null;
- this.weightedStatisticModes = null;
- this.meshType = null;
- this.resolution = null;
- this.meshSizeUnit = null;
- this.type = null;
- if (this.output instanceof OutputSetting) {
- this.output.destroy();
- this.output = null;
- }
- if (this.mappingParameters instanceof MappingParameters){
- this.mappingParameters.destroy();
- this.mappingParameters = null;
- }
- }
- /**
- * @function SummaryRegionJobParameter.toObject
- * @param {Object} summaryRegionJobParameter - 矢量裁剪分析任务参数。
- * @param {Object} tempObj - 目标对象。
- * @description 生成区域汇总分析服务对象。
- */
- static toObject(summaryRegionJobParameter, tempObj) {
- for (var name in summaryRegionJobParameter) {
- if (name === "datasetName") {
- tempObj['input'] = tempObj['input'] || {};
- tempObj['input'][name] = summaryRegionJobParameter[name];
- continue;
- }
- if (name === "type") {
- tempObj['type'] = summaryRegionJobParameter[name];
- continue;
- }
- if (name === "type") {
- tempObj['type'] = summaryRegionJobParameter[name];
- continue;
- }
- if (name === "output") {
- tempObj['output'] = tempObj['output'] || {};
- tempObj['output'] = summaryRegionJobParameter[name];
- continue;
- }
- if (summaryRegionJobParameter.type === "SUMMARYREGION" || summaryRegionJobParameter.type === "SUMMARYMESH" && name !== "regionDataset") {
- tempObj['analyst'] = tempObj['analyst'] || {};
- if (name === 'query' && summaryRegionJobParameter[name]) {
- tempObj['analyst'][name] = summaryRegionJobParameter[name].toBBOX();
- } else {
- tempObj['analyst'][name] = summaryRegionJobParameter[name];
- }
- if(name === 'mappingParameters'){
- tempObj['analyst'][name] = tempObj['analyst'][name] || {};
- tempObj['analyst']['mappingParameters'] = summaryRegionJobParameter[name];
- }
- }
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/SummaryRegionJobsService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class SummaryRegionJobsService
- * @deprecatedclass SuperMap.SummaryRegionJobsService
- * @category iServer ProcessingService SummaryRegion
- * @classdesc 区域汇总分析服务类
- * @extends {ProcessingServiceBase}
- * @param {string} url - 服务地址。
- * @param {Object} options - 可选参数。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class SummaryRegionJobsService extends ProcessingServiceBase {
- constructor(url, options) {
- super(url, options);
- this.url = Util.urlPathAppend(this.url, 'spatialanalyst/summaryregion');
- this.CLASS_NAME = 'SuperMap.SummaryRegionJobsService';
- }
- /**
- *@override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function SummaryRegionJobsService.prototype.getSummaryRegionJobs
- * @description 获取区域汇总分析任务集合。
- */
- getSummaryRegionJobs() {
- super.getJobs(this.url);
- }
- /**
- * @function SummaryRegionJobsService.prototype.getSummaryRegionJob
- * @description 获取指定id的区域汇总分析任务。
- * @param {string} id -要获取区域汇总分析任务的id
- */
- getSummaryRegionJob(id) {
- super.getJobs(Util.urlPathAppend(this.url, id));
- }
- /**
- * @function SummaryRegionJobsService.prototype.addSummaryRegionJob
- * @description 新建区域汇总任务。
- * @param {SummaryRegionJobParameter} params - 区域汇总分析任务参数类。
- * @param {number} seconds - 创建成功结果的时间间隔。
- */
- addSummaryRegionJob(params, seconds) {
- super.addJob(this.url, params, SummaryRegionJobParameter, seconds);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/SupplyCenter.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class SupplyCenter
- * @deprecatedclass SuperMap.SupplyCenter
- * @category iServer NetworkAnalyst Location
- * @classdesc 资源供给中心类。在资源分配和选址分区分析两个功能中使用。
- * @param {Object} options - 参数。
- * @param {number} options.maxWeight - 最大耗费值。
- * @param {number} options.nodeID - 结点 ID 号。资源供给中心必须是结点。
- * @param {number} options.resourceValue - 能提供的最大服务量或商品数量。
- * @param {SupplyCenterType} [options.type] - 资源供给中心点的类型常量。
- * @usage
- */
- class SupplyCenter {
- constructor(options) {
- /**
- * @member {number} SupplyCenter.prototype.maxWeight
- * @description 资源供给中心的最大耗费值。中心点最大阻值设置越小,表示中心点所提供的资源可影响范围越大。
- * 最大阻力值是用来限制需求点到中心点的花费。
- * 如果需求点(弧段或结点)到此中心的花费大于最大阻力值,则该需求点不属于该资源供给中心提供资源的范围。
- */
- this.maxWeight = null;
- /**
- * @member {number} SupplyCenter.prototype.nodeID
- * @description 资源供给中心点的结点 ID 号,资源供给中心必须是结点。
- */
- this.nodeID = null;
- /**
- * @member {number} SupplyCenter.prototype.resourceValue
- * @description 资源供给中心能提供的最大服务量或商品数量。例如资源中心为学校,资源中心资源量表示该学校能够接纳多少学生。
- */
- this.resourceValue = null;
- /**
- * @member {SupplyCenterType} [SupplyCenter.prototype.type]
- * @description 资源供给中心点的类型常量。资源供给中心点的类型包括非中心,固定中心和可选中心。
- * 固定中心用于资源分配分析;固定中心和可选中心用于选址分析;非中心在两种网络分析时都不予考虑。
- */
- this.type = null;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.SupplyCenter";
- }
- /**
- * @function SupplyCenter.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.maxWeight = null;
- me.nodeID = null;
- me.resourceValue = null;
- me.type = null;
- }
- /**
- * @function SupplyCenter.fromJson
- * @description 将服务端 JSON 对象转换成当前客户端对象。
- * @param {Object} jsonObject - 要转换的 JSON 对象。
- * @returns {SupplyCenter} SupplyCenter 对象。
- */
- static fromJson(jsonObject) {
- if (!jsonObject) {
- return;
- }
- return new SupplyCenter({
- maxWeight: jsonObject.maxWeight,
- nodeID: jsonObject.nodeID,
- resourceValue: jsonObject.resourceValue,
- type: jsonObject.type
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/SurfaceAnalystService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class SurfaceAnalystService
- * @deprecatedclass SuperMap.SurfaceAnalystService
- * @category iServer SpatialAnalyst SurfaceAnalyst
- * @classdesc 表面分析服务类。
- * 该类负责将客户设置的表面分析服务参数传递给服务端,并接收服务端返回的表面分析服务分析结果数据。
- * 表面分析结果通过该类支持的事件的监听函数参数获取
- * @param {string} url - 服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 需要被注册的监听器对象。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @extends {SpatialAnalystBase}
- * @example 例如:
- * (start code)
- * var mySurfaceAnalystService = new SurfaceAnalystService(url, {
- * eventListeners: {
- * "processCompleted": surfaceAnalysCompleted,
- * "processFailed": surfaceAnalysFailed
- * }
- * });
- * (end)
- * @usage
- */
- class SurfaceAnalystService extends SpatialAnalystBase {
- constructor(url, options) {
- super(url, options);
- this.CLASS_NAME = "SuperMap.SurfaceAnalystService";
- }
- /**
- * @function SurfaceAnalystService.prototype.destroy
- * @description 释放资源,将引用的资源属性置空。
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function SurfaceAnalystService.prototype.processAsync
- * @description 负责将客户端的表面分析服务参数传递到服务端。
- * @param {SurfaceAnalystParameters} params - 表面分析提取操作参数类。
- */
- processAsync(params) {
- if (!(params instanceof SurfaceAnalystParameters)) {
- return;
- }
- var me = this, jsonParameters;
- jsonParameters = me.getJsonParameters(params);
- me.request({
- method: "POST",
- data: jsonParameters,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- /**
- * @function SurfaceAnalystService.prototype.getJsonParameters
- * @description 将参数转化为 JSON 字符串。
- * @param {SurfaceAnalystParameters} params - 表面分析提取操作参数类。
- * @returns {Object} 转化后的JSON字符串。
- */
- getJsonParameters(params) {
- var jsonParameters = '';
- var parameterObject = {};
- var me = this;
- if (params instanceof DatasetSurfaceAnalystParameters) {
- me.url = Util.urlPathAppend(
- me.url,
- 'datasets/' + params.dataset + '/' + params.surfaceAnalystMethod.toLowerCase()
- );
- DatasetSurfaceAnalystParameters.toObject(params, parameterObject);
- jsonParameters = Util.toJSON(parameterObject);
- } else if (params instanceof GeometrySurfaceAnalystParameters) {
- me.url = Util.urlPathAppend(me.url, 'geometry/' + params.surfaceAnalystMethod.toLowerCase());
- jsonParameters = Util.toJSON(params);
- } else {
- return;
- }
- me.url = Util.urlAppend(me.url, 'returnContent=true');
- return jsonParameters;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/TerrainCurvatureCalculationParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class TerrainCurvatureCalculationParameters
- * @deprecatedclass SuperMap.TerrainCurvatureCalculationParameters
- * @category iServer SpatialAnalyst TerrainCalculation
- * @classdesc 地形曲率计算参数类。
- * @param {Object} options - 参数。
- * @param {string} options.dataset - 地形曲率计算数据源中数据集的名称。该名称用形如"数据集名称@数据源别名"形式来表示,例如:JingjinTerrain@Jingjin。
- * @param {string} options.averageCurvatureName - 结果数据集:平均曲率数据集的名称。
- * @param {string} options.profileCurvatureName - 结果数据集:剖面曲率数据集的名称。
- * @param {string} options.planCurvatureName - 结果数据集:平面曲率数据集的名称。
- * @param {number} [options.zFactor=1.0] - 指定的高程缩放系数。1.0 表示不缩放。
- * @param {boolean} [options.deleteExistResultDataset=false] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
- * @usage
- */
- class TerrainCurvatureCalculationParameters {
- constructor(options) {
- if (!options) {
- return;
- }
- /**
- * @member {string} TerrainCurvatureCalculationParameters.prototype.dataset
- * @description 要用来做地形曲率计算数据源中数据集的名称。
- * 该名称用形如"数据集名称@数据源别名"形式来表示,例如:JingjinTerrain@Jingjin。
- * 注:地形曲率计算必须为栅格数据集。
- */
- this.dataset = null;
- /**
- * @member {number} [TerrainCurvatureCalculationParameters.prototype.zFactor=1.0]
- * @description 指定的高程缩放系数。1.0 表示不缩放。
- * 该值是指在 DEM 栅格数据中,栅格值( Z 坐标,即高程值)相对于 X 和 Y 坐标的单位变换系数。
- * 通常有 X,Y,Z 都参加的计算中,需要将高程值乘以一个高程缩放系数,使得三者单位一致。
- * 例如,X、Y 方向上的单位是米,而 Z 方向的单位是英尺,由于 1 英尺等于 0.3048 米,则需要指定缩放系数为 0.3048。
- */
- this.zFactor = 1.0;
- /**
- * @member {string} TerrainCurvatureCalculationParameters.prototype.averageCurvatureName
- * @description 结果数据集:平均曲率数据集的名称。
- */
- this.averageCurvatureName = null;
- /**
- * @member {string} TerrainCurvatureCalculationParameters.prototype.profileCurvatureName
- * @description 结果数据集:剖面曲率数据集的名称。
- */
- this.profileCurvatureName = "";
- /**
- * @member {string} TerrainCurvatureCalculationParameters.prototype.planCurvatureName
- * @description 结果数据集:平面曲率数据集的名称。
- */
- this.planCurvatureName = "";
- /**
- * @member {boolean} [TerrainCurvatureCalculationParameters.prototype.deleteExistResultDataset=false]
- * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
- */
- this.deleteExistResultDataset = false;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.TerrainCurvatureCalculationParameters";
- }
- /**
- * @function TerrainCurvatureCalculationParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.dataset = null;
- me.zFactor = 1.0;
- me.averageCurvatureName = null;
- me.profileCurvatureName = null;
- me.planCurvatureName = null;
- me.deleteExistResultDataset = true;
- }
- /**
- * @function TerrainCurvatureCalculationParameters.toObject
- * @param {Object} derrainCurvatureCalculationParameters - 地形曲率计算参数。
- * @param {Object} tempObj - 目标对象。
- * @description 生成地形曲率计算对象。
- */
- static toObject(derrainCurvatureCalculationParameters, tempObj) {
- for (var name in derrainCurvatureCalculationParameters) {
- if (name !== "dataset") {
- tempObj[name] = derrainCurvatureCalculationParameters[name];
- }
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/TerrainCurvatureCalculationService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class TerrainCurvatureCalculationService
- * @deprecatedclass SuperMap.TerrainCurvatureCalculationService
- * @category iServer SpatialAnalyst TerrainCalculation
- * @classdesc 地形曲率计算服务类。
- * @extends {SpatialAnalystBase}
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 需要被注册的监听器对象。
- * @param {string} options.url - 服务的访问地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst 。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @example 例如:
- * (start code)
- * var myTerrainCurvatureCalculationService = new TerrainCurvatureCalculationService(url);
- * myTerrainCurvatureCalculationService.on({
- * "processCompleted": processCompleted,
- * "processFailed": processFailed
- * }
- * );
- * (end)
- * @usage
- */
- class TerrainCurvatureCalculationService extends SpatialAnalystBase {
- constructor(url, options) {
- super(url, options);
- this.CLASS_NAME = "SuperMap.TerrainCurvatureCalculationService";
- }
- /**
- *@override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function TerrainCurvatureCalculationService.prototype.processAsync
- * @description 负责将客户端的查询参数传递到服务端。
- * @param {TerrainCurvatureCalculationParameters} parameter - 地形曲率计算参数类。
- */
- processAsync(parameter) {
- var me = this;
- var parameterObject = {};
- if (parameter instanceof TerrainCurvatureCalculationParameters) {
- me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/terraincalculation/curvature');
- }
- TerrainCurvatureCalculationParameters.toObject(parameter, parameterObject);
- var jsonParameters = Util.toJSON(parameterObject);
- me.url = Util.urlAppend(me.url, 'returnContent=true');
- me.request({
- method: "POST",
- data: jsonParameters,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ThemeFlow.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ThemeFlow
- * @deprecatedclass SuperMap.ThemeFlow
- * @private
- * @category iServer Map Theme
- * @classdesc 标签或符号流动显示和牵引线风格设置类。
- * 通过该类可以设置专题图中符号是否流动显示、是否使用牵引线以及牵引线风格。
- * @param {Object} options - 可选参数。
- * @param {boolean} [options.flowEnabled=false] - 是否流动显示标签或符号。
- * @param {boolean} [options.leaderLineDisplayed=false] - 是否显示标签或符号和它标注的对象之间的牵引线。
- * @param {ServerStyle} [options.leaderLineStyle] - 标签或符号与其标注对象之间牵引线的风格。
- * @usage
- */
- class ThemeFlow {
- constructor(options) {
- /**
- * @member {boolean} [ThemeFlow.prototype.flowEnabled=false]
- * @description 是否流动显示标签或符号。<br>
- * 对于标签专题图而言,对于跨越比较大的区域和线条状的几何对象,在一个地图窗口中不能完全显示的情况下,如果其标签位置比较固定,
- * 在当前地图窗口中该对象的标签不可见,则需要通过平移地图来查看对象的标签信息。如果采用了流动显示的效果,在当前地图窗口中,对象即使是部分显示,
- * 其标签也会显示在当前地图窗口中。当平移地图时,对象的标签会随之移动,以保证在当前地图窗口中部分或全部显示的对象其标签都可见,从而可以方便地查看各要素的标签信息。
- */
- this.flowEnabled = false;
- /**
- * @member {boolean} [ThemeFlow.prototype.leaderLineDisplayed=false]
- * @description 是否显示标签或符号和它标注的对象之间的牵引线。false表示不显示标签或符号和它标注的对象之间的牵引线。<br>
- * 只有当 flowEnabled 为 true 时,牵引线才起作用。在当标签流动显示时,其位置不固定,由于牵引线始终指向要素的内点,
- * 因而通过牵引线显示功能可以找到流动的标签或符号实际对应的要素。或者渲染符号偏移它所指向的对象时,图与对象之间可以采用牵引线进行连接。
- */
- this.leaderLineDisplayed = false;
- /**
- * @member {ServerStyle} ThemeFlow.prototype.leaderLineStyle
- * @description 标签或符号与其标注对象之间牵引线的风格。
- */
- this.leaderLineStyle = new ServerStyle();
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.ThemeFlow";
- }
- /**
- * @function ThemeFlow.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.flowEnabled = null;
- me.leaderLineDisplayed = null;
- if (me.leaderLineStyle) {
- me.leaderLineStyle.destroy();
- me.leaderLineStyle = null;
- }
- }
- /**
- * @function ThemeFlow.fromObj
- * @description 从传入对象获取标签或符号流动显示和牵引线风格设置类。
- * @param {Object} obj - 传入对象。
- * @returns {ThemeFlow} ThemeFlow 对象。
- */
- static fromObj(obj) {
- if (!obj) {
- return;
- }
- var res = new ThemeFlow();
- Util.copy(res, obj);
- res.leaderLineStyle = ServerStyle.fromJson(obj.leaderLineStyle);
- return res;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGridRangeItem.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ThemeGridRangeItem
- * @deprecatedclass SuperMap.ThemeGridRangeItem
- * @category iServer Map Theme
- * @classdesc 栅格分段专题图子项类。在栅格分段专题图中,将栅格值按照某种分段模式被分成多个范围段。
- * 本类用来设置每个范围段的分段起始值、终止值、名称和颜色等。每个分段所表示的范围为 [Start,End)。
- * @param {Object} options - 参数。
- * @param {ServerColor} options.color - 栅格分段专题图中每一个分段专题图子项的对应的颜色。
- * @param {string} [options.caption] - 栅格分段专题图子项的标题。
- * @param {number} [options.end=0] - 栅格分段专题图子项的终止值。
- * @param {number} [options.start=0] - 栅格分段专题图子项的起始值。
- * @param {boolean} [options.visible=true] - 栅格分段专题图子项是否可见。
- * @usage
- */
- class ThemeGridRangeItem {
- constructor(options) {
- /**
- * @member {string} [ThemeGridRangeItem.prototype.caption]
- * @description 栅格分段专题图子项的标题。
- */
- this.caption = null;
- /**
- * @member {ServerColor} ThemeGridRangeItem.prototype.color
- * @description 栅格分段专题图中每一个分段专题图子项的对应的颜色。
- */
- this.color = new ServerColor();
- /**
- * @member {number} [ThemeGridRangeItem.prototype.end=0]
- * @description 栅格分段专题图子项的终止值,即该段专题值范围的最大值。
- */
- this.end = 0;
- /**
- * @member {number} [ThemeGridRangeItem.prototype.start=0]
- * @description 栅格分段专题图子项的起始值,即该段专题值范围的最小值。
- */
- this.start = 0;
- /**
- * @member {boolean} [ThemeGridRangeItem.prototype.visible=true]
- * @description 栅格分段专题图子项是否可见。
- */
- this.visible = true;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.ThemeGridRangeItem";
- }
- /**
- * @function ThemeGridRangeItem.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.caption = null;
- me.end = null;
- me.start = null;
- //需要验证是够存在destroy方法
- if (me.color) {
- me.color.destroy();
- me.color = null;
- }
- me.visible = null;
- }
- /**
- * @function ThemeGridRangeItem.prototype.toServerJSONObject
- * @description 转换成对应的 JSON 格式对象。
- * @returns {Object} 对应的 JSON 格式对象。
- */
- toServerJSONObject() {
- var obj = {};
- obj = Util.copyAttributes(obj, this);
- if (obj.color) {
- if (obj.color.toServerJSONObject) {
- obj.color = obj.color.toServerJSONObject();
- }
- }
- return obj;
- }
- /**
- * @function ThemeGridRangeItem.fromObj
- * @description 从传入对象获取栅格分段专题图子项类。
- * @param {Object} obj - 传入对象。
- * @returns {ThemeGridRangeItem} ThemeGridRangeItem 对象。
- */
- static fromObj(obj) {
- if (!obj) {
- return;
- }
- var res = new ThemeGridRangeItem();
- Util.copy(res, obj);
- res.color = ServerColor.fromJson(obj.color);
- return res;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGridRange.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ThemeGridRange
- * @deprecatedclass SuperMap.ThemeGridRange
- * @category iServer Map Theme
- * @classdesc 栅格分段专题图。栅格分段专题图,是将所有单元格的值按照某种分段方式分成多个范围段,值在同一个范围段中的单元格使用相同的颜色进行显示。一般用来反映连续分布现象的数量或程度特征。
- * 比如某年的全国降水量分布图,将各气象站点的观测值经过内插之后生成的栅格数据进行分段显示。
- * 该类类似于分段专题图类,不同点在于分段专题图的操作对象是矢量数据,而栅格分段专题图的操作对象是栅格数据。
- * @extends {CommonTheme}
- * @param {Object} options - 参数。
- * @param {Array.<ThemeGridRangeItem>} options.items - 栅格分段专题图子项数组。
- * @param {boolean} [options.reverseColor=false] - 是否对栅格分段专题图中分段的颜色风格进行反序显示。
- * @param {RangeMode} [options.rangeMode=RangeMode.EQUALINTERVAL] - 分段专题图的分段模式。
- * @param {number} [options.rangeParameter=0] - 分段参数。
- * @param {ColorGradientType} [options.colorGradientType=ColorGradientType.YELLOW_RED] - 渐变颜色枚举类。
- * @usage
- */
- class ThemeGridRange extends Theme {
- constructor(options) {
- super("GRIDRANGE", options);
- /**
- * @member {Array.<ThemeGridRangeItem>} ThemeGridRange.prototype.items
- * @description 栅格分段专题图子项数组。<br>
- * 在栅格分段专题图中,将栅格值按照某种分段模式被分成多个范围段。
- * 本类用来设置每个栅格范围段的分段起始值、终止值、名称和颜色等。每个分段所表示的范围为 [Start,End)。
- */
- this.items = null;
- /**
- * @member {RangeMode} [ThemeGridRange.prototype.rangeMode=RangeMode.EQUALINTERVAL]
- * @description 分段专题图的分段模式。<br>
- * 在栅格分段专题图中,作为专题变量的字段或表达式的值按照某种分段方式被分成多个范围段。
- * 目前 SuperMap 提供的分段方式包括:等距离分段法、平方根分段法、标准差分段法、对数分段法、等计数分段法和自定义距离法,
- * 显然这些分段方法根据一定的距离进行分段,因而范围分段专题图所基于的专题变量必须为数值型。
- */
- this.rangeMode = RangeMode.EQUALINTERVAL;
- /**
- * @member {number} [ThemeGridRange.prototype.rangeParameter=0]
- * @description 分段参数。<br>
- * 当分段模式为等距离分段法,平方根分段,对数分段法,计数分段法其中一种模式时,该参数用于设置分段个数,必设;当分段模式为标准差分段法时,
- * 该参数不起作用;当分段模式为自定义距离时,该参数用于设置自定义距离。
- */
- this.rangeParameter = 0;
- /**
- * @member {ColorGradientType} [ThemeGridRange.prototype.colorGradientType=ColorGradientType.YELLOW_RED]
- * @description 渐变颜色枚举类。
- *
- */
- this.colorGradientType = ColorGradientType.YELLOW_RED;
- /**
- * @member {boolean} ThemeGridRange.prototype.reverseColor
- * @description 是否对栅格分段专题图中分段的颜色风格进行反序显示。
- */
- this.reverseColor = false;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.ThemeGridRange";
- }
- /**
- * @function ThemeGridRange.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- var me = this;
- if (me.items) {
- if (me.items.length > 0) {
- for (var item in me.items) {
- me.items[item].destroy();
- me.items[item] = null;
- }
- }
- me.items = null;
- }
- me.reverseColor = null;
- me.rangeMode = null;
- me.rangeParameter = null;
- me.colorGradientType = null;
- }
- /**
- * @function ThemeGridRange.fromObj
- * @description 从传入对象获取栅格分段专题图。
- * @param {Object} obj - 传入对象。
- * @returns {ThemeGridRange} ThemeGridRange 对象。
- */
- static fromObj(obj) {
- if (!obj) {
- return;
- }
- var res = new ThemeGridRange();
- Util.copy(res, obj);
- var itemsR = obj.items;
- var len = itemsR ? itemsR.length : 0;
- res.items = [];
- for (var i = 0; i < len; i++) {
- res.items.push(ThemeGridRangeItem.fromObj(itemsR[i]));
- }
- return res;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGridUniqueItem.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ThemeGridUniqueItem
- * @deprecatedclass SuperMap.ThemeGridUniqueItem
- * @category iServer Map Theme
- * @classdesc 栅格单值专题图子项类。
- * 栅格单值专题图是将值相同的单元格归为一类,每一类是一个专题图子项。
- * @param {Object} options - 可选参数。
- * @param {string} [options.caption] - 子项的名称。
- * @param {ServerColor} [options.color] - 子项的显示颜色。
- * @param {number} options.unique - 子项的专题值,即单元格的值,值相同的单元格位于一个子项内。
- * @param {boolean} [options.visible=true] - 子项是否可见。
- * @usage
- */
- class ThemeGridUniqueItem {
- constructor(options) {
- /**
- * @member {string} [ThemeGridUniqueItem.prototype.caption]
- * @description 栅格单值专题图子项的名称。
- */
- this.caption = null;
- /**
- * @member {ServerColor} [ThemeGridUniqueItem.prototype.color]
- * @description 栅格单值专题图子项的显示颜色。
- */
- this.color = new ServerColor();
- /**
- * @member {number} ThemeGridUniqueItem.prototype.unique
- * @description 栅格单值专题图子项的专题值,即单元格的值,值相同的单元格位于一个子项内。
- */
- this.unique = null;
- /**
- * @member {boolean} [ThemeGridUniqueItem.prototype.visible=true]
- * @description 栅格单值专题图子项是否可见。
- */
- this.visible = true;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.ThemeGridUniqueItem";
- }
- /**
- * @function ThemeGridUniqueItem.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.caption = null;
- me.unique = null;
- if (me.color) {
- me.color.destroy();
- me.color = null;
- }
- me.visible = null;
- }
- /**
- * @function ThemeGridUniqueItem.prototype.toServerJSONObject
- * @description 转换成对应的 JSON 格式对象。
- * @returns {Object} 对应的 JSON 格式对象。
- */
- toServerJSONObject() {
- var obj = {};
- obj = Util.copyAttributes(obj, this);
- if (obj.color) {
- if (obj.color.toServerJSONObject) {
- obj.color = obj.color.toServerJSONObject();
- }
- }
- return obj;
- }
- /**
- * @function ThemeGridUniqueItem.fromObj
- * @description 从传入对象获取栅格单值专题图子项类。
- * @param {Object} obj - 传入对象。
- * @returns {ThemeGridUniqueItem} ThemeGridUniqueItem 对象。
- */
- static fromObj(obj) {
- var res = new ThemeGridUniqueItem();
- Util.copy(res, obj);
- res.color = ServerColor.fromJson(obj.color);
- return res;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGridUnique.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ThemeGridUnique
- * @deprecatedclass SuperMap.ThemeGridUnique
- * @category iServer Map Theme
- * @classdesc 栅格单值专题图类。栅格单值专题图是将单元格值相同的归为一类,为每一类设定一种颜色,从而用来区分不同的类别。
- * 适用于离散栅格数据和部分连续栅格数据,对于单元格值各不相同的那些连续栅格数据,使用栅格单值专题图不具有任何意义。
- * @extends {CommonTheme}
- * @param {Object} options - 参数。
- * @param {Array.<ThemeGridUniqueItem>} options.items - 栅格单值专题图子项数组。
- * @param {ServerColor} [options.defaultcolor] - 栅格单值专题图的默认颜色。
- * @usage
- */
- class ThemeGridUnique extends Theme {
- constructor(options) {
- super("GRIDUNIQUE", options);
- /**
- * @member {ServerColor} ThemeGridUnique.prototype.defaultcolor
- * @description 栅格单值专题图的默认颜色。
- * 对于那些未在格网单值专题图子项之列的要素使用该颜色显示。
- */
- this.defaultcolor = new ServerColor();
- /**
- * @member {Array.<ThemeGridUniqueItem>} ThemeGridUnique.prototype.items
- * @description 栅格单值专题图子项数组。
- * 栅格单值专题图将值相同的单元格归为一类,每一类是一个专题图子项。
- */
- this.items = null;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.ThemeGridUnique";
- }
- /**
- * @function ThemeGridUnique.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- var me = this;
- if (me.items) {
- if (me.items.length > 0) {
- for (var item in me.items) {
- me.items[item].destroy();
- me.items[item] = null;
- }
- }
- me.items = null;
- }
- if (me.defaultcolor) {
- me.defaultcolor.destroy();
- me.defaultcolor = null;
- }
- }
- /**
- * @function ThemeGridUnique.prototype.toServerJSONObject
- * @description 转换成对应的 JSON 格式对象。
- * @returns {Object} 对应的 JSON 格式对象
- */
- toServerJSONObject() {
- var obj = {};
- obj = Util.copyAttributes(obj, this);
- if (obj.defaultcolor) {
- if (obj.defaultcolor.toServerJSONObject) {
- obj.defaultcolor = obj.defaultcolor.toServerJSONObject();
- }
- }
- if (obj.items) {
- var items = [],
- len = obj.items.length;
- for (var i = 0; i < len; i++) {
- items.push(obj.items[i].toServerJSONObject());
- }
- obj.items = items;
- }
- return obj;
- }
- /**
- * @function ThemeGridUnique.fromObj
- * @description 从传入对象获取栅格单值专题图类。
- * @param {Object} obj - 传入对象
- * @returns {ThemeGridUnique} ThemeGridUnique 对象
- */
- static fromObj(obj) {
- var res = new ThemeGridUnique();
- var uItems = obj.items;
- var len = uItems ? uItems.length : 0;
- Util.extend(res, obj);
- res.items = [];
- res.defaultcolor = ServerColor.fromJson(obj.defaultcolor);
- for (var i = 0; i < len; i++) {
- res.items.push(ThemeGridUniqueItem.fromObj(uItems[i]));
- }
- return res;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabelUniqueItem.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ThemeLabelUniqueItem
- * @deprecatedclass SuperMap.ThemeLabelUniqueItem
- * @category iServer Map Theme
- * @classdesc 单值标签专题图的子项。标签专题图用专题值对点、线、面等对象做标注,值得注意的是,单值标签专题图允许用户通过 uniqueExpression
- * 字段指定用于单值的字段,同一值的标签具有相同的显示风格,其中每一个值就是一个专题图子项,
- * 每一个子项都具有其名称、风格、指定的单值、X 方向偏移量和 Y 方向偏移量。
- * @param {Object} options - 参数。
- * @param {string} options.unique - 子项的值,可以为数字、字符串等。
- * @param {string} [options.caption] - 子项的名称。
- * @param {number} [options.offsetX=0] - 标签在 X 方向偏移量。
- * @param {number} [options.offsetY=0] - 标签在 Y 方向偏移量。
- * @param {boolean} [options.visible=true] - 子项是否可见。
- * @param {ServerTextStyle} [options.style] - 子项文本的显示风格。
- * @usage
- */
- class ThemeLabelUniqueItem {
- constructor(options) {
- /**
- * @member {string} [ThemeLabelUniqueItem.prototype.caption]
- * @description 标签专题子项的标题。
- */
- this.caption = null;
- /**
- * @member {string} ThemeLabelUniqueItem.prototype.unique
- * @description 单值专题图子项的值,可以为数字、字符串等。
- */
- this.unique = null;
- /**
- * @member {number} [ThemeLabelUniqueItem.prototype.offsetX=0]
- * @description 标签在 X 方向偏移量。
- */
- this.offsetX = 0;
- /**
- * @member {number} [ThemeLabelUniqueItem.prototype.offsetY=0]
- * @description 标签在 Y 方向偏移量。
- */
- this.offsetY = 0;
- /**
- * @member {boolean} [ThemeLabelUniqueItem.prototype.visible=true]
- * @description 标签专题图子项是否可见。如果标签专题图子项可见,则为 true,否则为 false。
- */
- this.visible = true;
- /**
- * @member {ServerTextStyle} ThemeLabelUniqueItem.prototype.style
- * @description 标签专题图子项文本的显示风格。各种风格的优先级从高到低为:<br>
- * uniformMixedStyle(标签文本的复合风格),ThemeLabelUniqueItem.style(单值子项的文本风格),uniformStyle(统一文本风格)。
- */
- this.style = new ServerTextStyle();
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.ThemeLabelUniqueItem";
- }
- /**
- * @function ThemeLabelUniqueItem.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.unique = null;
- me.caption = null;
- me.offsetX = null;
- me.offsetY = null;
- if (me.style) {
- me.style.destroy();
- me.style = null;
- }
- me.visible = null;
- }
- /**
- * @function ThemeLabelUniqueItem.fromObj
- * @description 从传入对象获取单值标签专题图的子项类。
- * @param {Object} obj - 传入对象。
- * @returns {ThemeLabelUniqueItem} ThemeLabelUniqueItem 对象。
- */
- static fromObj(obj) {
- if (!obj) {
- return;
- }
- var t = new ThemeLabelUniqueItem();
- Util.copy(t, obj);
- return t;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ThemeMemoryData.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ThemeMemoryData
- * @deprecatedclass SuperMap.ThemeMemoryData
- * @category iServer Map Theme
- * @classdesc 专题图内存数据类。
- * @param {Array} srcData - 原始值数组。
- * @param {Array} targetData - 外部值数组。
- * @usage
- */
- class ThemeMemoryData {
- constructor(srcData, targetData) {
- /**
- * @member {Array} ThemeMemoryData.prototype.srcData
- * @description 原始值数组,该属性值将被 targetData 属性所指定的值替换掉,然后制作专题图,但数据库中的值并不会改变。
- */
- this.srcData = srcData;
- /**
- * @member {Array} ThemeMemoryData.prototype.targetData
- * @description 外部值数组,即用于制作专题图的内存数据,设定该属性值后,会将 srcData 属性所指定的原始值替换掉制作专题图,但数据库中的值并不会改变。
- */
- this.targetData = targetData;
- this.CLASS_NAME = "SuperMap.ThemeMemoryData";
- }
- /**
- * @function ThemeMemoryData.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.srcData = null;
- me.targetData = null;
- }
- /**
- * @function ThemeMemoryData.prototype.toJSON
- * @description 将 ThemeMemoryData 对象转化为 JSON 字符串。
- * @returns {string} 返回转换后的 JSON 字符串。
- */
- toJSON() {
- if (this.srcData && this.targetData) {
- var memoryDataStr = "";
- var count = Math.min(this.srcData.length, this.targetData.length);
- for (var i = 0; i < count; i++) {
- memoryDataStr += "\'" + this.srcData[i] + "\':\'" + this.targetData[i] + "\',";
- }
- //去除多余的逗号
- if (i > 0) {
- memoryDataStr = memoryDataStr.substring(0, memoryDataStr.length - 1);
- }
- return "{" + memoryDataStr + "}";
- } else {
- return null;
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ThemeParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ThemeParameters
- * @deprecatedclass SuperMap.ThemeParameters
- * @category iServer Map Theme
- * @classdesc 专题图参数类。
- * 该类存储了制作专题所需的参数,包括数据源、数据集名称和专题图对象。
- * @param {Object} options - 参数。
- * @param {Array.<string>} options.datasetNames - 数据集数组。
- * @param {Array.<string>} options.dataSourceNames - 数据源数组。
- * @param {Array.<JoinItem>} [options.joinItems] - 专题图外部表的连接信息 JoinItem 数组。
- * @param {Array.<CommonTheme>} options.themes - 专题图对象列表。
- * @param {Array.<string>} [options.displayFilters] - 专题图属性过滤条件。
- * @param {Array.<string>} [options.displayOrderBys] - 专题图对象生成符号叠加次序排序字段。
- * @param {Object} [options.fieldValuesDisplayFilter] - 图层要素的显示和隐藏的过滤属性,其带有三个属性,分别是:values、fieldName、fieldValuesDisplayMode。
- * @usage
- */
- class ThemeParameters {
- constructor(options) {
- /**
- * @member {Array.<string>} ThemeParameters.prototype.datasetNames
- * @description 要制作专题图的数据集数组。
- */
- this.datasetNames = null;
- /**
- * @member {Array.<string>} ThemeParameters.prototype.dataSourceNames
- * @description 要制作专题图的数据集所在的数据源数组。
- */
- this.dataSourceNames = null;
- /**
- * @member {Array.<JoinItem>} [ThemeParameters.prototype.joinItems]
- * @description 设置与外部表的连接信息 JoinItem 数组。
- * 使用此属性可以制作与外部表连接的专题图。
- */
- this.joinItems = null;
- /**
- * @member {Array.<CommonTheme>} ThemeParameters.prototype.themes
- * @description 专题图对象列表。
- * 该参数为实例化的各类专题图对象的集合。
- */
- this.themes = null;
- /**
- * @member {Array.<string>} [ThemeParameters.prototype.displayFilters]
- * @description 专题图属性过滤条件。
- */
- this.displayFilters = null;
- /**
- * @member {Array.<string>} [ThemeParameters.prototype.displayOrderBys]
- * @description 专题图对象生成符号叠加次序排序字段。
- */
- this.displayOrderBys = null;
- /**
- * @member {Object} [ThemeParameters.prototype.fieldValuesDisplayFilter]
- * @property {Array.<number>} values - 待过滤的值。
- * @property {string} fieldName - 待过滤的字段名称只支持数字类型的字段。
- * @property {string} fieldValuesDisplayMode - 目前为 DISPLAY/DISABLE。当为 DISPLAY 时,表示只显示以上设置的相应属性值的要素,否则表示不显示以上设置的相应属性值的要素。
- */
- this.fieldValuesDisplayFilter = null;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.ThemeParameters";
- }
- /**
- * @function ThemeParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.datasetNames = null;
- me.dataSourceNames = null;
- if (me.joinItems) {
- for (let i = 0, joinItems = me.joinItems, len = joinItems.length; i < len; i++) {
- joinItems[i].destroy();
- }
- me.joinItems = null;
- }
- if (me.themes) {
- for (let i = 0, themes = me.themes, len = themes.length; i < len; i++) {
- themes[i].destroy();
- }
- me.themes = null;
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ThemeService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ThemeService
- * @deprecatedclass SuperMap.ThemeService
- * @category iServer Map Theme
- * @classdesc 专题图服务类。
- * @extends {CommonServiceBase}
- * @example
- * var myThemeService = new ThemeService(url, {
- * eventListeners: {
- * "processCompleted": themeCompleted,
- * "processFailed": themeFailed
- * }
- * });
- * @param {string} url - 服务地址。如:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 。
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 需要被注册的监听器对象。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class ThemeService extends CommonServiceBase {
- constructor(url, options) {
- super(url, options);
- if (options) {
- Util.extend(this, options);
- }
- this.url = Util.urlPathAppend(this.url, 'tempLayersSet');
- this.CLASS_NAME = 'SuperMap.ThemeService';
- }
- /**
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function ThemeService.prototype.processAsync
- * @description 负责将客户端的专题图参数传递到服务端。
- * @param {ThemeParameters} params - 专题图参数类。
- */
- processAsync(params) {
- if (!(params instanceof ThemeParameters)) {
- return;
- }
- var me = this,
- jsonParameters = null;
- jsonParameters = me.getJsonParameters(params);
- me.request({
- method: "POST",
- data: jsonParameters,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- /**
- * @function ThemeService.prototype.getJsonParameters
- * @description 将专题图参数参数转化为 JSON 字符串。
- * @param {ThemeParameters} parameter - 专题图参数类。
- * @returns {Object} 转化后的JSON字符串。
- */
- getJsonParameters(parameter) {
- var jsonParameters = "",
- themeObj = null,
- filters = null,
- orderBys = null,
- fieldValuesDisplayFilter;
- jsonParameters += "[{'type': 'UGC','subLayers': {'layers': [";
- for (var i = 0; i < parameter.themes.length; i++) {
- themeObj = parameter.themes[i];
- var jsonTheme = Util.toJSON(themeObj);
- jsonTheme = jsonTheme.slice(0, -1);
- jsonParameters += "{'theme': " + jsonTheme + "},'type': 'UGC','ugcLayerType': 'THEME',";
- filters = parameter.displayFilters;
- if (filters && filters.length > 0) {
- if (filters.length === 1) {
- jsonParameters += "'displayFilter':\"" + filters[0] + "\",";
- } else {
- jsonParameters += "'displayFilter':\"" + filters[i] + "\",";
- }
- }
- orderBys = parameter.displayOrderBy;
- if (orderBys && orderBys.length > 0) {
- if (orderBys.length === 1) {
- jsonParameters += "'displayOrderBy':'" + orderBys[0] + "',";
- } else {
- jsonParameters += "'displayOrderBy':'" + orderBys[i] + "',";
- }
- }
- fieldValuesDisplayFilter = parameter.fieldValuesDisplayFilter;
- if (fieldValuesDisplayFilter) {
- jsonParameters += "'fieldValuesDisplayFilter':" + Util.toJSON(fieldValuesDisplayFilter) + ",";
- }
- if (parameter.joinItems && parameter.joinItems.length > 0 && parameter.joinItems[i]) {
- jsonParameters += "'joinItems':[" + Util.toJSON(parameter.joinItems[i]) + "],";
- }
- if (parameter.datasetNames && parameter.dataSourceNames) {
- var datasetID = parameter.datasetNames[i] ? i : (parameter.datasetNames.length - 1);
- var dataSourceID = parameter.dataSourceNames[i] ? i : (parameter.dataSourceNames.length - 1);
- jsonParameters += "'datasetInfo': {'name': '" + parameter.datasetNames[datasetID] +
- "','dataSourceName': '" + parameter.dataSourceNames[dataSourceID] + "'}},";
- } else {
- jsonParameters += "},";
- }
- }
- //去除多余的逗号
- if (parameter.themes && parameter.themes.length > 0) {
- jsonParameters = jsonParameters.substring(0, jsonParameters.length - 1);
- }
- jsonParameters += "]},";
- var urlArray = this.url.split("/");
- var jsonMapName = urlArray[urlArray.length - 2];
- jsonParameters += "'name': '" + jsonMapName + "'}]";
- return jsonParameters;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ThiessenAnalystService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ThiessenAnalystService
- * @deprecatedclass SuperMap.ThiessenAnalystService
- * @category iServer SpatialAnalyst ThiessenPolygonAnalyst
- * @classdesc
- * 泰森多边形分析服务类
- * 该类负责将客户设置的泰森多边形分析参数传递给服务端,并接收服务端返回的分析结果数据。
- * 泰森多边形分析结果通过该类支持的事件的监听函数参数获取
- * 泰森多边形分析的参数支持两种,当参数为 {@link DatasetThiessenAnalystParameters} 类型
- * 时,执行数据集泰森多边形分析,当参数为 {@link GeometryThiessenAnalystParameters} 类型时,
- * 执行几何对象泰森多边形分析。
- * @param {string} url - 服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 需要被注册的监听器对象。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @extends {SpatialAnalystBase}
- * @example 例如:
- * (start code)
- * var myThiessenAnalystService = new ThiessenAnalystService(url, {
- * eventListeners: {
- * "processCompleted": bufferCompleted,
- * "processFailed": bufferFailed
- * }
- * });
- * (end)
- * @usage
- */
- class ThiessenAnalystService extends SpatialAnalystBase {
- constructor(url, options) {
- super(url, options);
- /**
- * @member {string} ThiessenAnalystService.prototype.mode
- * @description 缓冲区分析类型
- */
- this.mode = null;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.ThiessenAnalystService";
- }
- /**
- * @override
- */
- destroy() {
- super.destroy();
- this.mode = null;
- }
- /**
- * @function ThiessenAnalystService.prototype.processAsync
- * @description 负责将客户端的查询参数传递到服务端。
- * @param {DatasetThiessenAnalystParameters|GeometryThiessenAnalystParameters} parameter - 泰森多边形分析参数基类。
- */
- processAsync(parameter) {
- var parameterObject = {};
- var me = this;
- if (parameter instanceof DatasetThiessenAnalystParameters) {
- me.mode = "datasets";
- me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/thiessenpolygon');
- DatasetThiessenAnalystParameters.toObject(parameter, parameterObject);
- } else if (parameter instanceof GeometryThiessenAnalystParameters) {
- me.mode = "geometry";
- me.url = Util.urlPathAppend(me.url, 'geometry/thiessenpolygon');
- GeometryThiessenAnalystParameters.toObject(parameter, parameterObject);
- }
- var jsonParameters = Util.toJSON(parameterObject);
- me.url = Util.urlAppend(me.url, 'returnContent=true');
- me.request({
- method: "POST",
- data: jsonParameters,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/GeometryBatchAnalystService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GeometryBatchAnalystService
- * @deprecatedclass SuperMap.GeometryBatchAnalystService
- * @category iServer SpatialAnalyst BatchAnalyst
- * @classdesc 批量空间分析服务类
- * @description 该类负责将客户设置的叠加分析参数传递给服务端,并接收服务端返回的叠加分析结果数据。
- * 获取的结果数据包括 originResult 、result 两种,
- * 其中,originResult 为服务端返回的用 JSON 对象表示的量算结果数据,result 为服务端返回的量算结果数据。
- * @extends {SpatialAnalystBase}
- * @param {string} url - 服务地址。如:http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 需要被注册的监听器对象。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @example
- * var myOverlayAnalystService = new GeometryBatchAnalystService(url, {
- * eventListeners: {
- * "processCompleted": OverlayCompleted,
- * "processFailed": OverlayFailed
- * }
- * });
- * @usage
- */
- class GeometryBatchAnalystService extends SpatialAnalystBase {
- constructor(url, options) {
- super(url, options);
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.GeometryBatchAnalystService";
- }
- /**
- * @function GeometryBatchAnalystService.prototype.processAsync
- * @description 负责将客户端的查询参数传递到服务端。
- * @param {GeometryOverlayAnalystParameter} parameter - 批量几何对象叠加分析参数类
- *
- */
- processAsync(parameters) {
- var me = this;
- me.url = Util.urlPathAppend(me.url, 'geometry/batchanalyst');
- me.url = Util.urlAppend(me.url, 'returnContent=true&ignoreAnalystParam=true');
- var parameterObjects = me._processParams(parameters);
- var jsonParameters = Util.toJSON(parameterObjects);
- me.request({
- method: "POST",
- data: jsonParameters,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- _processParams(parameters) {
- var me = this;
- if (!Util.isArray(parameters)) {
- return;
- }
- var processParams = [];
- parameters.map(function (item) {
- processParams.push(me._toJSON(item));
- return item;
- });
- return processParams;
- }
- _toJSON(parameter) {
- var tempObj = {};
- if(parameter.analystName ==="buffer"){
- tempObj.analystName = "buffer";
- tempObj.param = {};
- //几何对象的批量空间分析,
- GeometryBufferAnalystParameters.toObject(parameter.param, tempObj.param);
- }else if(parameter.analystName ==="overlay"){
- tempObj.analystName = "overlay";
- tempObj.param = {};
- GeometryOverlayAnalystParameters.toObject(parameter.param, tempObj.param);
- }else if(parameter.analystName ==="interpolationDensity"){
- tempObj.analystName = "interpolationDensity";
- tempObj.param = {};
- InterpolationAnalystParameters.toObject(parameter.param, tempObj.param);
- }else if(parameter.analystName ==="interpolationidw"){
- tempObj.analystName = "interpolationidw";
- tempObj.param = {};
- InterpolationAnalystParameters.toObject(parameter.param, tempObj.param);
- }else if(parameter.analystName ==="interpolationRBF"){
- tempObj.analystName = "interpolationRBF";
- tempObj.param = {};
- InterpolationAnalystParameters.toObject(parameter.param, tempObj.param);
- }else if(parameter.analystName ==="interpolationKriging"){
- tempObj.analystName = "interpolationKriging";
- tempObj.param = {};
- InterpolationAnalystParameters.toObject(parameter.param, tempObj.param);
- }else if(parameter.analystName ==="thiessenpolygon"){
- tempObj.analystName = "thiessenpolygon";
- tempObj.param = {};
- GeometryThiessenAnalystParameters.toObject(parameter.param, tempObj.param);
- }else {
- //isoline; isoregion; calculatemeasure; routelocator 四种分析不需要再处理参数
- return parameter;
- }
- return tempObj;
- }
- /**
- * @override
- */
- destroy() {
- super.destroy();
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/TilesetsService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class TilesetsService
- * @deprecatedclass SuperMap.TilesetsService
- * @category iServer Map Tilesets
- * @classdesc 切片列表信息查询服务类;即查询切片地图服务的切片列表,返回切片集名称、地图切片元数据信息、切片版本集信息。
- * @extends {CommonServiceBase}
- * @param {string} url - 服务地址。URL 应为:
- * http://{服务器地址}:{服务端口号}/iserver/services/{服务名}/rest/maps/map;
- * 例如: "http://localhost:8090/iserver/services/test/rest/maps/tianlocal"。
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
- * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class TilesetsService extends CommonServiceBase {
- constructor(url, options) {
- super(url, options);
- this.CLASS_NAME = "SuperMap.TilesetsService";
- }
- /**
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function TilesetsService.prototype.processAsync
- * @description 负责将客户端的查询参数传递到服务端。
- */
- processAsync() {
- if (!this.url) {
- return;
- }
- var me = this;
- me.url = Util.urlPathAppend(me.url, 'tilesets');
- me.request({
- method: "GET",
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/TopologyValidatorJobsParameter.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class TopologyValidatorJobsParameter
- * @deprecatedclass SuperMap.TopologyValidatorJobsParameter
- * @category iServer ProcessingService TopologyValidator
- * @classdesc 拓扑检查分析任务参数类。
- * @param {Object} options - 参数。
- * @param {string} options.datasetName - 数据集名。
- * @param {string} options.datasetTopology -检查对象所在的数据集名称。
- * @param {TopologyValidatorRule} [options.rule=TopologyValidatorRule.REGIONNOOVERLAP] - 拓扑检查规则。
- * @param {string} [options.tolerance] - 容限。
- * @param {OutputSetting} [options.output] - 输出参数设置。
- * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
- * @usage
- */
- class TopologyValidatorJobsParameter {
- constructor(options) {
- if (!options) {
- return;
- }
- /**
- * @member {string} TopologyValidatorJobsParameter.prototype.datasetName
- * @description 数据集名。
- */
- this.datasetName = "";
- /**
- * @member {string} TopologyValidatorJobsParameter.prototype.datasetTopology
- * @description 拓扑检查对象所在的数据集名称。
- */
- this.datasetTopology = "";
- /**
- * @member {string} [TopologyValidatorJobsParameter.prototype.tolerance]
- * @description 容限,指定的拓扑错误检查时使用的容限。
- */
- this.tolerance = "";
- /**
- * @member {TopologyValidatorRule} [TopologyValidatorJobsParameter.prototype.rule=TopologyValidatorRule.REGIONNOOVERLAP]
- * @description 拓扑检查模式。
- */
- this.rule = TopologyValidatorRule.REGIONNOOVERLAP;
- /**
- * @member {OutputSetting} [TopologyValidatorJobsParameter.prototype.output]
- * @description 输出参数设置类。
- */
- this.output = null;
- /**
- * @member {MappingParameters} [TopologyValidatorJobsParameter.prototype.mappingParameters]
- * @description 分析后结果可视化的参数类。
- */
- this.mappingParameters = null;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.TopologyValidatorJobsParameter";
- }
- /**
- * @function TopologyValidatorJobsParameter.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- this.datasetName = null;
- this.datasetTopology = null;
- this.tolerance = null;
- this.rule = null;
- if (this.output instanceof OutputSetting) {
- this.output.destroy();
- this.output = null;
- }
- if (this.mappingParameters instanceof MappingParameters) {
- this.mappingParameters.destroy();
- this.mappingParameters = null;
- }
- }
- /**
- * @function TopologyValidatorJobsParameter.toObject
- * @param {Object} TopologyValidatorJobsParameter -拓扑检查分析任务参数。
- * @param {Object} tempObj - 目标对象。
- * @description 生成拓扑检查分析任务对象。
- */
- static toObject(TopologyValidatorJobsParameter, tempObj) {
- for (var name in TopologyValidatorJobsParameter) {
- if (name === "datasetName") {
- tempObj['input'] = tempObj['input'] || {};
- tempObj['input'][name] = TopologyValidatorJobsParameter[name];
- continue;
- }
- if (name === "output") {
- tempObj['output'] = tempObj['output'] || {};
- tempObj['output'] = TopologyValidatorJobsParameter[name];
- continue;
- }
- tempObj['analyst'] = tempObj['analyst'] || {};
- tempObj['analyst'][name] = TopologyValidatorJobsParameter[name];
- if(name === 'mappingParameters'){
- tempObj['analyst'][name] = tempObj['analyst'][name] || {};
- tempObj['analyst']['mappingParameters'] = TopologyValidatorJobsParameter[name];
- }
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/TopologyValidatorJobsService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class TopologyValidatorJobsService
- * @deprecatedclass SuperMap.TopologyValidatorJobsService
- * @category iServer ProcessingService TopologyValidator
- * @classdesc 拓扑检查分析服务类
- * @extends {ProcessingServiceBase}
- * @param {string} url - 服务地址。
- * @param {Object} options - 可选参数。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class TopologyValidatorJobsService extends ProcessingServiceBase {
- constructor(url, options) {
- super(url, options);
- this.url = Util.urlPathAppend(this.url, 'spatialanalyst/topologyvalidator');
- this.CLASS_NAME = "SuperMap.TopologyValidatorJobsService";
- }
- /**
- *@override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function TopologyValidatorJobsService.protitype.getTopologyValidatorJobs
- * @description 获取拓扑检查分析所有任务
- */
- getTopologyValidatorJobs() {
- super.getJobs(this.url);
- }
- /**
- * @function TopologyValidatorJobsService.protitype.getTopologyValidatorJob
- * @description 获取指定id的拓扑检查分析服务
- * @param {string} id - 指定要获取数据的id
- */
- getTopologyValidatorJob(id) {
- super.getJobs( Util.urlPathAppend(this.url, id));
- }
- /**
- * @function TopologyValidatorJobsService.protitype.addTopologyValidatorJob
- * @description 新建拓扑检查分析服务
- * @param {TopologyValidatorJobsParameter} params - 拓扑检查分析任务参数类。
- * @param {number} seconds -创建成功结果的时间间隔。
- */
- addTopologyValidatorJob(params, seconds) {
- super.addJob(this.url, params, TopologyValidatorJobsParameter, seconds);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/TransferLine.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class TransferLine
- * @deprecatedclass SuperMap.TransferLine
- * @category iServer TrafficTransferAnalyst TransferPath
- * @classdesc 换乘路线信息类。
- * @param {Object} options - 参数。
- * @param {number} options.lineID - 乘车路线 ID。
- * @param {string} options.lineName - 乘车路线名称。
- * @param {string} options.lineAliasName - 乘车路线别名。
- * @param {number} options.startStopIndex - 上车站点在本公交路线中的索引。
- * @param {string} options.startStopName - 上车站点名称。
- * @param {string} options.startStopAliasName - 上车站点别名。
- * @param {number} options.endStopIndex - 下车站点在本公交路线中的索引。
- * @param {string} options.endStopName - 下车站点名称。
- * @param {string} options.endStopAliasName - 下车站点别名。
- * @usage
- */
- class TransferLine {
- constructor(options) {
- options = options || {};
- /**
- * @member {number} TransferLine.prototype.lineID
- * @description 乘车路线 ID。
- */
- this.lineID = null;
- /**
- * @member {string} TransferLine.prototype.lineName
- * @description 乘车路线名称。
- */
- this.lineName = null;
- /**
- * @member {string} TransferLine.prototype.lineAliasName
- * @description 乘车路线别名。
- */
- this.lineAliasName = null;
- /**
- * @member {number} TransferLine.prototype.startStopIndex
- * @description 上车站点在本公交路线中的索引。
- */
- this.startStopIndex = null;
- /**
- * @member {string} TransferLine.prototype.startStopName
- * @description 上车站点名称。
- */
- this.startStopName = null;
- /**
- * @member {string} TransferLine.prototype.startStopAliasName
- * @description 上车站点别名。
- */
- this.startStopAliasName = null;
- /**
- * @member {number} TransferLine.prototype.endStopIndex
- * @description 下车站点在本公交路线中的索引。
- */
- this.endStopIndex = null;
- /**
- * @member {string} TransferLine.prototype.endStopName
- * @description 下车站点名称。
- */
- this.endStopName = null;
- /**
- * @member {string} TransferLine.prototype.endStopAliasName
- * @description 下车站点别名。
- */
- this.endStopAliasName = null;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.TransferLine";
- }
- /**
- * @function TransferLine.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- Util.reset(this);
- }
- /**
- * @function TransferLine.fromJson
- * @description 将返回结果转化为 {@link TransferLine} 对象。
- * @param {Object} jsonObject - 新的返回结果。
- * @returns {TransferLine} 转化后的 {@link TransferLine} 对象。
- */
- static fromJson(jsonObject) {
- if (!jsonObject) {
- return;
- }
- return new TransferLine({
- lineID: jsonObject['lineID'],
- lineName: jsonObject['lineName'],
- lineAliasName: jsonObject['lineAliasName'],
- startStopIndex: jsonObject['startStopIndex'],
- startStopName: jsonObject['startStopName'],
- startStopAliasName: jsonObject['startStopAliasName'],
- endStopIndex: jsonObject['endStopIndex'],
- endStopName: jsonObject['endStopName'],
- endStopAliasName: jsonObject['endStopAliasName']
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/TransferPathParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class TransferPathParameters
- * @deprecatedclass SuperMap.TransferPathParameters
- * @category iServer TrafficTransferAnalyst TransferPath
- * @classdesc 交通换乘线路查询参数类。
- * @param {Object} options - 参数。
- * @param {Array.<TransferLine>} options.transferLines - 本换乘分段内可乘车的路线集合。
- * @param {Array.<GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|Array.<number>|number>} options.points - 两种查询方式:按照公交站点的起止 ID 进行查询和按照起止点的坐标进行查询。
- * @usage
- */
- class TransferPathParameters {
- constructor(options) {
- options = options || {};
- /**
- * @member {Array.<TransferLine>} TransferPathParameters.prototype.transferLines
- * @description 本换乘分段内可乘车的路线集合,通过交通换乘方案查询得到。
- */
- this.transferLines = null;
- /**
- * @member {Array.<GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|Array.<number>|number>} TransferPathParameters.prototype.points
- * @description 两种查询方式:<br>
- * 1. 按照公交站点的起止ID进行查询,则 points 参数的类型为 int[],形如:[起点ID、终点ID],公交站点的 ID 对应服务提供者配置中的站点 ID 字段;
- * 2. 按照起止点的坐标进行查询,则 points 参数的类型为 Point2D[],形如:[{"x":44,"y":39},{"x":45,"y":40}]。
- */
- this.points = null;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.TransferPathParameters";
- }
- /**
- * @function TransferPathParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- Util.reset(this);
- }
- /**
- * @function TransferPathParameters.toJson
- * @description 将 {@link TransferPathParameters} 对象参数转换为 JSON 字符串。
- * @param {TransferPathParameters} params - 交通换乘参数。
- * @returns {string} 转化后的 JSON 字符串。
- */
- static toJson(params) {
- if (params) {
- return Util.toJSON(params);
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/TransferPathService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class TransferPathService
- * @deprecatedclass SuperMap.TransferPathService
- * @category iServer TrafficTransferAnalyst TransferPath
- * @classdesc 交通换乘线路查询服务类,根据交通换乘分析结果(TransferSolutionResult),获取某一条乘车路线的详细信息。
- * 返回结果通过该类支持的事件的监听函数参数获取
- * @extends {CommonServiceBase}
- * @example 例如:
- * var myService = new TransferPathService(url, {eventListeners: {
- * "processCompleted": TrafficTransferCompleted,
- * "processFailed": TrafficTransferError
- * }
- * };
- * @param {string} url - 服务地址。
- * 例如:</br>"http://localhost:8090/iserver/services/traffictransferanalyst-sample/restjsr/traffictransferanalyst/Traffic-Changchun"。
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 需要被注册的监听器对象。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class TransferPathService extends CommonServiceBase {
- constructor(url, options) {
- super(url, options);
- this.CLASS_NAME = "SuperMap.TransferPathService";
- }
- /**
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function TransferPathService.prototype.processAsync
- * @description 负责将客户端的更新参数传递到服务端。
- * @param {TransferPathParameters} params - 交通换乘参数。
- */
- processAsync(params) {
- if (!(params instanceof TransferPathParameters)) {
- return;
- }
- var me = this,
- method = "GET",
- jsonParameters;
- me.url = Util.urlPathAppend(me.url, 'path');
- jsonParameters = {
- points: Util.toJSON(params.points),
- transferLines: Util.toJSON(params['transferLines'])
- };
- me.request({
- method: method,
- params: jsonParameters,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/TransferSolutionParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class TransferSolutionParameters
- * @deprecatedclass SuperMap.TransferSolutionParameters
- * @category iServer TrafficTransferAnalyst TransferSolutions
- * @classdesc 交通换乘方案查询参数类。
- * @param {Object} options - 参数。
- * @param {Array.<GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|Array.<number>|number>} options.points - 两种查询方式:按照公交站点的起止ID进行查询和按照起止点的坐标进行查询。
- * @param {number} [options.solutionCount=6] - 乘车方案的数量。
- * @param {TransferTactic} [options.transferTactic=TransferTactic.LESS_TIME] - 交通换乘策略类型,包括时间最短、距离最短、最少换乘、最少步行四种选择。
- * @param {TransferPreference} [options.transferPreference=TransferPreference.NONE] - 乘车偏好枚举。
- * @param {number} [options.walkingRatio=10] - 步行与公交的消耗权重比。
- * @param {Array.<number>} [options.evadeLines] - 避让路线的 ID。
- * @param {Array.<number>} [options.evadeStops] - 避让站点的 ID。
- * @param {Array.<number>} [options.priorLines] - 优先路线的 ID。
- * @param {Array.<number>} [options.priorStops] - 优先站点的 ID。
- * @param {string} [options.travelTime] - 出行的时间。
- * @usage
- */
- class TransferSolutionParameters {
- constructor(options) {
- options = options || {};
- /**
- * @member {number} [TransferSolutionParameters.prototype.solutionCount=6]
- * @description 乘车方案的数量。
- */
- this.solutionCount = 6;
- /**
- * @member {TransferPreference} [TransferSolutionParameters.prototype.transferPreference=TransferPreference.NONE]
- * @description 乘车偏好枚举。
- */
- this.transferPreference = TransferPreference.NONE;
- /**
- * @member {TransferTactic} [TransferSolutionParameters.prototype.transferTactic=TransferTactic|TransferTactic.LESS_TIME]
- * @description 交通换乘策略类型,包括时间最短、距离最短、最少换乘、最少步行四种选择。
- */
- this.transferTactic = TransferTactic.LESS_TIME;
- /**
- * @member {number} [TransferSolutionParameters.prototype.walkingRatio=10]
- * @description 步行与公交的消耗权重比。此值越大,则步行因素对于方案选择的影响越大。例如:</br>
- * 例如现在有两种换乘方案(在仅考虑消耗因素的情况下):</br>
- * 方案1:坐车 10 公里,走路 1 公里;</br>
- * 方案2:坐车 15 公里,走路 0.5 公里;</br>
- * 1. 假设权重比为 15:</br>
- * •方案 1 的总消耗为:10 + 1*15 = 25</br>
- * •方案 2 的总消耗为:15 + 0.5*15 = 22.5</br>
- * 此时方案 2 消耗更低。</br>
- * 2. 假设权重比为2:</br>
- * •方案 1 的总消耗为:10+1*2 = 12</br>
- * •方案 2 的总消耗为:15+0.5*2 = 17</br>
- * 此时方案 1 消耗更低。</br>
- */
- this.walkingRatio = null;
- /**
- * @member {Array.<GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|Array.<number>|number>} TransferSolutionParameters.prototype.points
- * @description 两种查询方式:</br>
- * 1. 按照公交站点的起止 ID 进行查询,则 points 参数的类型为 int[],形如:[起点 ID、终点 ID],公交站点的 ID 对应服务提供者配置中的站点 ID 字段;
- * 2. 按照起止点的坐标进行查询,则 points 参数的类型为 Point2D[],形如:[{"x":44,"y":39},{"x":45,"y":40}]。
- */
- this.points = false;
- /**
- * @member {Array.<number>} [TransferSolutionParameters.prototype.evadeLinesnull]
- * @description 避让路线 ID。
- * */
- this.evadeLines = null;
- /**
- * @member {Array.<number>} [TransferSolutionParameters.prototype.evadeStops=TransferLine]
- * @description 避让站点 ID。
- * */
- this.evadeStops = null;
- /**
- * @member {Array.<number>} [TransferSolutionParameters.prototype.priorLines]
- * @description 优先路线 ID。
- * */
- this.priorLines = null;
- /**
- * @member {Array.<number>} [TransferSolutionParameters.prototype.priorStops]
- * @description 优先站点 ID。
- * */
- this.priorStops = null;
- /**
- * @member {string} TransferSolutionParameters.prototype.travelTime
- * @description 出行的时间; 格式是:"小时:分钟",如:"08:30"。如果设置了该参数,在分析时,则会考虑线路的首末班车时间的限制,即在返回的结果中会提示公交的首末班发车时间。
- */
- this.travelTime = null;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.TransferSolutionParameters";
- }
- /**
- * @function TransferSolutionParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- Util.reset(this);
- }
- /**
- * @function TransferSolutionParameters.toJsonParameters
- * @description 将 {@link TransferSolutionParameters} 对象参数转换为 JSON 字符串。
- * @param {TransferSolutionParameters} params - 交通换乘参数。
- * @returns {string} 转化后的 JSON 字符串。
- */
- static toJson(params) {
- if (params) {
- return Util.toJSON(params);
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/TransferSolutionService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class TransferSolutionService
- * @deprecatedclass SuperMap.TransferSolutionService
- * @category iServer TrafficTransferAnalyst TransferSolutions
- * @classdesc 交通换乘方案查询服务类。
- * 返回结果通过该类支持的事件的监听函数参数获取。
- * @param {string} url - 服务地址。
- * 例如:</br>"http://localhost:8090/iserver/services/traffictransferanalyst-sample/restjsr/traffictransferanalyst/Traffic-Changchun"。
- * @param {Object} options - 参数。</br>
- * @param {Object} options.eventListeners - 需要被注册的监听器对象。</br>
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @extends {CommonServiceBase}
- * @example 例如:
- * (start code)
- * var myService = new TransferSolutionService(url, {eventListeners: {
- * "processCompleted": trafficTransferCompleted,
- * "processFailed": trafficTransferError
- * }
- * };
- * (end)
- * @usage
- */
- class TransferSolutionService extends CommonServiceBase {
- constructor(url, options) {
- super(url, options);
- this.CLASS_NAME = "SuperMap.TransferSolutionService";
- }
- /**
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function TransferSolutionService.prototype.processAsync
- * @description 负责将客户端的更新参数传递到服务端。
- * @param {TransferSolutionParameters} params - 交通换乘参数。
- */
- processAsync(params) {
- if (!(params instanceof TransferSolutionParameters)) {
- return;
- }
- var me = this,
- method = "GET",
- jsonParameters;
- me.url = Util.urlPathAppend(me.url, 'solutions');
- jsonParameters = {
- points: Util.toJSON(params.points),
- walkingRatio: params['walkingRatio'],
- transferTactic: params['transferTactic'],
- solutionCount: params['solutionCount'],
- transferPreference: params["transferPreference"]
- };
- if (params.evadeLines) {
- jsonParameters["evadeLines"] = Util.toJSON(params.evadeLines);
- }
- if (params.evadeStops) {
- jsonParameters["evadeStops"] = Util.toJSON(params.evadeStops);
- }
- if (params.priorLines) {
- jsonParameters["priorLines"] = Util.toJSON(params.priorLines);
- }
- if (params.priorStops) {
- jsonParameters["priorStops"] = Util.toJSON(params.priorStops);
- }
- if (params.travelTime) {
- jsonParameters["travelTime"] = params.travelTime;
- }
- me.request({
- method: method,
- params: jsonParameters,
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/UpdateEdgeWeightParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class UpdateEdgeWeightParameters
- * @deprecatedclass SuperMap.UpdateEdgeWeightParameters
- * @category iServer NetworkAnalyst EdgeWeight
- * @classdesc 边的耗费权重更新服务参数类。
- * @param {Object} options - 参数。
- * @param {string} options.edgeId - 所在边的 ID。
- * @param {string} options.fromNodeId - 起始转向点的 ID。
- * @param {string} options.toNodeId - 终止转向点的 ID。
- * @param {string} options.weightField - 边的耗费字段。
- * @param {string} options.edgeWeight - 耗费权重。
- * @usage
- */
- class UpdateEdgeWeightParameters {
- constructor(options) {
- if (!options) {
- return;
- }
- /**
- * @member {string} UpdateEdgeWeightParameters.prototype.edgeId
- * @description 所在边的 ID。
- */
- this.edgeId = "";
- /**
- * @member {string} UpdateEdgeWeightParameters.prototype.fromNodeId
- * @description 起始转向点的 ID。
- */
- this.fromNodeId = "";
- /**
- * @member {string} UpdateEdgeWeightParameters.prototype.toNodeId
- * @description 终止转向点的 ID。
- */
- this.toNodeId = "";
- /**
- * @member {string} UpdateEdgeWeightParameters.prototype.weightField
- * @description 边的耗费字段。
- */
- this.weightField = "";
- /**
- * @member {string} UpdateEdgeWeightParameters.prototype.edgeWeight
- * @description 耗费权重。
- */
- this.edgeWeight = "";
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.UpdateEdgeWeightParameters";
- }
- /**
- * @function UpdateEdgeWeightParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- this.edgeId = null;
- this.fromNodeId = null;
- this.toNodeId = null;
- this.weightField = null;
- this.edgeWeight = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/CreateDatasetParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class CreateDatasetParameters
- * @deprecatedclass SuperMap.CreateDatasetParameters
- * @category iServer Data Dataset
- * @classdesc 数据集创建参数类。
- * @param {Object} options - 参数。
- * @param {string} options.datasourceName - 数据源名称,此为必选参数。
- * @param {string} options.datasetName - 数据集名称,此为必选参数。
- * @param {string} options.datasetType - 数据集类型。目前支持创建的出聚集类型有:点、线、面、文本、复合(CAD)和属性数据集。
- * @usage
- */
- class CreateDatasetParameters {
- constructor(options) {
- if (!options) {
- return;
- }
- /**
- * @member {string} CreateDatasetParameters.prototype.datasourceName
- * @description 数据源名称,此为必选参数。
- */
- this.datasourceName = null;
- /**
- * @member {string} CreateDatasetParameters.prototype.datasetName
- * @description 数据集名称,此为必选参数。
- */
- this.datasetName = null;
- /**
- * @member {string} CreateDatasetParameters.prototype.datasetType
- * @description 数据集类型。目前支持创建的出聚集类型有:点、线、面、文本、复合(CAD)和属性数据集。
- */
- this.datasetType = null;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.CreateDatasetParameters";
- }
- /**
- * @function CreateDatasetParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.datasourceName = null;
- me.datasetName = null;
- me.datasetType = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/UpdateEdgeWeightService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class UpdateEdgeWeightService
- * @deprecatedclass SuperMap.UpdateEdgeWeightService
- * @category iServer NetworkAnalyst EdgeWeight
- * @classdesc 更新边的边的耗费权重服务
- * @extends {NetworkAnalystServiceBase}
- * @example
- *(start code)
- * var updateEdgeWeightService = new UpdateEdgeWeightService(url, {
- * eventListeners: {
- * "processCompleted": UpdateEdgeWeightCompleted,
- * "processFailed": UpdateEdgeWeightError
- * }
- * });
- * (end)
- * @param {string} url - 服务地址。如:http://localhost:8090/iserver/services/transportationanalyst-sample/rest/networkanalyst/RoadNet@Changchun 。
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 需要被注册的监听器对象。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class UpdateEdgeWeightService extends NetworkAnalystServiceBase {
- constructor(url, options) {
- super(url, options);
- this.CLASS_NAME = "SuperMap.UpdateEdgeWeightService";
- }
- /**
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function UpdateEdgeWeightService.prototype.processAsync
- * @description 开始异步执行边的边的耗费权重的更新
- * @param {UpdateEdgeWeightParameters} params - 边的耗费权重更新服务参数类
- * @example
- * (code)
- * var updateEdgeWeightParam=new SuperMapUpdateEdgeWeightParameters({
- * edgeId:"20",
- * fromNodeId:"26",
- * toNodeId:"109",
- * weightField:"time",
- * edgeWeight:"25"
- * });
- * updateEdgeWeightService.processAsync(updateEdgeWeightParam);
- * (end)
- */
- processAsync(params) {
- if (!(params instanceof UpdateEdgeWeightParameters)) {
- return;
- }
- var me = this;
- var paramStr = me.parse(params);
- me.url = Util.urlPathAppend(me.url, paramStr);
- var data = params.edgeWeight ? params.edgeWeight : null;
- me.request({
- method: "PUT",
- scope: me,
- data: data,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- /**
- * @function UpdateEdgeWeightService.prototype.parse
- * @description 将更新服务参数解析为用‘/’做分隔的字符串
- */
- parse(params) {
- if (!params) {
- return;
- }
- var paramStr = "";
- for (var attr in params) {
- if (params[attr] === "" || params[attr] === "edgeWeight") {
- continue;
- }
- switch (attr) {
- case "edgeId":
- paramStr += "/edgeweight/" + params[attr];
- break;
- case "fromNodeId":
- paramStr += "/fromnode/" + params[attr];
- break;
- case "toNodeId":
- paramStr += "/tonode/" + params[attr];
- break;
- case "weightField":
- paramStr += "/weightfield/" + params[attr];
- break;
- default :
- break;
- }
- }
- return paramStr;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/UpdateTurnNodeWeightParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class UpdateTurnNodeWeightParameters
- * @deprecatedclass SuperMap.UpdateTurnNodeWeightParameters
- * @category iServer NetworkAnalyst TurnNodeWeight
- * @classdesc 转向耗费权重更新服务参数类。
- * @param {Object} options - 参数。
- * @param {string} options.nodeId - 转向结点的 ID。
- * @param {string} options.fromEdgeId - 起始边的 ID。
- * @param {string} options.toEdgeId - 终止边的 ID。
- * @param {string} options.weightField - 转向结点的耗费字段。
- * @param {string} options.turnNodeWeight - 耗费权重。
- * @usage
- */
- class UpdateTurnNodeWeightParameters {
- constructor(options) {
- if (!options) {
- return;
- }
- /**
- * @member {string} UpdateTurnNodeWeightParameters.prototype.nodeId
- * @description 转向结点的 ID。
- */
- this.nodeId = "";
- /**
- * @member {string} UpdateTurnNodeWeightParameters.prototype.fromEdgeId
- * @description 起始边的 ID。
- */
- this.fromEdgeId = "";
- /**
- * @member {string} UpdateTurnNodeWeightParameters.prototype.toEdgeId
- * @description 终止边的 ID。
- */
- this.toEdgeId = "";
- /**
- * @member {string} UpdateTurnNodeWeightParameters.prototype.weightField
- * @description 转向结点的耗费字段。
- */
- this.weightField = "";
- /**
- * @member {string} UpdateTurnNodeWeightParameters.prototype.turnNodeWeight
- * @description 耗费权重。
- */
- this.turnNodeWeight = "";
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.UpdateTurnNodeWeightParameters";
- }
- /**
- * @function UpdateTurnNodeWeightParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- this.nodeId = null;
- this.fromEdgeId = null;
- this.toEdgeId = null;
- this.weightField = null;
- this.turnNodeWeight = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/UpdateTurnNodeWeightService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class UpdateTurnNodeWeightService
- * @deprecatedclass SuperMap.UpdateTurnNodeWeightService
- * @category iServer NetworkAnalyst TurnNodeWeight
- * @classdesc 转向耗费权重更新服务类
- * @extends {NetworkAnalystServiceBase}
- * @example
- * var UpdateTurnNodeWeightService = new UpdateTurnNodeWeightService(url, {
- * eventListeners: {
- * "processCompleted": UpdateTurnNodeWeightCompleted,
- * "processFailed": UpdateTurnNodeWeightError
- * }
- * });
- * @param {string} url - 服务地址。如:
- * http://localhost:8090/iserver/services/transportationanalyst-sample/rest/networkanalyst/RoadNet@Changchun 。
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 需要被注册的监听器对象。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class UpdateTurnNodeWeightService extends NetworkAnalystServiceBase {
- constructor(url, options) {
- super(url, options);
- this.CLASS_NAME = "SuperMap.UpdateTurnNodeWeightService";
- }
- /**
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function UpdateTurnNodeWeightService.prototype.processAsync
- * @description 开始异步执行转向耗费权重的更新
- * @param {UpdateTurnNodeWeightParameters} params - 转向耗费权重更新服务参数类
- * @example
- * (code)
- * var updateTurnNodeWeightParam=new UpdateTurnNodeWeightParameters({
- * nodeId:"106",
- * fromEdgeId:"6508",
- * toEdgeId:"6504",
- * weightField:"TurnCost",
- * turnNodeWeight:"50"
- * });
- * updateTurnNodeWeightService.processAsync(updateTurnNodeWeightParam);
- * (end)
- **/
- processAsync(params) {
- if (!(params instanceof UpdateTurnNodeWeightParameters)) {
- return;
- }
- var me = this;
- var paramStr = me.parse(params);
- me.url = Util.urlPathAppend(me.url, paramStr);
- var data = params.turnNodeWeight ? params.turnNodeWeight : null;
- me.request({
- method: "PUT",
- scope: me,
- data: data,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- /**
- * @function UpdateTurnNodeWeightService.prototype.parse
- * @description 将更新服务参数解析为用‘/’做分隔的字符串
- */
- parse(params) {
- if (!params) {
- return;
- }
- var paramStr = "";
- for (var attr in params) {
- if (params[attr] === "" || params[attr] === "turnNodeWeight") {
- continue;
- }
- switch (attr) {
- case "nodeId":
- paramStr += "/turnnodeweight/" + params[attr];
- break;
- case "fromEdgeId":
- paramStr += "/fromedge/" + params[attr];
- break;
- case "toEdgeId":
- paramStr += "/toedge/" + params[attr];
- break;
- case "weightField":
- paramStr += "/weightfield/" + params[attr];
- break;
- default :
- break;
- }
- }
- return paramStr;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/UpdateDatasetParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class UpdateDatasetParameters
- * @deprecatedclass SuperMap.UpdateDatasetParameters
- * @category iServer Data Dataset
- * @classdesc 数据集信息更改参数类。
- * @param {Object} options - 参数。
- * @param {string} options.datasourceName - 数据源名称。
- * @param {string} options.datasetName - 数据集名称。
- * @param {boolean} options.isFileCache - 是否使用文件形式的缓存。仅对数据库型数据源中的矢量数据集有效。
- * @param {string} options.description - 数据集描述信息。
- * @param {string} options.prjCoordSys - 投影坐标系。
- * @param {Object} options.charset - 矢量数据集的字符集。当数据集类型为矢量数据集时,可以传递此参数。如果用户传递空值,则编码方式保持不变。
- * @param {Array.<string>} options.palette - 影像数据的颜色调色板。当数据集类型为影像数据集时,可以传递此参数。
- * @param {number} options.noValue - 栅格数据集中没有数据的像元的栅格值。当数据集类型为栅格数据集时,可以传递此参数。
- * @usage
- */
- class UpdateDatasetParameters {
- constructor(options) {
- if (!options) {
- return;
- }
- /**
- * @member {string} UpdateDatasetParameters.prototype.datasourceName
- * @description 数据源名称。
- */
- this.datasourceName = null;
- /**
- * @member {string} UpdateDatasetParameters.prototype.datasetName
- * @description 数据集名称。
- */
- this.datasetName = null;
- /**
- * @member {boolean} UpdateDatasetParameters.prototype.isFileCache
- * @description 是否使用文件形式的缓存。仅对数据库型数据源中的矢量数据集有效。
- */
- this.isFileCache = null;
- /**
- * @member {string} UpdateDatasetParameters.prototype.description
- * @description 数据集描述信息。
- */
- this.description = null;
- /**
- * @member {string} UpdateDatasetParameters.prototype.prjCoordSys
- * @description 投影坐标系。
- */
- this.prjCoordSys = null;
- /**
- * @member {Object} UpdateDatasetParameters.prototype.charset
- * @description 矢量数据集的字符集。
- */
- this.charset = null;
- /**
- * @member {Array.<string>} UpdateDatasetParameters.prototype.palette
- * @description 影像数据的颜色调色板。
- */
- this.palette = null;
- /**
- * @member {number} UpdateDatasetParameters.prototype.noValue
- * @description 栅格数据集中没有数据的像元的栅格值。
- */
- this.noValue = null;
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = "SuperMap.UpdateDatasetParameters";
- }
- /**
- * @function UpdateDatasetParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.datasourceName = null;
- me.datasetName = null;
- me.isFileCache = null;
- me.prjCoordSys = null;
- me.charset = null;
- me.palette = null;
- me.noValue = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/VectorClipJobsParameter.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class VectorClipJobsParameter
- * @deprecatedclass SuperMap.VectorClipJobsParameter
- * @category iServer ProcessingService VectorClip
- * @classdesc 矢量裁剪分析任务参数类。
- * @param {Object} options - 参数。
- * @param {string} options.datasetName - 数据集名。
- * @param {string} options.datasetOverlay - 裁剪对象数据集。
- * @param {ClipAnalystMode} [options.mode=ClipAnalystMode.CLIP] - 裁剪分析模式。
- * @param {OutputSetting} [options.output] - 输出参数设置。
- * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
- * @usage
- */
- class VectorClipJobsParameter {
- constructor(options) {
- options = options || {};
- /**
- * @member {string} VectorClipJobsParameter.prototype.datasetName
- * @description 数据集名。
- */
- this.datasetName = "";
- /**
- * @member {string} VectorClipJobsParameter.prototype.datasetOverlay
- * @description 裁剪对象数据集。
- */
- this.datasetVectorClip = "";
- /**
- * @member {string} VectorClipJobsParameter.prototype.geometryClip
- * @description 裁剪几何对象。
- */
- this.geometryClip = "";
- /**
- * @member {ClipAnalystMode} [VectorClipJobsParameter.prototype.mode=ClipAnalystMode.CLIP]
- * @description 裁剪分析模式 。
- */
- this.mode = ClipAnalystMode.CLIP;
- /**
- * @member {OutputSetting} VectorClipJobsParameter.prototype.output
- * @description 输出参数设置类。
- */
- this.output = null;
- /**
- * @member {MappingParameters} [VectorClipJobsParameter.prototype.mappingParameters]
- * @description 分析后结果可视化的参数类。
- */
- this.mappingParameters = null;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.VectorClipJobsParameter";
- }
- /**
- * @function VectorClipJobsParameter.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- this.datasetName = null;
- this.datasetVectorClip = null;
- this.geometryClip = null;
- this.mode = null;
- if (this.output instanceof OutputSetting) {
- this.output.destroy();
- this.output = null;
- }
- if (this.mappingParameters instanceof MappingParameters) {
- this.mappingParameters.destroy();
- this.mappingParameters = null;
- }
- }
- /**
- * @function VectorClipJobsParameter.toObject
- * @param {Object} vectorClipJobsParameter - 区域汇总分析服务参数。
- * @param {Object} tempObj - 目标对象。
- * @description 矢量裁剪分析任务对象。
- */
- static toObject(vectorClipJobsParameter, tempObj) {
- for (var name in vectorClipJobsParameter) {
- if (name === "datasetName") {
- tempObj['input'] = tempObj['input'] || {};
- tempObj['input'][name] = vectorClipJobsParameter[name];
- continue;
- }
- if (name === "output"){
- tempObj['output'] = tempObj['output'] || {};
- tempObj['output'] = vectorClipJobsParameter[name];
- continue;
- }
- tempObj['analyst'] = tempObj['analyst'] || {};
- tempObj['analyst'][name] = vectorClipJobsParameter[name];
- if(name === 'mappingParameters'){
- tempObj['analyst'][name] = tempObj['analyst'][name] || {};
- tempObj['analyst']['mappingParameters'] = vectorClipJobsParameter[name];
- }
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/VectorClipJobsService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class VectorClipJobsService
- * @deprecatedclass SuperMap.VectorClipJobsService
- * @category iServer ProcessingService VectorClip
- * @classdesc 矢量裁剪分析服务类
- * @extends {ProcessingServiceBase}
- * @param {string} url -服务地址。
- * @param {Object} options - 可选参数。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class VectorClipJobsService extends ProcessingServiceBase {
- constructor(url, options) {
- super(url, options);
- this.url = Util.urlPathAppend(this.url, 'spatialanalyst/vectorclip');
- this.CLASS_NAME = 'SuperMap.VectorClipJobsService';
- }
- /**
- *@override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function VectorClipJobsService.protitype.getVectorClipJobs
- * @description 获取矢量裁剪分析所有任务
- */
- getVectorClipJobs() {
- super.getJobs(this.url);
- }
- /**
- * @function KernelDensityJobsService.protitype.getVectorClipJob
- * @description 获取指定id的矢量裁剪分析服务
- * @param {string} id - 指定要获取数据的id
- */
- getVectorClipJob(id) {
- super.getJobs(Util.urlPathAppend(this.url, id));
- }
- /**
- * @function VectorClipJobsService.protitype.addVectorClipJob
- * @description 新建矢量裁剪分析服务
- * @param {VectorClipJobsParameter} params - 创建一个空间分析的请求参数。
- * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
- */
- addVectorClipJob(params, seconds) {
- super.addJob(this.url, params, VectorClipJobsParameter, seconds);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/RasterFunctionParameter.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class RasterFunctionParameter
- * @deprecatedclass SuperMap.RasterFunctionParameter
- * @category iServer Map Tile
- * @classdesc iServer 地图服务栅格分析参数基类
- * @param {Object} options - 参数。
- * @param {RasterFunctionType} options.type - 栅格分析方法。
- * @usage
- */
- class RasterFunctionParameter {
- constructor(options) {
- options = options || {};
- /**
- * @member {RasterFunctionType} [RasterFunctionParameter.prototype.type]
- * @description 栅格分析方法。
- */
- this.type = null;
- Util.extend(this, options);
- this.CLASS_NAME = 'SuperMap.RasterFunctionParameter';
- }
- /**
- * @function RasterFunctionParameter.prototype.destroy
- * @description 释放资源,将资源的属性置空。
- */
- destroy() {
- this.type = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/NDVIParameter.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class NDVIParameter
- * @deprecatedclass SuperMap.NDVIParameter
- * @category iServer Map Tile
- * @classdesc 归一化植被指数参数类
- * @param {Object} options - 参数。
- * @param {number} [options.redIndex=0] - 红光谱波段索引。
- * @param {number} [options.nirIndex=1] - 近红外光谱波段索引。
- * @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。仅单波段数据时设定。
- * @extends {RasterFunctionParameter}
- * @usage
- */
- class NDVIParameter extends RasterFunctionParameter {
- constructor(options) {
- super(options);
- /**
- * @member {number} [NDVIParameter.prototype.redIndex=0]
- * @description 红光谱波段索引。
- */
- this.redIndex = 0;
- /**
- * @member {number} [NDVIParameter.prototype.nirIndex=1]
- * @description 近红外光谱波段索引。
- */
- this.nirIndex = 1;
- /**
- * @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"]
- * @description 颜色表。由栅格的中断值和颜色停止之间的映射组成的,如0.3->d9f0a3ff 指的是[0,0.3)显示d9f0a3ff。仅单波段数据时设定。
- */
- this.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';
- /**
- * @member {RasterFunctionType} [NDVIParameter.prototype.type]
- * @description 栅格分析方法。
- */
- this.type = RasterFunctionType.NDVI;
- Util.extend(this, options);
- this.CLASS_NAME = 'SuperMap.NDVIParameter';
- }
- /**
- * @function NDVIParameter.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- this.redIndex = null;
- this.nirIndex = null;
- this.colorMap = null;
- }
- /**
- * @function NDVIParameter.prototype.toJSON
- * @description 将 NDVIParameter 对象转化为 JSON 字符串。
- * @returns {string} 返回转换后的 JSON 字符串。
- */
- toJSON() {
- return {
- redIndex: this.redIndex,
- nirIndex: this.nirIndex,
- colorMap: this.colorMap,
- type: this.type
- };
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/HillshadeParameter.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class HillshadeParameter
- * @deprecatedclass SuperMap.HillshadeParameter
- * @category iServer Map Tile
- * @classdesc 阴影面分析参数类
- * @param {Object} options - 可选参数。
- * @param {number} [options.altitude=45] - 高于地平线的光源高度角。高度角由正度数表示,0 度代表地平线,而 90 度代表头顶正上方。
- * @param {number} [options.azimuth=315] - 光源的方位角。方位角由0到360度之间的正度数表示,以北为基准方向按顺时针进行测量。
- * @param {number} [options.zFactor=1] - 一个表面 z 单位中地面 x,y 单位的数量。z 单位与输入表面的 x,y 单位不同时,可使用 z 因子调整 z 单位的测量单位。计算最终输出表面时,将用 z 因子乘以输入表面的 z 值。
- * z 单位与输入表面的 x,y 单位不同时,可使用 z 因子调整 z 单位的测量单位。计算最终输出表面时,将用 z 因子乘以输入表面的 z 值。
- * 如果 x,y 单位和 z 单位采用相同的测量单位,则 z 因子为 1。这是默认设置。
- * 如果 x,y 单位和 z 单位采用不同的测量单位,则必须将 z 因子设置为适当的因子,否则会得到错误的结果。例如,如果 z 单位是英尺而 x,y 单位是米,则应使用 z 因子 0.3048 将 z 单位从英尺转换为米(1 英尺 = 0.3048 米)。
- * 如果输入栅格位于球面坐标系中(如十进制度球面坐标系),则生成的山体阴影可能看起来很独特。这是因为水平地面单位与高程 z 单位之间的测量值存在差异。由于经度的长度随着纬度而变化,因此需要为该纬度指定一个适当的 z 因子。如果 x,y 单位是十进制度而 Z 单位是米,特定纬度的一些合适的 Z 因子为:
- * Latitude Z-factor
- * 0 0.00000898
- * 10 0.00000912
- * 20 0.00000956
- * 30 0.00001036
- * 40 0.00001171
- * 50 0.00001395
- * 60 0.00001792
- * 70 0.00002619
- * 80 0.00005156
- * @extends {RasterFunctionParameter}
- * @usage
- */
- class HillshadeParameter extends RasterFunctionParameter {
- constructor(options) {
- super(options);
- /**
- * @member {number} [HillshadeParameter.prototype.altitude = 45]
- * @description 高于地平线的光源高度角。高度角由正度数表示,0 度代表地平线,而 90 度代表头顶正上方。
- */
- this.altitude = 45;
- /**
- * @member {number} [HillshadeParameter.prototype.azimuth = 315]
- * @description 光源的方位角。方位角由0到360度之间的正度数表示,以北为基准方向按顺时针进行测量。
- */
- this.azimuth = 315;
- /**
- * @member {number} [HillshadeParameter.prototype.zFactor = 1]
- * @description 一个表面 z 单位中地面 x,y 单位的数量。z 单位与输入表面的 x,y 单位不同时,可使用 z 因子调整 z 单位的测量单位。计算最终输出表面时,将用 z 因子乘以输入表面的 z 值。
- */
- this.zFactor = 1;
- /**
- * @member {RasterFunctionType} HillshadeParameter.prototype.type
- * @description 栅格分析方法。
- */
- this.type = RasterFunctionType.HILLSHADE;
- Util.extend(this, options);
- this.CLASS_NAME = 'SuperMap.HillshadeParameter';
- }
- /**
- * @function HillshadeParameter.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- this.altitude = null;
- this.azimuth = null;
- this.zFactor = null;
- }
- /**
- * @function HillshadeParameter.prototype.toJSON
- * @description 将 HillshadeParameter 对象转化为 JSON 字符串。
- * @returns {string} 返回转换后的 JSON 字符串。
- */
- toJSON() {
- return {
- altitude: this.altitude,
- azimuth: this.azimuth,
- zFactor: this.zFactor,
- type: this.type
- };
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobCustomItems.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class WebPrintingJobCustomItems
- * @deprecatedclass SuperMap.WebPrintingJobCustomItems
- * @classdesc Web 打印图例元素参数类。
- * @version 10.1.0
- * @category iServer WebPrintingJob
- * @param {Object} option - 参数。
- * @param {string} option.name - 图例元素的名称。
- * @param {string} option.picAsUrl - 图例元素 Base64 格式图片。
- * @param {string} [option.picAsBase64] - 图例元素图片的获取地址。如果已填了 url 参数,此参数可不传
- * @usage
- */
- class WebPrintingJobCustomItems {
- constructor(option) {
- /**
- * @member {string} WebPrintingJobCustomItems.prototype.name
- * @description 图例元素的名称。
- */
- this.name = null;
- /**
- * @member {string} [WebPrintingJobCustomItems.prototype.picAsUrl]
- * @description 图例元素 Base64 格式图片。
- */
- this.picAsUrl = null;
- /**
- * @member {string} [WebPrintingJobCustomItems.prototype.picAsBase64]
- * @description 图例元素图片的获取地址。
- */
- this.picAsBase64 = null;
- this.CLASS_NAME = 'SuperMap.WebPrintingJobCustomItems';
- Util.extend(this, option);
- }
- /**
- * @function WebPrintingJobCustomItems.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.name = null;
- me.picAsUrl = null;
- me.picAsBase64 = null;
- }
- /**
- * @function WebPrintingJobCustomItems.prototype.toJSON
- * @description 将 WebPrintingJobCustomItems 对象转化为 JSON 字符串。
- * @returns {string} 转换后的 JSON 字符串。
- */
- toJSON() {
- var params = {
- name: this.name
- };
- if (this.title) {
- params.title = this.title;
- }
- if (this.picAsUrl) {
- params.picAsUrl = this.picAsUrl;
- } else if (this.picAsBase64) {
- params.picAsBase64 = this.picAsBase64.replace(/^data:.+;base64,/, '');
- }
- return Util.toJSON(params);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobImage.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class WebPrintingJobImage
- * @deprecatedclass SuperMap.WebPrintingJobImage
- * @classdesc 表达小地图的静态图片参数类。
- * @version 10.1.0
- * @category iServer WebPrintingJob
- * @param {Object} option - 参数。
- * @param {string} option.picAsUrl - 小地图的图片 url 地址。
- * @param {string} [option.picAsBase64] - 小地图的base64位图片信息。如果已填了 url 参数,此参数可不传
- * @usage
- */
- class WebPrintingJobImage {
- constructor(option) {
- /**
- * @member {string} [WebPrintingJobImage.prototype.picAsUrl]
- * @description 小地图的图片 url 地址。
- */
- this.picAsUrl = null;
- /**
- * @member {string} [WebPrintingJobImage.prototype.picAsBase64]
- * @description 小地图的base64位图片信息。
- */
- this.picAsBase64 = null;
- this.CLASS_NAME = 'SuperMap.WebPrintingJobImage';
- Util.extend(this, option);
- }
- /**
- * @function WebPrintingJobImage.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- this.picAsUrl = null;
- this.picAsBase64 = null;
- }
- /**
- * @function WebPrintingJobImage.prototype.toJSON
- * @description 将 WebPrintingJobImage 对象转化为 JSON 字符串。
- * @returns {string} 转换后的 JSON 字符串。
- */
- toJSON() {
- var params = {};
- if (this.picAsUrl) {
- params.picAsUrl = this.picAsUrl;
- }
- if (this.picAsBase64) {
- params.picAsBase64 = this.picAsBase64.replace(/^data:.+;base64,/, '');
- }
- return Util.toJSON(params);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobLayers.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
-
- /**
- * @class WebPrintingJobLayers
- * @deprecatedclass SuperMap.WebPrintingJobLayers
- * @classdesc 将图例添加到布局的业务图层参数类。
- * @version 10.1.0
- * @category iServer WebPrintingJob
- * @param {Object} option - 参数。
- * @param {string} option.name - 图层 name 的字符串。此 name 必须唯一,并且必须与定义业务图层的 LegendOptions_layers 元素中的图层 name 匹配。
- * @usage
- */
- class WebPrintingJobLayers {
- constructor(option) {
- /**
- * @member {string} WebPrintingJobLayers.prototype.name
- * @description 图层 name。
- */
- this.name = null;
- /**
- * @member {string} WebPrintingJobLayers.prototype.layerType
- * @description 图层 type。
- */
- this.layerType = null;
- /**
- * @member {string} WebPrintingJobLayers.prototype.url
- * @description 图层 url。
- */
- this.url = null;
- this.CLASS_NAME = 'SuperMap.WebPrintingJobLayers';
- Util.extend(this, option);
- }
- /**
- * @function WebPrintingJobLayers.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- this.name = null;
- this.layerType = null;
- this.url = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobLegendOptions.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class WebPrintingJobLegendOptions
- * @deprecatedclass SuperMap.WebPrintingJobLegendOptions
- * @classdesc Web 打印图例参数类。
- * @version 10.1.0
- * @category iServer WebPrintingJob
- * @param {Object} option - 参数。
- * @param {string} [option.title] - 图例名称。
- * @param {string} [option.picAsUrl] - 图例的图片 url 地址。
- * @param {string} [option.picAsBase64] - 图例的 base64 位图片信息。
- * @param {WebPrintingJobLayers} [option.layers] - 图例的布局业务图层参数类。
- * @param {WebPrintingJobCustomItems} [option.customItems] - 自定义图例元素参数类。
- * @usage
- */
- class WebPrintingJobLegendOptions {
- constructor(option) {
- /**
- * @member {string} WebPrintingJobLegendOptions.prototype.title
- * @description 图例名称。
- */
- this.title = null;
- /**
- * @member {string} [WebPrintingJobLegendOptions.prototype.picAsUrl]
- * @description 图例的图片 url 地址。
- */
- this.picAsUrl = null;
- /**
- * @member {string} [WebPrintingJobLegendOptions.prototype.picAsBase64]
- * @description 图例的 base64 位图片信息。
- */
- this.picAsBase64 = null;
- /**
- * @member {WebPrintingJobLayers} [WebPrintingJobLegendOptions.prototype.layers]
- * @description 图例的布局业务图层参数类。
- */
- this.layers = null;
- /**
- * @member {WebPrintingJobCustomItems} [WebPrintingJobLegendOptions.prototype.customItems]
- * @description 自定义图例元素参数类。
- */
- this.customItems = null;
- this.CLASS_NAME = 'SuperMap.WebPrintingJobLegendOptions';
- Util.extend(this, option);
- }
- /**
- * @function WebPrintingJobLegendOptions.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- this.title = null;
- this.picAsUrl = null;
- this.picAsBase64 = null;
- if (this.layers instanceof WebPrintingJobLayers) {
- this.layers.destroy();
- this.layers = null;
- }
- if (this.customItems instanceof WebPrintingJobCustomItems) {
- this.customItems.destroy();
- this.customItems = null;
- }
- }
- /**
- * @function WebPrintingJobLegendOptions.prototype.toJSON
- * @description 将 WebPrintingJobLegendOptions 对象转化为 JSON 字符串。
- * @returns {string} 转换后的 JSON 字符串。
- */
- toJSON() {
- var params = {
- title: this.title || ""
- };
- if (this.picAsUrl) {
- params.picAsUrl = this.picAsUrl;
- } else if (this.picAsBase64) {
- params.picAsBase64 = this.picAsBase64.replace(/^data:.+;base64,/, '');
- } else if (this.customItems) {
- params.customItems = this.customItems;
- }
- return Util.toJSON(params);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobLittleMapOptions.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class WebPrintingJobLittleMapOptions
- * @deprecatedclass SuperMap.WebPrintingJobLittleMapOptions
- * @classdesc Web 打印小地图参数类。
- * @version 10.1.0
- * @category iServer WebPrintingJob
- * @param {Object} option - 参数。
- * @param {GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>} option.center - 小地图的中心点。
- * @param {number} [option.scale] - 小地图的比例尺。
- * @param {Array.<string>} [option.layerNames] - 指定 WebMap中图层名称的列表,用于渲染小地图。
- * @param {WebPrintingJobImage} [option.image] - 表达小地图的静态图类。
- * @param {WebPrintingJobLayers} [option.layers] - 指定 WebMap 中的 layers 图层类。
- * @usage
- */
- class WebPrintingJobLittleMapOptions {
- constructor(option) {
- /**
- * @member {GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>} WebPrintingJobLittleMapOptions.prototype.center
- * @description 小地图的中心点。
- */
- this.center = null;
- /**
- * @member {number} [WebPrintingJobLittleMapOptions.prototype.scale]
- * @description 小地图的比例尺。
- */
- this.scale = null;
- /**
- * @member {Array.<string>} WebPrintingJobLittleMapOptions.prototype.layerNames
- * @description 指定 WebMap中图层名称的列表,用于渲染小地图。
- */
- this.layerNames = null;
- /**
- * @member {WebPrintingJobImage} [WebPrintingJobLittleMapOptions.prototype.image]
- * @description 表达小地图的静态图类。暂不支持
- */
- this.image = null;
- /**
- * @member {WebPrintingJobLayers} [WebPrintingJobLittleMapOptions.prototype.layers]
- * @description 指定 WebMap 中的 layers 图层类。
- */
- this.layers = null;
- this.CLASS_NAME = 'SuperMap.WebPrintingJobLittleMapOptions';
- Util.extend(this, option);
- }
- /**
- * @function WebPrintingJobLittleMapOptions.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- this.center = null;
- this.scale = null;
- this.layerNames = null;
- if (this.image instanceof WebPrintingJobImage) {
- this.image.destroy();
- this.image = null;
- }
- if (this.layers instanceof WebPrintingJobLayers) {
- this.layers.destroy();
- this.layers = null;
- }
- }
- /**
- * @function WebPrintingJobLittleMapOptions.prototype.toJSON
- * @description 将 WebPrintingJobLittleMapOptions 对象转化为 JSON 字符串。
- * @returns {string} 转换后的 JSON 字符串。
- */
- toJSON() {
- var params = {
- scale: this.scale,
- center: this.center
- };
- if (this.layerNames) {
- params.layerNames = this.layerNames;
- } else if (this.layers) {
- params.layers = this.layers;
- }
- if (this.image) {
- params.image = this.image;
- }
- return Util.toJSON(params);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobNorthArrowOptions.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class WebPrintingJobNorthArrowOptions
- * @deprecatedclass SuperMap.WebPrintingJobNorthArrowOptions
- * @classdesc Web 打印地图指北针参数类。
- * @version 10.1.0
- * @category iServer WebPrintingJob
- * @param {Object} option - 参数。
- * @param {string} option.picAsUrl - 指北针的图片 url 地址。
- * @param {string} [option.picAsBase64] - 指北针的base64位图片信息。
- * @usage
- */
- class WebPrintingJobNorthArrowOptions {
- constructor(option) {
- /**
- * @member {string} WebPrintingJobNorthArrowOptions.prototype.picAsUrl
- * @description 指北针的图片 url 地址。
- */
- this.picAsUrl = null;
- /**
- * @member {string} [WebPrintingJobNorthArrowOptions.prototype.picAsBase64]
- * @description 指北针的base64位图片信息。
- */
- this.picAsBase64 = null;
- this.CLASS_NAME = 'SuperMap.WebPrintingJobNorthArrowOptions';
- Util.extend(this, option);
- }
- /**
- * @function WebPrintingJobNorthArrowOptions.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- this.picAsUrl = null;
- this.picAsBase64 = null;
- }
- /**
- * @function WebPrintingJobNorthArrowOptions.prototype.toJSON
- * @description 将 WebPrintingJobNorthArrowOptions 对象转化为 JSON 字符串。
- * @returns {string} 转换后的 JSON 字符串。
- */
- toJSON() {
- var params = {};
- if (this.picAsUrl) {
- params.picAsUrl = this.picAsUrl;
- } else if (this.picAsBase64) {
- params.picAsBase64 = this.picAsBase64.replace(/^data:.+;base64,/, '');
- }
- return Util.toJSON(params);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobScaleBarOptions.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class WebPrintingJobScaleBarOptions
- * @deprecatedclass SuperMap.WebPrintingJobScaleBarOptions
- * @classdesc Web 打印比例尺参数类。
- * @category iServer WebPrintingJob
- * @version 10.1.0
- * @param {Object} option - 参数。
- * @param {string} [option.scaleText] - 比例尺文本信息。例如:1:1000000
- * @param {WebScaleOrientationType} [option.orientation] - 比例尺的方位样式。
- * @param {WebScaleType} [option.type] - 比例尺的样式。
- * @param {number} [option.intervals] - 比例尺条的段数。
- * @param {WebScaleUnit} [option.unit] - 比例尺的单位制。
- * @usage
- */
- class WebPrintingJobScaleBarOptions {
- constructor(option) {
- /**
- * @member {string} WebPrintingJobScaleBarOptions.prototype.scaleText
- * @description 比例尺文本信息。
- */
- this.scaleText = null;
- /**
- * @member {WebScaleOrientationType} [WebPrintingJobScaleBarOptions.prototype.orientation]
- * @description 比例尺的方位样式。
- */
- this.orientation = null;
- /**
- * @member {WebScaleType} [WebPrintingJobScaleBarOptions.prototype.type]
- * @description 比例尺的样式。
- */
- this.type = null;
- /**
- * @member {Object} [WebPrintingJobScaleBarOptions.prototype.intervals]
- * @description 比例尺条的段数。
- */
- this.intervals = null;
- /**
- * @member {WebScaleUnit} [WebPrintingJobScaleBarOptions.prototype.unit]
- * @description 比例尺的单位制。
- */
- this.unit = null;
- this.CLASS_NAME = 'SuperMap.WebPrintingJobScaleBarOptions';
- Util.extend(this, option);
- }
- /**
- * @function WebPrintingJobScaleBarOptions.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- this.scaleText = null;
- this.orientation = null;
- this.type = null;
- this.intervals = null;
- this.unit = null;
- }
- /**
- * @function WebPrintingJobScaleBarOptions.prototype.toJSON
- * @description 将 WebPrintingJobScaleBarOptions 对象转化为 JSON 字符串。
- * @returns {string} 转换后的 JSON 字符串。
- */
- toJSON() {
- var params = {
- scaleText: this.scaleText || "",
- type: this.type || "BAR",
- intervals: this.intervals || "",
- unit: this.unit || "METER"
- };
- if (this.orientation) {
- params.orientation = this.orientation;
- }
- return Util.toJSON(params);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobContent.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class WebPrintingJobContent
- * @deprecatedclass SuperMap.WebPrintingJobContent
- * @classdesc Web 打印内容参数类。
- * @version 10.1.0
- * @category iServer WebPrintingJob
- * @param {Object} option - 参数。
- * @param {string} option.type - Web 打印内容支持的类型。目前支持的类型:WEBMAP
- * @param {string} [option.url] - 待打印的 SuperMap iPortal WebMap 的 url 地址。例如:http://supermapiportal:8190/iportal/web/maps/{mapid}/map.rjson
- * @param {string} [option.token] - 如果待打印的是 SuperMap iPortal 用户私有的 WebMap,需要提供 SuperMap iPortal 用户的 token。
- * @param {WebMapSummaryObject} [option.value] - 传递的是一个符合 SuperMap WebMap 规范的 WebMap 的 JSON 表达,也可以是一个完整的 SuperMap iPortal 数据上图制作的 WebMap 的 json 表达。如果已填了 url 参数,此参数可不传
- * @usage
- */
- class WebPrintingJobContent {
- constructor(option) {
- /**
- * @member {string} WebPrintingJobContent.prototype.type
- * @description Web 打印内容支持的类型。
- */
- this.type = null;
- /**
- * @member {string} [WebPrintingJobContent.prototype.url]
- * @description 待打印的 SuperMap iPortal WebMap 的 url 地址。
- */
- this.url = null;
- /**
- * @member {string} [WebPrintingJobContent.prototype.token]
- * @description 如果待打印的是 SuperMap iPortal 用户私有的 WebMap,需要提供 SuperMap iPortal 用户的 token。
- */
- this.token = null;
- /**
- * @member {WebMapSummaryObject} [WebPrintingJobContent.prototype.value]
- * @description 传递的是一个符合 SuperMap WebMap 规范的 WebMap 的 JSON 表达,也可以是一个完整的 SuperMap iPortal 数据上图制作的 WebMap 的 json 表达。
- */
- this.value = null;
- this.CLASS_NAME = 'SuperMap.WebPrintingJobContent';
- Util.extend(this, option);
- }
- /**
- * @function WebPrintingJobContent.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- this.type = false || "WEBMAP";
- this.url = null;
- this.token = null;
- this.value = null;
- }
- /**
- * @function WebPrintingJobContent.prototype.toJSON
- * @description 将 WebPrintingJobContent 对象转化为 JSON 字符串。
- * @returns {string} 转换后的 JSON 字符串。
- */
- toJSON() {
- var params = {
- type: this.type
- };
- if (this.token) {
- params.token = this.token;
- }
- if (this.url) {
- params.url = this.url;
- } else if (this.value) {
- params.value = this.value;
- }
- return Util.toJSON(params);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobLayoutOptions.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class WebPrintingJobLayoutOptions
- * @deprecatedclass SuperMap.WebPrintingJobLayoutOptions
- * @classdesc Web 打印的布局参数类。
- * @version 10.1.0
- * @category iServer WebPrintingJob
- * @param {Object} option - 参数。
- * @param {string} option.templateName - 布局模板的名称。
- * @param {string} option.title - 地图主标题名称。
- * @param {string} option.subTitle - 地图副标题名称。
- * @param {string} option.author - 作者名称。
- * @param {string} option.copyright - 版权信息。
- * @param {WebPrintingJobLittleMapOptions} option.littleMapOptions - 小地图参数类。
- * @param {WebPrintingJobLegendOptions} option.legendOptions - 图例参数类。
- * @param {WebPrintingJobScaleBarOptions} [option.scaleBarOptions] - 地图比例尺参数类。
- * @param {WebPrintingJobNorthArrowOptions} [option.northArrowOptions] - 地图指北针参数类。
- * @usage
- */
- class WebPrintingJobLayoutOptions {
- constructor(option) {
- /**
- * @member {string} WebPrintingJobLayoutOptions.prototype.templateName
- * @description 布局模板的名称。
- */
- this.templateName = null;
- /**
- * @member {string} WebPrintingJobLayoutOptions.prototype.title
- * @description 地图主标题名称。
- */
- this.title = null;
- /**
- * @member {string} WebPrintingJobLayoutOptions.prototype.subTitle
- * @description 地图副标题名称。
- */
- this.subTitle = null;
- /**
- * @member {string} WebPrintingJobLayoutOptions.prototype.author
- * @description 地图作者名称。
- */
- this.author = null;
- /**
- * @member {string} WebPrintingJobLayoutOptions.prototype.copyright
- * @description 地图版权信息。
- */
- this.copyright = null;
- /**
- * @member {WebPrintingJobScaleBarOptions} [WebPrintingJobLayoutOptions.prototype.scaleBarOptions]
- * @description 地图比例尺参数类。
- */
- this.scaleBarOptions = null;
- /**
- * @member {WebPrintingJobNorthArrowOptions} [WebPrintingJobLayoutOptions.prototype.northArrowOptions]
- * @description 地图指北针参数类。
- */
- this.northArrowOptions = null;
- /**
- * @member {WebPrintingJobLittleMapOptions} WebPrintingJobLayoutOptions.prototype.littleMapOptions
- * @description 小地图参数类。
- */
- this.littleMapOptions = null;
- /**
- * @member {WebPrintingJobLegendOptions} WebPrintingJobLayoutOptions.prototype.legendOptions
- * @description 图例参数类。
- */
- this.legendOptions = null;
- this.CLASS_NAME = 'SuperMap.WebPrintingJobLayoutOptions';
- Util.extend(this, option);
- }
- /**
- * @function WebPrintingJobLayoutOptions.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- this.templateName = null;
- this.title = null;
- this.subTitle = null;
- this.author = null;
- this.copyright = null;
- if (this.scaleBarOptions instanceof WebPrintingJobScaleBarOptions) {
- this.scaleBarOptions.destroy();
- this.scaleBarOptions = null;
- }
- if (this.northArrowOptions instanceof WebPrintingJobNorthArrowOptions) {
- this.northArrowOptions.destroy();
- this.northArrowOptions = null;
- }
- if (this.littleMapOptions instanceof WebPrintingJobLittleMapOptions) {
- this.littleMapOptions.destroy();
- this.littleMapOptions = null;
- }
- if (this.legendOptions instanceof WebPrintingJobLegendOptions) {
- this.legendOptions.destroy();
- this.legendOptions = null;
- }
- }
- /**
- * @function WebPrintingJobLayoutOptions.prototype.toJSON
- * @description 将 WebPrintingJobLayoutOptions 对象转化为 JSON 字符串。
- * @returns {string} 转换后的 JSON 字符串。
- */
- toJSON() {
- var params = {
- templateName: this.templateName,
- title: this.title,
- subTitle: this.subTitle,
- author: this.author,
- copyright: this.copyright
- };
- if (this.scaleBarOptions) {
- params.scaleBarOptions = this.scaleBarOptions;
- }
- if (this.northArrowOptions) {
- params.northArrowOptions = this.northArrowOptions;
- }
- if (this.littleMapOptions) {
- params.littleMapOptions = this.littleMapOptions;
- }
- if (this.legendOptions) {
- params.legendOptions = this.legendOptions;
- }
- return Util.toJSON(params);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobExportOptions.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class WebPrintingJobExportOptions
- * @deprecatedclass SuperMap.WebPrintingJobExportOptions
- * @classdesc Web 打印的输出参数类。
- * @version 10.1.0
- * @category iServer WebPrintingJob
- * @param {Object} option - 参数。
- * @param {WebExportFormatType} option.format - Web 打印输出的格式,目前支持:PNG、PDF。
- * @param {number} [option.dpi=96] - Web 打印输出的分辨率,单位为每英寸点数。默认值为 96 dpi。
- * @param {number} [option.scale] - Web 打印输出的地图比例尺。
- * @param {number} [option.rotation] - Web 打印输出的地图角度。
- * @param {GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>} [option.center] - Web 打印输出的地图中心点。
- * @usage
- */
- class WebPrintingJobExportOptions {
- constructor(option) {
- /**
- * @member {WebExportFormatType} WebPrintingJobExportOptions.prototype.format
- * @description Web 打印输出的格式。
- */
- this.format = null;
- /**
- * @member {number} [WebPrintingJobExportOptions.prototype.dpi=96]
- * @description Web 打印输出的分辨率,单位为每英寸点数。
- */
- this.dpi = 96;
- /**
- * @member {number} [WebPrintingJobExportOptions.prototype.scale]
- * @description Web 打印输出的地图比例尺。
- */
- this.scale = null;
- /**
- * @member {number} [WebPrintingJobExportOptions.prototype.rotation]
- * @description Web 打印输出的地图角度。
- */
- this.rotation = null;
- /**
- * @member {GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>} [WebPrintingJobExportOptions.prototype.center]
- * @description Web 打印输出的地图中心点。
- */
- this.center = null;
- this.CLASS_NAME = 'SuperMap.WebPrintingJobExportOptions';
- Util.extend(this, option);
- }
- /**
- * @function WebPrintingJobExportOptions.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- this.format = null;
- this.dpi = null;
- this.scale = null;
- this.rotation = null;
- this.center = null;
- this.outputSize = null;
- }
- /**
- * @function WebPrintingJobExportOptions.prototype.toJSON
- * @description 将 WebPrintingJobExportOptions 对象转化为 JSON 字符串。
- * @returns {string} 转换后的 JSON 字符串。
- */
- toJSON() {
- var params = {
- format: this.format || "PDF",
- dpi: this.dpi,
- scale: this.scale,
- center: this.center
- };
- if (this.rotation) {
- params.rotation = this.rotation;
- }
- if (this.outputSize) {
- params.outputSize = this.outputSize;
- }
- return Util.toJSON(params);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class WebPrintingJobParameters
- * @deprecatedclass SuperMap.WebPrintingJobParameters
- * @category iServer WebPrintingJob
- * @version 10.1.0
- * @classdesc Web 打印参数类。
- * @param {Object} options - 参数。
- * @param {WebPrintingJobContent} options.content - Web 打印的内容类。
- * @param {WebPrintingJobLayoutOptions} options.layoutOptions - Web 打印的布局类,包含各种布局元素的设置。
- * @param {WebPrintingJobExportOptions} options.exportOptions - Web 打印的输出类,包含 DPI、页面大小等。
- * @usage
- */
- class WebPrintingJobParameters {
- constructor(options) {
- if (!options) {
- return;
- }
- /**
- * @member {WebPrintingJobContent} WebPrintingJobParameters.prototype.content
- * @description Web 打印的内容类。
- */
- this.content = null;
- /**
- * @member {WebPrintingJobLayoutOptions} WebPrintingJobParameters.prototype.layoutOptions
- * @description Web 打印的布局类,包含各种布局元素的设置。
- */
- this.layoutOptions = null;
- /**
- * @member {WebPrintingJobExportOptions} WebPrintingJobParameters.prototype.exportOptions
- * @description Web 打印的输出类,包含 DPI、页面大小等。
- */
- this.exportOptions = null;
- Util.extend(this, options);
- this.CLASS_NAME = 'SuperMap.WebPrintingJobParameters';
- }
- /**
- * @function WebPrintingJobParameters.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- if (this.content instanceof WebPrintingJobContent) {
- this.content.destroy();
- this.content = null;
- }
- if (this.layoutOptions instanceof WebPrintingJobLayoutOptions) {
- this.layoutOptions.destroy();
- this.layoutOptions = null;
- }
- if (this.exportOptions instanceof WebPrintingJobExportOptions) {
- this.exportOptions.destroy();
- this.exportOptions = null;
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class WebPrintingService
- * @deprecatedclass SuperMap.WebPrintingService
- * @category iServer WebPrintingJob
- * @version 10.1.0
- * @classdesc 打印地图服务基类。
- * @extends {CommonServiceBase}
- * @param {string} url - 服务地址。请求打印地图服务的 URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/webprinting/rest/webprinting/v1。
- * @param {Object} options - 参数。
- * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class WebPrintingService extends CommonServiceBase {
- constructor(url, options) {
- super(url, options);
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = 'SuperMap.WebPrintingService';
- if (!this.url) {
- return;
- }
- }
- /**
- * @function WebPrintingService.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function WebPrintingService.prototype.createWebPrintingJob
- * @description 创建 Web 打印任务。
- * @param {WebPrintingJobParameters} params - Web 打印的请求参数。
- */
- createWebPrintingJob(params) {
- if (!params) {
- return;
- }
- if (params.layoutOptions) {
- if (params.layoutOptions.legendOptions) {
- !params.layoutOptions.legendOptions.title && (params.layoutOptions.legendOptions.title = '');
- params.layoutOptions.legendOptions.picAsBase64 =
- params.layoutOptions.legendOptions.picAsBase64 &&
- params.layoutOptions.legendOptions.picAsBase64.replace(/^data:.+;base64,/, '');
- if (
- params.layoutOptions.legendOptions.customItems &&
- params.layoutOptions.legendOptions.customItems.hasOwnProperty('picAsBase64')
- ) {
- params.layoutOptions.legendOptions.customItems.picAsBase64 = params.layoutOptions.legendOptions.customItems.picAsBase64.replace(
- /^data:.+;base64,/,
- ''
- );
- }
- }
- }
- var me = this;
- me.request({
- url: me._processUrl('jobs'),
- method: 'POST',
- data: Util.toJSON(params),
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- /**
- * @function WebPrintingService.prototype.getPrintingJob
- * @description 获取 Web 打印输出文档任务。
- * @param {string} jobId - Web 打印任务 ID
- */
- getPrintingJob(jobId) {
- var me = this;
- var url = me._processUrl(`jobs/${jobId}`);
- me.request({
- url,
- method: 'GET',
- scope: me,
- success: function (result) {
- me.rollingProcess(result, url);
- },
- failure: me.serviceProcessFailed
- });
- }
- /**
- * @function WebPrintingService.prototype.getPrintingJobResult
- * @description 获取 Web 打印任务的输出文档。
- * @param {string} jobId - Web 打印输入文档任务 ID。
- */
- getPrintingJobResult(jobId) {
- var me = this;
- me.request({
- url: me._processUrl(`jobs/${jobId}/result`),
- method: 'GET',
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- /**
- * @function WebPrintingService.prototype.getLayoutTemplates
- * @description 查询 Web 打印服务所有可用的模板信息。
- */
- getLayoutTemplates() {
- var me = this;
- me.request({
- url: me._processUrl('layouts'),
- method: 'GET',
- scope: me,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- /**
- * @function WebPrintingService.prototype.rollingProcess
- * @description 轮询查询 Web 打印任务。
- * @param {Object} result - 服务器返回的结果对象。
- */
- rollingProcess(result, url) {
- var me = this;
- if (!result) {
- return;
- }
- var id = setInterval(function () {
- me.request({
- url,
- method: 'GET',
- scope: me,
- success: function (result) {
- switch (result.status) {
- case 'FINISHED':
- clearInterval(id);
- me.serviceProcessCompleted(result);
- break;
- case 'ERROR':
- clearInterval(id);
- me.serviceProcessFailed(result);
- break;
- case 'RUNNING':
- me.events.triggerEvent('processRunning', result);
- break;
- }
- },
- failure: me.serviceProcessFailed
- });
- }, 1000);
- }
- _processUrl(appendContent) {
- if (appendContent) {
- return Util.urlPathAppend(this.url, appendContent);
- }
- return this.url;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ImageCollectionService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ImageCollectionService
- * @deprecatedclass SuperMap.ImageCollectionService
- * @classdesc 影像集合服务类
- * @version 10.2.0
- * @category iServer Image
- * @param {string} url - 服务地址。例如: http://{ip}:{port}/iserver/{imageservice-imageserviceName}/restjsr/
- * @param {Object} options - 参数。
- * @param {string} options.collectionId 影像集合(Collection)的ID,在一个影像服务中唯一标识影像集合。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @extends {CommonServiceBase}
- * @usage
- */
- class ImageCollectionService_ImageCollectionService extends CommonServiceBase {
- constructor(url, options) {
- super(url, options);
- this.options = options || {};
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = 'SuperMap.ImageCollectionService';
- }
- /**
- * @function ImageCollectionService.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function ImageCollectionService.prototype.getLegend
- * @description 返回当前影像集合的图例信息。默认为服务发布所配置的风格,支持根据风格参数生成新的图例。
- * @param {Object} queryParams query参数
- * @param {ImageRenderingRule} [queryParams.renderingRule] renderingRule 对象,用来指定影像的渲染风格,从而确定图例内容。影像的渲染风格包含拉伸显示方式、颜色表、波段组合以及应用栅格函数进行快速处理等。该参数未设置时,将使用发布服务时所配置的风格。
- */
- getLegend(queryParams) {
- var me = this;
- var pathParams = {
- collectionId: me.options.collectionId
- };
- var path = Util.convertPath('/collections/{collectionId}/legend', pathParams);
- var url = Util.urlPathAppend(me.url, path);
- this.request({
- method: 'GET',
- url,
- params: queryParams,
- scope: this,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- /**
- * @function ImageCollectionService.prototype.getStatistics
- * @description 返回当前影像集合的统计信息。包括文件数量,文件大小等信息。
- */
- getStatistics() {
- var me = this;
- var pathParams = {
- collectionId: me.options.collectionId
- };
- var path = Util.convertPath('/collections/{collectionId}/statistics', pathParams);
- var url = Util.urlPathAppend(me.url, path);
- this.request({
- method: 'GET',
- url,
- scope: this,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- /**
- * @function ImageCollectionService.prototype.getTileInfo
- * @description 返回影像集合所提供的服务瓦片的信息,包括:每层瓦片的分辨率,比例尺等信息,方便前端进行图层叠加。
- */
- getTileInfo() {
- var me = this;
- var pathParams = {
- collectionId: me.options.collectionId
- };
- var path = Util.convertPath('/collections/{collectionId}/tileInfo', pathParams);
- var url = Util.urlPathAppend(me.url, path);
- this.request({
- method: 'GET',
- url,
- scope: this,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- /**
- * @function ImageCollectionService.prototype.deleteItemByID
- * @description 删除影像集合中指定 ID 的 Item,即从影像集合中删除指定的影像。
- * @param {string} featureId Feature 的本地标识符。
- */
- deleteItemByID(featureId) {
- var me = this;
- var pathParams = {
- collectionId: me.options.collectionId,
- featureId: featureId
- };
- var path = Util.convertPath('/collections/{collectionId}/items/{featureId}', pathParams);
- var url = Util.urlPathAppend(me.url, path);
- this.request({
- method: 'DELETE',
- url,
- scope: this,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- /**
- * @function ImageCollectionService.prototype.getItemByID
- * @description 返回指定ID(`collectionId`)的影像集合中的指定ID(`featureId`)的Item对象,即返回影像集合中指定的影像。
- * @param {string} featureId Feature 的本地标识符。
- */
- getItemByID(featureId) {
- var me = this;
- var pathParams = {
- collectionId: me.options.collectionId,
- featureId: featureId
- };
- var path = Util.convertPath('/collections/{collectionId}/items/{featureId}', pathParams);
- var url = Util.urlPathAppend(me.url, path);
- this.request({
- method: 'GET',
- url,
- scope: this,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ImageService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ImageService
- * @deprecatedclass SuperMap.ImageService
- * @classdesc 影像服务类
- * @version 10.2.0
- * @category iServer Image
- * @param {string} url - 服务地址。例如: http://{ip}:{port}/iserver/{imageservice-imageserviceName}/restjsr/
- * @param {Object} options - 可选参数。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @extends {CommonServiceBase}
- * @usage
- */
- class ImageService_ImageService extends CommonServiceBase {
- constructor(url, options) {
- super(url, options);
- this.options = options || {};
- if (options) {
- Util.extend(this, options);
- }
- this.CLASS_NAME = 'SuperMap.ImageService';
- }
- /**
- * @function ImageService.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function ImageService.prototype.getCollections
- * @description 返回当前影像服务中的影像集合列表(Collections)。
- */
- getCollections() {
- var me = this;
- var path = Util.convertPath('/collections');
- var url = Util.urlPathAppend(me.url, path);
- this.request({
- method: 'GET',
- url,
- scope: this,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- /**
- * @function ImageService.prototype.getCollectionByID
- * @description ID值等于`collectionId`参数值的影像集合(Collection)。 ID值用于在服务中唯一标识该影像集合。
- * @param {string} collectionId 影像集合(Collection)的ID,在一个影像服务中唯一标识影像集合。
- */
- getCollectionByID(collectionId) {
- var pathParams = {
- collectionId: collectionId
- };
- var me = this;
- var path = Util.convertPath('/collections/{collectionId}', pathParams);
- var url = Util.urlPathAppend(me.url, path);
- this.request({
- method: 'GET',
- url,
- scope: this,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- /**
- * @function ImageSearchService.prototype.search
- * @description 查询与过滤条件匹配的影像数据。
- * @param {ImageSearchParameter} [imageSearchParameter] 查询参数
- */
- search(imageSearchParameter) {
- var postBody = { ...(imageSearchParameter || {}) };
- var me = this;
- var path = Util.convertPath('/search');
- var url = Util.urlPathAppend(me.url, path);
- this.request({
- method: 'POST',
- url,
- data: postBody,
- scope: this,
- success: me.serviceProcessCompleted,
- failure: me.serviceProcessFailed
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/FieldsFilter.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FieldsFilter
- * @deprecatedclass SuperMap.FieldsFilter
- * @category iServer Data Field
- * @classdesc 指定返回的用于描述 Feature 的字段。
- * @param {Object} options - 可选参数。
- * @param {Array.<string>} [options.include] 对返回的字段内容进行过滤,需保留的字段列表
- * @param {Array.<string>} [options.exclude] 对返回的字段内容进行过滤,需排除的字段列表
- * @usage
- */
- class FieldsFilter {
- constructor(options) {
- /**
- * @description 对返回的字段内容进行过滤,需保留的字段列表
- * @member {Array.<string>} FieldsFilter.prototype.include
- */
- this.include = undefined;
- /**
- * @description 对返回的字段内容进行过滤,需排除的字段列表
- * @member {Array.<string>} FieldsFilter.prototype.exclude
- */
- this.exclude = undefined;
- this.CLASS_NAME = 'SuperMap.FieldsFilter';
- Util.extend(this, options);
- }
- /**
- * @function FieldsFilter.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.include = undefined;
- me.exclude = undefined;
- }
- /**
- * @function FieldsFilter.prototype.constructFromObject
- * @description 目标对象新增该类的可选参数。
- * @param {Object} data 要转换的数据.
- * @param {FieldsFilter} obj 返回的模型.
- * @return {FieldsFilter} 返回结果
- */
- static constructFromObject(data, obj) {
- if (data) {
- obj = obj || new FieldsFilter();
- if (data.hasOwnProperty('include')) {
- obj.include = data.include
- }
- if (data.hasOwnProperty('exclude')) {
- obj.exclude = data.exclude
- }
- }
- return obj;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/Sortby.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class Sortby
- * @deprecatedclass SuperMap.Sortby
- * @classdesc 通过指定字段进行排序的方法类。
- * @category BaseTypes Util
- * @param {Object} options - 参数。
- * @param {string} options.field 属性名称。
- * @param {Sortby.Direction} options.direction 排序规则, 默认升序。
- * @usage
- */
- class Sortby {
- constructor(options) {
- /**
- * @description 属性名称
- * @member {string} Sortby.prototype.field
- */
- this.field = undefined;
- /**
- * @description 排序规则
- * @member {Sortby.Direction} Sortby.prototype.direction
- * @default Sortby.Direction.ASC
- */
- this.direction = Sortby.Direction.ASC;
- this.CLASS_NAME = 'SuperMap.Sortby';
- Util.extend(this, options);
- }
- /**
- * @function Sortby.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.field = undefined;
- me.direction = 'ASC';
- }
- /**
- * @function Sortby.prototype.constructFromObject
- * @description 目标对象新增该类的可选参数。
- * @param {Object} data 要转换的数据。
- * @param {Sortby} obj 返回的模型。
- * @return {Sortby} 返回结果。
- */
- static constructFromObject(data, obj) {
- if (data) {
- obj = obj || new Sortby();
- if (data.hasOwnProperty('field')) {
- obj.field = data.field;
- }
- if (data.hasOwnProperty('direction')) {
- obj.direction = data.direction;
- }
- }
- return obj;
- }
- }
- /**
- * @enum Direction
- * @description 排序的类型枚举。
- * @memberOf Sortby
- * @readonly
- * @type {string}
- */
- Sortby.Direction = {
- ASC: 'ASC',
- DESC: 'DESC'
- };
- ;// CONCATENATED MODULE: ./src/common/iServer/ImageSearchParameter.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ImageSearchParameter
- * @deprecatedclass SuperMap.ImageSearchParameter
- * @classdesc 影像服务查询参数类
- * @category iServer Image
- * @param {Object} options - 可选参数。
- * @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)属性, 由服务器决定是否使用单一的空间几何对象属性,还是使用所有相关的几何对象作为最终的查询空间范围。
- * @param {Array.<string>} [options.collections] 影像集合的ID数组,将在该指定的Collection中搜索Items。
- * @param {Array.<string>} [options.ids] 只返回指定 Item 的 ID 数组中的Item。返回的 Item 的 ID 值数组。 设置了该参数,所有其他过滤器参数(除了next和limit)将被忽略。
- * @param {number} [options.limit] 返回的最大结果数,即响应文档包含的 Item 的数目。
- * @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 属性都包含在查询结果中。
- * @param {Object} [options.query] 定义查询哪些属性,查询运算符将应用于这些属性。运算符包括:eq、neq、gt、lt、gte、lte、startsWith、endsWith、 contains、in。 其中in是Array.<string>类型 例如:{ "SmFileName": { "eq":"B49C001002.tif" }}
- * @param {Array.<Sortby>} [options.sortby] 由包含属性名称和排序规则的对象构成的数组。
- * @usage
- */
- class ImageSearchParameter {
- constructor(options) {
- /**
- * @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)属性, 由服务器决定是否使用单一的空间几何对象属性,还是使用所有相关的几何对象作为最终的查询空间范围。
- * @member {Array.<number>} ImageSearchParameter.prototype.bbox
- */
- this.bbox = undefined;
- /**
- * @description 影像集合的ID数组,将在该指定的Collection中搜索Items。
- * @member {Array.<string>} ImageSearchParameter.prototype.collections
- */
- this.collections = undefined;
- /**
- * @description 返回的 Item 的 ID 值数组。 设置了该参数,所有其他过滤器参数(除了next和limit)将被忽略。
- * @member {Array.<string>} ImageSearchParameter.prototype.ids
- */
- this.ids = undefined;
- /**
- * @description 单页返回的最大结果数。 最小值为1最大值为10000
- * @member {number} ImageSearchParameter.prototype.limit
- */
- this.limit = undefined;
- /**
- * @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 属性都包含在查询结果中。
- * @member {FieldsFilter} ImageSearchParameter.prototype.fields
- */
- this.fields = undefined;
- /**
- * @description 定义查询哪些属性,查询运算符将应用于这些属性。
- * @member {Object} ImageSearchParameter.prototype.query
- */
- this.query = undefined;
- /**
- * @description 由包含属性名称和排序规则的对象构成的数组。
- * @member {Array.<Sortby>} ImageSearchParameter.prototype.sortby
- */
- this.sortby = undefined;
- this.CLASS_NAME = 'SuperMap.ImageSearchParameter';
- Util.extend(this, options);
- }
- /**
- * @function ImageSearchParameter.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.bbox = undefined;
- me.collections = undefined;
- me.ids = undefined;
- me.limit = undefined;
- me.fields = undefined;
- me.query = undefined;
- me.sortby = undefined;
- }
- /**
- * @function ImageSearchParameter.prototype.constructFromObject
- * @description 目标对象新增该类的可选参数。
- * @param {Object} data 要转换的数据.
- * @param {ImageSearchParameter} obj 返回的模型.
- * @return {ImageSearchParameter} 返回结果
- */
- static constructFromObject(data, obj) {
- if (data) {
- obj = obj || new ImageSearchParameter();
- if (data.hasOwnProperty('bbox')) {
- obj.bbox = data.bbox;
- }
- if (data.hasOwnProperty('collections')) {
- obj.collections = data.collections;
- }
- if (data.hasOwnProperty('ids')) {
- obj.ids = data.ids;
- }
- if (data.hasOwnProperty('limit')) {
- obj.limit = data.limit;
- }
- if (data.hasOwnProperty('fields')) {
- obj.fields = (FieldsFilter.constructFromObject && FieldsFilter.constructFromObject(data.fields, {})) || data.fields;
- }
- if (data.hasOwnProperty('query')) {
- obj.query = data.query;
- }
- if (data.hasOwnProperty('sortby')) {
- obj.sortby = data.sortby;
- if (data.sortby) {
- obj.sortby = data.sortby.map((item) => {
- return (Sortby.constructFromObject && Sortby.constructFromObject(item, {})) || item;
- });
- }
- }
- }
- return obj;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ImageStretchOption.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ImageStretchOption
- * @deprecatedclass SuperMap.ImageStretchOption
- * @classdesc 影像拉伸类。
- * @category iServer Image
- * @param {Object} options - 可选参数。
- * @param {ImageStretchOption.StretchType} [options.stretchType] 影像拉伸类型。该属性的值有以下几种情况:NONE,无拉伸;GAUSSIAN,高斯拉伸;PERCENTCLIP,百分比截断拉伸;MINIMUMMAXIMUM,最值拉伸;STANDARDDEVIATION,标准差拉伸。
- * @param {number} [options.stdevCoefficient] 标准差系数。
- * @param {number} [options.gaussianCoefficient] 高斯系数。
- * @param {boolean} [options.useMedianValue] 高斯拉伸时,是否使用中间值,若该属性值为true,表示使用中间值;false,表示使用平均值。
- * @param {number} [options.minPercent] 使用百分比截断拉伸时,排除影像直方图最低值区域的像元,该参数值为这部分像元占总像元百分比。
- * @param {number} [options.maxPercent] 使用百分比截断拉伸时,排除影像直方图最高值区域的像元,该参数值为这部分像元占总像元百分比。
- * @usage
- */
- class ImageStretchOption {
- constructor(options) {
- /**
- * @description 影像拉伸类型。该属性的值有以下几种情况:NONE,无拉伸;GAUSSIAN,高斯拉伸;PERCENTCLIP,百分比截断拉伸;MINIMUMMAXIMUM,最值拉伸;STANDARDDEVIATION,标准差拉伸。
- * @member {ImageStretchOption.StretchType} ImageStretchOption.prototype.stretchType
- */
- this.stretchType = undefined;
- /**
- * @description 标准差系数。
- * @member {number} ImageStretchOption.prototype.stdevCoefficient
- */
- this.stdevCoefficient = undefined;
- /**
- * @description 高斯系数。
- * @member {number} ImageStretchOption.prototype.gaussianCoefficient
- */
- this.gaussianCoefficient = undefined;
- /**
- * @description 高斯拉伸时,是否使用中间值,若该属性值为true,表示使用中间值;false,表示使用平均值。
- * @member {boolean} ImageStretchOption.prototype.useMedianValue
- */
- this.useMedianValue = undefined;
- /**
- * @description 使用百分比截断拉伸时,排除影像直方图最低值区域的像元,该参数值为这部分像元占总像元百分比。
- * @member {number} ImageStretchOption.prototype.minPercent
- */
- this.minPercent = undefined;
- /**
- * @description 使用百分比截断拉伸时,排除影像直方图最高值区域的像元,该参数值为这部分像元占总像元百分比。
- * @member {number} ImageStretchOption.prototype.maxPercent
- */
- this.maxPercent = undefined;
- this.CLASS_NAME = 'SuperMap.ImageStretchOption';
- Util.extend(this, options);
- }
- /**
- * @function ImageStretchOption.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.stretchType = undefined;
- me.stdevCoefficient = undefined;
- me.gaussianCoefficient = undefined;
- me.useMedianValue = undefined;
- me.minPercent = undefined;
- me.maxPercent = undefined;
- }
- /**
- * @function ImageStretchOption.prototype.constructFromObject
- * @description 目标对象新增该类的可选参数。
- * @param {Object} data 要转换的数据.
- * @param {ImageStretchOption} obj 返回的模型.
- * @return {ImageStretchOption} 返回结果
- */
- static constructFromObject(data, obj) {
- if (data) {
- obj = obj || new ImageStretchOption();
- if (data.hasOwnProperty('stretchType')) {
- obj.stretchType = data.stretchType;
- }
- if (data.hasOwnProperty('stdevCoefficient')) {
- obj.stdevCoefficient = data.stdevCoefficient;
- }
- if (data.hasOwnProperty('gaussianCoefficient')) {
- obj.gaussianCoefficient = data.gaussianCoefficient;
- }
- if (data.hasOwnProperty('useMedianValue')) {
- obj.useMedianValue = data.useMedianValue;
- }
- if (data.hasOwnProperty('minPercent')) {
- obj.minPercent = data.minPercent;
- }
- if (data.hasOwnProperty('maxPercent')) {
- obj.maxPercent = data.maxPercent;
- }
- }
- return obj;
- }
- }
- /**
- * @enum StretchType
- * @description 影像拉伸类型枚举。
- * @memberOf ImageStretchOption
- * @readonly
- * @type {string}
- */
- ImageStretchOption.StretchType = {
- NONE: 'NONE',
- GAUSSIAN: 'GAUSSIAN',
- PERCENTCLIP: 'PERCENTCLIP',
- MINIMUMMAXIMUM: 'MINIMUMMAXIMUM',
- STANDARDDEVIATION: 'STANDARDDEVIATION'
- };
- ;// CONCATENATED MODULE: ./src/common/iServer/ImageRenderingRule.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ImageRenderingRule
- * @deprecatedclass SuperMap.ImageRenderingRule
- * @classdesc 定义请求的影像如何进行渲染或者处理,如:影像的拉伸显示方式、颜色表、波段组合以及应用栅格函数进行快速处理等。
- * @category iServer Image
- * @param {Object} options - 可选参数。
- * @param {ImageRenderingRule.DisplayMode} [options.displayMode] 影像显示模式,其中:Composite表示多波段组合显示;Stretched表示单波段拉伸显示。
- * @param {string} [options.displayBands] 影像显示的波段或者波段组合。若影像的显示模式为STRETCHED,该属性指定一个波段的索引号(波段索引号从0开始计数);若影像的显示模式为COMPOSITE,该属性为组合的波段索引号,例如:属性值3,2,1表示采用4波段、3波段、2波段分别对应 R、G、B颜色通道进行组合显示。
- * @param {ImageStretchOption} [options.stretchOption] 影像的拉伸参数。
- * @param {ImageRenderingRule.InterpolationMode} [options.interpolationMode] 影像显示时使用的插值算法。
- * @param {Array.<string>} [options.colorScheme] 影像拉伸显示的颜色方案。颜色方案为RGBA颜色数组。 RGBA是代表Red(红色)Green(绿色)Blue(蓝色)和Alpha的色彩空间。Alpha值可以省略不写,表示完全不透明。Alpha通道表示不透明度参数,若该值为0表示完全透明。 例如:"255,0,0","0,255,0","0,0,255" 表示由红色、绿色、蓝色三种颜色构成的色带。
- * @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"
- * @param {number} [options.brightness] 影像显示的亮度。数值范围为-100到100,增加亮度为正,降低亮度为负。
- * @param {number} [options.contrast] 影像显示的对比度。数值范围为-100到100,增加对比度为正,降低对比度为负。
- * @param {string} [options.noData] 影像的无值。影像为多波段时,通过逗号分隔 R,G,B 颜色通道对应波段的无值。
- * @param {string} [options.noDataColor] 影像的无值的显示颜色,支持RGB颜色,例如:255,0,0(红色),那么无值将以指定的红色显示。
- * @param {boolean} [options.noDataTransparent] 无值是否透明显示,true表示透明显示无值;否则为false。
- * @param {string} [options.backgroundValue] 影像的背景值。影像为多波段时,通过逗号分隔 R,G,B 颜色通道对应波段的背景值。
- * @param {string} [options.backgroundColor] 指定背景值的颜色。支持指定RGB颜色,例如:255,0,0(红色),那么背景值将以指定的红色显示。
- * @param {boolean} [options.backgroundTransparent] 背景值是否透明显示,true表示透明显示背景值;否则为false。
- * @param {Array.<ImageGFHillShade|ImageGFSlope|ImageGFAspect|ImageGFOrtho>} [options.gridFunctions] 栅格函数链。
- * @usage
- */
- class ImageRenderingRule {
- constructor(options) {
- /**
- * @description 影像显示模式,其中:Composite表示多波段组合显示;Stretched表示单波段拉伸显示。
- * @member {ImageRenderingRule.DisplayMode} ImageRenderingRule.prototype.displayMode
- */
- this.displayMode = undefined;
- /**
- * @description 影像显示的波段或者波段组合。该参数为一个数组,数组元素为波段索引号。若影像的显示模式为Stretched,该属性指定一个显示的波段;若影像的显示模式为Composite,该属性为组合的波段索引号,例如:属性值4,3,2表示采用4波段、3波段、2波段分别对应 R、G、B颜色通道进行组合显示。
- * @member {string} ImageRenderingRule.prototype.displayBands
- */
- this.displayBands = undefined;
- /**
- * @description 影像的拉伸参数。
- * @member {ImageStretchOption} ImageRenderingRule.prototype.stretchOption
- */
- this.stretchOption = undefined;
- /**
- * @description 影像显示时使用的插值算法。
- * @member {ImageRenderingRule.InterpolationMode} ImageRenderingRule.prototype.interpolationMode
- */
- this.interpolationMode = undefined;
- /**
- * @description 影像拉伸显示的颜色方案。颜色方案为RGBA颜色数组。 RGBA是代表Red(红色)Green(绿色)Blue(蓝色)和Alpha的色彩空间。Alpha值可以省略不写,表示完全不透明。Alpha通道表示不透明度参数,若该值为0表示完全透明。 例如:"255,0,0","0,255,0","0,0,255" 表示由红色、绿色、蓝色三种颜色构成的色带。
- * @member {Array.<string>} ImageRenderingRule.prototype.colorScheme
- */
- this.colorScheme = undefined;
- /**
- * @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"
- * @member {Array.<string>} ImageRenderingRule.prototype.colorTable
- */
- this.colorTable = undefined;
- /**
- * @description 影像显示的亮度。数值范围为-100到100,增加亮度为正,降低亮度为负。
- * @member {number} ImageRenderingRule.prototype.brightness
- */
- this.brightness = undefined;
- /**
- * @description 影像显示的对比度。数值范围为-100到100,增加对比度为正,降低对比度为负。
- * @member {number} ImageRenderingRule.prototype.contrast
- */
- this.contrast = undefined;
- /**
- * @description 影像的无值。影像为多波段时,通过逗号分隔 R,G,B 颜色通道对应波段的无值。
- * @member {string} ImageRenderingRule.prototype.noData
- */
- this.noData = undefined;
- /**
- * @description 影像的无值的显示颜色,支持RGB颜色,例如:255,0,0(红色),那么无值将以指定的红色显示。
- * @member {string} ImageRenderingRule.prototype.noDataColor
- */
- this.noDataColor = undefined;
- /**
- * @description 无值是否透明显示,true表示透明显示无值;否则为false。
- * @member {boolean} ImageRenderingRule.prototype.noDataTransparent
- */
- this.noDataTransparent = undefined;
- /**
- * @description 影像的背景值。影像为多波段时,通过逗号分隔 R,G,B 颜色通道对应波段的背景值。
- * @member {string} ImageRenderingRule.prototype.backgroundValue
- */
- this.backgroundValue = undefined;
- /**
- * @description 指定背景值的颜色。支持指定RGB颜色,例如:255,0,0(红色),那么背景值将以指定的红色显示。
- * @member {string} ImageRenderingRule.prototype.backgroundColor
- */
- this.backgroundColor = undefined;
- /**
- * @description 背景值是否透明显示,true表示透明显示背景值;否则为false。
- * @member {boolean} ImageRenderingRule.prototype.backgroundTransparent
- */
- this.backgroundTransparent = undefined;
- /**
- * @description 栅格函数选项,通过应用栅格函数,可以对影像进行快速显示处理。
- * @member {Array.<ImageGFHillShade|ImageGFSlope|ImageGFAspect|ImageGFOrtho>} ImageRenderingRule.prototype.gridFunctions
- */
- this.gridFunctions = undefined;
- this.CLASS_NAME = 'SuperMap.ImageRenderingRule';
- Util.extend(this, options);
- }
- /**
- * @function ImageRenderingRule.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.displayMode = undefined;
- me.displayBands = undefined;
- me.stretchOption = undefined;
- me.interpolationMode = undefined;
- me.colorScheme = undefined;
- me.colorTable = undefined;
- me.brightness = undefined;
- me.contrast = undefined;
- me.noData = undefined;
- me.noDataColor = undefined;
- me.noDataTransparent = undefined;
- me.backgroundValue = undefined;
- me.backgroundColor = undefined;
- me.backgroundTransparent = undefined;
- me.gridFuncOptions = undefined;
- }
- /**
- * @function ImageRenderingRule.prototype.constructFromObject
- * @description 目标对象新增该类的可选参数。
- * @param {Object} data 要转换的数据.
- * @param {ImageRenderingRule} obj 返回的模型.
- * @return {ImageRenderingRule} 返回结果
- */
- static constructFromObject(data, obj) {
- if (data) {
- obj = obj || new ImageRenderingRule();
- if (data.hasOwnProperty('displayMode')) {
- obj.displayMode = data.displayMode;
- }
- if (data.hasOwnProperty('displayBands')) {
- obj.displayBands = data.displayBands;
- }
- if (data.hasOwnProperty('stretchOption')) {
- obj.stretchOption =
- (ImageStretchOption.constructFromObject && ImageStretchOption.constructFromObject(data.stretchOption, {})) ||
- data.stretchOption;
- }
- if (data.hasOwnProperty('interpolationMode')) {
- obj.interpolationMode = data.interpolationMode;
- }
- if (data.hasOwnProperty('colorScheme')) {
- obj.colorScheme = data.colorScheme;
- }
- if (data.hasOwnProperty('colorTable')) {
- obj.colorTable = data.colorTable;
- }
- if (data.hasOwnProperty('brightness')) {
- obj.brightness = data.brightness;
- }
- if (data.hasOwnProperty('contrast')) {
- obj.contrast = data.contrast;
- }
- if (data.hasOwnProperty('noData')) {
- obj.noData = data.noData;
- }
- if (data.hasOwnProperty('noDataColor')) {
- obj.noDataColor = data.noDataColor;
- }
- if (data.hasOwnProperty('backgroundValue')) {
- obj.backgroundValue = data.backgroundValue;
- }
- if (data.hasOwnProperty('noDataTransparent')) {
- obj.noDataTransparent = data.noDataTransparent;
- }
- if (data.hasOwnProperty('backgroundColor')) {
- obj.backgroundColor = data.backgroundColor;
- }
- if (data.hasOwnProperty('backgroundTransparent')) {
- obj.backgroundTransparent = data.backgroundTransparent;
- }
- if (data.hasOwnProperty('gridFunctions')) {
- obj.gridFunctions = data.gridFunctions;
- }
- }
- return obj;
- }
- }
- /**
- * @enum DisplayMode
- * @description 影像显示模式。
- * @memberOf ImageRenderingRule
- * @readonly
- * @type {string}
- */
- ImageRenderingRule.DisplayMode = {
- COMPOSITE: 'COMPOSITE',
- STRETCHED: 'Stretched'
- };
- /**
- * @enum InterpolationMode
- * @description 影像显示时使用的插值算法枚举。
- * @memberOf ImageRenderingRule
- * @readonly
- * @type {string}
- */
- ImageRenderingRule.InterpolationMode = {
- NEARESTNEIGHBOR: 'NEARESTNEIGHBOR',
- HIGHQUALITYBILINEAR: 'HIGHQUALITYBILINEAR',
- DEFAULT: 'DEFAULT'
- };
- ;// CONCATENATED MODULE: ./src/common/iServer/ImageGFHillShade.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ImageGFHillShade
- * @deprecatedclass SuperMap.ImageGFHillShade
- * @classdesc 栅格函数对象:对DEM数据生成三维晕渲图。
- * @category iServer Image
- * @param {Object} options - 可选参数。
- * @param {string} [options.girdFuncName='GFHillShade'] 栅格函数名称,参数值为:GFHillShade。
- * @param {number} [options.Azimuth = 315] 光源方位角。用于确定光源的方向,是从光源所在位置的正北方向线起,依顺时针方向到光源与目标方向线的夹角,范围为 0-360 度,以正北方向为 0 度,依顺时针方向递增。默认值为:315。
- * @param {number} [options.Altitude = 45] 光源高度角。用于确定光源照射的倾斜角度,是光源与目标的方向线与水平面间的夹角,范围为 0-90 度。当光源高度角为 90 度时,光源正射地表。默认值为:45。
- * @param {number} [options.ZFactor = 1] 高程缩放系数。如果设置为 1.0,表示不缩放。默认值为:1。
- * @usage
- */
- class ImageGFHillShade {
- constructor(options) {
- /**
- * @description 栅格函数名称,参数值为:GFHillShade。
- * @member {string} ImageGFHillShade.prototype.girdFuncName
- * @default 'GFHillShade'
- */
- this.girdFuncName = 'GFHillShade';
- /**
- * @description 光源方位角。用于确定光源的方向,是从光源所在位置的正北方向线起,依顺时针方向到光源与目标方向线的夹角,范围为 0-360 度,以正北方向为 0 度,依顺时针方向递增。默认值为:315。
- * @member {number} ImageGFHillShade.prototype.Azimuth
- */
- this.Azimuth = 315;
- /**
- * @description 光源高度角。用于确定光源照射的倾斜角度,是光源与目标的方向线与水平面间的夹角,范围为 0-90 度。当光源高度角为 90 度时,光源正射地表。默认值为:45。
- * @member {number} ImageGFHillShade.prototype.Altitude
- */
- this.Altitude = 45;
- /**
- * @description 高程缩放系数。如果设置为 1.0,表示不缩放。默认值为:1。
- * @member {number} ImageGFHillShade.prototype.ZFactor
- */
- this.ZFactor = 1;
- this.CLASS_NAME = 'SuperMap.ImageGFHillShade';
- Util.extend(this, options);
- }
- /**
- * @function ImageGFHillShade.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.girdFuncName = 'GFHillShade';
- me.Azimuth = 315;
- me.Altitude = 45;
- me.ZFactor = 1;
- }
- /**
- * @function ImageGFHillShade.prototype.constructFromObject
- * @description 目标对象新增该类的可选参数。
- * @param {Object} data 要转换的数据.
- * @param {ImageGFHillShade} obj 返回的模型.
- * @return {ImageGFHillShade} 返回结果
- */
- static constructFromObject(data, obj) {
- if (data) {
- obj = obj || new ImageGFHillShade();
- if (data.hasOwnProperty('girdFuncName')) {
- obj.girdFuncName = data.girdFuncName
- }
- if (data.hasOwnProperty('Azimuth')) {
- obj.Azimuth = data.Azimuth
- }
- if (data.hasOwnProperty('Altitude')) {
- obj.Altitude = data.Altitude
- }
- if (data.hasOwnProperty('ZFactor')) {
- obj.ZFactor = data.ZFactor
- }
- }
- return obj;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ImageGFAspect.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ImageGFAspect
- * @deprecatedclass SuperMap.ImageGFAspect
- * @classdesc 栅格函数对象:对DEM数据生成坡向渲图。
- * @category iServer Image
- * @param {Object} options -可选参数。
- * @param {string} [options.girdFuncName='GFAspect'] 栅格函数名称,参数值为:GFAspect。
- * @param {number} [options.Azimuth] 光源方位角,固定为360度。
- * @usage
- */
- class ImageGFAspect {
- constructor(options) {
- /**
- * @description 栅格函数名称,参数值为:GFAspect。
- * @member {string} ImageGFAspect.prototype.girdFuncName
- * @default 'GFAspect'
- */
- this.girdFuncName = 'GFAspect';
- /**
- * @description 光源方位角,固定为360度。
- * @member {number} ImageGFAspect.prototype.Azimuth
- */
- this.Azimuth = undefined;
- this.CLASS_NAME = 'SuperMap.ImageGFAspect';
- Util.extend(this, options);
- }
- /**
- * @function ImageGFAspect.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.girdFuncName = 'GFAspect';
- me.Azimuth = undefined;
- }
- /**
- * @function ImageGFAspect.prototype.constructFromObject
- * @description 目标对象新增该类的可选参数。
- * @param {Object} data 要转换的数据.
- * @param {ImageGFAspect} obj 返回的模型.
- * @return {ImageGFAspect} 返回结果
- */
- static constructFromObject(data, obj) {
- if (data) {
- obj = obj || new ImageGFAspect();
- if (data.hasOwnProperty('girdFuncName')) {
- obj.girdFuncName = data.girdFuncName
- }
- if (data.hasOwnProperty('Azimuth')) {
- obj.Azimuth = data.Azimuth
- }
- }
- return obj;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ImageGFOrtho.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ImageGFOrtho
- * @deprecatedclass SuperMap.ImageGFOrtho
- * @classdesc 栅格函数对象:对DEM数据生成三维晕渲图。该栅格函数不需要输入参数,采用系统默认设置。
- * @category iServer Image
- * @param {Object} options - 可选参数。
- * @param {string} [options.girdFuncName='GFOrtho'] 栅格函数名称,参数值为:GFOrtho。
- * @usage
- */
- class ImageGFOrtho {
- constructor(options) {
- /**
- * @description 栅格函数名称,参数值为:GFOrtho。
- * @member {string} ImageGFOrtho.prototype.girdFuncName
- * @default 'GFOrtho'
- */
- this.girdFuncName = 'GFOrtho';
- this.CLASS_NAME = 'SuperMap.ImageGFOrtho';
- Util.extend(this, options);
- }
- /**
- * @function ImageGFOrtho.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.girdFuncName = 'GFOrtho';
- }
- /**
- * @function ImageGFOrtho.prototype.constructFromObject
- * @description 目标对象新增该类的可选参数。
- * @param {Object} data 要转换的数据.
- * @param {ImageGFOrtho} obj 返回的模型.
- * @return {ImageGFOrtho} 返回结果
- */
- static constructFromObject(data, obj) {
- if (data) {
- obj = obj || new ImageGFOrtho();
- if (data.hasOwnProperty('girdFuncName')) {
- obj.girdFuncName = data.girdFuncName
- }
- }
- return obj;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/ImageGFSlope.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ImageGFSlope
- * @deprecatedclass SuperMap.ImageGFSlope
- * @classdesc 栅格函数对象:对DEM数据生成坡度图。
- * @category iServer Image
- * @param {Object} options - 可选参数。
- * @param {string} [options.girdFuncName='GFSlope'] 栅格函数名称,参数值为:GFSlope。
- * @param {number} [options.Altitude = 45] 光源高度角。用于确定光源照射的倾斜角度,是光源与目标的方向线与水平面间的夹角,范围为 0-90 度。当光源高度角为 90 度时,光源正射地表。默认值为:45。
- * @param {number} [options.ZFactor = 1] 高程缩放系数。如果设置为 1.0,表示不缩放。默认值为:1。
- * @usage
- */
- class ImageGFSlope {
- constructor(options) {
- /**
- * @description 栅格函数名称,参数值为:GFSlope。
- * @member {string} ImageGFSlope.prototype.girdFuncName
- * @default 'GFSlope'
- */
- this.girdFuncName = 'GFSlope';
- /**
- * @description 光源高度角。用于确定光源照射的倾斜角度,是光源与目标的方向线与水平面间的夹角,范围为 0-90 度。当光源高度角为 90 度时,光源正射地表。默认值为:45。
- * @member {number} ImageGFSlope.prototype.Altitude
- */
- this.Altitude = 45;
- /**
- * @description 高程缩放系数。如果设置为 1.0,表示不缩放。默认值为:1。
- * @member {number} ImageGFSlope.prototype.ZFactor
- */
- this.ZFactor = 1;
- this.CLASS_NAME = 'SuperMap.ImageGFSlope';
- Util.extend(this, options);
- }
- /**
- * @function ImageGFSlope.prototype.destroy
- * @description 释放资源,将引用资源的属性置空。
- */
- destroy() {
- var me = this;
- me.girdFuncName = 'GFSlope';
- me.Altitude = 45;
- me.ZFactor = 1;
- }
- /**
- * @function ImageGFSlope.prototype.constructFromObject
- * @description 目标对象新增该类的可选参数。
- * @param {Object} data 要转换的数据.
- * @param {ImageGFSlope} obj 返回的模型.
- * @return {ImageGFSlope} 返回结果
- */
- static constructFromObject(data, obj) {
- if (data) {
- obj = obj || new ImageGFSlope();
- if (data.hasOwnProperty('girdFuncName')) {
- obj.girdFuncName = data.girdFuncName
- }
- if (data.hasOwnProperty('Altitude')) {
- obj.Altitude = data.Altitude
- }
- if (data.hasOwnProperty('ZFactor')) {
- obj.ZFactor = data.ZFactor
- }
- }
- return obj;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/iServer/index.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- ;// CONCATENATED MODULE: ./src/common/online/OnlineResources.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @enum ServiceStatus
- * @category BaseTypes Constant
- * @description 服务发布状态。
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.ServiceStatus.DOES_NOT_INVOLVE;
- *
- * </script>
- * // ES6 Import
- * import { ServiceStatus } from '{npm}';
- *
- * const result = ServiceStatus.DOES_NOT_INVOLVE;
- * ```
- */
- var ServiceStatus = {
- /** 不涉及,不可发布。 */
- DOES_NOT_INVOLVE: "DOES_NOT_INVOLVE",
- /** 发布失败。 */
- PUBLISH_FAILED: "PUBLISH_FAILED",
- /** 已发布。 */
- PUBLISHED: "PUBLISHED",
- /** 正在发布。 */
- PUBLISHING: "PUBLISHING",
- /** 未发布。 */
- UNPUBLISHED: "UNPUBLISHED",
- /** 取消服务失败。 */
- UNPUBLISHED_FAILED: "UNPUBLISHED_FAILED"
- };
- /**
- * @enum DataItemOrderBy
- * @category BaseTypes Constant
- * @description 数据排序字段。
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.DataItemOrderBy.FILENAME;
- *
- * </script>
- * // ES6 Import
- * import { DataItemOrderBy } from '{npm}';
- *
- * const result = DataItemOrderBy.FILENAME;
- * ```
- */
- var DataItemOrderBy = {
- /** FILENAME */
- FILENAME: "FILENAME",
- /** ID */
- ID: "ID",
- /** LASTMODIFIEDTIME */
- LASTMODIFIEDTIME: "LASTMODIFIEDTIME",
- /** NICKNAME */
- NICKNAME: "NICKNAME",
- /** SERVICESTATUS */
- SERVICESTATUS: "SERVICESTATUS",
- /** SIZE */
- SIZE: "SIZE",
- /** STATUS */
- STATUS: "STATUS",
- /** TYPE */
- TYPE: "TYPE",
- /** UPDATETIME */
- UPDATETIME: "UPDATETIME",
- /** USERNAME */
- USERNAME: "USERNAME"
- };
- /**
- * @enum FilterField {number}
- * @category BaseTypes Constant
- * @description 关键字查询时的过滤字段。
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.FilterField.LINKPAGE;
- *
- * </script>
- * // ES6 Import
- * import { FilterField } from '{npm}';
- *
- * const result = FilterField.LINKPAGE;
- * ```
- */
- var FilterField = {
- /** LINKPAGE */
- LINKPAGE: "LINKPAGE",
- /** MAPTITLE */
- MAPTITLE: "MAPTITLE",
- /** NICKNAME */
- NICKNAME: "NICKNAME",
- /** RESTITLE */
- RESTITLE: "RESTITLE",
- /** USERNAME */
- USERNAME: "USERNAME"
- };
- ;// CONCATENATED MODULE: ./src/common/online/OnlineServiceBase.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class OnlineServiceBase
- * @deprecatedclass SuperMap.OnlineServiceBase
- * @classdesc Online 服务基类(使用 key 作为权限限制的类需要实现此类)。
- * @category iPortal/Online Core
- * @param {Object} options - 可选参数。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- class OnlineServiceBase {
- constructor(options) {
- options = options || {};
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.OnlineServiceBase";
- }
- /**
- * @function OnlineServiceBase.prototype.request
- * @description 请求 online 服务
- * @param {string} [method='GET'] - 请求方式, 'GET', 'PUT', 'POST', 'DELETE'。
- * @param {string} url - 服务地址。
- * @param {Object} param - URL 查询参数。
- * @param {Object} [requestOptions] - http 请求参数, 比如请求头,超时时间等。
- * @returns {Promise} 包含请求结果的 Promise 对象。
- */
- request(method, url, param, requestOptions = {}) {
- url = SecurityManager.appendCredential(url);
- requestOptions['crossOrigin'] = this.options.crossOrigin;
- requestOptions['headers'] = this.options.headers;
- return FetchRequest.commit(method, url, param, requestOptions).then(function(response) {
- return response.json();
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/online/OnlineData.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class OnlineData
- * @deprecatedclass SuperMap.OnlineData
- * @classdesc Online myData 服务。
- * @category iPortal/Online Resources Data
- * @param {string} serviceRootUrl - 服务地址。
- * @param {Object} options - 可选参数。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- * @extends OnlineServiceBase
- */
- class OnlineData extends OnlineServiceBase {
- //TODO 目前并没有对接服务支持的所有操作,日后需要补充完整
- constructor(serviceRootUrl, options) {
- super(serviceRootUrl);
- options = options || {};
- //MD5
- this.MD5 = null;
- //文件类型。
- this.type = null;
- //数据上传者名称。
- this.userName = null;
- //文件名称。
- this.fileName = null;
- //文件大小,单位为 B 。
- this.size = null;
- //服务发布状态。
- this.serviceStatus = null;
- //服务 id 。
- this.serviceId = null;
- //数据项 id 。
- this.id = null;
- //最后修改时间。
- this.lastModfiedTime = null;
- //文件状态。
- this.status = null;
- //数据文件存储 id 。
- this.storageId = null;
- //数据的发布信息。
- this.publishInfo = null;
- //数据的权限信息。
- this.authorizeSetting = null;
- //用户的昵称。
- this.nickname = null;
- //数据的标签。
- this.tags = [];
- //数据的描述信息。
- this.description = null;
- //数据发布的服务信息集合。
- this.dataItemServices = null;
- //数据坐标类型。
- this.coordType = null;
- //数据审核信息
- this.dataCheckResult = null;
- //数据元数据信息
- this.dataMetaInfo = null;
- //数据的缩略图路径。
- this.thumbnail = null;
- Util.extend(this, options);
- if (this.id) {
- this.serviceUrl = serviceRootUrl + "/" + this.id;
- }
- this.CLASS_NAME = "SuperMap.OnlineData";
- }
- /**
- * @function OnlineData.prototype.load
- * @description 通过 URL 请求获取该服务完整信息。
- * @returns {Promise} 不包含请求结果的 Promise 对象,请求返回结果自动填充到该类属性中。
- */
- load() {
- if (!this.serviceUrl) {
- return;
- }
- var me = this;
- return me.request("GET", this.serviceUrl).then(function (result) {
- Util.extend(me, result);
- });
- }
- /**
- * @function OnlineData.prototype.getPublishedServices
- * @description 获取数据发布的所有服务。
- * @returns {Object} 数据发布的所有服务。
- */
- getPublishedServices() {
- return this.dataItemServices;
- }
- /**
- * @function OnlineData.prototype.getAuthorizeSetting
- * @description 获取数据的权限信息。
- * @returns {Object} 权限信息。
- */
- getAuthorizeSetting() {
- return this.authorizeSetting;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/online/Online.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class Online
- * @deprecatedclass SuperMap.Online
- * @classdesc 对接 SuperMap Online 所有基础服务。
- * @category iPortal/Online Resources
- * @example
- * var online=new Online();
- * var services = online.queryDatas(param);
- * service.then(function(services){
- * var service= services[0];
- * service.updateDataInfo();
- * })
- * @usage
- */
- class Online {
- //TODO 目前并没有对接Online的所有操作,需要补充完整
- //所有查询返回的是一个Promise,在外部使用的时候通过Promise的then方法获取异步结果
- constructor() {
- this.rootUrl = "https://www.supermapol.com";
- this.webUrl = this.rootUrl + "/web";
- var mContentUrl = this.webUrl + "/mycontent";
- this.mDatasUrl = mContentUrl + "/datas";
- this.CLASS_NAME = "SuperMap.Online";
- }
- /**
- * @function Online.prototype.load
- * @description 加载 online,验证 online 是否可用。
- * @returns {Promise} 包含网络请求结果的 Promise 对象。
- */
- load() {
- return FetchRequest.get(this.rootUrl).then(function (response) {
- return response;
- });
- }
- /**
- * @function Online.prototype.login
- * @description 登录Online
- */
- login() {
- SecurityManager.loginOnline(this.rootUrl, true);
- }
- /**
- * @function Online.prototype.queryDatas
- * @description 查询 Online “我的内容” 下 “我的数据” 服务(需要登录状态获取),并返回可操作的服务对象。
- * @param {OnlineQueryDatasParameter} parameter - myDatas 服务资源查询参数。
- * @returns {Promise} 包含所有数据服务信息的 Promise 对象。
- */
- queryDatas(parameter) {
- var me = this, url = me.mDatasUrl;
- if (parameter) {
- parameter = parameter.toJSON();
- }
- return FetchRequest.get(url, parameter).then(function (json) {
- if (!json || !json.content || json.content.length < 1) {
- return;
- }
- var services = [], contents = json.content, len = contents.length;
- for (var i = 0; i < len; i++) {
- var content = contents[i];
- var service = new OnlineData(me.mDatasUrl, content);
- services.push(service);
- }
- return services;
- });
- }
- }
- ;// CONCATENATED MODULE: ./src/common/online/OnlineQueryDatasParameter.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class OnlineQueryDatasParameter
- * @deprecatedclass SuperMap.OnlineQueryDatasParameter
- * @classdesc myDatas 服务资源查询参数。
- * @category iPortal/Online Resources Data
- * @param {Object} options - 参数。
- * @usage
- */
- class OnlineQueryDatasParameter {
- constructor(options) {
- options = options || {};
- /**
- * @member {Array.<string>} OnlineQueryDatasParameter.prototype.userNames
- * @description 数据作者名。可以根据数据作者名查询,默认查询全部。
- */
- this.userNames = null;
- /**
- * @member {Array.<Object>} OnlineQueryDatasParameter.prototype.types
- * @description 数据类型。
- */
- this.types = null;
- /**
- * @member {string} OnlineQueryDatasParameter.prototype.fileName
- * @description 文件名称。
- */
- this.fileName = null;
- /**
- * @member {string} OnlineQueryDatasParameter.prototype.serviceStatuses
- * @description 服务发布状态。
- */
- this.serviceStatuses = null;
- /**
- * @member {string} OnlineQueryDatasParameter.prototype.serviceId
- * @description 服务 ID。
- */
- this.serviceId = null;
- /**
- * @member {Array.<number>} OnlineQueryDatasParameter.prototype.ids
- * @description 由数据项 ID 组成的整型数组。
- */
- this.ids = null;
- /**
- * @member {Array.<string>} OnlineQueryDatasParameter.prototype.keywords
- * @description 关键字。
- */
- this.keywords = null;
- /**
- * @member {string} OnlineQueryDatasParameter.prototype.orderBy
- * @description 排序字段。
- */
- this.orderBy = null;
- /**
- * @member {Array.<string>} OnlineQueryDatasParameter.prototype.tags
- * @description 数据的标签。
- */
- this.tags = null;
- /**
- * @member {Array.<string>} OnlineQueryDatasParameter.prototype.filterFields
- * @description 用于关键字查询时的过滤字段。
- */
- this.filterFields = null;
- Util.extend(this, options)
- this.CLASS_NAME = "SuperMap.OnlineQueryDatasParameter";
- }
- /**
- * @function OnlineQueryDatasParameter.prototype.toJSON
- * @description 返回对应的 JSON 对象。
- * @returns {Object} 对应的 JSON 对象。
- */
- toJSON() {
- var me = this;
- var jsonObj = {
- "types": me.types,
- "fileName": me.fileName,
- "serviceStatuses": me.serviceStatuses,
- "serviceId": me.serviceId,
- "ids": me.ids,
- "keywords": me.keywords,
- "orderBy": me.orderBy,
- "tags": me.tags,
- "filterFields": me.filterFields
- };
- for (var key in jsonObj) {
- if (jsonObj[key] == null) {
- delete jsonObj[key]
- }
- }
- return jsonObj;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/online/index.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- ;// CONCATENATED MODULE: ./src/common/security/KeyServiceParameter.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class KeyServiceParameter
- * @deprecatedclass SuperMap.KeyServiceParameter
- * @classdesc key申请参数
- * @category Security
- * @param {Object} options - 参数。
- * @param {string} options.name - 申请服务名称。
- * @param {number} options.serviceIds - 服务 ID。
- * @param {ClientType} [options.clientType=ClientType.SERVER] - 服务端类型。
- * @param {number} options.limitation - 有效期
- * @usage
- */
- class KeyServiceParameter {
- constructor(options) {
- this.name = null;
- this.serviceIds = null;
- this.clientType = ClientType.SERVER;
- this.limitation = null;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.KeyServiceParameter";
- }
- /**
- * @function KeyServiceParameter.prototype.toJSON
- * @description 转换成 JSON 对象
- * @returns {Object} 参数的 JSON 对象
- */
- toJSON() {
- return {
- name: this.name,
- serviceIds: this.serviceIds,
- clientType: this.clientType,
- limitation: this.limitation
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/security/ServerInfo.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ServerInfo
- * @deprecatedclass SuperMap.ServerInfo
- * @classdesc 服务器信息(安全相关),包含服务器类型,服务地址,token服务地址等
- * @category Security
- * @param {string} type - 服务器类型
- * @param {Object} options - 参数。
- * @param {string} options.server - 服务器地址,如:http://supermapiserver:8090/iserver
- * @param {string} [options.tokenServiceUrl] - 如:http://supermapiserver:8090/iserver/services/security/tokens.json
- * @param {string} [options.keyServiceUrl] - 如:http://supermapiserver:8092/web/mycontent/keys/register.json
- * @usage
- */
- class ServerInfo {
- constructor(type, options) {
- /**
- * @member {ServerType} ServerInfo.prototype.type
- * @description 服务器类型
- */
- this.type = type;
- /**
- * @member {string} ServerInfo.prototype.server
- * @description 服务器地址
- */
- this.server = null;
- /**
- * @member {string} [ServerInfo.prototype.tokenServiceUrl]
- * @description 如:http://supermapiserver:8090/iserver/services/security/tokens.json
- */
- this.tokenServiceUrl = null;
- /**
- * @member {string} [ServerInfo.prototype.keyServiceUrl]
- * @description 如:http://supermapiserver:8092/web/mycontent/keys/register.json
- */
- this.keyServiceUrl = null;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.ServerInfo";
- this.type = this.type || ServerType.ISERVER;
- if (!this.server) {
- console.error('server url require is not undefined')
- }
- // var patten = /http:\/\/([^\/]+)/i;
- //this.server = this.server.match(patten)[0];
- var tokenServiceSuffix = "/services/security/tokens";
- if (this.type === ServerType.ISERVER && this.server.indexOf("iserver") < 0) {
- tokenServiceSuffix = "/iserver" + tokenServiceSuffix;
- }
- if (!this.tokenServiceUrl) {
- this.tokenServiceUrl = Util.urlPathAppend(this.server, tokenServiceSuffix);
- }
- if (!this.keyServiceUrl) {
- if (this.type === ServerType.IPORTAL) {
- this.keyServiceUrl = Util.urlPathAppend(this.server, "/web/mycontent/keys/register");
- } else if (this.type === ServerType.ONLINE) {
- this.keyServiceUrl = Util.urlPathAppend(this.server, "/web/mycontent/keys");
- }
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/security/TokenServiceParameter.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class TokenServiceParameter
- * @deprecatedclass SuperMap.TokenServiceParameter
- * @classdesc token 申请参数。
- * @category Security
- * @param {Object} options - 参数。
- * @param {string} options.username - 用户名。
- * @param {string} options.password - 密码。
- * @param {ClientType} [options.clientType='ClientType.NONE'] - token 申请的客户端标识类型。
- * @param {string} [options.ip] - clientType=IP 时,此为必选参数。
- * @param {string} [options.referer] -clientType=Referer 时,此为必选参数。如果按照指定 URL 的方式申请令牌,则设置相应的 URL。
- * @param {number} [options.expiration=60] - 申请令牌的有效期,从发布令牌的时间开始计算,单位为分钟。
- * @usage
- *
- */
- class TokenServiceParameter {
- constructor(options) {
- /**
- * @member {string} TokenServiceParameter.prototype.userName
- * @description 用户名。
- */
- this.userName = null;
- /**
- * @member {string} TokenServiceParameter.prototype.password
- * @description 密码。
- */
- this.password = null;
- /**
- * @member {ClientType} TokenServiceParameter.prototype.clientType
- * @description token 申请的客户端标识类型。
- */
- this.clientType = ClientType.NONE;
- /**
- * @member {string} [TokenServiceParameter.prototype.ip]
- * @description clientType=IP 时,此为必选参数。
- */
- this.ip = null;
- /**
- * @member {string} [TokenServiceParameter.prototype.referer]
- * @description clientType=Referer 时,此为必选参数。如果按照指定 URL 的方式申请令牌,则设置相应的 URL。
- */
- this.referer = null;
- /**
- * @member {number} TokenServiceParameter.prototype.expiration
- * @description 申请令牌的有效期,从发布令牌的时间开始计算,单位为分钟。
- */
- this.expiration = 60;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.TokenServiceParameter";
- }
- /**
- * @function TokenServiceParameter.prototype.toJSON
- * @description 将所有信息转成 JSON 字符串
- * @returns {string} 参数的 JSON 字符串
- */
- toJSON() {
- return {
- userName: this.userName,
- password: this.password,
- clientType: this.clientType,
- ip: this.ip,
- referer: this.referer,
- expiration: this.expiration
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/security/index.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- ;// CONCATENATED MODULE: external "function(){try{return elasticsearch}catch(e){return {}}}()"
- const external_function_try_return_elasticsearch_catch_e_return_namespaceObject = function(){try{return elasticsearch}catch(e){return {}}}();
- var external_function_try_return_elasticsearch_catch_e_return_default = /*#__PURE__*/__webpack_require__.n(external_function_try_return_elasticsearch_catch_e_return_namespaceObject);
- ;// CONCATENATED MODULE: ./src/common/thirdparty/elasticsearch/ElasticSearch.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ElasticSearch
- * @deprecatedclass SuperMap.ElasticSearch
- * @classdesc ElasticSearch服务类。
- * @category ElasticSearch
- * @param {string} url - ElasticSearch服务地址。
- * @param {Object} options - 参数。
- * @param {function} [options.change] - 服务器返回数据后执行的函数。废弃,不建议使用。使用search或msearch方法。
- * @param {boolean} [options.openGeoFence=false] - 是否开启地理围栏验证,默认为不开启。
- * @param {function} [options.outOfGeoFence] - 数据超出地理围栏后执行的函数。
- * @param {Object} [options.geoFence] - 地理围栏。
- * @usage
- */
- class ElasticSearch {
- constructor(url, options) {
- options = options || {};
- /**
- * @member {string} ElasticSearch.prototype.url
- * @description ElasticSearch服务地址
- */
- this.url = url;
- /**
- * @member {Object} ElasticSearch.prototype.client
- * @description client ES客户端
- */
- this.client = new (external_function_try_return_elasticsearch_catch_e_return_default()).Client({
- host: this.url
- });
- /**
- * @deprecated
- * @member {function} [ElasticSearch.prototype.change]
- * @description 服务器返回数据后执行的函数。废弃,不建议使用。使用search或msearch方法。
- */
- this.change = null;
- /**
- * @member {boolean} [ElasticSearch.prototype.openGeoFence=false]
- * @description 是否开启地理围栏验证,默认为不开启。
- */
- this.openGeoFence = false;
- /**
- * @member {function} [ElasticSearch.prototype.outOfGeoFence]
- * @description 数据超出地理围栏后执行的函数
- */
- this.outOfGeoFence = null;
- /**
- * @member {Object} [ElasticSearch.prototype.geoFence]
- * @description 地理围栏
- * @example {
- * radius: 1000,//单位是m
- * center: [104.40, 30.43],
- * unit: 'meter|degree'
- * }
- */
- this.geoFence = null;
- /*
- * Constant: EVENT_TYPES
- * {Array.<String>}
- * 此类支持的事件类型。
- *
- */
- this.EVENT_TYPES = ['change', 'error', 'outOfGeoFence'];
- /**
- * @member {Events} ElasticSearch.prototype.events
- * @description 事件
- */
- this.events = new Events(this, null, this.EVENT_TYPES);
- /**
- * @member {Object} ElasticSearch.prototype.eventListeners
- * @description 听器对象,在构造函数中设置此参数(可选),对 MapService 支持的两个事件 processCompleted 、processFailed 进行监听,
- * 相当于调用 Events.on(eventListeners)。
- */
- this.eventListeners = null;
- Util.extend(this, options);
- if (this.eventListeners instanceof Object) {
- this.events.on(this.eventListeners);
- }
- }
- /**
- * @function ElasticSearch.prototype.setGeoFence
- * @description 设置地理围栏,openGeoFence参数为true的时候,设置的地理围栏才生效。
- * @param {Geometry} geoFence - 地理围栏。
- */
- setGeoFence(geoFence) {
- this.geoFence = geoFence;
- }
- /**
- * @function ElasticSearch.prototype.bulk
- * @description 批量操作API,允许执行多个索引/删除操作。
- * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-bulk}</br>
- * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html}</br>
- * @param {Object} params - 参数。
- * @param {function} callback - 回调函数。
- */
- bulk(params, callback) {
- return this.client.bulk(params, callback);
- }
- /**
- * @function ElasticSearch.prototype.clearScroll
- * @description 通过指定scroll参数进行查询来清除已经创建的scroll请求。
- * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-clearscroll}</br>
- *更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html}</br>
- * @param {Object} params - 参数。
- * @param {function} callback - 回调函数。
- */
- clearScroll(params, callback) {
- return this.client.clearScroll(params, callback);
- }
- /**
- * @function ElasticSearch.prototype.count
- * @description 获取集群、索引、类型或查询的文档个数。
- * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-count}</br>
- * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-count.html}</br>
- * @param {Object} params - 参数。
- * @param {function} callback - 回调函数。
- */
- count(params, callback) {
- return this.client.count(params, callback);
- }
- /**
- * @function ElasticSearch.prototype.create
- * @description 在特定索引中添加一个类型化的JSON文档,使其可搜索。如果具有相同index,type且id已经存在的文档将发生错误。</br>
- * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-create}
- * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html}
- * @param {Object} params - 参数。
- * @param {function} callback - 回调函数。
- */
- create(params, callback) {
- return this.client.create(params, callback);
- }
- /**
- * @function ElasticSearch.prototype.delete
- * @description 根据其ID从特定索引中删除键入的JSON文档。
- * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-delete}</br>
- * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete.html}</br>
- * @param {Object} params - 参数。
- * @param {function} callback - 回调函数。
- */
- delete(params, callback) {
- return this.client.delete(params, callback);
- }
- /**
- * @function ElasticSearch.prototype.deleteByQuery
- * @description 根据其ID从特定索引中删除键入的JSON文档。
- * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-deletebyquery}</br>
- * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html}</br>
- * @param {Object} params - 参数。
- * @param {function} callback - 回调函数。
- */
- deleteByQuery(params, callback) {
- return this.client.deleteByQuery(params, callback);
- }
- /**
- * @function ElasticSearch.prototype.deleteScript
- * @description 根据其ID删除脚本。</br>
- * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-deletescript}</br>
- * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html}</br>
- * @param {Object} params - 参数。
- * @param {function} callback - 回调函数。
- */
- deleteScript(params, callback) {
- return this.client.deleteScript(params, callback);
- }
- /**
- * @function ElasticSearch.prototype.deleteTemplate
- * @description 根据其ID删除模板。</br>
- * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-deletetemplate}</br>
- * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
- * @param {Object} params - 参数。
- * @param {function} callback - 回调函数。
- */
- deleteTemplate(params, callback) {
- return this.client.deleteTemplate(params, callback);
- }
- /**
- * @function ElasticSearch.prototype.exists
- * @description 检查给定文档是否存在。</br>
- * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-exists}</br>
- * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
- * @param {Object} params - 参数。
- * @param {function} callback - 回调函数。
- */
- exists(params, callback) {
- return this.client.exists(params, callback);
- }
- /**
- * @function ElasticSearch.prototype.existsSource
- * @description 检查资源是否存在。</br>
- * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-existssource}</br>
- * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
- * @param {Object} params - 参数。
- * @param {function} callback - 回调函数。
- */
- existsSource(params, callback) {
- return this.client.existsSource(params, callback);
- }
- /**
- * @function ElasticSearch.prototype.explain
- * @description 提供与特定查询相关的特定文档分数的详细信息。它还会告诉您文档是否与指定的查询匹配。</br>
- * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-explain}</br>
- * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-explain.html}</br>
- * @param {Object} params - 参数。
- * @param {function} callback - 回调函数。
- */
- explain(params, callback) {
- return this.client.explain(params, callback);
- }
- /**
- * @function ElasticSearch.prototype.fieldCaps
- * @description 允许检索多个索引之间的字段的功能。(实验性API,可能会在未来版本中删除)</br>
- * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-fieldcaps}</br>
- * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-field-caps.html}</br>
- * @param {Object} params - 参数。
- * @param {function} callback - 回调函数。
- */
- fieldCaps(params, callback) {
- return this.client.fieldCaps(params, callback);
- }
- /**
- * @function ElasticSearch.prototype.get
- * @description 从索引获取一个基于其id的类型的JSON文档。</br>
- * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-get}</br>
- * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
- * @param {Object} params - 参数。
- * @param {function} callback - 回调函数。
- */
- get(params, callback) {
- return this.client.get(params, callback);
- }
- /**
- * @function ElasticSearch.prototype.getScript
- * @description 获取脚本。</br>
- * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-getscript}</br>
- * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html}</br>
- * @param {Object} params - 参数。
- * @param {function} callback - 回调函数。
- */
- getScript(params, callback) {
- return this.client.getScript(params, callback);
- }
- /**
- * @function ElasticSearch.prototype.getSource
- * @description 通过索引,类型和ID获取文档的源。</br>
- * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-getsource}</br>
- * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
- * @param {Object} params - 参数。
- * @param {function} callback - 回调函数。
- */
- getSource(params, callback) {
- return this.client.getSource(params, callback);
- }
- /**
- * @function ElasticSearch.prototype.getTemplate
- * @description 获取模板。</br>
- * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-gettemplate}</br>
- * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
- * @param {Object} params - 参数。
- * @param {function} callback - 回调函数。
- */
- getTemplate(params, callback) {
- return this.client.getTemplate(params, callback);
- }
- /**
- * @function ElasticSearch.prototype.index
- * @description 在索引中存储一个键入的JSON文档,使其可搜索。</br>
- * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-index}</br>
- * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html}</br>
- * @param {Object} params - 参数。
- * @param {function} callback - 回调函数。
- */
- index(params, callback) {
- return this.client.index(params, callback);
- }
- /**
- * @function ElasticSearch.prototype.info
- * @description 从当前集群获取基本信息。</br>
- * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-info}</br>
- * 更多信息参考 {@link https://www.elastic.co/guide/index.html}</br>
- * @param {Object} params - 参数。
- * @param {function} callback - 回调函数。
- */
- info(params, callback) {
- return this.client.info(params, callback);
- }
- /**
- * @function ElasticSearch.prototype.mget
- * @description 根据索引,类型(可选)和ids来获取多个文档。mget所需的主体可以采用两种形式:文档位置数组或文档ID数组。</br>
- * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-mget}</br>
- * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html}</br>
- * @param {Object} params - 参数。
- * @param {function} callback - 回调函数。
- */
- mget(params, callback) {
- return this.client.mget(params, callback);
- }
- /**
- * @function ElasticSearch.prototype.msearch
- * @description 在同一请求中执行多个搜索请求。</br>
- * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-msearch}</br>
- * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html}</br>
- * @param {Object} params - 参数。
- * @param {function} callback - 请求返回的回调函数。也可以使用then表达式获取返回结果。
- * 回调参数:error,response。结果存储在response.responses中
- */
- msearch(params, callback) {
- let me = this;
- return me.client.msearch(params)
- .then(function (resp) {
- me._update(resp.responses, callback);
- return resp;
- }, function (err) {
- callback(err);
- me.events.triggerEvent('error', {error: err});
- return err;
- });
- }
- /**
- * @function ElasticSearch.prototype.msearchTemplate
- * @description 在同一请求中执行多个搜索模板请求。</br>
- * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-msearchtemplate}</br>
- * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
- * @param {Object} params - 参数。
- * @param {function} callback - 回调函数。
- */
- msearchTemplate(params, callback) {
- return this.client.msearchTemplate(params, callback);
- }
- /**
- * @function ElasticSearch.prototype.mtermvectors
- * @description 多termvectors API允许一次获得多个termvectors。</br>
- * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-mtermvectors}</br>
- * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-termvectors.html}</br>
- * @param {Object} params - 参数。
- * @param {function} callback - 回调函数。
- */
- mtermvectors(params, callback) {
- return this.client.mtermvectors(params, callback);
- }
- /**
- * @function ElasticSearch.prototype.ping
- * @description 测试连接。</br>
- * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-ping}</br>
- * 更多信息参考 {@link https://www.elastic.co/guide/index.html}</br>
- * @param {Object} params - 参数。
- * @param {function} callback - 回调函数。
- */
- ping(params, callback) {
- return this.client.ping(params, callback);
- }
- /**
- * @function ElasticSearch.prototype.putScript
- * @description 添加脚本。</br>
- * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-putscript}</br>
- * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html}</br>
- * @param {Object} params - 参数。
- * @param {function} callback - 回调函数。
- */
- putScript(params, callback) {
- return this.client.putScript(params, callback);
- }
- /**
- * @function ElasticSearch.prototype.putTemplate
- * @description 添加模板。</br>
- * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-puttemplate}</br>
- * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
- * @param {Object} params - 参数。
- * @param {function} callback - 回调函数。
- */
- putTemplate(params, callback) {
- return this.client.putTemplate(params, callback);
- }
- /**
- * @function ElasticSearch.prototype.reindex
- * @description 重新索引。</br>
- * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-reindex}</br>
- * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html}</br>
- * @param {Object} params - 参数。
- * @param {function} callback - 回调函数。
- */
- reindex(params, callback) {
- return this.client.reindex(params, callback);
- }
- /**
- * @function ElasticSearch.prototype.reindexRessrottle
- * @description 重新索引。</br>
- * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-reindexrethrottle}</br>
- * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html}</br>
- * @param {Object} params - 参数。
- * @param {function} callback - 回调函数。
- */
- reindexRessrottle(params, callback) {
- return this.client.reindexRessrottle(params, callback);
- }
- /**
- * @function ElasticSearch.prototype.renderSearchTemplate
- * @description 搜索模板。</br>
- * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-rendersearchtemplate}</br>
- * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
- * @param {Object} params - 参数。
- * @param {function} callback - 回调函数。
- */
- renderSearchTemplate(params, callback) {
- return this.client.renderSearchTemplate(params, callback);
- }
- /**
- * @function ElasticSearch.prototype.scroll
- * @description 在search()调用中指定滚动参数之后,滚动搜索请求(检索下一组结果)。</br>
- * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-scroll}</br>
- * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html}</br>
- * @param {Object} params - 参数。
- * @param {function} callback - 回调函数。
- */
- scroll(params, callback) {
- return this.client.scroll(params, callback);
- }
- /**
- * @function ElasticSearch.prototype.search
- * @description 在search()调用中指定滚动参数之后,滚动搜索请求(检索下一组结果)。
- * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-search}</br>
- * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html}</br>
- * @param {Object} params - 参数。
- * @param {function} callback - 请求返回的回调函数。也可以使用then表达式获取返回结果。
- * 回调参数:error,response,结果存储在response.responses中
- */
- search(params, callback) {
- let me = this;
- return me.client.search(params)
- .then(function (resp) {
- me._update(resp.responses, callback);
- return resp;
- }, function (err) {
- callback && callback(err);
- me.events.triggerEvent('error', {error: err});
- return err;
- });
- }
- /**
- * @function ElasticSearch.prototype.searchShards
- * @description 返回要执行搜索请求的索引和分片。
- * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-searchshards}</br>
- * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-shards.html}</br>
- * @param {Object} params - 参数。
- * @param {function} callback - 回调函数。
- */
- searchShards(params, callback) {
- return this.client.searchShards(params, callback);
- }
- /**
- * @function ElasticSearch.prototype.searchTemplate
- * @description 搜索模板。
- * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-searchtemplate}</br>
- * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html}</br>
- * @param {Object} params - 参数。
- * @param {function} callback - 回调函数。
- */
- searchTemplate(params, callback) {
- return this.client.searchTemplate(params, callback);
- }
- /**
- * @function ElasticSearch.prototype.suggest
- * @description 该建议功能通过使用特定的建议者,基于所提供的文本来建议类似的术语。
- * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-suggest}</br>
- * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html}</br>
- * @param {Object} params - 参数。
- * @param {function} callback - 回调函数。
- */
- suggest(params, callback) {
- return this.client.suggest(params, callback);
- }
- /**
- * @function ElasticSearch.prototype.termvectors
- * @description 返回有关特定文档字段中的术语的信息和统计信息。
- * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-termvectors}</br>
- * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-termvectors.html}</br>
- * @param {Object} params - 参数。
- * @param {function} callback - 回调函数。
- */
- termvectors(params, callback) {
- return this.client.termvectors(params, callback);
- }
- /**
- * @function ElasticSearch.prototype.update
- * @description 更新文档的部分。
- * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-update}</br>
- * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html}</br>
- * @param {Object} params - 参数。
- * @param {function} callback - 回调函数。
- */
- update(params, callback) {
- return this.client.update(params, callback);
- }
- /**
- * @function ElasticSearch.prototype.updateByQuery
- * @description 通过查询API来更新文档。
- * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-updatebyquery}</br>
- * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-query.html}</br>
- * @param {Object} params - 参数。
- * @param {function} callback - 回调函数。
- */
- updateByQuery(params, callback) {
- return this.client.updateByQuery(params, callback);
- }
- _update(data, callback) {
- let me = this;
- if (!data) {
- return;
- }
- me.data = data;
- if (me.openGeoFence && me.geoFence) {
- me._validateDatas(data);
- }
- me.events.triggerEvent('change', {data: me.data});
- //change方法已废弃,不建议使用。建议使用search方法的第二个参数传入请求成功的回调
- if (me.change) {
- me.change && me.change(data);
- } else {
- //加responses是为了保持跟原来es自身的数据结构一致
- callback && callback(undefined, {responses: data});
- }
- }
- _validateDatas(datas) {
- if (!datas) {
- return;
- }
- if (!(datas instanceof Array)) {
- datas = [datas];
- }
- var i, len = datas.length;
- for (i = 0; i < len; i++) {
- this._validateData(datas[i]);
- }
- }
- _validateData(data) {
- let me = this;
- data.hits.hits.map(function (source) {
- let content = source._source;
- let meterUnit = me._getMeterPerMapUnit(me.geoFence.unit);
- let geoFenceCX = me.geoFence.center[0] * meterUnit;
- let geoFenceCY = me.geoFence.center[1] * meterUnit;
- let contentX = content.x * meterUnit;
- let contentY = content.y * meterUnit;
- let distance = me._distance(contentX, contentY, geoFenceCX, geoFenceCY);
- let radius = me.geoFence.radius;
- if (distance > radius) {
- me.outOfGeoFence && me.outOfGeoFence(data);
- me.events.triggerEvent('outOfGeoFence', {data: data});
- }
- return source;
- });
- }
- _distance(x1, y1, x2, y2) {
- return Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
- }
- _getMeterPerMapUnit(mapUnit) {
- let earchRadiusInMeters = 6378137;
- let meterPerMapUnit;
- if (mapUnit === 'meter') {
- meterPerMapUnit = 1;
- } else if (mapUnit === 'degree') {
- // 每度表示多少米。
- meterPerMapUnit = Math.PI * 2 * earchRadiusInMeters / 360;
- }
- return meterPerMapUnit;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/thirdparty/elasticsearch/index.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- ;// CONCATENATED MODULE: ./src/common/thirdparty/index.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Util.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @private
- * @class LevelRenderer.Tool.Util
- * @category Visualization Theme
- * LevelRenderer 基础工具类
- *
- */
- class Util_Util {
- constructor() {
- /**
- * @member {Object} LevelRenderer.Tool.Util.prototype.BUILTIN_OBJECT
- * @description 用于处理merge时无法遍历Date等对象的问题
- */
- this.BUILTIN_OBJECT = {
- '[object Function]': 1,
- '[object RegExp]': 1,
- '[object Date]': 1,
- '[object Error]': 1,
- '[object CanvasGradient]': 1
- };
- /**
- * @member {Object} LevelRenderer.Tool.Util.prototype._ctx
- */
- this._ctx = null;
- /**
- * Property: _canvas
- * {Object}
- */
- this._canvas = null;
- /**
- * Property: _pixelCtx
- * {Object}
- */
- this._pixelCtx = null;
- /**
- * Property: _width
- * {Object}
- */
- this._width = null;
- /**
- * Property: _height
- * {Object}
- */
- this._height = null;
- /**
- * Property: _offsetX
- * {Object}
- */
- this._offsetX = 0;
- /**
- * Property: _offsetY
- * {Object}
- */
- this._offsetY = 0;
- this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Util";
- }
- /**
- * @function LevelRenderer.Tool.Util.prototype.clone
- * @description 对一个object进行深度拷贝。
- *
- * @param {Object} source - 需要进行拷贝的对象。
- * @return {Object} 拷贝后的新对象。
- */
- clone(source) {
- var BUILTIN_OBJECT = this.BUILTIN_OBJECT;
- if (typeof source == 'object' && source !== null) {
- var result = source;
- if (source instanceof Array) {
- result = [];
- for (var i = 0, len = source.length; i < len; i++) {
- result[i] = this.clone(source[i]);
- }
- } else if (!BUILTIN_OBJECT[Object.prototype.toString.call(source)]) {
- result = {};
- for (var key in source) {
- if (source.hasOwnProperty(key)) {
- result[key] = this.clone(source[key]);
- }
- }
- }
- return result;
- }
- return source;
- }
- /**
- * @function LevelRenderer.Tool.Util.prototype.mergeItem
- * @description 合并源对象的单个属性到目标对象。
- *
- * @param {Object} target - 目标对象。
- * @param {Object} source - 源对象。
- * @param {string} key - 键。
- * @param {boolean} overwrite - 是否覆盖。
- * @return {Object} 目标对象
- */
- mergeItem(target, source, key, overwrite) {
- var BUILTIN_OBJECT = this.BUILTIN_OBJECT;
- if (source.hasOwnProperty(key)) {
- if (typeof target[key] == 'object'
- && !BUILTIN_OBJECT[Object.prototype.toString.call(target[key])]
- ) {
- // 如果需要递归覆盖,就递归调用merge
- this.merge(
- target[key],
- source[key],
- overwrite
- );
- } else if (overwrite || !(key in target)) {
- // 否则只处理overwrite为true,或者在目标对象中没有此属性的情况
- target[key] = source[key];
- }
- }
- }
- /**
- * @function LevelRenderer.Tool.Util.prototype.merge
- * @description 合并源对象的属性到目标对象。
- *
- * @param {Object} target - 目标对象。
- * @param {Object} source - 源对象。
- * @param {boolean} overwrite - 是否覆盖。
- * @return {Object} 目标对象。
- */
- merge(target, source, overwrite) {
- for (var i in source) {
- this.mergeItem(target, source, i, overwrite);
- }
- return target;
- }
- /**
- * @function LevelRenderer.Tool.Util.prototype.getContext
- * @description 获取 Canvas 上下文。
- * @return {Object} 上下文。
- */
- getContext() {
- if (!this._ctx) {
- this._ctx = document.createElement('canvas').getContext('2d');
- }
- return this._ctx;
- }
- /**
- * @function LevelRenderer.Tool.Util.prototype.getPixelContext
- * @description 获取像素拾取专用的上下文。
- * @return {Object} 像素拾取专用的上下文。
- */
- getPixelContext() {
- if (!this._pixelCtx) {
- this._canvas = document.createElement('canvas');
- this._width = this._canvas.width;
- this._height = this._canvas.height;
- this._pixelCtx = this._canvas.getContext('2d');
- }
- return this._pixelCtx;
- }
- /**
- * @function LevelRenderer.Tool.Util.prototype.adjustCanvasSize
- * @description 如果坐标处在_canvas外部,改变_canvas的大小,修改canvas的大小 需要重新设置translate
- *
- * @param {number} x - 横坐标。
- * @param {number} y - 纵坐标。
- *
- */
- adjustCanvasSize(x, y) {
- var _canvas = this._canvas;
- var _pixelCtx = this._pixelCtx;
- var _width = this._width;
- var _height = this._height;
- var _offsetX = this._offsetX;
- var _offsetY = this._offsetY;
- // 每次加的长度
- var _v = 100;
- var _flag;
- if (x + _offsetX > _width) {
- _width = x + _offsetX + _v;
- _canvas.width = _width;
- _flag = true;
- }
- if (y + _offsetY > _height) {
- _height = y + _offsetY + _v;
- _canvas.height = _height;
- _flag = true;
- }
- if (x < -_offsetX) {
- _offsetX = Math.ceil(-x / _v) * _v;
- _width += _offsetX;
- _canvas.width = _width;
- _flag = true;
- }
- if (y < -_offsetY) {
- _offsetY = Math.ceil(-y / _v) * _v;
- _height += _offsetY;
- _canvas.height = _height;
- _flag = true;
- }
- if (_flag) {
- _pixelCtx.translate(_offsetX, _offsetY);
- }
- }
- /**
- * @function LevelRenderer.Tool.Util.prototype.getPixelOffset
- * @description 获取像素canvas的偏移量。
- * @return {Object} 偏移量。
- */
- getPixelOffset() {
- return {
- x: this._offsetX,
- y: this._offsetY
- };
- }
- /**
- * @function LevelRenderer.Tool.Util.prototype.indexOf
- * @description 查询数组中元素的index
- * @return {Object} 偏移量。
- */
- indexOf(array, value) {
- if (array.indexOf) {
- return array.indexOf(value);
- }
- for (var i = 0, len = array.length; i < len; i++) {
- if (array[i] === value) {
- return i;
- }
- }
- return -1;
- }
- /**
- * @function LevelRenderer.Tool.Util.prototype.inherits
- * @description 构造类继承关系
- *
- * @param {function} clazz - 源类。
- * @param {function} baseClazz - 基类。
- * @return {Object} 偏移量。
- */
- inherits(clazz, baseClazz) {
- var clazzPrototype = clazz.prototype;
- function F() {
- }
- F.prototype = baseClazz.prototype;
- clazz.prototype = new F();
- for (var prop in clazzPrototype) {
- clazz.prototype[prop] = clazzPrototype[prop];
- }
- clazz.constructor = clazz;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Color.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class LevelRenderer.Tool.Color
- * @category Visualization Theme
- * @classdesc LevelRenderer 工具-颜色辅助类
- * @private
- */
- class Color {
- constructor() {
- /**
- * @member {LevelRenderer.Tool.Util} LevelRenderer.Tool.Color.prototype.util
- * @description LevelRenderer 基础工具对象。
- */
- this.util = new Util_Util();
- /**
- * @member {Object} LevelRenderer.Tool.Color.prototype._ctx
- * @description _ctx。
- */
- this._ctx = null;
- /**
- * @member {Array.<string>} LevelRenderer.Tool.Color.prototype.palette
- * @description 默认色板。色板是一个包含图表默认颜色系列的数组,当色板中所有颜色被使用过后,又将从新回到色板中的第一个颜色。
- */
- this.palette = [
- '#ff9277', ' #dddd00', ' #ffc877', ' #bbe3ff', ' #d5ffbb',
- '#bbbbff', ' #ddb000', ' #b0dd00', ' #e2bbff', ' #ffbbe3',
- '#ff7777', ' #ff9900', ' #83dd00', ' #77e3ff', ' #778fff',
- '#c877ff', ' #ff77ab', ' #ff6600', ' #aa8800', ' #77c7ff',
- '#ad77ff', ' #ff77ff', ' #dd0083', ' #777700', ' #00aa00',
- '#0088aa', ' #8400dd', ' #aa0088', ' #dd0000', ' #772e00'
- ];
- /**
- * @member {Array.<string>} LevelRenderer.Tool.Color.prototype._palette
- * @description 复位色板,用于复位 palette
- */
- this._palette = this.palette;
- /**
- * @member {string} LevelRenderer.Tool.Color.prototype.highlightColor
- * @description 高亮色
- */
- this.highlightColor = 'rgba(0,0,255,1)';
- /**
- * @member {string} LevelRenderer.Tool.Color.prototype._highlightColor
- * @description 复位高亮色
- */
- this._highlightColor = this.highlightColor;
- /**
- * @member {string} LevelRenderer.Tool.Color.prototype.colorRegExp
- * @description 颜色格式,正则表达式。
- */
- 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;
- /**
- * @member {string} LevelRenderer.Tool.Color.prototype._nameColors
- * @description 颜色名。
- */
- this._nameColors = {
- aliceblue: '#f0f8ff',
- antiquewhite: '#faebd7',
- aqua: '#0ff',
- aquamarine: '#7fffd4',
- azure: '#f0ffff',
- beige: '#f5f5dc',
- bisque: '#ffe4c4',
- black: '#000',
- blanchedalmond: '#ffebcd',
- blue: '#00f',
- blueviolet: '#8a2be2',
- brown: '#a52a2a',
- burlywood: '#deb887',
- cadetblue: '#5f9ea0',
- chartreuse: '#7fff00',
- chocolate: '#d2691e',
- coral: '#ff7f50',
- cornflowerblue: '#6495ed',
- cornsilk: '#fff8dc',
- crimson: '#dc143c',
- cyan: '#0ff',
- darkblue: '#00008b',
- darkcyan: '#008b8b',
- darkgoldenrod: '#b8860b',
- darkgray: '#a9a9a9',
- darkgrey: '#a9a9a9',
- darkgreen: '#006400',
- darkkhaki: '#bdb76b',
- darkmagenta: '#8b008b',
- darkolivegreen: '#556b2f',
- darkorange: '#ff8c00',
- darkorchid: '#9932cc',
- darkred: '#8b0000',
- darksalmon: '#e9967a',
- darkseagreen: '#8fbc8f',
- darkslateblue: '#483d8b',
- darkslategray: '#2f4f4f',
- darkslategrey: '#2f4f4f',
- darkturquoise: '#00ced1',
- darkviolet: '#9400d3',
- deeppink: '#ff1493',
- deepskyblue: '#00bfff',
- dimgray: '#696969',
- dimgrey: '#696969',
- dodgerblue: '#1e90ff',
- firebrick: '#b22222',
- floralwhite: '#fffaf0',
- forestgreen: '#228b22',
- fuchsia: '#f0f',
- gainsboro: '#dcdcdc',
- ghostwhite: '#f8f8ff',
- gold: '#ffd700',
- goldenrod: '#daa520',
- gray: '#808080',
- grey: '#808080',
- green: '#008000',
- greenyellow: '#adff2f',
- honeydew: '#f0fff0',
- hotpink: '#ff69b4',
- indianred: '#cd5c5c',
- indigo: '#4b0082',
- ivory: '#fffff0',
- khaki: '#f0e68c',
- lavender: '#e6e6fa',
- lavenderblush: '#fff0f5',
- lawngreen: '#7cfc00',
- lemonchiffon: '#fffacd',
- lightblue: '#add8e6',
- lightcoral: '#f08080',
- lightcyan: '#e0ffff',
- lightgoldenrodyellow: '#fafad2',
- lightgray: '#d3d3d3',
- lightgrey: '#d3d3d3',
- lightgreen: '#90ee90',
- lightpink: '#ffb6c1',
- lightsalmon: '#ffa07a',
- lightseagreen: '#20b2aa',
- lightskyblue: '#87cefa',
- lightslategray: '#789',
- lightslategrey: '#789',
- lightsteelblue: '#b0c4de',
- lightyellow: '#ffffe0',
- lime: '#0f0',
- limegreen: '#32cd32',
- linen: '#faf0e6',
- magenta: '#f0f',
- maroon: '#800000',
- mediumaquamarine: '#66cdaa',
- mediumblue: '#0000cd',
- mediumorchid: '#ba55d3',
- mediumpurple: '#9370d8',
- mediumseagreen: '#3cb371',
- mediumslateblue: '#7b68ee',
- mediumspringgreen: '#00fa9a',
- mediumturquoise: '#48d1cc',
- mediumvioletred: '#c71585',
- midnightblue: '#191970',
- mintcream: '#f5fffa',
- mistyrose: '#ffe4e1',
- moccasin: '#ffe4b5',
- navajowhite: '#ffdead',
- navy: '#000080',
- oldlace: '#fdf5e6',
- olive: '#808000',
- olivedrab: '#6b8e23',
- orange: '#ffa500',
- orangered: '#ff4500',
- orchid: '#da70d6',
- palegoldenrod: '#eee8aa',
- palegreen: '#98fb98',
- paleturquoise: '#afeeee',
- palevioletred: '#d87093',
- papayawhip: '#ffefd5',
- peachpuff: '#ffdab9',
- peru: '#cd853f',
- pink: '#ffc0cb',
- plum: '#dda0dd',
- powderblue: '#b0e0e6',
- purple: '#800080',
- red: '#f00',
- rosybrown: '#bc8f8f',
- royalblue: '#4169e1',
- saddlebrown: '#8b4513',
- salmon: '#fa8072',
- sandybrown: '#f4a460',
- seagreen: '#2e8b57',
- seashell: '#fff5ee',
- sienna: '#a0522d',
- silver: '#c0c0c0',
- skyblue: '#87ceeb',
- slateblue: '#6a5acd',
- slategray: '#708090',
- slategrey: '#708090',
- snow: '#fffafa',
- springgreen: '#00ff7f',
- steelblue: '#4682b4',
- tan: '#d2b48c',
- teal: '#008080',
- thistle: '#d8bfd8',
- tomato: '#ff6347',
- turquoise: '#40e0d0',
- violet: '#ee82ee',
- wheat: '#f5deb3',
- white: '#fff',
- whitesmoke: '#f5f5f5',
- yellow: '#ff0',
- yellowgreen: '#9acd32'
- };
- this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Color";
- }
- /**
- * @function LevelRenderer.Tool.Color.prototype.customPalette
- * @description 自定义调色板。
- * @param {Array.<string>} userPalete - 颜色板。
- */
- customPalette(userPalete) {
- this.palette = userPalete;
- }
- /**
- * @function LevelRenderer.Tool.Color.prototype.resetPalette
- * @description 复位默认色板。
- */
- resetPalette() {
- this.palette = this._palette;
- }
- /**
- * @function LevelRenderer.Tool.Color.prototype.getColor
- * @description 获取色板颜色。
- * @param {number} idx - 色板位置。
- * @param {Array.<string>} userPalete - 色板。
- * @returns {string} 颜色值。
- */
- getColor(idx, userPalete) {
- idx = idx | 0;
- userPalete = userPalete || this.palette;
- return userPalete[idx % userPalete.length];
- }
- /**
- * @function LevelRenderer.Tool.Color.prototype.customHighlight
- * @description 自定义默认高亮颜色。
- * @param {string} userHighlightColor - 自定义高亮色。
- */
- customHighlight(userHighlightColor) {
- this.highlightColor = userHighlightColor;
- }
- /**
- * @function LevelRenderer.Tool.Color.prototype.resetHighlight
- * @description 重置默认高亮颜色。将当前的高亮色作为默认高亮颜色
- */
- resetHighlight() {
- this.highlightColor = this._highlightColor;
- }
- /**
- * @function LevelRenderer.Tool.Color.prototype.getHighlightColor
- * @description 获取默认高亮颜色
- * @returns {string} 颜色值。
- */
- getHighlightColor() {
- return this.highlightColor;
- }
- /**
- * @function LevelRenderer.Tool.Color.prototype.getRadialGradient
- * @description 径向渐变。
- * @param {number} x0 - 渐变起点横坐标。
- * @param {number} y0 - 渐变起点纵坐标。
- * @param {number} r0 - 半径
- * @param {number} x1 - 渐变终点横坐标。
- * @param {number} y1 - 渐变终点纵坐标。
- * @param {number} r1 - 半径
- * @param {Array} colorList - 颜色列表。
- * @returns {CanvasGradient} Cavans 渐变颜色。
- */
- getRadialGradient(x0, y0, r0, x1, y1, r1, colorList) {
- var util = this.util;
- if (!this._ctx) {
- this._ctx = util.getContext();
- }
- var gradient = this._ctx.createRadialGradient(x0, y0, r0, x1, y1, r1);
- for (var i = 0, l = colorList.length; i < l; i++) {
- gradient.addColorStop(colorList[i][0], colorList[i][1]);
- }
- gradient.__nonRecursion = true;
- return gradient;
- }
- /**
- * @function LevelRenderer.Tool.Color.prototype.getLinearGradient
- * @description 线性渐变。
- * @param {number} x0 - 渐变起点横坐标。
- * @param {number} y0 - 渐变起点纵坐标。
- * @param {number} x1 - 渐变终点横坐标。
- * @param {number} y1 - 渐变终点纵坐标。
- * @param {Array} colorList - 颜色列表。
- * @returns {CanvasGradient} Cavans 渐变颜色。
- */
- getLinearGradient(x0, y0, x1, y1, colorList) {
- var util = this.util;
- if (!this._ctx) {
- this._ctx = util.getContext();
- }
- var gradient = this._ctx.createLinearGradient(x0, y0, x1, y1);
- for (var i = 0, l = colorList.length; i < l; i++) {
- gradient.addColorStop(colorList[i][0], colorList[i][1]);
- }
- gradient.__nonRecursion = true;
- return gradient;
- }
- /**
- * @function LevelRenderer.Tool.Color.prototype.getStepColors
- * @description 获取两种颜色之间渐变颜色数组。
- * @param {Object} start - 起始颜色对象。
- * @param {Object} end - 结束颜色对象。
- * @param {number} step - 渐变级数。
- * @returns {Array} 颜色数组。
- */
- getStepColors(start, end, step) {
- start = this.toRGBA(start);
- end = this.toRGBA(end);
- start = this.getData(start);
- end = this.getData(end);
- var colors = [];
- var stepR = (end[0] - start[0]) / step;
- var stepG = (end[1] - start[1]) / step;
- var stepB = (end[2] - start[2]) / step;
- var stepA = (end[3] - start[3]) / step;
- // 生成颜色集合
- // fix by linfeng 颜色堆积
- for (var i = 0, r = start[0], g = start[1], b = start[2], a = start[3]; i < step; i++) {
- colors[i] = this.toColor([
- this.adjust(Math.floor(r), [0, 255]),
- this.adjust(Math.floor(g), [0, 255]),
- this.adjust(Math.floor(b), [0, 255]),
- a.toFixed(4) - 0
- ], 'rgba');
- r += stepR;
- g += stepG;
- b += stepB;
- a += stepA;
- }
- r = end[0];
- g = end[1];
- b = end[2];
- a = end[3];
- colors[i] = this.toColor([r, g, b, a], 'rgba');
- return colors;
- }
- /**
- * @function LevelRenderer.Tool.Color.prototype.getGradientColors
- * @description 获取指定级数的渐变颜色数组。
- * @param {Array.<string>} colors - 颜色数组。
- * @param {number} [step=20] - 渐变级数。
- * @returns {Array.<string>} 颜色数组。
- */
- getGradientColors(colors, step) {
- var ret = [];
- var len = colors.length;
- if (step === undefined) {
- step = 20;
- }
- if (len === 1) {
- ret = this.getStepColors(colors[0], colors[0], step);
- } else if (len > 1) {
- for (var i = 0, n = len - 1; i < n; i++) {
- var steps = this.getStepColors(colors[i], colors[i + 1], step);
- if (i < n - 1) {
- steps.pop();
- }
- ret = ret.concat(steps);
- }
- }
- return ret;
- }
- /**
- * @function LevelRenderer.Tool.Color.prototype.toColor
- * @description 颜色值数组转为指定格式颜色。
- * @param {Array} data - 颜色值数组。
- * @param {string} format - 格式,默认'rgb'
- * @returns {string} 颜色。
- */
- toColor(data, format) {
- format = format || 'rgb';
- if (data && (data.length === 3 || data.length === 4)) {
- data = this.map(data,
- function (c) {
- return c > 1 ? Math.ceil(c) : c;
- }
- );
- if (format.indexOf('hex') > -1) {
- return '#' + ((1 << 24) + (data[0] << 16) + (data[1] << 8) + (+data[2])).toString(16).slice(1);
- } else if (format.indexOf('hs') > -1) {
- var sx = this.map(data.slice(1, 3),
- function (c) {
- return c + '%';
- }
- );
- data[1] = sx[0];
- data[2] = sx[1];
- }
- if (format.indexOf('a') > -1) {
- if (data.length === 3) {
- data.push(1);
- }
- data[3] = this.adjust(data[3], [0, 1]);
- return format + '(' + data.slice(0, 4).join(',') + ')';
- }
- return format + '(' + data.slice(0, 3).join(',') + ')';
- }
- }
- /**
- * @function LevelRenderer.Tool.Color.prototype.toArray
- * @description 颜色字符串转换为rgba数组。
- * @param {string} color - 颜色。
- * @returns {Array.<number>} 颜色值数组。
- */
- toArray(color) {
- color = this.trim(color);
- if (color.indexOf('rgba') < 0) {
- color = this.toRGBA(color);
- }
- var data = [];
- var i = 0;
- color.replace(/[\d.]+/g, function (n) {
- if (i < 3) {
- n = n | 0;
- } else {
- // Alpha
- n = +n;
- }
- data[i++] = n;
- });
- return data;
- }
- /**
- * @function LevelRenderer.Tool.Color.prototype.convert
- * @description 颜色格式转化。
- * @param {Array} data - 颜色值数组。
- * @param {string} format - 格式,默认'rgb'
- * @returns {string} 颜色。
- */
- convert(color, format) {
- if (!this.isCalculableColor(color)) {
- return color;
- }
- var data = this.getData(color);
- var alpha = data[3];
- if (typeof alpha === 'undefined') {
- alpha = 1;
- }
- if (color.indexOf('hsb') > -1) {
- data = this._HSV_2_RGB(data);
- } else if (color.indexOf('hsl') > -1) {
- data = this._HSL_2_RGB(data);
- }
- if (format.indexOf('hsb') > -1 || format.indexOf('hsv') > -1) {
- data = this._RGB_2_HSB(data);
- } else if (format.indexOf('hsl') > -1) {
- data = this._RGB_2_HSL(data);
- }
- data[3] = alpha;
- return this.toColor(data, format);
- }
- /**
- * @function LevelRenderer.Tool.Color.prototype.toRGBA
- * @description 转换为rgba格式的颜色。
- * @param {string} color - 颜色。
- * @returns {string} 颜色。
- */
- toRGBA(color) {
- return this.convert(color, 'rgba');
- }
- /**
- * @function LevelRenderer.Tool.Color.prototype.toRGB
- * @description 转换为rgb数字格式的颜色。
- * @param {string} color - 颜色。
- * @returns {string} 颜色。
- */
- toRGB(color) {
- return this.convert(color, 'rgb');
- }
- /**
- * @function LevelRenderer.Tool.Color.prototype.toHex
- * @description 转换为16进制颜色。
- * @param {string} color - 颜色。
- * @returns {string} 16进制颜色,#rrggbb格式
- */
- toHex(color) {
- return this.convert(color, 'hex');
- }
- /**
- * @function LevelRenderer.Tool.Color.prototype.toHSVA
- * @description 转换为HSV颜色。
- * @param {string} color - 颜色。
- * @returns {string} HSVA颜色,hsva(h,s,v,a)
- */
- toHSVA(color) {
- return this.convert(color, 'hsva');
- }
- /**
- * @function LevelRenderer.Tool.Color.prototype.toHSV
- * @description 转换为HSV颜色。
- * @param {string} color - 颜色。
- * @returns {string} HSV颜色,hsv(h,s,v)
- */
- toHSV(color) {
- return this.convert(color, 'hsv');
- }
- /**
- * @function LevelRenderer.Tool.Color.prototype.toHSBA
- * @description 转换为HSBA颜色。
- * @param {string} color - 颜色。
- * @returns {string} HSBA颜色,hsba(h,s,b,a)
- */
- toHSBA(color) {
- return this.convert(color, 'hsba');
- }
- /**
- * @function LevelRenderer.Tool.Color.prototype.toHSB
- * @description 转换为HSB颜色。
- * @param {string} color - 颜色。
- * @returns {string} HSB颜色,hsb(h,s,b)
- */
- toHSB(color) {
- return this.convert(color, 'hsb');
- }
- /**
- * @function LevelRenderer.Tool.Color.prototype.toHSLA
- * @description 转换为HSLA颜色。
- * @param {string} color - 颜色。
- * @returns {string} HSLA颜色,hsla(h,s,l,a)
- */
- toHSLA(color) {
- return this.convert(color, 'hsla');
- }
- /**
- * @function LevelRenderer.Tool.Color.prototype.toHSL
- * @description 转换为HSL颜色。
- * @param {string} color - 颜色。
- * @returns {string} HSL颜色,hsl(h,s,l)
- */
- toHSL(color) {
- return this.convert(color, 'hsl');
- }
- /**
- * @function LevelRenderer.Tool.Color.prototype.toName
- * @description 转换颜色名。
- * @param {string} color - 颜色。
- * @returns {string} 颜色名
- */
- toName(color) {
- for (var key in this._nameColors) {
- if (this.toHex(this._nameColors[key]) === this.toHex(color)) {
- return key;
- }
- }
- return null;
- }
- /**
- * @function LevelRenderer.Tool.Color.prototype.trim
- * @description 移除颜色中多余空格。
- * @param {string} color - 颜色。
- * @returns {string} 无空格颜色
- */
- trim(color) {
- return String(color).replace(/\s+/g, '');
- }
- /**
- * @function LevelRenderer.Tool.Color.prototype.normalize
- * @description 颜色规范化。
- * @param {string} color - 颜色。
- * @returns {string} 规范化后的颜色
- */
- normalize(color) {
- // 颜色名
- if (this._nameColors[color]) {
- color = this._nameColors[color];
- }
- // 去掉空格
- color = this.trim(color);
- // hsv与hsb等价
- color = color.replace(/hsv/i, 'hsb');
- // rgb转为rrggbb
- if (/^#[\da-f]{3}$/i.test(color)) {
- color = parseInt(color.slice(1), 16);
- var r = (color & 0xf00) << 8;
- var g = (color & 0xf0) << 4;
- var b = color & 0xf;
- color = '#' + ((1 << 24) + (r << 4) + r + (g << 4) + g + (b << 4) + b).toString(16).slice(1);
- }
- // 或者使用以下正则替换,不过 chrome 下性能相对差点
- // color = color.replace(/^#([\da-f])([\da-f])([\da-f])$/i, '#$1$1$2$2$3$3');
- return color;
- }
- /**
- * @function LevelRenderer.Tool.Color.prototype.lift
- * @description 颜色加深或减淡,当level>0加深,当level<0减淡。
- * @param {string} color - 颜色。
- * @param {number} level - 升降程度,取值区间[-1,1]。
- * @returns {string} 加深或减淡后颜色值
- */
- lift(color, level) {
- if (!this.isCalculableColor(color)) {
- return color;
- }
- var direct = level > 0 ? 1 : -1;
- if (typeof level === 'undefined') {
- level = 0;
- }
- level = Math.abs(level) > 1 ? 1 : Math.abs(level);
- color = this.toRGB(color);
- var data = this.getData(color);
- for (var i = 0; i < 3; i++) {
- if (direct === 1) {
- data[i] = data[i] * (1 - level) | 0;
- } else {
- data[i] = ((255 - data[i]) * level + data[i]) | 0;
- }
- }
- return 'rgb(' + data.join(',') + ')';
- }
- /**
- * @function LevelRenderer.Tool.Color.prototype.reverse
- * @description 颜色翻转。[255-r,255-g,255-b,1-a]
- * @param {string} color - 颜色。
- * @returns {string} 翻转颜色
- */
- reverse(color) {
- if (!this.isCalculableColor(color)) {
- return color;
- }
- var data = this.getData(this.toRGBA(color));
- data = this.map(data,
- function (c) {
- return 255 - c;
- }
- );
- return this.toColor(data, 'rgb');
- }
- /**
- * @function LevelRenderer.Tool.Color.prototype.mix
- * @description 简单两种颜色混合
- * @param {string} color1 - 第一种颜色。
- * @param {string} color2 - 第二种颜色。
- * @param {number} weight - 混合权重[0-1]。
- * @returns {string} 结果色。rgb(r,g,b)或rgba(r,g,b,a)
- */
- mix(color1, color2, weight) {
- if (!this.isCalculableColor(color1) || !this.isCalculableColor(color2)) {
- return color1;
- }
- if (typeof weight === 'undefined') {
- weight = 0.5;
- }
- weight = 1 - this.adjust(weight, [0, 1]);
- var w = weight * 2 - 1;
- var data1 = this.getData(this.toRGBA(color1));
- var data2 = this.getData(this.toRGBA(color2));
- var d = data1[3] - data2[3];
- var weight1 = (((w * d === -1) ? w : (w + d) / (1 + w * d)) + 1) / 2;
- var weight2 = 1 - weight1;
- var data = [];
- for (var i = 0; i < 3; i++) {
- data[i] = data1[i] * weight1 + data2[i] * weight2;
- }
- var alpha = data1[3] * weight + data2[3] * (1 - weight);
- alpha = Math.max(0, Math.min(1, alpha));
- if (data1[3] === 1 && data2[3] === 1) {// 不考虑透明度
- return this.toColor(data, 'rgb');
- }
- data[3] = alpha;
- return this.toColor(data, 'rgba');
- }
- /**
- * @function LevelRenderer.Tool.Color.prototype.random
- * @description 随机颜色
- * @returns {string} 颜色值,#rrggbb格式
- */
- random() {
- return '#' + Math.random().toString(16).slice(2, 8);
- }
- /**
- * @function LevelRenderer.Tool.Color.prototype.getData
- * @description 获取颜色值数组,返回值范围。
- * RGB 范围[0-255]
- * HSL/HSV/HSB 范围[0-1]
- * A透明度范围[0-1]
- * 支持格式:
- * #rgb
- * #rrggbb
- * rgb(r,g,b)
- * rgb(r%,g%,b%)
- * rgba(r,g,b,a)
- * hsb(h,s,b) // hsv与hsb等价
- * hsb(h%,s%,b%)
- * hsba(h,s,b,a)
- * hsl(h,s,l)
- * hsl(h%,s%,l%)
- * hsla(h,s,l,a)
- * @param {string} color - 颜色。
- * @returns {Array.<number>} 颜色值数组或null
- */
- getData(color) {
- color = this.normalize(color);
- var r = color.match(this.colorRegExp);
- if (r === null) {
- throw new Error('The color format error'); // 颜色格式错误
- }
- var d;
- var a;
- var data = [];
- var rgb;
- if (r[2]) {
- // #rrggbb
- d = r[2].replace('#', '').split('');
- rgb = [d[0] + d[1], d[2] + d[3], d[4] + d[5]];
- data = this.map(rgb,
- function (c) {
- return Color.prototype.adjust.call(this, parseInt(c, 16), [0, 255]);
- }
- );
- } else if (r[4]) {
- // rgb rgba
- var rgba = (r[4]).split(',');
- a = rgba[3];
- rgb = rgba.slice(0, 3);
- data = this.map(
- rgb,
- function (c) {
- c = Math.floor(
- c.indexOf('%') > 0 ? parseInt(c, 0) * 2.55 : c
- );
- return Color.prototype.adjust.call(this, c, [0, 255]);
- }
- );
- if (typeof a !== 'undefined') {
- data.push(this.adjust(parseFloat(a), [0, 1]));
- }
- } else if (r[5] || r[6]) {
- // hsb hsba hsl hsla
- var hsxa = (r[5] || r[6]).split(',');
- var h = parseInt(hsxa[0], 0) / 360;
- var s = hsxa[1];
- var x = hsxa[2];
- a = hsxa[3];
- data = this.map([s, x],
- function (c) {
- return Color.prototype.adjust.call(this, parseFloat(c) / 100, [0, 1]);
- }
- );
- data.unshift(h);
- if (typeof a !== 'undefined') {
- data.push(this.adjust(parseFloat(a), [0, 1]));
- }
- }
- return data;
- }
- /**
- * @function LevelRenderer.Tool.Color.prototype.alpha
- * @description 设置颜色透明度
- * @param {string} color - 颜色。
- * @param {number} a - 透明度,区间[0,1]。
- * @returns {string} rgba颜色值
- */
- alpha(color, a) {
- if (!this.isCalculableColor(color)) {
- return color;
- }
- if (a === null) {
- a = 1;
- }
- var data = this.getData(this.toRGBA(color));
- data[3] = this.adjust(Number(a).toFixed(4), [0, 1]);
- return this.toColor(data, 'rgba');
- }
- /**
- * @function LevelRenderer.Tool.Color.prototype.map
- * @description 数组映射
- * @param {Array} array - 数组。
- * @param {function} fun - 函数。
- * @returns {string} 数组映射结果
- */
- map(array, fun) {
- if (typeof fun !== 'function') {
- throw new TypeError();
- }
- var len = array ? array.length : 0;
- for (var i = 0; i < len; i++) {
- array[i] = fun(array[i]);
- }
- return array;
- }
- /**
- * @function LevelRenderer.Tool.Color.prototype.adjust
- * @description 调整值区间
- * @param {Array.<number>} value - 数组。
- * @param {Array.<number>} region - 区间。
- * @returns {number} 调整后的值
- */
- adjust(value, region) {
- // < to <= & > to >=
- // modify by linzhifeng 2014-05-25 because -0 == 0
- if (value <= region[0]) {
- value = region[0];
- } else if (value >= region[1]) {
- value = region[1];
- }
- return value;
- }
- /**
- * @function LevelRenderer.Tool.Color.prototype.isCalculableColor
- * @description 判断是否是可计算的颜色
- * @param {string} color - 颜色。
- * @returns {boolean} 是否是可计算的颜色
- */
- isCalculableColor(color) {
- return color instanceof Array || typeof color === 'string';
- }
- /**
- * @function LevelRenderer.Tool.Color.prototype._HSV_2_RGB。参见{@link http://www.easyrgb.com/index.php?X=MATH}
- */
- _HSV_2_RGB(data) {
- var H = data[0];
- var S = data[1];
- var V = data[2];
- // HSV from 0 to 1
- var R;
- var G;
- var B;
- if (S === 0) {
- R = V * 255;
- G = V * 255;
- B = V * 255;
- } else {
- var h = H * 6;
- if (h === 6) {
- h = 0;
- }
- var i = h | 0;
- var v1 = V * (1 - S);
- var v2 = V * (1 - S * (h - i));
- var v3 = V * (1 - S * (1 - (h - i)));
- var r = 0;
- var g = 0;
- var b = 0;
- if (i === 0) {
- r = V;
- g = v3;
- b = v1;
- } else if (i === 1) {
- r = v2;
- g = V;
- b = v1;
- } else if (i === 2) {
- r = v1;
- g = V;
- b = v3;
- } else if (i === 3) {
- r = v1;
- g = v2;
- b = V;
- } else if (i === 4) {
- r = v3;
- g = v1;
- b = V;
- } else {
- r = V;
- g = v1;
- b = v2;
- }
- // RGB results from 0 to 255
- R = r * 255;
- G = g * 255;
- B = b * 255;
- }
- return [R, G, B];
- }
- /**
- * @function LevelRenderer.Tool.Color.prototype._HSL_2_RGB。参见{@link http://www.easyrgb.com/index.php?X=MATH}
- */
- _HSL_2_RGB(data) {
- var H = data[0];
- var S = data[1];
- var L = data[2];
- // HSL from 0 to 1
- var R;
- var G;
- var B;
- if (S === 0) {
- R = L * 255;
- G = L * 255;
- B = L * 255;
- } else {
- var v2;
- if (L < 0.5) {
- v2 = L * (1 + S);
- } else {
- v2 = (L + S) - (S * L);
- }
- var v1 = 2 * L - v2;
- R = 255 * this._HUE_2_RGB(v1, v2, H + (1 / 3));
- G = 255 * this._HUE_2_RGB(v1, v2, H);
- B = 255 * this._HUE_2_RGB(v1, v2, H - (1 / 3));
- }
- return [R, G, B];
- }
- /**
- * @function LevelRenderer.Tool.Color.prototype._HUE_2_RGB。参见{@link http://www.easyrgb.com/index.php?X=MATH}
- */
- _HUE_2_RGB(v1, v2, vH) {
- if (vH < 0) {
- vH += 1;
- }
- if (vH > 1) {
- vH -= 1;
- }
- if ((6 * vH) < 1) {
- return (v1 + (v2 - v1) * 6 * vH);
- }
- if ((2 * vH) < 1) {
- return (v2);
- }
- if ((3 * vH) < 2) {
- return (v1 + (v2 - v1) * ((2 / 3) - vH) * 6);
- }
- return v1;
- }
- /**
- * @function LevelRenderer.Tool.Color.prototype._RGB_2_HSB。参见{@link http://www.easyrgb.com/index.php?X=MATH}
- */
- _RGB_2_HSB(data) {
- // RGB from 0 to 255
- var R = (data[0] / 255);
- var G = (data[1] / 255);
- var B = (data[2] / 255);
- var vMin = Math.min(R, G, B); // Min. value of RGB
- var vMax = Math.max(R, G, B); // Max. value of RGB
- var delta = vMax - vMin; // Delta RGB value
- var V = vMax;
- var H;
- var S;
- // HSV results from 0 to 1
- if (delta === 0) {
- H = 0;
- S = 0;
- } else {
- S = delta / vMax;
- var deltaR = (((vMax - R) / 6) + (delta / 2)) / delta;
- var deltaG = (((vMax - G) / 6) + (delta / 2)) / delta;
- var deltaB = (((vMax - B) / 6) + (delta / 2)) / delta;
- if (R === vMax) {
- H = deltaB - deltaG;
- } else if (G === vMax) {
- H = (1 / 3) + deltaR - deltaB;
- } else if (B === vMax) {
- H = (2 / 3) + deltaG - deltaR;
- }
- if (H < 0) {
- H += 1;
- }
- if (H > 1) {
- H -= 1;
- }
- }
- H = H * 360;
- S = S * 100;
- V = V * 100;
- return [H, S, V];
- }
- /**
- * @function LevelRenderer.Tool.Color.prototype._RGB_2_HSL。参见{@link http://www.easyrgb.com/index.php?X=MATH}
- */
- _RGB_2_HSL(data) {
- // RGB from 0 to 255
- var R = (data[0] / 255);
- var G = (data[1] / 255);
- var B = (data[2] / 255);
- var vMin = Math.min(R, G, B); // Min. value of RGB
- var vMax = Math.max(R, G, B); // Max. value of RGB
- var delta = vMax - vMin; // Delta RGB value
- var L = (vMax + vMin) / 2;
- var H;
- var S;
- // HSL results from 0 to 1
- if (delta === 0) {
- H = 0;
- S = 0;
- } else {
- if (L < 0.5) {
- S = delta / (vMax + vMin);
- } else {
- S = delta / (2 - vMax - vMin);
- }
- var deltaR = (((vMax - R) / 6) + (delta / 2)) / delta;
- var deltaG = (((vMax - G) / 6) + (delta / 2)) / delta;
- var deltaB = (((vMax - B) / 6) + (delta / 2)) / delta;
- if (R === vMax) {
- H = deltaB - deltaG;
- } else if (G === vMax) {
- H = (1 / 3) + deltaR - deltaB;
- } else if (B === vMax) {
- H = (2 / 3) + deltaG - deltaR;
- }
- if (H < 0) {
- H += 1;
- }
- if (H > 1) {
- H -= 1;
- }
- }
- H = H * 360;
- S = S * 100;
- L = L * 100;
- return [H, S, L];
- }
- }
- ;// CONCATENATED MODULE: ./src/common/util/ColorsPickerUtil.js
- var ColorRender = new Color();
- // let "http://www.qzu.zj.cn": "#bd10e0"
- // "www.qzct.net": "#7ed321" = new LevelRenderer.Tool.Color();
- /**
- * @name ColorsPickerUtil
- * @namespace
- * @category BaseTypes Util
- * @classdesc 色带选择器工具类 用于1、创建canvas对象,2、从几种颜色中获取一定数量的渐变色
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.ColorsPickerUtil.createCanvas();
- *
- * // 弃用的写法
- * const result = SuperMap.ColorsPickerUtil.createCanvas();
- *
- * </script>
- *
- * // ES6 Import
- * import { ColorsPickerUtil } from '{npm}';
- *
- * const result = ColorsPickerUtil.createCanvas();
- * ```
- */
- class ColorsPickerUtil {
- /**
- * @function ColorsPickerUtil.createCanvas
- * @description 创建DOM canvas
- * @param {number} height - canvas 高度。
- * @param {number} width - canvas 宽度。
- */
- static createCanvas (height, width){
- var canvas = document.createElement("canvas");
- canvas.height = height;
- canvas.width = width;
- return canvas.getContext("2d");
- }
- /**
- * @function ColorsPickerUtil.getLinearGradient
- * @description 线性渐变。
- * @param {number} x0 - 渐变起点 x 坐标。
- * @param {number} y0 - 渐变起点 y 坐标。
- * @param {number} x1 - 渐变终点 x 坐标。
- * @param {number} y1 - 渐变终点 y 坐标。
- * @param {Array} colorList 颜色列表。
- * @returns {CanvasGradient} Cavans 渐变颜色。
- */
- static getLinearGradient (x0, y0, x1, y1, colorList){
- if (!this._ctx) {
- this._ctx = this.getContext();
- }
- var gradient = this._ctx.createLinearGradient(x0, y0, x1, y1);
- var leng = colorList.length;
- var add = 1/(leng -1);
- var offset = 0;
- for (var i = 0; i < leng; i++) {
- gradient.addColorStop(offset, colorList[i]);
- offset += add;
- }
- gradient.__nonRecursion = true;
- return gradient;
- }
- /**
- * @function ColorsPickerUtil.getContext
- * @description 获取 Cavans 上下文。
- * @returns {Object} Cavans 上下文。
- */
- static getContext () {
- if (!this._ctx) {
- this._ctx = document.createElement('canvas').getContext('2d');
- }
- return this._ctx;
- }
- /**
- * @function ColorsPickerUtil.getStepColors
- * @description 获取两种颜色之间渐变颜色数组。
- * @param {string} start - 起始颜色。
- * @param {string} end - 结束颜色。
- * @param {number} step - 渐变级数。
- * @returns {Array} 颜色数组。
- */
- static getStepColors (start, end, step){
- start = ColorRender.toRGBA(start);
- end = ColorRender.toRGBA(end);
- start = ColorRender.getData(start);
- end = ColorRender.getData(end);
- var colors = [];
- var stepR = (end[0] - start[0]) / step;
- var stepG = (end[1] - start[1]) / step;
- var stepB = (end[2] - start[2]) / step;
- var stepA = (end[3] - start[3]) / step;
- // 生成颜色集合
- // fix by linfeng 颜色堆积
- for (var i = 0, r = start[0], g = start[1], b = start[2], a = start[3]; i < step; i++) {
- colors[i] = ColorRender.toColor([
- ColorRender.adjust(Math.floor(r), [ 0, 255 ]),
- ColorRender.adjust(Math.floor(g), [ 0, 255 ]),
- ColorRender.adjust(Math.floor(b), [ 0, 255 ]),
- a.toFixed(4) - 0
- ],'hex');
- r += stepR;
- g += stepG;
- b += stepB;
- a += stepA;
- }
- r = end[0];
- g = end[1];
- b = end[2];
- a = end[3];
- colors[i] = ColorRender.toColor([r, g, b, a], 'hex');
- return colors;
- }
- /**
- * @function ColorsPickerUtil.getGradientColors
- * @description 获取指定级数的渐变颜色数组。
- * @param {Array.<string>} colors - 颜色组。
- * @param {number} total - 颜色总数。
- * @param {string} themeType - 专题类型。
- * @returns {Array.<string>} 颜色数组。
- */
- static getGradientColors (colors, total, themeType){
- var ret = [], step;
- var i, n, len = colors.length;
- if (total === undefined) {
- return;
- }
- if(len >= total){
- if(themeType === 'RANGE'){
- for(i = 0; i<total; i++){
- ret.push(colors[i]);
- }
- }else {
- //1/2前后取色
- for(i = 0; i<total; i++){
- let ii = Math.floor(i/2);
- if(i%2 === 0){
- ret.push(colors[ii]);
- }else {
- let index = colors.length -1 - ii;
- ret.push(colors[index]);
- }
- }
- }
- } else {
- step = Math.ceil(total/(len-1));
- for (i = 0, n = len - 1; i < n; i++) {
- var steps = this.getStepColors(colors[i], colors[i + 1], step);
- if (i < n - 1) {
- steps.pop();
- }
- ret = ret.concat(steps);
- }
- //删除多余元素
- var nouse = ret.length - total;
- for(var j = 0, index = 0; j< nouse; j++){
- ret.splice(index+2,1);
- }
- }
- return ret;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/util/ArrayStatistic.js
- /**
- * @name ArrayStatistic
- * @namespace
- * @category BaseTypes Util
- * @classdesc 处理数组。
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.ArrayStatistic.newInstance();
- *
- * // 弃用的写法
- * const result = SuperMap.ArrayStatistic.newInstance();
- *
- * </script>
- *
- * // ES6 Import
- * import { ArrayStatistic } from '{npm}';
- *
- * const result = ArrayStatistic.newInstance();
- * ```
- */
- class ArrayStatistic {
- // geostatsInstance: null,
- /**
- * @function ArrayStatistic.newInstance
- * @description 初始化插件实例。
- */
- static newInstance() {
- // if(!this.geostatsInstance) {
- // // this.geostatsInstance = new geostats();
- // // }
- // window.dataList = [];
- if(!this.geostatsInstance) {
- this.geostatsInstance = new window.geostats();
-
- }
- return this.geostatsInstance;
- }
- /**
- * @function ArrayStatistic.getInstance
- * @description 设置需要被处理的数组。
- * @param {Array} array - 数组。
- */
- static getInstance(array) {
- let instance = this.newInstance();
- instance.setSerie(array);
- return instance;
- }
- /**
- * @function ArrayStatistic.getArrayStatistic
- * @description 获取数组统计的值。
- * @param {Array.<number>} array - 需要统计的数组。
- * @param {string} type - 统计方法。
- */
- static getArrayStatistic(array, type){
- if(!array.length) {
- return 0;
- }
- if(type === "Sum" || type === "求和"){
- return this.getSum(array);
- } else if(type === "Maximum" || type === "最大值"){
- return this.getMax(array);
- } else if(type === "Minimum" || type === "最小值"){
- return this.getMin(array);
- } else if(type === "Average" || type === "平均值"){
- return this.getMean(array);
- } else if(type === "Median" || type === "中位数"){
- return this.getMedian(array);
- } else if(type === "times" || type === "计数"){
- return this.getTimes(array);
- }
- }
- /**
- * @function ArrayStatistic.getArraySegments
- * @description 获取数组分段后的数值。
- * @param {Array.<number>} array - 需要分段的数组。
- * @param {string} type - 分段方法。
- * @param {number} segNum - 分段个数。
- */
- static getArraySegments(array, type, segNum) {
- if(type === "offset") {
- return this.getEqInterval(array, segNum);
- } else if(type === "jenks") {
- return this.getJenks(array, segNum);
- } else if(type === "square") {
- // 数据都必须 >= 0
- let minValue = this.getMin(array);
- if(minValue >= 0){
- return this.getSqrtInterval(array, segNum);
- }else {
- //console.log('数据都必须 >= 0');
- // Util.showMessage(Language.hasNegValue + Language.noSupportRange, 'ERROR');
- return false;
- }
- } else if(type === "logarithm") {
- // 数据都必须 > 0
- let minValue = this.getMin(array);
- if(minValue > 0){
- return this.getGeometricProgression(array, segNum);
- }else {
- //console.log('数据都必须 > 0');
- // Util.showMessage(Language.hasZeroNegValue + Language.noSupportRange, 'ERROR');
- return false;
- }
- }
- }
- /**
- * @function ArrayStatistic.getSum
- * @description 求和。
- * @param {Array.<number>} array 需要求和的参数。
- * @returns {number} 返回求和结果。
- */
- static getSum(array){
- return this.getInstance(array).sum();
- }
- /**
- * @function ArrayStatistic.getMax
- * @description 最大值。
- * @param {Array.<number>} array 需要求最大值的参数。
- * @returns {number} 返回最大值。
- */
- static getMax(array){
- return this.getInstance(array).max();
- }
- /**
- * @function ArrayStatistic.getMin
- * @description 最小值。
- * @param {Array.<number>} array 需要求最小值的参数。
- * @returns {number} 返回最小值。
- */
- static getMin(array){
- return this.getInstance(array).min();
- }
- /**
- * @function ArrayStatistic.getMean
- * @description 求平均数。
- * @param {Array.<number>} array 需要求平均数的参数。
- * @returns {number} 返回平均数。
- */
- static getMean(array){
- return this.getInstance(array).mean();
- }
- /**
- * @function ArrayStatistic.getMedian
- * @description 求中位数。
- * @param {Array.<number>} array 需要求中位数的参数。
- * @returns {number} 返回中位数。
- */
- static getMedian(array) {
- return this.getInstance(array).median();
- }
- /**
- * @function ArrayStatistic.getTimes
- * @description 计数。
- * @param {Array.<number>} array 需要计数的参数。
- * @returns {number} 返回计数结果。
- */
- static getTimes(array) {
- return array.length;
- }
- /**
- * @function ArrayStatistic.getEqInterval
- * @description 等距分段法。
- * @param {Array} array 需要进行等距分段的数组。
- * @param {number} segNum 分段个数。
- */
- static getEqInterval(array, segNum) {
- return this.getInstance(array).getClassEqInterval(segNum);
- }
-
- /**
- * @function ArrayStatistic.getJenks
- * @description 自然断裂法。
- * @param {Array} array 需要进行自然断裂的参数。
- * @param {number} segNum 分段个数。
- */
- static getJenks(array, segNum) {
- return this.getInstance(array).getClassJenks(segNum);
- }
- /**
- * @function ArrayStatistic.getSqrtInterval
- * @description 平方根分段法。
- * @param {Array} array 需要进行平方根分段的参数。
- * @param {number} segNum 分段个数。
- */
- static getSqrtInterval(array, segNum) {
- array = array.map(function(value) {
- return Math.sqrt(value);
- });
- let breaks = this.getInstance(array).getClassEqInterval(segNum);
- return (
- breaks.map(function(value) {
- return value * value;
- })
- )
- }
- /**
- * @function ArrayStatistic.getGeometricProgression
- * @description 对数分段法。
- * @param {Array} array 需要进行对数分段的参数。
- * @param {number} segNum 分段个数。
- */
- static getGeometricProgression(array, segNum) {
- return this.getInstance(array).getClassGeometricProgression(segNum);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/util/MapCalculateUtil.js
- /**
- * @function getMeterPerMapUnit
- * @description 单位换算,把米|度|千米|英寸|英尺换成米。
- * @category BaseTypes Util
- * @param {string} mapUnit 地图单位。
- * @returns {number} 返回地图的距离单位。
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.getMeterPerMapUnit(mapUnit);
- *
- * </script>
- *
- * // ES6 Import
- * import { getMeterPerMapUnit } from '{npm}';
- *
- * const result = getMeterPerMapUnit(mapUnit);
- * ```
- */
- var getMeterPerMapUnit = function(mapUnit) {
- var earchRadiusInMeters = 6378137;
- var meterPerMapUnit;
- if (mapUnit === Unit.METER) {
- meterPerMapUnit = 1;
- } else if (mapUnit === Unit.DEGREE) {
- // 每度表示多少米。
- meterPerMapUnit = (Math.PI * 2 * earchRadiusInMeters) / 360;
- } else if (mapUnit === Unit.KILOMETER) {
- meterPerMapUnit = 1.0e-3;
- } else if (mapUnit === Unit.INCH) {
- meterPerMapUnit = 1 / 2.5399999918e-2;
- } else if (mapUnit === Unit.FOOT) {
- meterPerMapUnit = 0.3048;
- } else {
- return meterPerMapUnit;
- }
- return meterPerMapUnit;
- };
- /**
- * @function getWrapNum
- * @description 获取该坐标系的经纬度范围的经度或纬度。
- * @category BaseTypes Util
- * @param {number} x 经度或纬度。
- * @param {boolean} includeMax 是否获取经度或纬度的最大值。
- * @param {boolean} includeMin 是否获取经度或纬度的最小值。
- * @param {number} range 坐标系的经纬度范围。
- * @returns {number} 返回经度或纬度的值。
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.getWrapNum(x, includeMax, includeMin, range);
- *
- * </script>
- *
- * // ES6 Import
- * import { getWrapNum } from '{npm}';
- *
- * const result = getWrapNum(x, includeMax, includeMin, range);
- * ```
- */
- function getWrapNum(x, includeMax = true, includeMin = true, range = [-180, 180]) {
- var max = range[1],
- min = range[0],
- d = max - min;
- if (x === max && includeMax) {
- return x;
- }
- if (x === min && includeMin) {
- return x;
- }
- var tmp = (((x - min) % d) + d) % d;
- if (tmp === 0 && includeMax) {
- return max;
- }
- return ((((x - min) % d) + d) % d) + min;
- }
- /**
- * @function conversionDegree
- * @description 转换经纬度。
- * @category BaseTypes Util
- * @param {number} degrees 经度或纬度。
- * @returns {string} 返回度分秒。
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.conversionDegree(degrees);
- *
- * </script>
- *
- * // ES6 Import
- * import { conversionDegree } from '{npm}';
- *
- * const result = conversionDegree(degrees);
- * ```
- */
- function conversionDegree(degrees) {
- const degree = parseInt(degrees);
- let fraction = parseInt((degrees - degree) * 60);
- let second = parseInt(((degrees - degree) * 60 - fraction) * 60);
- fraction = parseInt(fraction / 10) === 0 ? `0${fraction}` : fraction;
- second = parseInt(second / 10) === 0 ? `0${second}` : second;
- return `${degree}°${fraction}'${second}`;
- }
- /**
- * @function scalesToResolutions
- * @description 通过比例尺数组计算分辨率数组,没有传入比例尺数组时通过地图范围与地图最大级别进行计算。
- * @version 11.0.1
- * @param {Array} scales - 比例尺数组。
- * @param {Object} bounds - 地图范围。
- * @param {number} dpi - 屏幕分辨率。
- * @param {string} mapUnit - 地图单位。
- * @param {number} [level=22] - 地图最大级别。
- * @returns {number} 分辨率。
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.scalesToResolutions(scales, bounds, dpi, mapUnit);
- *
- * </script>
- *
- * // ES6 Import
- * import { scalesToResolutions } from '{npm}';
- *
- * const result = scalesToResolutions(scales, bounds, dpi, mapUnit);
- * ```
- */
- function scalesToResolutions(scales, bounds, dpi, mapUnit, level = 22) {
- var resolutions = [];
- if (scales && scales.length > 0) {
- for (let i = 0; i < scales.length; i++) {
- resolutions.push(scaleToResolution(scales[i], dpi, mapUnit));
- }
- } else {
- const maxReolution = Math.abs(bounds.left - bounds.right) / 256;
- for (let i = 0; i < level; i++) {
- resolutions.push(maxReolution / Math.pow(2, i));
- }
- }
- return resolutions.sort(function (a, b) {
- return b - a;
- });
- }
- /**
- * @function getZoomByResolution
- * @description 通过分辨率获取地图级别。
- * @version 11.0.1
- * @param {number} resolution - 分辨率。
- * @param {Array} resolutions - 分辨率数组。
- * @returns {number} 地图级别。
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.getZoomByResolution(resolution, resolutions);
- *
- * </script>
- *
- * // ES6 Import
- * import { getZoomByResolution } from '{npm}';
- *
- * const result = getZoomByResolution(resolution, resolutions);
- * ```
- */
- function getZoomByResolution(resolution, resolutions) {
- let zoom = 0;
- let minDistance;
- for (let i = 0; i < resolutions.length; i++) {
- if (i === 0) {
- minDistance = Math.abs(resolution - resolutions[i]);
- }
- if (minDistance > Math.abs(resolution - resolutions[i])) {
- minDistance = Math.abs(resolution - resolutions[i]);
- zoom = i;
- }
- }
- return zoom;
- }
- /**
- * @function scaleToResolution
- * @description 通过比例尺计算分辨率。
- * @version 11.0.1
- * @param {number} scale - 比例尺。
- * @param {number} dpi - 屏幕分辨率。
- * @param {string} mapUnit - 地图单位。
- * @returns {number} 分辨率。
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.scaleToResolution(scale, dpi, mapUnit);
- *
- * </script>
- *
- * // ES6 Import
- * import { scaleToResolution } from '{npm}';
- *
- * const result = scaleToResolution(scale, dpi, mapUnit);
- * ```
- */
- function scaleToResolution(scale, dpi, mapUnit) {
- const inchPerMeter = 1 / 0.0254;
- const meterPerMapUnitValue = getMeterPerMapUnit(mapUnit);
- const resolution = 1 / (scale * dpi * inchPerMeter * meterPerMapUnitValue);
- return resolution;
- }
- ;// CONCATENATED MODULE: ./src/common/util/index.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- // EXTERNAL MODULE: ./node_modules/lodash.topairs/index.js
- var lodash_topairs = __webpack_require__(52);
- var lodash_topairs_default = /*#__PURE__*/__webpack_require__.n(lodash_topairs);
- ;// CONCATENATED MODULE: ./src/common/style/CartoCSS.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class CartoCSS
- * @deprecatedclass SuperMap.CartoCSS
- * @classdesc CartoCSS 解析类,其主要功能为将 CartoCSS 字符串解析为 CartoCSS 的 shader 属性风格对象。
- * @category BaseTypes Style
- * @param {string} cartoStr - 样式表字符串
- * @example
- * var cartocss = "@provinceLineColor:#ddd;
- * #China_Provinces_L___China400{
- * line-dasharray:10,10;
- * line-color:@provinceLineColor;
- * line-width:1;
- * }";
- * new CartoCSS(cartocss);
- * @usage
- */
- /*eslint no-useless-escape: "off"*/
- class CartoCSS {
- constructor(cartoStr) {
- this.env = null;
- /**
- * @member CartoCSS.prototype.parser
- * @description 解析器
- */
- this.parser = null;
- /**
- * @member CartoCSS.prototype.ruleSet
- * @description CartoCSS 规则对象
- */
- this.ruleSet = null;
- /**
- * @member CartoCSS.prototype.cartoStr
- * @description CartoCSS 样式表字符串
- */
- this.cartoStr = "";
- /**
- * @member CartoCSS.prototype.shaders
- * @description Carto 着色器集
- */
- this.shaders = null;
- if (typeof cartoStr === "string") {
- this.cartoStr = cartoStr;
- this.env = {
- frames: [],
- errors: [],
- error: function (obj) {
- this.errors.push(obj);
- }
- };
- this.parser = this.getParser(this.env);
- this.parse(cartoStr);
- this.shaders = this.toShaders();
- }
- }
- /**
- * @function CartoCSS.prototype.getParser
- * @description 获取 CartoCSS 解析器
- */
- getParser(env) {
- var input, // LeSS input string
- i, // current index in `input`
- j, // current chunk
- temp, // temporarily holds a chunk's state, for backtracking
- memo, // temporarily holds `i`, when backtracking
- furthest, // furthest index the parser has gone to
- chunks, // chunkified input
- current, // index of current chunk, in `input`
- parser;
- var that = this;
- // This function is called after all files
- // have been imported through `@import`.
- var finish = function () {//NOSONAR
- //所有文件导入完成之后调用
- };
- function save() {
- temp = chunks[j];
- memo = i;
- current = i;
- }
- function restore() {
- chunks[j] = temp;
- i = memo;
- current = i;
- }
- function sync() {
- if (i > current) {
- chunks[j] = chunks[j].slice(i - current);
- current = i;
- }
- }
- //
- // Parse from a token, regexp or string, and move forward if match
- //
- function _match(tok) {
- var match, length, c, endIndex;
- // Non-terminal
- if (tok instanceof Function) {
- return tok.call(parser.parsers);
- // Terminal
- // Either match a single character in the input,
- // or match a regexp in the current chunk (chunk[j]).
- } else if (typeof(tok) === 'string') {
- match = input.charAt(i) === tok ? tok : null;
- length = 1;
- sync();
- } else {
- sync();
- match = tok.exec(chunks[j]);
- if (match) {
- length = match[0].length;
- } else {
- return null;
- }
- }
- // The match is confirmed, add the match length to `i`,
- // and consume any extra white-space characters (' ' || '\n')
- // which come after that. The reason for this is that LeSS's
- // grammar is mostly white-space insensitive.
- if (match) {
- var mem = i += length;
- endIndex = i + chunks[j].length - length;
- while (i < endIndex) {
- c = input.charCodeAt(i);
- if (!(c === 32 || c === 10 || c === 9)) {
- break;
- }
- i++;
- }
- chunks[j] = chunks[j].slice(length + (i - mem));
- current = i;
- if (chunks[j].length === 0 && j < chunks.length - 1) {
- j++;
- }
- if (typeof(match) === 'string') {
- return match;
- } else {
- return match.length === 1 ? match[0] : match;
- }
- }
- }
- // Same as _match(), but don't change the state of the parser,
- // just return the match.
- function peek(tok) {
- if (typeof(tok) === 'string') {
- return input.charAt(i) === tok;
- } else {
- return !!tok.test(chunks[j]);
- }
- }
- // Make an error object from a passed set of properties.
- // Accepted properties:
- // - `message`: Text of the error message.
- // - `filename`: Filename where the error occurred.
- // - `index`: Char. index where the error occurred.
- function makeError(err) {
- var einput;
- var defautls = {
- index: furthest,
- filename: env.filename,
- message: 'Parse error.',
- line: 0,
- column: -1
- };
- for (var prop in defautls) {
- if (err[prop] === 0) {
- err[prop] = defautls[prop];
- }
- }
- if (err.filename && that.env.inputs && that.env.inputs[err.filename]) {
- einput = that.env.inputs[err.filename];
- } else {
- einput = input;
- }
- err.line = (einput.slice(0, err.index).match(/\n/g) || '').length + 1;
- for (var n = err.index; n >= 0 && einput.charAt(n) !== '\n'; n--) {
- err.column++;
- }
- return new Error([err.filename, err.line, err.column, err.message].join(";"));
- }
- this.env = env = env || {};
- this.env.filename = this.env.filename || null;
- this.env.inputs = this.env.inputs || {};
- // The Parser
- parser = {
- // Parse an input string into an abstract syntax tree.
- // Throws an error on parse errors.
- parse: function (str) {
- var root, error = null;
- i = j = current = furthest = 0;
- chunks = [];
- input = str.replace(/\r\n/g, '\n');
- if (env.filename) {
- that.env.inputs[env.filename] = input;
- }
- // Split the input into chunks.
- chunks = (function (chunks) {
- var j = 0,
- skip = /(?:@\{[\w-]+\}|[^"'`\{\}\/\(\)\\])+/g,
- comment = /\/\*(?:[^*]|\*+[^\/*])*\*+\/|\/\/.*/g,
- string = /"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'|`((?:[^`]|\\.)*)`/g,
- level = 0,
- match,
- chunk = chunks[0],
- inParam;
- for (var i = 0, c, cc; i < input.length;) {
- skip.lastIndex = i;
- if (match = skip.exec(input)) {
- if (match.index === i) {
- i += match[0].length;
- chunk.push(match[0]);
- }
- }
- c = input.charAt(i);
- comment.lastIndex = string.lastIndex = i;
- if (match = string.exec(input)) {
- if (match.index === i) {
- i += match[0].length;
- chunk.push(match[0]);
- continue;
- }
- }
- if (!inParam && c === '/') {
- cc = input.charAt(i + 1);
- if (cc === '/' || cc === '*') {
- if (match = comment.exec(input)) {
- if (match.index === i) {
- i += match[0].length;
- chunk.push(match[0]);
- continue;
- }
- }
- }
- }
- switch (c) {
- case '{'://NOSONAR
- if (!inParam) {
- level++;
- chunk.push(c);
- break;
- }
- case '}'://NOSONAR
- if (!inParam) {
- level--;
- chunk.push(c);
- chunks[++j] = chunk = [];
- break;
- }
- case '('://NOSONAR
- if (!inParam) {
- inParam = true;
- chunk.push(c);
- break;
- }
- case ')'://NOSONAR
- if (inParam) {
- inParam = false;
- chunk.push(c);
- break;
- }
- default:
- chunk.push(c);
- break;
- }
- i++;
- }
- if (level !== 0) {
- error = {
- index: i - 1,
- type: 'Parse',
- message: (level > 0) ? "missing closing `}`" : "missing opening `{`"
- };
- }
- return chunks.map(function (c) {
- return c.join('');
- });
- })([[]]);
- if (error) {
- throw makeError(error);
- }
- // Sort rules by specificity: this function expects selectors to be
- // split already.
- //
- // Written to be used as a .sort(Function);
- // argument.
- //
- // [1, 0, 0, 467] > [0, 0, 1, 520]
- var specificitySort = function (a, b) {
- var as = a.specificity;
- var bs = b.specificity;
- if (as[0] != bs[0]) {return bs[0] - as[0];}
- if (as[1] != bs[1]) {return bs[1] - as[1];}
- if (as[2] != bs[2]) {return bs[2] - as[2];}
- return bs[3] - as[3];
- };
- // Start with the primary rule.
- // The whole syntax tree is held under a Ruleset node,
- // with the `root` property set to true, so no `{}` are
- // output.
- root = new CartoCSS.Tree.Ruleset([], _match(this.parsers.primary));
- root.root = true;
- // Get an array of Ruleset objects, flattened
- // and sorted according to specificitySort
- root.toList = (function () {
- return function (env) {
- env.error = function (e) {
- if (!env.errors) {env.errors = new Error('');}
- if (env.errors.message) {
- env.errors.message += '\n' + makeError(e).message;
- } else {
- env.errors.message = makeError(e).message;
- }
- };
- env.frames = env.frames || [];
- // call populates Invalid-caused errors
- var definitions = this.flatten([], [], env);
- definitions.sort(specificitySort);
- return definitions;
- };
- })();
- return root;
- },
- // Here in, the parsing rules/functions
- //
- // The basic structure of the syntax tree generated is as follows:
- //
- // Ruleset -> Rule -> Value -> Expression -> Entity
- //
- // In general, most rules will try to parse a token with the `_match()` function, and if the return
- // value is truly, will return a new node, of the relevant type. Sometimes, we need to check
- // first, before parsing, that's when we use `peek()`.
- parsers: {
- // The `primary` rule is the *entry* and *exit* point of the parser.
- // The rules here can appear at any level of the parse tree.
- //
- // The recursive nature of the grammar is an interplay between the `block`
- // rule, which represents `{ ... }`, the `ruleset` rule, and this `primary` rule,
- // as represented by this simplified grammar:
- //
- // primary → (ruleset | rule)+
- // ruleset → selector+ block
- // block → '{' primary '}'
- //
- // Only at one point is the primary rule not called from the
- // block rule: at the root level.
- primary: function () {
- var node, root = [];
- while ((node = _match(this.rule) || _match(this.ruleset) ||
- _match(this.comment)) ||
- _match(/^[\s\n]+/) || (node = _match(this.invalid))) {
- if (node) {root.push(node);}
- }
- return root;
- },
- invalid: function () {
- var chunk = _match(/^[^;\n]*[;\n]/);
- // To fail gracefully, match everything until a semicolon or linebreak.
- if (chunk) {
- return new CartoCSS.Tree.Invalid(chunk, memo);
- }
- },
- // We create a Comment node for CSS comments `/* */`,
- // but keep the LeSS comments `//` silent, by just skipping
- // over them.
- comment: function () {
- var comment;
- if (input.charAt(i) !== '/') {return;}
- if (input.charAt(i + 1) === '/') {
- return new CartoCSS.Tree.Comment(_match(/^\/\/.*/), true);
- } else if (comment = _match(/^\/\*(?:[^*]|\*+[^\/*])*\*+\/\n?/)) {
- return new CartoCSS.Tree.Comment(comment);
- }
- },
- // Entities are tokens which can be found inside an Expression
- entities: {
- // A string, which supports escaping " and ' "milky way" 'he\'s the one!'
- quoted: function () {
- if (input.charAt(i) !== '"' && input.charAt(i) !== "'") {return;}
- var str = _match(/^"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'/);
- if (str) {
- return new CartoCSS.Tree.Quoted(str[1] || str[2]);
- }
- },
- // A reference to a Mapnik field, like [NAME]
- // Behind the scenes, this has the same representation, but Carto
- // needs to be careful to warn when unsupported operations are used.
- field: function () {
- var l = '[', r = ']';
- if (!_match(l)) {return;}
- var field_name = _match(/(^[^\]]+)/);
- if (!_match(r)) {return;}
- if (field_name) {return new CartoCSS.Tree.Field(field_name[1]);}
- },
- // This is a comparison operator
- comparison: function () {
- var str = _match(/^=~|=|!=|<=|>=|<|>/);
- if (str) {
- return str;
- }
- },
- // A catch-all word, such as: hard-light
- // These can start with either a letter or a dash (-),
- // and then contain numbers, underscores, and letters.
- keyword: function () {
- var k = _match(/^[A-Za-z\u4e00-\u9fa5-]+[A-Za-z-0-9\u4e00-\u9fa5_]*/);
- if (k) {
- return new CartoCSS.Tree.Keyword(k);
- }
- },
- // A function call like rgb(255, 0, 255)
- // The arguments are parsed with the `entities.arguments` parser.
- call: function () {
- var name, args;
- if (!(name = /^([\w\-]+|%)\(/.exec(chunks[j]))) {return;}
- name = name[1];
- if (name === 'url') {
- // url() is handled by the url parser instead
- return null;
- } else {
- i += name.length;
- }
- var l = '(', r = ')';
- _match(l); // Parse the '(' and consume whitespace.
- args = _match(this.entities['arguments']);
- if (!_match(r)) {return;}
- if (name) {
- return new CartoCSS.Tree.Call(name, args, i);
- }
- },
- // Arguments are comma-separated expressions
- 'arguments': function () {
- var args = [], arg;
- while (arg = _match(this.expression)) {
- args.push(arg);
- var q = ',';
- if (!_match(q)) {
- break;
- }
- }
- return args;
- },
- literal: function () {
- return _match(this.entities.dimension) ||
- _match(this.entities.keywordcolor) ||
- _match(this.entities.hexcolor) ||
- _match(this.entities.quoted);
- },
- // Parse url() tokens
- //
- // We use a specific rule for urls, because they don't really behave like
- // standard function calls. The difference is that the argument doesn't have
- // to be enclosed within a string, so it can't be parsed as an Expression.
- url: function () {
- var value;
- if (input.charAt(i) !== 'u' || !_match(/^url\(/)) {return;}
- value = _match(this.entities.quoted) || _match(this.entities.variable) ||
- _match(/^[\-\w%@_match\/.&=:;#+?~]+/) || '';
- var r = ')';
- if (!_match(r)) {
- return new CartoCSS.Tree.Invalid(value, memo, 'Missing closing ) in URL.');
- } else {
- return new CartoCSS.Tree.URL((typeof value.value !== 'undefined' ||
- value instanceof CartoCSS.Tree.Variable) ?
- value : new CartoCSS.Tree.Quoted(value));
- }
- },
- // A Variable entity, such as `@fink`, in
- //
- // width: @fink + 2px
- //
- // We use a different parser for variable definitions,
- // see `parsers.variable`.
- variable: function () {
- var name, index = i;
- if (input.charAt(i) === '@' && (name = _match(/^@[\w-]+/))) {
- return new CartoCSS.Tree.Variable(name, index, env.filename);
- }
- },
- hexcolor: function () {
- var rgb;
- if (input.charAt(i) === '#' && (rgb = _match(/^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})/))) {
- return new CartoCSS.Tree.Color(rgb[1]);
- }
- },
- keywordcolor: function () {
- var rgb = chunks[j].match(/^[a-z]+/);
- if (rgb && rgb[0] in CartoCSS.Tree.Reference.data.colors) {
- return new CartoCSS.Tree.Color(CartoCSS.Tree.Reference.data.colors[_match(/^[a-z]+/)]);
- }
- },
- // A Dimension, that is, a number and a unit. The only
- // unit that has an effect is %
- dimension: function () {
- var c = input.charCodeAt(i);
- if ((c > 57 || c < 45) || c === 47) {return;}
- var value = _match(/^(-?\d*\.?\d+(?:[eE][-+]?\d+)?)(\%|\w+)?/);
- if (value) {
- return new CartoCSS.Tree.Dimension(value[1], value[2], memo);
- }
- }
- },
- // The variable part of a variable definition.
- // Used in the `rule` parser. Like @fink:
- variable: function () {
- var name;
- if (input.charAt(i) === '@' && (name = _match(/^(@[\w-]+)\s*:/))) {
- return name[1];
- }
- },
- // Entities are the smallest recognized token,
- // and can be found inside a rule's value.
- entity: function () {
- var property1 = _match(this.entities.call) || _match(this.entities.literal);
- var property2 = _match(this.entities.field) || _match(this.entities.variable);
- var property3 = _match(this.entities.url) || _match(this.entities.keyword);
- return property1 || property2 || property3;
- },
- // A Rule terminator. Note that we use `peek()` to check for '}',
- // because the `block` rule will be expecting it, but we still need to make sure
- // it's there, if ';' was ommitted.
- end: function () {
- var q = ';';
- return _match(q) || peek('}');
- },
- // Elements are the building blocks for Selectors. They consist of
- // an element name, such as a tag a class, or `*`.
- //增加对中文的支持,[\u4e00-\u9fa5]
- element: function () {
- var e = _match(/^(?:[.#][\w\u4e00-\u9fa5\-]+|\*|Map)/);
- if (e) {return new CartoCSS.Tree.Element(e);}
- },
- // Attachments allow adding multiple lines, polygons etc. to an
- // object. There can only be one attachment per selector.
- attachment: function () {
- var s = _match(/^::([\w\-]+(?:\/[\w\-]+)*)/);
- if (s) {return s[1];}
- },
- // Selectors are made out of one or more Elements, see above.
- selector: function () {
- var a, attachment,
- e, elements = [],
- f, filters = new CartoCSS.Tree.Filterset(),
- z, zooms = [],
- segments = 0, conditions = 0;
- while (
- (e = _match(this.element)) ||
- (z = _match(this.zoom)) ||
- (f = _match(this.filter)) ||
- (a = _match(this.attachment))
- ) {
- segments++;
- if (e) {
- elements.push(e);
- } else if (z) {
- zooms.push(z);
- conditions++;
- } else if (f) {
- var err = filters.add(f);
- if (err) {
- throw makeError({
- message: err,
- index: i - 1
- });
- }
- conditions++;
- } else if (attachment) {
- throw makeError({
- message: 'Encountered second attachment name.',
- index: i - 1
- });
- } else {
- attachment = a;
- }
- var c = input.charAt(i);
- if (c === '{' || c === '}' || c === ';' || c === ',') {
- break;
- }
- }
- if (segments) {
- return new CartoCSS.Tree.Selector(filters, zooms, elements, attachment, conditions, memo);
- }
- },
- filter: function () {
- save();
- var key, op, val, l = '[', r = ']';
- if (!_match(l)) {return;}
- if (key = _match(/^[a-zA-Z0-9\-_]+/) ||
- _match(this.entities.quoted) ||
- _match(this.entities.variable) ||
- _match(this.entities.keyword) ||
- _match(this.entities.field)) {
- if (key instanceof CartoCSS.Tree.Quoted) {
- key = new CartoCSS.Tree.Field(key.toString());
- }
- if ((op = _match(this.entities.comparison)) &&
- (val = _match(this.entities.quoted) ||
- _match(this.entities.variable) ||
- _match(this.entities.dimension) ||
- _match(this.entities.keyword) ||
- _match(this.entities.field))) {
- if (!_match(r)) {
- throw makeError({
- message: 'Missing closing ] of filter.',
- index: memo - 1
- });
- }
- if (!key.is) {key = new CartoCSS.Tree.Field(key);}
- return new CartoCSS.Tree.Filter(key, op, val, memo, env.filename);
- }
- }
- },
- zoom: function () {
- save();
- var op, val, r = ']';
- if (_match(/^\[\s*zoom/g) &&
- (op = _match(this.entities.comparison)) &&
- (val = _match(this.entities.variable) || _match(this.entities.dimension)) && _match(r)) {
- return new CartoCSS.Tree.Zoom(op, val, memo);
- } else {
- // backtrack
- restore();
- }
- },
- // The `block` rule is used by `ruleset`
- // It's a wrapper around the `primary` rule, with added `{}`.
- block: function () {
- var content, l = '{', r = '}';
- if (_match(l) && (content = _match(this.primary)) && _match(r)) {
- return content;
- }
- },
- // div, .class, body > p {...}
- ruleset: function () {
- var selectors = [], s, rules, q = ',';
- save();
- while (s = _match(this.selector)) {
- selectors.push(s);
- while (_match(this.comment)) {//NOSONAR
- }
- if (!_match(q)) {
- break;
- }
- while (_match(this.comment)) {//NOSONAR
- }
- }
- if (s) {
- while (_match(this.comment)) {//NOSONAR
- }
- }
- if (selectors.length > 0 && (rules = _match(this.block))) {
- if (selectors.length === 1 &&
- selectors[0].elements.length &&
- selectors[0].elements[0].value === 'Map') {
- var rs = new CartoCSS.Tree.Ruleset(selectors, rules);
- rs.isMap = true;
- return rs;
- }
- return new CartoCSS.Tree.Ruleset(selectors, rules);
- } else {
- // Backtrack
- restore();
- }
- },
- rule: function () {
- var name, value, c = input.charAt(i);
- save();
- if (c === '.' || c === '#') {
- return;
- }
- if (name = _match(this.variable) || _match(this.property)) {
- value = _match(this.value);
- if (value && _match(this.end)) {
- return new CartoCSS.Tree.Rule(name, value, memo, env.filename);
- } else {
- furthest = i;
- restore();
- }
- }
- },
- font: function () {
- var value = [], expression = [], e, q = ',';
- while (e = _match(this.entity)) {
- expression.push(e);
- }
- value.push(new CartoCSS.Tree.Expression(expression));
- if (_match(q)) {
- while (e = _match(this.expression)) {
- value.push(e);
- if (!_match(q)) {
- break;
- }
- }
- }
- return new CartoCSS.Tree.Value(value);
- },
- // A Value is a comma-delimited list of Expressions
- // In a Rule, a Value represents everything after the `:`,
- // and before the `;`.
- value: function () {
- var e, expressions = [], q = ',';
- while (e = _match(this.expression)) {
- expressions.push(e);
- if (!_match(q)) {
- break;
- }
- }
- if (expressions.length > 1) {
- return new CartoCSS.Tree.Value(expressions.map(function (e) {
- return e.value[0];
- }));
- } else if (expressions.length === 1) {
- return new CartoCSS.Tree.Value(expressions);
- }
- },
- // A sub-expression, contained by parenthensis
- sub: function () {
- var e, l = '(', r = ")";
- if (_match(l) && (e = _match(this.expression)) && _match(r)) {
- return e;
- }
- },
- // This is a misnomer because it actually handles multiplication
- // and division.
- multiplication: function () {
- var m, a, op, operation, q = '/';
- if (m = _match(this.operand)) {
- while ((op = (_match(q) || _match('*') || _match('%'))) && (a = _match(this.operand))) {
- operation = new CartoCSS.Tree.Operation(op, [operation || m, a], memo);
- }
- return operation || m;
- }
- },
- addition: function () {
- var m, a, op, operation, plus = '+';
- if (m = _match(this.multiplication)) {
- while ((op = _match(/^[-+]\s+/) || (input.charAt(i - 1) != ' ' && (_match(plus) || _match('-')))) &&
- (a = _match(this.multiplication))) {
- operation = new CartoCSS.Tree.Operation(op, [operation || m, a], memo);
- }
- return operation || m;
- }
- },
- // An operand is anything that can be part of an operation,
- // such as a Color, or a Variable
- operand: function () {
- return _match(this.sub) || _match(this.entity);
- },
- // Expressions either represent mathematical operations,
- // or white-space delimited Entities. @var * 2
- expression: function () {
- var e, entities = [];
- while (e = _match(this.addition) || _match(this.entity)) {
- entities.push(e);
- }
- if (entities.length > 0) {
- return new CartoCSS.Tree.Expression(entities);
- }
- },
- property: function () {
- var name = _match(/^(([a-z][-a-z_0-9]*\/)?\*?-?[-a-z_0-9]+)\s*:/);
- if (name) {return name[1];}
- }
- }
- };
- return parser;
- }
- /**
- * @function CartoCSS.prototype.parse
- * @description 利用CartoCSS解析器里面的parse方法,将CartoCSS样式表字符串转化为CartoCSS规则集
- * @returns {Object} CartoCSS规则集
- */
- parse(str) {
- var parser = this.parser;
- var ruleSet = this.ruleSet = parser.parse(str);
- return ruleSet;
- }
- /**
- * @function CartoCSS.prototype.toShaders
- * @description 将CartoCSS规则集转化为着色器
- * @returns {Array} CartoCSS着色器集
- */
- toShaders() {
- if (this.ruleSet) {
- var ruleset = this.ruleSet;
- if (ruleset) {
- var defs = ruleset.toList(this.env);
- defs.reverse();
- var shaders = {};
- var keys = [];
- this._toShaders(shaders,keys,defs);
- var ordered_shaders = [];
- var done = {};
- for (var i = 0, len0 = defs.length; i < len0; ++i) {
- var def = defs[i];
- var k = def.attachment;
- var shader = shaders[keys[i]];
- var shaderArray = [];
- if (!done[k]) {
- var j = 0;
- for (var prop in shader) {
- if (prop !== 'zoom' && prop !== 'frames' && prop !== "attachment" && prop != "elements") {
- //对layer-index作特殊处理以实现图层的控制
- if (prop === "layer-index") {
- /*var getLayerIndex = Function("attributes", "zoom", "var _value = null;" + shader[prop].join('\n') + "; return _value; ");*/
- var getLayerIndex = function (attributes, zoom) {//NOSONAR
- var _value = null;
- shader[prop].join('\n');
- return _value;
- };
- var layerIndex = getLayerIndex();
- Object.defineProperty(shaderArray, "layerIndex", {
- configurable: true,
- enumerable: false,
- value: layerIndex
- });
- } else {
- shaderArray[j++] = function (ops, shaderArray) {//NOSONAR
- if (!Array.isArray(ops)) {
- return ops;
- }
- var body = ops.join('\n');
- var myKeyword = 'attributes["FEATUREID"]&&attributes["FEATUREID"]';
- var index = body.indexOf(myKeyword);
- if (index >= 0) {
- //对featureID作一些特殊处理,以将featureID提取出来
- if (!shaderArray.featureFilter) {
- var featureFilterStart = index + myKeyword.length;
- var featureFilterEnd = body.indexOf(")", featureFilterStart + 1);
- var featureFilterStr = "featureId&&(featureId" + body.substring(featureFilterStart, featureFilterEnd) + ")";
- /*var featureFilter = Function("featureId", "if(" + featureFilterStr + "){return true;}return false;");*/
- var featureFilter = function (featureId) {
- if (featureFilterStr) {
- return true;
- }
- return false;
- }
- Object.defineProperty(shaderArray, "featureFilter", {
- configurable: true,
- enumerable: false,
- value: featureFilter
- });
- }
- return {
- "property": prop,
- "getValue": Function("attributes", "zoom", "seftFilter", "var _value = null; var isExcute=typeof seftFilter=='function'?sefgFilter():seftFilter;if(isExcute){" + body + ";} return _value; ")//NOSONAR
- };
- } else {
- return {
- "property": prop,
- "getValue": Function("attributes", "zoom", "var _value = null;" + body + "; return _value; ")//NOSONAR
- };
- }
- }(shader[prop], shaderArray);
- }
- }
- }
- Object.defineProperty(shaderArray, "attachment", {
- configurable: true,
- enumerable: false,
- value: k
- });
- Object.defineProperty(shaderArray, "elements", {
- configurable: true,
- enumerable: false,
- value: def.elements
- });
- ordered_shaders.push(shaderArray);
- done[keys[i]] = true;
- }
- Object.defineProperty(shaderArray, "zoom", {
- configurable: true,
- enumerable: false,
- value: def.zoom
- });
- //shader.frames.push(def.frame_offset);
- }
- return ordered_shaders;
- }
- }
- return null;
- }
- _toShaders(shaders, keys,defs) {
- for (let i = 0, len0 = defs.length; i < len0; ++i) {
- let def = defs[i];
- let element_str = [];
- for (let j = 0, len1 = def.elements.length; j < len1; j++) {
- element_str.push(def.elements[j]);
- }
- let filters = def.filters.filters;
- let filterStr = [];
- for (let attr in filters) {
- filterStr.push(filters[attr].id);
- }
- let key = element_str.join("/") + "::" + def.attachment + "_" + filterStr.join("_");
- keys.push(key);
- let shader = shaders[key] = (shaders[key] || {});
- //shader.frames = [];
- shader.zoom = CartoCSS.Tree.Zoom.all;
- let props = def.toJS(this.env);
- for (let v in props) {
- (shader[v] = (shader[v] || [])).push(props[v].join('\n'))
- }
- }
- }
- /**
- * @function CartoCSS.prototype.getShaders
- * @description 获取CartoCSS着色器
- * @returns {Array} 着色器集
- * @example
- * //shaders的结构大概如下:
- * var shaders=[
- * {
- * attachment:"one",
- * elements:[],
- * zoom:23,
- * length:2,
- * 0:{property:"line-color",value:function(attribute,zoom){var _value=null;if(zoom){_value="#123456"}return _vlaue;}},
- * 1:{preoperty:"line-width",value:function(attribute,zoom){var _value=null;if(zoom){_value=3}return _vlaue;}}
- * },
- * {
- * attachment:"two",
- * elements:[],
- * zoom:23,
- * length:2,
- * 0:{property:"polygon-color",value:function(attribute,zoom){var _value=null;if(zoom){_value="#123456"}return _vlaue;}},
- * 1:{property:"line-width",value:function(attribute,zoom){var _value=null;if(zoom){_value=3}return _vlaue;}}
- * }
- * ];
- */
- getShaders() {
- return this.shaders;
- }
- /**
- * @function CartoCSS.prototype.destroy
- * @description CartoCSS解析对象的析构函数,用于销毁CartoCSS解析对象
- */
- destroy() {
- this.cartoStr = null;
- this.env = null;
- this.ruleSet = null;
- this.parser = null;
- this.shaders = null;
- }
- }
- var _mapnik_reference_latest = {
- "version": "2.1.1",
- "style": {
- "filter-mode": {
- "type": [
- "all",
- "first"
- ],
- "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)",
- "default-value": "all",
- "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."
- },
- "image-filters": {
- "css": "image-filters",
- "default-value": "none",
- "default-meaning": "no filters",
- "type": "functions",
- "functions": [
- ["agg-stack-blur", 2],
- ["emboss", 0],
- ["blur", 0],
- ["gray", 0],
- ["sobel", 0],
- ["edge-detect", 0],
- ["x-gradient", 0],
- ["y-gradient", 0],
- ["invert", 0],
- ["sharpen", 0]
- ],
- "doc": "A list of image filters."
- },
- "comp-op": {
- "css": "comp-op",
- "default-value": "src-over",
- "default-meaning": "add the current layer on top of other layers",
- "doc": "Composite operation. This defines how this layer should behave relative to layers atop or below it.",
- "type": ["clear",
- "src",
- "dst",
- "src-over",
- "dst-over",
- "src-in",
- "dst-in",
- "src-out",
- "dst-out",
- "src-atop",
- "dst-atop",
- "xor",
- "plus",
- "minus",
- "multiply",
- "screen",
- "overlay",
- "darken",
- "lighten",
- "color-dodge",
- "color-burn",
- "hard-light",
- "soft-light",
- "difference",
- "exclusion",
- "contrast",
- "invert",
- "invert-rgb",
- "grain-merge",
- "grain-extract",
- "hue",
- "saturation",
- "color",
- "value"
- ]
- },
- "opacity": {
- "css": "opacity",
- "type": "float",
- "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)",
- "default-value": 1,
- "default-meaning": "no separate buffer will be used and no alpha will be applied to the style after rendering"
- }
- },
- "layer": {
- "name": {
- "default-value": "",
- "type": "string",
- "required": true,
- "default-meaning": "No layer name has been provided",
- "doc": "The name of a layer. Can be anything you wish and is not strictly validated, but ideally unique in the map"
- },
- "srs": {
- "default-value": "",
- "type": "string",
- "default-meaning": "No srs value is provided and the value will be inherited from the Map's srs",
- "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'"
- },
- "status": {
- "default-value": true,
- "type": "boolean",
- "default-meaning": "This layer will be marked as active and available for processing",
- "doc": "A property that can be set to false to disable this layer from being processed"
- },
- "minzoom": {
- "default-value": "0",
- "type": "float",
- "default-meaning": "The layer will be visible at the minimum possible scale",
- "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"
- },
- "maxzoom": {
- "default-value": "1.79769e+308",
- "type": "float",
- "default-meaning": "The layer will be visible at the maximum possible scale",
- "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"
- },
- "queryable": {
- "default-value": false,
- "type": "boolean",
- "default-meaning": "The layer will not be available for the direct querying of data values",
- "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"
- },
- "clear-label-cache": {
- "default-value": false,
- "type": "boolean",
- "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",
- "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"
- },
- "group-by": {
- "default-value": "",
- "type": "string",
- "default-meaning": "No special layer grouping will be used during rendering",
- "doc": "https://github.com/mapnik/mapnik/wiki/Grouped-rendering"
- },
- "buffer-size": {
- "default-value": "0",
- "type": "float",
- "default-meaning": "No buffer will be used",
- "doc": "Extra tolerance around the Layer extent (in pixels) used to when querying and (potentially) clipping the layer data during rendering"
- },
- "maximum-extent": {
- "default-value": "none",
- "type": "bbox",
- "default-meaning": "No clipping extent will be used",
- "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."
- }
- },
- "symbolizers": {
- "*": {
- "image-filters": {
- "css": "image-filters",
- "default-value": "none",
- "default-meaning": "no filters",
- "type": "functions",
- "functions": [
- ["agg-stack-blur", 2],
- ["emboss", 0],
- ["blur", 0],
- ["gray", 0],
- ["sobel", 0],
- ["edge-detect", 0],
- ["x-gradient", 0],
- ["y-gradient", 0],
- ["invert", 0],
- ["sharpen", 0]
- ],
- "doc": "A list of image filters."
- },
- "comp-op": {
- "css": "comp-op",
- "default-value": "src-over",
- "default-meaning": "add the current layer on top of other layers",
- "doc": "Composite operation. This defines how this layer should behave relative to layers atop or below it.",
- "type": ["clear",
- "src",
- "dst",
- "src-over",
- "dst-over",
- "src-in",
- "dst-in",
- "src-out",
- "dst-out",
- "src-atop",
- "dst-atop",
- "xor",
- "plus",
- "minus",
- "multiply",
- "screen",
- "overlay",
- "darken",
- "lighten",
- "color-dodge",
- "color-burn",
- "hard-light",
- "soft-light",
- "difference",
- "exclusion",
- "contrast",
- "invert",
- "invert-rgb",
- "grain-merge",
- "grain-extract",
- "hue",
- "saturation",
- "color",
- "value"
- ]
- },
- "opacity": {
- "css": "opacity",
- "type": "float",
- "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)",
- "default-value": 1,
- "default-meaning": "no separate buffer will be used and no alpha will be applied to the style after rendering"
- }
- },
- "map": {
- "background-color": {
- "css": "background-color",
- "default-value": "none",
- "default-meaning": "transparent",
- "type": "color",
- "doc": "Map Background color"
- },
- "background-image": {
- "css": "background-image",
- "type": "uri",
- "default-value": "",
- "default-meaning": "transparent",
- "doc": "An image that is repeated below all features on a map as a background.",
- "description": "Map Background image"
- },
- "srs": {
- "css": "srs",
- "type": "string",
- "default-value": "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs",
- "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",
- "doc": "Map spatial reference (proj4 string)"
- },
- "buffer-size": {
- "css": "buffer-size",
- "default-value": "0",
- "type": "float",
- "default-meaning": "No buffer will be used",
- "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\"."
- },
- "maximum-extent": {
- "css": "",
- "default-value": "none",
- "type": "bbox",
- "default-meaning": "No clipping extent will be used",
- "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."
- },
- "base": {
- "css": "base",
- "default-value": "",
- "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.",
- "type": "string",
- "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."
- },
- "paths-from-xml": {
- "css": "",
- "default-value": true,
- "default-meaning": "Paths read from XML will be interpreted from the location of the XML",
- "type": "boolean",
- "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()"
- },
- "minimum-version": {
- "css": "",
- "default-value": "none",
- "default-meaning": "Mapnik version will not be detected and no error will be thrown about compatibility",
- "type": "string",
- "doc": "The minumum Mapnik version (e.g. 0.7.2) needed to use certain functionality in the stylesheet"
- },
- "font-directory": {
- "css": "font-directory",
- "type": "uri",
- "default-value": "none",
- "default-meaning": "No map-specific fonts will be registered",
- "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)."
- }
- },
- "polygon": {
- "fill": {
- "css": "polygon-fill",
- "type": "color",
- "default-value": "rgba(128,128,128,1)",
- "default-meaning": "gray and fully opaque (alpha = 1), same as rgb(128,128,128)",
- "doc": "Fill color to assign to a polygon"
- },
- "fill-opacity": {
- "css": "polygon-opacity",
- "type": "float",
- "doc": "The opacity of the polygon",
- "default-value": 1,
- "default-meaning": "opaque"
- },
- "gamma": {
- "css": "polygon-gamma",
- "type": "float",
- "default-value": 1,
- "default-meaning": "fully antialiased",
- "range": "0-1",
- "doc": "Level of antialiasing of polygon edges"
- },
- "gamma-method": {
- "css": "polygon-gamma-method",
- "type": [
- "power",
- "linear",
- "none",
- "threshold",
- "multiply"
- ],
- "default-value": "power",
- "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",
- "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"
- },
- "clip": {
- "css": "polygon-clip",
- "type": "boolean",
- "default-value": true,
- "default-meaning": "geometry will be clipped to map bounds before rendering",
- "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."
- },
- "smooth": {
- "css": "polygon-smooth",
- "type": "float",
- "default-value": 0,
- "default-meaning": "no smoothing",
- "range": "0-1",
- "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
- },
- "geometry-transform": {
- "css": "polygon-geometry-transform",
- "type": "functions",
- "default-value": "none",
- "default-meaning": "geometry will not be transformed",
- "doc": "Allows transformation functions to be applied to the geometry.",
- "functions": [
- ["matrix", 6],
- ["translate", 2],
- ["scale", 2],
- ["rotate", 3],
- ["skewX", 1],
- ["skewY", 1]
- ]
- },
- "comp-op": {
- "css": "polygon-comp-op",
- "default-value": "src-over",
- "default-meaning": "add the current symbolizer on top of other symbolizer",
- "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
- "type": ["clear",
- "src",
- "dst",
- "src-over",
- "dst-over",
- "src-in",
- "dst-in",
- "src-out",
- "dst-out",
- "src-atop",
- "dst-atop",
- "xor",
- "plus",
- "minus",
- "multiply",
- "screen",
- "overlay",
- "darken",
- "lighten",
- "color-dodge",
- "color-burn",
- "hard-light",
- "soft-light",
- "difference",
- "exclusion",
- "contrast",
- "invert",
- "invert-rgb",
- "grain-merge",
- "grain-extract",
- "hue",
- "saturation",
- "color",
- "value"
- ]
- }
- },
- "line": {
- "stroke": {
- "css": "line-color",
- "default-value": "rgba(0,0,0,1)",
- "type": "color",
- "default-meaning": "black and fully opaque (alpha = 1), same as rgb(0,0,0)",
- "doc": "The color of a drawn line"
- },
- "stroke-width": {
- "css": "line-width",
- "default-value": 1,
- "type": "float",
- "doc": "The width of a line in pixels"
- },
- "stroke-opacity": {
- "css": "line-opacity",
- "default-value": 1,
- "type": "float",
- "default-meaning": "opaque",
- "doc": "The opacity of a line"
- },
- "stroke-linejoin": {
- "css": "line-join",
- "default-value": "miter",
- "type": [
- "miter",
- "round",
- "bevel"
- ],
- "doc": "The behavior of lines when joining"
- },
- "stroke-linecap": {
- "css": "line-cap",
- "default-value": "butt",
- "type": [
- "butt",
- "round",
- "square"
- ],
- "doc": "The display of line endings"
- },
- "stroke-gamma": {
- "css": "line-gamma",
- "type": "float",
- "default-value": 1,
- "default-meaning": "fully antialiased",
- "range": "0-1",
- "doc": "Level of antialiasing of stroke line"
- },
- "stroke-gamma-method": {
- "css": "line-gamma-method",
- "type": [
- "power",
- "linear",
- "none",
- "threshold",
- "multiply"
- ],
- "default-value": "power",
- "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",
- "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"
- },
- "stroke-dasharray": {
- "css": "line-dasharray",
- "type": "numbers",
- "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.",
- "default-value": "none",
- "default-meaning": "solid line"
- },
- "stroke-dashoffset": {
- "css": "line-dash-offset",
- "type": "numbers",
- "doc": "valid parameter but not currently used in renderers (only exists for experimental svg support in Mapnik which is not yet enabled)",
- "default-value": "none",
- "default-meaning": "solid line"
- },
- "stroke-miterlimit": {
- "css": "line-miterlimit",
- "type": "float",
- "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.",
- "default-value": 4.0,
- "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 )'"
- },
- "clip": {
- "css": "line-clip",
- "type": "boolean",
- "default-value": true,
- "default-meaning": "geometry will be clipped to map bounds before rendering",
- "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."
- },
- "smooth": {
- "css": "line-smooth",
- "type": "float",
- "default-value": 0,
- "default-meaning": "no smoothing",
- "range": "0-1",
- "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
- },
- "offset": {
- "css": "line-offset",
- "type": "float",
- "default-value": 0,
- "default-meaning": "no offset",
- "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)."
- },
- "rasterizer": {
- "css": "line-rasterizer",
- "type": [
- "full",
- "fast"
- ],
- "default-value": "full",
- "doc": "Exposes an alternate AGG rendering method that sacrifices some accuracy for speed."
- },
- "geometry-transform": {
- "css": "line-geometry-transform",
- "type": "functions",
- "default-value": "none",
- "default-meaning": "geometry will not be transformed",
- "doc": "Allows transformation functions to be applied to the geometry.",
- "functions": [
- ["matrix", 6],
- ["translate", 2],
- ["scale", 2],
- ["rotate", 3],
- ["skewX", 1],
- ["skewY", 1]
- ]
- },
- "comp-op": {
- "css": "line-comp-op",
- "default-value": "src-over",
- "default-meaning": "add the current symbolizer on top of other symbolizer",
- "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
- "type": ["clear",
- "src",
- "dst",
- "src-over",
- "dst-over",
- "src-in",
- "dst-in",
- "src-out",
- "dst-out",
- "src-atop",
- "dst-atop",
- "xor",
- "plus",
- "minus",
- "multiply",
- "screen",
- "overlay",
- "darken",
- "lighten",
- "color-dodge",
- "color-burn",
- "hard-light",
- "soft-light",
- "difference",
- "exclusion",
- "contrast",
- "invert",
- "invert-rgb",
- "grain-merge",
- "grain-extract",
- "hue",
- "saturation",
- "color",
- "value"
- ]
- }
- },
- "markers": {
- "file": {
- "css": "marker-file",
- "doc": "An SVG file that this marker shows at each placement. If no file is given, the marker will show an ellipse.",
- "default-value": "",
- "default-meaning": "An ellipse or circle, if width equals height",
- "type": "uri"
- },
- "opacity": {
- "css": "marker-opacity",
- "doc": "The overall opacity of the marker, if set, overrides both the opacity of both the fill and stroke",
- "default-value": 1,
- "default-meaning": "The stroke-opacity and fill-opacity will be used",
- "type": "float"
- },
- "fill-opacity": {
- "css": "marker-fill-opacity",
- "doc": "The fill opacity of the marker",
- "default-value": 1,
- "default-meaning": "opaque",
- "type": "float"
- },
- "stroke": {
- "css": "marker-line-color",
- "doc": "The color of the stroke around a marker shape.",
- "default-value": "black",
- "type": "color"
- },
- "stroke-width": {
- "css": "marker-line-width",
- "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.",
- "type": "float"
- },
- "stroke-opacity": {
- "css": "marker-line-opacity",
- "default-value": 1,
- "default-meaning": "opaque",
- "doc": "The opacity of a line",
- "type": "float"
- },
- "placement": {
- "css": "marker-placement",
- "type": [
- "point",
- "line",
- "interior"
- ],
- "default-value": "point",
- "default-meaning": "Place markers at the center point (centroid) of the geometry",
- "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"
- },
- "multi-policy": {
- "css": "marker-multi-policy",
- "type": [
- "each",
- "whole",
- "largest"
- ],
- "default-value": "each",
- "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",
- "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)."
- },
- "marker-type": {
- "css": "marker-type",
- "type": [
- "arrow",
- "ellipse"
- ],
- "default-value": "ellipse",
- "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)"
- },
- "width": {
- "css": "marker-width",
- "default-value": 10,
- "doc": "The width of the marker, if using one of the default types.",
- "type": "expression"
- },
- "height": {
- "css": "marker-height",
- "default-value": 10,
- "doc": "The height of the marker, if using one of the default types.",
- "type": "expression"
- },
- "fill": {
- "css": "marker-fill",
- "default-value": "blue",
- "doc": "The color of the area of the marker.",
- "type": "color"
- },
- "allow-overlap": {
- "css": "marker-allow-overlap",
- "type": "boolean",
- "default-value": false,
- "doc": "Control whether overlapping markers are shown or hidden.",
- "default-meaning": "Do not allow makers to overlap with each other - overlapping markers will not be shown."
- },
- "ignore-placement": {
- "css": "marker-ignore-placement",
- "type": "boolean",
- "default-value": false,
- "default-meaning": "do not store the bbox of this geometry in the collision detector cache",
- "doc": "value to control whether the placement of the feature will prevent the placement of other features"
- },
- "spacing": {
- "css": "marker-spacing",
- "doc": "Space between repeated labels",
- "default-value": 100,
- "type": "float"
- },
- "max-error": {
- "css": "marker-max-error",
- "type": "float",
- "default-value": 0.2,
- "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."
- },
- "transform": {
- "css": "marker-transform",
- "type": "functions",
- "functions": [
- ["matrix", 6],
- ["translate", 2],
- ["scale", 2],
- ["rotate", 3],
- ["skewX", 1],
- ["skewY", 1]
- ],
- "default-value": "",
- "default-meaning": "No transformation",
- "doc": "SVG transformation definition"
- },
- "clip": {
- "css": "marker-clip",
- "type": "boolean",
- "default-value": true,
- "default-meaning": "geometry will be clipped to map bounds before rendering",
- "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."
- },
- "smooth": {
- "css": "marker-smooth",
- "type": "float",
- "default-value": 0,
- "default-meaning": "no smoothing",
- "range": "0-1",
- "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
- },
- "geometry-transform": {
- "css": "marker-geometry-transform",
- "type": "functions",
- "default-value": "none",
- "default-meaning": "geometry will not be transformed",
- "doc": "Allows transformation functions to be applied to the geometry.",
- "functions": [
- ["matrix", 6],
- ["translate", 2],
- ["scale", 2],
- ["rotate", 3],
- ["skewX", 1],
- ["skewY", 1]
- ]
- },
- "comp-op": {
- "css": "marker-comp-op",
- "default-value": "src-over",
- "default-meaning": "add the current symbolizer on top of other symbolizer",
- "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
- "type": ["clear",
- "src",
- "dst",
- "src-over",
- "dst-over",
- "src-in",
- "dst-in",
- "src-out",
- "dst-out",
- "src-atop",
- "dst-atop",
- "xor",
- "plus",
- "minus",
- "multiply",
- "screen",
- "overlay",
- "darken",
- "lighten",
- "color-dodge",
- "color-burn",
- "hard-light",
- "soft-light",
- "difference",
- "exclusion",
- "contrast",
- "invert",
- "invert-rgb",
- "grain-merge",
- "grain-extract",
- "hue",
- "saturation",
- "color",
- "value"
- ]
- }
- },
- "shield": {
- "name": {
- "css": "shield-name",
- "type": "expression",
- "serialization": "content",
- "doc": "Value to use for a shield\"s text label. Data columns are specified using brackets like [column_name]"
- },
- "file": {
- "css": "shield-file",
- "required": true,
- "type": "uri",
- "default-value": "none",
- "doc": "Image file to render behind the shield text"
- },
- "face-name": {
- "css": "shield-face-name",
- "type": "string",
- "validate": "font",
- "doc": "Font name and style to use for the shield text",
- "default-value": "",
- "required": true
- },
- "unlock-image": {
- "css": "shield-unlock-image",
- "type": "boolean",
- "doc": "This parameter should be set to true if you are trying to position text beside rather than on top of the shield image",
- "default-value": false,
- "default-meaning": "text alignment relative to the shield image uses the center of the image as the anchor for text positioning."
- },
- "size": {
- "css": "shield-size",
- "type": "float",
- "doc": "The size of the shield text in pixels"
- },
- "fill": {
- "css": "shield-fill",
- "type": "color",
- "doc": "The color of the shield text"
- },
- "placement": {
- "css": "shield-placement",
- "type": [
- "point",
- "line",
- "vertex",
- "interior"
- ],
- "default-value": "point",
- "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."
- },
- "avoid-edges": {
- "css": "shield-avoid-edges",
- "doc": "Tell positioning algorithm to avoid labeling near intersection edges.",
- "type": "boolean",
- "default-value": false
- },
- "allow-overlap": {
- "css": "shield-allow-overlap",
- "type": "boolean",
- "default-value": false,
- "doc": "Control whether overlapping shields are shown or hidden.",
- "default-meaning": "Do not allow shields to overlap with other map elements already placed."
- },
- "minimum-distance": {
- "css": "shield-min-distance",
- "type": "float",
- "default-value": 0,
- "doc": "Minimum distance to the next shield symbol, not necessarily the same shield."
- },
- "spacing": {
- "css": "shield-spacing",
- "type": "float",
- "default-value": 0,
- "doc": "The spacing between repeated occurrences of the same shield on a line"
- },
- "minimum-padding": {
- "css": "shield-min-padding",
- "default-value": 0,
- "doc": "Determines the minimum amount of padding that a shield gets relative to other shields",
- "type": "float"
- },
- "wrap-width": {
- "css": "shield-wrap-width",
- "type": "unsigned",
- "default-value": 0,
- "doc": "Length of a chunk of text in characters before wrapping text"
- },
- "wrap-before": {
- "css": "shield-wrap-before",
- "type": "boolean",
- "default-value": false,
- "doc": "Wrap text before wrap-width is reached. If false, wrapped lines will be a bit longer than wrap-width."
- },
- "wrap-character": {
- "css": "shield-wrap-character",
- "type": "string",
- "default-value": " ",
- "doc": "Use this character instead of a space to wrap long names."
- },
- "halo-fill": {
- "css": "shield-halo-fill",
- "type": "color",
- "default-value": "#FFFFFF",
- "default-meaning": "white",
- "doc": "Specifies the color of the halo around the text."
- },
- "halo-radius": {
- "css": "shield-halo-radius",
- "doc": "Specify the radius of the halo in pixels",
- "default-value": 0,
- "default-meaning": "no halo",
- "type": "float"
- },
- "character-spacing": {
- "css": "shield-character-spacing",
- "type": "unsigned",
- "default-value": 0,
- "doc": "Horizontal spacing between characters (in pixels). Currently works for point placement only, not line placement."
- },
- "line-spacing": {
- "css": "shield-line-spacing",
- "doc": "Vertical spacing between lines of multiline labels (in pixels)",
- "type": "unsigned"
- },
- "dx": {
- "css": "shield-text-dx",
- "type": "float",
- "doc": "Displace text within shield by fixed amount, in pixels, +/- along the X axis. A positive value will shift the text right",
- "default-value": 0
- },
- "dy": {
- "css": "shield-text-dy",
- "type": "float",
- "doc": "Displace text within shield by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down",
- "default-value": 0
- },
- "shield-dx": {
- "css": "shield-dx",
- "type": "float",
- "doc": "Displace shield by fixed amount, in pixels, +/- along the X axis. A positive value will shift the text right",
- "default-value": 0
- },
- "shield-dy": {
- "css": "shield-dy",
- "type": "float",
- "doc": "Displace shield by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down",
- "default-value": 0
- },
- "opacity": {
- "css": "shield-opacity",
- "type": "float",
- "doc": "(Default 1.0) - opacity of the image used for the shield",
- "default-value": 1
- },
- "text-opacity": {
- "css": "shield-text-opacity",
- "type": "float",
- "doc": "(Default 1.0) - opacity of the text placed on top of the shield",
- "default-value": 1
- },
- "horizontal-alignment": {
- "css": "shield-horizontal-alignment",
- "type": [
- "left",
- "middle",
- "right",
- "auto"
- ],
- "doc": "The shield's horizontal alignment from its centerpoint",
- "default-value": "auto"
- },
- "vertical-alignment": {
- "css": "shield-vertical-alignment",
- "type": [
- "top",
- "middle",
- "bottom",
- "auto"
- ],
- "doc": "The shield's vertical alignment from its centerpoint",
- "default-value": "middle"
- },
- "text-transform": {
- "css": "shield-text-transform",
- "type": [
- "none",
- "uppercase",
- "lowercase",
- "capitalize"
- ],
- "doc": "Transform the case of the characters",
- "default-value": "none"
- },
- "justify-alignment": {
- "css": "shield-justify-alignment",
- "type": [
- "left",
- "center",
- "right",
- "auto"
- ],
- "doc": "Define how text in a shield's label is justified",
- "default-value": "auto"
- },
- "clip": {
- "css": "shield-clip",
- "type": "boolean",
- "default-value": true,
- "default-meaning": "geometry will be clipped to map bounds before rendering",
- "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."
- },
- "comp-op": {
- "css": "shield-comp-op",
- "default-value": "src-over",
- "default-meaning": "add the current symbolizer on top of other symbolizer",
- "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
- "type": ["clear",
- "src",
- "dst",
- "src-over",
- "dst-over",
- "src-in",
- "dst-in",
- "src-out",
- "dst-out",
- "src-atop",
- "dst-atop",
- "xor",
- "plus",
- "minus",
- "multiply",
- "screen",
- "overlay",
- "darken",
- "lighten",
- "color-dodge",
- "color-burn",
- "hard-light",
- "soft-light",
- "difference",
- "exclusion",
- "contrast",
- "invert",
- "invert-rgb",
- "grain-merge",
- "grain-extract",
- "hue",
- "saturation",
- "color",
- "value"
- ]
- }
- },
- "line-pattern": {
- "file": {
- "css": "line-pattern-file",
- "type": "uri",
- "default-value": "none",
- "required": true,
- "doc": "An image file to be repeated and warped along a line"
- },
- "clip": {
- "css": "line-pattern-clip",
- "type": "boolean",
- "default-value": true,
- "default-meaning": "geometry will be clipped to map bounds before rendering",
- "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."
- },
- "smooth": {
- "css": "line-pattern-smooth",
- "type": "float",
- "default-value": 0,
- "default-meaning": "no smoothing",
- "range": "0-1",
- "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
- },
- "geometry-transform": {
- "css": "line-pattern-geometry-transform",
- "type": "functions",
- "default-value": "none",
- "default-meaning": "geometry will not be transformed",
- "doc": "Allows transformation functions to be applied to the geometry.",
- "functions": [
- ["matrix", 6],
- ["translate", 2],
- ["scale", 2],
- ["rotate", 3],
- ["skewX", 1],
- ["skewY", 1]
- ]
- },
- "comp-op": {
- "css": "line-pattern-comp-op",
- "default-value": "src-over",
- "default-meaning": "add the current symbolizer on top of other symbolizer",
- "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
- "type": ["clear",
- "src",
- "dst",
- "src-over",
- "dst-over",
- "src-in",
- "dst-in",
- "src-out",
- "dst-out",
- "src-atop",
- "dst-atop",
- "xor",
- "plus",
- "minus",
- "multiply",
- "screen",
- "overlay",
- "darken",
- "lighten",
- "color-dodge",
- "color-burn",
- "hard-light",
- "soft-light",
- "difference",
- "exclusion",
- "contrast",
- "invert",
- "invert-rgb",
- "grain-merge",
- "grain-extract",
- "hue",
- "saturation",
- "color",
- "value"
- ]
- }
- },
- "polygon-pattern": {
- "file": {
- "css": "polygon-pattern-file",
- "type": "uri",
- "default-value": "none",
- "required": true,
- "doc": "Image to use as a repeated pattern fill within a polygon"
- },
- "alignment": {
- "css": "polygon-pattern-alignment",
- "type": [
- "local",
- "global"
- ],
- "default-value": "local",
- "doc": "Specify whether to align pattern fills to the layer or to the map."
- },
- "gamma": {
- "css": "polygon-pattern-gamma",
- "type": "float",
- "default-value": 1,
- "default-meaning": "fully antialiased",
- "range": "0-1",
- "doc": "Level of antialiasing of polygon pattern edges"
- },
- "opacity": {
- "css": "polygon-pattern-opacity",
- "type": "float",
- "doc": "(Default 1.0) - Apply an opacity level to the image used for the pattern",
- "default-value": 1,
- "default-meaning": "The image is rendered without modifications"
- },
- "clip": {
- "css": "polygon-pattern-clip",
- "type": "boolean",
- "default-value": true,
- "default-meaning": "geometry will be clipped to map bounds before rendering",
- "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."
- },
- "smooth": {
- "css": "polygon-pattern-smooth",
- "type": "float",
- "default-value": 0,
- "default-meaning": "no smoothing",
- "range": "0-1",
- "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
- },
- "geometry-transform": {
- "css": "polygon-pattern-geometry-transform",
- "type": "functions",
- "default-value": "none",
- "default-meaning": "geometry will not be transformed",
- "doc": "Allows transformation functions to be applied to the geometry.",
- "functions": [
- ["matrix", 6],
- ["translate", 2],
- ["scale", 2],
- ["rotate", 3],
- ["skewX", 1],
- ["skewY", 1]
- ]
- },
- "comp-op": {
- "css": "polygon-pattern-comp-op",
- "default-value": "src-over",
- "default-meaning": "add the current symbolizer on top of other symbolizer",
- "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
- "type": ["clear",
- "src",
- "dst",
- "src-over",
- "dst-over",
- "src-in",
- "dst-in",
- "src-out",
- "dst-out",
- "src-atop",
- "dst-atop",
- "xor",
- "plus",
- "minus",
- "multiply",
- "screen",
- "overlay",
- "darken",
- "lighten",
- "color-dodge",
- "color-burn",
- "hard-light",
- "soft-light",
- "difference",
- "exclusion",
- "contrast",
- "invert",
- "invert-rgb",
- "grain-merge",
- "grain-extract",
- "hue",
- "saturation",
- "color",
- "value"
- ]
- }
- },
- "raster": {
- "opacity": {
- "css": "raster-opacity",
- "default-value": 1,
- "default-meaning": "opaque",
- "type": "float",
- "doc": "The opacity of the raster symbolizer on top of other symbolizers."
- },
- "filter-factor": {
- "css": "raster-filter-factor",
- "default-value": -1,
- "default-meaning": "Allow the datasource to choose appropriate downscaling.",
- "type": "float",
- "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."
- },
- "scaling": {
- "css": "raster-scaling",
- "type": [
- "near",
- "fast",
- "bilinear",
- "bilinear8",
- "bicubic",
- "spline16",
- "spline36",
- "hanning",
- "hamming",
- "hermite",
- "kaiser",
- "quadric",
- "catrom",
- "gaussian",
- "bessel",
- "mitchell",
- "sinc",
- "lanczos",
- "blackman"
- ],
- "default-value": "near",
- "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."
- },
- "mesh-size": {
- "css": "raster-mesh-size",
- "default-value": 16,
- "default-meaning": "Reprojection mesh will be 1/16 of the resolution of the source image",
- "type": "unsigned",
- "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."
- },
- "comp-op": {
- "css": "raster-comp-op",
- "default-value": "src-over",
- "default-meaning": "add the current symbolizer on top of other symbolizer",
- "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
- "type": ["clear",
- "src",
- "dst",
- "src-over",
- "dst-over",
- "src-in",
- "dst-in",
- "src-out",
- "dst-out",
- "src-atop",
- "dst-atop",
- "xor",
- "plus",
- "minus",
- "multiply",
- "screen",
- "overlay",
- "darken",
- "lighten",
- "color-dodge",
- "color-burn",
- "hard-light",
- "soft-light",
- "difference",
- "exclusion",
- "contrast",
- "invert",
- "invert-rgb",
- "grain-merge",
- "grain-extract",
- "hue",
- "saturation",
- "color",
- "value"
- ]
- }
- },
- "point": {
- "file": {
- "css": "point-file",
- "type": "uri",
- "required": false,
- "default-value": "none",
- "doc": "Image file to represent a point"
- },
- "allow-overlap": {
- "css": "point-allow-overlap",
- "type": "boolean",
- "default-value": false,
- "doc": "Control whether overlapping points are shown or hidden.",
- "default-meaning": "Do not allow points to overlap with each other - overlapping markers will not be shown."
- },
- "ignore-placement": {
- "css": "point-ignore-placement",
- "type": "boolean",
- "default-value": false,
- "default-meaning": "do not store the bbox of this geometry in the collision detector cache",
- "doc": "value to control whether the placement of the feature will prevent the placement of other features"
- },
- "opacity": {
- "css": "point-opacity",
- "type": "float",
- "default-value": 1.0,
- "default-meaning": "Fully opaque",
- "doc": "A value from 0 to 1 to control the opacity of the point"
- },
- "placement": {
- "css": "point-placement",
- "type": [
- "centroid",
- "interior"
- ],
- "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.",
- "default-value": "centroid"
- },
- "transform": {
- "css": "point-transform",
- "type": "functions",
- "functions": [
- ["matrix", 6],
- ["translate", 2],
- ["scale", 2],
- ["rotate", 3],
- ["skewX", 1],
- ["skewY", 1]
- ],
- "default-value": "",
- "default-meaning": "No transformation",
- "doc": "SVG transformation definition"
- },
- "comp-op": {
- "css": "point-comp-op",
- "default-value": "src-over",
- "default-meaning": "add the current symbolizer on top of other symbolizer",
- "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
- "type": ["clear",
- "src",
- "dst",
- "src-over",
- "dst-over",
- "src-in",
- "dst-in",
- "src-out",
- "dst-out",
- "src-atop",
- "dst-atop",
- "xor",
- "plus",
- "minus",
- "multiply",
- "screen",
- "overlay",
- "darken",
- "lighten",
- "color-dodge",
- "color-burn",
- "hard-light",
- "soft-light",
- "difference",
- "exclusion",
- "contrast",
- "invert",
- "invert-rgb",
- "grain-merge",
- "grain-extract",
- "hue",
- "saturation",
- "color",
- "value"
- ]
- }
- },
- "text": {
- "name": {
- "css": "text-name",
- "type": "expression",
- "required": true,
- "default-value": "",
- "serialization": "content",
- "doc": "Value to use for a text label. Data columns are specified using brackets like [column_name]"
- },
- "face-name": {
- "css": "text-face-name",
- "type": "string",
- "validate": "font",
- "doc": "Font name and style to render a label in",
- "required": true
- },
- "size": {
- "css": "text-size",
- "type": "float",
- "default-value": 10,
- "doc": "Text size in pixels"
- },
- "text-ratio": {
- "css": "text-ratio",
- "doc": "Define the amount of text (of the total) present on successive lines when wrapping occurs",
- "default-value": 0,
- "type": "unsigned"
- },
- "wrap-width": {
- "css": "text-wrap-width",
- "doc": "Length of a chunk of text in characters before wrapping text",
- "default-value": 0,
- "type": "unsigned"
- },
- "wrap-before": {
- "css": "text-wrap-before",
- "type": "boolean",
- "default-value": false,
- "doc": "Wrap text before wrap-width is reached. If false, wrapped lines will be a bit longer than wrap-width."
- },
- "wrap-character": {
- "css": "text-wrap-character",
- "type": "string",
- "default-value": " ",
- "doc": "Use this character instead of a space to wrap long text."
- },
- "spacing": {
- "css": "text-spacing",
- "type": "unsigned",
- "doc": "Distance between repeated text labels on a line (aka. label-spacing)"
- },
- "character-spacing": {
- "css": "text-character-spacing",
- "type": "float",
- "default-value": 0,
- "doc": "Horizontal spacing adjustment between characters in pixels"
- },
- "line-spacing": {
- "css": "text-line-spacing",
- "default-value": 0,
- "type": "unsigned",
- "doc": "Vertical spacing adjustment between lines in pixels"
- },
- "label-position-tolerance": {
- "css": "text-label-position-tolerance",
- "default-value": 0,
- "type": "unsigned",
- "doc": "Allows the label to be displaced from its ideal position by a number of pixels (only works with placement:line)"
- },
- "max-char-angle-delta": {
- "css": "text-max-char-angle-delta",
- "type": "float",
- "default-value": "22.5",
- "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."
- },
- "fill": {
- "css": "text-fill",
- "doc": "Specifies the color for the text",
- "default-value": "#000000",
- "type": "color"
- },
- "opacity": {
- "css": "text-opacity",
- "doc": "A number from 0 to 1 specifying the opacity for the text",
- "default-value": 1.0,
- "default-meaning": "Fully opaque",
- "type": "float"
- },
- "halo-fill": {
- "css": "text-halo-fill",
- "type": "color",
- "default-value": "#FFFFFF",
- "default-meaning": "white",
- "doc": "Specifies the color of the halo around the text."
- },
- "halo-radius": {
- "css": "text-halo-radius",
- "doc": "Specify the radius of the halo in pixels",
- "default-value": 0,
- "default-meaning": "no halo",
- "type": "float"
- },
- "dx": {
- "css": "text-dx",
- "type": "float",
- "doc": "Displace text by fixed amount, in pixels, +/- along the X axis. A positive value will shift the text right",
- "default-value": 0
- },
- "dy": {
- "css": "text-dy",
- "type": "float",
- "doc": "Displace text by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down",
- "default-value": 0
- },
- "vertical-alignment": {
- "css": "text-vertical-alignment",
- "type": [
- "top",
- "middle",
- "bottom",
- "auto"
- ],
- "doc": "Position of label relative to point position.",
- "default-value": "auto",
- "default-meaning": "Default affected by value of dy; \"bottom\" for dy>0, \"top\" for dy<0."
- },
- "avoid-edges": {
- "css": "text-avoid-edges",
- "doc": "Tell positioning algorithm to avoid labeling near intersection edges.",
- "default-value": false,
- "type": "boolean"
- },
- "minimum-distance": {
- "css": "text-min-distance",
- "doc": "Minimum permitted distance to the next text symbolizer.",
- "type": "float"
- },
- "minimum-padding": {
- "css": "text-min-padding",
- "doc": "Determines the minimum amount of padding that a text symbolizer gets relative to other text",
- "type": "float"
- },
- "minimum-path-length": {
- "css": "text-min-path-length",
- "type": "float",
- "default-value": 0,
- "default-meaning": "place labels on all paths",
- "doc": "Place labels only on paths longer than this value."
- },
- "allow-overlap": {
- "css": "text-allow-overlap",
- "type": "boolean",
- "default-value": false,
- "doc": "Control whether overlapping text is shown or hidden.",
- "default-meaning": "Do not allow text to overlap with other text - overlapping markers will not be shown."
- },
- "orientation": {
- "css": "text-orientation",
- "type": "expression",
- "doc": "Rotate the text."
- },
- "placement": {
- "css": "text-placement",
- "type": [
- "point",
- "line",
- "vertex",
- "interior"
- ],
- "default-value": "point",
- "doc": "Control the style of placement of a point versus the geometry it is attached to."
- },
- "placement-type": {
- "css": "text-placement-type",
- "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.",
- "type": [
- "dummy",
- "simple"
- ],
- "default-value": "dummy"
- },
- "placements": {
- "css": "text-placements",
- "type": "string",
- "default-value": "",
- "doc": "If \"placement-type\" is set to \"simple\", use this \"POSITIONS,[SIZES]\" string. An example is `text-placements: \"E,NE,SE,W,NW,SW\";` "
- },
- "text-transform": {
- "css": "text-transform",
- "type": [
- "none",
- "uppercase",
- "lowercase",
- "capitalize"
- ],
- "doc": "Transform the case of the characters",
- "default-value": "none"
- },
- "horizontal-alignment": {
- "css": "text-horizontal-alignment",
- "type": [
- "left",
- "middle",
- "right",
- "auto"
- ],
- "doc": "The text's horizontal alignment from its centerpoint",
- "default-value": "auto"
- },
- "justify-alignment": {
- "css": "text-align",
- "type": [
- "left",
- "right",
- "center",
- "auto"
- ],
- "doc": "Define how text is justified",
- "default-value": "auto",
- "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"
- },
- "clip": {
- "css": "text-clip",
- "type": "boolean",
- "default-value": true,
- "default-meaning": "geometry will be clipped to map bounds before rendering",
- "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."
- },
- "comp-op": {
- "css": "text-comp-op",
- "default-value": "src-over",
- "default-meaning": "add the current symbolizer on top of other symbolizer",
- "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
- "type": ["clear",
- "src",
- "dst",
- "src-over",
- "dst-over",
- "src-in",
- "dst-in",
- "src-out",
- "dst-out",
- "src-atop",
- "dst-atop",
- "xor",
- "plus",
- "minus",
- "multiply",
- "screen",
- "overlay",
- "darken",
- "lighten",
- "color-dodge",
- "color-burn",
- "hard-light",
- "soft-light",
- "difference",
- "exclusion",
- "contrast",
- "invert",
- "invert-rgb",
- "grain-merge",
- "grain-extract",
- "hue",
- "saturation",
- "color",
- "value"
- ]
- }
- },
- "building": {
- "fill": {
- "css": "building-fill",
- "default-value": "#FFFFFF",
- "doc": "The color of the buildings walls.",
- "type": "color"
- },
- "fill-opacity": {
- "css": "building-fill-opacity",
- "type": "float",
- "doc": "The opacity of the building as a whole, including all walls.",
- "default-value": 1
- },
- "height": {
- "css": "building-height",
- "doc": "The height of the building in pixels.",
- "type": "expression",
- "default-value": "0"
- }
- }
- },
- "colors": {
- "aliceblue": [240, 248, 255],
- "antiquewhite": [250, 235, 215],
- "aqua": [0, 255, 255],
- "aquamarine": [127, 255, 212],
- "azure": [240, 255, 255],
- "beige": [245, 245, 220],
- "bisque": [255, 228, 196],
- "black": [0, 0, 0],
- "blanchedalmond": [255, 235, 205],
- "blue": [0, 0, 255],
- "blueviolet": [138, 43, 226],
- "brown": [165, 42, 42],
- "burlywood": [222, 184, 135],
- "cadetblue": [95, 158, 160],
- "chartreuse": [127, 255, 0],
- "chocolate": [210, 105, 30],
- "coral": [255, 127, 80],
- "cornflowerblue": [100, 149, 237],
- "cornsilk": [255, 248, 220],
- "crimson": [220, 20, 60],
- "cyan": [0, 255, 255],
- "darkblue": [0, 0, 139],
- "darkcyan": [0, 139, 139],
- "darkgoldenrod": [184, 134, 11],
- "darkgray": [169, 169, 169],
- "darkgreen": [0, 100, 0],
- "darkgrey": [169, 169, 169],
- "darkkhaki": [189, 183, 107],
- "darkmagenta": [139, 0, 139],
- "darkolivegreen": [85, 107, 47],
- "darkorange": [255, 140, 0],
- "darkorchid": [153, 50, 204],
- "darkred": [139, 0, 0],
- "darksalmon": [233, 150, 122],
- "darkseagreen": [143, 188, 143],
- "darkslateblue": [72, 61, 139],
- "darkslategrey": [47, 79, 79],
- "darkturquoise": [0, 206, 209],
- "darkviolet": [148, 0, 211],
- "deeppink": [255, 20, 147],
- "deepskyblue": [0, 191, 255],
- "dimgray": [105, 105, 105],
- "dimgrey": [105, 105, 105],
- "dodgerblue": [30, 144, 255],
- "firebrick": [178, 34, 34],
- "floralwhite": [255, 250, 240],
- "forestgreen": [34, 139, 34],
- "fuchsia": [255, 0, 255],
- "gainsboro": [220, 220, 220],
- "ghostwhite": [248, 248, 255],
- "gold": [255, 215, 0],
- "goldenrod": [218, 165, 32],
- "gray": [128, 128, 128],
- "grey": [128, 128, 128],
- "green": [0, 128, 0],
- "greenyellow": [173, 255, 47],
- "honeydew": [240, 255, 240],
- "hotpink": [255, 105, 180],
- "indianred": [205, 92, 92],
- "indigo": [75, 0, 130],
- "ivory": [255, 255, 240],
- "khaki": [240, 230, 140],
- "lavender": [230, 230, 250],
- "lavenderblush": [255, 240, 245],
- "lawngreen": [124, 252, 0],
- "lemonchiffon": [255, 250, 205],
- "lightblue": [173, 216, 230],
- "lightcoral": [240, 128, 128],
- "lightcyan": [224, 255, 255],
- "lightgoldenrodyellow": [250, 250, 210],
- "lightgray": [211, 211, 211],
- "lightgreen": [144, 238, 144],
- "lightgrey": [211, 211, 211],
- "lightpink": [255, 182, 193],
- "lightsalmon": [255, 160, 122],
- "lightseagreen": [32, 178, 170],
- "lightskyblue": [135, 206, 250],
- "lightslategray": [119, 136, 153],
- "lightslategrey": [119, 136, 153],
- "lightsteelblue": [176, 196, 222],
- "lightyellow": [255, 255, 224],
- "lime": [0, 255, 0],
- "limegreen": [50, 205, 50],
- "linen": [250, 240, 230],
- "magenta": [255, 0, 255],
- "maroon": [128, 0, 0],
- "mediumaquamarine": [102, 205, 170],
- "mediumblue": [0, 0, 205],
- "mediumorchid": [186, 85, 211],
- "mediumpurple": [147, 112, 219],
- "mediumseagreen": [60, 179, 113],
- "mediumslateblue": [123, 104, 238],
- "mediumspringgreen": [0, 250, 154],
- "mediumturquoise": [72, 209, 204],
- "mediumvioletred": [199, 21, 133],
- "midnightblue": [25, 25, 112],
- "mintcream": [245, 255, 250],
- "mistyrose": [255, 228, 225],
- "moccasin": [255, 228, 181],
- "navajowhite": [255, 222, 173],
- "navy": [0, 0, 128],
- "oldlace": [253, 245, 230],
- "olive": [128, 128, 0],
- "olivedrab": [107, 142, 35],
- "orange": [255, 165, 0],
- "orangered": [255, 69, 0],
- "orchid": [218, 112, 214],
- "palegoldenrod": [238, 232, 170],
- "palegreen": [152, 251, 152],
- "paleturquoise": [175, 238, 238],
- "palevioletred": [219, 112, 147],
- "papayawhip": [255, 239, 213],
- "peachpuff": [255, 218, 185],
- "peru": [205, 133, 63],
- "pink": [255, 192, 203],
- "plum": [221, 160, 221],
- "powderblue": [176, 224, 230],
- "purple": [128, 0, 128],
- "red": [255, 0, 0],
- "rosybrown": [188, 143, 143],
- "royalblue": [65, 105, 225],
- "saddlebrown": [139, 69, 19],
- "salmon": [250, 128, 114],
- "sandybrown": [244, 164, 96],
- "seagreen": [46, 139, 87],
- "seashell": [255, 245, 238],
- "sienna": [160, 82, 45],
- "silver": [192, 192, 192],
- "skyblue": [135, 206, 235],
- "slateblue": [106, 90, 205],
- "slategray": [112, 128, 144],
- "slategrey": [112, 128, 144],
- "snow": [255, 250, 250],
- "springgreen": [0, 255, 127],
- "steelblue": [70, 130, 180],
- "tan": [210, 180, 140],
- "teal": [0, 128, 128],
- "thistle": [216, 191, 216],
- "tomato": [255, 99, 71],
- "turquoise": [64, 224, 208],
- "violet": [238, 130, 238],
- "wheat": [245, 222, 179],
- "white": [255, 255, 255],
- "whitesmoke": [245, 245, 245],
- "yellow": [255, 255, 0],
- "yellowgreen": [154, 205, 50],
- "transparent": [0, 0, 0, 0]
- },
- "filter": {
- "value": [
- "true",
- "false",
- "null",
- "point",
- "linestring",
- "polygon",
- "collection"
- ]
- }
- };
- CartoCSS['mapnik_reference'] = {
- version: {
- latest: _mapnik_reference_latest,
- '2.1.1': _mapnik_reference_latest
- }
- };
- CartoCSS.Tree = {};
- CartoCSS.Tree.operate = function(op, a, b) {
- switch (op) {
- case '+': return a + b;
- case '-': return a - b;
- case '*': return a * b;
- case '%': return a % b;
- case '/': return a / b;
- }
- };
- CartoCSS.Tree.functions = {
- rgb: function (r, g, b) {
- return this.rgba(r, g, b, 1.0);
- },
- rgba: function (r, g, b, a) {
- var me = this;
- var rgb = [r, g, b].map(function (c) {
- return me.number(c);
- });
- a = me.number(a);
- if (rgb.some(isNaN) || isNaN(a)) {return null;}
- return new CartoCSS.Tree.Color(rgb, a);
- },
- // Only require val
- stop: function (val) {
- var color, mode;
- if (arguments.length > 1) {color = arguments[1];}
- if (arguments.length > 2) {mode = arguments[2];}
- return {
- is: 'tag',
- val: val,
- color: color,
- mode: mode,
- toString(env) {
- return '\n\t<stop value="' + val.ev(env) + '"' +
- (color ? ' color="' + color.ev(env) + '" ' : '') +
- (mode ? ' mode="' + mode.ev(env) + '" ' : '') +
- '/>';
- }
- };
- },
- hsl: function (h, s, l) {
- return this.hsla(h, s, l, 1.0);
- },
- hsla: function (h, s, l, a) {
- h = (this.number(h) % 360) / 360;
- s = this.number(s);
- l = this.number(l);
- a = this.number(a);
- if ([h, s, l, a].some(isNaN)) {return null;}
- var m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s,
- m1 = l * 2 - m2;
- return this.rgba(hue(h + 1 / 3) * 255,
- hue(h) * 255,
- hue(h - 1 / 3) * 255,
- a);
- function hue(h) {
- h = h < 0 ? h + 1 : (h > 1 ? h - 1 : h);
- 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;}
- }
- },
- hue: function (color) {
- if (!('toHSL' in color)) {return null;}
- return new CartoCSS.Tree.Dimension(Math.round(color.toHSL().h));
- },
- saturation: function (color) {
- if (!('toHSL' in color)) {return null;}
- return new CartoCSS.Tree.Dimension(Math.round(color.toHSL().s * 100), '%');
- },
- lightness: function (color) {
- if (!('toHSL' in color)) {return null;}
- return new CartoCSS.Tree.Dimension(Math.round(color.toHSL().l * 100), '%');
- },
- alpha: function (color) {
- if (!('toHSL' in color)) {return null;}
- return new CartoCSS.Tree.Dimension(color.toHSL().a);
- },
- saturate: function (color, amount) {
- if (!('toHSL' in color)) {return null;}
- var hsl = color.toHSL();
- hsl.s += amount.value / 100;
- hsl.s = this.clamp(hsl.s);
- return this.hsla_simple(hsl);
- },
- desaturate: function (color, amount) {
- if (!('toHSL' in color)) {return null;}
- var hsl = color.toHSL();
- hsl.s -= amount.value / 100;
- hsl.s = this.clamp(hsl.s);
- return this.hsla_simple(hsl);
- },
- lighten: function (color, amount) {
- if (!('toHSL' in color)) {return null;}
- var hsl = color.toHSL();
- hsl.l += amount.value / 100;
- hsl.l = this.clamp(hsl.l);
- return this.hsla_simple(hsl);
- },
- darken: function (color, amount) {
- if (!('toHSL' in color)) {return null;}
- var hsl = color.toHSL();
- hsl.l -= amount.value / 100;
- hsl.l = this.clamp(hsl.l);
- return this.hsla_simple(hsl);
- },
- fadein: function (color, amount) {
- if (!('toHSL' in color)) {return null;}
- var hsl = color.toHSL();
- hsl.a += amount.value / 100;
- hsl.a = this.clamp(hsl.a);
- return this.hsla_simple(hsl);
- },
- fadeout: function (color, amount) {
- if (!('toHSL' in color)) {return null;}
- var hsl = color.toHSL();
- hsl.a -= amount.value / 100;
- hsl.a = this.clamp(hsl.a);
- return this.hsla_simple(hsl);
- },
- spin: function (color, amount) {
- if (!('toHSL' in color)) {return null;}
- var hsl = color.toHSL();
- var hue = (hsl.h + amount.value) % 360;
- hsl.h = hue < 0 ? 360 + hue : hue;
- return this.hsla_simple(hsl);
- },
- replace: function (entity, a, b) {
- if (entity.is === 'field') {
- return entity.toString + '.replace(' + a.toString() + ', ' + b.toString() + ')';
- } else {
- return entity.replace(a, b);
- }
- },
- //
- // Copyright (c) 2006-2009 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein
- // http://sass-lang.com
- //
- mix: function (color1, color2, weight) {
- var p = weight.value / 100.0;
- var w = p * 2 - 1;
- var a = color1.toHSL().a - color2.toHSL().a;
- var w1 = (((w * a == -1) ? w : (w + a) / (1 + w * a)) + 1) / 2.0;
- var w2 = 1 - w1;
- var rgb = [color1.rgb[0] * w1 + color2.rgb[0] * w2,
- color1.rgb[1] * w1 + color2.rgb[1] * w2,
- color1.rgb[2] * w1 + color2.rgb[2] * w2];
- var alpha = color1.alpha * p + color2.alpha * (1 - p);
- return new CartoCSS.Tree.Color(rgb, alpha);
- },
- greyscale: function (color) {
- return this.desaturate(color, new CartoCSS.Tree.Dimension(100));
- },
- '%': function (quoted /* arg, arg, ...*/) {
- var args = Array.prototype.slice.call(arguments, 1),
- str = quoted.value;
- for (var i = 0; i < args.length; i++) {
- str = str.replace(/%s/, args[i].value)
- .replace(/%[da]/, args[i].toString());
- }
- str = str.replace(/%%/g, '%');
- return new CartoCSS.Tree.Quoted(str);
- },
- hsla_simple: function (h) {
- return this.hsla(h.h, h.s, h.l, h.a);
- },
- number: function (n) {
- if (n instanceof CartoCSS.Tree.Dimension) {
- return parseFloat(n.unit === '%' ? n.value / 100 : n.value);
- } else if (typeof(n) === 'number') {
- return n;
- } else {
- return NaN;
- }
- },
- clamp: function (val) {
- return Math.min(1, Math.max(0, val));
- }
- };
- CartoCSS.Tree.Call = class Call {
- constructor(name, args, index) {
- this.is = 'call';
- this.name = name;
- this.args = args;
- this.index = index;
- }
- // When evuating a function call,
- // we either find the function in `tree.functions` [1],
- // in which case we call it, passing the evaluated arguments,
- // or we simply print it out as it appeared originally [2].
- // The *functions.js* file contains the built-in functions.
- // The reason why we evaluate the arguments, is in the case where
- // we try to pass a variable to a function, like: `saturate(@color)`.
- // The function should receive the value, not the variable.
- 'ev'(env) {
- var args = this.args.map(function (a) {
- return a.ev(env);
- });
- for (var i = 0; i < args.length; i++) {
- if (args[i].is === 'undefined') {
- return {
- is: 'undefined',
- value: 'undefined'
- };
- }
- }
- if (this.name in CartoCSS.Tree.functions) {
- if (CartoCSS.Tree.functions[this.name].length <= args.length) {
- var val = CartoCSS.Tree.functions[this.name].apply(CartoCSS.Tree.functions, args);
- if (val === null) {
- env.error({
- message: 'incorrect arguments given to ' + this.name + '()',
- index: this.index,
- type: 'runtime',
- filename: this.filename
- });
- return {is: 'undefined', value: 'undefined'};
- }
- return val;
- } else {
- env.error({
- message: 'incorrect number of arguments for ' + this.name +
- '(). ' + CartoCSS.Tree.functions[this.name].length + ' expected.',
- index: this.index,
- type: 'runtime',
- filename: this.filename
- });
- return {
- is: 'undefined',
- value: 'undefined'
- };
- }
- } else {
- var fn = CartoCSS.Tree.Reference.mapnikFunctions[this.name];
- if (fn === undefined) {
- var functions = lodash_topairs_default()(CartoCSS.Tree.Reference.mapnikFunctions);
- // cheap closest, needs improvement.
- var name = this.name;
- var mean = functions.map(function (f) {
- return [f[0], CartoCSS.Tree.Reference.editDistance(name, f[0]), f[1]];
- }).sort(function (a, b) {
- return a[1] - b[1];
- });
- env.error({
- message: 'unknown function ' + this.name + '(), did you mean ' +
- mean[0][0] + '(' + mean[0][2] + ')',
- index: this.index,
- type: 'runtime',
- filename: this.filename
- });
- return {
- is: 'undefined',
- value: 'undefined'
- };
- }
- if (fn !== args.length &&
- // support variable-arg functions like `colorize-alpha`
- fn !== -1) {
- env.error({
- message: 'function ' + this.name + '() takes ' +
- fn + ' arguments and was given ' + args.length,
- index: this.index,
- type: 'runtime',
- filename: this.filename
- });
- return {
- is: 'undefined',
- value: 'undefined'
- };
- } else {
- // Save the evaluated versions of arguments
- this.args = args;
- return this;
- }
- }
- }
- toString(env, format) {
- if (this.args.length) {
- return this.name + '(' + this.args.join(',') + ')';
- } else {
- return this.name;
- }
- }
- };
- CartoCSS.Tree.Color = class Color {
- constructor(rgb, a) {
- this.is = 'color';
- // The end goal here, is to parse the arguments
- // into an integer triplet, such as `128, 255, 0`
- //
- // This facilitates operations and conversions.
- if (Array.isArray(rgb)) {
- this.rgb = rgb.slice(0, 3);
- } else if (rgb.length == 6) {
- this.rgb = rgb.match(/.{2}/g).map(function (c) {
- return parseInt(c, 16);
- });
- } else {
- this.rgb = rgb.split('').map(function (c) {
- return parseInt(c + c, 16);
- });
- }
- if (typeof(a) === 'number') {
- this.alpha = a;
- } else if (rgb.length === 4) {
- this.alpha = rgb[3];
- } else {
- this.alpha = 1;
- }
- }
- 'ev'() {
- return this;
- }
- // If we have some transparency, the only way to represent it
- // is via `rgba`. Otherwise, we use the hex representation,
- // which has better compatibility with older browsers.
- // Values are capped between `0` and `255`, rounded and zero-padded.
- toString() {
- /* if (this.alpha < 1.0) {*/
- return 'rgba(' + this.rgb.map(function (c) {
- return Math.round(c);
- }).concat(this.alpha).join(', ') + ')';
- /*} else {
- return '#' + this.rgb.map(function(i) {
- i = Math.round(i);
- i = (i > 255 ? 255 : (i < 0 ? 0 : i)).toString(16);
- return i.length === 1 ? '0' + i : i;
- }).join('');
- }*/
- }
- // Operations have to be done per-channel, if not,
- // channels will spill onto each other. Once we have
- // our result, in the form of an integer triplet,
- // we create a new Color node to hold the result.
- operate(env, op, other) {
- var result = [];
- if (!(other instanceof CartoCSS.Tree.Color)) {
- other = other.toColor();
- }
- for (var c = 0; c < 3; c++) {
- result[c] = CartoCSS.Tree.operate(op, this.rgb[c], other.rgb[c]);
- }
- return new CartoCSS.Tree.Color(result);
- }
- toHSL() {
- var r = this.rgb[0] / 255,
- g = this.rgb[1] / 255,
- b = this.rgb[2] / 255,
- a = this.alpha;
- var max = Math.max(r, g, b), min = Math.min(r, g, b);
- var h, s, l = (max + min) / 2, d = max - min;
- if (max === min) {
- h = s = 0;
- } else {
- s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
- switch (max) {
- case r:
- h = (g - b) / d + (g < b ? 6 : 0);
- break;
- case g:
- h = (b - r) / d + 2;
- break;
- case b:
- h = (r - g) / d + 4;
- break;
- default:
- break;
- }
- h /= 6;
- }
- return {h: h * 360, s: s, l: l, a: a};
- }
- };
- CartoCSS.Tree.Comment = class Comment {
- constructor(value, silent) {
- this.value = value;
- this.silent = !!silent;
- }
- toString(env) {
- return '<!--' + this.value + '-->';
- }
- 'ev'() {
- return this;
- }
- };
- CartoCSS.Tree.Definition = class Definition {
- constructor(selector, rules) {
- this.elements = selector.elements;
- //assert.ok(selector.filters instanceof CartoCSS.Tree.Filterset);
- this.rules = rules;
- this.ruleIndex = {};
- for (var i = 0; i < this.rules.length; i++) {
- if ('zoom' in this.rules[i]) {this.rules[i] = this.rules[i].clone();}
- this.rules[i].zoom = selector.zoom;
- this.ruleIndex[this.rules[i].updateID()] = true;
- }
- this.filters = selector.filters;
- this.zoom = selector.zoom;
- this.attachment = selector.attachment || '__default__';
- this.specificity = selector.specificity();
- }
- toString() {
- var str = this.filters.toString();
- for (var i = 0; i < this.rules.length; i++) {
- str += '\n ' + this.rules[i];
- }
- return str;
- }
- toJS(env) {
- var shaderAttrs = {};
- // merge conditions from filters with zoom condition of the
- // definition
- var zoom = this.zoom;
- //var frame_offset = this.frame_offset;
- var _if = this.filters.toJS(env);
- var filters = [zoom];
- if (_if) {filters.push(_if);}
- //if(frame_offset) filters.push('ctx["frame-offset"] === ' + frame_offset);
- _if = filters.join(" && ");
- function eachRule(rule) {
- if (rule instanceof CartoCSS.Tree.Rule) {
- shaderAttrs[rule.name] = shaderAttrs[rule.name] || [];
- if (_if) {
- shaderAttrs[rule.name].push(
- "if(" + _if + "){" + rule.value.toJS(env) + "}"
- );
- } else {
- shaderAttrs[rule.name].push(rule.value.toJS(env));
- }
- } else {
- if (rule instanceof CartoCSS.Tree.Ruleset) {
- var sh = rule.toJS(env);
- for (var v in sh) {
- shaderAttrs[v] = shaderAttrs[v] || [];
- for (var attr in sh[v]) {
- shaderAttrs[v].push(sh[v][attr]);
- }
- }
- }
- }
- }
- for (var id in this.rules) {
- eachRule(this.rules[id]);
- }
- return shaderAttrs;
- }
- };
- CartoCSS.Tree.Dimension = class Dimension {
- constructor(value, unit, index) {
- this.is = 'float';
- this.physical_units = ['m', 'cm', 'in', 'mm', 'pt', 'pc'];
- this.screen_units = ['px', '%'];
- this.all_units = ['m', 'cm', 'in', 'mm', 'pt', 'pc', 'px', '%'];
- this.densities = {
- m: 0.0254,
- mm: 25.4,
- cm: 2.54,
- pt: 72,
- pc: 6
- };
- this.value = parseFloat(value);
- this.unit = unit || null;
- this.index = index;
- }
- ev(env) {
- if (this.unit && this.all_units.indexOf(this.unit)<0) {
- env.error({
- message: "Invalid unit: '" + this.unit + "'",
- index: this.index
- });
- return {is: 'undefined', value: 'undefined'};
- }
- // normalize units which are not px or %
- if (this.unit && this.physical_units.indexOf(this.unit)>=0) {
- if (!env.ppi) {
- env.error({
- message: "ppi is not set, so metric units can't be used",
- index: this.index
- });
- return {is: 'undefined', value: 'undefined'};
- }
- // convert all units to inch
- // convert inch to px using ppi
- this.value = (this.value / this.densities[this.unit]) * env.ppi;
- this.unit = 'px';
- }
- return this;
- }
- toColor() {
- return new CartoCSS.Tree.Color([this.value, this.value, this.value]);
- }
- round() {
- this.value = Math.round(this.value);
- return this;
- }
- toString() {
- return this.value.toString();
- }
- operate(env, op, other) {
- if (this.unit === '%' && other.unit !== '%') {
- env.error({
- message: 'If two operands differ, the first must not be %',
- index: this.index
- });
- return {
- is: 'undefined',
- value: 'undefined'
- };
- }
- if (this.unit !== '%' && other.unit === '%') {
- if (op === '*' || op === '/' || op === '%') {
- env.error({
- message: 'Percent values can only be added or subtracted from other values',
- index: this.index
- });
- return {
- is: 'undefined',
- value: 'undefined'
- };
- }
- return new CartoCSS.Tree.Dimension(CartoCSS.Tree.operate(op,
- this.value, this.value * other.value * 0.01),
- this.unit);
- }
- //here the operands are either the same (% or undefined or px), or one is undefined and the other is px
- return new CartoCSS.Tree.Dimension(CartoCSS.Tree.operate(op, this.value, other.value),
- this.unit || other.unit);
- }
- };
- CartoCSS.Tree.Element = class Element {
- constructor(value) {
- this.value = value.trim();
- if (this.value[0] === '#') {
- this.type = 'id';
- this.clean = this.value.replace(/^#/, '');
- }
- if (this.value[0] === '.') {
- this.type = 'class';
- this.clean = this.value.replace(/^\./, '');
- }
- if (this.value.indexOf('*') !== -1) {
- this.type = 'wildcard';
- }
- }
- specificity() {
- return [
- (this.type === 'id') ? 1 : 0, // a
- (this.type === 'class') ? 1 : 0 // b
- ];
- }
- toString() {
- return this.value;
- }
- };
- CartoCSS.Tree.Expression = class Expression {
- constructor(value) {
- this.is = 'expression';
- this.value = value;
- }
- ev(env) {
- if (this.value.length > 1) {
- return new CartoCSS.Tree.Expression(this.value.map(function (e) {
- return e.ev(env);
- }));
- } else {
- return this.value[0].ev(env);
- }
- }
- toString(env) {
- return this.value.map(function (e) {
- return e.toString(env);
- }).join(' ');
- }
- };
- CartoCSS.Tree.Field = class Field {
- constructor(content) {
- this.is = 'field';
- this.value = content || '';
- }
- toString() {
- return '["' + this.value.toUpperCase() + '"]';
- }
- 'ev'() {
- return this;
- }
- };
- CartoCSS.Tree.Filter = class Filter {
- constructor(key, op, val, index, filename) {
- this.ops = {
- '<': [' < ', 'numeric'],
- '>': [' > ', 'numeric'],
- '=': [' = ', 'both'],
- '!=': [' != ', 'both'],
- '<=': [' <= ', 'numeric'],
- '>=': [' >= ', 'numeric'],
- '=~': ['.match(', 'string', ')']
- };
- this.key = key;
- this.op = op;
- this.val = val;
- this.index = index;
- this.filename = filename;
- this.id = this.key + this.op + this.val;
- }
- ev(env) {
- this.key = this.key.ev(env);
- this.val = this.val.ev(env);
- return this;
- }
- toString() {
- return '[' + this.id + ']';
- }
- };
- CartoCSS.Tree.Filterset = class Filterset {
- constructor() {
- this.filters = {};
- }
- toJS(env) {
- function eachFilter(filter) {
- var op = filter.op;
- if (op === "=") {
- op = "==";
- }
- var val = filter.val;
- if (filter._val !== undefined) {
- val = filter._val.toString(true);
- }
- //对scale进行特殊处理,将值转换成数值
- if (filter.key && filter.key.value === 'scale') {
- val = +val;
- } else if (typeof val === 'string' || typeof val === 'object') {
- val = "'" + val + "'";
- }
- var attrs = "attributes";
- return attrs + "&&" + attrs + filter.key + "&&" + attrs + filter.key + " " + op + val;
- }
- var results = [];
- for (var id in this.filters) {
- results.push(eachFilter(this.filters[id]));
- }
- return results.join(' && ');
- }
- toString() {
- var arr = [];
- for (var id in this.filters) {arr.push(this.filters[id].id);}
- return arr.sort().join('\t');
- }
- ev(env) {
- for (var i in this.filters) {
- this.filters[i].ev(env);
- }
- return this;
- }
- clone() {
- var clone = new CartoCSS.Tree.Filterset();
- for (var id in this.filters) {
- clone.filters[id] = this.filters[id];
- }
- return clone;
- }
- cloneWith(other) {
- var additions = [];
- for (var id in other.filters) {
- var status = this.addable(other.filters[id]);
- // status is true, false or null. if it's null we don't fail this
- // clone nor do we add the filter.
- if (status === false) {
- return false;
- }
- if (status === true) {
- // Adding the filter will override another value.
- additions.push(other.filters[id]);
- }
- }
- // Adding the other filters doesn't make this filterset invalid, but it
- // doesn't add anything to it either.
- if (!additions.length) {
- return null;
- }
- // We can successfully add all filters. Now clone the filterset and add the
- // new rules.
- var clone = new CartoCSS.Tree.Filterset();
- // We can add the rules that are already present without going through the
- // add function as a Filterset is always in it's simplest canonical form.
- for (id in this.filters) {
- clone.filters[id] = this.filters[id];
- }
- // Only add new filters that actually change the filter.
- while (id = additions.shift()) {
- clone.add(id);
- }
- return clone;
- }
- addable(filter) {
- var key = filter.key.toString(),
- value = filter.val.toString();
- if (value.match(/^[0-9]+(\.[0-9]*)?_match/)) {value = parseFloat(value);}
- switch (filter.op) {
- case '=':
- // if there is already foo= and we're adding foo=
- if (this.filters[key + '='] !== undefined) {
- if (this.filters[key + '='].val.toString() != value) {
- return false;
- } else {
- return null;
- }
- }
- if (this.filters[key + '!=' + value] !== undefined) {return false;}
- if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return false;}
- if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return false;}
- if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val > value) {return false;}
- if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val < value) {return false;}
- return true;
- case '=~':
- return true;
- case '!=':
- if (this.filters[key + '='] !== undefined) {return (this.filters[key + '='].val === value) ? false : null;}
- if (this.filters[key + '!=' + value] !== undefined) {return null;}
- if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return null;}
- if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return null;}
- if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val > value) {return null;}
- if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val < value) {return null;}
- return true;
- case '>':
- if (key + '=' in this.filters) {
- if (this.filters[key + '='].val <= value) {
- return false;
- } else {
- return null;
- }
- }
- if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return false;}
- if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val <= value) {return false;}
- if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return null;}
- if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val > value) {return null;}
- return true;
- case '>=':
- if (this.filters[key + '='] !== undefined) {return (this.filters[key + '='].val < value) ? false : null;}
- if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return false;}
- if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val < value) {return false;}
- if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return null;}
- if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val >= value) {return null;}
- return true;
- case '<':
- if (this.filters[key + '='] !== undefined) {return (this.filters[key + '='].val >= value) ? false : null;}
- if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return false;}
- if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val >= value) {return false;}
- if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return null;}
- if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val < value) {return null;}
- return true;
- case '<=':
- if (this.filters[key + '='] !== undefined) {return (this.filters[key + '='].val > value) ? false : null;}
- if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return false;}
- if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val > value) {return false;}
- if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return null;}
- if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val <= value) {return null;}
- return true;
- default:
- break;
- }
- }
- conflict(filter) {
- var key = filter.key.toString(),
- value = filter.val.toString();
- if (!isNaN(parseFloat(value))) {value = parseFloat(value);}
- // if (a=b) && (a=c)
- // if (a=b) && (a!=b)
- // or (a!=b) && (a=b)
- if ((filter.op === '=' && this.filters[key + '='] !== undefined &&
- value != this.filters[key + '='].val.toString()) ||
- (filter.op === '!=' && this.filters[key + '='] !== undefined &&
- value == this.filters[key + '='].val.toString()) ||
- (filter.op === '=' && this.filters[key + '!='] !== undefined &&
- value === this.filters[key + '!='].val.toString())) {
- return filter.toString() + ' added to ' + this.toString() + ' produces an invalid filter';
- }
- return false;
- }
- add(filter, env) {
- var key = filter.key.toString(),
- op = filter.op,
- conflict = this.conflict(filter),
- numval;
- if (conflict) {return conflict;}
- if (op === '=') {
- for (var i in this.filters) {
- if (this.filters[i].key === key) {delete this.filters[i];}
- }
- this.filters[key + '='] = filter;
- } else if (op === '!=') {
- this.filters[key + '!=' + filter.val] = filter;
- } else if (op === '=~') {
- this.filters[key + '=~' + filter.val] = filter;
- } else if (op === '>') {
- // If there are other filters that are also >
- // but are less than this one, they don't matter, so
- // remove them.
- for (var j in this.filters) {
- if (this.filters[j].key === key && this.filters[j].val <= filter.val) {
- delete this.filters[j];
- }
- }
- this.filters[key + '>'] = filter;
- } else if (op === '>=') {
- for (var k in this.filters) {
- numval = (+this.filters[k].val.toString());
- if (this.filters[k].key === key && numval < filter.val) {
- delete this.filters[k];
- }
- }
- if (this.filters[key + '!=' + filter.val] !== undefined) {
- delete this.filters[key + '!=' + filter.val];
- filter.op = '>';
- this.filters[key + '>'] = filter;
- } else {
- this.filters[key + '>='] = filter;
- }
- } else if (op === '<') {
- for (var l in this.filters) {
- numval = (+this.filters[l].val.toString());
- if (this.filters[l].key === key && numval >= filter.val) {
- delete this.filters[l];
- }
- }
- this.filters[key + '<'] = filter;
- } else if (op === '<=') {
- for (var m in this.filters) {
- numval = (+this.filters[m].val.toString());
- if (this.filters[m].key === key && numval > filter.val) {
- delete this.filters[m];
- }
- }
- if (this.filters[key + '!=' + filter.val] !== undefined) {
- delete this.filters[key + '!=' + filter.val];
- filter.op = '<';
- this.filters[key + '<'] = filter;
- } else {
- this.filters[key + '<='] = filter;
- }
- }
- }
- };
- CartoCSS.Tree.Fontset = class Fontset {
- constructor(env, fonts) {
- this.fonts = fonts;
- this.name = 'fontset-' + env.effects.length;
- }
- };
- CartoCSS.Tree.Invalid = class Invalid {
- constructor(chunk, index, message) {
- this.is = 'invalid';
- this.chunk = chunk;
- this.index = index;
- this.type = 'syntax';
- this.message = message || "Invalid code: " + this.chunk;
- }
- ev(env) {
- env.error({
- chunk: this.chunk,
- index: this.index,
- type: 'syntax',
- message: this.message || "Invalid code: " + this.chunk
- });
- return {
- is: 'undefined'
- };
- }
- };
- CartoCSS.Tree.Keyword = class Keyword {
- ev() {
- return this;
- }
- constructor(value) {
- this.value = value;
- var special = {
- 'transparent': 'color',
- 'true': 'boolean',
- 'false': 'boolean'
- };
- this.is = special[value] ? special[value] : 'keyword';
- }
- toString() {
- return this.value;
- }
- };
- /*Layer:class Invalid ),*/
- CartoCSS.Tree.Literal = class Literal {
- constructor(content) {
- this.value = content || '';
- this.is = 'field';
- }
- toString() {
- return this.value;
- }
- 'ev'() {
- return this;
- }
- };
- CartoCSS.Tree.Operation = class Operation {
- constructor(op, operands, index) {
- this.is = 'operation';
- this.op = op.trim();
- this.operands = operands;
- this.index = index;
- }
- ev(env) {
- var a = this.operands[0].ev(env),
- b = this.operands[1].ev(env),
- temp;
- if (a.is === 'undefined' || b.is === 'undefined') {
- return {
- is: 'undefined',
- value: 'undefined'
- };
- }
- if (a instanceof CartoCSS.Tree.Dimension && b instanceof CartoCSS.Tree.Color) {
- if (this.op === '*' || this.op === '+') {
- temp = b;
- b = a;
- a = temp;
- } else {
- env.error({
- name: "OperationError",
- message: "Can't substract or divide a color from a number",
- index: this.index
- });
- }
- }
- // Only concatenate plain strings, because this is easily
- // pre-processed
- if (a instanceof CartoCSS.Tree.Quoted && b instanceof CartoCSS.Tree.Quoted && this.op !== '+') {
- env.error({
- message: "Can't subtract, divide, or multiply strings.",
- index: this.index,
- type: 'runtime',
- filename: this.filename
- });
- return {
- is: 'undefined',
- value: 'undefined'
- };
- }
- // Fields, literals, dimensions, and quoted strings can be combined.
- if (a instanceof CartoCSS.Tree.Field || b instanceof CartoCSS.Tree.Field ||
- a instanceof CartoCSS.Tree.Literal || b instanceof CartoCSS.Tree.Literal) {
- if (a.is === 'color' || b.is === 'color') {
- env.error({
- message: "Can't subtract, divide, or multiply colors in expressions.",
- index: this.index,
- type: 'runtime',
- filename: this.filename
- });
- return {
- is: 'undefined',
- value: 'undefined'
- };
- } else {
- return new CartoCSS.Tree.Literal(a.ev(env).toString(true) + this.op + b.ev(env).toString(true));
- }
- }
- if (a.operate === undefined) {
- env.error({
- message: 'Cannot do math with type ' + a.is + '.',
- index: this.index,
- type: 'runtime',
- filename: this.filename
- });
- return {
- is: 'undefined',
- value: 'undefined'
- };
- }
- return a.operate(env, this.op, b);
- }
- };
- CartoCSS.Tree.Quoted = class Quoted {
- constructor(content) {
- this.is = 'string';
- this.value = content || '';
- }
- toString(quotes) {
- var escapedValue = this.value
- .replace(/&/g, '&')
- var xmlvalue = escapedValue
- .replace(/\'/g, '\\\'')
- .replace(/\"/g, '"')
- .replace(/</g, '<')
- .replace(/\>/g, '>');
- return (quotes === true) ? "'" + xmlvalue + "'" : escapedValue;
- }
- ev() {
- return this;
- }
- operate(env, op, other) {
- return new CartoCSS.Tree.Quoted(CartoCSS.Tree.operate(op, this.toString(), other.toString(this.contains_field)));
- }
- };
- CartoCSS.Tree.Reference = {
- _validateValue: {
- 'font': function (env, value) {
- if (env.validation_data && env.validation_data.fonts) {
- return env.validation_data.fonts.indexOf(value) != -1;
- } else {
- return true;
- }
- }
- },
- setData: function (data) {
- this.data = data;
- this.selector_cache = generateSelectorCache(data);
- this.mapnikFunctions = generateMapnikFunctions(data);
- this.required_cache = generateRequiredProperties(data);
- function generateSelectorCache(data) {
- var index = {};
- for (var i in data.symbolizers) {
- for (var j in data.symbolizers[i]) {
- if (data.symbolizers[i][j].hasOwnProperty('css')) {
- index[data.symbolizers[i][j].css] = [data.symbolizers[i][j], i, j];
- }
- }
- }
- return index;
- }
- function generateMapnikFunctions(data) {
- var functions = {};
- for (var i in data.symbolizers) {
- for (var j in data.symbolizers[i]) {
- if (data.symbolizers[i][j].type === 'functions') {
- for (var k = 0; k < data.symbolizers[i][j].functions.length; k++) {
- var fn = data.symbolizers[i][j].functions[k];
- functions[fn[0]] = fn[1];
- }
- }
- }
- }
- return functions;
- }
- function generateRequiredProperties(data) {
- var cache = {};
- for (var symbolizer_name in data.symbolizers) {
- cache[symbolizer_name] = [];
- for (var j in data.symbolizers[symbolizer_name]) {
- if (data.symbolizers[symbolizer_name][j].required) {
- cache[symbolizer_name].push(data.symbolizers[symbolizer_name][j].css);
- }
- }
- }
- return cache;
- }
- },
- setVersion: function (version) {
- if (CartoCSS.mapnik_reference.version.hasOwnProperty(version)) {
- this.setData(CartoCSS.mapnik_reference.version[version]);
- return true;
- }
- return false;
- },
- selectorData: function (selector, i) {
- if (this.selector_cache && this.selector_cache[selector]) {return this.selector_cache[selector][i];}
- },
- validSelector: function (selector) {
- return !!this.selector_cache[selector];
- },
- selectorName: function (selector) {
- return this.selectorData(selector, 2);
- },
- selector: function (selector) {
- return this.selectorData(selector, 0);
- },
- symbolizer: function (selector) {
- return this.selectorData(selector, 1);
- },
- requiredProperties: function (symbolizer_name, rules) {
- var req = this.required_cache[symbolizer_name];
- for (var i in req) {
- if (!(req[i] in rules)) {
- return 'Property ' + req[i] + ' required for defining ' +
- symbolizer_name + ' styles.';
- }
- }
- },
- isFont: function (selector) {
- return this.selector(selector).validate === 'font';
- },
- editDistance: function (a, b) {
- if (a.length === 0) {return b.length;}
- if (b.length === 0) {return a.length;}
- var matrix = [];
- for (var i = 0; i <= b.length; i++) {
- matrix[i] = [i];
- }
- for (var j = 0; j <= a.length; j++) {
- matrix[0][j] = j;
- }
- for (i = 1; i <= b.length; i++) {
- for (j = 1; j <= a.length; j++) {
- if (b.charAt(i - 1) === a.charAt(j - 1)) {
- matrix[i][j] = matrix[i - 1][j - 1];
- } else {
- matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, // substitution
- Math.min(matrix[i][j - 1] + 1, // insertion
- matrix[i - 1][j] + 1)); // deletion
- }
- }
- }
- return matrix[b.length][a.length];
- },
- validValue: function (env, selector, value) {
- function validateFunctions(value, selector) {
- if (value.value[0].is === 'string') {return true;}
- for (var i in value.value) {
- for (var j in value.value[i].value) {
- if (value.value[i].value[j].is !== 'call') {return false;}
- var f = find(this.selector(selector).functions, function (x) {//NOSONAR
- return x[0] === value.value[i].value[j].name;
- });
- if (!(f && f[1] === -1)) {
- // This filter is unknown or given an incorrect number of arguments
- if (!f || f[1] !== value.value[i].value[j].args.length) {return false;}
- }
- }
- }
- return true;
- }
- function validateKeyword(value, selector) {
- if (typeof this.selector(selector).type === 'object') {
- return this.selector(selector).type
- .indexOf(value.value[0].value) !== -1;
- } else {
- // allow unquoted keywords as strings
- return this.selector(selector).type === 'string';
- }
- }
- var i;
- if (!this.selector(selector)) {
- return false;
- } else if (value.value[0].is === 'keyword') {
- return validateKeyword(value, selector);
- } else if (value.value[0].is === 'undefined') {
- // caught earlier in the chain - ignore here so that
- // error is not overridden
- return true;
- } else if (this.selector(selector).type === 'numbers') {
- for (i in value.value) {
- if (value.value[i].is !== 'float') {
- return false;
- }
- }
- return true;
- } else if (this.selector(selector).type === 'tags') {
- if (!value.value) {return false;}
- if (!value.value[0].value) {
- return value.value[0].is === 'tag';
- }
- for (i = 0; i < value.value[0].value.length; i++) {
- if (value.value[0].value[i].is !== 'tag') {return false;}
- }
- return true;
- } else if (this.selector(selector).type == 'functions') {
- // For backwards compatibility, you can specify a string for `functions`-compatible
- // values, though they will not be validated.
- return validateFunctions(value, selector);
- } else if (this.selector(selector).type === 'expression') {
- return true;
- } else if (this.selector(selector).type === 'unsigned') {
- if (value.value[0].is === 'float') {
- value.value[0].round();
- return true;
- } else {
- return false;
- }
- } else {
- if (this.selector(selector).validate) {
- var valid = false;
- for (i = 0; i < value.value.length; i++) {
- if (this.selector(selector).type === value.value[i].is &&
- this._validateValue[this.selector(selector).validate](env, value.value[i].value)) {
- return true;
- }
- }
- return valid;
- } else {
- return this.selector(selector).type === value.value[0].is;
- }
- }
- }
- };
- CartoCSS.Tree.Reference.setVersion("latest");
- CartoCSS.Tree.Rule = class Rule {
- constructor(name, value, index, filename) {
- this.is = 'rule';
- var parts = name.split('/');
- this.name = parts.pop();
- this.instance = parts.length ? parts[0] : '__default__';
- this.value = (value instanceof CartoCSS.Tree.Value) ?
- value : new CartoCSS.Tree.Value([value]);
- this.index = index;
- this.symbolizer = CartoCSS.Tree.Reference.symbolizer(this.name);
- this.filename = filename;
- this.variable = (name.charAt(0) === '@');
- }
- clone() {
- var clone = Object.create(CartoCSS.Tree.Rule.prototype);
- clone.name = this.name;
- clone.value = this.value;
- clone.index = this.index;
- clone.instance = this.instance;
- clone.symbolizer = this.symbolizer;
- clone.filename = this.filename;
- clone.variable = this.variable;
- return clone;
- }
- updateID() {
- return this.id = this.zoom + '#' + this.instance + '#' + this.name;
- }
- toString() {
- return '[' + CartoCSS.Tree.Zoom.toString(this.zoom) + '] ' + this.name + ': ' + this.value;
- }
- ev(context) {
- return new CartoCSS.Tree.Rule(this.name,
- this.value.ev(context),
- this.index,
- this.filename);
- }
- };
- CartoCSS.Tree.Ruleset = class Ruleset {
- constructor(selectors, rules) {
- this.is = 'ruleset';
- this.selectors = selectors;
- this.rules = rules;
- // static cache of find() function
- this._lookups = {};
- }
- ev(env) {
- var i,
- rule,
- ruleset = new CartoCSS.Tree.Ruleset(this.selectors, this.rules.slice(0));
- ruleset.root = this.root;
- // push the current ruleset to the frames stack
- env.frames.unshift(ruleset);
- // Evaluate everything else
- for (i = 0, rule; i < ruleset.rules.length; i++) {
- rule = ruleset.rules[i];
- ruleset.rules[i] = rule.ev ? rule.ev(env) : rule;
- }
- // Pop the stack
- env.frames.shift();
- return ruleset;
- }
- match(args) {
- return !args || args.length === 0;
- }
- variables() {
- if (this._variables) {
- return this._variables;
- } else {
- return this._variables = this.rules.reduce(function (hash, r) {
- if (r instanceof CartoCSS.Tree.Rule && r.variable === true) {
- hash[r.name] = r;
- }
- return hash;
- }, {});
- }
- }
- variable(name) {
- return this.variables()[name];
- }
- rulesets() {
- if (this._rulesets) {
- return this._rulesets;
- } else {
- return this._rulesets = this.rules.filter(function (r) {
- return (r instanceof CartoCSS.Tree.Ruleset);
- });
- }
- }
- find(selector, self) {
- self = self || this;
- var rules = [], match,
- key = selector.toString();
- if (key in this._lookups) {
- return this._lookups[key];
- }
- this.rulesets().forEach(function (rule) {
- if (rule !== self) {
- for (var j = 0; j < rule.selectors.length; j++) {
- match = selector.match(rule.selectors[j]);
- if (match) {
- if (selector.elements.length > 1) {
- Array.prototype.push.apply(rules, rule.find(
- new CartoCSS.Tree.Selector(null, null, selector.elements.slice(1)), self));
- } else {
- rules.push(rule);
- }
- break;
- }
- }
- }
- });
- return this._lookups[key] = rules;
- }
- // Zooms can use variables. This replaces CartoCSS.Tree.Zoom objects on selectors
- // with simple bit-arrays that we can compare easily.
- evZooms(env) {
- for (var i = 0; i < this.selectors.length; i++) {
- var zval = CartoCSS.Tree.Zoom.all;
- for (var z = 0; z < this.selectors[i].zoom.length; z++) {
- zval = this.selectors[i].zoom[z].ev(env).zoom;
- }
- this.selectors[i].zoom = zval;
- }
- }
- flatten(result, parents, env) {
- var selectors = [], i, j;
- if (this.selectors.length === 0) {
- env.frames = env.frames.concat(this.rules);
- }
- // evaluate zoom variables on this object.
- this.evZooms(env);
- for (i = 0; i < this.selectors.length; i++) {
- var child = this.selectors[i];
- if (!child.filters) {
- // This is an invalid filterset.
- continue;
- }
- if (parents.length) {
- for (j = 0; j < parents.length; j++) {
- var parent = parents[j];
- var mergedFilters = parent.filters.cloneWith(child.filters);
- if (mergedFilters === null) {
- // Filters could be added, but they didn't change the
- // filters. This means that we only have to clone when
- // the zoom levels or the attachment is different too.
- if (parent.zoom === child.zoom &&
- parent.attachment === child.attachment &&
- parent.elements.join() === child.elements.join()) {
- selectors.push(parent);
- continue;
- } else {
- mergedFilters = parent.filters;
- }
- } else if (!mergedFilters) {
- // The merged filters are invalid, that means we don't
- // have to clone.
- continue;
- }
- var clone = Object.create(CartoCSS.Tree.Selector.prototype);
- clone.filters = mergedFilters;
- clone.zoom = child.zoom;
- clone.elements = parent.elements.concat(child.elements);
- if (parent.attachment && child.attachment) {
- clone.attachment = parent.attachment + '/' + child.attachment;
- } else {clone.attachment = child.attachment || parent.attachment;}
- clone.conditions = parent.conditions + child.conditions;
- clone.index = child.index;
- selectors.push(clone);
- }
- } else {
- selectors.push(child);
- }
- }
- var rules = [];
- for (i = 0; i < this.rules.length; i++) {
- var rule = this.rules[i];
- // Recursively flatten any nested rulesets
- if (rule instanceof CartoCSS.Tree.Ruleset) {
- rule.flatten(result, selectors, env);
- } else if (rule instanceof CartoCSS.Tree.Rule) {
- rules.push(rule);
- } else if (rule instanceof CartoCSS.Tree.Invalid) {
- env.error(rule);
- }
- }
- var index = rules.length ? rules[0].index : false;
- for (i = 0; i < selectors.length; i++) {
- // For specificity sort, use the position of the first rule to allow
- // defining attachments that are under current element as a descendant
- // selector.
- if (index !== false) {
- selectors[i].index = index;
- }
- result.push(new CartoCSS.Tree.Definition(selectors[i], rules.slice()));
- }
- return result;
- }
- };
- CartoCSS.Tree.Selector = class Selector {
- constructor(filters, zoom, elements, attachment, conditions, index) {
- this.elements = elements || [];
- this.attachment = attachment;
- this.filters = filters || {};
- this.zoom = typeof zoom !== 'undefined' ? zoom : CartoCSS.Tree.Zoom.all;
- this.conditions = conditions;
- this.index = index;
- }
- specificity() {
- return this.elements.reduce(function (memo, e) {
- var spec = e.specificity();
- memo[0] += spec[0];
- memo[1] += spec[1];
- return memo;
- }, [0, 0, this.conditions, this.index]);
- }
- };
- /*style:class Invalid ),*/
- CartoCSS.Tree.URL = class URL {
- constructor(val, paths) {
- this.is = 'uri';
- this.value = val;
- this.paths = paths;
- }
- toString() {
- return this.value.toString();
- }
- ev(ctx) {
- return new CartoCSS.Tree.URL(this.value.ev(ctx), this.paths);
- }
- };
- CartoCSS.Tree.Value = class Value {
- constructor(value) {
- this.is = 'value';
- this.value = value;
- }
- ev(env) {
- if (this.value.length === 1) {
- return this.value[0].ev(env);
- } else {
- return new CartoCSS.Tree.Value(this.value.map(function (v) {
- return v.ev(env);
- }));
- }
- }
- toJS(env) {
- //var v = this.value[0].value[0];
- var val = this.ev(env);
- var v = val.toString();
- if (val.is === "color" || val.is === 'uri' || val.is === 'string' || val.is === 'keyword') {
- v = "'" + v + "'";
- } else if (val.is === 'field') {
- // replace [varuable] by ctx['variable']
- v = v.replace(/\[(.*)\]/g, "attributes['\_match1']")
- } else if (val.value && typeof val.value === "object") {
- v = "[" + v + "]";
- }
- return "_value = " + v + ";";
- }
- toString(env, selector, sep, format) {
- return this.value.map(function (e) {
- return e.toString(env, format);
- }).join(sep || ', ');
- }
- clone() {
- var obj = Object.create(CartoCSS.Tree.Value.prototype);
- if (Array.isArray(obj)) {obj.value = this.value.slice();} else {obj.value = this.value;}
- obj.is = this.is;
- return obj;
- }
- };
- CartoCSS.Tree.Variable = class Variable {
- constructor(name, index, filename) {
- this.is = 'variable';
- this.name = name;
- this.index = index;
- this.filename = filename;
- }
- toString() {
- return this.name;
- }
- ev(env) {
- if (this._css) {return this._css;}
- var thisframe = env.frames.filter(function (f) {
- return f.name === this.name;
- }.bind(this));
- if (thisframe.length) {
- return thisframe[0].value.ev(env);
- } else {
- env.error({
- message: 'variable ' + this.name + ' is undefined',
- index: this.index,
- type: 'runtime',
- filename: this.filename
- });
- return {
- is: 'undefined',
- value: 'undefined'
- };
- }
- }
- };
- CartoCSS.Tree.Zoom = class Zoom {
- constructor(op, value, index) {
- this.op = op;
- this.value = value;
- this.index = index;
- }
- setZoom(zoom) {
- this.zoom = zoom;
- return this;
- }
- ev(env) {
- var value = parseInt(this.value.ev(env).toString(), 10);
- if (value > CartoCSS.Tree.Zoom.maxZoom || value < 0) {
- env.error({
- message: 'Only zoom levels between 0 and ' +
- CartoCSS.Tree.Zoom.maxZoom + ' supported.',
- index: this.index
- });
- }
- switch (this.op) {
- case '=':
- this.zoom = "zoom && zoom === " + value;
- return this;
- case '>':
- this.zoom = "zoom && zoom > " + value;
- break;
- case '>=':
- this.zoom = "zoom && zoom >= " + value;
- break;
- case '<':
- this.zoom = "zoom && zoom < " + value;
- break;
- case '<=':
- this.zoom = "zoom && zoom <= " + value;
- break;
- default:
- break;
- }
- /*
- for (var i = 0; i <= CartoCSS.Tree.Zoom.maxZoom; i++) {
- if (i >= start && i <= end) {
- zoom |= (1 << i);
- }
- }
- this.zoom = zoom;
- this.zoom=value+this.op+"zoom";*/
- return this;
- }
- toString() {
- var str = '';
- for (var i = 0; i <= CartoCSS.Tree.Zoom.maxZoom; i++) {
- str += (this.zoom & (1 << i)) ? 'X' : '.';
- }
- return str;
- }
- };
- // Covers all zoomlevels from 0 to 22
- CartoCSS.Tree.Zoom.all = 23;
- CartoCSS.Tree.Zoom.maxZoom = 22;
- CartoCSS.Tree.Zoom.ranges = {
- 0: 1000000000,
- 1: 500000000,
- 2: 200000000,
- 3: 100000000,
- 4: 50000000,
- 5: 25000000,
- 6: 12500000,
- 7: 6500000,
- 8: 3000000,
- 9: 1500000,
- 10: 750000,
- 11: 400000,
- 12: 200000,
- 13: 100000,
- 14: 50000,
- 15: 25000,
- 16: 12500,
- 17: 5000,
- 18: 2500,
- 19: 1500,
- 20: 750,
- 21: 500,
- 22: 250,
- 23: 100
- };
- ;// CONCATENATED MODULE: ./src/common/style/ThemeStyle.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ThemeStyle
- * @deprecatedclass SuperMap.ThemeStyle
- * @classdesc 客户端专题图风格类。
- * @category Visualization Theme
- * @param {Object} options - 可选参数。
- * @param {boolean} [options.fill=true] - 是否填充,不需要填充则设置为 false。如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染图层。
- * @param {string} [options.fillColor='#000000'] - 十六进制填充颜色。
- * @param {number} [options.fillOpacity=1] - 填充不透明度。取值范围[0, 1]。
- * @param {boolean} [options.stroke=false] - 是否描边,不需要描边则设置为false。如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染图层。
- * @param {string} [options.strokeColor='#000000'] - 十六进制描边颜色。
- * @param {number} [options.strokeOpacity=1] - 描边的不透明度。取值范围[0, 1]。
- * @param {number} [options.strokeWidth=1] - 线宽度/描边宽度。
- * @param {string} [options.strokeLinecap='butt'] - 线帽样式。strokeLinecap 有三种类型 “butt", "round", "square"。
- * @param {string} [options.strokeLineJoin='iter'] - 线段连接样式。strokeLineJoin 有三种类型 “miter", "round", "bevel"。
- * @param {string} [options.strokeDashstyle='solid'] - 虚线类型。strokeDashstyle 有八种类型 “dot",“dash",“dashdot",“longdash",“longdashdot",“solid", "dashed", "dotted"。solid 表示实线。
- * @param {number} [options.pointRadius=6] - 点半径,单位为像素。
- * @param {number} [options.shadowBlur=0] - 阴影模糊度,(大于 0 有效;)。注:请将 shadowColor 属性与 shadowBlur 属性一起使用,来创建阴影。
- * @param {string} [options.shadowColor='#000000'] - 阴影颜色。注:请将 shadowColor 属性与 shadowBlur 属性一起使用,来创建阴影。
- * @param {number} [options.shadowOffsetX=0] - 阴影 X 方向偏移值。
- * @param {number} [options.shadowOffsetY=0] - 阴影 Y 方向偏移值。
- * @param {string} options.label - 专题要素附加文本标签内容。
- * @param {string} [options.fontColor] - 附加文本字体颜色。
- * @param {number} [options.fontSize=12] - 附加文本字体大小,单位是像素。
- * @param {string} [options.fontStyle='normal'] - 附加文本字体样式。可设值:"normal", "italic", "oblique"。
- * @param {string} [options.fontVariant='normal'] - 附加文本字体变体。可设值:"normal", "small-caps"。
- * @param {string} [options.fontWeight='normal'] - 附加文本字体粗细。可设值:"normal", "bold", "bolder", "lighter"。
- * @param {string} [options.fontFamily='arial,sans-serif'] - 附加文本字体系列。fontFamily 值是字体族名称或/及类族名称的一个优先表,每个值逗号分割,
- * 浏览器会使用它可识别的第一个可以使用具体的字体名称("times"、"courier"、"arial")或字体系列名称
- * ("serif"、"sans-serif"、"cursive"、"fantasy"、"monospace")。
- * @param {string} [options.labelPosition='top'] - 附加文本位置, 可以是 'inside', 'left', 'right', 'top', 'bottom'。
- * @param {string} [options.labelAlign='center'] - 附加文本水平对齐。可以是 'left', 'right', 'center'。
- * @param {string} [options.labelBaseline='middle'] - 附加文本垂直对齐。 可以是 'top', 'bottom', 'middle' 。
- * @param {number} [options.labelXOffset=0] - 附加文本在x轴方向的偏移量。
- * @param {number} [options.labelYOffset=0] - 附加文本在y轴方向的偏移量。
- * @usage
- */
- class ThemeStyle {
- constructor(options) {
- options = options || {};
- /**
- * @member {boolean} [ThemeStyle.prototype.fill=true]
- * @description 是否填充,不需要填充则设置为 false。如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染图层。
- */
- this.fill = true;
- /**
- * @member {string} [ThemeStyle.prototype.fillColor="#000000"]
- * @description 十六进制填充颜色。
- */
- this.fillColor = "#000000";
- /**
- * @member {number} [ThemeStyle.prototype.fillOpacity=1]
- * @description 填充不透明度。取值范围[0, 1]。
- */
- this.fillOpacity = 1;
- /**
- * @member {boolean} [ThemeStyle.prototype.stroke=false]
- * @description 是否描边,不需要描边则设置为false。如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染图层。
- */
- this.stroke = false;
- /**
- * @member {string} [ThemeStyle.prototype.strokeColor="#000000"]
- * @description 十六进制描边颜色。
- */
- this.strokeColor = "#000000";
- /**
- * @member {number} [ThemeStyle.prototype.strokeOpacity=1]
- * @description 描边的不透明度。取值范围[0, 1]。
- */
- this.strokeOpacity = 1;
- /**
- * @member {number} [ThemeStyle.prototype.strokeWidth=1]
- * @description 线宽度/描边宽度。
- */
- this.strokeWidth = 1;
- /**
- * @member {string} [ThemeStyle.prototype.strokeLinecap="butt"]
- * @description 线帽样式;strokeLinecap 有三种类型 “butt", "round", "square" 。
- */
- this.strokeLinecap = "butt";
- /**
- * @member {string} [ThemeStyle.prototype.strokeLineJoin="miter"]
- * @description 线段连接样式;strokeLineJoin 有三种类型 “miter", "round", "bevel"。
- */
- this.strokeLineJoin = "miter";
- /**
- * @member {string} [ThemeStyle.prototype.strokeDashstyle="solid"]
- * @description 虚线类型; strokeDashstyle 有八种类型 “dot",“dash",“dashdot",“longdash",“longdashdot",“solid", "dashed", "dotted";
- * solid 表示实线。
- */
- this.strokeDashstyle = "solid";
- /**
- * @member {number} [ThemeStyle.prototype.pointRadius=6]
- * @description 点半径。单位为像素。
- */
- this.pointRadius = 6;
- /**
- * @member {number} [ThemeStyle.prototype.shadowBlur=0]
- * @description 阴影模糊度,(大于 0 有效)。注:请将 shadowColor 属性与 shadowBlur 属性一起使用,来创建阴影。
- */
- this.shadowBlur = 0;
- /**
- * @member {string} [ThemeStyle.prototype.shadowColor='#000000']
- * @description 阴影颜色。注:请将 shadowColor 属性与 shadowBlur 属性一起使用,来创建阴影。
- */
- this.shadowColor = "#000000";
- /**
- * @member {number} [ThemeStyle.prototype.shadowOffsetX=0]
- * @description 阴影 X 方向偏移值。
- */
- this.shadowOffsetX = 0;
- /**
- * @member {number} ThemeStyle.prototype.shadowOffsetY
- * @description Y 方向偏移值。
- */
- this.shadowOffsetY = 0;
- /**
- * @member {string} [ThemeStyle.prototype.label]
- * @description 专题要素附加文本标签内容。
- */
- this.label = "";
- /**
- * @member {boolean} [ThemeStyle.prototype.labelRect=false]
- * @description 是否显示文本标签矩形背景。
- */
- this.labelRect = false;
- /**
- * @member {string} [ThemeStyle.prototype.fontColor]
- * @description 附加文本字体颜色。
- */
- this.fontColor = "";
- /**
- * @member {number} [ThemeStyle.prototype.fontSize=12]
- * @description 附加文本字体大小,单位是像素。
- */
- this.fontSize = 12;
- /**
- * @member {string} [ThemeStyle.prototype.fontStyle="normal"]
- * @description 附加文本字体样式。可设值:"normal", "italic", "oblique"。
- */
- this.fontStyle = "normal";
- /**
- * @member {string} [ThemeStyle.prototype.fontVariant="normal"]
- * @description 附加文本字体变体。可设值:"normal", "small-caps"。
- */
- this.fontVariant = "normal";
- /**
- * @member {string} [ThemeStyle.prototype.fontWeight="normal"]
- * @description 附加文本字体粗细。可设值:"normal", "bold", "bolder", "lighter"。
- */
- this.fontWeight = "normal";
- /**
- * @member {string} [ThemeStyle.prototype.fontFamily="arial,sans-serif"]
- * @description 附加文本字体系列。fontFamily 值是字体族名称或/及类族名称的一个优先表,每个值逗号分割,浏览器会使用它可识别的第一个
- * 可以使用具体的字体名称("times"、"courier"、"arial")或字体系列名称("serif"、"sans-serif"、"cursive"、"fantasy"、"monospace")。
- */
- this.fontFamily = "arial,sans-serif";
- /**
- * @member {string} [ThemeStyle.prototype.labelPosition='top']
- * @description 附加文本位置, 可以是 'inside', 'left', 'right', 'top', 'bottom'。
- */
- this.labelPosition = "top";
- /**
- * @member {string} [ThemeStyle.prototype.labelAlign='center']
- * @description 附加文本水平对齐。可以是 'left', 'right', 'center'。
- */
- this.labelAlign = "center";
- /**
- * @member {string} [ThemeStyle.prototype.labelBaseline='middle']
- * @description 附加文本垂直对齐。 可以是 'top', 'bottom', 'middle'。
- */
- this.labelBaseline = "middle";
- /**
- * @member {number} [ThemeStyle.prototype.labelXOffset=0]
- * @description 附加文本在 X 轴方向的偏移量。
- */
- this.labelXOffset = 0;
- /**
- * @member {number} [ThemeStyle.prototype.labelYOffset=0]
- * @description 附加文本在 Y 轴方向的偏移量。
- */
- this.labelYOffset = 0;
- Util.extend(this, options);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/style/index.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- ;// CONCATENATED MODULE: ./src/common/overlay/feature/ShapeParameters.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ShapeParameters
- * @aliasclass Feature.ShapeParameters
- * @deprecatedclass SuperMap.Feature.ShapeParameters
- * @category Visualization Theme
- * @classdesc 图形参数基类
- * @usage
- */
- class ShapeParameters {
- constructor() {
- /**
- * @member {Array.<number>} [ShapeParameters.prototype.refOriginalPosition=[0,0]]
- * @description 图形参考原点位置,图形的参考中心位置。
- * refOriginalPosition 是长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
- * refOriginalPosition 表示图形的参考中心,通常情况下,图形是使用 canvas 的原点位置作为位置参考,
- * 但 refOriginalPosition 可以改变图形的参考位置,例如: refOriginalPosition = [80, 80],
- * 图形圆的 style.x = 20, style.y = 20,那么圆在 canvas 中的实际位置是 [100, 100]。
- * 图形(Shape) 的所有位置相关属性都是以 refOriginalPosition 为参考中心,
- * 也就是说图形的所有位置信息在 canvas 中都是以 refOriginalPosition 为参考的相对位置,只有
- * refOriginalPosition 的值为 [0, 0] 时,图形的位置信息才是 canvas 绝对位置。
- * 图形的位置信息通常有:style.pointList,style.x,style.y。
- */
- this.refOriginalPosition = [0, 0];
- /**
- * @member {string} ShapeParameters.prototype.refDataID
- * @description 图形所关联数据的 ID(<{@link FeatureVector}> 的 id)。
- */
- this.refDataID = null;
- /**
- * @member {boolean} ShapeParameters.prototype.isHoverByRefDataID
- * @description 是否根据 refDataID 进行高亮。用于同时高亮所有 refDataID 相同的图形。
- */
- this.isHoverByRefDataID = false;
- /**
- * @member {string} ShapeParameters.prototype.refDataHoverGroup
- * @description 高亮图形组的组名。此属性在 refDataID 有效且 isHoverByRefDataID 为 true 时生效。
- * 一旦设置此属性,且属性值有效,只有关联同一个数据的图形且此属性相同的图形才会高亮。
- */
- this.refDataHoverGroup = null;
- /**
- * @member {Object} ShapeParameters.prototype.dataInfo
- * @description 图形携带的附加数据。
- */
- this.dataInfo = null;
- /**
- * @member {boolean} ShapeParameters.prototype.clickable
- * @description 是否可点击。
- */
- this.clickable = true;
- /**
- * @member {boolean} ShapeParameters.prototype.hoverable
- * @description 是否可点击。
- */
- this.hoverable = true;
- /**
- * @member {Object} ShapeParameters.prototype.style
- * @description 图形样式对象,可设样式属性在子类中确定。
- */
- this.style = null;
- /**
- * @member {Object} ShapeParameters.prototype.highlightStyle
- * @description 高亮样式对象,可设样式属性与 style 的可设样式属性相同。
- */
- this.highlightStyle = {};
- this.CLASS_NAME = "SuperMap.Feature.ShapeParameters";
- }
- /**
- * @function ShapeParameters.prototype.destroy
- * @description 销毁对象。
- */
- destroy() {
- this.refOriginalPosition = null;
- this.refDataID = null;
- this.isHoverByRefDataID = null;
- this.refDataHoverGroup = null;
- this.dataInfo = null;
- this.clickable = null;
- this.hoverable = null;
- this.style = null;
- this.highlightStyle = null;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/feature/Point.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ShapeParametersPoint
- * @aliasclass Feature.ShapeParameters.Point
- * @deprecatedclass SuperMap.Feature.ShapeParameters.Point
- * @category Visualization Theme
- * @classdesc 点参数对象。
- * @extends {ShapeParameters}
- * @param {number} x - 点 x 坐标。
- * @param {number} y - 点 y 坐标。
- * @usage
- */
- class Point_Point extends ShapeParameters {
- constructor(x, y) {
- super(x, y);
- /**
- * @member {number} ShapeParametersPoint.prototype.x
- * @description 点 x 坐标。
- */
- this.x = !isNaN(x) ? x : 0;
- /**
- * @member {number} ShapeParametersPoint.prototype.y
- * @description 点 y 坐标。
- */
- this.y = !isNaN(y) ? y : 0;
- /**
- * @member {number} ShapeParametersPoint.prototype.r
- * @description 点的半径。
- */
- this.r = 6;
- this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Point";
- }
- /**
- * @function ShapeParametersPoint.prototype.destroy
- * @description 销毁对象。
- */
- destroy() {
- this.x = null;
- this.y = null;
- this.r = null;
- super.destroy();
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/feature/Line.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ShapeParametersLine
- * @aliasclass Feature.ShapeParameters.Line
- * @deprecatedclass SuperMap.Feature.ShapeParameters.Line
- * @category Visualization Theme
- * @classdesc 线参数对象。
- * @extends {ShapeParameters}
- * @param {Array} pointList - 线要素节点数组,二维数组。
- * @usage
- */
- class Line_Line extends ShapeParameters {
- constructor(pointList) {
- super(pointList);
- /**
- * @member {Array} ShapeParametersLine.prototype.pointList
- * @description 线要素节点数组,二维数组。
- * 数组形如:
- * (start code)
- * [
- * [10, 20], //节点
- * [30, 40],
- * [25, 30] //最后一个节点和第一个节点不必相同,绘制时自动封闭
- * ]
- * (end)
- */
- this.pointList = pointList;
- this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Line";
- }
- /**
- * @function ShapeParametersLine.prototype.destroy
- * @description 销毁对象。
- */
- destroy() {
- this.pointList = null;
- super.destroy();
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/feature/Polygon.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ShapeParametersPolygon
- * @aliasclass Feature.ShapeParameters.Polygon
- * @deprecatedclass SuperMap.Feature.ShapeParameters.Polygon
- * @category Visualization Theme
- * @classdesc 面参数对象。
- * @extends {ShapeParameters}
- * @param {Array} pointList - 横坐标。
- * @usage
- */
- class Polygon_Polygon extends ShapeParameters {
- constructor(pointList) {
- super(pointList);
- /**
- * @member {Array} ShapeParametersPolygon.prototype.pointList
- * @description 面要素节点数组,二维数组。
- * 数组形如:
- * (start code)
- * [
- * [10, 20], //节点
- * [30, 40],
- * [25, 30] //最后一个节点和第一个节点不必相同,绘制时自动封闭
- * ]
- * (end)
- */
- this.pointList = pointList;
- /**
- * @member {Array} ShapeParametersPolygon.prototype.holePolygonPointLists
- * @description 岛洞面多边形顶点数组(三维数组)
- */
- this.holePolygonPointLists = null;
- this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Polygon";
- }
- /**
- * @function ShapeParametersPolygon.prototype.destroy
- * @description 销毁对象。
- */
- destroy() {
- this.pointList = null;
- this.holePolygonPointLists = null;
- super.destroy();
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/feature/Rectangle.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ShapeParametersRectangle
- * @aliasclass Feature.ShapeParameters.Rectangle
- * @deprecatedclass SuperMap.Feature.ShapeParameters.Rectangle
- * @category Visualization Theme
- * @classdesc 矩形参数对象。
- * @extends {ShapeParameters}
- * @param {number} x - 矩形 x 坐标。
- * @param {number} y - 矩形 y 坐标。
- * @param {number} width - 矩形 width 宽度。
- * @param {number} height - 矩形 height 高度。
- * @usage
- */
- class Rectangle_Rectangle extends ShapeParameters {
- constructor(x, y, width, height) {
- super(x, y, width, height);
- /**
- * @member {number} ShapeParametersRectangle.prototype.x
- * @description 左上角 x 坐标。
- */
- this.x = !isNaN(x) ? x : 0;
- /**
- * @member {number} ShapeParametersRectangle.prototype.y
- * @description 左上角 y 坐标。
- */
- this.y = !isNaN(x) ? y : 0;
- /**
- * @member {number} ShapeParametersRectangle.prototype.width
- * @description 宽度。
- */
- this.width = !isNaN(width) ? width : 0;
- /**
- * @member {number} ShapeParametersRectangle.prototype.height
- * @description 高度。
- */
- this.height = !isNaN(height) ? height : 0;
- this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Rectangle";
- }
- /**
- * @function ShapeParametersRectangle.prototype.destroy
- * @description 销毁对象。
- */
- destroy() {
- this.x = null;
- this.y = null;
- this.width = null;
- this.height = null;
- super.destroy();
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/feature/Sector.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ShapeParametersSector
- * @aliasclass Feature.ShapeParameters.Sector
- * @deprecatedclass SuperMap.Feature.ShapeParameters.Sector
- * @category Visualization Theme
- * @classdesc 扇形参数对象。
- * @extends {ShapeParameters}
- * @param {number} x - 圆心 x 坐标。
- * @param {number} y - 圆心 y 坐标。
- * @param {number} r - 外圆半径。
- * @param {number} startAngle - 起始角度。取值范围[0, 360)。
- * @param {number} endAngle - 结束角度。取值范围(0, 360]。
- * @param {number} [r0=0] - 内圆半径,指定后将出现内弧,同时扇边长度为'r - r0'。取值范围[0, r)。
- * @usage
- */
- class Sector extends ShapeParameters {
- constructor(x, y, r, startAngle, endAngle, r0, clockWise) {
- super(x, y, r, startAngle, endAngle, r0, clockWise);
- /**
- * @member {number} ShapeParametersSector.prototype.x
- * @description 圆心 x 坐标。
- */
- this.x = !isNaN(x) ? x : 0;
- /**
- * @member {number} ShapeParametersSector.prototype.Y
- * @description 圆心 Y 坐标。
- */
- this.y = !isNaN(y) ? y : 0;
- /**
- * @member {number} ShapeParametersSector.prototype.r
- * @description 外圆半径。
- */
- this.r = !isNaN(r) ? r : 0;
- /**
- * @member {number} ShapeParametersSector.prototype.startAngle
- * @description 起始角度。取值范围[0, 360),默认值:null。
- */
- this.startAngle = !isNaN(startAngle) ? startAngle : 0;
- /**
- * @member {number} ShapeParametersSector.prototype.endAngle
- * @description 结束角度。取值范围(0, 360],默认值:null。
- */
- this.endAngle = !isNaN(endAngle) ? endAngle : 0;
- /**
- * @member {number} [ShapeParametersSector.prototype.r0=0]
- * @description 内圆半径,指定后将出现内弧,同时扇边长度为 r 减 r0。取值范围[0, r)。
- */
- this.r0 = !isNaN(r0) ? r0 : 0;
- /**
- * @member {number} [ShapeParametersSector.prototype.clockWise=false]
- * @description 是否是顺时针。默认值:false。
- */
- this.clockWise = clockWise;
- this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Sector";
- }
- /**
- * @function ShapeParametersSector.prototype.destroy
- * @description 销毁对象。
- */
- destroy() {
- this.x = null;
- this.y = null;
- this.r = null;
- this.startAngle = null;
- this.endAngle = null;
- this.r0 = null;
- this.clockWise = null;
- super.destroy();
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/feature/Label.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ShapeParametersLabel
- * @aliasclass Feature.ShapeParameters.Label
- * @deprecatedclass SuperMap.Feature.ShapeParameters.Label
- * @category Visualization Theme
- * @classdesc 标签参数对象。
- * @extends {ShapeParameters}
- * @param {number} x - 横坐标。
- * @param {number} y - 纵坐标。
- * @param {string} text - 图形中的附加文本。
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * new {namespace}.Feature.ShapeParameters.Label(x, y, text);
- *
- * // 弃用的写法
- * new SuperMap.Feature.ShapeParameters.Label(x, y, text);
- *
- * </script>
- * // ES6 Import
- * import { ShapeParametersLabel } from '{npm}';
- * new ShapeParametersLabel(x, y, text);
- *
- * // 弃用的写法
- * import { Label } from '{npm}';
- * new Label(x, y, text);
- *
- * ```
- */
- class Label extends ShapeParameters {
- constructor(x, y, text) {
- super(x, y, text);
- /**
- * @member {number} ShapeParametersLabel.prototype.x
- * @description 标签 x 坐标。
- */
- this.x = x;
- /**
- * @member {number} ShapeParametersLabel.prototype.y
- * @description 标签 y 坐标。
- */
- this.y = y;
- /**
- * @member {number} ShapeParametersLabel.prototype.text
- * @description 标签的文本内容。
- */
- this.text = text;
- this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Label";
- }
- /**
- * @function ShapeParametersLabel.prototype.destroy
- * @description 销毁对象。
- */
- destroy() {
- this.x = null;
- this.y = null;
- this.text = null;
- super.destroy();
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/feature/Image.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ShapeParametersImage
- * @aliasclass Feature.ShapeParameters.Image
- * @deprecatedclass SuperMap.Feature.ShapeParameters.Image
- * @category Visualization Theme
- * @classdesc 图片参数对象。
- * @extends {ShapeParameters}
- * @param {number} x - 左上角横坐标。
- * @param {number} y - 左上角纵坐标。
- * @param {(string|Object)} image - 图片地址或Cavans对象。
- * @param {number} width - 绘制到画布上的宽度,默认为图片高度。
- * @param {number} height - 绘制到画布上的高度,默认为图片高度。
- * @param {number} sx - 从图片中裁剪的左上角横坐标。
- * @param {number} sy - 从图片中裁剪的左上角纵坐标。
- * @param {number} sWidth - 从图片中裁剪的宽度,默认为图片高度。
- * @param {number} sHeight - 绘制到画布上的高度,默认为图片高度。
- * @usage
- */
- class Image_Image extends ShapeParameters {
- constructor(x, y, image, width, height, sx, sy, sWidth, sHeight) {
- super(x, y, image, width, height, sx, sy, sWidth, sHeight);
- /**
- * @member {number} ShapeParametersImage.prototype.x
- * @description 左上角横坐标,必设参数。
- */
- this.x = x;
- /**
- * @member {number} ShapeParametersImage.prototype.y
- * @description 左上角纵坐标,必设参数。
- */
- this.y = y;
- /**
- * @member {(string|Object)} ShapeParametersImage.prototype.image
- * @description 图片地址。
- */
- this.image = image;
- /**
- * @member {number} ShapeParametersImage.prototype.width
- * @description 绘制到画布上的宽度,默认为图片高度。
- */
- this.width = width;
- /**
- * @member {number} ShapeParametersImage.prototype.height
- * @description 绘制到画布上的高度,默认为图片高度。
- */
- this.height = height;
- /**
- * @member {number} ShapeParametersImage.prototype.sx
- * @description 从图片中裁剪的左上角横坐标。
- */
- this.sx = sx;
- /**
- * @member {number} ShapeParametersImage.prototype.sy
- * @description 从图片中裁剪的左上角纵坐标。
- */
- this.sy = sy;
- /**
- * @member {number} ShapeParametersImage.prototype.sWidth
- * @description 从图片中裁剪的宽度,默认为图片高度。
- */
- this.sWidth = sWidth;
- /**
- * @member {number} ShapeParametersImage.prototype.sHeight
- * @description 绘制到画布上的高度,默认为图片高度。
- */
- this.sHeight = sHeight;
- this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Image";
- }
- /**
- * @function ShapeParametersImage.prototype.destroy
- * @description 销毁对象。
- */
- destroy() {
- this.x = null;
- this.y = null;
- this.image = null;
- this.width = null;
- this.height = null;
- this.sx = null;
- this.sy = null;
- this.sWidth = null;
- this.sHeight = null;
- super.destroy();
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/feature/Circle.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ShapeParametersCircle
- * @aliasclass Feature.ShapeParameters.Circle
- * @deprecatedclass SuperMap.Feature.ShapeParameters.Circle
- * @classdesc 圆形参数对象。
- * @category Visualization Theme
- * @extends {ShapeParameters}
- * @param {number} x - 圆心 x 坐标。
- * @param {number} y - 圆心 y 坐标。
- * @param {number} r - 圆半径。
- * @usage
- */
- class Circle_Circle extends ShapeParameters {
- constructor(x, y, r) {
- super(x, y, r);
- /**
- * @member {number} ShapeParametersCircle.prototype.x
- * @description 圆心 x 坐标。
- */
- this.x = !isNaN(x) ? x : 0;
- /**
- * @member {number} ShapeParametersCircle.prototype.y
- * @description 圆心 y 坐标。
- */
- this.y = !isNaN(y) ? y : 0;
- /**
- * @member {number} ShapeParametersCircle.prototype.r
- * @description 圆半径。
- */
- this.r = !isNaN(r) ? r : 0;
- this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Circle";
- }
- /**
- * @function ShapeParametersCircle.prototype.destroy
- * @description 销毁对象。
- */
- destroy() {
- this.x = null;
- this.y = null;
- this.r = null;
- super.destroy();
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Eventful.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class LevelRenderer.Eventful
- * @category Visualization Theme
- * @classdesc 事件分发器超类,所有支持事件处理的类均是此类的子类。
- * 此类不可实例化。
- * 支持的事件:
- * Symbolizer properties:
- * onclick - {function} 默认值:null。
- * onmouseover - {function} 默认值:null。
- * onmouseout - {function} 默认值:null。
- * onmousemove - {function} 默认值:null。
- * onmousewheel - {function} 默认值:null。
- * onmousedown - {function} 默认值:null。
- * onmouseup - {function} 默认值:null。
- * ondragstart - {function} 默认值:null。
- * ondragend - {function} 默认值:null。
- * ondragenter - {function} 默认值:null。
- * ondragleave - {function} 默认值:null。
- * ondragover - {function} 默认值:null。
- * ondrop - {function} 默认值:null。
- * @private
- */
- class Eventful {
- constructor() {
- /**
- * @member {Object} LevelRenderer.Eventful.prototype._handlers
- * @description 事件处理对象(事件分发器)。
- */
- this._handlers = {};
- this.CLASS_NAME = "SuperMap.LevelRenderer.Eventful";
- }
- /**
- * @function {Object} LevelRenderer.Eventful.prototype.destroy
- * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
- */
- destroy() {
- this._handlers = null;
- }
- /**
- * @function LevelRenderer.Eventful.prototype.one
- * @description 单次触发绑定,dispatch后销毁。
- * @param {string} event - 事件名。
- * @param {boolean} handler - 响应函数。
- * @param {Object} context - context。
- * @returns {LevelRenderer.Eventful} this
- */
- one(event, handler, context) {
- var _h = this._handlers;
- if (!handler || !event) {
- return this;
- }
- if (!_h[event]) {
- _h[event] = [];
- }
- _h[event].push({
- h: handler,
- one: true,
- ctx: context || this
- });
- return this;
- }
- /**
- * @function LevelRenderer.Eventful.prototype.bind
- * @description 绑定事件。
- * @param {string} event - 事件名。
- * @param {boolean} handler - 响应函数。
- * @param {Object} context - context。
- * @returns {LevelRenderer.Eventful} this
- */
- bind(event, handler, context) {
- var _h = this._handlers;
- if (!handler || !event) {
- return this;
- }
- if (!_h[event]) {
- _h[event] = [];
- }
- _h[event].push({
- h: handler,
- one: false,
- ctx: context || this
- });
- return this;
- }
- /**
- * @function LevelRenderer.Eventful.prototype.unbind
- * @description 解绑事件。
- * @param {string} event - 事件名。
- * @param {boolean} handler - 响应函数。
- * @returns {LevelRenderer.Eventful} this
- */
- unbind(event, handler) {
- var _h = this._handlers;
- if (!event) {
- this._handlers = {};
- return this;
- }
- if (handler) {
- if (_h[event]) {
- var newList = [];
- for (var i = 0, l = _h[event].length; i < l; i++) {
- if (_h[event][i]['h'] != handler) {
- newList.push(_h[event][i]);
- }
- }
- _h[event] = newList;
- }
- if (_h[event] && _h[event].length === 0) {
- delete _h[event];
- }
- } else {
- delete _h[event];
- }
- return this;
- }
- /**
- * @function LevelRenderer.Eventful.prototype.dispatch
- * @description 事件分发。
- * @param {string} type - 事件类型。
- * @returns {LevelRenderer.Eventful} this
- */
- dispatch(type) {
- if (this._handlers[type]) {
- var args = arguments;
- var argLen = args.length;
- if (argLen > 3) {
- args = Array.prototype.slice.call(args, 1);
- }
- var _h = this._handlers[type];
- var len = _h.length;
- for (var i = 0; i < len;) {
- // Optimize advise from backbone
- switch (argLen) {
- case 1:
- _h[i]['h'].call(_h[i]['ctx']);
- break;
- case 2:
- _h[i]['h'].call(_h[i]['ctx'], args[1]);
- break;
- case 3:
- _h[i]['h'].call(_h[i]['ctx'], args[1], args[2]);
- break;
- default:
- // have more than 2 given arguments
- _h[i]['h'].apply(_h[i]['ctx'], args);
- break;
- }
- if (_h[i]['one']) {
- _h.splice(i, 1);
- len--;
- } else {
- i++;
- }
- }
- }
- return this;
- }
- /**
- * @function LevelRenderer.Eventful.prototype.dispatchWithContext
- * @description 带有context的事件分发,最后一个参数是事件回调的 context。
- * @param {string} type - 事件类型。
- * @returns {LevelRenderer.Eventful} this
- */
- dispatchWithContext(type) {
- if (this._handlers[type]) {
- var args = arguments;
- var argLen = args.length;
- if (argLen > 4) {
- args = Array.prototype.slice.call(args, 1, args.length - 1);
- }
- var ctx = args[args.length - 1];
- var _h = this._handlers[type];
- var len = _h.length;
- for (var i = 0; i < len;) {
- // Optimize advise from backbone
- switch (argLen) {
- case 1:
- _h[i]['h'].call(ctx);
- break;
- case 2:
- _h[i]['h'].call(ctx, args[1]);
- break;
- case 3:
- _h[i]['h'].call(ctx, args[1], args[2]);
- break;
- default:
- // have more than 2 given arguments
- _h[i]['h'].apply(ctx, args);
- break;
- }
- if (_h[i]['one']) {
- _h.splice(i, 1);
- len--;
- } else {
- i++;
- }
- }
- }
- return this;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Vector.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @private
- * @class LevelRenderer.Tool.Vector
- * @category Visualization Theme
- * @classdesc LevelRenderer 二维向量类
- *
- */
- class levelRenderer_Vector_Vector {
- constructor() {
- this.ArrayCtor = typeof Float32Array === 'undefined'
- ? Array
- : Float32Array;
- this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Vector";
- }
- /**
- * @function LevelRenderer.Tool.Vector.prototype.create
- * @description 创建一个向量。
- *
- * @param {number} x - x坐标
- * @param {number} y - Y坐标
- * @return {Vector2} 向量。
- */
- create(x, y) {
- var ArrayCtor = this.ArrayCtor;
- var out = new ArrayCtor(2);
- out[0] = x || 0;
- out[1] = y || 0;
- return out;
- }
- /**
- * @function LevelRenderer.Tool.Vector.prototype.copy
- * @description 复制一个向量。
- *
- * @param {Vector2} out - 基础向量。
- * @param {Vector2} v - 向量。
- * @return {Vector2} 克隆向量。
- */
- copy(out, v) {
- out[0] = v[0];
- out[1] = v[1];
- return out;
- }
- /**
- * @function LevelRenderer.Tool.Vector.prototype.set
- * @description 设置向量的两个项。
- *
- * @param {Vector2} out - 基础向量。
- * @param {number} a - 项 a。
- * @param {number} b - 项 b。
- * @return {Vector2} 结果。
- */
- set(out, a, b) {
- out[0] = a;
- out[1] = b;
- return out;
- }
- /**
- * @function LevelRenderer.Tool.Vector.prototype.add
- * @description 向量相加。
- *
- * @param {Vector2} out - 基础向量。
- * @param {Vector2} v1 - 向量 v1。
- * @param {Vector2} v2 - 向量 v2。
- * @return {Vector2} 结果。
- */
- add(out, v1, v2) {
- out[0] = v1[0] + v2[0];
- out[1] = v1[1] + v2[1];
- return out;
- }
- /**
- * @function LevelRenderer.Tool.Vector.prototype.scaleAndAdd
- * @description 向量缩放后相加。
- * @param {Vector2} out - 基础向量。
- * @param {Vector2} v1 - 向量 v1。
- * @param {Vector2} v2 - 向量 v2(缩放向量)。
- * @param {number} a - 缩放参数。
- * @return {Vector2} 结果。
- */
- scaleAndAdd(out, v1, v2, a) {
- out[0] = v1[0] + v2[0] * a;
- out[1] = v1[1] + v2[1] * a;
- return out;
- }
- /**
- * @function LevelRenderer.Tool.Vector.prototype.sub
- * @description 向量相减。
- * @param {Vector2} out - 基础向量。
- * @param {Vector2} v1 - 向量 v1。
- * @param {Vector2} v2 - 向量 v2。
- * @return {Vector2} 结果。
- */
- sub(out, v1, v2) {
- out[0] = v1[0] - v2[0];
- out[1] = v1[1] - v2[1];
- return out;
- }
- /**
- * @function LevelRenderer.Tool.Vector.prototype.len
- * @description 向量长度。
- * @param {Vector2} v - 向量。
- * @return {number} 向量长度。
- */
- len(v) {
- return Math.sqrt(this.lenSquare(v));
- }
- /**
- * @function LevelRenderer.Tool.Vector.prototype.lenSquare
- * @description 向量长度平方。
- * @param {Vector2} v - 向量。
- * @return {number} 向量长度平方。
- */
- lenSquare(v) {
- return v[0] * v[0] + v[1] * v[1];
- }
- /**
- * @function LevelRenderer.Tool.Vector.prototype.mul
- * @description 向量乘法。
- * @param {Vector2} out - 基础向量。
- * @param {Vector2} v1 - 向量 v1。
- * @param {Vector2} v2 - 向量 v2。
- * @return {Vector2} 结果。
- */
- mul(out, v1, v2) {
- out[0] = v1[0] * v2[0];
- out[1] = v1[1] * v2[1];
- return out;
- }
- /**
- * @function LevelRenderer.Tool.Vector.prototype.div
- * @description 向量除法。
- *
- * @param {Vector2} out - 基础向量。
- * @param {Vector2} v1 - 向量 v1。
- * @param {Vector2} v2 - 向量 v2。
- * @return {Vector2} 结果。
- */
- div(out, v1, v2) {
- out[0] = v1[0] / v2[0];
- out[1] = v1[1] / v2[1];
- return out;
- }
- /**
- * @function LevelRenderer.Tool.Vector.prototype.dot
- * @description 向量点乘。
- *
- * @param {Vector2} v1 - 向量 v1。
- * @param {Vector2} v2 - 向量 v2。
- * @return {number} 向量点乘。
- */
- dot(v1, v2) {
- return v1[0] * v2[0] + v1[1] * v2[1];
- }
- /**
- * @function LevelRenderer.Tool.Vector.prototype.scale
- * @description 向量缩放。
- *
- * @param {Vector2} out - 基础向量。
- * @param {Vector2} v - 向量v。
- * @param {number} s -缩放参数。
- * @return {Vector2} 结果。
- */
- scale(out, v, s) {
- out[0] = v[0] * s;
- out[1] = v[1] * s;
- return out;
- }
- /**
- * @function LevelRenderer.Tool.Vector.prototype.normalize
- * @description 向量归一化。
- *
- * @param {Vector2} out - 基础向量。
- * @param {Vector2} v - 向量 v。
- * @return {Vector2} 结果。
- */
- normalize(out, v) {
- var d = this.len(v);
- if (d === 0) {
- out[0] = 0;
- out[1] = 0;
- } else {
- out[0] = v[0] / d;
- out[1] = v[1] / d;
- }
- return out;
- }
- /**
- * @function LevelRenderer.Tool.Vector.prototype.distance
- * @description 计算向量间距离。
- *
- * @param {Vector2} v1 - 向量 v1。
- * @param {Vector2} v2 - 向量 v2。
- * @return {number} 向量间距离。
- */
- distance(v1, v2) {
- return Math.sqrt(
- (v1[0] - v2[0]) * (v1[0] - v2[0])
- + (v1[1] - v2[1]) * (v1[1] - v2[1])
- );
- }
- /**
- * @function LevelRenderer.Tool.Vector.prototype.distanceSquare
- * @description 向量距离平方。
- *
- * @param {Vector2} v1 - 向量 v1。
- * @param {Vector2} v2 - 向量 v2。
- * @return {number} 向量距离平方。
- */
- distanceSquare(v1, v2) {
- return (v1[0] - v2[0]) * (v1[0] - v2[0])
- + (v1[1] - v2[1]) * (v1[1] - v2[1]);
- }
- /**
- * @function LevelRenderer.Tool.Vector.prototype.negate
- * @description 求负向量。
- *
- * @param {Vector2} out - 基础向量。
- * @param {Vector2} v - 向量 v。
- * @return {Vector2} 负向量。
- */
- negate(out, v) {
- out[0] = -v[0];
- out[1] = -v[1];
- return out;
- }
- /**
- * @function LevelRenderer.Tool.Vector.prototype.lerp
- * @description 两点之间线性插值。
- *
- * @param {Vector2} out - 基础向量。
- * @param {Vector2} v1 - 向量 v1。
- * @param {Vector2} v2 - 向量 v2。
- * @param {number} t
- * @return {Vector2} 结果。
- */
- lerp(out, v1, v2, t) {
- out[0] = v1[0] + t * (v2[0] - v1[0]);
- out[1] = v1[1] + t * (v2[1] - v1[1]);
- return out;
- }
- /**
- * @function LevelRenderer.Tool.Vector.prototype.applyTransform
- * @description 矩阵左乘向量。
- *
- * @param {Vector2} out - 基础向量。
- * @param {Vector2} v1 - 向量 v1。
- * @param {Vector2} v2 - 向量 v2。
- * @return {Vector2} 结果。
- */
- applyTransform(out, v, m) {
- var x = v[0];
- var y = v[1];
- out[0] = m[0] * x + m[2] * y + m[4];
- out[1] = m[1] * x + m[3] * y + m[5];
- return out;
- }
- /**
- * @function LevelRenderer.Tool.Vector.prototype.min
- * @description 求两个向量最小值。
- * @param {Vector2} out - 基础向量。
- * @param {Vector2} v1 - 向量 v1。
- * @param {Vector2} v2 - 向量 v2。
- * @return {Vector2} 结果。
- */
- min(out, v1, v2) {
- out[0] = Math.min(v1[0], v2[0]);
- out[1] = Math.min(v1[1], v2[1]);
- return out;
- }
- /**
- * @function LevelRenderer.Tool.Vector.prototype.max
- * @description 求两个向量最大值。
- *
- * @param {Vector2} out - 基础向量。
- * @param {Vector2} v1 - 向量 v1。
- * @param {Vector2} v2 - 向量 v2。
- * @return {Vector2} 结果。
- */
- max(out, v1, v2) {
- out[0] = Math.max(v1[0], v2[0]);
- out[1] = Math.max(v1[1], v2[1]);
- return out;
- }
- /**
- * @function LevelRenderer.Tool.Vector.prototype.length
- * @description 向量长度。
- *
- * @param {Vector2} v - 向量。
- * @return {number} 向量长度。
- */
- length(v) {
- return this.len(v);
- }
- /**
- * @function LevelRenderer.Tool.Vector.prototype.lengthSquare
- * @description 向量长度平方。
- *
- * @param {Vector2} v - 向量。
- * @return {number} 向量长度平方。
- */
- lengthSquare(v) {
- return this.lenSquare(v);
- }
- /**
- * @function LevelRenderer.Tool.Vector.prototype.dist
- * @description 计算向量间距离。
- *
- * @param {Vector2} v1 - 向量 v1。
- * @param {Vector2} v2 - 向量 v2。
- * @return {number} 向量间距离。
- */
- dist(v1, v2) {
- return this.distance(v1, v2);
- }
- /**
- * @function LevelRenderer.Tool.Vector.prototype.distSquare
- * @description 向量距离平方。
- *
- * @param {Vector2} v1 - 向量 v1。
- * @param {Vector2} v2 - 向量 v2。
- * @return {number} 向量距离平方
- */
- distSquare(v1, v2) {
- return this.distanceSquare(v1, v2);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Curve.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class LevelRenderer.Tool.Curve
- * @category Visualization Theme
- * @classdesc LevelRenderer 工具-曲线
- * @private
- */
- class Curve_Curve {
- constructor() {
- /**
- * @member {LevelRenderer.Tool.Vector} LevelRenderer.Tool.Curve.prototype.vector
- * @description 矢量工具。
- */
- this.vector = new levelRenderer_Vector_Vector();
- /**
- * @member {number} LevelRenderer.Tool.Curve.prototype.EPSILON
- * @description e。
- */
- this.EPSILON = 1e-4;
- /**
- * @member {number} LevelRenderer.Tool.Curve.prototype.THREE_SQRT
- * @description 3 的平方根。
- */
- this.THREE_SQRT = Math.sqrt(3);
- /**
- * @member {number} LevelRenderer.Tool.Curve.prototype.ONE_THIRD
- * @description 1/3。
- */
- this.ONE_THIRD = 1 / 3;
- this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Curve";
- }
- /*
- * Method: evalCubicCoeff
- *
- * Parameters:
- * a - {number} 值。
- * b - {number} 值。
- * c - {number} 值。
- * d - {number} 值。
- * t - {number} 值。
- *
- * Returns:
- * {number}
- */
- /*
- evalCubicCoeff: function(a, b, c, d, t){
- return ((a * t + b) * t + c) * t + d;
- },
- */
- /**
- * @function LevelRenderer.Tool.Curve.prototype.isAroundZero
- * @description 判断一个值是否趋于0,判断参考值:1e-4。
- * @param {number} val - 值。
- * @returns {boolean} 值是否趋于0。
- */
- isAroundZero(val) {
- return val > -this.EPSILON && val < this.EPSILON;
- }
- /**
- * @function LevelRenderer.Tool.Curve.prototype.isNotAroundZero
- * @description 判断一个值是否不趋于0,判断参考值:1e-4。
- * @param {number} val - 值。
- * @returns {boolean} 值是否不趋于0。
- */
- isNotAroundZero(val) {
- return val > this.EPSILON || val < -this.EPSILON;
- }
- /**
- * @function LevelRenderer.Tool.Curve.prototype.cubicAt
- * @description 计算三次贝塞尔值
- * @param {number} p0 - 点p0。
- * @param {number} p1 - 点p1。
- * @param {number} p2 - 点p2。
- * @param {number} p3 - 点p3。
- * @param {number} t - t值。
- * @returns {number} 三次贝塞尔值。
- */
- cubicAt(p0, p1, p2, p3, t) {
- var onet = 1 - t;
- return onet * onet * (onet * p0 + 3 * t * p1)
- + t * t * (t * p3 + 3 * onet * p2);
- }
- /**
- * @function LevelRenderer.Tool.Curve.prototype.cubicDerivativeAt
- * @description 计算三次贝塞尔导数值
- * @param {number} p0 - 点p0。
- * @param {number} p1 - 点p1。
- * @param {number} p2 - 点p2。
- * @param {number} p3 - 点p3。
- * @param {number} t - t值。
- * @returns {number} 三次贝塞尔导数值。
- */
- cubicDerivativeAt(p0, p1, p2, p3, t) {
- var onet = 1 - t;
- return 3 * (
- ((p1 - p0) * onet + 2 * (p2 - p1) * t) * onet
- + (p3 - p2) * t * t
- );
- }
- /**
- * @function LevelRenderer.Tool.Curve.prototype.cubicRootAt
- * @description 计算三次贝塞尔方程根,使用盛金公式
- * @param {number} p0 - 点p0。
- * @param {number} p1 - 点p1。
- * @param {number} p2 - 点p2。
- * @param {number} p3 - 点p3。
- * @param {number} val - 值。
- * @param {Array.<number>} roots - 有效根数目。
- * @returns {number} 有效根。
- */
- cubicRootAt(p0, p1, p2, p3, val, roots) {
- // Evaluate roots of cubic functions
- var a = p3 + 3 * (p1 - p2) - p0;
- var b = 3 * (p2 - p1 * 2 + p0);
- var c = 3 * (p1 - p0);
- var d = p0 - val;
- var A = b * b - 3 * a * c;
- var B = b * c - 9 * a * d;
- var C = c * c - 3 * b * d;
- var n = 0;
- if (this.isAroundZero(A) && this.isAroundZero(B)) {
- if (this.isAroundZero(b)) {
- roots[0] = 0;
- } else {
- let t1 = -c / b; //t1, t2, t3, b is not zero
- if (t1 >= 0 && t1 <= 1) {
- roots[n++] = t1;
- }
- }
- } else {
- var disc = B * B - 4 * A * C;
- if (this.isAroundZero(disc)) {
- var K = B / A;
- let t1 = -b / a + K; // t1, a is not zero
- let t2 = -K / 2; // t2, t3
- if (t1 >= 0 && t1 <= 1) {
- roots[n++] = t1;
- }
- if (t2 >= 0 && t2 <= 1) {
- roots[n++] = t2;
- }
- } else if (disc > 0) {
- let discSqrt = Math.sqrt(disc);
- let Y1 = A * b + 1.5 * a * (-B + discSqrt);
- let Y2 = A * b + 1.5 * a * (-B - discSqrt);
- if (Y1 < 0) {
- Y1 = -Math.pow(-Y1, this.ONE_THIRD);
- } else {
- Y1 = Math.pow(Y1, this.ONE_THIRD);
- }
- if (Y2 < 0) {
- Y2 = -Math.pow(-Y2, this.ONE_THIRD);
- } else {
- Y2 = Math.pow(Y2, this.ONE_THIRD);
- }
- let t1 = (-b - (Y1 + Y2)) / (3 * a);
- if (t1 >= 0 && t1 <= 1) {
- roots[n++] = t1;
- }
- } else {
- var T = (2 * A * b - 3 * a * B) / (2 * Math.sqrt(A * A * A));
- var theta = Math.acos(T) / 3;
- var ASqrt = Math.sqrt(A);
- var tmp = Math.cos(theta);
- let t1 = (-b - 2 * ASqrt * tmp) / (3 * a);
- let t2 = (-b + ASqrt * (tmp + this.THREE_SQRT * Math.sin(theta))) / (3 * a);
- let t3 = (-b + ASqrt * (tmp - this.THREE_SQRT * Math.sin(theta))) / (3 * a);
- if (t1 >= 0 && t1 <= 1) {
- roots[n++] = t1;
- }
- if (t2 >= 0 && t2 <= 1) {
- roots[n++] = t2;
- }
- if (t3 >= 0 && t3 <= 1) {
- roots[n++] = t3;
- }
- }
- }
- return n;
- }
- /**
- * @function LevelRenderer.Tool.Curve.prototype.cubicRootAt
- * @description 计算三次贝塞尔方程极限值的位置
- * @param {number} p0 - 点p0。
- * @param {number} p1 - 点p1。
- * @param {number} p2 - 点p2。
- * @param {number} p3 - 点p3。
- * @param {Array.<number>} extrema - 值。
- * @returns {number} 有效数目。
- */
- cubicExtrema(p0, p1, p2, p3, extrema) {
- var b = 6 * p2 - 12 * p1 + 6 * p0;
- var a = 9 * p1 + 3 * p3 - 3 * p0 - 9 * p2;
- var c = 3 * p1 - 3 * p0;
- var n = 0;
- if (this.isAroundZero(a)) {
- if (this.isNotAroundZero(b)) {
- let t1 = -c / b;
- if (t1 >= 0 && t1 <= 1) {
- extrema[n++] = t1;
- }
- }
- } else {
- var disc = b * b - 4 * a * c;
- if (this.isAroundZero(disc)) {
- extrema[0] = -b / (2 * a);
- } else if (disc > 0) {
- let discSqrt = Math.sqrt(disc);
- let t1 = (-b + discSqrt) / (2 * a);
- let t2 = (-b - discSqrt) / (2 * a);
- if (t1 >= 0 && t1 <= 1) {
- extrema[n++] = t1;
- }
- if (t2 >= 0 && t2 <= 1) {
- extrema[n++] = t2;
- }
- }
- }
- return n;
- }
- /**
- * @function LevelRenderer.Tool.Curve.prototype.cubicSubdivide
- * @description 细分三次贝塞尔曲线
- * @param {number} p0 - 点p0。
- * @param {number} p1 - 点p1。
- * @param {number} p2 - 点p2。
- * @param {number} p3 - 点p3。
- * @param {number} t - t值。
- * @param {Array.<number>} out - 投射点。
- * @returns {number} 投射点。
- */
- cubicSubdivide(p0, p1, p2, p3, t, out) {
- var p01 = (p1 - p0) * t + p0;
- var p12 = (p2 - p1) * t + p1;
- var p23 = (p3 - p2) * t + p2;
- var p012 = (p12 - p01) * t + p01;
- var p123 = (p23 - p12) * t + p12;
- var p0123 = (p123 - p012) * t + p012;
- // Seg0
- out[0] = p0;
- out[1] = p01;
- out[2] = p012;
- out[3] = p0123;
- // Seg1
- out[4] = p0123;
- out[5] = p123;
- out[6] = p23;
- out[7] = p3;
- }
- /**
- * @function LevelRenderer.Tool.Curve.prototype.cubicProjectPoint
- * @description 投射点到三次贝塞尔曲线上,返回投射距离。投射点有可能会有一个或者多个,这里只返回其中距离最短的一个。
- * @param {number} x0 - 点p0横坐标。
- * @param {number} y0 - 点p0纵坐标。
- * @param {number} x1 - 点p1横坐标。
- * @param {number} y1 - 点p1纵坐标。
- * @param {number} x2 - 点p2横坐标。
- * @param {number} y2 - 点p2纵坐标。
- * @param {number} x3 - 点p3横坐标。
- * @param {number} y3 - 点p3纵坐标。
- * @param {number} x - 点p横坐标。
- * @param {number} y - 点p纵坐标。
- * @param {Array.<number>} out - 投射点。
- * @returns {number} 投射点。
- */
- cubicProjectPoint(x0, y0, x1, y1, x2, y2, x3, y3, x, y, out) {
- // 临时变量
- var _v0 = this.vector.create();
- var _v1 = this.vector.create();
- var _v2 = this.vector.create();
- // var _v3 = vector.create();
- // http://pomax.github.io/bezierinfo/#projections
- var t;
- var interval = 0.005;
- var d = Infinity;
- _v0[0] = x;
- _v0[1] = y;
- // 先粗略估计一下可能的最小距离的 t 值
- // PENDING
- for (let _t = 0; _t < 1; _t += 0.05) {
- _v1[0] = this.cubicAt(x0, x1, x2, x3, _t);
- _v1[1] = this.cubicAt(y0, y1, y2, y3, _t);
- let d1 = this.vector.distSquare(_v0, _v1);
- if (d1 < d) {
- t = _t;
- d = d1;
- }
- }
- d = Infinity;
- // At most 32 iteration
- for (let i = 0; i < 32; i++) {
- if (interval < this.EPSILON) {
- break;
- }
- let prev = t - interval;
- let next = t + interval;
- // t - interval
- _v1[0] = this.cubicAt(x0, x1, x2, x3, prev);
- _v1[1] = this.cubicAt(y0, y1, y2, y3, prev);
- let d1 = this.vector.distSquare(_v1, _v0);
- if (prev >= 0 && d1 < d) {
- t = prev;
- d = d1;
- } else {
- // t + interval
- _v2[0] = this.cubicAt(x0, x1, x2, x3, next);
- _v2[1] = this.cubicAt(y0, y1, y2, y3, next);
- let d2 = this.vector.distSquare(_v2, _v0);
- if (next <= 1 && d2 < d) {
- t = next;
- d = d2;
- } else {
- interval *= 0.5;
- }
- }
- }
- // t
- if (out) {
- out[0] = this.cubicAt(x0, x1, x2, x3, t);
- out[1] = this.cubicAt(y0, y1, y2, y3, t);
- }
- // console.log(interval, i);
- return Math.sqrt(d);
- }
- /**
- * @function LevelRenderer.Tool.Curve.prototype.quadraticAt
- * @description 计算二次方贝塞尔值。
- * @param {number} p0 - 点p0。
- * @param {number} p1 - 点p1。
- * @param {number} p2 - 点p2。
- * @param {number} t - t值。
- * @returns {number} 二次方贝塞尔值。
- */
- quadraticAt(p0, p1, p2, t) {
- var onet = 1 - t;
- return onet * (onet * p0 + 2 * t * p1) + t * t * p2;
- }
- /**
- * @function LevelRenderer.Tool.Curve.prototype.quadraticAt
- * @description 计算二次方贝塞尔导数值。
- * @param {number} p0 - 点p0。
- * @param {number} p1 - 点p1。
- * @param {number} p2 - 点p2。
- * @param {number} t - t值。
- * @returns {number} 二次方贝塞尔导数值。
- */
- quadraticDerivativeAt(p0, p1, p2, t) {
- return 2 * ((1 - t) * (p1 - p0) + t * (p2 - p1));
- }
- /**
- * @function LevelRenderer.Tool.Curve.prototype.quadraticRootAt
- * @description 计算二次方贝塞尔方程根
- * @param {number} p0 - 点p0。
- * @param {number} p1 - 点p1。
- * @param {number} p2 - 点p2。
- * @param {number} val - 值。
- * @param {Array.<number>} roots - 有效根数目。
- * @returns {number} 有效根数目。
- */
- quadraticRootAt(p0, p1, p2, val, roots) {
- var a = p0 - 2 * p1 + p2;
- var b = 2 * (p1 - p0);
- var c = p0 - val;
- var n = 0;
- if (this.isAroundZero(a)) {
- if (this.isNotAroundZero(b)) {
- var t1 = -c / b;
- if (t1 >= 0 && t1 <= 1) {
- roots[n++] = t1;
- }
- }
- } else {
- var disc = b * b - 4 * a * c;
- if (this.isAroundZero(disc)) {
- let t1 = -b / (2 * a);
- if (t1 >= 0 && t1 <= 1) {
- roots[n++] = t1;
- }
- } else if (disc > 0) {
- let discSqrt = Math.sqrt(disc);
- let t1 = (-b + discSqrt) / (2 * a);
- let t2 = (-b - discSqrt) / (2 * a);
- if (t1 >= 0 && t1 <= 1) {
- roots[n++] = t1;
- }
- if (t2 >= 0 && t2 <= 1) {
- roots[n++] = t2;
- }
- }
- }
- return n;
- }
- /**
- * @function LevelRenderer.Tool.Curve.prototype.quadraticExtremum
- * @description 计算二次贝塞尔方程极限值
- * @param {number} p0 - 点p0。
- * @param {number} p1 - 点p1。
- * @param {number} p2 - 点p2。
- * @returns {number} 二次贝塞尔方程极限值。
- */
- quadraticExtremum(p0, p1, p2) {
- var divider = p0 + p2 - 2 * p1;
- if (divider === 0) {
- // p1 is center of p0 and p2
- return 0.5;
- } else {
- return (p0 - p1) / divider;
- }
- }
- /**
- * @function LevelRenderer.Tool.Curve.prototype.quadraticProjectPoint
- * @description 投射点到二次贝塞尔曲线上,返回投射距离。投射点有可能会有一个或者多个,这里只返回其中距离最短的一个。
- * @param {number} x0 - 点p0横坐标。
- * @param {number} y0 - 点p0纵坐标。
- * @param {number} x1 - 点p1横坐标。
- * @param {number} y1 - 点p1纵坐标。
- * @param {number} x2 - 点p2横坐标。
- * @param {number} y2 - 点p2纵坐标。
- * @param {number} x - 点p横坐标。
- * @param {number} y - 点p纵坐标。
- * @param {Array.<number>} out - 投射点。
- * @returns {number} 投射距离。
- */
- quadraticProjectPoint(x0, y0, x1, y1, x2, y2, x, y, out) {
- // 临时变量
- var _v0 = this.vector.create();
- var _v1 = this.vector.create();
- var _v2 = this.vector.create();
- // http://pomax.github.io/bezierinfo/#projections
- var t;
- var interval = 0.005;
- var d = Infinity;
- _v0[0] = x;
- _v0[1] = y;
- // 先粗略估计一下可能的最小距离的 t 值
- // PENDING
- for (let _t = 0; _t < 1; _t += 0.05) {
- _v1[0] = this.quadraticAt(x0, x1, x2, _t);
- _v1[1] = this.quadraticAt(y0, y1, y2, _t);
- let d1 = this.vector.distSquare(_v0, _v1);
- if (d1 < d) {
- t = _t;
- d = d1;
- }
- }
- d = Infinity;
- // At most 32 iteration
- for (let i = 0; i < 32; i++) {
- if (interval < this.EPSILON) {
- break;
- }
- let prev = t - interval;
- let next = t + interval;
- // t - interval
- _v1[0] = this.quadraticAt(x0, x1, x2, prev);
- _v1[1] = this.quadraticAt(y0, y1, y2, prev);
- let d1 = this.vector.distSquare(_v1, _v0);
- if (prev >= 0 && d1 < d) {
- t = prev;
- d = d1;
- } else {
- // t + interval
- _v2[0] = this.quadraticAt(x0, x1, x2, next);
- _v2[1] = this.quadraticAt(y0, y1, y2, next);
- let d2 = this.vector.distSquare(_v2, _v0);
- if (next <= 1 && d2 < d) {
- t = next;
- d = d2;
- } else {
- interval *= 0.5;
- }
- }
- }
- // t
- if (out) {
- out[0] = this.quadraticAt(x0, x1, x2, t);
- out[1] = this.quadraticAt(y0, y1, y2, t);
- }
- // console.log(interval, i);
- return Math.sqrt(d);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Area.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class LevelRenderer.Tool.Area
- * @category Visualization Theme
- * @classdesc LevelRenderer 工具-图形范围判断
- * @private
- */
- class Area {
- constructor() {
- /**
- * @member {LevelRenderer.Tool.Util} LevelRenderer.Tool.Areal.prototype.util
- * @description 基础工具对象。
- */
- this.util = new Util_Util();
- /**
- * @member {LevelRenderer.Tool.Curve} LevelRenderer.Tool.Areal.prototype.curve
- * @description 曲线工具对象
- */
- this.curve = new Curve_Curve();
- /**
- * @member {Object} LevelRenderer.Tool.Areal.prototype._ctx
- * @description Cavans2D 渲染上下文
- */
- this._ctx = null;
- /**
- * @member {Object} LevelRenderer.Tool.Areal.prototype._textWidthCache
- * @description 文本宽度缓存
- */
- this._textWidthCache = {};
- /**
- * @member {Object} LevelRenderer.Tool.Areal.prototype._textHeightCache
- * @description 文本高度缓存
- */
- this._textHeightCache = {};
- /**
- * @member {number} LevelRenderer.Tool.Areal.prototype._textWidthCacheCounter
- * @description 文本宽度缓存数量
- */
- this._textWidthCacheCounter = 0;
- /**
- * @member {number} LevelRenderer.Tool.Areal.prototype._textHeightCacheCounter
- * @description 文本高度缓存数量
- */
- this._textHeightCacheCounter = 0;
- /**
- * @member {number} LevelRenderer.Tool.Areal.prototype.TEXT_CACHE_MAX
- * @description 文本最大缓存数量
- */
- this.TEXT_CACHE_MAX = 5000;
- /**
- * @member {number} LevelRenderer.Tool.Areal.prototype.PI2
- * @description 2*PI 的值
- */
- this.PI2 = Math.PI * 2;
- /**
- * @member {Array.<number>} LevelRenderer.Tool.Areal.prototype.roots
- * @description 临时数组
- */
- this.roots = [-1, -1, -1];
- /**
- * @member {Array.<number>} LevelRenderer.Tool.Areal.prototype.extrema
- * @description 临时数组
- */
- this.extrema = [-1, -1];
- this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Area";
- }
- /**
- * @function LevelRenderer.Tool.Areal.prototype.normalizeRadian
- * @description 弧度标准化函数。
- * @param {number} angle - 弧度值。
- * @returns {number} 标准化后的弧度值。
- */
- normalizeRadian(angle) {
- angle %= this.PI2;
- if (angle < 0) {
- angle += this.PI2;
- }
- return angle;
- }
- /**
- * @function LevelRenderer.Tool.Areal.prototype.isInside
- * @description 包含判断。
- * @param {Object} shape - 图形。
- * @param {number} area - 目标区域。
- * @param {number} x - 横坐标。
- * @param {number} y - 纵坐标。
- * @returns {boolean} 图形是否包含鼠标位置。
- */
- isInside(shape, area, x, y) {
- if (!area || !shape) {
- // 无参数或不支持类型
- return false;
- }
- var zoneType = shape.type;
- this._ctx = this._ctx || this.util.getContext();
- // 未实现或不可用时则数学运算,主要是line,brokenLine,ring
- var _mathReturn = this._mathMethod(shape, area, x, y);
- if (typeof _mathReturn != 'undefined') {
- return _mathReturn;
- }
- if (shape.buildPath && this._ctx.isPointInPath) {
- return this._buildPathMethod(shape, this._ctx, area, x, y);
- }
- // 上面的方法都行不通时
- switch (zoneType) {
- case 'ellipse': // Todo,不精确
- case 'smicellipse': // Todo,不精确
- return true;
- // 旋轮曲线 不准确
- case 'trochoid':
- var _r = area.location == 'out'
- ? area.r1 + area.r2 + area.d
- : area.r1 - area.r2 + area.d;
- return this.isInsideCircle(area, x, y, _r);
- // 玫瑰线 不准确
- case 'rose' :
- return this.isInsideCircle(area, x, y, area.maxr);
- // 路径,椭圆,曲线等-----------------13
- default:
- return false; // Todo,暂不支持
- }
- }
- /**
- * @function LevelRenderer.Tool.Areal.prototype._mathMethod
- * @description 包含判断。用数学方法判断,三个方法中最快,但是支持的shape少。
- * @param {Object} shape - 图形。
- * @param {number} area - 目标区域。
- * @param {number} x - 横坐标。
- * @param {number} y - 纵坐标。
- * @returns {boolean} 图形是否包含鼠标位置,true表示坐标处在图形中。
- */
- _mathMethod(shape, area, x, y) {
- var zoneType = shape.type;
- // 在矩形内则部分图形需要进一步判断
- switch (zoneType) {
- // 贝塞尔曲线
- case 'bezier-curve':
- if (typeof(area.cpX2) === 'undefined') {
- return this.isInsideQuadraticStroke(
- area.xStart, area.yStart,
- area.cpX1, area.cpY1,
- area.xEnd, area.yEnd,
- area.lineWidth, x, y
- );
- }
- return this.isInsideCubicStroke(
- area.xStart, area.yStart,
- area.cpX1, area.cpY1,
- area.cpX2, area.cpY2,
- area.xEnd, area.yEnd,
- area.lineWidth, x, y
- );
- // 线
- case 'line':
- return this.isInsideLine(
- area.xStart, area.yStart,
- area.xEnd, area.yEnd,
- area.lineWidth, x, y
- );
- // 折线
- case 'broken-line':
- return this.isInsideBrokenLine(
- area.pointList, area.lineWidth, x, y
- );
- // 扩展折线
- case 'smicbroken-line': {
- // SMIC-修改 - start
- let icX = x;
- let icY = y;
- if (shape.refOriginalPosition) {
- icX = x - shape.refOriginalPosition[0];
- icY = y - shape.refOriginalPosition[1];
- }
- return this.isInsideBrokenLine(
- area.pointList, area.lineWidth, icX, icY
- );
- }
- //初始代码:
- // return isInsideBrokenLine(
- // area.pointList, area.lineWidth, x, y
- // );
- // SMIC-修改 - end
- // 圆环
- case 'ring':
- return this.isInsideRing(
- area.x, area.y, area.r0, area.r, x, y
- );
- case 'smicring': {
- let areaX = area.x;
- let areaY = area.y;
- if (shape.refOriginalPosition) {
- areaX = area.x + shape.refOriginalPosition[0];
- areaY = area.y + shape.refOriginalPosition[1];
- }
- return this.isInsideRing(
- areaX, areaY, area.r0, area.r, x, y
- );
- }
- // 圆形
- case 'circle':
- return this.isInsideCircle(
- area.x, area.y, area.r, x, y
- );
- // 扩展-点
- case 'smicpoint': {
- // SMIC-修改 - start
- let icX = x;
- let icY = y;
- if (shape.refOriginalPosition) {
- icX = x - shape.refOriginalPosition[0];
- icY = y - shape.refOriginalPosition[1];
- }
- return this.isInsideCircle(
- area.x, area.y, area.r, icX, icY
- );
- }
- //初始代码:
- // 无
- // SMIC-修改 - end
- // 扇形
- case 'sector': {
- let startAngle = area.startAngle * Math.PI / 180;
- let endAngle = area.endAngle * Math.PI / 180;
- if (!area.clockWise) {
- startAngle = -startAngle;
- endAngle = -endAngle;
- }
- return this.isInsideSector(
- area.x, area.y, area.r0, area.r,
- startAngle, endAngle,
- !area.clockWise,
- x, y
- );
- }
- //初始代码:
- // 无
- // SMIC-增加 - end
- // 扇形
- case 'smicsector': {
- let startAngle = area.startAngle * Math.PI / 180;
- let endAngle = area.endAngle * Math.PI / 180;
- if (!area.clockWise) {
- startAngle = -startAngle;
- endAngle = -endAngle;
- }
- let areaX = area.x;
- let areaY = area.y;
- if (shape.refOriginalPosition) {
- areaX = area.x + shape.refOriginalPosition[0];
- areaY = area.y + shape.refOriginalPosition[1];
- }
- return this.isInsideSector(
- areaX, areaY, area.r0, area.r,
- startAngle, endAngle,
- !area.clockWise,
- x, y
- );
- }
- // 多边形
- case 'path':
- return this.isInsidePath(
- area.pathArray, Math.max(area.lineWidth, 5),
- area.brushType, x, y
- );
- case 'polygon':
- case 'star':
- case 'smicstar':
- case 'isogon':
- case 'smicisogon':
- return this.isInsidePolygon(area.pointList, x, y);
- // 扩展多边形
- case 'smicpolygon': {
- // SMIC-修改 - start
- let icX = x;
- let icY = y;
- if (shape.refOriginalPosition) {
- icX = x - shape.refOriginalPosition[0];
- icY = y - shape.refOriginalPosition[1];
- }
- //岛洞面
- if (shape.holePolygonPointLists && shape.holePolygonPointLists.length > 0) {
- var isOnBase = this.isInsidePolygon(area.pointList, icX, icY);
- // 遍历岛洞子面
- var holePLS = shape.holePolygonPointLists;
- var isOnHole = false;
- for (var i = 0, holePLSen = holePLS.length; i < holePLSen; i++) {
- var holePL = holePLS[i];
- var isOnSubHole = this.isInsidePolygon(holePL, icX, icY);
- if (isOnSubHole === true) {
- isOnHole = true;
- }
- }
- // 捕获判断
- return isOnBase === true && isOnHole === false;
- } else {
- return this.isInsidePolygon(area.pointList, icX, icY);
- }
- }
- // 初始代码:
- // 无
- // SMIC-修改 - end
- // 文本
- case 'text':
- var rect = area.__rect || shape.getRect(area);
- return this.isInsideRect(
- rect.x, rect.y, rect.width, rect.height, x, y
- );
- // 扩展文本
- case 'smictext':
- //用文本背景矩形判断
- var textBg = shape.getTextBackground(area);
- return this.isInsidePolygon(textBg, x, y);
- //初始代码:
- // 无
- // SMIC-修改 - end
- // 矩形
- case 'rectangle':
- case 'image':
- // 图片
- return this.isInsideRect(
- area.x, area.y, area.width, area.height, x, y
- );
- case 'smicimage': {
- let areaX = area.x;
- let areaY = area.y;
- if (shape.refOriginalPosition) {
- areaX = area.x + shape.refOriginalPosition[0];
- areaY = area.y + shape.refOriginalPosition[1];
- }
- return this.isInsideRect(
- areaX, areaY, area.width, area.height, x, y
- );
- }
- //// 扩展矩形
- //case 'smicpolygon':
- // // SMIC-修改 - start
- // var icX = x;
- // var icY = y;
- // if(shape.refOriginalPosition) {
- // icX = x - shape.refOriginalPosition[0];
- // icY = y - shape.refOriginalPosition[1];
- // }
- // return this.isInsideRect(
- // area.x, area.y, area.width, area.height, icX, icY
- // );
- //初始代码:
- // 无
- // SMIC-修改 - end
- }
- }
- /**
- * @function LevelRenderer.Tool.Areal.prototype._buildPathMethod
- * @description 包含判断。通过buildPath方法来判断,三个方法中较快,但是不支持线条类型的 shape。
- * @param {Object} shape - 图形。
- * @param {Object} context - 上下文。
- * @param {number} area - 目标区域。
- * @param {number} x - 横坐标。
- * @param {number} y - 纵坐标。
- * @returns {boolean} 图形是否包含鼠标位置,true表示坐标处在图形中。
- */
- _buildPathMethod(shape, context, area, x, y) {
- // 图形类实现路径创建了则用类的path
- context.beginPath();
- shape.buildPath(context, area);
- context.closePath();
- return context.isPointInPath(x, y);
- }
- /**
- * @function LevelRenderer.Tool.Areal.prototype.isOutside
- * @description 图形是否不包含鼠标位置。
- * @param {Object} shape - 图形。
- * @param {number} area - 目标区域。
- * @param {number} x - 横坐标。
- * @param {number} y - 纵坐标。
- * @returns {boolean} 图形是否不包含鼠标位置, true表示坐标处在图形外。
- */
- isOutside(shape, area, x, y) {
- return !this.isInside(shape, area, x, y);
- }
- /**
- * @function LevelRenderer.Tool.Areal.prototype.isInsideLine
- * @description 线段包含判断。
- * @param {number} x0 - 线起始点横坐标。
- * @param {number} y0 - 线起始点纵坐标。
- * @param {number} x1 - 线终点横坐标。
- * @param {number} y1 - 线终点纵坐标。
- * @param {number} lineWidth - 线宽。
- * @param {number} x - 鼠标位置横坐标。
- * @param {number} y - 鼠标位置纵坐标。
- * @returns {boolean} 图形是否包含鼠标位置,true表示坐标处在图形内。
- */
- isInsideLine(x0, y0, x1, y1, lineWidth, x, y) {
- if (lineWidth === 0) {
- return false;
- }
- var _l = Math.max(lineWidth, 5);
- var _a = 0;
- var _b = 0;
- // Quick reject
- if (
- (y > y0 + _l && y > y1 + _l)
- || (y < y0 - _l && y < y1 - _l)
- || (x > x0 + _l && x > x1 + _l)
- || (x < x0 - _l && x < x1 - _l)
- ) {
- return false;
- }
- if (x0 !== x1) {
- _a = (y0 - y1) / (x0 - x1);
- _b = (x0 * y1 - x1 * y0) / (x0 - x1);
- } else {
- return Math.abs(x - x0) <= _l / 2;
- }
- var tmp = _a * x - y + _b;
- var _s = tmp * tmp / (_a * _a + 1);
- return _s <= _l / 2 * _l / 2;
- }
- /**
- * @function LevelRenderer.Tool.Areal.prototype.isInsideCubicStroke
- * @description 三次贝塞尔曲线描边包含判断。
- * @param {number} x0 - 点1横坐标。
- * @param {number} y0 - 点1纵坐标。
- * @param {number} x1 - 点2横坐标。
- * @param {number} y1 - 点2纵坐标。
- * @param {number} x2 - 点3纵坐标。
- * @param {number} y2 - 点3纵坐标。
- * @param {number} lineWidth - 线宽。
- * @param {number} x - 鼠标位置横坐标。
- * @param {number} y - 鼠标位置纵坐标。
- * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
- */
- isInsideCubicStroke(x0, y0, x1, y1, x2, y2, x3, y3, lineWidth, x, y) {
- if (lineWidth === 0) {
- return false;
- }
- var _l = Math.max(lineWidth, 5);
- // Quick reject
- if (
- (y > y0 + _l && y > y1 + _l && y > y2 + _l && y > y3 + _l)
- || (y < y0 - _l && y < y1 - _l && y < y2 - _l && y < y3 - _l)
- || (x > x0 + _l && x > x1 + _l && x > x2 + _l && x > x3 + _l)
- || (x < x0 - _l && x < x1 - _l && x < x2 - _l && x < x3 - _l)
- ) {
- return false;
- }
- var d = this.curve.cubicProjectPoint(
- x0, y0, x1, y1, x2, y2, x3, y3,
- x, y, null
- );
- return d <= _l / 2;
- }
- /**
- * @function LevelRenderer.Tool.Areal.prototype.isInsideQuadraticStroke
- * @description 二次贝塞尔曲线描边包含判断。
- * @param {number} x0 - 点1横坐标。
- * @param {number} y0 - 点1纵坐标。
- * @param {number} x1 - 点2横坐标。
- * @param {number} y1 - 点2纵坐标。
- * @param {number} x2 - 点3纵坐标。
- * @param {number} y2 - 点3纵坐标。
- * @param {number} lineWidth - 线宽。
- * @param {number} x - 鼠标位置横坐标。
- * @param {number} y - 鼠标位置纵坐标。
- * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
- */
- isInsideQuadraticStroke(x0, y0, x1, y1, x2, y2, lineWidth, x, y) {
- if (lineWidth === 0) {
- return false;
- }
- var _l = Math.max(lineWidth, 5);
- // Quick reject
- if (
- (y > y0 + _l && y > y1 + _l && y > y2 + _l)
- || (y < y0 - _l && y < y1 - _l && y < y2 - _l)
- || (x > x0 + _l && x > x1 + _l && x > x2 + _l)
- || (x < x0 - _l && x < x1 - _l && x < x2 - _l)
- ) {
- return false;
- }
- var d = this.curve.quadraticProjectPoint(
- x0, y0, x1, y1, x2, y2,
- x, y, null
- );
- return d <= _l / 2;
- }
- /**
- * @function LevelRenderer.Tool.Areal.prototype.isInsideArcStroke
- * @description 圆弧描边包含判断。
- * @param {number} cx - 圆心横坐标。
- * @param {number} cy - 圆心纵坐标。
- * @param {number} r - 圆半径。
- * @param {number} startAngle - 起始角度。
- * @param {number} endAngle - 终止角度。
- * @param {number} anticlockwise - 顺时针还是逆时针。
- * @param {number} lineWidth - 线宽。
- * @param {number} x - 鼠标位置横坐标。
- * @param {number} y - 鼠标位置纵坐标。
- * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
- */
- isInsideArcStroke(cx, cy, r, startAngle, endAngle, anticlockwise, lineWidth, x, y) {
- var PI2 = this.PI2;
- if (lineWidth === 0) {
- return false;
- }
- var _l = Math.max(lineWidth, 5);
- x -= cx;
- y -= cy;
- var d = Math.sqrt(x * x + y * y);
- if ((d - _l > r) || (d + _l < r)) {
- return false;
- }
- if (Math.abs(startAngle - endAngle) >= PI2) {
- // Is a circle
- return true;
- }
- if (anticlockwise) {
- var tmp = startAngle;
- startAngle = this.normalizeRadian(endAngle);
- endAngle = this.normalizeRadian(tmp);
- } else {
- startAngle = this.normalizeRadian(startAngle);
- endAngle = this.normalizeRadian(endAngle);
- }
- if (startAngle > endAngle) {
- endAngle += PI2;
- }
- var angle = Math.atan2(y, x);
- if (angle < 0) {
- angle += PI2;
- }
- return (angle >= startAngle && angle <= endAngle)
- || (angle + PI2 >= startAngle && angle + PI2 <= endAngle);
- }
- /**
- * @function LevelRenderer.Tool.Areal.prototype.isInsideBrokenLine
- * @description 图形 BrokenLine 是否包含鼠标位置, true表示坐标处在图形内。
- * @param {Array} points - 曲线点对象。
- * @param {number} lineWidth - 线宽。
- * @param {number} x - 鼠标位置横坐标。
- * @param {number} y - 鼠标位置纵坐标。
- * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
- */
- isInsideBrokenLine(points, lineWidth, x, y) {
- var _lineWidth = Math.max(lineWidth, 10);
- for (var i = 0, l = points.length - 1; i < l; i++) {
- var x0 = points[i][0];
- var y0 = points[i][1];
- var x1 = points[i + 1][0];
- var y1 = points[i + 1][1];
- if (this.isInsideLine(x0, y0, x1, y1, _lineWidth, x, y)) {
- return true;
- }
- }
- return false;
- }
- /**
- * @function LevelRenderer.Tool.Areal.prototype.isInsideRing
- * @description 图形 Ring 是否包含鼠标位置, true表示坐标处在图形内。
- * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
- */
- isInsideRing(cx, cy, r0, r, x, y) {
- var d = (x - cx) * (x - cx) + (y - cy) * (y - cy);
- return (d < r * r) && (d > r0 * r0);
- }
- /**
- * @function LevelRenderer.Tool.Areal.prototype.isInsideRect
- * @description 图形 Rect 是否包含鼠标位置, true表示坐标处在图形内。
- * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
- */
- isInsideRect(x0, y0, width, height, x, y) {
- return x >= x0 && x <= (x0 + width) && y >= y0 && y <= (y0 + height);
- }
- /**
- * @function LevelRenderer.Tool.Areal.prototype.isInsideCircle
- * @description 图形 Circle 是否包含鼠标位置, true表示坐标处在图形内。
- * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
- */
- isInsideCircle(x0, y0, r, x, y) {
- return (x - x0) * (x - x0) + (y - y0) * (y - y0) < r * r;
- }
- /**
- * @function LevelRenderer.Tool.Areal.prototype.isInsideSector
- * @description 图形 Sector 是否包含鼠标位置, true表示坐标处在图形内。
- * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
- */
- isInsideSector(cx, cy, r0, r, startAngle, endAngle, anticlockwise, x, y) {
- return this.isInsideArcStroke(cx, cy, (r0 + r) / 2, startAngle, endAngle, anticlockwise, r - r0, x, y);
- }
- /**
- * @function LevelRenderer.Tool.Areal.prototype.isInsidePolygon
- * @description 图形 Polygon 是否包含鼠标位置, true表示坐标处在图形内。与 canvas 一样采用 non-zero winding rule
- * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
- */
- isInsidePolygon(points, x, y) {
- var N = points.length;
- var w = 0;
- for (var i = 0, j = N - 1; i < N; i++) {
- var x0 = points[j][0];
- var y0 = points[j][1];
- var x1 = points[i][0];
- var y1 = points[i][1];
- w += this.windingLine(x0, y0, x1, y1, x, y);
- j = i;
- }
- return w !== 0;
- }
- /**
- * @function LevelRenderer.Tool.Areal.prototype.windingLine
- */
- windingLine(x0, y0, x1, y1, x, y) {
- if ((y > y0 && y > y1) || (y < y0 && y < y1)) {
- return 0;
- }
- if (y1 == y0) {
- return 0;
- }
- var dir = y1 < y0 ? 1 : -1;
- var t = (y - y0) / (y1 - y0);
- var x_ = t * (x1 - x0) + x0;
- return x_ > x ? dir : 0;
- }
- /**
- * @function LevelRenderer.Tool.Areal.prototype.swapExtrema
- */
- swapExtrema() {
- var tmp = this.extrema[0];
- this.extrema[0] = this.extrema[1];
- this.extrema[1] = tmp;
- }
- /**
- * @function LevelRenderer.Tool.Areal.prototype.windingCubic
- */
- windingCubic(x0, y0, x1, y1, x2, y2, x3, y3, x, y) {
- var curve = this.curve;
- var roots = this.roots;
- var extrema = this.extrema;
- // Quick reject
- if (
- (y > y0 && y > y1 && y > y2 && y > y3)
- || (y < y0 && y < y1 && y < y2 && y < y3)
- ) {
- return 0;
- }
- var nRoots = curve.cubicRootAt(y0, y1, y2, y3, y, roots);
- if (nRoots === 0) {
- return 0;
- } else {
- var w = 0;
- var nExtrema = -1;
- var y0_, y1_;
- for (var i = 0; i < nRoots; i++) {
- var t = roots[i];
- var x_ = curve.cubicAt(x0, x1, x2, x3, t);
- if (x_ < x) { // Quick reject
- continue;
- }
- if (nExtrema < 0) {
- nExtrema = curve.cubicExtrema(y0, y1, y2, y3, extrema);
- if (extrema[1] < extrema[0] && nExtrema > 1) {
- this.swapExtrema();
- }
- y0_ = curve.cubicAt(y0, y1, y2, y3, extrema[0]);
- if (nExtrema > 1) {
- y1_ = curve.cubicAt(y0, y1, y2, y3, extrema[1]);
- }
- }
- if (nExtrema == 2) {
- // 分成三段单调函数
- if (t < extrema[0]) {
- w += y0_ < y0 ? 1 : -1;
- } else if (t < extrema[1]) {
- w += y1_ < y0_ ? 1 : -1;
- } else {
- w += y3 < y1_ ? 1 : -1;
- }
- } else {
- // 分成两段单调函数
- if (t < extrema[0]) {
- w += y0_ < y0 ? 1 : -1;
- } else {
- w += y3 < y0_ ? 1 : -1;
- }
- }
- }
- return w;
- }
- }
- /**
- * @function LevelRenderer.Tool.Areal.prototype.windingQuadratic
- */
- windingQuadratic(x0, y0, x1, y1, x2, y2, x, y) {
- var curve = this.curve;
- var roots = this.roots;
- // Quick reject
- if (
- (y > y0 && y > y1 && y > y2)
- || (y < y0 && y < y1 && y < y2)
- ) {
- return 0;
- }
- var nRoots = curve.quadraticRootAt(y0, y1, y2, y, roots);
- if (nRoots === 0) {
- return 0;
- } else {
- var t = curve.quadraticExtremum(y0, y1, y2);
- if (t >= 0 && t <= 1) {
- var w = 0;
- var y_ = curve.quadraticAt(y0, y1, y2, t);
- for (let i = 0; i < nRoots; i++) {
- let x_ = curve.quadraticAt(x0, x1, x2, roots[i]);
- if (x_ > x) {
- continue;
- }
- if (roots[i] < t) {
- w += y_ < y0 ? 1 : -1;
- } else {
- w += y2 < y_ ? 1 : -1;
- }
- }
- return w;
- } else {
- let x_ = curve.quadraticAt(x0, x1, x2, roots[0]);
- if (x_ > x) {
- return 0;
- }
- return y2 < y0 ? 1 : -1;
- }
- }
- }
- /**
- * @function LevelRenderer.Tool.Areal.prototype.windingArc
- * // TODO Arc 旋转
- */
- windingArc(cx, cy, r, startAngle, endAngle, anticlockwise, x, y) {
- var roots = this.roots;
- var PI2 = this.PI2;
- y -= cy;
- if (y > r || y < -r) {
- return 0;
- }
- let tmp = Math.sqrt(r * r - y * y);
- roots[0] = -tmp;
- roots[1] = tmp;
- if (Math.abs(startAngle - endAngle) >= PI2) {
- // Is a circle
- startAngle = 0;
- endAngle = PI2;
- var dir = anticlockwise ? 1 : -1;
- if (x >= roots[0] + cx && x <= roots[1] + cx) {
- return dir;
- } else {
- return 0;
- }
- }
- if (anticlockwise) {
- let tmp = startAngle;
- startAngle = this.normalizeRadian(endAngle);
- endAngle = this.normalizeRadian(tmp);
- } else {
- startAngle = this.normalizeRadian(startAngle);
- endAngle = this.normalizeRadian(endAngle);
- }
- if (startAngle > endAngle) {
- endAngle += PI2;
- }
- var w = 0;
- for (let i = 0; i < 2; i++) {
- var x_ = roots[i];
- if (x_ + cx > x) {
- let angle = Math.atan2(y, x_);
- let dir = anticlockwise ? 1 : -1;
- if (angle < 0) {
- angle = PI2 + angle;
- }
- if (
- (angle >= startAngle && angle <= endAngle)
- || (angle + PI2 >= startAngle && angle + PI2 <= endAngle)
- ) {
- if (angle > Math.PI / 2 && angle < Math.PI * 1.5) {
- dir = -dir;
- }
- w += dir;
- }
- }
- }
- return w;
- }
- /**
- * @function LevelRenderer.Tool.Areal.prototype.isInsidePath
- * @description 与 canvas 一样采用 non-zero winding rule
- */
- isInsidePath(pathArray, lineWidth, brushType, x, y) {
- var w = 0;
- var xi = 0;
- var yi = 0;
- var x0 = 0;
- var y0 = 0;
- var beginSubpath = true;
- var firstCmd = true;
- brushType = brushType || 'fill';
- var hasStroke = brushType === 'stroke' || brushType === 'both';
- var hasFill = brushType === 'fill' || brushType === 'both';
- // var roots = [-1, -1, -1];
- for (var i = 0; i < pathArray.length; i++) {
- var seg = pathArray[i];
- var p = seg.points;
- // Begin a new subpath
- if (beginSubpath || seg.command === 'M') {
- if (i > 0) {
- // Close previous subpath
- if (hasFill) {
- w += this.windingLine(xi, yi, x0, y0, x, y);
- }
- if (w !== 0) {
- return true;
- }
- }
- x0 = p[p.length - 2];
- y0 = p[p.length - 1];
- beginSubpath = false;
- if (firstCmd && seg.command !== 'A') {
- // 如果第一个命令不是M, 是lineTo, bezierCurveTo
- // 等绘制命令的话,是会从该绘制的起点开始算的
- // Arc 会在之后做单独处理所以这里忽略
- firstCmd = false;
- xi = x0;
- yi = y0;
- }
- }
- switch (seg.command) {
- case 'M':
- xi = p[0];
- yi = p[1];
- break;
- case 'L':
- if (hasStroke) {
- if (this.isInsideLine(
- xi, yi, p[0], p[1], lineWidth, x, y
- )) {
- return true;
- }
- }
- if (hasFill) {
- w += this.windingLine(xi, yi, p[0], p[1], x, y);
- }
- xi = p[0];
- yi = p[1];
- break;
- case 'C':
- if (hasStroke) {
- if (this.isInsideCubicStroke(
- xi, yi, p[0], p[1], p[2], p[3], p[4], p[5],
- lineWidth, x, y
- )) {
- return true;
- }
- }
- if (hasFill) {
- w += this.windingCubic(
- xi, yi, p[0], p[1], p[2], p[3], p[4], p[5], x, y
- );
- }
- xi = p[4];
- yi = p[5];
- break;
- case 'Q':
- if (hasStroke) {
- if (this.isInsideQuadraticStroke(
- xi, yi, p[0], p[1], p[2], p[3],
- lineWidth, x, y
- )) {
- return true;
- }
- }
- if (hasFill) {
- w += this.windingQuadratic(
- xi, yi, p[0], p[1], p[2], p[3], x, y
- );
- }
- xi = p[2];
- yi = p[3];
- break;
- case 'A':
- // TODO Arc 旋转
- // TODO Arc 判断的开销比较大
- var cx = p[0];
- var cy = p[1];
- var rx = p[2];
- var ry = p[3];
- var theta = p[4];
- var dTheta = p[5];
- var x1 = Math.cos(theta) * rx + cx;
- var y1 = Math.sin(theta) * ry + cy;
- // 不是直接使用 arc 命令
- if (!firstCmd) {
- w += this.windingLine(xi, yi, x1, y1);
- } else {
- firstCmd = false;
- // 第一个命令起点还未定义
- x0 = x1;
- y0 = y1;
- }
- // zr 使用scale来模拟椭圆, 这里也对x做一定的缩放
- var _x = (x - cx) * ry / rx + cx;
- if (hasStroke) {
- if (this.isInsideArcStroke(
- cx, cy, ry, theta, theta + dTheta, 1 - p[7],
- lineWidth, _x, y
- )) {
- return true;
- }
- }
- if (hasFill) {
- w += this.windingArc(
- cx, cy, ry, theta, theta + dTheta, 1 - p[7],
- _x, y
- );
- }
- xi = Math.cos(theta + dTheta) * rx + cx;
- yi = Math.sin(theta + dTheta) * ry + cy;
- break;
- case 'z':
- if (hasStroke) {
- if (this.isInsideLine(
- xi, yi, x0, y0, lineWidth, x, y
- )) {
- return true;
- }
- }
- beginSubpath = true;
- break;
- }
- }
- if (hasFill) {
- w += this.windingLine(xi, yi, x0, y0, x, y);
- }
- return w !== 0;
- }
- /**
- * @function LevelRenderer.Tool.Areal.prototype.getTextWidth
- * @description 测算多行文本宽度
- */
- getTextWidth(text, textFont) {
- var key = text + ':' + textFont;
- if (this._textWidthCache[key]) {
- return this._textWidthCache[key];
- }
- this._ctx = this._ctx || this.util.getContext();
- this._ctx.save();
- if (textFont) {
- this._ctx.font = textFont;
- }
- text = (text + '').split('\n');
- var width = 0;
- for (var i = 0, l = text.length; i < l; i++) {
- width = Math.max(
- this._ctx.measureText(text[i]).width,
- width
- );
- }
- this._ctx.restore();
- this._textWidthCache[key] = width;
- if (++this._textWidthCacheCounter > this.TEXT_CACHE_MAX) {
- // 内存释放
- this._textWidthCacheCounter = 0;
- this._textWidthCache = {};
- }
- return width;
- }
- /**
- * @function LevelRenderer.Tool.Areal.prototype.getTextHeight
- * @description 测算多行文本高度
- */
- getTextHeight(text, textFont) {
- var key = text + ':' + textFont;
- if (this._textHeightCache[key]) {
- return this._textHeightCache[key];
- }
- this._ctx = this._ctx || this.util.getContext();
- this._ctx.save();
- if (textFont) {
- this._ctx.font = textFont;
- }
- text = (text + '').split('\n');
- // 比较粗暴
- //var height = (this._ctx.measureText('国').width + 2) * text.length; //打包不支持中文,替换掉
- var height = (this._ctx.measureText('ZH').width + 2) * text.length;
- this._ctx.restore();
- this._textHeightCache[key] = height;
- if (++this._textHeightCacheCounter > this.TEXT_CACHE_MAX) {
- // 内存释放
- this._textHeightCacheCounter = 0;
- this._textHeightCache = {};
- }
- return height;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/ComputeBoundingBox.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class LevelRenderer.Tool.ComputeBoundingBox
- * @category Visualization Theme
- * @classdesc LevelRenderer 工具-图形 Bounds 计算
- * @private
- */
- class ComputeBoundingBox {
- constructor() {
- if (arguments.length === 3) {
- this.computeBoundingBox(arguments);
- }
- this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.ComputeBoundingBox";
- }
- /**
- * @function LevelRenderer.Tool.ComputeBoundingBox.prototype.computeBoundingBox
- * @description 从顶点数组中计算出最小包围盒,写入'min'和'max'中。
- * @param {Array.<Object>} points - 顶点数组。
- * @param {Array.<number>} min - 最小
- * @param {Array.<number>} max - 最大
- */
- computeBoundingBox(points, min, max) {
- if (points.length === 0) {
- return;
- }
- var left = points[0][0];
- var right = points[0][0];
- var top = points[0][1];
- var bottom = points[0][1];
- for (var i = 1; i < points.length; i++) {
- var p = points[i];
- if (p[0] < left) {
- left = p[0];
- }
- if (p[0] > right) {
- right = p[0];
- }
- if (p[1] < top) {
- top = p[1];
- }
- if (p[1] > bottom) {
- bottom = p[1];
- }
- }
- min[0] = left;
- min[1] = top;
- max[0] = right;
- max[1] = bottom;
- }
- /**
- * @function LevelRenderer.Tool.ComputeBoundingBox.prototype.cubeBezier
- * @description 从三阶贝塞尔曲线(p0, p1, p2, p3)中计算出最小包围盒,写入'min'和'max'中。原:computeCubeBezierBoundingBox。
- * @param {Array.<number>} p0 - 三阶贝塞尔曲线p0点
- * @param {Array.<number>} p1 - 三阶贝塞尔曲线p1点
- * @param {Array.<number>} p2 - 三阶贝塞尔曲线p2点
- * @param {Array.<number>} p3 - 三阶贝塞尔曲线p3点
- * @param {Array.<number>} min - 最小
- * @param {Array.<number>} max - 最大
- */
- cubeBezier(p0, p1, p2, p3, min, max) {
- var curve = new Curve_Curve();
- var xDim = [];
- curve.cubicExtrema(p0[0], p1[0], p2[0], p3[0], xDim);
- for (let i = 0; i < xDim.length; i++) {
- xDim[i] = curve.cubicAt(p0[0], p1[0], p2[0], p3[0], xDim[i]);
- }
- var yDim = [];
- curve.cubicExtrema(p0[1], p1[1], p2[1], p3[1], yDim);
- for (let i = 0; i < yDim.length; i++) {
- yDim[i] = curve.cubicAt(p0[1], p1[1], p2[1], p3[1], yDim[i]);
- }
- xDim.push(p0[0], p3[0]);
- yDim.push(p0[1], p3[1]);
- var left = Math.min.apply(null, xDim);
- var right = Math.max.apply(null, xDim);
- var top = Math.min.apply(null, yDim);
- var bottom = Math.max.apply(null, yDim);
- min[0] = left;
- min[1] = top;
- max[0] = right;
- max[1] = bottom;
- }
- /**
- * @function LevelRenderer.Tool.ComputeBoundingBox.prototype.quadraticBezier
- * @description 从二阶贝塞尔曲线(p0, p1, p2)中计算出最小包围盒,写入'min'和'max'中。原:computeQuadraticBezierBoundingBox。
- * @param {Array.<number>} p0 - 二阶贝塞尔曲线p0点
- * @param {Array.<number>} p1 - 二阶贝塞尔曲线p1点
- * @param {Array.<number>} p2 - 二阶贝塞尔曲线p2点
- * @param {Array.<number>} min - 最小
- * @param {Array.<number>} max - 最大
- */
- quadraticBezier(p0, p1, p2, min, max) {
- var curve = new Curve_Curve();
- // Find extremities, where derivative in x dim or y dim is zero
- var t1 = curve.quadraticExtremum(p0[0], p1[0], p2[0]);
- var t2 = curve.quadraticExtremum(p0[1], p1[1], p2[1]);
- t1 = Math.max(Math.min(t1, 1), 0);
- t2 = Math.max(Math.min(t2, 1), 0);
- var ct1 = 1 - t1;
- var ct2 = 1 - t2;
- var x1 = ct1 * ct1 * p0[0]
- + 2 * ct1 * t1 * p1[0]
- + t1 * t1 * p2[0];
- var y1 = ct1 * ct1 * p0[1]
- + 2 * ct1 * t1 * p1[1]
- + t1 * t1 * p2[1];
- var x2 = ct2 * ct2 * p0[0]
- + 2 * ct2 * t2 * p1[0]
- + t2 * t2 * p2[0];
- var y2 = ct2 * ct2 * p0[1]
- + 2 * ct2 * t2 * p1[1]
- + t2 * t2 * p2[1];
- min[0] = Math.min(p0[0], p2[0], x1, x2);
- min[1] = Math.min(p0[1], p2[1], y1, y2);
- max[0] = Math.max(p0[0], p2[0], x1, x2);
- max[1] = Math.max(p0[1], p2[1], y1, y2);
- }
- /**
- * @function LevelRenderer.Tool.ComputeBoundingBox.prototype.arc
- * @description 从圆弧中计算出最小包围盒,写入'min'和'max'中。原:computeArcBoundingBox。
- * @param {number} x - 圆弧中心点 x
- * @param {number} y - 圆弧中心点 y
- * @param {number} r - 圆弧半径
- * @param {number} startAngle - 圆弧开始角度
- * @param {number} endAngle - 圆弧结束角度
- * @param {number} anticlockwise - 是否是顺时针
- * @param {number} min - 最小
- * @param {number} max - 最大
- */
- arc(x, y, r, startAngle, endAngle, anticlockwise, min, max) {
- var vec2 = new levelRenderer_Vector_Vector();
- var start = vec2.create();
- var end = vec2.create();
- var extremity = vec2.create();
- start[0] = Math.cos(startAngle) * r + x;
- start[1] = Math.sin(startAngle) * r + y;
- end[0] = Math.cos(endAngle) * r + x;
- end[1] = Math.sin(endAngle) * r + y;
- vec2.min(min, start, end);
- vec2.max(max, start, end);
- // Thresh to [0, Math.PI * 2]
- startAngle = startAngle % (Math.PI * 2);
- if (startAngle < 0) {
- startAngle = startAngle + Math.PI * 2;
- }
- endAngle = endAngle % (Math.PI * 2);
- if (endAngle < 0) {
- endAngle = endAngle + Math.PI * 2;
- }
- if (startAngle > endAngle && !anticlockwise) {
- endAngle += Math.PI * 2;
- } else if (startAngle < endAngle && anticlockwise) {
- startAngle += Math.PI * 2;
- }
- if (anticlockwise) {
- var tmp = endAngle;
- endAngle = startAngle;
- startAngle = tmp;
- }
- // var number = 0;
- // var step = (anticlockwise ? -Math.PI : Math.PI) / 2;
- for (var angle = 0; angle < endAngle; angle += Math.PI / 2) {
- if (angle > startAngle) {
- extremity[0] = Math.cos(angle) * r + x;
- extremity[1] = Math.sin(angle) * r + y;
- vec2.min(min, extremity, min);
- vec2.max(max, extremity, max);
- }
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Env.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class LevelRenderer.Tool.Env
- * @category Visualization Theme
- * @classdesc 环境识别
- * @private
- */
- class Env {
- constructor() {
- // Zepto.js
- // (c) 2010-2013 Thomas Fuchs
- // Zepto.js may be freely distributed under the MIT license.
- this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Env";
- var me = this;
- function detect(ua) {
- var os = me.os = {};
- var browser = me.browser = {};
- var webkit = ua.match(/Web[kK]it[\/]{0,1}([\d.]+)/);
- var android = ua.match(/(Android);?[\s\/]+([\d.]+)?/);
- var ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
- var ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
- var iphone = !ipad && ua.match(/(iPhone\sOS)\s([\d_]+)/);
- var webos = ua.match(/(webOS|hpwOS)[\s\/]([\d.]+)/);
- var touchpad = webos && ua.match(/TouchPad/);
- var kindle = ua.match(/Kindle\/([\d.]+)/);
- var silk = ua.match(/Silk\/([\d._]+)/);
- var blackberry = ua.match(/(BlackBerry).*Version\/([\d.]+)/);
- var bb10 = ua.match(/(BB10).*Version\/([\d.]+)/);
- var rimtabletos = ua.match(/(RIM\sTablet\sOS)\s([\d.]+)/);
- var playbook = ua.match(/PlayBook/);
- var chrome = ua.match(/Chrome\/([\d.]+)/) || ua.match(/CriOS\/([\d.]+)/);
- var firefox = ua.match(/Firefox\/([\d.]+)/);
- var ie = ua.match(/MSIE ([\d.]+)/);
- var safari = webkit && ua.match(/Mobile\//) && !chrome;
- var webview = ua.match(/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/) && !chrome;
- // Todo: clean this up with a better OS/browser seperation:
- // - discern (more) between multiple browsers on android
- // - decide if kindle fire in silk mode is android or not
- // - Firefox on Android doesn't specify the Android version
- // - possibly devide in os, device and browser hashes
- /*eslint-disable*/
- if (browser.webkit = !!webkit) {
- browser.version = webkit[1];
- }
- if (android) {
- os.android = true;
- os.version = android[2];
- }
- if (iphone && !ipod) {
- os.ios = os.iphone = true;
- os.version = iphone[2].replace(/_/g, '.');
- }
- if (ipad) {
- os.ios = os.ipad = true;
- os.version = ipad[2].replace(/_/g, '.');
- }
- if (ipod) {
- os.ios = os.ipod = true;
- os.version = ipod[3] ? ipod[3].replace(/_/g, '.') : null;
- }
- if (webos) {
- os.webos = true;
- os.version = webos[2];
- }
- if (touchpad) {
- os.touchpad = true;
- }
- if (blackberry) {
- os.blackberry = true;
- os.version = blackberry[2];
- }
- if (bb10) {
- os.bb10 = true;
- os.version = bb10[2];
- }
- if (rimtabletos) {
- os.rimtabletos = true;
- os.version = rimtabletos[2];
- }
- if (playbook) {
- browser.playbook = true;
- }
- if (kindle) {
- os.kindle = true;
- os.version = kindle[1];
- }
- if (silk) {
- browser.silk = true;
- browser.version = silk[1];
- }
- if (!silk && os.android && ua.match(/Kindle Fire/)) {
- browser.silk = true;
- }
- if (chrome) {
- browser.chrome = true;
- browser.version = chrome[1];
- }
- if (firefox) {
- browser.firefox = true;
- browser.version = firefox[1];
- }
- if (ie) {
- browser.ie = true;
- browser.version = ie[1];
- }
- if (safari && (ua.match(/Safari/) || !!os.ios)) {
- browser.safari = true;
- }
- if (webview) {
- browser.webview = true;
- }
- if (ie) {
- browser.ie = true;
- browser.version = ie[1];
- }
- os.tablet = !!(ipad || playbook || (android && !ua.match(/Mobile/)) ||
- (firefox && ua.match(/Tablet/)) || (ie && !ua.match(/Phone/) && ua.match(/Touch/)));
- os.phone = !!(!os.tablet && !os.ipod && (android || iphone || webos || blackberry || bb10 ||
- (chrome && ua.match(/Android/)) || (chrome && ua.match(/CriOS\/([\d.]+)/)) ||
- (firefox && ua.match(/Mobile/)) || (ie && ua.match(/Touch/))));
- return {
- browser: browser,
- os: os,
- // 原生canvas支持
- canvasSupported: document.createElement('canvas').getContext ? true : false
- };
- }
- return detect(navigator.userAgent);
- }
- destory() {
- return true;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Event.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class LevelRenderer.Tool.Event
- * @category Visualization Theme
- * @classdesc LevelRenderer 工具-事件辅助类
- * @private
- */
- class Event_Event {
- constructor() {
- /**
- * @member {function} LevelRenderer.Tool.Event.prototype.stop
- * @description 停止冒泡和阻止默认行为
- */
- this.stop = typeof window.addEventListener === 'function'
- ? function (e) {
- e.preventDefault();
- e.stopPropagation();
- e.cancelBubble = true;
- }
- : function (e) {
- e.returnValue = false;
- e.cancelBubble = true;
- };
- this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Event";
- }
- /**
- * @function LevelRenderer.Tool.Event.prototype.getX
- * @description 提取鼠标(手指)x坐标。
- * @param {Event} e - 事件。
- * @returns {number} 鼠标(手指)x坐标。
- */
- getX(e) {
- return typeof e.zrenderX != 'undefined' && e.zrenderX
- || typeof e.offsetX != 'undefined' && e.offsetX
- || typeof e.layerX != 'undefined' && e.layerX
- || typeof e.clientX != 'undefined' && e.clientX;
- }
- /**
- * @function LevelRenderer.Tool.Event.prototype.getY
- * @description 提取鼠标(手指)y坐标。
- * @param {Event} e - 事件。
- * @returns {number} 鼠标(手指)y坐标。
- */
- getY(e) {
- return typeof e.zrenderY != 'undefined' && e.zrenderY
- || typeof e.offsetY != 'undefined' && e.offsetY
- || typeof e.layerY != 'undefined' && e.layerY
- || typeof e.clientY != 'undefined' && e.clientY;
- }
- /**
- * @function LevelRenderer.Tool.Event.prototype.getDelta
- * @description 提取鼠标滚轮变化。
- * @param {Event} e - 事件。
- * @returns {number} 滚轮变化,正值说明滚轮是向上滚动,如果是负值说明滚轮是向下滚动。
- */
- getDelta(e) {
- return typeof e.zrenderDelta != 'undefined' && e.zrenderDelta
- || typeof e.wheelDelta != 'undefined' && e.wheelDelta
- || typeof e.detail != 'undefined' && -e.detail;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Http.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @private
- * @class LevelRenderer.Tool.Http
- * @category Visualization Theme
- * @classdesc LevelRenderer 工具-Http
- */
- class Http {
- constructor() {
- this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Http"
- }
- /**
- * @function LevelRenderer.Tool.Http.prototype.get
- * @description get请求。
- * @param {(string|IHTTPGetOption)} url - 请求url
- * @param {function} onsuccess - 请求成功函数
- * @param {function} onerror - 请求失败函数
- * @param {Object} opts - 额外参数
- * @returns {number} cos值
- */
- get(url, onsuccess, onerror) {
- if (typeof(url) === 'object') {
- var obj = url;
- url = obj.url;
- onsuccess = obj.onsuccess;
- onerror = obj.onerror;
- }
- var xhr = window.XMLHttpRequest
- ? new XMLHttpRequest()
- : new window.ActiveXObject('Microsoft.XMLHTTP');
- xhr.open('GET', url, true);
- xhr.onreadystatechange = function () {
- if (xhr.readyState == 4) {
- if (xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) {
- onsuccess && onsuccess(xhr.responseText);
- } else {
- onerror && onerror();
- }
- xhr.onreadystatechange = new Function();
- xhr = null;
- }
- };
- xhr.send(null);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Config.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- class Config {
- }
- /**
- * @enum EVENT
- * @description 事件
- * @type {Object}
- * @private
- */
- Config.EVENT = {
- //窗口大小变化
- RESIZE: 'resize',
- //鼠标按钮被(手指)按下,事件对象是:目标图形元素或空
- CLICK: 'click',
- //双击事件
- DBLCLICK: 'dblclick',
- //鼠标滚轮变化,事件对象是:目标图形元素或空
- MOUSEWHEEL: 'mousewheel',
- //鼠标(手指)被移动,事件对象是:目标图形元素或空
- MOUSEMOVE: 'mousemove',
- //鼠标移到某图形元素之上,事件对象是:目标图形元素
- MOUSEOVER: 'mouseover',
- //鼠标从某图形元素移开,事件对象是:目标图形元素
- MOUSEOUT: 'mouseout',
- //鼠标按钮(手指)被按下,事件对象是:目标图形元素或空
- MOUSEDOWN: 'mousedown',
- //鼠标按键(手指)被松开,事件对象是:目标图形元素或空
- MOUSEUP: 'mouseup',
- //全局离开,MOUSEOUT触发比较频繁,一次离开优化绑定
- GLOBALOUT: 'globalout',
- // 一次成功元素拖拽的行为事件过程是:
- // dragstart > dragenter > dragover [> dragleave] > drop > dragend
- //开始拖拽时触发,事件对象是:被拖拽图形元素
- DRAGSTART: 'dragstart',
- //拖拽完毕时触发(在drop之后触发),事件对象是:被拖拽图形元素
- DRAGEND: 'dragend',
- //拖拽图形元素进入目标图形元素时触发,事件对象是:目标图形元素
- DRAGENTER: 'dragenter',
- //拖拽图形元素在目标图形元素上移动时触发,事件对象是:目标图形元素
- DRAGOVER: 'dragover',
- //拖拽图形元素离开目标图形元素时触发,事件对象是:目标图形元素
- DRAGLEAVE: 'dragleave',
- //拖拽图形元素放在目标图形元素内时触发,事件对象是:目标图形元素
- DROP: 'drop',
- //touch end - start < delay is click
- touchClickDelay: 300
- };
- /**
- * @enum catchBrushException
- * @description 是否异常捕获
- * @type {boolean}
- * @private
- */
- Config.catchBrushException = false;
- /**
- * @enum debugMode
- * @description debug 日志选项:catchBrushException 为 true 下有效。
- * 0 : 不生成debug数据,发布用
- * 1 : 异常抛出,调试用
- * 2 : 控制台输出,调试用
- * @type {boolean}
- * @private
- */
- Config.debugMode = 0;
- ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Log.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @private
- * @class LevelRenderer.Tool.Log
- * @category Visualization Theme
- * @classdesc LevelRenderer 工具-日志
- */
- class Log {
- constructor() {
- this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Log";
- return function () {
- if (+Config.debugMode === 0) {
- return;
- } else if (+Config.debugMode === 1) {
- for (let k in arguments) {
- throw new Error(arguments[k]);
- }
- } else if (+Config.debugMode > 1) {
- for (let k in arguments) {
- console.log(arguments[k]);
- }
- }
- };
- /* for debug
- return function(mes) {
- document.getElementById('wrong-message').innerHTML =
- mes + ' ' + (new Date() - 0)
- + '<br/>'
- + document.getElementById('wrong-message').innerHTML;
- };
- */
- }
- destory() {
- return true;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Math.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @private
- * @class LevelRenderer.Tool.Math
- * @category Visualization Theme
- * @classdesc LevelRenderer 工具-数学辅助类
- */
- class MathTool {
- constructor() {
- /**
- * @member {number} LevelRenderer.Tool.Math._radians
- * @description 角度与弧度转化参数
- */
- this._radians = window.Math.PI / 180;
- this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Math";
- }
- /**
- * @function LevelRenderer.Tool.Math.prototype.sin
- * @description 正弦函数。
- * @param {number} angle - 弧度(角度)参数。
- * @param {boolean} [isDegrees=false] - angle参数是否为角度计算,angle为以弧度计量的角度。
- * @returns {number} sin 值。
- */
- sin(angle, isDegrees) {
- return window.Math.sin(isDegrees ? angle * this._radians : angle);
- }
- /**
- * @function LevelRenderer.Tool.Math.prototype.cos
- * @description 余弦函数。
- * @param {number} angle - 弧度(角度)参数。
- * @param {boolean} [isDegrees=false] - angle参数是否为角度计算,angle为以弧度计量的角度。
- * @returns {number} cos 值。
- */
- cos(angle, isDegrees) {
- return window.Math.cos(isDegrees ? angle * this._radians : angle);
- }
- /**
- * @function LevelRenderer.Tool.Math.prototype.degreeToRadian
- * @description 角度转弧度。
- * @param {number} angle - 弧度(角度)参数。
- * @param {boolean} [isDegrees=false] - angle参数是否为角度计算,angle为以弧度计量的角度。
- * @returns {number} 弧度值。
- */
- degreeToRadian(angle) {
- return angle * this._radians;
- }
- /**
- * @function LevelRenderer.Tool.Math.prototype.radianToDegree
- * @description 弧度转角度。
- * @param {number} angle - 弧度(角度)参数。
- * @param {boolean} [isDegrees=false] - angle参数是否为角度计算,angle为以弧度计量的角度。
- * @returns {number} 角度。
- */
- radianToDegree(angle) {
- return angle / this._radians;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Matrix.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @private
- * @class LevelRenderer.Tool.Matrix
- * @category Visualization Theme
- * @classdesc LevelRenderer 工具-3x2矩阵操作类
- */
- class Matrix {
- constructor() {
- /**
- * @member {Object} LevelRenderer.Tool.Matrix.prototype.ArrayCtor
- * @description 数组类型控制
- */
- this.ArrayCtor = typeof Float32Array === 'undefined'
- ? Array
- : Float32Array;
- this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Matrix";
- }
- /**
- * @function LevelRenderer.Tool.Matrix.prototype.create
- * @description 创建一个单位矩阵。
- * @returns {(Float32Array|Array.<number>)} 单位矩阵。
- */
- create() {
- var ArrayCtor = this.ArrayCtor;
- var out = new ArrayCtor(6);
- this.identity(out);
- return out;
- }
- /**
- * @function LevelRenderer.Tool.Matrix.prototype.identity
- * @description 设置矩阵为单位矩阵。
- * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
- * @returns {(Float32Array|Array.<number>)} 单位矩阵。
- */
- identity(out) {
- out[0] = 1;
- out[1] = 0;
- out[2] = 0;
- out[3] = 1;
- out[4] = 0;
- out[5] = 0;
- return out;
- }
- /**
- * @function LevelRenderer.Tool.Matrix.prototype.copy
- * @description 复制矩阵。
- * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
- * @returns {(Float32Array|Array.<number>)} 克隆矩阵。
- */
- copy(out, m) {
- out[0] = m[0];
- out[1] = m[1];
- out[2] = m[2];
- out[3] = m[3];
- out[4] = m[4];
- out[5] = m[5];
- return out;
- }
- /**
- * @function LevelRenderer.Tool.Matrix.prototype.mul
- * @description 矩阵相乘。
- * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
- * @param {(Float32Array|Array.<number>)} m1 - 矩阵m1。
- * @param {(Float32Array|Array.<number>)} m2- 矩阵m2。
- * @returns {(Float32Array|Array.<number>)} 结果矩阵。
- */
- mul(out, m1, m2) {
- out[0] = m1[0] * m2[0] + m1[2] * m2[1];
- out[1] = m1[1] * m2[0] + m1[3] * m2[1];
- out[2] = m1[0] * m2[2] + m1[2] * m2[3];
- out[3] = m1[1] * m2[2] + m1[3] * m2[3];
- out[4] = m1[0] * m2[4] + m1[2] * m2[5] + m1[4];
- out[5] = m1[1] * m2[4] + m1[3] * m2[5] + m1[5];
- return out;
- }
- /**
- * @function LevelRenderer.Tool.Matrix.prototype.mul
- * @description 平移变换。
- * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
- * @param {(Float32Array|Array.<number>)} a - 矩阵。
- * @param {(Float32Array|Array.<number>)} v- 平移参数。
- * @returns {(Float32Array|Array.<number>)} 结果矩阵。
- */
- translate(out, a, v) {
- out[0] = a[0];
- out[1] = a[1];
- out[2] = a[2];
- out[3] = a[3];
- out[4] = a[4] + v[0];
- out[5] = a[5] + v[1];
- return out;
- }
- /**
- * @function LevelRenderer.Tool.Matrix.prototype.rotate
- * @description 平移变换。
- * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
- * @param {(Float32Array|Array.<number>)} a - 矩阵。
- * @param {(Float32Array|Array.<number>)} rad - 旋转参数。
- * @returns {(Float32Array|Array.<number>)} 结果矩阵。
- */
- rotate(out, a, rad) {
- var aa = a[0];
- var ac = a[2];
- var atx = a[4];
- var ab = a[1];
- var ad = a[3];
- var aty = a[5];
- var st = Math.sin(rad);
- var ct = Math.cos(rad);
- out[0] = aa * ct + ab * st;
- out[1] = -aa * st + ab * ct;
- out[2] = ac * ct + ad * st;
- out[3] = -ac * st + ct * ad;
- out[4] = ct * atx + st * aty;
- out[5] = ct * aty - st * atx;
- return out;
- }
- /**
- * @function LevelRenderer.Tool.Matrix.prototype.scale
- * @description 缩放变换。
- * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
- * @param {(Float32Array|Array.<number>)} a - 矩阵。
- * @param {(Float32Array|Array.<number>)} v - 缩放参数。
- * @returns {(Float32Array|Array.<number>)} 结果矩阵。
- */
- scale(out, a, v) {
- var vx = v[0];
- var vy = v[1];
- out[0] = a[0] * vx;
- out[1] = a[1] * vy;
- out[2] = a[2] * vx;
- out[3] = a[3] * vy;
- out[4] = a[4] * vx;
- out[5] = a[5] * vy;
- return out;
- }
- /**
- * @function LevelRenderer.Tool.Matrix.prototype.invert
- * @description 求逆矩阵。
- * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
- * @param {(Float32Array|Array.<number>)} a - 矩阵。
- * @returns {(Float32Array|Array.<number>)} 结果矩阵。
- */
- invert(out, a) {
- var aa = a[0];
- var ac = a[2];
- var atx = a[4];
- var ab = a[1];
- var ad = a[3];
- var aty = a[5];
- var det = aa * ad - ab * ac;
- if (!det) {
- return null;
- }
- det = 1.0 / det;
- out[0] = ad * det;
- out[1] = -ab * det;
- out[2] = -ac * det;
- out[3] = aa * det;
- out[4] = (ac * aty - ad * atx) * det;
- out[5] = (ab * atx - aa * aty) * det;
- return out;
- }
- /**
- * @function LevelRenderer.Tool.Matrix.prototype.mulVector
- * @description 矩阵左乘向量。
- * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
- * @param {(Float32Array|Array.<number>)} a - 矩阵。
- * @param {(Float32Array|Array.<number>)} v - 缩放参数。
- * @returns {(Float32Array|Array.<number>)} 结果矩阵。
- */
- mulVector(out, a, v) {
- var aa = a[0];
- var ac = a[2];
- var atx = a[4];
- var ab = a[1];
- var ad = a[3];
- var aty = a[5];
- out[0] = v[0] * aa + v[1] * ac + atx;
- out[1] = v[0] * ab + v[1] * ad + aty;
- return out;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SUtil.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- class SUtil_SUtil {
- /**
- * @function LevelRenderer.SUtil.SUtil_smoothBezier
- * @description 贝塞尔平滑曲线。
- * @private
- * @param {Array} points - 线段顶点数组。
- * @param {number} smooth - 平滑等级, 0-1。
- * @param {boolean} isLoop - isLoop。
- * @param {Array} constraint - 将计算出来的控制点约束在一个包围盒内,比如 [[0, 0], [100, 100]], 这个包围盒会与整个折线的包围盒做一个并集用来约束控制点。
- * @param {Array.<number>} [originalPosition=[0, 0]] - 参考原点。
- * @return {Array} 生成的平滑节点数组。
- */
- static SUtil_smoothBezier(points, smooth, isLoop, constraint, originalPosition) {
- if (!originalPosition || originalPosition.length !== 2) {
- originalPosition = [0, 0];
- }
- var __OP = originalPosition;
- var cps = [];
- var v = [];
- var v1 = [];
- var v2 = [];
- var hasConstraint = !!constraint;
- var min, max;
- if (hasConstraint) {
- min = [Infinity, Infinity];
- max = [-Infinity, -Infinity];
- let len = points.length;
- for (let i = 0; i < len; i++) {
- SUtil_SUtil.Util_vector.min(min, min, [points[i][0] + __OP[0], points[i][1] + __OP[1]]);
- SUtil_SUtil.Util_vector.max(max, max, [points[i][0] + __OP[0], points[i][1] + __OP[1]]);
- }
- // 与指定的包围盒做并集
- SUtil_SUtil.Util_vector.min(min, min, constraint[0]);
- SUtil_SUtil.Util_vector.max(max, max, constraint[1]);
- }
- let len = points.length;
- for (let i = 0; i < len; i++) {
- let point = [points[i][0] + __OP[0], points[i][1] + __OP[1]];
- let prevPoint;
- let nextPoint;
- if (isLoop) {
- prevPoint = [points[i ? i - 1 : len - 1][0] + __OP[0], points[i ? i - 1 : len - 1][1] + __OP[1]];
- nextPoint = [points[(i + 1) % len][0] + __OP[0], points[(i + 1) % len][1] + __OP[1]];
- } else {
- if (i === 0 || i === len - 1) {
- cps.push([points[i][0] + __OP[0], points[i][1] + __OP[1]]);
- continue;
- } else {
- prevPoint = [points[i - 1][0] + __OP[0], points[i - 1][1] + __OP[1]];
- nextPoint = [points[i + 1][0] + __OP[0], points[i + 1][1] + __OP[1]];
- }
- }
- SUtil_SUtil.Util_vector.sub(v, nextPoint, prevPoint);
- // use degree to scale the handle length
- SUtil_SUtil.Util_vector.scale(v, v, smooth);
- let d0 = SUtil_SUtil.Util_vector.distance(point, prevPoint);
- let d1 = SUtil_SUtil.Util_vector.distance(point, nextPoint);
- let sum = d0 + d1;
- if (sum !== 0) {
- d0 /= sum;
- d1 /= sum;
- }
- SUtil_SUtil.Util_vector.scale(v1, v, -d0);
- SUtil_SUtil.Util_vector.scale(v2, v, d1);
- let cp0 = SUtil_SUtil.Util_vector.add([], point, v1);
- let cp1 = SUtil_SUtil.Util_vector.add([], point, v2);
- if (hasConstraint) {
- SUtil_SUtil.Util_vector.max(cp0, cp0, min);
- SUtil_SUtil.Util_vector.min(cp0, cp0, max);
- SUtil_SUtil.Util_vector.max(cp1, cp1, min);
- SUtil_SUtil.Util_vector.min(cp1, cp1, max);
- }
- cps.push(cp0);
- cps.push(cp1);
- }
- if (isLoop) {
- cps.push(cps.shift());
- }
- return cps;
- }
- /**
- * @function LevelRenderer.SUtil.SUtil_smoothSpline
- * @description 插值折线。
- * @private
- * @param {Array} points - 线段顶点数组。
- * @param {boolean} isLoop - isLoop。
- * @param {Array} constraint - 将计算出来的控制点约束在一个包围盒内,比如 [[0, 0], [100, 100]], 这个包围盒会与整个折线的包围盒做一个并集用来约束控制点。
- * @param {Array.<number>} originalPosition - 参考原点。默认值:[0, 0]。
- * @return {Array} 生成的平滑节点数组。
- */
- static SUtil_smoothSpline(points, isLoop, constraint, originalPosition) {
- if (!originalPosition || originalPosition.length !== 2) {
- originalPosition = [0, 0];
- }
- var __OP = originalPosition;
- var len = points.length;
- var ret = [];
- var distance = 0;
- for (let i = 1; i < len; i++) {
- 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]]);
- }
- var segs = distance / 5;
- segs = segs < len ? len : segs;
- for (let i = 0; i < segs; i++) {
- let pos = i / (segs - 1) * (isLoop ? len : len - 1);
- let idx = Math.floor(pos);
- let w = pos - idx;
- let p0;
- let p1 = [points[idx % len][0] + __OP[0], points[idx % len][1] + __OP[1]];
- let p2;
- let p3;
- if (!isLoop) {
- p0 = [points[idx === 0 ? idx : idx - 1][0] + __OP[0], points[idx === 0 ? idx : idx - 1][1] + __OP[1]];
- p2 = [points[idx > len - 2 ? len - 1 : idx + 1][0] + __OP[0], points[idx > len - 2 ? len - 1 : idx + 1][1] + __OP[1]];
- p3 = [points[idx > len - 3 ? len - 1 : idx + 2][0] + __OP[0], points[idx > len - 3 ? len - 1 : idx + 2][1] + __OP[1]];
- } else {
- p0 = [points[(idx - 1 + len) % len][0] + __OP[0], points[(idx - 1 + len) % len][1] + __OP[1]];
- p2 = [points[(idx + 1) % len][0] + __OP[0], points[(idx + 1) % len][1] + __OP[1]];
- p3 = [points[(idx + 2) % len][0] + __OP[0], points[(idx + 2) % len][1] + __OP[1]];
- }
- let w2 = w * w;
- let w3 = w * w2;
- ret.push([
- interpolate(p0[0], p1[0], p2[0], p3[0], w, w2, w3),
- interpolate(p0[1], p1[1], p2[1], p3[1], w, w2, w3)
- ]);
- }
- return ret;
- // inner Function
- function interpolate(p0, p1, p2, p3, t, t2, t3) {
- var v0 = (p2 - p0) * 0.5;
- var v1 = (p3 - p1) * 0.5;
- return (2 * (p1 - p2) + v0 + v1) * t3
- + (-3 * (p1 - p2) - 2 * v0 - v1) * t2
- + v0 * t + p1;
- }
- }
- /**
- * @function LevelRenderer.SUtil.SUtil_dashedLineTo
- * @description 虚线 lineTo。
- */
- static SUtil_dashedLineTo(ctx, x1, y1, x2, y2, dashLength, customDashPattern) {
- // http://msdn.microsoft.com/en-us/library/ie/dn265063(v=vs.85).aspx
- var dashPattern = [5, 5];
- dashLength = typeof dashLength != 'number'
- ? 5
- : dashLength;
- if (ctx.setLineDash) {
- dashPattern[0] = dashLength;
- dashPattern[1] = dashLength;
- if (customDashPattern && (customDashPattern instanceof Array)) {
- ctx.setLineDash(customDashPattern);
- } else {
- ctx.setLineDash(dashPattern);
- }
- // ctx.setLineDash(dashPattern);
- ctx.moveTo(x1, y1);
- ctx.lineTo(x2, y2);
- return;
- }
- var dx = x2 - x1;
- var dy = y2 - y1;
- var numDashes = Math.floor(
- Math.sqrt(dx * dx + dy * dy) / dashLength
- );
- dx = dx / numDashes;
- dy = dy / numDashes;
- var flag = true;
- for (var i = 0; i < numDashes; ++i) {
- if (flag) {
- ctx.moveTo(x1, y1);
- } else {
- ctx.lineTo(x1, y1);
- }
- flag = !flag;
- x1 += dx;
- y1 += dy;
- }
- ctx.lineTo(x2, y2);
- }
- }
- // 把所有工具对象放到全局静态变量上,以便直接调用工具方法,
- // 避免使用工具时频繁的创建工具对象带来的性能消耗。
- SUtil_SUtil.Util_area = new Area();
- SUtil_SUtil.Util_color = new Color();
- SUtil_SUtil.Util_computeBoundingBox = new ComputeBoundingBox();
- SUtil_SUtil.Util_curve = new Curve_Curve();
- SUtil_SUtil.Util_env = new Env();
- SUtil_SUtil.Util_event = new Event_Event();
- SUtil_SUtil.Util_http = new Http();
- SUtil_SUtil.Util_log = new Log();
- SUtil_SUtil.Util_math = new MathTool();
- SUtil_SUtil.Util_matrix = new Matrix();
- SUtil_SUtil.Util = new Util_Util();
- SUtil_SUtil.Util_vector = new levelRenderer_Vector_Vector();
- ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Transformable.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @private
- * @class LevelRenderer.Transformable
- * @category Visualization Theme
- * @classdesc 可变换超类,所有支持 Canvas Transform 变换操作的类均是此类的子类。此类不可实例化。
- */
- class Transformable {
- constructor() {
- /**
- * @member {Array.<number>} LevelRenderer.Transformable.prototype.position
- * @description 平移, 默认值:[0, 0]。
- */
- this.position = [0, 0];
- /**
- * @member {Array.<number>} LevelRenderer.Transformable.prototype.rotation
- * @description 旋转,可以通过数组二三项指定旋转的原点, 默认值:[0, 0, 0]。
- */
- this.rotation = [0, 0, 0];
- /**
- * @member {Array.<number>} LevelRenderer.Transformable.prototype.scale
- * @description 缩放,可以通过数组三四项指定缩放的原点, 默认值:[1, 1, 0, 0]。
- */
- this.scale = [1, 1, 0, 0];
- /**
- * @member {boolean} LevelRenderer.Transformable.prototype.needLocalTransform
- * @description 是否变换。默认值:false。
- */
- this.needLocalTransform = false;
- /**
- * @member {boolean} LevelRenderer.Transformable.prototype.needTransform
- * @description 是否有坐标变换。默认值:false。
- */
- this.needTransform = false;
- this.CLASS_NAME = "SuperMap.LevelRenderer.Transformable";
- /**
- * @function LevelRenderer.Transformable.prototype.lookAt
- * @description 设置图形的朝向。
- */
- this.lookAt = (function () {
- var v = SUtil_SUtil.Util_vector.create();
- // {Array.<Number>|Float32Array} target
- return function (target) {
- if (!this.transform) {
- this.transform = SUtil_SUtil.Util_matrix.create();
- }
- var m = this.transform;
- SUtil_SUtil.Util_vector.sub(v, target, this.position);
- if (isAroundZero(v[0]) && isAroundZero(v[1])) {
- return;
- }
- SUtil_SUtil.Util_vector.normalize(v, v);
- // Y Axis
- // TODO Scale origin ?
- m[2] = v[0] * this.scale[1];
- m[3] = v[1] * this.scale[1];
- // X Axis
- m[0] = v[1] * this.scale[0];
- m[1] = -v[0] * this.scale[0];
- // Position
- m[4] = this.position[0];
- m[5] = this.position[1];
- this.decomposeTransform();
- function isAroundZero(val) {
- var EPSILON = 5e-5;
- return val > -EPSILON && val < EPSILON;
- }
- };
- })();
- }
- /**
- * @function LevelRenderer.Transformable.prototype.destroy
- * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
- */
- destroy() {
- this.position = null;
- this.rotation = null;
- this.scale = null;
- this.needLocalTransform = null;
- this.needTransform = null;
- }
- /**
- * @function LevelRenderer.Transformable.prototype.updateNeedTransform
- * @description 更新 needLocalTransform
- */
- updateNeedTransform() {
- this.needLocalTransform = isNotAroundZero(this.rotation[0])
- || isNotAroundZero(this.position[0])
- || isNotAroundZero(this.position[1])
- || isNotAroundZero(this.scale[0] - 1)
- || isNotAroundZero(this.scale[1] - 1);
- function isNotAroundZero(val) {
- var EPSILON = 5e-5;
- return val > EPSILON || val < -EPSILON;
- }
- }
- /**
- * @function LevelRenderer.Transformable.prototype.updateTransform
- * @description 判断是否需要有坐标变换,更新 needTransform 属性。如果有坐标变换, 则从 position, rotation, scale 以及父节点的 transform 计算出自身的 transform 矩阵
- */
- updateTransform() {
- this.updateNeedTransform();
- if (this.parent) {
- this.needTransform = this.needLocalTransform || this.parent.needTransform;
- } else {
- this.needTransform = this.needLocalTransform;
- }
- if (!this.needTransform) {
- return;
- }
- var origin = [0, 0];
- var m = this.transform || SUtil_SUtil.Util_matrix.create();
- SUtil_SUtil.Util_matrix.identity(m);
- if (this.needLocalTransform) {
- if (
- isNotAroundZero(this.scale[0])
- || isNotAroundZero(this.scale[1])
- ) {
- origin[0] = -this.scale[2] || 0;
- origin[1] = -this.scale[3] || 0;
- let haveOrigin = isNotAroundZero(origin[0])
- || isNotAroundZero(origin[1]);
- if (haveOrigin) {
- SUtil_SUtil.Util_matrix.translate(
- m, m, origin
- );
- }
- SUtil_SUtil.Util_matrix.scale(m, m, this.scale);
- if (haveOrigin) {
- origin[0] = -origin[0];
- origin[1] = -origin[1];
- SUtil_SUtil.Util_matrix.translate(
- m, m, origin
- );
- }
- }
- if (this.rotation instanceof Array) {
- if (this.rotation[0] !== 0) {
- origin[0] = -this.rotation[1] || 0;
- origin[1] = -this.rotation[2] || 0;
- let haveOrigin = isNotAroundZero(origin[0])
- || isNotAroundZero(origin[1]);
- if (haveOrigin) {
- SUtil_SUtil.Util_matrix.translate(
- m, m, origin
- );
- }
- SUtil_SUtil.Util_matrix.rotate(m, m, this.rotation[0]);
- if (haveOrigin) {
- origin[0] = -origin[0];
- origin[1] = -origin[1];
- SUtil_SUtil.Util_matrix.translate(
- m, m, origin
- );
- }
- }
- } else {
- if (+this.rotation !== 0) {
- SUtil_SUtil.Util_matrix.rotate(m, m, this.rotation);
- }
- }
- if (
- isNotAroundZero(this.position[0]) || isNotAroundZero(this.position[1])
- ) {
- SUtil_SUtil.Util_matrix.translate(m, m, this.position);
- }
- }
- // 保存这个变换矩阵
- this.transform = m;
- // 应用父节点变换
- if (this.parent && this.parent.needTransform) {
- if (this.needLocalTransform) {
- SUtil_SUtil.Util_matrix.mul(this.transform, this.parent.transform, this.transform);
- } else {
- SUtil_SUtil.Util_matrix.copy(this.transform, this.parent.transform);
- }
- }
- function isNotAroundZero(val) {
- var EPSILON = 5e-5;
- return val > EPSILON || val < -EPSILON;
- }
- }
- /**
- * @function LevelRenderer.Transformable.prototype.setTransform
- * @description 将自己的 transform 应用到 context 上。
- *
- * @param {Context2D} ctx - Context2D 上下文。
- */
- setTransform(ctx) {
- if (this.needTransform) {
- var m = this.transform;
- ctx.transform(
- m[0], m[1],
- m[2], m[3],
- m[4], m[5]
- );
- }
- }
- /**
- * @function LevelRenderer.Transformable.prototype.decomposeTransform
- * @description 分解`transform`矩阵到`position`, `rotation`, `scale` 。
- */
- decomposeTransform() {
- if (!this.transform) {
- return;
- }
- var m = this.transform;
- var sx = m[0] * m[0] + m[1] * m[1];
- var position = this.position;
- var scale = this.scale;
- var rotation = this.rotation;
- if (isNotAroundZero(sx - 1)) {
- sx = Math.sqrt(sx);
- }
- var sy = m[2] * m[2] + m[3] * m[3];
- if (isNotAroundZero(sy - 1)) {
- sy = Math.sqrt(sy);
- }
- position[0] = m[4];
- position[1] = m[5];
- scale[0] = sx;
- scale[1] = sy;
- scale[2] = scale[3] = 0;
- rotation[0] = Math.atan2(-m[1] / sy, m[0] / sx);
- rotation[1] = rotation[2] = 0;
- function isNotAroundZero(val) {
- var EPSILON = 5e-5;
- return val > EPSILON || val < -EPSILON;
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Shape.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @private
- * @class LevelRenderer.Shape
- * @category Visualization Theme
- * @classdesc 图形(shape)基类。
- * @extends LevelRenderer.Eventful
- * @extends LevelRenderer.Transformable
- * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
- */
- class Shape_Shape extends mixinExt(Eventful, Transformable) {
- constructor(options) {
- super(options);
- options = options || {};
- /**
- * @member {string} LevelRenderer.Shape.prototype.id
- * @description 唯一标识。
- */
- this.id = null;
- /**
- * @member {Object} LevelRenderer.Shape.prototype.style
- * @description 基础绘制样式。
- * @param {string} style.brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
- * @param {string} style.color - 填充颜色。默认值:"#000000'"。
- * @param {string} style.strokeColor - 描边颜色。默认值:"#000000'"。
- * @param {string} style.lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
- * @param {number} style.lineWidth - 描边宽度。默认值:1。
- * @param {number} style.opacity - 绘制透明度。默认值:1。
- * @param {number} style.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
- * @param {number} style.shadowColor - 阴影颜色。默认值:"#000000'"。
- * @param {number} style.shadowOffsetX - 阴影横向偏移。默认值:0。
- * @param {number} style.shadowOffsetY - 阴影纵向偏移。默认值:0。
- * @param {string} style.text - 图形中的附加文本。默认值:""。
- * @param {string} style.textColor - 文本颜色。默认值:"#000000'"。
- * @param {string} style.textFont - 附加文本样式。示例:'bold 18px verdana'。
- * @param {string} style.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
- * @param {string} style.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
- * @param {string} style.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
- *
- */
- this.style = {};
- /**
- * @member {Object} LevelRenderer.Shape.prototype.style.__rect
- * @description 包围图形的最小矩形盒子。
- *
- * @param {number} x - 左上角顶点x轴坐标。
- * @param {number} y - 左上角顶点y轴坐标。
- * @param {number} width - 包围盒矩形宽度。
- * @param {number} height - 包围盒矩形高度。
- */
- /**
- * @member {Object} LevelRenderer.Shape.prototype.highlightStyle
- * @description 高亮样式。
- *
- * @param {string} highlightStyle.brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
- * @param {string} highlightStyle.color - 填充颜色。默认值:"#000000'"。
- * @param {string} highlightStyle.strokeColor - 描边颜色。默认值:"#000000'"。
- * @param {string} highlightStyle.lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
- * @param {number} highlightStyle.lineWidth - 描边宽度。默认值:1。
- * @param {number} highlightStyle.opacity - 绘制透明度。默认值:1。
- * @param {number} highlightStyle.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
- * @param {number} highlightStyle.shadowColor - 阴影颜色。默认值:"#000000'"。
- * @param {number} highlightStyle.shadowOffsetX - 阴影横向偏移。默认值:0。
- * @param {number} highlightStyle.shadowOffsetY - 阴影纵向偏移。默认值:0。
- * @param {string} highlightStyle.text - 图形中的附加文本。默认值:""。
- * @param {string} highlightStyle.textColor - 文本颜色。默认值:"#000000'"。
- * @param {string} highlightStyle.textFont - 附加文本样式。示例:'bold 18px verdana'。
- * @param {string} highlightStyle.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
- * @param {string} highlightStyle.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
- * @param {string} highlightStyle.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
- */
- this.highlightStyle = null;
- /**
- * @member {Object} LevelRenderer.Shape.prototype.parent
- * @description 父节点,只读属性。<LevelRenderer.Group>
- */
- this.parent = null;
- /**
- * @member {boolean} LevelRenderer.Shape.prototype.__dirty
- * @description {boolean}
- */
- this.__dirty = true;
- /**
- * @member {Array} LevelRenderer.Shape.prototype.__clipShapes
- * @description {Array}
- *
- */
- this.__clipShapes = [];
- /**
- * @member {boolean} LevelRenderer.Shape.prototype.invisible
- * @description 图形是否可见,为 true 时不绘制图形,但是仍能触发鼠标事件。默认值:false。
- */
- this.invisible = false;
- /**
- * @member {boolean} LevelRenderer.Shape.prototype.ignore
- * @description 图形是否忽略,为 true 时忽略图形的绘制以及事件触发。默认值:false。
- */
- this.ignore = false;
- /**
- * @member {boolean} LevelRenderer.Shape.prototype.zlevel
- * @description z 层 level,决定绘画在哪层 canvas 中。默认值:0。
- */
- this.zlevel = 0;
- /**
- * @member {boolean} LevelRenderer.Shape.prototype.draggable
- * @description 是否可拖拽。默认值:false。
- */
- this.draggable = false;
- /**
- * @member {boolean} LevelRenderer.Shape.prototype.clickable
- * @description 是否可点击。默认值:false。
- */
- this.clickable = false;
- /**
- * @member {boolean} LevelRenderer.Shape.prototype.hoverable
- * @description 是否可以 hover。默认值:true。
- */
- this.hoverable = true;
- /**
- * @member {number} LevelRenderer.Shape.prototype.z
- * @description z值,跟zlevel一样影响shape绘制的前后顺序,z值大的shape会覆盖在z值小的上面,但是并不会创建新的canvas,所以优先级低于zlevel,而且频繁改动的开销比zlevel小很多。默认值:0。
- */
- this.z = 0;
- //地理扩展
- /**
- * @member {Array.<number>} LevelRenderer.Shape.prototype.refOriginalPosition
- * @description 图形参考原点位置,图形的参考中心位置。
- * refOriginalPosition 是长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
- *
- * refOriginalPosition 表示图形的参考中心,通常情况下,图形是使用 canvas 的原点位置作为位置参考,
- * 但 refOriginalPosition 可以改变图形的参考位置,例如: refOriginalPosition = [80, 80],
- * 图形圆的 style.x = 20, style.y = 20,那么圆在 canvas 中的实际位置是 [100, 100]。
- *
- * 图形(Shape) 的所有位置相关属性都是以 refOriginalPosition 为参考中心,
- * 也就是说图形的所有位置信息在 canvas 中都是以 refOriginalPosition 为参考的相对位置,只有
- * refOriginalPosition 的值为 [0, 0] 时,形的位置信息才是 canvas 绝对位置。
- *
- * 图形的位置信息通常有:style.pointList,style.x,style.y。
- *
- * refOriginalPosition。默认值是: [0, 0]。
- */
- this.refOriginalPosition = [0, 0];
- /**
- * @member {string} LevelRenderer.Shape.prototype.refDataID
- * @description 图形所关联数据的 ID。
- *
- */
- this.refDataID = null;
- /**
- * @member {boolean} LevelRenderer.Shape.prototype.isHoverByRefDataID
- * @description 是否根据 refDataID 进行高亮。用于同时高亮所有 refDataID 相同的图形。
- *
- */
- this.isHoverByRefDataID = false;
- /**
- * @member {string} LevelRenderer.Shape.prototype.refDataHoverGroup
- * @description 高亮图形组的组名。此属性在 refDataID 有效且 isHoverByRefDataID 为 true 时生效。
- * 一旦设置此属性,且属性值有效,只有关联同一个数据的图形且此属性相同的图形才会高亮。
- *
- */
- this.refDataHoverGroup = null;
- /**
- * @member {Object} LevelRenderer.Shape.prototype.dataInfo
- * @description 图形的数据信息。
- *
- */
- this.dataInfo = null;
- Util.extend(this, options);
- this.id = this.id || Util.createUniqueID("smShape_");
- this.CLASS_NAME = "SuperMap.LevelRenderer.Shape";
- /**
- * @function LevelRenderer.Shape.prototype.getTansform
- * @description 变换鼠标位置到 shape 的局部坐标空间
- *
- */
- this.getTansform = (function () {
- var invTransform = [];
- return function (x, y) {
- var originPos = [x, y];
- // 对鼠标的坐标也做相同的变换
- if (this.needTransform && this.transform) {
- SUtil_SUtil.Util_matrix.invert(invTransform, this.transform);
- SUtil_SUtil.Util_matrix.mulVector(originPos, invTransform, [x, y, 1]);
- if (x == originPos[0] && y == originPos[1]) {
- // 避免外部修改导致的 needTransform 不准确
- this.updateNeedTransform();
- }
- }
- return originPos;
- };
- })();
- }
- /**
- * @function LevelRenderer.Shape.prototype.destroy
- * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
- */
- destroy() {
- this.id = null;
- this.style = null;
- this.highlightStyle = null;
- this.parent = null;
- this.__dirty = null;
- this.__clipShapes = null;
- this.invisible = null;
- this.ignore = null;
- this.zlevel = null;
- this.draggable = null;
- this.clickable = null;
- this.hoverable = null;
- this.z = null;
- this.refOriginalPosition = null;
- this.refDataID = null;
- this.refDataHoverGroup = null;
- this.isHoverByRefDataID = null;
- this.dataInfo = null;
- super.destroy();
- }
- /**
- * @function LevelRenderer.Shape.prototype.brush
- * @description 绘制图形。
- *
- * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
- * @param {boolean} isHighlight - 是否使用高亮属性。
- * @param {function} updateCallback - 需要异步加载资源的 shape 可以通过这个 callback(e),让painter更新视图,base.brush 没用,需要的话重载 brush。
- */
- brush(ctx, isHighlight) {
- var style = this.beforeBrush(ctx, isHighlight);
- ctx.beginPath();
- this.buildPath(ctx, style);
- switch (style.brushType) {
- /* jshint ignore:start */
- case 'both':
- this.setCtxGlobalAlpha(ctx, "fill", style);
- ctx.fill();
- if (style.lineWidth > 0) {
- this.setCtxGlobalAlpha(ctx, "stroke", style);
- ctx.stroke();
- }
- this.setCtxGlobalAlpha(ctx, "reset", style);
- break;
- case 'stroke':
- this.setCtxGlobalAlpha(ctx, "stroke", style);
- style.lineWidth > 0 && ctx.stroke();
- this.setCtxGlobalAlpha(ctx, "reset", style);
- break;
- /* jshint ignore:end */
- default:
- this.setCtxGlobalAlpha(ctx, "fill", style);
- ctx.fill();
- this.setCtxGlobalAlpha(ctx, "reset", style);
- break;
- }
- this.drawText(ctx, style, this.style);
- this.afterBrush(ctx);
- }
- /**
- * @function LevelRenderer.Shape.prototype.beforeBrush
- * @description 具体绘制操作前的一些公共操作。
- *
- * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
- * @param {boolean} isHighlight - 是否使用高亮属性。
- * @return {Object} 处理后的样式。
- */
- beforeBrush(ctx, isHighlight) {
- var style = this.style;
- if (this.brushTypeOnly) {
- style.brushType = this.brushTypeOnly;
- }
- if (isHighlight) {
- // 根据style扩展默认高亮样式
- style = this.getHighlightStyle(
- style,
- this.highlightStyle || {},
- this.brushTypeOnly
- );
- }
- if (this.brushTypeOnly == 'stroke') {
- style.strokeColor = style.strokeColor || style.color;
- }
- ctx.save();
- this.doClip(ctx);
- this.setContext(ctx, style);
- // 设置transform
- this.setTransform(ctx);
- return style;
- }
- /**
- * @function LevelRenderer.Shape.prototype.afterBrush
- * @description 绘制后的处理。
- *
- * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
- *
- */
- afterBrush(ctx) {
- ctx.restore();
- }
- /**
- * @function LevelRenderer.Shape.prototype.setContext
- * @description 设置 fillStyle, strokeStyle, shadow 等通用绘制样式。
- *
- * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
- * @param {Object} style - 样式。
- *
- */
- setContext(ctx, style) {
- var STYLE_CTX_MAP = [
- ['color', 'fillStyle'],
- ['strokeColor', 'strokeStyle'],
- ['opacity', 'globalAlpha'],
- ['lineCap', 'lineCap'],
- ['lineJoin', 'lineJoin'],
- ['miterLimit', 'miterLimit'],
- ['lineWidth', 'lineWidth'],
- ['shadowBlur', 'shadowBlur'],
- ['shadowColor', 'shadowColor'],
- ['shadowOffsetX', 'shadowOffsetX'],
- ['shadowOffsetY', 'shadowOffsetY']
- ];
- for (var i = 0, len = STYLE_CTX_MAP.length; i < len; i++) {
- var styleProp = STYLE_CTX_MAP[i][0];
- var styleValue = style[styleProp];
- var ctxProp = STYLE_CTX_MAP[i][1];
- if (typeof styleValue != 'undefined') {
- ctx[ctxProp] = styleValue;
- }
- }
- }
- /**
- * @function LevelRenderer.Shape.prototype.doClip
- *
- */
- doClip(ctx) {
- var clipShapeInvTransform = SUtil_SUtil.Util_matrix.create();
- if (this.__clipShapes) {
- for (var i = 0; i < this.__clipShapes.length; i++) {
- var clipShape = this.__clipShapes[i];
- if (clipShape.needTransform) {
- let m = clipShape.transform;
- SUtil_SUtil.Util_matrix.invert(clipShapeInvTransform, m);
- ctx.transform(
- m[0], m[1],
- m[2], m[3],
- m[4], m[5]
- );
- }
- ctx.beginPath();
- clipShape.buildPath(ctx, clipShape.style);
- ctx.clip();
- // Transform back
- if (clipShape.needTransform) {
- let m = clipShapeInvTransform;
- ctx.transform(
- m[0], m[1],
- m[2], m[3],
- m[4], m[5]
- );
- }
- }
- }
- }
- /**
- * @function LevelRenderer.Shape.prototype.getHighlightStyle
- * @description 根据默认样式扩展高亮样式
- *
- * @param {Object} style - 样式。
- * @param {Object} highlightStyle - 高亮样式。
- * @param {string} brushTypeOnly - brushTypeOnly。
- *
- */
- getHighlightStyle(style, highlightStyle, brushTypeOnly) {
- var newStyle = {};
- for (let k in style) {
- newStyle[k] = style[k];
- }
- var highlightColor = SUtil_SUtil.Util_color.getHighlightColor();
- // 根据highlightStyle扩展
- if (style.brushType != 'stroke') {
- // 带填充则用高亮色加粗边线
- newStyle.strokeColor = highlightColor;
- // SMIC-方法修改 - start
- newStyle.lineWidth = (style.lineWidth || 1);
- // 原始代码
- // newStyle.lineWidth = (style.lineWidth || 1)
- // + this.getHighlightZoom();
- // 修改代码1
- // if(!style.lineType || style.lineType === "solid"){
- // newStyle.lineWidth = (style.lineWidth || 1)
- // + this.getHighlightZoom();
- // }
- // else{
- // newStyle.lineWidth = (style.lineWidth || 1);
- // }
- // SMIC-方法修改 - end
- newStyle.brushType = 'both';
- } else {
- if (brushTypeOnly != 'stroke') {
- // 描边型的则用原色加工高亮
- newStyle.strokeColor = highlightColor;
- // SMIC-方法修改 - start
- newStyle.lineWidth = (style.lineWidth || 1);
- // 原始代码
- // newStyle.lineWidth = (style.lineWidth || 1)
- // + this.getHighlightZoom();
- // 修改代码1
- // if(!style.lineType || style.lineType === "solid"){
- // newStyle.lineWidth = (style.lineWidth || 1)
- // + this.getHighlightZoom();
- // }
- // else{
- // newStyle.lineWidth = (style.lineWidth || 1);
- // }
- // SMIC-方法修改 - end
- } else {
- // 线型的则用原色加工高亮
- newStyle.strokeColor = highlightStyle.strokeColor
- || SUtil_SUtil.Util_color.mix(
- style.strokeColor,
- SUtil_SUtil.Util_color.toRGB(highlightColor)
- );
- }
- }
- // 可自定义覆盖默认值
- for (let k in highlightStyle) {
- if (typeof highlightStyle[k] != 'undefined') {
- newStyle[k] = highlightStyle[k];
- }
- }
- return newStyle;
- }
- /**
- * @function LevelRenderer.Shape.prototype.getHighlightZoom
- * @description 高亮放大效果参数,当前统一设置为6,如有需要差异设置,通过 this.type 判断实例类型
- *
- */
- getHighlightZoom() {
- return this.type != 'text' ? 6 : 2;
- }
- /**
- * @function LevelRenderer.Shape.prototype.drift
- * @description 移动位置
- *
- * @param {Object} dx - 横坐标变化。
- * @param {Object} dy - 纵坐标变化。
- *
- */
- drift(dx, dy) {
- this.position[0] += dx;
- this.position[1] += dy;
- }
- /**
- * @function LevelRenderer.Shape.prototype.buildPath
- * @description 构建绘制的Path。子类必须重新实现此方法。
- *
- * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
- * @param {Object} style - 样式。
- */
- buildPath(ctx, style) { // eslint-disable-line no-unused-vars
- SUtil_SUtil.Util_log('buildPath not implemented in ' + this.type);
- }
- /**
- * @function LevelRenderer.Shape.prototype.getRect
- * @description 计算返回包围盒矩形。子类必须重新实现此方法。
- *
- * @param {Object} style - 样式。
- */
- getRect(style) { // eslint-disable-line no-unused-vars
- SUtil_SUtil.Util_log('getRect not implemented in ' + this.type);
- }
- /**
- * @function LevelRenderer.Shape.prototype.isCover
- * @description 判断鼠标位置是否在图形内。
- *
- * @param {number} x - x。
- * @param {number} y - y。
- */
- isCover(x, y) {
- var originPos = this.getTansform(x, y);
- x = originPos[0];
- y = originPos[1];
- // 快速预判并保留判断矩形
- var rect = this.style.__rect;
- if (!rect) {
- rect = this.style.__rect = this.getRect(this.style);
- }
- if (x >= rect.x
- && x <= (rect.x + rect.width)
- && y >= rect.y
- && y <= (rect.y + rect.height)
- ) {
- // 矩形内
- return SUtil_SUtil.Util_area.isInside(this, this.style, x, y);
- }
- return false;
- }
- /**
- * @function LevelRenderer.Shape.prototype.drawText
- * @description 绘制附加文本。
- *
- * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
- * @param {string} style - 样式。
- * @param {string} normalStyle - normalStyle 默认样式,用于定位文字显示。
- */
- drawText(ctx, style, normalStyle) {
- if (typeof(style.text) == 'undefined' || style.text === false) {
- return;
- }
- // 字体颜色策略
- var textColor = style.textColor || style.color || style.strokeColor;
- ctx.fillStyle = textColor;
- // 文本与图形间空白间隙
- var dd = 10;
- var al; // 文本水平对齐
- var bl; // 文本垂直对齐
- var tx; // 文本横坐标
- var ty; // 文本纵坐标
- var textPosition = style.textPosition // 用户定义
- || this.textPosition // shape默认
- || 'top'; // 全局默认
- // Smic 方法修改 -start
- var __OP = [];
- if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
- __OP = [0, 0];
- } else {
- __OP = this.refOriginalPosition;
- }
- //原代码:
- // Smic 方法修改 -end
- switch (textPosition) {
- case 'inside':
- case 'top':
- case 'bottom':
- case 'left':
- case 'right':
- if (this.getRect) {
- var rect = (normalStyle || style).__rect
- || this.getRect(normalStyle || style);
- switch (textPosition) {
- case 'inside':
- tx = rect.x + rect.width / 2;
- ty = rect.y + rect.height / 2;
- al = 'center';
- bl = 'middle';
- if (style.brushType != 'stroke'
- && textColor == style.color
- ) {
- ctx.fillStyle = '#fff';
- }
- break;
- case 'left':
- tx = rect.x - dd;
- ty = rect.y + rect.height / 2;
- al = 'end';
- bl = 'middle';
- break;
- case 'right':
- tx = rect.x + rect.width + dd;
- ty = rect.y + rect.height / 2;
- al = 'start';
- bl = 'middle';
- break;
- case 'top':
- tx = rect.x + rect.width / 2;
- ty = rect.y - dd;
- al = 'center';
- bl = 'bottom';
- break;
- case 'bottom':
- tx = rect.x + rect.width / 2;
- ty = rect.y + rect.height + dd;
- al = 'center';
- bl = 'top';
- break;
- }
- }
- break;
- case 'start':
- case 'end':
- var xStart = 0;
- var xEnd = 0;
- var yStart = 0;
- var yEnd = 0;
- if (typeof style.pointList != 'undefined') {
- var pointList = style.pointList;
- if (pointList.length < 2) {
- // 少于2个点就不画了~
- return;
- }
- var length = pointList.length;
- switch (textPosition) {
- // Smic 方法修改 -start
- case 'start':
- xStart = pointList[0][0] + __OP[0];
- xEnd = pointList[1][0] + __OP[0];
- yStart = pointList[0][1] + __OP[1];
- yEnd = pointList[1][1] + __OP[1];
- break;
- case 'end':
- xStart = pointList[length - 2][0] + __OP[0];
- xEnd = pointList[length - 1][0] + __OP[0];
- yStart = pointList[length - 2][1] + __OP[1];
- yEnd = pointList[length - 1][1] + __OP[1];
- break;
- //原代码:
- /*
- case 'start':
- xStart = pointList[0][0];
- xEnd = pointList[1][0];
- yStart = pointList[0][1];
- yEnd = pointList[1][1];
- break;
- case 'end':
- xStart = pointList[length - 2][0];
- xEnd = pointList[length - 1][0];
- yStart = pointList[length - 2][1];
- yEnd = pointList[length - 1][1];
- break;
- */
- // Smic 方法修改 -end
- }
- } else {
- // Smic 方法修改 -start
- xStart = (style.xStart + __OP[0]) || 0;
- xEnd = (style.xEnd + __OP[0]) || 0;
- yStart = (style.yStart + __OP[1]) || 0;
- yEnd = (style.yEnd + __OP[1]) || 0;
- //原代码:
- /*
- xStart = style.xStart || 0;
- xEnd = style.xEnd || 0;
- yStart = style.yStart || 0;
- yEnd = style.yEnd || 0;
- */
- // Smic 方法修改 -end
- }
- switch (textPosition) {
- case 'start':
- al = xStart < xEnd ? 'end' : 'start';
- bl = yStart < yEnd ? 'bottom' : 'top';
- tx = xStart;
- ty = yStart;
- break;
- case 'end':
- al = xStart < xEnd ? 'start' : 'end';
- bl = yStart < yEnd ? 'top' : 'bottom';
- tx = xEnd;
- ty = yEnd;
- break;
- }
- dd -= 4;
- if (xStart && xEnd && xStart != xEnd) {
- tx -= (al == 'end' ? dd : -dd);
- } else {
- al = 'center';
- }
- if (yStart != yEnd) {
- ty -= (bl == 'bottom' ? dd : -dd);
- } else {
- bl = 'middle';
- }
- break;
- case 'specific':
- tx = style.textX || 0;
- ty = style.textY || 0;
- al = 'start';
- bl = 'middle';
- break;
- }
- // Smic 方法修改 -start
- if (style.labelXOffset && !isNaN(style.labelXOffset)) {
- tx += style.labelXOffset;
- }
- if (style.labelYOffset && !isNaN(style.labelYOffset)) {
- ty += style.labelYOffset;
- }
- //原代码:
- // Smic 方法修改 -end
- if (tx != null && ty != null) {
- Shape_Shape._fillText(
- ctx,
- style.text,
- tx, ty,
- style.textFont,
- style.textAlign || al,
- style.textBaseline || bl
- );
- }
- }
- /**
- * @function LevelRenderer.Shape.prototype.modSelf
- * @description 图形发生改变
- */
- modSelf() {
- this.__dirty = true;
- if (this.style) {
- this.style.__rect = null;
- }
- if (this.highlightStyle) {
- this.highlightStyle.__rect = null;
- }
- }
- /**
- * @function LevelRenderer.Shape.prototype.isSilent
- * @description 图形是否会触发事件,通过 bind 绑定的事件
- */
- isSilent() {
- return !(
- this.hoverable || this.draggable || this.clickable
- || this.onmousemove || this.onmouseover || this.onmouseout
- || this.onmousedown || this.onmouseup || this.onclick
- || this.ondragenter || this.ondragover || this.ondragleave
- || this.ondrop
- );
- }
- /**
- * @function LevelRenderer.Shape.prototype.setCtxGlobalAlpha
- * @description 设置 Cavans 上下文全局透明度
- *
- * @param {Object} _ctx - Cavans 上下文
- * @param {string} type - one of 'stroke', 'fill', or 'reset'
- * @param {Object} style - Symbolizer hash
- */
- setCtxGlobalAlpha(_ctx, type, style) {
- if (type === "fill") {
- _ctx.globalAlpha = typeof(style["fillOpacity"]) === "undefined" ? (typeof(style["opacity"]) === "undefined" ? 1 : style['opacity']) : style['fillOpacity'];
- } else if (type === "stroke") {
- _ctx.globalAlpha = typeof(style["strokeOpacity"]) === "undefined" ? (typeof(style["opacity"]) === "undefined" ? 1 : style['opacity']) : style['strokeOpacity'];
- } else {
- _ctx.globalAlpha = typeof(style["opacity"]) === "undefined" ? 1 : style['opacity'];
- }
- }
- /**
- * @function LevelRenderer.Shape.prototype._fillText
- * @description 填充文本
- */
- static _fillText(ctx, text, x, y, textFont, textAlign, textBaseline) {
- if (textFont) {
- ctx.font = textFont;
- }
- ctx.textAlign = textAlign;
- ctx.textBaseline = textBaseline;
- var rect = Shape_Shape._getTextRect(
- text, x, y, textFont, textAlign, textBaseline
- );
- text = (text + '').split('\n');
- var lineHeight = SUtil_SUtil.Util_area.getTextHeight('ZH', textFont);
- switch (textBaseline) {
- case 'top':
- y = rect.y;
- break;
- case 'bottom':
- y = rect.y + lineHeight;
- break;
- default:
- y = rect.y + lineHeight / 2;
- }
- for (var i = 0, l = text.length; i < l; i++) {
- ctx.fillText(text[i], x, y);
- y += lineHeight;
- }
- }
- /**
- * @function LevelRenderer.Shape._getTextRect
- * @description 返回矩形区域,用于局部刷新和文字定位
- *
- * @param {string} text - text。
- * @param {number} x - x。
- * @param {number} y - y。
- * @param {string} textFont - textFont。
- * @param {string} textAlign - textAlign。
- * @param {string} textBaseline - textBaseline。
- * @return {Object} 矩形区域。
- */
- static _getTextRect(text, x, y, textFont, textAlign, textBaseline) {
- var width = SUtil_SUtil.Util_area.getTextWidth(text, textFont);
- var lineHeight = SUtil_SUtil.Util_area.getTextHeight('ZH', textFont);
- text = (text + '').split('\n');
- switch (textAlign) {
- case 'end':
- case 'right':
- x -= width;
- break;
- case 'center':
- x -= (width / 2);
- break;
- }
- switch (textBaseline) {
- case 'top':
- break;
- case 'bottom':
- y -= lineHeight * text.length;
- break;
- default:
- y -= lineHeight * text.length / 2;
- }
- return {
- x: x,
- y: y,
- width: width,
- height: lineHeight * text.length
- };
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicPoint.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @private
- * @class LevelRenderer.Shape.SmicPoint
- * @category Visualization Theme
- * @classdesc 点。
- * @extends LevelRenderer.Shape
- * @example
- * var shape = new LevelRenderer.Shape.SmicPoint({
- * style: {
- * x: 100,
- * y: 100,
- * r: 40,
- * brushType: 'both',
- * color: 'blue',
- * strokeColor: 'red',
- * lineWidth: 3,
- * text: 'point'
- * }
- * });
- * levelRenderer.addShape(shape);
- * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
- *
- */
- class SmicPoint extends Shape_Shape {
- constructor(options) {
- super(options);
- /**
- * @member {string} LevelRenderer.Shape.SmicPoint.prototype.type
- * @description 图形类型。
- */
- this.type = 'smicpoint';
- if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
- this.refOriginalPosition = [0, 0];
- }
- this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicPoint";
- }
- /**
- * @function cdestroy
- * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
- */
- destroy() {
- this.type = null;
- super.destroy();
- }
- /**
- * @function LevelRenderer.Shape.SmicPoint.prototype.buildPath
- * @description 创建点触。
- *
- * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
- * @param {Object} style - style。
- *
- */
- buildPath(ctx, style) {
- if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
- this.refOriginalPosition = [0, 0];
- }
- var __OP = this.refOriginalPosition;
- ctx.arc(style.x + __OP[0], style.y + __OP[1], style.r, 0, Math.PI * 2, true);
- return;
- }
- /**
- * @function LevelRenderer.Shape.SmicPoint.prototype.getRect
- * @description 计算返回点的包围盒矩形。该包围盒是直接从四个控制点计算,并非最小包围盒。
- *
- * @param {Object} style - style
- * @return {Object} 边框对象。包含属性:x,y,width,height。
- */
- getRect(style) {
- if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
- this.refOriginalPosition = [0, 0];
- }
- var __OP = this.refOriginalPosition;
- if (style.__rect) {
- return style.__rect;
- }
- var lineWidth;
- if (style.brushType == 'stroke' || style.brushType == 'fill') {
- lineWidth = style.lineWidth || 1;
- } else {
- lineWidth = 0;
- }
- style.__rect = {
- x: Math.round((style.x + __OP[0]) - style.r - lineWidth / 2),
- y: Math.round((style.y + __OP[1]) - style.r - lineWidth / 2),
- width: style.r * 2 + lineWidth,
- height: style.r * 2 + lineWidth
- };
- return style.__rect;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicText.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @private
- * @class LevelRenderer.Shape.SmicText
- * @category Visualization Theme
- * @extends {LevelRenderer.Shape}
- * @example
- * var shape = new LevelRenderer.Shape.SmicText({
- * style: {
- * text: 'Label',
- * x: 100,
- * y: 100,
- * textFont: '14px Arial'
- * }
- * });
- * levelRenderer.addShape(shape);
- * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
- */
- class SmicText extends Shape_Shape {
- constructor(options) {
- super(options);
- /**
- * @member {string} LevelRenderer.Shape.SmicText.prototype.type
- * @description 图形类型.
- */
- this.type = 'smictext';
- if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
- this.refOriginalPosition = [0, 0];
- }
- this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicText";
- }
- /**
- * @function LevelRenderer.Shape.SmicText.prototype.destroy
- * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
- */
- destroy() {
- this.type = null;
- super.destroy();
- }
- /**
- * @function LevelRenderer.Shape.SmicText.prototype.brush
- * @description 笔触。
- *
- * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
- * @param {boolean} isHighlight - 是否使用高亮属性。
- *
- */
- brush(ctx, isHighlight) {
- if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
- this.refOriginalPosition = [0, 0];
- }
- var __OP = this.refOriginalPosition;
- var style = this.style;
- if (isHighlight) {
- // 根据style扩展默认高亮样式
- style = this.getHighlightStyle(
- style, this.highlightStyle || {}
- );
- }
- if (typeof(style.text) == 'undefined' || style.text === false) {
- return;
- }
- ctx.save();
- this.doClip(ctx);
- this.setContext(ctx, style);
- // 设置transform
- this.setTransform(ctx);
- if (style.textFont) {
- ctx.font = style.textFont;
- }
- ctx.textAlign = style.textAlign || 'start';
- ctx.textBaseline = style.textBaseline || 'middle';
- var text = (style.text + '').split('\n');
- var lineHeight = SUtil_SUtil.Util_area.getTextHeight('ZH', style.textFont);
- var rect = this.getRectNoRotation(style);
- // var x = style.x;
- var x = style.x + __OP[0];
- var y;
- if (style.textBaseline == 'top') {
- y = rect.y;
- } else if (style.textBaseline == 'bottom') {
- y = rect.y + lineHeight;
- } else {
- y = rect.y + lineHeight / 2;
- }
- var ox = style.x + __OP[0];
- var oy = style.y + __OP[1];
- //文本绘制
- for (var i = 0, l = text.length; i < l; i++) {
- //是否渲染矩形背景及颜色
- if (style.labelRect) {
- //+4,-2是为了让文字距边框左右边缘有点间隔
- ctx.fillRect(rect.x - 2, rect.y, rect.width + 4, rect.height);
- ctx.fillStyle = style.strokeColor;
- ctx.strokeRect(rect.x - 2, rect.y, rect.width + 4, rect.height);
- ctx.fillStyle = style.textColor;
- }
- switch (style.brushType) {
- case 'stroke':
- this.setCtxGlobalAlpha(ctx, "stroke", style);
- if (style.textRotation && style.textRotation !== 0) {
- ctx.save();
- ctx.translate(ox, oy);
- ctx.rotate(style.textRotation * Math.PI / 180);
- if (style.textBaseline == 'top') {
- if (style.maxWidth) {
- ctx.strokeText(text[i], 0, lineHeight * i, style.maxWidth);
- } else {
- ctx.strokeText(text[i], 0, lineHeight * i);
- }
- } else if (style.textBaseline == 'bottom') {
- if (style.maxWidth) {
- ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height, style.maxWidth);
- } else {
- ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height);
- }
- } else {
- if (style.maxWidth) {
- ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2, style.maxWidth);
- } else {
- ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2);
- }
- }
- ctx.restore();
- } else {
- if (style.maxWidth) {
- ctx.strokeText(text[i], x, y, style.maxWidth);
- } else {
- ctx.strokeText(text[i], x, y);
- }
- }
- this.setCtxGlobalAlpha(ctx, "reset", style);
- break;
- case 'both':
- if (style.textRotation && style.textRotation !== 0) {
- ctx.save();
- ctx.translate(ox, oy);
- ctx.rotate(style.textRotation * Math.PI / 180);
- if (style.textBaseline == 'top') {
- if (style.maxWidth) {
- this.setCtxGlobalAlpha(ctx, "fill", style);
- ctx.fillText(text[i], 0, lineHeight * i, style.maxWidth);
- this.setCtxGlobalAlpha(ctx, "reset", style);
- this.setCtxGlobalAlpha(ctx, "stroke", style);
- ctx.strokeText(text[i], 0, lineHeight * i, style.maxWidth);
- this.setCtxGlobalAlpha(ctx, "reset", style);
- } else {
- this.setCtxGlobalAlpha(ctx, "fill", style);
- ctx.fillText(text[i], 0, lineHeight * i);
- this.setCtxGlobalAlpha(ctx, "reset", style);
- this.setCtxGlobalAlpha(ctx, "stroke", style);
- ctx.strokeText(text[i], 0, lineHeight * i);
- this.setCtxGlobalAlpha(ctx, "reset", style);
- }
- } else if (style.textBaseline == 'bottom') {
- if (style.maxWidth) {
- this.setCtxGlobalAlpha(ctx, "fill", style);
- ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height, style.maxWidth);
- this.setCtxGlobalAlpha(ctx, "reset", style);
- this.setCtxGlobalAlpha(ctx, "stroke", style);
- ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height, style.maxWidth);
- this.setCtxGlobalAlpha(ctx, "reset", style);
- } else {
- this.setCtxGlobalAlpha(ctx, "fill", style);
- ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height);
- this.setCtxGlobalAlpha(ctx, "reset", style);
- this.setCtxGlobalAlpha(ctx, "stroke", style);
- ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height);
- this.setCtxGlobalAlpha(ctx, "reset", style);
- }
- } else {
- if (style.maxWidth) {
- this.setCtxGlobalAlpha(ctx, "fill", style);
- ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2, style.maxWidth);
- this.setCtxGlobalAlpha(ctx, "reset", style);
- this.setCtxGlobalAlpha(ctx, "stroke", style);
- ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2, style.maxWidth);
- this.setCtxGlobalAlpha(ctx, "reset", style);
- } else {
- this.setCtxGlobalAlpha(ctx, "fill", style);
- ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2);
- this.setCtxGlobalAlpha(ctx, "reset", style);
- this.setCtxGlobalAlpha(ctx, "stroke", style);
- ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2);
- this.setCtxGlobalAlpha(ctx, "reset", style);
- }
- }
- ctx.restore();
- } else {
- if (style.maxWidth) {
- this.setCtxGlobalAlpha(ctx, "fill", style);
- ctx.fillText(text[i], x, y, style.maxWidth);
- this.setCtxGlobalAlpha(ctx, "reset", style);
- this.setCtxGlobalAlpha(ctx, "stroke", style);
- ctx.strokeText(text[i], x, y, style.maxWidth);
- this.setCtxGlobalAlpha(ctx, "reset", style);
- } else {
- this.setCtxGlobalAlpha(ctx, "fill", style);
- ctx.fillText(text[i], x, y);
- this.setCtxGlobalAlpha(ctx, "reset", style);
- this.setCtxGlobalAlpha(ctx, "stroke", style);
- ctx.strokeText(text[i], x, y);
- this.setCtxGlobalAlpha(ctx, "reset", style);
- }
- }
- break;
- default:
- //fill or others
- this.setCtxGlobalAlpha(ctx, "fill", style);
- if (style.textRotation && style.textRotation !== 0) {
- ctx.save();
- ctx.translate(ox, oy);
- ctx.rotate(style.textRotation * Math.PI / 180);
- if (style.textBaseline == 'top') {
- if (style.maxWidth) {
- ctx.fillText(text[i], 0, lineHeight * i, style.maxWidth);
- } else {
- ctx.fillText(text[i], 0, lineHeight * i);
- }
- } else if (style.textBaseline == 'bottom') {
- if (style.maxWidth) {
- ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height, style.maxWidth);
- } else {
- ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height);
- }
- } else {
- if (style.maxWidth) {
- ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2, style.maxWidth);
- } else {
- ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2);
- }
- }
- ctx.restore();
- } else {
- if (style.maxWidth) {
- ctx.fillText(text[i], x, y, style.maxWidth);
- } else {
- ctx.fillText(text[i], x, y);
- }
- }
- this.setCtxGlobalAlpha(ctx, "reset", style);
- }
- y += lineHeight;
- }
- ctx.restore();
- return;
- }
- /**
- * @function LevelRenderer.Shape.SmicText.prototype.getRect
- * @description 返回文字包围盒矩形
- */
- getRect(style) {
- if (style.__rect) {
- return style.__rect;
- }
- var left, top, right, bottom
- var tbg = this.getTextBackground(style, true);
- for (var i = 0, len = tbg.length; i < len; i++) {
- var poi = tbg[i];
- //用第一个点初始化
- if (i == 0) {
- left = poi[0];
- right = poi[0];
- top = poi[1];
- bottom = poi[1];
- } else {
- if (poi[0] < left) {
- left = poi[0]
- }
- if (poi[0] > right) {
- right = poi[0]
- }
- if (poi[1] < top) {
- top = poi[1]
- }
- if (poi[1] > bottom) {
- bottom = poi[1]
- }
- }
- }
- style.__rect = {
- x: left,
- y: top,
- width: right - left,
- height: bottom - top
- };
- return style.__rect;
- }
- /**
- * @function LevelRenderer.Shape.SmicText.prototype.getRectNoRotation
- * @description 返回忽略旋转和maxWidth时文字包围盒矩形
- */
- getRectNoRotation(style) {
- if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
- this.refOriginalPosition = [0, 0];
- }
- var __OP = this.refOriginalPosition;
- var lineHeight = SUtil_SUtil.Util_area.getTextHeight('ZH', style.textFont);
- var width = SUtil_SUtil.Util_area.getTextWidth(style.text, style.textFont);
- var height = SUtil_SUtil.Util_area.getTextHeight(style.text, style.textFont);
- //处理文字位置,注:文本的绘制是由此 rect 决定
- var textX = style.x + __OP[0]; // 默认start == left
- if (style.textAlign == 'end' || style.textAlign == 'right') {
- textX -= width;
- } else if (style.textAlign == 'center') {
- textX -= (width / 2);
- }
- var textY;
- if (style.textBaseline == 'top') {
- // textY = style.y;
- textY = style.y + __OP[1];
- } else if (style.textBaseline == 'bottom') {
- textY = (style.y + __OP[1]) - height;
- } else {
- // middle
- textY = (style.y + __OP[1]) - height / 2;
- }
- var isWidthChangeByMaxWidth = false;
- var widthBeforeChangeByMaxWidth;
- //处理 maxWidth
- if (style.maxWidth) {
- var maxWidth = parseInt(style.maxWidth);
- if (maxWidth < width) {
- widthBeforeChangeByMaxWidth = width;
- isWidthChangeByMaxWidth = true;
- width = maxWidth;
- }
- textX = style.x + __OP[0];
- if (style.textAlign == 'end' || style.textAlign == 'right') {
- textX -= width;
- } else if (style.textAlign == 'center') {
- textX -= (width / 2);
- }
- }
- //处理斜体字
- if (style.textFont) {
- var textFont = style.textFont;
- var textFontStr = textFont.toLowerCase()
- if (textFontStr.indexOf("italic") > -1) {
- if (isWidthChangeByMaxWidth === true) {
- width += (lineHeight / 3) * (width / widthBeforeChangeByMaxWidth);
- } else {
- width += lineHeight / 3;
- }
- }
- }
- var rect = {
- x: textX,
- y: textY,
- width: width,
- height: height
- };
- return rect;
- }
- /**
- * @function LevelRenderer.Shape.SmicText.prototype.getTextBackground
- * @description 获取文本背景框范围
- *
- * @param {Object} style - 样式。
- * @param {boolean} redo - 是否强制重新计算 textBackground。
- */
- getTextBackground(style, redo) {
- if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
- this.refOriginalPosition = [0, 0];
- }
- var __OP = this.refOriginalPosition;
- if ((!redo) && style.__textBackground) {
- return style.__textBackground;
- }
- //不旋转时矩形框
- var rect = this.getRectNoRotation(style);
- //旋转中心点
- var ox = style.x + __OP[0];
- var oy = style.y + __OP[1];
- //背景框
- var background = [];
- if (style.textRotation && style.textRotation !== 0) {
- let textRotation = style.textRotation;
- let ltPoi = this.getRotatedLocation(rect.x, rect.y, ox, oy, textRotation);
- let rtPoi = this.getRotatedLocation(rect.x + rect.width, rect.y, ox, oy, textRotation);
- let rbPoi = this.getRotatedLocation(rect.x + rect.width, rect.y + rect.height, ox, oy, textRotation);
- let lbPoi = this.getRotatedLocation(rect.x, rect.y + rect.height, ox, oy, textRotation);
- background.push(ltPoi);
- background.push(rtPoi);
- background.push(rbPoi);
- background.push(lbPoi);
- } else {
- let ltPoi = [rect.x, rect.y];
- let rtPoi = [rect.x + rect.width, rect.y];
- let rbPoi = [rect.x + rect.width, rect.y + rect.height];
- let lbPoi = [rect.x, rect.y + rect.height];
- background.push(ltPoi);
- background.push(rtPoi);
- background.push(rbPoi);
- background.push(lbPoi);
- }
- style.__textBackground = background;
- return style.__textBackground;
- }
- /**
- * @function LevelRenderer.Shape.SmicText.prototype.getRotatedLocation
- * @description 获取一个点绕旋转中心顺时针旋转后的位置。(此方法用于屏幕坐标)
- *
- * @param {number} x - 旋转点横坐标。
- * @param {number} y - 旋转点纵坐标。
- * @param {number} rx - 旋转中心点横坐标。
- * @param {number} ry - 旋转中心点纵坐标。
- * @param {number} angle - 旋转角度(度)。
- * @return {Array.<number>} 旋转后的坐标位置,长度为 2 的一维数组,数组第一个元素表示 x 坐标,第二个元素表示 y 坐标。
- */
- getRotatedLocation(x, y, rx, ry, angle) {
- var loc = new Array(), x0, y0;
- y = -y;
- ry = -ry;
- angle = -angle;//顺时针旋转
- x0 = (x - rx) * Math.cos((angle / 180) * Math.PI) - (y - ry) * Math.sin((angle / 180) * Math.PI) + rx;
- y0 = (x - rx) * Math.sin((angle / 180) * Math.PI) + (y - ry) * Math.cos((angle / 180) * Math.PI) + ry;
- loc[0] = x0;
- loc[1] = -y0;
- return loc;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicCircle.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @private
- * @class LevelRenderer.Shape.SmicCircle
- * @category Visualization Theme
- * @classdesc 圆形
- * @extends LevelRenderer.Shape
- * @example
- * var shape = new LevelRenderer.Shape.SmicCircle({
- * style: {
- * x: 100,
- * y: 100,
- * r: 60,
- * brushType: "both",
- * color: "blue",
- * strokeColor: "red",
- * lineWidth: 3,
- * text: "Circle"
- * }
- * });
- * levelRenderer.addShape(shape);
- * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
- *
- */
- class SmicCircle extends Shape_Shape {
- constructor(options) {
- super(options);
- /**
- * @member {string} LevelRenderer.Shape.SmicCircle.prototype.type
- * @description 图形类型。
- */
- this.type = 'smiccircle';
- if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
- this.refOriginalPosition = [0, 0];
- }
- this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicCircle";
- }
- /**
- * @function LevelRenderer.Shape.SmicCircle.prototype.destroy
- * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
- */
- destroy() {
- this.type = null;
- super.destroy();
- }
- /**
- * @function LevelRenderer.Shape.SmicCircle.prototype.buildPath
- * @description 创建图形路径。
- *
- * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
- * @param {Object} style - style。
- *
- */
- buildPath(ctx, style) {
- if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
- this.refOriginalPosition = [0, 0];
- }
- var __OP = this.refOriginalPosition;
- var x = style.x + __OP[0]; // 圆心x
- var y = style.y + __OP[1]; // 圆心y
- ctx.moveTo(x + style.r, y);
- ctx.arc(x, y, style.r, 0, Math.PI * 2, true);
- return true;
- }
- /**
- * @function LevelRenderer.Shape.SmicCircle.prototype.getRect
- * @description 返回圆形包围盒矩形
- *
- * @param {Object} style - style
- * @return {Object} 边框对象。包含属性:x,y,width,height。
- *
- */
- getRect(style) {
- if (style.__rect) {
- return style.__rect;
- }
- if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
- this.refOriginalPosition = [0, 0];
- }
- var __OP = this.refOriginalPosition;
- var x = style.x + __OP[0]; // 圆心x
- var y = style.y + __OP[1]; // 圆心y
- var r = style.r; // 圆r
- var lineWidth;
- if (style.brushType == 'stroke' || style.brushType == 'fill') {
- lineWidth = style.lineWidth || 1;
- } else {
- lineWidth = 0;
- }
- style.__rect = {
- x: Math.round(x - r - lineWidth / 2),
- y: Math.round(y - r - lineWidth / 2),
- width: r * 2 + lineWidth,
- height: r * 2 + lineWidth
- };
- return style.__rect;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicPolygon.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @private
- * @class LevelRenderer.Shape.SmicPolygon
- * @category Visualization Theme
- * @classdesc 多边形。
- * @extends LevelRenderer.Shape
- * @example
- * var shape = new LevelRenderer.Shape.SmicPolygon({
- * style: {
- * // 100x100 的正方形
- * pointList: [[0, 0], [100, 0], [100, 100], [0, 100]],
- * color: 'blue'
- * }
- * });
- * levelRenderer.addShape(shape);
- * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
- */
- class SmicPolygon extends Shape_Shape {
- constructor(options) {
- super(options);
- /**
- * @member {string} LevelRenderer.Shape.SmicPolygon.prototype.type
- * @description 图形类型.
- */
- this.type = 'smicpolygon';
- /**
- * @member {Array} LevelRenderer.Shape.SmicPolygon.prototype._holePolygonPointList
- * @description 岛洞面多边形顶点数组(三维数组)
- *
- */
- this.holePolygonPointLists = null;
- if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
- this.refOriginalPosition = [0, 0];
- }
- this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicPolygon";
- }
- /**
- * @function LevelRenderer.Shape.SmicPolygon.prototype.destroy
- * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
- */
- destroy() {
- this.type = null;
- this.holePolygonPointLists = null;
- super.destroy();
- }
- /**
- * @function LevelRenderer.Shape.SmicPolygon.prototype.brush
- * @description 笔触。
- *
- * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
- * @param {boolean} isHighlight - 是否使用高亮属性。
- *
- */
- brush(ctx, isHighlight) {
- if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
- this.refOriginalPosition = [0, 0];
- }
- var style = this.style;
- if (isHighlight) {
- // 根据style扩展默认高亮样式
- style = this.getHighlightStyle(
- style,
- this.highlightStyle || {}
- );
- }
- ctx.save();
- this.setContext(ctx, style);
- // 设置 transform
- this.setTransform(ctx);
- // 先 fill 再stroke
- var hasPath = false;
- if (style.brushType == 'fill' || style.brushType == 'both' || typeof style.brushType == 'undefined') { // 默认为fill
- ctx.beginPath();
- if (style.lineType == 'dashed'
- || style.lineType == 'dotted'
- || style.lineType == 'dot'
- || style.lineType == 'dash'
- || style.lineType == 'dashdot'
- || style.lineType == 'longdash'
- || style.lineType == 'longdashdot'
- ) {
- // 特殊处理,虚线围不成path,实线再build一次
- this.buildPath(ctx, {
- lineType: 'solid',
- lineWidth: style.lineWidth,
- pointList: style.pointList
- }
- );
- } else {
- this.buildPath(ctx, style);
- hasPath = true; // 这个path能用
- }
- ctx.closePath();
- this.setCtxGlobalAlpha(ctx, "fill", style);
- ctx.fill();
- this.setCtxGlobalAlpha(ctx, "reset", style);
- }
- if (style.lineWidth > 0 && (style.brushType == 'stroke' || style.brushType == 'both')) {
- if (!hasPath) {
- ctx.beginPath();
- this.buildPath(ctx, style);
- }
- this.setCtxGlobalAlpha(ctx, "stroke", style);
- ctx.stroke();
- this.setCtxGlobalAlpha(ctx, "reset", style);
- }
- this.drawText(ctx, style, this.style);
- //岛洞
- var hpStyle = Util.cloneObject(style);
- if (hpStyle.pointList) {
- if (this.holePolygonPointLists && this.holePolygonPointLists.length > 0) {
- var holePLS = this.holePolygonPointLists;
- var holePLSen = holePLS.length;
- for (var i = 0; i < holePLSen; i++) {
- var holePL = holePLS[i];
- //岛洞面
- hpStyle.pointList = holePL;
- ctx.globalCompositeOperation = "destination-out";
- // 先 fill 再stroke
- hasPath = false;
- if (hpStyle.brushType == 'fill' || hpStyle.brushType == 'both' || typeof hpStyle.brushType == 'undefined') { // 默认为fill
- ctx.beginPath();
- if (hpStyle.lineType == 'dashed'
- || hpStyle.lineType == 'dotted'
- || hpStyle.lineType == 'dot'
- || hpStyle.lineType == 'dash'
- || hpStyle.lineType == 'dashdot'
- || hpStyle.lineType == 'longdash'
- || hpStyle.lineType == 'longdashdot'
- ) {
- // 特殊处理,虚线围不成path,实线再build一次
- this.buildPath(ctx, {
- lineType: 'solid',
- lineWidth: hpStyle.lineWidth,
- pointList: hpStyle.pointList
- }
- );
- } else {
- this.buildPath(ctx, hpStyle);
- hasPath = true; // 这个path能用
- }
- ctx.closePath();
- this.setCtxGlobalAlpha(ctx, "fill", hpStyle);
- ctx.fill();
- this.setCtxGlobalAlpha(ctx, "reset", hpStyle);
- }
- if (hpStyle.lineWidth > 0 && (hpStyle.brushType == 'stroke' || hpStyle.brushType == 'both')) {
- if (!hasPath) {
- ctx.beginPath();
- this.buildPath(ctx, hpStyle);
- }
- //如果描边,先回复 globalCompositeOperation 默认值再描边。
- ctx.globalCompositeOperation = "source-over";
- this.setCtxGlobalAlpha(ctx, "stroke", hpStyle);
- ctx.stroke();
- this.setCtxGlobalAlpha(ctx, "reset", hpStyle);
- } else {
- ctx.globalCompositeOperation = "source-over";
- }
- }
- }
- }
- ctx.restore();
- return;
- }
- /**
- * @function LevelRenderer.Shape.SmicPolygon.prototype.buildPath
- * @description 创建多边形路径。
- *
- * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
- * @param {Object} style - style。
- *
- */
- buildPath(ctx, style) {
- if (style.showShadow) {
- ctx.shadowBlur = style.shadowBlur;
- ctx.shadowColor = style.shadowColor;
- ctx.shadowOffsetX = style.shadowOffsetX;
- ctx.shadowOffsetY = style.shadowOffsetY;
- }
- if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
- this.refOriginalPosition = [0, 0];
- }
- var __OP = this.refOriginalPosition;
- // 虽然能重用 brokenLine,但底层图形基于性能考虑,重复代码减少调用吧
- var pointList = style.pointList;
- if (pointList.length < 2) {
- // 少于2个点就不画了~
- return;
- }
- if (style.smooth && style.smooth !== 'spline') {
- var controlPoints = SUtil_SUtil.SUtil_smoothBezier(pointList, style.smooth, true, style.smoothConstraint, __OP);
- ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
- var cp1;
- var cp2;
- var p;
- var len = pointList.length;
- for (var i = 0; i < len; i++) {
- cp1 = controlPoints[i * 2];
- cp2 = controlPoints[i * 2 + 1];
- p = [pointList[(i + 1) % len][0] + __OP[0], pointList[(i + 1) % len][1] + __OP[1]];
- ctx.bezierCurveTo(
- cp1[0], cp1[1], cp2[0], cp2[1], p[0], p[1]
- );
- }
- } else {
- if (style.smooth === 'spline') {
- pointList = SUtil_SUtil.SUtil_smoothSpline(pointList, true, null, __OP);
- }
- if (!style.lineType || style.lineType == 'solid') {
- // 默认为实线
- ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
- for (let i = 1; i < pointList.length; i++) {
- ctx.lineTo(pointList[i][0] + __OP[0], pointList[i][1] + __OP[1]);
- }
- ctx.lineTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
- } else if (style.lineType === 'dashed'
- || style.lineType === 'dotted'
- || style.lineType === 'dot'
- || style.lineType === 'dash'
- || style.lineType === 'longdash'
- ) {
- // SMIC-方法修改 - start
- let dashLengthForStyle = style._dashLength || (style.lineWidth || 1) * (style.lineType == 'dashed' ? 5 : 1);
- style._dashLength = dashLengthForStyle;
- let dashLength = (style.lineWidth || 1);
- let pattern1 = dashLength;
- let pattern2 = dashLength;
- //dashed
- if (style.lineType === 'dashed') {
- pattern1 *= 5;
- pattern2 *= 5;
- if (style.lineCap && style.lineCap !== "butt") {
- pattern1 -= dashLength;
- pattern2 += dashLength;
- }
- }
- //dotted
- if (style.lineType === 'dotted') {
- if (style.lineCap && style.lineCap !== "butt") {
- pattern1 = 1;
- pattern2 += dashLength;
- }
- }
- //dot
- if (style.lineType === 'dot') {
- pattern2 *= 4;
- if (style.lineCap && style.lineCap !== "butt") {
- pattern1 = 1;
- pattern2 += dashLength;
- }
- }
- //dash
- if (style.lineType === 'dash') {
- pattern1 *= 4;
- pattern2 *= 4;
- if (style.lineCap && style.lineCap !== "butt") {
- pattern1 -= dashLength;
- pattern2 += dashLength;
- }
- }
- //longdash
- if (style.lineType === 'longdash') {
- pattern1 *= 8;
- pattern2 *= 4;
- if (style.lineCap && style.lineCap !== "butt") {
- pattern1 -= dashLength;
- pattern2 += dashLength;
- }
- }
- ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
- for (let i = 1; i < pointList.length; i++) {
- SUtil_SUtil.SUtil_dashedLineTo(
- ctx,
- pointList[i - 1][0] + __OP[0],
- pointList[i - 1][1] + __OP[1],
- pointList[i][0] + __OP[0],
- pointList[i][1] + __OP[1],
- dashLength,
- [pattern1, pattern2]
- );
- }
- SUtil_SUtil.SUtil_dashedLineTo(
- ctx,
- pointList[pointList.length - 1][0] + __OP[0],
- pointList[pointList.length - 1][1] + __OP[1],
- pointList[0][0] + __OP[0],
- pointList[0][1] + __OP[1],
- dashLength,
- [pattern1, pattern2]
- );
- } else if (style.lineType === 'dashdot'
- || style.lineType === 'longdashdot'
- ) {
- let dashLengthForStyle = style._dashLength || (style.lineWidth || 1) * (style.lineType == 'dashed' ? 5 : 1);
- style._dashLength = dashLengthForStyle;
- let dashLength = (style.lineWidth || 1);
- let pattern1 = dashLength;
- let pattern2 = dashLength;
- let pattern3 = dashLength;
- let pattern4 = dashLength;
- //dashdot
- if (style.lineType === 'dashdot') {
- pattern1 *= 4;
- pattern2 *= 4;
- pattern4 *= 4;
- if (style.lineCap && style.lineCap !== "butt") {
- pattern1 -= dashLength;
- pattern2 += dashLength;
- pattern3 = 1;
- pattern4 += dashLength;
- }
- }
- //longdashdot
- if (style.lineType === 'longdashdot') {
- pattern1 *= 8;
- pattern2 *= 4;
- pattern4 *= 4;
- if (style.lineCap && style.lineCap !== "butt") {
- pattern1 -= dashLength;
- pattern2 += dashLength;
- pattern3 = 1;
- pattern4 += dashLength;
- }
- }
- ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
- for (let i = 1; i < pointList.length; i++) {
- SUtil_SUtil.SUtil_dashedLineTo(
- ctx,
- pointList[i - 1][0] + __OP[0],
- pointList[i - 1][1] + __OP[1],
- pointList[i][0] + __OP[0],
- pointList[i][1] + __OP[1],
- dashLength,
- [pattern1, pattern2, pattern3, pattern4]
- );
- }
- SUtil_SUtil.SUtil_dashedLineTo(
- ctx,
- pointList[pointList.length - 1][0] + __OP[0],
- pointList[pointList.length - 1][1] + __OP[1],
- pointList[0][0] + __OP[0],
- pointList[0][1] + __OP[1],
- dashLength,
- [pattern1, pattern2, pattern3, pattern4]
- );
- }
- }
- return;
- }
- /**
- * @function LevelRenderer.Shape.SmicPolygon.prototype.getRect
- * @description 计算返回多边形包围盒矩阵。该包围盒是直接从四个控制点计算,并非最小包围盒。
- *
- * @param {Object} style - style
- * @return {Object} 边框对象。包含属性:x,y,width,height。
- *
- */
- getRect(style, refOriginalPosition) {
- var __OP;
- if (!refOriginalPosition) {
- if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
- this.refOriginalPosition = [0, 0];
- }
- __OP = this.refOriginalPosition;
- } else {
- __OP = refOriginalPosition;
- }
- if (style.__rect) {
- return style.__rect;
- }
- var minX = Number.MAX_VALUE;
- var maxX = Number.MIN_VALUE;
- var minY = Number.MAX_VALUE;
- var maxY = Number.MIN_VALUE;
- var pointList = style.pointList;
- for (var i = 0, l = pointList.length; i < l; i++) {
- if (pointList[i][0] + __OP[0] < minX) {
- minX = pointList[i][0] + __OP[0];
- }
- if (pointList[i][0] + __OP[0] > maxX) {
- maxX = pointList[i][0] + __OP[0];
- }
- if (pointList[i][1] + __OP[1] < minY) {
- minY = pointList[i][1] + __OP[1];
- }
- if (pointList[i][1] + __OP[1] > maxY) {
- maxY = pointList[i][1] + __OP[1];
- }
- }
- var lineWidth;
- if (style.brushType == 'stroke' || style.brushType == 'fill') {
- lineWidth = style.lineWidth || 1;
- } else {
- lineWidth = 0;
- }
- style.__rect = {
- x: Math.round(minX - lineWidth / 2),
- y: Math.round(minY - lineWidth / 2),
- width: maxX - minX + lineWidth,
- height: maxY - minY + lineWidth
- };
- return style.__rect;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicBrokenLine.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @private
- * @class LevelRenderer.Shape.SmicBrokenLine
- * @category Visualization Theme
- * @classdesc 折线(ic)。
- * @extends LevelRenderer.Shape
- * @example
- * var shape = new LevelRenderer.Shape.SmicBrokenLine({
- * style: {
- * pointList: [[0, 0], [100, 100], [100, 0]],
- * smooth: 'bezier',
- * strokeColor: 'purple'
- * }
- * });
- * levelRenderer.addShape(shape);
- * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
- *
- */
- class SmicBrokenLine extends Shape_Shape {
- constructor(options) {
- super(options);
- /**
- * @member {string} LevelRenderer.Shape.SmicBrokenLine.prototype.brushTypeOnly
- * @description 线条只能描边。
- */
- this.brushTypeOnly = 'stroke';
- /**
- * @member {string} LevelRenderer.Shape.SmicBrokenLine.prototype.textPosition
- * @description 文本位置。
- */
- this.textPosition = 'end';
- /**
- * @member {string} LevelRenderer.Shape.SmicBrokenLine.prototype.type
- * @description 图形类型.
- */
- this.type = 'smicbroken-line';
- if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
- this.refOriginalPosition = [0, 0];
- }
- this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicBrokenLine";
- }
- /**
- * @function LevelRenderer.Shape.SmicBrokenLine.prototype.destroy
- * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
- */
- destroy() {
- this.brushTypeOnly = null;
- this.textPosition = null;
- this.type = null;
- super.destroy();
- }
- /**
- * @function LevelRenderer.Shape.SmicBrokenLine.prototype.buildPath
- * @description 创建折线路径。
- *
- * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
- * @param {Object} style - style。
- *
- */
- buildPath(ctx, style) {
- if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
- this.refOriginalPosition = [0, 0];
- }
- var __OP = this.refOriginalPosition;
- var pointList = style.pointList;
- if (pointList.length < 2) {
- // 少于2个点就不画了~
- return;
- }
- var len = Math.min(style.pointList.length, Math.round(style.pointListLength || style.pointList.length));
- if (style.smooth && style.smooth !== 'spline') {
- var controlPoints = SUtil_SUtil.SUtil_smoothBezier(pointList, style.smooth, false, style.smoothConstraint, __OP);
- ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
- var cp1;
- var cp2;
- var p;
- for (let i = 0; i < len - 1; i++) {
- cp1 = controlPoints[i * 2];
- cp2 = controlPoints[i * 2 + 1];
- p = [pointList[i + 1][0] + __OP[0], pointList[i + 1][1] + __OP[1]];
- ctx.bezierCurveTo(
- cp1[0], cp1[1], cp2[0], cp2[1], p[0], p[1]
- );
- }
- } else {
- if (style.smooth === 'spline') {
- pointList = SUtil_SUtil.SUtil_smoothSpline(pointList, null, null, __OP);
- len = pointList.length;
- }
- if (!style.lineType || style.lineType === 'solid') {
- // 默认为实线
- ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
- for (let i = 1; i < len; i++) {
- ctx.lineTo(pointList[i][0] + __OP[0], pointList[i][1] + __OP[1]);
- }
- } else if (style.lineType === 'dashed'
- || style.lineType === 'dotted'
- || style.lineType === 'dot'
- || style.lineType === 'dash'
- || style.lineType === 'longdash'
- ) {
- let dashLength = (style.lineWidth || 1);
- let pattern1 = dashLength;
- let pattern2 = dashLength;
- //dashed
- if (style.lineType === 'dashed') {
- pattern1 *= 5;
- pattern2 *= 5;
- if (style.lineCap && style.lineCap !== "butt") {
- pattern1 -= dashLength;
- pattern2 += dashLength;
- }
- }
- //dotted
- if (style.lineType === 'dotted') {
- if (style.lineCap && style.lineCap !== "butt") {
- pattern1 = 1;
- pattern2 += dashLength;
- }
- }
- //dot
- if (style.lineType === 'dot') {
- pattern2 *= 4;
- if (style.lineCap && style.lineCap !== "butt") {
- pattern1 = 1;
- pattern2 += dashLength;
- }
- }
- //dash
- if (style.lineType === 'dash') {
- pattern1 *= 4;
- pattern2 *= 4;
- if (style.lineCap && style.lineCap !== "butt") {
- pattern1 -= dashLength;
- pattern2 += dashLength;
- }
- }
- //longdash
- if (style.lineType === 'longdash') {
- pattern1 *= 8;
- pattern2 *= 4;
- if (style.lineCap && style.lineCap !== "butt") {
- pattern1 -= dashLength;
- pattern2 += dashLength;
- }
- }
- ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
- for (var i = 1; i < len; i++) {
- SUtil_SUtil.SUtil_dashedLineTo(
- ctx,
- pointList[i - 1][0] + __OP[0], pointList[i - 1][1] + __OP[1],
- pointList[i][0] + __OP[0], pointList[i][1] + __OP[1],
- dashLength,
- [pattern1, pattern2]
- );
- }
- } else if (style.lineType === 'dashdot'
- || style.lineType === 'longdashdot'
- ) {
- let dashLength = (style.lineWidth || 1);
- let pattern1 = dashLength;
- let pattern2 = dashLength;
- let pattern3 = dashLength;
- let pattern4 = dashLength;
- //dashdot
- if (style.lineType === 'dashdot') {
- pattern1 *= 4;
- pattern2 *= 4;
- pattern4 *= 4;
- if (style.lineCap && style.lineCap !== "butt") {
- pattern1 -= dashLength;
- pattern2 += dashLength;
- pattern3 = 1;
- pattern4 += dashLength;
- }
- }
- //longdashdot
- if (style.lineType === 'longdashdot') {
- pattern1 *= 8;
- pattern2 *= 4;
- pattern4 *= 4;
- if (style.lineCap && style.lineCap !== "butt") {
- pattern1 -= dashLength;
- pattern2 += dashLength;
- pattern3 = 1;
- pattern4 += dashLength;
- }
- }
- dashLength = (style.lineWidth || 1)
- * (style.lineType === 'dashed' ? 5 : 1);
- ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
- for (let i = 1; i < len; i++) {
- SUtil_SUtil.SUtil_dashedLineTo(
- ctx,
- pointList[i - 1][0] + __OP[0], pointList[i - 1][1] + __OP[1],
- pointList[i][0] + __OP[0], pointList[i][1] + __OP[1],
- dashLength,
- [pattern1, pattern2, pattern3, pattern4]
- );
- }
- }
- }
- return;
- }
- /**
- * @function LevelRenderer.Shape.SmicBrokenLine.prototype.getRect
- * @description 计算返回折线包围盒矩形。该包围盒是直接从四个控制点计算,并非最小包围盒。
- *
- * @param {Object} style - style
- * @return {Object} 边框对象。包含属性:x,y,width,height。
- */
- getRect(style) {
- if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
- this.refOriginalPosition = [0, 0];
- }
- var __OP = this.refOriginalPosition;
- return SmicPolygon.prototype.getRect.apply(this, [style, __OP]);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicImage.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @private
- * @class LevelRenderer.Shape.SmicImage
- * @category Visualization Theme
- * @classdesc 图片绘制。
- * @extends LevelRenderer.Shape
- * @example
- * var shape = new LevelRenderer.Shape.SmicImage({
- * style: {
- * image: 'test.jpg',
- * x: 100,
- * y: 100
- * }
- * });
- * levelRenderer.addShape(shape);
- * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
- *
- */
- class SmicImage extends Shape_Shape {
- constructor(options) {
- super(options);
- /**
- * @member {string} LevelRenderer.Shape.SmicImage.prototype.type
- * @description 图形类型。
- */
- this.type = 'smicimage';
- /**
- * @member {string} LevelRenderer.Shape.SmicImage.prototype._imageCache
- * @description 图片缓存。
- */
- this._imageCache = {};
- if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
- this.refOriginalPosition = [0, 0];
- }
- this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicImage";
- }
- /**
- * @function LevelRenderer.Shape.SmicImage.prototype.destroy
- * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
- */
- destroy() {
- this.type = null;
- this._imageCache = null;
- super.destroy();
- }
- /**
- * @function LevelRenderer.Shape.SmicImage.prototype.buildPath
- * @description 创建图片。
- *
- * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
- * @param {Object} style - style。
- *
- */
- brush(ctx, isHighlight, refresh) {
- if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
- this.refOriginalPosition = [0, 0];
- }
- var __OP = this.refOriginalPosition;
- var style = this.style || {};
- if (isHighlight) {
- // 根据style扩展默认高亮样式
- style = this.getHighlightStyle(
- style, this.highlightStyle || {}
- );
- }
- var image = style.image;
- var me = this;
- if (typeof(image) === 'string') {
- var src = image;
- if (this._imageCache[src]) {
- image = this._imageCache[src];
- } else {
- image = new Image();
- image.onload = function () {
- image.onload = null;
- clearTimeout(SmicImage._refreshTimeout);
- SmicImage._needsRefresh.push(me);
- // 防止因为缓存短时间内触发多次onload事件
- SmicImage._refreshTimeout = setTimeout(function () {
- refresh && refresh(SmicImage._needsRefresh);
- // 清空 needsRefresh
- SmicImage._needsRefresh = [];
- }, 10);
- };
- image.src = src;
- this._imageCache[src] = image;
- }
- }
- if (image) {
- // 图片已经加载完成
- if (image.nodeName.toUpperCase() == 'IMG') {
- if (window.ActiveXObject) {
- if (image.readyState != 'complete') {
- return;
- }
- } else {
- if (!image.complete) {
- return;
- }
- }
- }
- // Else is canvas
- var width = style.width || image.width;
- var height = style.height || image.height;
- var x = style.x + __OP[0];
- var y = style.y + __OP[1];
- // 图片加载失败
- if (!image.width || !image.height) {
- return;
- }
- ctx.save();
- this.doClip(ctx);
- this.setContext(ctx, style);
- // 设置transform
- this.setTransform(ctx);
- if (style.sWidth && style.sHeight) {
- let sx = (style.sx + __OP[0]) || 0;
- let sy = (style.sy + __OP[1]) || 0;
- ctx.drawImage(
- image,
- sx, sy, style.sWidth, style.sHeight,
- x, y, width, height
- );
- } else if (style.sx && style.sy) {
- let sx = style.sx + __OP[0];
- let sy = style.sy + __OP[1];
- var sWidth = width - sx;
- var sHeight = height - sy;
- ctx.drawImage(
- image,
- sx, sy, sWidth, sHeight,
- x, y, width, height
- );
- } else {
- ctx.drawImage(image, x, y, width, height);
- }
- // 如果没设置宽和高的话自动根据图片宽高设置
- if (!style.width) {
- style.width = width;
- }
- if (!style.height) {
- style.height = height;
- }
- if (!this.style.width) {
- this.style.width = width;
- }
- if (!this.style.height) {
- this.style.height = height;
- }
- this.drawText(ctx, style, this.style);
- ctx.restore();
- }
- }
- /**
- * @function LevelRenderer.Shape.SmicImage.prototype.getRect
- * @description 计算返回图片的包围盒矩形。
- *
- * @param {Object} style - style
- * @return {Object} 边框对象。包含属性:x,y,width,height。
- */
- getRect(style) {
- if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
- this.refOriginalPosition = [0, 0];
- }
- var __OP = this.refOriginalPosition;
- return {
- x: style.x + __OP[0],
- y: style.y + __OP[1],
- width: style.width,
- height: style.height
- };
- }
- /**
- * @function LevelRenderer.Shape.SmicImage.prototype.clearCache
- * @description 清除图片缓存。
- *
- * @param {Object} style - style
- * @return {Object} 边框对象。包含属性:x,y,width,height。
- *
- */
- clearCache() {
- this._imageCache = {};
- }
- }
- SmicImage._needsRefresh = [];
- SmicImage._refreshTimeout = null;
- ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicRectangle.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @private
- * @class LevelRenderer.Shape.SmicRectangle
- * @category Visualization Theme
- * @classdesc 矩形。
- * @extends LevelRenderer.Shape
- * @example
- * var shape = new LevelRenderer.Shape.SmicRectangle({
- * style: {
- * x: 0,
- * y: 0,
- * width: 100,
- * height: 100,
- * radius: 20
- * }
- * });
- * levelRenderer.addShape(shape);
- * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
- */
- class SmicRectangle extends Shape_Shape {
- constructor(options) {
- super(options);
- /**
- * @member {string} LevelRenderer.Shape.SmicRectangle.prototype.type
- * @description 图形类型.
- */
- this.type = 'smicrectangle';
- if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
- this.refOriginalPosition = [0, 0];
- }
- this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicRectangle";
- }
- /**
- * @function LevelRenderer.Shape.SmicRectangle.prototype.destroy
- * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
- */
- destroy() {
- this.type = null;
- super.destroy();
- }
- /**
- * APIMethod: _buildRadiusPath
- * 创建矩形的圆角路径。
- *
- * Parameters:
- * ctx - {CanvasRenderingContext2D} Context2D 上下文。
- * style - {Object} style。
- *
- */
- _buildRadiusPath(ctx, style) {
- if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
- this.refOriginalPosition = [0, 0];
- }
- var __OP = this.refOriginalPosition;
- // 左上、右上、右下、左下角的半径依次为r1、r2、r3、r4
- // r缩写为1 相当于 [1, 1, 1, 1]
- // r缩写为[1] 相当于 [1, 1, 1, 1]
- // r缩写为[1, 2] 相当于 [1, 2, 1, 2]
- // r缩写为[1, 2, 3] 相当于 [1, 2, 3, 2]
- var x = style.x + __OP[0];
- var y = style.y + __OP[1];
- var width = style.width;
- var height = style.height;
- var r = style.radius;
- var r1;
- var r2;
- var r3;
- var r4;
- if (typeof r === 'number') {
- r1 = r2 = r3 = r4 = r;
- } else if (r instanceof Array) {
- if (r.length === 1) {
- r1 = r2 = r3 = r4 = r[0];
- } else if (r.length === 2) {
- r1 = r3 = r[0];
- r2 = r4 = r[1];
- } else if (r.length === 3) {
- r1 = r[0];
- r2 = r4 = r[1];
- r3 = r[2];
- } else {
- r1 = r[0];
- r2 = r[1];
- r3 = r[2];
- r4 = r[3];
- }
- } else {
- r1 = r2 = r3 = r4 = 0;
- }
- var total;
- if (r1 + r2 > width) {
- total = r1 + r2;
- r1 *= width / total;
- r2 *= width / total;
- }
- if (r3 + r4 > width) {
- total = r3 + r4;
- r3 *= width / total;
- r4 *= width / total;
- }
- if (r2 + r3 > height) {
- total = r2 + r3;
- r2 *= height / total;
- r3 *= height / total;
- }
- if (r1 + r4 > height) {
- total = r1 + r4;
- r1 *= height / total;
- r4 *= height / total;
- }
- ctx.moveTo(x + r1, y);
- ctx.lineTo(x + width - r2, y);
- r2 !== 0 && ctx.quadraticCurveTo(
- x + width, y, x + width, y + r2
- );
- ctx.lineTo(x + width, y + height - r3);
- r3 !== 0 && ctx.quadraticCurveTo(
- x + width, y + height, x + width - r3, y + height
- );
- ctx.lineTo(x + r4, y + height);
- r4 !== 0 && ctx.quadraticCurveTo(
- x, y + height, x, y + height - r4
- );
- ctx.lineTo(x, y + r1);
- r1 !== 0 && ctx.quadraticCurveTo(x, y, x + r1, y);
- }
- /**
- * @function LevelRenderer.Shape.SmicRectangle.prototype.buildPath
- * @description 创建矩形路径。
- *
- * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
- * @param {Object} style - style。
- *
- */
- buildPath(ctx, style) {
- if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
- this.refOriginalPosition = [0, 0];
- }
- var __OP = this.refOriginalPosition;
- if (!style.radius) {
- ctx.moveTo(style.x + __OP[0], style.y + __OP[1]);
- ctx.lineTo((style.x + __OP[0]) + style.width, (style.y + __OP[1]));
- ctx.lineTo((style.x + __OP[0]) + style.width, (style.y + __OP[1]) + style.height);
- ctx.lineTo((style.x + __OP[0]), (style.y + __OP[1]) + style.height);
- ctx.lineTo(style.x + __OP[0], style.y + __OP[1]);
- // ctx.rect(style.x, style.y, style.width, style.height);
- } else {
- this._buildRadiusPath(ctx, style);
- }
- ctx.closePath();
- return;
- }
- /**
- * @function LevelRenderer.Shape.SmicRectangle.prototype.getRect
- * @description 计算返回矩形包围盒矩阵。该包围盒是直接从四个控制点计算,并非最小包围盒。
- *
- * @param {Object} style - style
- * @return {Object} 边框对象。包含属性:x,y,width,height。
- */
- getRect(style) {
- if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
- this.refOriginalPosition = [0, 0];
- }
- var __OP = this.refOriginalPosition;
- if (style.__rect) {
- return style.__rect;
- }
- var lineWidth;
- if (style.brushType == 'stroke' || style.brushType == 'fill') {
- lineWidth = style.lineWidth || 1;
- } else {
- lineWidth = 0;
- }
- style.__rect = {
- x: Math.round((style.x + __OP[0]) - lineWidth / 2),
- y: Math.round((style.y + __OP[1]) - lineWidth / 2),
- width: style.width + lineWidth,
- height: style.height + lineWidth
- };
- return style.__rect;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicSector.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @private
- * @class LevelRenderer.Shape.SmicSector
- * @category Visualization Theme
- * @classdesc 扇形。
- * @extends LevelRenderer.Shape
- * @example
- * var shape = new LevelRenderer.Shape.SmicSector({
- * style: {
- * x: 100,
- * y: 100,
- * r: 60,
- * r0: 30,
- * startAngle: 0,
- * endEngle: 180
- * }
- * });
- * levelRenderer.addShape(shape);
- * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
- *
- */
- class SmicSector extends Shape_Shape {
- constructor(options) {
- super(options);
- /**
- * @member {string} LevelRenderer.Shape.SmicSector.protptype.type
- * @description 图形类型。
- */
- this.type = 'smicsector';
- if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
- this.refOriginalPosition = [0, 0];
- }
- this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicSector";
- }
- /**
- * @function LevelRenderer.Shape.SmicSector.prototype.destroy
- * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
- */
- destroy() {
- this.type = null;
- super.destroy();
- }
- /**
- * @function LevelRenderer.Shape.SmicSector.prototype.buildPath
- * @description 创建扇形路径。
- *
- * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
- * @param {Object} style - style。
- *
- */
- buildPath(ctx, style) {
- if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
- this.refOriginalPosition = [0, 0];
- }
- var __OP = this.refOriginalPosition;
- var x = style.x + __OP[0]; // 圆心x
- var y = style.y + __OP[1]; // 圆心y
- var r0 = style.r0 || 0; // 形内半径[0,r)
- var r = style.r; // 扇形外半径(0,r]
- var startAngle = style.startAngle; // 起始角度[0,360)
- var endAngle = style.endAngle; // 结束角度(0,360]
- var clockWise = style.clockWise || false;
- startAngle = SUtil_SUtil.Util_math.degreeToRadian(startAngle);
- endAngle = SUtil_SUtil.Util_math.degreeToRadian(endAngle);
- if (!clockWise) {
- // 扇形默认是逆时针方向,Y轴向上
- // 这个跟arc的标准不一样,为了兼容echarts
- startAngle = -startAngle;
- endAngle = -endAngle;
- }
- var unitX = SUtil_SUtil.Util_math.cos(startAngle);
- var unitY = SUtil_SUtil.Util_math.sin(startAngle);
- ctx.moveTo(
- unitX * r0 + x,
- unitY * r0 + y
- );
- ctx.lineTo(
- unitX * r + x,
- unitY * r + y
- );
- ctx.arc(x, y, r, startAngle, endAngle, !clockWise);
- ctx.lineTo(
- SUtil_SUtil.Util_math.cos(endAngle) * r0 + x,
- SUtil_SUtil.Util_math.sin(endAngle) * r0 + y
- );
- if (r0 !== 0) {
- ctx.arc(x, y, r0, endAngle, startAngle, clockWise);
- }
- ctx.closePath();
- return;
- }
- /**
- * @function LevelRenderer.Shape.SmicSector.prototype.getRect
- * @description 返回扇形包围盒矩形
- *
- * @param {Object} style - style
- * @return {Object} 边框对象。包含属性:x,y,width,height。
- *
- */
- getRect(style) {
- if (style.__rect) {
- return style.__rect;
- }
- if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
- this.refOriginalPosition = [0, 0];
- }
- var __OP = this.refOriginalPosition;
- var min0 = SUtil_SUtil.Util_vector.create();
- var min1 = SUtil_SUtil.Util_vector.create();
- var max0 = SUtil_SUtil.Util_vector.create();
- var max1 = SUtil_SUtil.Util_vector.create();
- var x = style.x + __OP[0]; // 圆心x
- var y = style.y + __OP[1]; // 圆心y
- var r0 = style.r0 || 0; // 形内半径[0,r)
- var r = style.r; // 扇形外半径(0,r]
- var startAngle = SUtil_SUtil.Util_math.degreeToRadian(style.startAngle);
- var endAngle = SUtil_SUtil.Util_math.degreeToRadian(style.endAngle);
- var clockWise = style.clockWise;
- if (!clockWise) {
- startAngle = -startAngle;
- endAngle = -endAngle;
- }
- if (r0 > 1) {
- SUtil_SUtil.Util_computeBoundingBox.arc(
- x, y, r0, startAngle, endAngle, !clockWise, min0, max0
- );
- } else {
- min0[0] = max0[0] = x;
- min0[1] = max0[1] = y;
- }
- SUtil_SUtil.Util_computeBoundingBox.arc(
- x, y, r, startAngle, endAngle, !clockWise, min1, max1
- );
- SUtil_SUtil.Util_vector.min(min0, min0, min1);
- SUtil_SUtil.Util_vector.max(max0, max0, max1);
- style.__rect = {
- x: min0[0],
- y: min0[1],
- width: max0[0] - min0[0],
- height: max0[1] - min0[1]
- };
- return style.__rect;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/feature/ShapeFactory.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FeatureShapeFactory
- * @aliasclass Feature.ShapeFactory
- * @deprecatedclass SuperMap.Feature.ShapeFactory
- * @category Visualization Theme
- * @classdesc 图形工厂类。
- * 目前支持创建的图形有:<br>
- * 用于统计专题图:<br>
- * 点 - 参数对象 <{@link ShapeParametersPoint}> <br>
- * 线 - 参数对象 <{@link ShapeParametersLine}> <br>
- * 面 - 参数对象 <{@link ShapeParametersPolygon}> <br>
- * 矩形 - 参数对象 <{@link ShapeParametersPolygon}> <br>
- * 扇形 - 参数对象 <{@link ShapeParametersSector}> <br>
- * 标签 - 参数对象 <{@link ShapeParametersLabel}> <br>
- * 图片 - 参数对象 <{@link ShapeParametersImage}> <br>
- * 用于符号专题图:<br>
- * 圆形 - 参数对象:<{@link ShapeParametersCircle}>
- * @param {Object} [shapeParameters] - 图形参数对象,<{@link ShapeParameters}> 子类对象。
- * @usage
- */
- class ShapeFactory {
- constructor(shapeParameters) {
- /**
- * @member {Object} FeatureShapeFactory.prototype.shapeParameters
- * @description 图形参数对象,<{@link ShapeParameters}> 子类对象。必设参数,默认值 null。
- */
- this.shapeParameters = shapeParameters;
- this.CLASS_NAME = "SuperMap.Feature.ShapeFactory";
- }
- /**
- * @function FeatureShapeFactory.prototype.destroy
- * @description 销毁图形工厂类对象。
- */
- destroy() {
- this.shapeParameters = null;
- }
- /**
- * @function FeatureShapeFactory.prototype.createShape
- * @description 创建一个图形。具体图形由 shapeParameters 决定。
- * @param {Object} shapeParameters - 图形参数对象,<{@link ShapeParameters}> 子类对象。
- * 此参数可选,如果使用此参数(不为 null),shapeParameters 属性值将被修改为参数的值,然后再使用 shapeParameters 属性值创建图形;
- * 如果不使用此参数,createShape 方法将直接使用 shapeParameters 属性创建图形。
- * @returns {Object} 图形对象(或 null - 图形创建失败)。
- */
- createShape(shapeParameters) {
- if (shapeParameters) {
- this.shapeParameters = shapeParameters;
- }
- if (!this.shapeParameters) {
- return null;
- }
- var sps = this.shapeParameters;
- if (sps instanceof Point_Point) { // 点
- //设置style
- let style = new Object();
- style["x"] = sps.x;
- style["y"] = sps.y;
- style["r"] = sps.r;
- style = Util.copyAttributesWithClip(style, sps.style, ['x', 'y']);
- //创建图形
- let shape = new SmicPoint();
- shape.style = ShapeFactory.transformStyle(style);
- shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
- Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'style', 'highlightStyle']);
- return shape;
- } else if (sps instanceof Line_Line) { // 线
- //检查参数 pointList 是否存在
- if (!sps.pointList) {
- return null;
- }
- // 设置style
- let style = new Object();
- style["pointList"] = sps.pointList;
- style = Util.copyAttributesWithClip(style, sps.style, ['pointList']);
- // 创建图形
- let shape = new SmicBrokenLine();
- shape.style = ShapeFactory.transformStyle(style);
- shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
- Util.copyAttributesWithClip(shape, sps, ['pointList', 'style', 'highlightStyle']);
- return shape;
- } else if (sps instanceof Polygon_Polygon) { // 面
- //检查参数 pointList 是否存在
- if (!sps.pointList) {
- return null;
- }
- //设置style
- let style = new Object();
- style["pointList"] = sps.pointList;
- style = Util.copyAttributesWithClip(style, sps.style, ['pointList']);
- //创建图形
- let shape = new SmicPolygon();
- shape.style = ShapeFactory.transformStyle(style);
- shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
- Util.copyAttributesWithClip(shape, sps, ['pointList', 'style', "highlightStyle"]);
- return shape;
- } else if (sps instanceof Rectangle_Rectangle) { // 矩形
- //检查参数 pointList 是否存在
- if (!sps.x && !sps.y & !sps.width & !sps.height) {
- return null;
- }
- //设置style
- let style = new Object();
- style["x"] = sps.x;
- style["y"] = sps.y;
- style["width"] = sps.width;
- style["height"] = sps.height;
- style = Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'width', 'height']);
- //创建图形
- let shape = new SmicRectangle();
- shape.style = ShapeFactory.transformStyle(style);
- shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
- Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'width', 'height', 'style', 'highlightStyle']);
- return shape;
- } else if (sps instanceof Sector) { // 扇形
- //设置style
- let style = new Object();
- style["x"] = sps.x;
- style["y"] = sps.y;
- style["r"] = sps.r;
- style["startAngle"] = sps.startAngle;
- style["endAngle"] = sps.endAngle;
- if (sps["r0"]) {
- style["r0"] = sps.r0
- }
- if (sps["clockWise"]) {
- style["clockWise"] = sps.clockWise
- }
- style = Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'r', 'startAngle', 'endAngle', 'r0', 'endAngle']);
- //创建图形
- let shape = new SmicSector();
- shape.style = ShapeFactory.transformStyle(style);
- shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
- Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'r', 'startAngle', 'endAngle', 'r0', 'endAngle', 'style', 'highlightStyle']);
- return shape;
- } else if (sps instanceof Label) { // 标签
- //设置style
- let style = new Object();
- style["x"] = sps.x;
- style["y"] = sps.y;
- style["text"] = sps.text;
- style = Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'text']);
- //创建图形
- let shape = new SmicText();
- shape.style = ShapeFactory.transformStyle(style);
- shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
- Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'text', 'style', 'highlightStyle']);
- return shape;
- } else if (sps instanceof Image_Image) { // 图片
- //设置style
- let style = new Object();
- style["x"] = sps.x;
- style["y"] = sps.y;
- if (sps["image"]) {
- style["image"] = sps.image;
- }
- if (sps["width"]) {
- style["width"] = sps.width;
- }
- if (sps["height"]) {
- style["height"] = sps.height;
- }
- if (sps["sx"]) {
- style["sx"] = sps.sx;
- }
- if (sps["sy"]) {
- style["sy"] = sps.sy;
- }
- if (sps["sWidth"]) {
- style["sWidth"] = sps.sWidth
- }
- if (sps["sHeight"]) {
- style["sHeight"] = sps.sHeight
- }
- style = Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'image', 'width', 'height', 'sx', 'sy', 'sWidth', 'sHeight']);
- //创建图形
- let shape = new SmicImage();
- shape.style = ShapeFactory.transformStyle(style);
- shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
- Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'image', 'width', 'height', 'style', 'highlightStyle']);
- return shape;
- } else if (sps instanceof Circle_Circle) { //圆形 用于符号专题图
- //设置stytle
- let style = new Object();
- style["x"] = sps.x;
- style["r"] = sps.r;
- style["y"] = sps.y;
- style = Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'r']);
- //创建图形
- let shape = new SmicCircle();
- shape.style = ShapeFactory.transformStyle(style);
- shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
- Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'r', 'style', 'highlightStyle', 'lineWidth', 'text', 'textPosition']);
- return shape;
- }
- return null
- }
- /**
- * @function FeatureShapeFactory.prototype.transformStyle
- * @description 将用户 feature.style (类 Svg style 标准) 的样式,转换为 levelRenderer 的样式标准(类 CSS-Canvas 样式)
- * @param {Object} style - 用户 style。
- * @returns {Object} 符合 levelRenderer 的 style。
- */
- static transformStyle(style) {
- var newStyle = {};
- //字体 ["font-style", "font-variant", "font-weight", "font-size / line-height", "font-family"];
- var fontStr = ["normal", "normal", "normal", "12", "arial,sans-serif"];
- //画笔类型 ["fill", "stroke"];
- var brushType = [true, false];
- for (var ss in style) {
- switch (ss) {
- case "fill":
- brushType[0] = style[ss];
- break;
- case "fillColor":
- newStyle["color"] = style[ss];
- break;
- case "stroke":
- brushType[1] = style[ss];
- break;
- case "strokeWidth":
- newStyle["lineWidth"] = style[ss];
- break;
- case "strokeLinecap":
- newStyle["lineCap"] = style[ss];
- break;
- case "strokeLineJoin":
- newStyle["lineJoin"] = style[ss];
- break;
- case "strokeDashstyle":
- newStyle["lineType"] = style[ss];
- break;
- case "pointRadius":
- newStyle["r"] = style[ss];
- break;
- case "label":
- newStyle["text"] = style[ss];
- break;
- case "labelRect":
- newStyle["labelRect"] = style[ss];
- break;
- case "fontColor":
- newStyle["textColor"] = style[ss];
- break;
- case "fontStyle":
- fontStr[0] = style[ss];
- break;
- case "fontVariant":
- fontStr[1] = style[ss];
- break;
- case "fontWeight":
- fontStr[2] = style[ss];
- break;
- case "fontSize":
- var unit = "";
- if (style[ss] && style[ss].toString().indexOf("px") < 0) {
- unit = "px";
- }
- fontStr[3] = style[ss] + unit;
- break;
- case "fontFamily":
- fontStr[4] = style[ss];
- break;
- case "fontOpacity":
- newStyle["opacity"] = style[ss];
- break;
- case "labelPosition":
- newStyle["textPosition"] = style[ss];
- break;
- case "labelAlign":
- newStyle["textAlign"] = style[ss];
- break;
- case "labelBaseline":
- newStyle["textBaseline"] = style[ss];
- break;
- case "labelRotation":
- newStyle["textRotation"] = style[ss];
- break;
- default:
- newStyle[ss] = style[ss];
- break;
- }
- }
- //拼接字体字符串
- newStyle["textFont"] = fontStr.join(" ");
- //画笔类型
- if (brushType[0] === true && brushType[1] === false) {
- newStyle["brushType"] = "fill";
- } else if (brushType[0] === false && brushType[1] === true) {
- newStyle["brushType"] = "stroke";
- } else if (brushType[0] === true && brushType[1] === true) {
- newStyle["brushType"] = "both";
- } else {
- newStyle["brushType"] = "fill";
- }
- //默认线宽 1
- if (newStyle["lineWidth"] == null) {
- newStyle["lineWidth"] = 1;
- }
- return newStyle;
- }
- /**
- * @function FeatureShapeFactory.prototype.Background
- * @description 创建一个矩形背景框图形对象。
- * @param {FeatureShapeFactory} shapeFactory - 图形工厂对象。
- * @param {Array.<number>} box - 框区域,长度为 4 的一维数组,像素坐标,[left, bottom, right, top]。
- * @param {Object} setting - 图表配置参数。本函数中图形配置对象 setting 可设属性:
- * @param {Object} setting.backgroundStyle - 背景样式,此样式对象对象可设属性:<ShapeParametersRectangle#style>。
- * @param {Array.<number>} [setting.backgroundRadius=[0,0,0,0]] - 背景框矩形圆角半径,可以用数组分别指定四个角的圆角半径,设:左上、右上、右下、左下角的半径依次为 r1、r2、r3、r4,则 backgroundRadius 为 [r1、r2、r3、r4 ]。
- * @returns {Object} 背景框图形,一个可视化图形(矩形)对象。
- */
- static Background(shapeFactory, box, setting) {
- var sets = setting ? setting : {};
- // 背景框图形参数对象
- var bgSP = new Rectangle_Rectangle(box[0], box[3], Math.abs(box[2] - box[0]), Math.abs(box[3] - box[1]));
- // 默认样式
- bgSP.style = {
- fillColor: "#f3f3f3"
- };
- // 设置用户 style
- if (sets.backgroundStyle) {
- Util.copyAttributesWithClip(bgSP.style, sets.backgroundStyle);
- }
- // 设置背景框圆角参数
- if (sets.backgroundRadius) {
- bgSP.style["radius"] = sets.backgroundRadius;
- }
- // 禁止背景框响应事件
- bgSP.clickable = false;
- bgSP.hoverable = false;
- return shapeFactory.createShape(bgSP);
- }
- /**
- * @function FeatureShapeFactory.prototype.GraphAxis
- * @description 创建一个统计图表坐标轴图形对象组。
- * @param {FeatureShapeFactory} shapeFactory - 图形工厂对象。
- * @param {Array.<number>} dataViewBox - 统计图表模型的数据视图框,长度为 4 的一维数组,像素坐标,[left, bottom, right, top]。
- * @param {Object} setting - 图表配置参数。
- * @param {Object} setting.axisStyle - 坐标轴样式,此样式对象对象可设属性:<ShapeParametersLine#style>。
- * @param {boolean} [setting.axisUseArrow=false] - 坐标轴是否使用箭头。
- * @param {number} [setting.axisYTick=0] - y 轴刻度数量,0表示不使用箭头。
- * @param {Array.<string>} setting.axisYLabels - y 轴上的标签组内容,标签顺序沿着数据视图框左面条边自上而下,等距排布。例如:["1000", "750", "500", "250", "0"]。
- * @param {Object} setting.axisYLabelsStyle - y 轴上的标签组样式,此样式对象对象可设属性:<ShapeParametersLabel#style>。
- * @param {Array.<number>} [setting.axisYLabelsOffset=[0,0]] - y 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 y 轴标签组横向上的偏移量,向左为正,默认值:0;数组第二项表示 y 轴标签组纵向上的偏移量,向下为正,默认值:0。
- * @param {Array.<string>} setting.axisXLabels - x 轴上的标签组内容,标签顺序沿着数据视图框下面条边自左向右排布,例如:["92年", "95年", "99年"]。
- * 标签排布规则:当标签数量与 xShapeInfo 中的属性 xPositions 数量相同(即标签个数与数据个数相等时), 按照 xPositions 提供的位置在水平方向上排布标签,否则沿数据视图框下面条边等距排布标签。
- * @param {Object} setting.axisXLabelsStyle - x 轴上的标签组样式,此样式对象对象可设属性:<ShapeParametersLabel#style>。
- * @param {Array.<number>} [setting.axisXLabelsOffset=[0,0]] - x 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 x 轴标签组横向上的偏移量,向左为正,默认值:0;数组第二项表示 x 轴标签组纵向上的偏移量,向下为正,默认值:0。
- * @param {boolean} setting.useXReferenceLine - 是否使用水平参考线,如果为 true,在 axisYTick 大于 0 时有效,水平参考线是 y 轴刻度在数据视图框里的延伸。
- * @param {Object} setting.xReferenceLineStyle - 水平参考线样式,此样式对象对象可设属性:<ShapeParametersLine#style>。
- * @param {number} [setting.axis3DParameter=0] - 3D 坐标轴参数,此属性值在大于等于 15 时有效。
- * @param {Object} xShapeInfo - X 方向上的图形信息对象,包含两个属性。
- * @param {Array.<number>} xShapeInfo.xPositions - 图形在 x 轴方向上的像素坐标值,是一个一维数组,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
- * @param {number} xShapeInfo.width - 图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
- * @returns {Array.<Object>} 统计图表坐标轴图形对象数组。
- */
- static GraphAxis(shapeFactory, dataViewBox, setting, xShapeInfo) {
- var dvb = dataViewBox;
- var sets = setting ? setting : {};
- // 参考线图形对象组
- var refLines = [];
- //坐标轴箭头对象组
- var arrows = [];
- // 是否使用参水平考线,默认不使用
- var isAddRefLine = sets.useXReferenceLine ? sets.useXReferenceLine : false;
- // y 轴上的刻度
- var axisytick = (sets.axisYTick && !isNaN(sets.axisYTick)) ? sets.axisYTick : 0;
- // 坐标轴节点数组
- var pois = [];
- //z 轴箭头数组
- var zArrowPois = [];
- // x,y 轴主干节点数组
- var xMainPois = [];
- if (axisytick == 0) {
- xMainPois.push([dvb[0], dvb[3] - 5]);
- xMainPois.push([dvb[0], dvb[1]]);
- // 3D 坐标轴 第三象限平分线
- if (sets.axis3DParameter && !isNaN(sets.axis3DParameter) && sets.axis3DParameter >= 15) {
- let axis3DParameter = parseInt(sets.axis3DParameter);
- let axis3DPoi = [dvb[0] - axis3DParameter, dvb[1] + axis3DParameter];
- // 添加 3D 轴节点
- if (sets.axisUseArrow) { // 添加 3D 轴箭头节点坐标
- //箭头坐标
- zArrowPois.push([axis3DPoi[0] + 1.5, axis3DPoi[1] - 7.5]);
- zArrowPois.push([axis3DPoi[0] - 1, axis3DPoi[1] + 1]);
- zArrowPois.push([axis3DPoi[0] + 7.5, axis3DPoi[1] - 1.5]);
- //3D轴
- xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
- } else {
- xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
- }
- xMainPois.push([dvb[0], dvb[1]]);
- }
- xMainPois.push([dvb[2] + 5, dvb[1]]);
- } else {
- // 单位刻度长度
- var unitTick = Math.abs(dvb[1] - dvb[3]) / axisytick;
- // 刻度 y 坐标
- var thckY = dvb[3];
- xMainPois.push([dvb[0], thckY - 5]);
- for (var i = 0; i < axisytick; i++) {
- xMainPois.push([dvb[0], thckY]);
- xMainPois.push([dvb[0] - 5, thckY]);
- xMainPois.push([dvb[0], thckY]);
- // 参考线
- if (isAddRefLine) {
- // 参考线参数对象
- var refLineSP = new Line_Line([
- [dvb[0], thckY],
- [dvb[2], thckY]
- ]);
- // 参考线默认样式对象
- refLineSP.style = {
- strokeColor: "#cfcfcf",
- strokeLinecap: "butt",
- strokeLineJoin: "round",
- strokeWidth: 1
- };
- // 禁止事件
- refLineSP.clickable = false;
- refLineSP.hoverable = false;
- // 用户style
- if (sets.xReferenceLineStyle) {
- Util.copyAttributesWithClip(refLineSP.style, sets.xReferenceLineStyle);
- }
- // 生成参考线图形对象
- refLines.push(shapeFactory.createShape(refLineSP))
- }
- // y 刻度增量
- thckY += unitTick;
- }
- xMainPois.push([dvb[0], dvb[1]]);
- // 3D 坐标轴 第三象限平分线
- if (sets.axis3DParameter && !isNaN(sets.axis3DParameter) && sets.axis3DParameter >= 15) {
- let axis3DParameter = parseInt(sets.axis3DParameter);
- let axis3DPoi = [dvb[0] - axis3DParameter, dvb[1] + axis3DParameter];
- /*
- // 箭头计算过程
- var axis3DPoiRef = [axis3DPoi[0] + 7, axis3DPoi[1] - 7]; // 7 是 10 为斜边 cos(45度)时邻边的值
- var axis3DPoiLT = [axis3DPoiRef[0] - 4, axis3DPoiRef[1] - 4];
- var axis3DPoiRB = [axis3DPoiRef[0] + 4, axis3DPoiRef[1] + 4];
- if(sets.axisUseArrow){
- xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
- xMainPois.push([axis3DPoiLT[0], axis3DPoiLT[1]]);
- xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
- xMainPois.push([axis3DPoiRB[0], axis3DPoiRB[1]]);
- xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
- }
- else{
- xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
- }
- */
- // 添加 3D 轴节点
- if (sets.axisUseArrow) { // 添加 3D 轴和箭头坐标
- //箭头坐标
- zArrowPois.push([axis3DPoi[0] + 1.5, axis3DPoi[1] - 7.5]);
- zArrowPois.push([axis3DPoi[0] - 1, axis3DPoi[1] + 1]);
- zArrowPois.push([axis3DPoi[0] + 7.5, axis3DPoi[1] - 1.5]);
- //3D轴
- xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
- } else {
- xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
- }
- xMainPois.push([dvb[0], dvb[1]]);
- }
- xMainPois.push([dvb[2] + 5, dvb[1]]);
- }
- // 坐标轴箭头
- if (sets.axisUseArrow) {
- // x 轴箭头节点数组
- var xArrowPois = [
- [dvb[2] + 5, dvb[1] + 4],
- [dvb[2] + 13, dvb[1]],
- [dvb[2] + 5, dvb[1] - 4]
- ];
- // y 轴箭头节点数组
- var yArrowPois = [
- [dvb[0] - 4, dvb[3] - 5],
- [dvb[0], dvb[3] - 13],
- [dvb[0] + 4, dvb[3] - 5]
- ];
- //x轴箭头
- var xSP = new Polygon_Polygon(xArrowPois);
- xSP.style = {fillColor: "#008acd"};
- Util.copyAttributesWithClip(xSP.style, sets.axisStyle);
- arrows.push(shapeFactory.createShape(xSP));
- //y轴箭头
- var ySP = new Polygon_Polygon(yArrowPois);
- ySP.style = {fillColor: "#008acd"};
- Util.copyAttributesWithClip(ySP.style, sets.axisStyle);
- arrows.push(shapeFactory.createShape(ySP));
- // z轴箭头 坐标轴箭头是否要使用
- if (sets.axis3DParameter && !isNaN(sets.axis3DParameter) && sets.axis3DParameter >= 15) {
- var zSP = new Polygon_Polygon(zArrowPois);
- zSP.style = {fillColor: "#008acd"};
- Util.copyAttributesWithClip(zSP.style, sets.axisStyle);
- arrows.push(shapeFactory.createShape(zSP));
- }
- }
- //不带箭头的坐标轴
- pois = xMainPois;
- // 坐标轴参数对象
- var axisSP = new Line_Line(pois);
- // 坐标轴默认style
- axisSP.style = {
- strokeLinecap: "butt",
- strokeLineJoin: "round",
- strokeColor: "#008acd",
- strokeWidth: 1
- };
- // 用户 style
- if (sets.axisStyle) {
- Util.copyAttributesWithClip(axisSP.style, sets.axisStyle);
- }
- // 禁止事件
- axisSP.clickable = false;
- axisSP.hoverable = false;
- // 创建坐标轴图形对象
- var axisMain = [shapeFactory.createShape(axisSP)];
- // Y 轴标签
- var yLabels = [];
- if (sets.axisYLabels && sets.axisYLabels.length && sets.axisYLabels.length > 0) {
- var axisYLabels = sets.axisYLabels;
- let len = axisYLabels.length;
- // 标签偏移量
- var ylOffset = [0, 0];
- if (sets.axisYLabelsOffset && sets.axisYLabelsOffset.length) {
- ylOffset = sets.axisYLabelsOffset;
- }
- if (len == 1) {
- // 标签参数对象
- let labelYSP = new Label(dvb[0] - 5 + ylOffset[0], dvb[3] + ylOffset[1], axisYLabels[0]);
- labelYSP.style = {
- labelAlign: "right"
- };
- // 用户 style
- if (sets.axisYLabelsStyle) {
- Util.copyAttributesWithClip(labelYSP.style, sets.axisYLabelsStyle);
- }
- // 禁止事件
- labelYSP.clickable = false;
- labelYSP.hoverable = false;
- // 制作标签
- yLabels.push(shapeFactory.createShape(labelYSP));
- } else {
- var labelY = dvb[3];
- // y 轴标签单位距离
- var yUnit = Math.abs(dvb[1] - dvb[3]) / (len - 1);
- for (var j = 0; j < len; j++) {
- // 标签参数对象
- let labelYSP = new Label(dvb[0] - 5 + ylOffset[0], labelY + ylOffset[1], axisYLabels[j]);
- labelYSP.style = {
- labelAlign: "right"
- };
- // 用户 style
- if (sets.axisYLabelsStyle) {
- Util.copyAttributesWithClip(labelYSP.style, sets.axisYLabelsStyle);
- }
- // 禁止事件
- labelYSP.clickable = false;
- labelYSP.hoverable = false;
- // 制作标签
- yLabels.push(shapeFactory.createShape(labelYSP));
- // y 轴标签 y 方向增量
- labelY += yUnit;
- }
- }
- }
- // X 轴标签
- var xLabels = [];
- if (sets.axisXLabels && sets.axisXLabels.length && sets.axisXLabels.length > 0) {
- let axisXLabels = sets.axisXLabels;
- let len = axisXLabels.length;
- // 标签偏移量
- let xlOffset = [0, 0];
- if (sets.axisXLabelsOffset && sets.axisXLabelsOffset.length) {
- xlOffset = sets.axisXLabelsOffset;
- }
- // 标签个数与数据字段个数相等等时,标签在 x 轴均匀排列
- if (xShapeInfo && xShapeInfo.xPositions && xShapeInfo.xPositions.length && xShapeInfo.xPositions.length == len) {
- let xsCenter = xShapeInfo.xPositions;
- for (let K = 0; K < len; K++) {
- // 标签参数对象
- let labelXSP = new Label(xsCenter[K] + xlOffset[0], dvb[1] + xlOffset[1], axisXLabels[K]);
- // 默认 style
- labelXSP.style = {
- labelAlign: "center",
- labelBaseline: "top"
- };
- // 用户 style
- if (sets.axisXLabelsStyle) {
- Util.copyAttributesWithClip(labelXSP.style, sets.axisXLabelsStyle);
- }
- // 禁止事件
- labelXSP.clickable = false;
- labelXSP.hoverable = false;
- // 创建标签对象
- xLabels.push(shapeFactory.createShape(labelXSP));
- }
- } else {
- if (len == 1) {
- // 标签参数对象
- let labelXSP = new Label(dvb[0] - 5 + xlOffset[0], dvb[1] + xlOffset[0], axisXLabels[0]);
- // 默认 style
- labelXSP.style = {
- labelAlign: "center",
- labelBaseline: "top"
- };
- // 用户 style
- if (sets.axisXLabelsStyle) {
- Util.copyAttributesWithClip(labelXSP.style, sets.axisXLabelsStyle);
- }
- // 禁止事件
- labelXSP.clickable = false;
- labelXSP.hoverable = false;
- // 创建标签对象
- xLabels.push(shapeFactory.createShape(labelXSP));
- } else {
- let labelX = dvb[0];
- // x 轴标签单位距离
- let xUnit = Math.abs(dvb[2] - dvb[0]) / (len - 1);
- for (let m = 0; m < len; m++) {
- // 标签参数对象
- let labelXSP = new Label(labelX + xlOffset[0], dvb[1] + xlOffset[1], axisXLabels[m]);
- // 默认 style
- labelXSP.style = {
- labelAlign: "center",
- labelBaseline: "top"
- };
- // 用户 style
- if (sets.axisXLabelsStyle) {
- Util.copyAttributesWithClip(labelXSP.style, sets.axisXLabelsStyle);
- }
- // 禁止事件
- labelXSP.clickable = false;
- labelXSP.hoverable = false;
- // 创建标签对象
- xLabels.push(shapeFactory.createShape(labelXSP));
- // x 轴标签 x 方向增量
- labelX += xUnit;
- }
- }
- }
- }
- // 组装并返回构成坐标轴的图形
- return ((refLines.concat(axisMain)).concat(yLabels)).concat(xLabels).concat(arrows);
- }
- /**
- * @function FeatureShapeFactory.prototype.ShapeStyleTool
- * @description 一个图形 style 处理工具。此工具将指定的默认 style,通用 style,按 styleGroup 取得的 style 和按数据值 value 范围取得的 style 进行合并,得到图形最终的 style。
- * @param {Object} defaultStyle - 默认style,此样式对象可设属性根据图形类型参考 <{@link ShapeParameters}> 子类对象的 style 属性。
- * @param {Object} style - 图形对象基础 style,此参数控制图形的基础样式,可设属性根据图形类型参考 <{@link ShapeParameters}> 子类对象的 style 属性。优先级低于 styleGroup,styleByCodomain。
- * @param {Array.<Object>} styleGroup - 一个 style 数组,优先级低于 styleByCodomain,高于 style。此数组每个元素是样式对象,
- * 其可设属性根据图形类型参考 <{@link ShapeParameters}> 子类对象的 style 属性。通过 index 参数从 styleGroup 中取 style。
- * @param {Array.<Object>} styleByCodomain - 按数据(参数 value)所在值域范围控制数据的可视化对象样式。
- * (start code)
- * // styleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
- * // start: 值域值下限(包含);
- * // end: 值域值上限(不包含);
- * // style: 数据可视化图形的 style,其可设属性根据图形类型参考 <ShapeParameters> 子类对象的 style 属性。。
- * // dataStyleByCodomain 数组形如:
- * [
- * {
- * start:0,
- * end:250,
- * style:{
- * fillColor:"#00CD00"
- * }
- * },
- * {
- * start:250,
- * end:500,
- * style:{
- * fillColor:"#00EE00"
- * }
- * },
- * {
- * start:500,
- * end:750,
- * style:{
- * fillColor:"#00FF7F"
- * }
- * },
- * {
- * start:750,
- * end:1500,
- * style:{
- * fillColor:"#00FF00"
- * }
- * }
- * ]
- * (end)
- * @param {number} index - styleGroup 的索引值,用于取出 styleGroup 指定的 style。
- * @param {number} value - 数据值,用于取出 styleByCodomain 指定的 style。
- * @returns {Object} 合并后的样式 (style) 对象。
- */
- static ShapeStyleTool(defaultStyle, style, styleGroup, styleByCodomain, index, value) {
- // 用 defaultStyle 初始化 style 对象
- var finalStyle = defaultStyle ? defaultStyle : {};
- // 基础 style
- if (style) {
- Util.copyAttributesWithClip(finalStyle, style);
- }
- // 按索引赋 style
- if (styleGroup && styleGroup.length && typeof(index) !== "undefined" && !isNaN(index) && index >= 0) {
- if (styleGroup[index]) {
- Util.copyAttributesWithClip(finalStyle, styleGroup[index]);
- }
- }
- // 按值域赋 style
- if (styleByCodomain && styleByCodomain.length && typeof(value) !== "undefined") {
- var dsc = styleByCodomain;
- var dscLen = dsc.length;
- var v = parseFloat(value);
- for (var i = 0; i < dscLen; i++) {
- if (dsc[i].start <= v && v < dsc[i].end) {
- Util.copyAttributesWithClip(finalStyle, dsc[i].style);
- break;
- }
- }
- }
- return finalStyle;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/feature/Theme.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FeatureTheme
- * @aliasclass Feature.Theme
- * @deprecatedclass SuperMap.Feature.Theme
- * @category Visualization Theme
- * @classdesc 专题要素基类。
- * @param {Object} data - 用户数据,用于生成可视化 shape。
- * @param {SuperMap.Layer.Theme} layer - 此专题要素所在图层。
- * @usage
- */
- class Theme_Theme {
- constructor(data, layer) {
- if (!data) {
- return;
- }
- // layer 必须已经添加到地图, 且已初始化渲染器
- if (!layer || !layer.map || !layer.renderer) {
- return;
- }
- /**
- * @member {string} FeatureTheme.prototype.id
- * @description 专题要素唯一标识。
- */
- this.id = Util.createUniqueID(this.CLASS_NAME + "_");
- /**
- * @member {LonLat} FeatureTheme.prototype.lonlat
- * @description 专题要素地理参考位置。子类中必须根据用户数据(或地理位置参数)对其赋值。
- */
- this.lonlat = null;
- /**
- * @member {Array.<number>} FeatureTheme.prototype.location
- * @description 专题要素像素参考位置。通常由地理参考位置决定。长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
- */
- this.location = [];
- /**
- * @readonly
- * @member {Object} FeatureTheme.prototype.data
- * @description 用户数据,用于生成可视化 shape,可在子类中规定数据格式或类型,如:<{@link FeatureVector}>。
- */
- this.data = data;
- /**
- * @readonly
- * @member {Array.<Object>} FeatureTheme.prototype.shapes
- * @description 构成此专题要素的可视化图形对象数组,数组顺序控制渲染。
- */
- this.shapes = [];
- /**
- * @readonly
- * @member {SuperMap.Layer.Theme} FeatureTheme.prototype.layer
- * @description 此专题要素所在专题图层。
- */
- this.layer = layer;
- this.CLASS_NAME = "SuperMap.Feature.Theme";
- }
- /**
- * @function FeatureTheme.prototype.destroy
- * @description 销毁专题要素。
- */
- destroy() {
- this.data = null;
- this.id = null;
- this.lonlat = null;
- this.location = null;
- this.shapes = null;
- this.layer = null;
- }
- /**
- * @function FeatureTheme.prototype.getLocalXY
- * @description 地理坐标转为像素坐标。
- * @param {GeometryPoint|GeometryGeoText|LonLat} coordinate - 地理坐标点。
- * @returns {Array.<number>} 长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
- */
- getLocalXY(coordinate) {
- var resolution = this.layer.map.getResolution();
- var extent = this.layer.map.getExtent();
- if (coordinate instanceof Point || coordinate instanceof GeoText) {
- let x = (coordinate.x / resolution + (-extent.left / resolution));
- let y = ((extent.top / resolution) - coordinate.y / resolution);
- return [x, y];
- } else if (coordinate instanceof LonLat) {
- let x = (coordinate.lon / resolution + (-extent.left / resolution));
- let y = ((extent.top / resolution) - coordinate.lat / resolution);
- return [x, y];
- } else {
- return null;
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/Graph.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FeatureThemeGraph
- * @aliasclass Feature.Theme.Graph
- * @deprecatedclass SuperMap.Feature.Theme.Graph
- * @category Visualization Theme
- * @classdesc 统计专题要素基类。
- * 此类定义了统计专题要素基础模型,具体的图表模型通过继承此类,在子类中实现 assembleShapes 方法。
- * 统计专题要素模型采用了可视化图形大小自适应策略,用较少的参数控制着图表诸多图形,图表配置对象 <FeatureThemeGraph.setting> 的基础属性只有 7 个,
- * 它们控制着图表结构、值域范围、数据小数位等基础图表形态。构成图表的图形必须在图表结构里自适应大小。
- * 此类不可实例化,此类的可实例化子类必须实现 assembleShapes() 方法。
- * @extends FeatureTheme
- * @param {FeatureVector} data - 用户数据。
- * @param {SuperMap.Layer.Theme} layer - 此专题要素所在图层。
- * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
- * @param {Object} setting - 图表配置对象。
- * @param {LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
- * @usage
- */
- class Graph extends Theme_Theme {
- constructor(data, layer, fields, setting, lonlat, options) {
- super(data, layer, fields, setting, lonlat, options);
- /**
- * @member {FeatureShapeFactory} FeatureThemeGraph.prototype.shapeFactory
- * @description 内置的图形工厂对象,调用其 createShape 方法创建图形。
- */
- this.shapeFactory = new ShapeFactory();
- /**
- * @member {Object} FeatureThemeGraph.prototype.shapeParameters
- * @description 当前图形参数对象,<{@link ShapeParameters}> 的子类对象。
- */
- this.shapeParameters = null;
- /**
- * @member {boolean} [FeatureThemeGraph.prototype.RelativeCoordinate]
- * @description 图形是否已经计算了相对坐标。
- */
- this.RelativeCoordinate = false;
- /**
- * @member {Object} FeatureThemeGraph.prototype.setting
- * @description 图表配置对象,该对象控制着图表的可视化显示。
- * @param {number} width - 专题要素(图表)宽度。
- * @param {number} height - 专题要素(图表)高度。
- * @param {Array.<number>} codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
- * @param {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
- * @param {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
- * @param {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox
- * (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
- * @param {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。
- * 如果不设置此参数,在取数据值时不对数据做小数位处理。
- *
- */
- this.setting = null;
- /**
- * @readonly
- * @member {Array.<number>} FeatureThemeGraph.prototype.origonPoint
- * @description 专题要素(图表)原点,图表左上角点像素坐标,是长度为 2 的一维数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
- */
- this.origonPoint = null;
- /**
- * @readonly
- * @member {Array.<number>} FeatureThemeGraph.prototype.chartBox
- * @description 专题要素(图表)区域,即图表框,长度为 4 的一维数组,数组的 4 个元素依次表示图表框左端 x 坐标值、
- * 下端 y坐标值、 右端 x坐标值、 上端 y 坐标值;[left, bottom, right, top]。
- */
- this.chartBox = null;
- /**
- * @readonly
- * @member {Bounds} FeatureThemeGraph.prototype.chartBounds
- * @description 图表 Bounds 随着 lonlat、XOffset、YOffset 更新,注意 chartBounds 是图表像素范围,不是地理范围。
- */
- this.chartBounds = null;
- /**
- * @readonly
- * @member {number} FeatureThemeGraph.prototype.width
- * @description 专题要素(图表)宽度 。
- */
- this.width = null;
- /**
- * @readonly
- * @member {number} FeatureThemeGraph.prototype.height
- * @description 专题要素(图表)高度 。
- */
- this.height = null;
- /**
- * @readonly
- * @member {number} FeatureThemeGraph.prototype.XOffset
- * @description 专题要素(图表)在 X 方向上的偏移值,单位像素。
- */
- this.XOffset = 0;
- /**
- * @readonly
- * @member {number} FeatureThemeGraph.prototype.YOffset
- * @description 专题要素(图表)在 Y 方向上的偏移值,单位像素。
- */
- this.YOffset = 0;
- /**
- * @readonly
- * @member {Array.<number>} FeatureThemeGraph.prototype.DVBParameter
- * @description 数据视图框参数,长度为 4 的一维数组(数组元素值 >= 0),[leftOffset, bottomOffset, rightOffset, topOffset],chartBox 内偏距值。
- * 此属性用于指定数据视图框 dataViewBox 的范围。
- */
- this.DVBParameter = null;
- /**
- * @readonly
- * @member {Array.<number>} FeatureThemeGraph.prototype.dataViewBox
- * @description 数据视图框,长度为 4 的一维数组,[left, bottom, right, top]。
- * dataViewBox 是统计专题要素最核心的内容,它负责解释数据在一个像素区域里的数据可视化含义,
- * 这种含义用可视化图形表达出来,这些表示数据的图形和一些辅助图形组合在一起构成统计专题图表。
- */
- this.dataViewBox = null;
- /**
- * @readonly
- * @member {Array.<number>} FeatureThemeGraph.prototype.DVBCodomain
- * @description 数据视图框的内允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
- * dataViewBox 中允许的数据范围,对数据溢出值域范围情况的处理需要在 assembleShapes 中进行。
- */
- this.DVBCodomain = null;
- /**
- * @readonly
- * @member {Array.<number>} FeatureThemeGraph.prototype.DVBCenterPoint
- * @description 数据视图框中心点,长度为 2 的一维数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
- */
- this.DVBCenterPoint = null;
- /**
- * @readonly
- * @member {string} FeatureThemeGraph.prototype.DVBUnitValue
- * @description 单位值。在 assembleShapes() 中初始化其具体意义,例如:饼图的 DVBUnitValue 可以定义为"360/数据总和",
- * 折线图的 DVBUnitValue 可以定义为 "DVBCodomain/DVBHeight"。
- */
- this.DVBUnitValue = null;
- /**
- * @readonly
- * @member {Array.<number>} FeatureThemeGraph.prototype.DVBOrigonPoint
- * @description 数据视图框原点,数据视图框左上角点,长度为 2 的一维数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
- */
- this.DVBOrigonPoint = null;
- /**
- * @readonly
- * @member {number} FeatureThemeGraph.prototype.DVBWidth
- * @description 数据视图框宽度。
- */
- this.DVBWidth = null;
- /**
- * @readonly
- * @member {number} FeatureThemeGraph.prototype.DVBHeight
- * @description 数据视图框高度。
- */
- this.DVBHeight = null;
- /**
- * @readonly
- * @member {Array.<number>} FeatureThemeGraph.prototype.origonPointOffset
- * @description 数据视图框原点相对于图表框的原点偏移量,长度为 2 的一维数组,第一个元素表示 x 偏移量,第二个元素表示 y 偏移量。
- */
- this.origonPointOffset = null;
- /**
- * @readonly
- * @member {Array.<string>} FeatureThemeGraph.prototype.fields
- * @description 数据{FeatureVector}属性字段。
- */
- this.fields = fields || [];
- /**
- * @readonly
- * @member {Array.<number>} FeatureThemeGraph.prototype.dataValues
- * @description 图表展示的数据值,通过 fields 从数据 feature 属性中获得。
- */
- this.dataValues = null;
- // 图表位置
- if (lonlat) {
- this.lonlat = lonlat;
- } else {
- // 默认使用 bounds 中心
- this.lonlat = this.data.geometry.getBounds().getCenterLonLat();
- }
- // 配置项检测与赋值
- if (setting && setting.width && setting.height && setting.codomain) {
- this.setting = setting;
- }
- this.CLASS_NAME = "SuperMap.Feature.Theme.Graph";
- }
- /**
- * @function FeatureThemeGraph.prototype.destroy
- * @description 销毁专题要素。
- */
- destroy() {
- this.shapeFactory = null;
- this.shapeParameters = null;
- this.width = null;
- this.height = null;
- this.origonPoint = null;
- this.chartBox = null;
- this.dataViewBox = null;
- this.chartBounds = null;
- this.DVBParameter = null;
- this.DVBOrigonPoint = null;
- this.DVBCenterPoint = null;
- this.DVBWidth = null;
- this.DVBHeight = null;
- this.DVBCodomain = null;
- this.DVBUnitValue = null;
- this.origonPointOffset = null;
- this.XOffset = null;
- this.YOffset = null;
- this.fields = null;
- this.dataValues = null;
- this.setting = null;
- super.destroy();
- }
- /**
- * @function FeatureThemeGraph.prototype.initBaseParameter
- * @description 初始化专题要素(图表)基础参数。在调用此方法前,此类的图表模型相关属性都是不可用的 ,此方法在 assembleShapes 函数中调用。
- * 调用此函数关系到 setting 对象的以下属性。
- * @param {number} width - 专题要素(图表)宽度。
- * @param {number} height - 专题要素(图表)高度。
- * @param {Array.<number>} codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
- * @param {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
- * @param {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
- * @param {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox。
- * (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
- * @param {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
- * @returns {boolean} 初始化参数是否成功。
- */
- initBaseParameter() {
- // 参数初始化是否成功
- var isSuccess = true;
- // setting 属性是否已成功赋值
- if (!this.setting) {
- return false;
- }
- var sets = this.setting;
- // 检测 setting 的必设参数
- if (!(sets.width && sets.height && sets.codomain)) {
- return false;
- }
- // 数据
- var decimalNumber = (typeof(sets.decimalNumber) !== "undefined" && !isNaN(sets.decimalNumber)) ? sets.decimalNumber : -1;
- var dataEffective = Theme_Theme.getDataValues(this.data, this.fields, decimalNumber);
- this.dataValues = dataEffective ? dataEffective : [];
- // 基础参数 width, height, codomain
- this.width = parseFloat(sets.width);
- this.height = parseFloat(sets.height);
- this.DVBCodomain = sets.codomain;
- // 图表偏移
- // if(sets.XOffset) {this.XOffset = sets.XOffset};
- // if(sets.YOffset) {this.YOffset = sets.YOffset};
- this.XOffset = sets.XOffset ? sets.XOffset : 0;
- this.YOffset = sets.YOffset ? sets.YOffset : 0;
- // 其他默认值
- this.origonPoint = [];
- this.chartBox = [];
- this.dataViewBox = [];
- this.DVBParameter = sets.dataViewBoxParameter ? sets.dataViewBoxParameter : [0, 0, 0, 0];
- this.DVBOrigonPoint = [];
- this.DVBCenterPoint = [];
- this.origonPointOffset = [];
- // 图表位置
- this.resetLocation();
- // 专题要素宽度 w
- var w = this.width;
- // 专题要素高度 h
- var h = this.height;
- // 专题要素像素位置 loc
- var loc = this.location;
- // 专题要素像素位置 loc
- this.origonPoint = [loc[0] - w / 2, loc[1] - h / 2];
- // 专题要素原点(左上角)
- var op = this.origonPoint;
- // 图表框([left, bottom, right, top])
- this.chartBox = [op[0], op[1] + h, op[0] + w, op[1]];
- // 图表框
- var cb = this.chartBox;
- // 数据视图框参数,它是图表框各方向对应的内偏距
- var dbbP = this.DVBParameter;
- // 数据视图框 ([left, bottom, right, top])
- this.dataViewBox = [cb[0] + dbbP[0], cb[1] - dbbP[1], cb[2] - dbbP[2], cb[3] + dbbP[3]];
- // 数据视图框
- var dvb = this.dataViewBox;
- //检查数据视图框是否合法
- if (dvb[0] >= dvb[2] || dvb[1] <= dvb[3]) {
- return false;
- }
- // 数据视图框原点
- this.DVBOrigonPoint = [dvb[0], dvb[3]];
- // 数据视图框宽度
- this.DVBWidth = Math.abs(dvb[2] - dvb[0]);
- // 数据视图框高度
- this.DVBHeight = Math.abs(dvb[1] - dvb[3]);
- // 数据视图框中心点
- this.DVBCenterPoint = [this.DVBOrigonPoint[0] + this.DVBWidth / 2, this.DVBOrigonPoint[1] + this.DVBHeight / 2]
- // 数据视图框原点与图表框的原点偏移量
- this.origonPointOffset = [this.DVBOrigonPoint[0] - op[0], this.DVBOrigonPoint[1] - op[1]];
- return isSuccess;
- }
- /**
- * @function FeatureThemeGraph.prototype.resetLocation
- * @description 根据地理位置 lonlat 重置专题要素(图表)位置。
- * @param {LonLat} lonlat - 专题要素新的像素中心位置。
- * @returns {Array.<number>} 新专题要素像素参考位置。长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
- */
- resetLocation(lonlat) {
- if (lonlat) {
- this.lonlat = lonlat;
- }
- // 获取地理位置对应的像素坐标 newLocalLX
- var newLocalLX = this.getLocalXY(this.lonlat);
- // 处理偏移量 XOffset, YOffset
- newLocalLX[0] += this.XOffset;
- newLocalLX[1] += this.YOffset;
- // 将图形位置赋予 location 属性(注意 location 属性表示的是专题要素中心位置)
- this.location = newLocalLX;
- // 更新图表像素 Bounds
- var w = this.width;
- var h = this.height;
- var loc = this.location;
- this.chartBounds = new Bounds(loc[0] - w / 2, loc[1] + h / 2, loc[0] + w / 2, loc[1] - h / 2);
- //重新计算当前渐变色
- this.resetLinearGradient();
- return loc;
- }
- /**
- * @function FeatureThemeGraph.prototype.resetLinearGradient
- * @description resetLocation 中调用 图表的相对坐标存在的时候,重新计算渐变的颜色(目前用于二维柱状图渐变色 所以子类实现此方法)。
- */
- resetLinearGradient() {
- //子类实现此方法
- }
- /**
- * @function FeatureThemeGraph.prototype.shapesConvertToRelativeCoordinate
- * @description 将(构成图表)图形的节点转为相对坐标表示,此函数必须且只能在 assembleShapes() 结束时调用。
- */
- shapesConvertToRelativeCoordinate() {
- var shapes = this.shapes;
- var shapeROP = this.location;
- for (var i = 0, len = shapes.length; i < len; i++) {
- shapes[i].refOriginalPosition = shapeROP;
- var style = shapes[i].style;
- for (var sty in style) {
- switch (sty) {
- case "pointList":
- var pl = style[sty];
- for (var j = 0, len2 = pl.length; j < len2; j++) {
- pl[j][0] -= shapeROP[0];
- pl[j][1] -= shapeROP[1];
- }
- break;
- case "x":
- style[sty] -= shapeROP[0];
- break;
- case "y":
- style[sty] -= shapeROP[1];
- break;
- default:
- break;
- }
- }
- }
- this.RelativeCoordinate = true;
- }
- /**
- * @function FeatureThemeGraph.prototype.assembleShapes
- * @description 图形装配函数。抽象方法,可视化子类必须实现此方法。<br>
- * 重写此方法的步骤:<br>
- * 1. 图表的某些特殊配置项(setting)处理,例如多数图表模型需要重新指定 dataViewBoxParameter 的默认值。<br>
- * 2. 调用 initBaseParameter() 方法初始化模型属性值,此步骤必须执行,只有当 initBaseParameter 返回 true 时才可以允许进行后续步骤。<br>
- * 3. 计算图形参数,制作图形,图形组合。在组装图表过程中,应该特别注意数据视图框单位值的定义、数据值溢出值域范围的处理和图形大小自适应。<br>
- * 4. 调用 shapesConvertToRelativeCoordinate() 方法,将图形的坐标值转为相对坐标,此步骤必须执行。
- * @example
- * //子类实现 assembleShapes() 接口的步骤示例:
- * assembleShapes: function(){
- * // 第一步:图表的某些特殊配置项(setting)处理,例如多数图表模型需要重新指定 dataViewBoxParameter 的默认值。此步骤是非必须过程。
- *
- * // 图表配置对象
- * var sets = this.setting;
- * // 默认数据视图框,这里展示在使用坐标轴和不使用坐标轴情况下对数据视图框参数赋予不同的默认值
- * if(!sets.dataViewBoxParameter){
- * if(typeof(sets.useAxis) === "undefined" || sets.useAxis){
- * sets.dataViewBoxParameter = [45, 15, 15, 15];
- * }
- * else{
- * sets.dataViewBoxParameter = [5, 5, 5, 5];
- * }
- * }
- *
- * // 第二步:初始化图表模型基本参数,只有在图表模型基本参数初始化成功时才可模型相关属性,如 this.dataViewBox、 this.DVBCodomain等。此步骤是必须过程。
- * if(!this.initBaseParameter()) return;
- *
- * // 第三步:用图形组装图表,在组装图表过程中,应该特别注意数据视图框单位值的定义、数据值溢出值域范围的处理和图形大小自适应。
- * // 定义图表数据视图框中单位值的含义,下面行代码表示将数据视图框单位值定义为数据视图框高度上每像素代表的数据值
- * this.DVBUnitValue = (this.codomain[1] - this.codomain[0])/this.DVBHeight;
- * var uv = this.DVBUnitValue;
- *
- * // 图形参数计算代码......
- *
- * // 关于图形装配,实际上就是利用图形工程对象 this.shapeFactory 的 createShape() 方法通过图形参数对象创建可视化的图形对象,并把这些图形对象按序添加到模型的图形库(his.shapes)中。下面的代码演示创建一个面图形参数对象,并允许通过图形配置对象设置图形的 style 和 highlightStyle,
- * var barParams = new ShapeParametersPolygon(poiLists);
- * barParams.style = sets.barStyle? sets.barStyle:{fillColor: "lightblue"};
- * barParams.highlightStyle = sets.barHoverStyle? sets.barHoverStyle:{fillColor: "blue"};
- * // 图形携带数据ID信息
- * barParams.refDataID = this.data.id;
- * // 创建图形并添加到图表图形数组中
- * this.shapes.push(this.shapeFactory.createShape(barParams));
- *
- * // 第四步:调用 shapesConvertToRelativeCoordinate() 方法,将图形库(his.shapes)中的图形转为由相对坐标表示的图形,客户端统计专题图模块从结构上要求可视化图形使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数。此步骤是必须过程。
- * this.shapesConvertToRelativeCoordinate();
- * },
- */
- assembleShapes() {
- //子类必须实现此方法
- }
- /**
- * @function FeatureThemeGraph.prototype.getLocalXY
- * @description 地理坐标转为像素坐标。
- * @param {LonLat} lonlat - 带转换的地理坐标。
- * @returns 屏幕像素坐标。
- */
- getLocalXY(lonlat) {
- return this.layer.getLocalXY(lonlat);
- }
- }
- /**
- * @function FeatureTheme.getDataValues
- * @description 根据字段名数组获取指定数据(feature)的属性值数组。属性值类型必须为 Number。
- * @param {FeatureVector} data - 数据。
- * @param {Array.<string>} [fields] - 字段名数组。
- * @param {number} [decimalNumber] - 小数位处理参数,对获取到的属性数据值进行小数位处理。
- * @returns {Array.<string>} 字段名数组对应的属性数据值数组。
- */
- Theme_Theme.getDataValues = function (data, fields, decimalNumber) {
- if (!data.attributes) {
- return false;
- }
- var fieldsValue = [];
- var attrs = data.attributes;
- for (var i = 0; i < fields.length; i++) {
- for (var field in attrs) {
- if (field !== fields[i]) {
- continue
- }
- // 数字转换判断
- try {
- if (!isNaN(decimalNumber) && decimalNumber >= 0) {
- fieldsValue.push(parseFloat(attrs[field].toString()).toFixed(decimalNumber));
- } else {
- fieldsValue.push(parseFloat(attrs[field].toString()));
- }
- } catch (e) {
- throw new Error("not a number")
- }
- }
- }
- if (fieldsValue.length === fields.length) {
- return fieldsValue;
- } else {
- return false;
- }
- };
- ;// CONCATENATED MODULE: ./src/common/overlay/Bar.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FeatureThemeBar
- * @aliasclass Feature.Theme.Bar
- * @deprecatedclass SuperMap.Feature.Theme.Bar
- * @classdesc 柱状图 。
- * @category Visualization Theme
- * @example
- * // barStyleByCodomain参数用法如下:
- * // barStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
- * // start: 值域值下限(包含);
- * // end: 值域值上限(不包含);
- * // style: 数据可视化图形的 style,这个样式对象的可设属性: <ShapeParametersPolygon.style> 。
- * // barStyleByCodomain 数组形如:
- * [
- * {
- * start:0,
- * end:250,
- * style:{
- * fillColor:"#00CD00"
- * }
- * },
- * {
- * start:250,
- * end:500,
- * style:{
- * fillColor:"#00EE00"
- * }
- * },
- * {
- * start:500,
- * end:750,
- * style:{
- * fillColor:"#00FF7F"
- * }
- * },
- * {
- * start:750,
- * end:1500,
- * style:{
- * fillColor:"#00FF00"
- * }
- * }
- * ]
- * @extends FeatureThemeGraph
- * @param {FeatureVector} data - 用户数据。
- * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
- * @param {Array.<string>} fields - data 属性中的参与此图表生成的属性字段名称。
- * @param {FeatureThemeBar.setting} setting - 图表配置对象。
- * @param {LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
- * @usage
- * @private
- */
- class Bar extends Graph {
- constructor(data, layer, fields, setting, lonlat) {
- super(data, layer, fields, setting, lonlat);
- this.CLASS_NAME = "SuperMap.Feature.Theme.Bar";
- }
- /**
- * @function FeatureThemeBar.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function FeatureThemeBar.prototype.assembleShapes
- * @description 图表图形装配函数。
- */
- assembleShapes() {
- //默认渐变颜色数组
- var deafaultColors = [["#00FF00", "#00CD00"], ["#00CCFF", "#5E87A2"], ["#00FF66", "#669985"], ["#CCFF00", "#94A25E"], ["#FF9900", "#A2945E"]];
- //默认阴影
- var deafaultShawdow = {
- showShadow: true,
- shadowBlur: 8,
- shadowColor: "rgba(100,100,100,0.8)",
- shadowOffsetX: 2,
- shadowOffsetY: 2
- };
- // 图表配置对象
- var sets = this.setting;
- if (!sets.barLinearGradient) {
- sets.barLinearGradient = deafaultColors;
- }
- // 默认数据视图框
- if (!sets.dataViewBoxParameter) {
- if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
- sets.dataViewBoxParameter = [45, 15, 15, 15];
- } else {
- sets.dataViewBoxParameter = [5, 5, 5, 5];
- }
- }
- // 重要步骤:初始化参数
- if (!this.initBaseParameter()) {
- return;
- }
- // 值域
- var codomain = this.DVBCodomain;
- // 重要步骤:定义图表 BaFeatureThemeBarr 数据视图框中单位值的含义
- this.DVBUnitValue = (codomain[1] - codomain[0]) / this.DVBHeight;
- // 数据视图域
- var dvb = this.dataViewBox;
- // 用户数据值
- var fv = this.dataValues;
- if (fv.length < 1) {
- return;
- } // 没有数据
- // 数据溢出值域范围处理
- for (let i = 0, fvLen = fv.length; i < fvLen; i++) {
- if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
- return;
- }
- }
- // 获取 x 轴上的图形信息
- var xShapeInfo = this.calculateXShapeInfo();
- if (!xShapeInfo) {
- return;
- }
- // 每个柱条 x 位置
- var xsLoc = xShapeInfo.xPositions;
- // 柱条宽度
- var xsWdith = xShapeInfo.width;
- // 背景框,默认启用
- if (typeof(sets.useBackground) === "undefined" || sets.useBackground) {
- // 将背景框图形添加到模型的 shapes 数组,注意添加顺序,后添加的图形在先添加的图形之上。
- this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
- }
- // 坐标轴, 默认启用
- if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
- // 添加坐标轴图形数组
- this.shapes = this.shapes.concat(ShapeFactory.GraphAxis(this.shapeFactory, dvb, sets, xShapeInfo));
- }
- for (var i = 0; i < fv.length; i++) {
- // 计算柱条 top 边的 y 轴坐标值
- var yPx = dvb[1] - (fv[i] - codomain[0]) / this.DVBUnitValue;
- // 柱条节点数组
- var poiLists = [
- [xsLoc[i] - xsWdith / 2, dvb[1] - 1],
- [xsLoc[i] + xsWdith / 2, dvb[1] - 1],
- [xsLoc[i] + xsWdith / 2, yPx],
- [xsLoc[i] - xsWdith / 2, yPx]
- ];
- // 柱条参数对象(一个面参数对象)
- var barParams = new Polygon_Polygon(poiLists);
- // 柱条 阴影 style
- if (typeof(sets.showShadow) === "undefined" || sets.showShadow) {
- if (sets.barShadowStyle) {
- var sss = sets.barShadowStyle;
- if (sss.shadowBlur) {
- deafaultShawdow.shadowBlur = sss.shadowBlur;
- }
- if (sss.shadowColor) {
- deafaultShawdow.shadowColor = sss.shadowColor;
- }
- if (sss.shadowOffsetX) {
- deafaultShawdow.shadowOffsetX = sss.shadowOffsetX;
- }
- if (sss.shadowOffsetY) {
- deafaultShawdow.shadowOffsetY = sss.shadowOffsetY;
- }
- }
- barParams.style = {};
- Util.copyAttributesWithClip(barParams.style, deafaultShawdow);
- }
- // 图形携带的数据信息
- barParams.refDataID = this.data.id;
- barParams.dataInfo = {
- field: this.fields[i],
- value: fv[i]
- };
- // 柱条 hover click
- if (typeof(sets.barHoverAble) !== "undefined") {
- barParams.hoverable = sets.barHoverAble;
- }
- if (typeof(sets.barClickAble) !== "undefined") {
- barParams.clickable = sets.barClickAble;
- }
- // 创建柱条并添加到图表图形数组中
- this.shapes.push(this.shapeFactory.createShape(barParams));
- }
- // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
- // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
- this.shapesConvertToRelativeCoordinate();
- }
- /**
- * @function FeatureThemeBar.prototype.calculateXShapeInfo
- * @description 计算 X 轴方向上的图形信息,此信息是一个对象,包含两个属性,
- * 属性 xPositions 是一个一维数组,该数组元素表示图形在 x 轴方向上的像素坐标值,
- * 如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
- * width 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
- * 本函数中图形配置对象 setting 可设属性:
- * xShapeBlank - {Array.<number>} 水平方向上的图形空白间隔参数。
- * 长度为 3 的数组,第一元素表示第一个图形左端与数据视图框左端的空白间距,第二个元素表示图形间空白间距,
- * 第三个元素表示最后一个图形右端与数据视图框右端端的空白间距 。
- * @returns {Object} 如果计算失败,返回 null;如果计算成功,返回 X 轴方向上的图形信息,此信息是一个对象,包含以下两个属性:
- * xPositions - {Array.<number>} 表示图形在 x 轴方向上的像素坐标值,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
- * width - {number} 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
- *
- */
- calculateXShapeInfo() {
- var dvb = this.dataViewBox; // 数据视图框
- var sets = this.setting; // 图表配置对象
- var fvc = this.dataValues.length; // 数组值个数
- if (fvc < 1) {
- return null;
- }
- var xBlank; // x 轴空白间隔参数
- var xShapePositions = []; // x 轴上图形的位置
- var xShapeWidth = 0; // x 轴上图形宽度(自适应)
- var dvbWidth = this.DVBWidth; // 数据视图框宽度
- // x 轴空白间隔参数处理
- if (sets.xShapeBlank && sets.xShapeBlank.length && sets.xShapeBlank.length == 3) {
- xBlank = sets.xShapeBlank;
- var xsLen = dvbWidth - (xBlank[0] + xBlank[2] + (fvc - 1) * xBlank[1]);
- if (xsLen <= fvc) {
- return null;
- }
- xShapeWidth = xsLen / fvc
- } else {
- // 默认使用等距离空白间隔,空白间隔为图形宽度
- xShapeWidth = dvbWidth / (2 * fvc + 1);
- xBlank = [xShapeWidth, xShapeWidth, xShapeWidth];
- }
- // 图形 x 轴上的位置计算
- var xOffset = 0
- for (var i = 0; i < fvc; i++) {
- if (i == 0) {
- xOffset = xBlank[0] + xShapeWidth / 2;
- } else {
- xOffset += (xShapeWidth + xBlank[1]);
- }
- xShapePositions.push(dvb[0] + xOffset);
- }
- return {
- "xPositions": xShapePositions,
- "width": xShapeWidth
- };
- }
- /**
- * @function FeatureThemeBar.prototype.resetLinearGradient
- * @description 图表的相对坐标存在的时候,重新计算渐变的颜色(目前用于二维柱状图 所以子类实现此方法)。
- */
- resetLinearGradient() {
- if (this.RelativeCoordinate) {
- var shpelength = this.shapes.length;
- var barLinearGradient = this.setting.barLinearGradient;
- var index = -1;
- for (var i = 0; i < shpelength; i++) {
- var shape = this.shapes[i];
- if (shape.CLASS_NAME === "SuperMap.LevelRenderer.Shape.SmicPolygon") {
- var style = shape.style;
- //计算出当前的绝对 x y
- var x1 = this.location[0] + style.pointList[0][0];
- var x2 = this.location[0] + style.pointList[1][0];
- //渐变颜色
- index++;
- //以防定义的颜色数组不够用
- if (index >= barLinearGradient.length) {
- index = index % barLinearGradient.length;
- }
- var color1 = barLinearGradient[index][0];
- var color2 = barLinearGradient[index][1];
- //颜色
- var zcolor = new Color();
- var linearGradient = zcolor.getLinearGradient(x1, 0, x2, 0,
- [[0, color1], [1, color2]]);
- //赋值
- shape.style.color = linearGradient;
- }
- }
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/Bar3D.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FeatureThemeBar3D
- * @aliasclass Feature.Theme.Bar3D
- * @deprecatedclass SuperMap.Feature.Theme.Bar3D
- * @classdesc 三维柱状图 。
- * @category Visualization Theme
- * @extends FeatureThemeGraph
- * @param {FeatureVector} data - 用户数据。
- * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
- * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
- * @param {FeatureThemeBar3D.setting} setting - 图表配置对象。
- * @param {LonLat} [lonlat] - 专题要素地理位置,默认为 data 指代的地理要素 Bounds 中心。
- *
- *
- * @example
- * // barFaceStyleByCodomain 用法示例如下:
- * // barFaceStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
- * // start: 值域值下限(包含);
- * // end: 值域值上限(不包含);
- * // style: 数据可视化图形的 style,这个样式对象的可设属性: <ShapeParametersPolygon.style> 。
- * // barFaceStyleByCodomain 数组形如:
- * [
- * {
- * start:0,
- * end:250,
- * style:{
- * fillColor:"#00CD00"
- * }
- * },
- * {
- * start:250,
- * end:500,
- * style:{
- * fillColor:"#00EE00"
- * }
- * },
- * {
- * start:500,
- * end:750,
- * style:{
- * fillColor:"#00FF7F"
- * }
- * },
- * {
- * start:750,
- * end:1500,
- * style:{
- * fillColor:"#00FF00"
- * }
- * }
- * ]
- *
- * @example
- * // barSideStyleByCodomain 用法示例如下:
- * // barSideStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
- * // start: 值域值下限(包含);
- * // end: 值域值上限(不包含);
- * // style: 数据可视化图形的 style,这个样式对象的可设属性: <ShapeParametersPolygon.style> 。
- * // barSideStyleByCodomain 数组形如:
- * [
- * {
- * start:0,
- * end:250,
- * style:{
- * fillColor:"#00CD00"
- * }
- * },
- * {
- * start:250,
- * end:500,
- * style:{
- * fillColor:"#00EE00"
- * }
- * },
- * {
- * start:500,
- * end:750,
- * style:{
- * fillColor:"#00FF7F"
- * }
- * },
- * {
- * start:750,
- * end:1500,
- * style:{
- * fillColor:"#00FF00"
- * }
- * }
- * ]
- *
- * @example
- * // barTopStyleByCodomain 用法示例如下:
- * // barTopStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
- * // start: 值域值下限(包含);
- * // end: 值域值上限(不包含);
- * // style: 数据可视化图形的 style,这个样式对象的可设属性:<ShapeParametersPolygon.style> 。
- * // barTopStyleByCodomain 数组形如:
- * [
- * {
- * start:0,
- * end:250,
- * style:{
- * fillColor:"#00CD00"
- * }
- * },
- * {
- * start:250,
- * end:500,
- * style:{
- * fillColor:"#00EE00"
- * }
- * },
- * {
- * start:500,
- * end:750,
- * style:{
- * fillColor:"#00FF7F"
- * }
- * },
- * {
- * start:750,
- * end:1500,
- * style:{
- * fillColor:"#00FF00"
- * }
- * }
- * ]
- * @usage
- * @private
- */
- class Bar3D extends Graph {
- constructor(data, layer, fields, setting, lonlat) {
- super(data, layer, fields, setting, lonlat);
- this.CLASS_NAME = "SuperMap.Feature.Theme.Bar3D";
- }
- /**
- * @function FeatureThemeBar3D.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function FeatureThemeBar3D.prototype.assembleShapes
- * @description 图形装配实现(扩展接口)。
- */
- assembleShapes() {
- // 图表配置对象
- var sets = this.setting;
- // 默认数据视图框
- if (!sets.dataViewBoxParameter) {
- if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
- sets.dataViewBoxParameter = [45, 25, 20, 20];
- } else {
- sets.dataViewBoxParameter = [5, 5, 5, 5];
- }
- }
- // 3d 柱图的坐标轴默认使用坐标轴箭头
- sets.axisUseArrow = (typeof(sets.axisUseArrow) !== "undefined") ? sets.axisUseArrow : true;
- sets.axisXLabelsOffset = (typeof(sets.axisXLabelsOffset) !== "undefined") ? sets.axisXLabelsOffset : [-10, 10];
- // 重要步骤:初始化参数
- if (!this.initBaseParameter()) {
- return;
- }
- // 值域
- var codomain = this.DVBCodomain;
- // 重要步骤:定义图表 FeatureThemeBar 数据视图框中单位值的含义
- this.DVBUnitValue = (codomain[1] - codomain[0]) / this.DVBHeight;
- // 数据视图域
- var dvb = this.dataViewBox;
- // 用户数据值
- var fv = this.dataValues;
- if (fv.length < 1) {
- return;
- } // 没有数据
- // 数据溢出值域范围处理
- for (let i = 0, fvLen = fv.length; i < fvLen; i++) {
- if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
- return;
- }
- }
- // 获取 x 轴上的图形信息
- var xShapeInfo = this.calculateXShapeInfo();
- if (!xShapeInfo) {
- return;
- }
- // 每个柱条 x 位置
- var xsLoc = xShapeInfo.xPositions;
- // 柱条宽度
- var xsWdith = xShapeInfo.width;
- // 坐标轴, 默认启用
- if (typeof(sets.useBackground) === "undefined" || sets.useBackground) {
- this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
- }
- // 坐标轴
- if (!sets.axis3DParameter || isNaN(sets.axis3DParameter) || sets.axis3DParameter < 15) {
- sets.axis3DParameter = 20;
- }
- if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
- this.shapes = this.shapes.concat(ShapeFactory.GraphAxis(this.shapeFactory, dvb, sets, xShapeInfo));
- }
- // 3d 偏移量, 默认值 10;
- var offset3d = (sets.bar3DParameter && !isNaN(sets.bar3DParameter)) ? sets.bar3DParameter : 10;
- for (let i = 0; i < fv.length; i++) {
- // 无 3d 偏移量时的柱面顶部 y 坐标
- var yPx = dvb[1] - (fv[i] - codomain[0]) / this.DVBUnitValue;
- // 无 3d 偏移量时的柱面的左、右端 x 坐标
- var iPoiL = xsLoc[i] - xsWdith / 2;
- var iPoiR = xsLoc[i] + xsWdith / 2;
- // 3d 柱顶面节点
- var bar3DTopPois = [
- [iPoiL, yPx],
- [iPoiR, yPx],
- [iPoiR - offset3d, yPx + offset3d],
- [iPoiL - offset3d, yPx + offset3d]
- ];
- // 3d 柱侧面节点
- var bar3DSidePois = [
- [iPoiR, yPx],
- [iPoiR - offset3d, yPx + offset3d],
- [iPoiR - offset3d, dvb[1] + offset3d],
- [iPoiR, dvb[1]]
- ];
- // 3d 柱正面节点
- var bar3DFacePois = [
- [iPoiL - offset3d, dvb[1] + offset3d],
- [iPoiR - offset3d, dvb[1] + offset3d],
- [iPoiR - offset3d, yPx + offset3d],
- [iPoiL - offset3d, yPx + offset3d]
- ];
- if (offset3d <= 0) { // offset3d <= 0 时正面不偏移
- bar3DFacePois = [
- [iPoiL, dvb[1]],
- [iPoiR, dvb[1]],
- [iPoiR, yPx],
- [iPoiL, yPx]
- ];
- }
- // 新建 3d 柱面顶面、侧面、正面图形参数对象
- var polyTopSP = new Polygon_Polygon(bar3DTopPois);
- var polySideSP = new Polygon_Polygon(bar3DSidePois);
- var polyFaceSP = new Polygon_Polygon(bar3DFacePois);
- // 侧面、正面图形 style 默认值
- sets.barSideStyle = sets.barSideStyle ? sets.barSideStyle : sets.barFaceStyle;
- sets.barSideStyleByFields = sets.barSideStyleByFields ? sets.barSideStyleByFields : sets.barFaceStyleByFields;
- sets.barSideStyleByCodomain = sets.barSideStyleByCodomain ? sets.barSideStyleByCodomain : sets.barFaceStyleByCodomain;
- sets.barTopStyle = sets.barTopStyle ? sets.barTopStyle : sets.barFaceStyle;
- sets.barTopStyleByFields = sets.barTopStyleByFields ? sets.barTopStyleByFields : sets.barFaceStyleByFields;
- sets.barTopStyleByCodomain = sets.barTopStyleByCodomain ? sets.barTopStyleByCodomain : sets.barFaceStyleByCodomain;
- // 顶面、侧面、正面图形 style
- polyFaceSP.style = ShapeFactory.ShapeStyleTool({
- stroke: true,
- strokeColor: "#ffffff",
- fillColor: "#ee9900"
- },
- sets.barFaceStyle, sets.barFaceStyleByFields, sets.barFaceStyleByCodomain, i, fv[i]);
- polySideSP.style = ShapeFactory.ShapeStyleTool({
- stroke: true,
- strokeColor: "#ffffff",
- fillColor: "#ee9900"
- },
- sets.barSideStyle, sets.barSideStyleByFields, sets.barSideStyleByCodomain, i, fv[i]);
- polyTopSP.style = ShapeFactory.ShapeStyleTool({
- stroke: true,
- strokeColor: "#ffffff",
- fillColor: "#ee9900"
- },
- sets.barTopStyle, sets.barTopStyleByFields, sets.barTopStyleByCodomain, i, fv[i]);
- // 3d 柱条高亮样式
- sets.barSideHoverStyle = sets.barSideHoverStyle ? sets.barSideHoverStyle : sets.barFaceHoverStyle;
- sets.barTopHoverStyle = sets.barTopHoverStyle ? sets.barTopHoverStyle : sets.barFaceHoverStyle;
- polyFaceSP.highlightStyle = ShapeFactory.ShapeStyleTool({stroke: true}, sets.barFaceHoverStyle);
- polySideSP.highlightStyle = ShapeFactory.ShapeStyleTool({stroke: true}, sets.barSideHoverStyle);
- polyTopSP.highlightStyle = ShapeFactory.ShapeStyleTool({stroke: true}, sets.barTopHoverStyle);
- // 图形携带的数据 id 信息 & 高亮模式
- polyTopSP.refDataID = polySideSP.refDataID = polyFaceSP.refDataID = this.data.id;
- // hover 模式(组合)
- polyTopSP.isHoverByRefDataID = polySideSP.isHoverByRefDataID = polyFaceSP.isHoverByRefDataID = true;
- // 高亮组(当鼠标 hover 到组内任何一个图形,整个组的图形都会高亮。refDataHoverGroup 在 isHoverByRefDataID 为 true 时有效)
- polyTopSP.refDataHoverGroup = polySideSP.refDataHoverGroup = polyFaceSP.refDataHoverGroup = Util.createUniqueID("lr_shg");
- // 图形携带的数据信息
- polyTopSP.dataInfo = polySideSP.dataInfo = polyFaceSP.dataInfo = {
- field: this.fields[i],
- value: fv[i]
- };
- // 3d 柱条顶面、侧面、正面图形 hover click 设置
- if (typeof(sets.barHoverAble) !== "undefined") {
- polyTopSP.hoverable = polySideSP.hoverable = polyFaceSP.hoverable = sets.barHoverAble;
- }
- if (typeof(sets.barClickAble) !== "undefined") {
- polyTopSP.clickable = polySideSP.clickable = polyFaceSP.clickable = sets.barClickAble;
- }
- // 创建3d 柱条的顶面、侧面、正面图形并添加到图表的图形列表数组
- this.shapes.push(this.shapeFactory.createShape(polySideSP));
- this.shapes.push(this.shapeFactory.createShape(polyTopSP));
- this.shapes.push(this.shapeFactory.createShape(polyFaceSP));
- }
- // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
- // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
- this.shapesConvertToRelativeCoordinate();
- }
- /**
- * @function FeatureThemeBar3D.prototype.calculateXShapeInfo
- * @description 计算 X 轴方向上的图形信息,此信息是一个对象,包含两个属性,
- * 属性 xPositions 是一个一维数组,该数组元素表示图形在 x 轴方向上的像素坐标值,
- * 如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
- * width 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
- * 本函数中图形配置对象 setting 可设属性:
- * xShapeBlank - {Array.<number>} 水平方向上的图形空白间隔参数。
- * 长度为 3 的数组,第一元素表示第一个图形左端与数据视图框左端的空白间距,第二个元素表示图形间空白间距,
- * 第三个元素表示最后一个图形右端与数据视图框右端端的空白间距 。
- * @returns {Object} 如果计算失败,返回 null;如果计算成功,返回 X 轴方向上的图形信息,此信息是一个对象,包含以下两个属性:
- * xPositions - {Array.<number>} 表示图形在 x 轴方向上的像素坐标值,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
- * width - {number} 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
- */
- calculateXShapeInfo() {
- var dvb = this.dataViewBox; // 数据视图框
- var sets = this.setting; // 图表配置对象
- var fvc = this.dataValues.length; // 数组值个数
- if (fvc < 1) {
- return null;
- }
- var xBlank; // x 轴空白间隔参数
- var xShapePositions = []; // x 轴上图形的位置
- var xShapeWidth = 0; // x 轴上图形宽度(自适应)
- var dvbWidth = this.DVBWidth; // 数据视图框宽度
- // x 轴空白间隔参数处理
- if (sets.xShapeBlank && sets.xShapeBlank.length && sets.xShapeBlank.length == 3) {
- xBlank = sets.xShapeBlank;
- var xsLen = dvbWidth - (xBlank[0] + xBlank[2] + (fvc - 1) * xBlank[1])
- if (xsLen <= fvc) {
- return null;
- }
- xShapeWidth = xsLen / fvc
- } else {
- // 默认使用等距离空白间隔,空白间隔为图形宽度
- xShapeWidth = dvbWidth / (2 * fvc + 1);
- xBlank = [xShapeWidth, xShapeWidth, xShapeWidth];
- }
- // 图形 x 轴上的位置计算
- var xOffset = 0
- for (var i = 0; i < fvc; i++) {
- if (i == 0) {
- xOffset = xBlank[0] + xShapeWidth / 2;
- } else {
- xOffset += (xShapeWidth + xBlank[1]);
- }
- xShapePositions.push(dvb[0] + xOffset);
- }
- return {
- "xPositions": xShapePositions,
- "width": xShapeWidth
- };
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/RankSymbol.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FeatureThemeRankSymbol
- * @aliasclass Feature.Theme.RankSymbol
- * @deprecatedclass SuperMap.Feature.Theme.RankSymbol
- * @category Visualization Theme
- * @classdesc 符号专题要素基类。此类定义了符号专题要素基础模型,具体的图表模型通过继承此类,在子类中实现 assembleShapes 方法。
- * 符号专题要素模型采用了可视化图形大小自适应策略,用较少的参数控制着图表诸多图形,图表配置对象 <FeatureThemeRankSymbol.setting> 的基础属性只有 5 个,
- * 它们控制着图表结构、值域范围、数据小数位等基础图表形态。构成图表的图形必须在图表结构里自适应大小。
- * 此类不可实例化,此类的可实例化子类必须实现 assembleShapes() 方法。
- * @param {FeatureVector} data - 用户数据。
- * @param {SuperMap.Layer.RankSymbol} layer - 此专题要素所在图层。
- * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
- * @param {LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
- * @param {Object} setting - 图表配置对象。除了以下 5 个基础属性,此对象的可设属性在不同子类中有较大差异,不同子类中对同一属性的解释也可能不同,请在此类的子类中查看 setting 对象的可设属性和属性含义。
- * @param {Array.<number>} setting.codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
- * @param {number} [setting.XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
- * @param {number} [setting.YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
- * @param {Array.<number>} [setting.dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
- * @param {number} [setting.decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
- * @extends FeatureThemeGraph
- * @usage
- */
- class RankSymbol extends Graph {
- constructor(data, layer, fields, setting, lonlat, options) {
- super(data, layer, fields, setting, lonlat, options);
- /**
- * @member {Object} FeatureThemeRankSymbol.prototype.setting
- * @description 符号配置对象,该对象控制着图表的可视化显示。
- */
- this.setting = null;
- // 配置项检测与赋值
- if (setting && setting.codomain) {
- this.setting = setting;
- this.DVBCodomain = this.setting.codomain;
- }
- this.CLASS_NAME = "SuperMap.Feature.Theme.RankSymbol";
- }
- /**
- * @function FeatureThemeRankSymbol.prototype.destroy
- * @description 销毁专题要素。
- */
- destroy() {
- this.setting = null;
- super.destroy();
- }
- /**
- * @function FeatureThemeRankSymbol.prototype.initBaseParameter
- * @description 初始化专题要素(图形)基础参数。
- * 在调用此方法前,此类的图表模型相关属性都是不可用的 ,此方法在 assembleShapes 函数中调用。
- * 调用此函数关系到 setting 对象的以下属性。
- * @param {Array.<number>} codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
- * @param {number} [XOffset] - 专题要素(图形)在 X 方向上的偏移值,单位像素。
- * @param {number} [YOffset] - 专题要素(图形)在 Y 方向上的偏移值,单位像素。
- * @param {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图形框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
- * @param {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
- * @returns {boolean} 初始化参数是否成功。
- */
- initBaseParameter() {
- // 参数初始化是否成功
- var isSuccess = true;
- // setting 属性是否已成功赋值
- if (!this.setting) {
- return false;
- }
- var sets = this.setting;
- // 图表偏移
- if (sets.XOffset) {
- this.XOffset = sets.XOffset;
- }
- if (sets.YOffset) {
- this.YOffset = sets.YOffset;
- }
- this.XOffset = sets.XOffset ? sets.XOffset : 0;
- this.YOffset = sets.YOffset ? sets.YOffset : 0;
- // 其他默认值
- this.origonPoint = [];
- this.chartBox = [];
- this.dataViewBox = [];
- this.DVBParameter = sets.dataViewBoxParameter ? sets.dataViewBoxParameter : [0, 0, 0, 0];
- this.DVBOrigonPoint = [];
- this.DVBCenterPoint = [];
- this.origonPointOffset = [];
- // 图表位置
- this.resetLocation();
- // 专题要素宽度 w
- var w = this.width;
- // 专题要素高度 h
- var h = this.height;
- // 专题要素像素位置 loc
- var loc = this.location;
- // 专题要素像素位置 loc
- this.origonPoint = [loc[0] - w / 2, loc[1] - h / 2];
- // 专题要素原点(左上角)
- var op = this.origonPoint;
- // 图表框([left, bottom, right, top])
- this.chartBox = [op[0], op[1] + h, op[0] + w, op[1]];
- // 图表框
- var cb = this.chartBox;
- // 数据视图框参数,它是图表框各方向对应的内偏距
- var dbbP = this.DVBParameter;
- // 数据视图框 ([left, bottom, right, top])
- this.dataViewBox = [cb[0] + dbbP[0], cb[1] - dbbP[1], cb[2] - dbbP[2], cb[3] + dbbP[3]];
- // 数据视图框
- var dvb = this.dataViewBox;
- //检查数据视图框是否合法
- if (dvb[0] >= dvb[2] || dvb[1] <= dvb[3]) {
- return false;
- }
- // 数据视图框原点
- this.DVBOrigonPoint = [dvb[0], dvb[3]];
- // 数据视图框宽度
- this.DVBWidth = Math.abs(dvb[2] - dvb[0]);
- // 数据视图框高度
- this.DVBHeight = Math.abs(dvb[1] - dvb[3]);
- // 数据视图框中心点
- this.DVBCenterPoint = [this.DVBOrigonPoint[0] + this.DVBWidth / 2, this.DVBOrigonPoint[1] + this.DVBHeight / 2];
- // 数据视图框原点与图表框的原点偏移量
- this.origonPointOffset = [this.DVBOrigonPoint[0] - op[0], this.DVBOrigonPoint[1] - op[1]];
- return isSuccess;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/Circle.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FeatureThemeCircle
- * @aliasclass Feature.Theme.Circle
- * @deprecatedclass SuperMap.Feature.Theme.Circle
- * @classdesc 圆类。
- * @category Visualization Theme
- * @extends FeatureThemeRankSymbol
- * @param {FeatureVector} data - 用户数据。
- * @param {SuperMap.Layer.RankSymbol} layer - 此专题要素所在图层。
- * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
- * @param {FeatureThemeCircle.setting} setting - 图表配置对象。
- * @param {LonLat} [lonlat] - 专题要素地理位置,默认为 data 指代的地理要素 Bounds 中心。
- * @usage
- * @private
- */
- class Circle extends RankSymbol {
- constructor(data, layer, fields, setting, lonlat) {
- super(data, layer, fields, setting, lonlat);
- this.CLASS_NAME = "SuperMap.Feature.Theme.Circle";
- }
- /**
- * @function FeatureThemeCircle.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function FeatureThemeCircle.prototype.assembleShapes
- * @description 装配图形(扩展接口)。
- */
- assembleShapes() {
- //默认填充颜色
- var defaultFillColor = "#ff9277";
- // setting 属性是否已成功赋值
- if (!this.setting) {
- return false;
- }
- var sets = this.setting;
- // 检测 setting 的必设参数
- if (!(sets.codomain)) {
- return false;
- }
- // 数据
- var decimalNumber = (typeof(sets.decimalNumber) !== "undefined" && !isNaN(sets.decimalNumber)) ? sets.decimalNumber : -1;
- var dataEffective = Theme_Theme.getDataValues(this.data, this.fields, decimalNumber);
- this.dataValues = dataEffective ? dataEffective : [];
- // 数据值数组
- var fv = this.dataValues;
- //if(fv.length != 1) return; // 没有数据 或者数据不唯一
- //if(fv[0] < 0) return; //数据为负值
- //用户应该定义最大 最小半径 默认最大半径MaxR:100 最小半径MinR:0;
- if (!sets.maxR) {
- sets.maxR = 100;
- }
- if (!sets.minR) {
- sets.minR = 0;
- }
- // 值域范围
- var codomain = this.DVBCodomain;
- // 重要步骤:定义Circle数据视图框中单位值的含义,单位值:1所代表的长度
- // 用户定义了值域范围
- if (codomain && codomain[1] - codomain[0] > 0) {
- this.DVBUnitValue = sets.maxR / (codomain[1] - codomain[0]);
- } else {
- //this.DVBUnitValue = sets.maxR / maxValue;
- this.DVBUnitValue = sets.maxR;
- }
- var uv = this.DVBUnitValue;
- //圆半径
- var r = fv[0] * uv + sets.minR;
- this.width = 2 * r;
- this.height = 2 * r;
- // 重要步骤:初始化参数
- if (!this.initBaseParameter()) {
- return;
- }
- //假如用户设置了值域范围 没有在值域范围直接返回
- if (codomain) {
- if (fv[0] < codomain[0] || fv[0] > codomain[1]) {
- return;
- }
- }
- var dvbCenter = this.DVBCenterPoint; // 数据视图框中心作为圆心
- //圆形对象参数
- var circleSP = new Circle_Circle(dvbCenter[0], dvbCenter[1], r);
- //circleSP.sytle 初始化
- circleSP.style = ShapeFactory.ShapeStyleTool(null, sets.circleStyle, null, null, 0);
- //图形的填充颜色
- if (typeof (sets.fillColor) !== "undefined") {
- //用户自定义
- circleSP.style.fillColor = sets.fillColor;
- } else {
- //当前默认
- circleSP.style.fillColor = defaultFillColor;
- }
- //圆形 Hover样式
- circleSP.highlightStyle = ShapeFactory.ShapeStyleTool(null, sets.circleHoverStyle);
- //圆形 Hover 与 click 设置
- if (typeof(sets.circleHoverAble) !== "undefined") {
- circleSP.hoverable = sets.circleHoverAble;
- }
- if (typeof(sets.circleClickAble) !== "undefined") {
- circleSP.clickable = sets.circleClickAble;
- }
- //图形携带的数据信息
- circleSP.refDataID = this.data.id;
- circleSP.dataInfo = {
- field: this.fields[0],
- r: r,
- value: fv[0]
- };
- // 创建扇形并把此扇形添加到图表图形数组
- this.shapes.push(this.shapeFactory.createShape(circleSP));
- // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
- // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
- this.shapesConvertToRelativeCoordinate();
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/Line.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FeatureThemeLine
- * @aliasclass Feature.Theme.Line
- * @deprecatedclass SuperMap.Feature.Theme.Line
- * @classdesc 折线图。
- * @category Visualization Theme
- * @example
- * // pointStyleByCodomain 参数用法示例
- * // pointStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
- * // start: 值域值下限(包含);
- * // end: 值域值上限(不包含);
- * // style: 数据可视化图形的 style,这个样式对象的可设属性: <Point.style> 。
- * // pointStyleByCodomain 数组形如:
- * [
- * {
- * start:0,
- * end:250,
- * style:{
- * fillColor:"#00CD00"
- * }
- * },
- * {
- * start:250,
- * end:500,
- * style:{
- * fillColor:"#00EE00"
- * }
- * },
- * {
- * start:500,
- * end:750,
- * style:{
- * fillColor:"#00FF7F"
- * }
- * },
- * {
- * start:750,
- * end:1500,
- * style:{
- * fillColor:"#00FF00"
- * }
- * }
- * ]
- *
- * @extends FeatureThemeGraph
- * @param {FeatureVector} data - 用户数据。
- * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
- * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
- * @param {FeatureThemeLine.setting} setting - 图表配置对象。
- * @param {LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
- * @usage
- * @private
- */
- class Line extends Graph {
- constructor(data, layer, fields, setting, lonlat, options) {
- super(data, layer, fields, setting, lonlat, options);
- this.CLASS_NAME = "SuperMap.Feature.Theme.Line";
- }
- /**
- * @function FeatureThemeLine.prototype.destroy
- * @override
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function FeatureThemeLine.prototype.assembleShapes
- * @description 装配图形(扩展接口)。
- */
- assembleShapes() {
- // 图表配置对象
- var sets = this.setting;
- // 默认数据视图框
- if (!sets.dataViewBoxParameter) {
- if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
- sets.dataViewBoxParameter = [45, 15, 15, 15];
- } else {
- sets.dataViewBoxParameter = [5, 5, 5, 5];
- }
- }
- // 重要步骤:初始化参数
- if (!this.initBaseParameter()) {
- return;
- }
- var dvb = this.dataViewBox;
- // 值域
- var codomain = this.DVBCodomain;
- // 重要步骤:定义图表 FeatureThemeBar 数据视图框中单位值的含义
- this.DVBUnitValue = (codomain[1] - codomain[0]) / this.DVBHeight;
- var uv = this.DVBUnitValue;
- // 数据值数组
- var fv = this.dataValues;
- if (fv.length < 1) {
- return;
- } // 没有数据
- // 获取 x 轴上的图形信息
- var xShapeInfo = this.calculateXShapeInfo();
- if (!xShapeInfo) {
- return;
- }
- // 折线每个节点的 x 位置
- var xsLoc = xShapeInfo.xPositions;
- // 背景框,默认启用
- if (typeof(sets.useBackground) === "undefined" || sets.useBackground) {
- // 将背景框图形添加到模型的 shapes 数组,注意添加顺序,后添加的图形在先添加的图形之上。
- this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
- }
- // 折线图必须使用坐标轴
- this.shapes = this.shapes.concat(ShapeFactory.GraphAxis(this.shapeFactory, dvb, sets, xShapeInfo));
- // var isDataEffective = true;
- var xPx; // 折线节点 x 坐标
- var yPx; // 折线节点 y 坐标
- var poiLists = []; // 折线节点数组
- var shapePois = []; // 折线节点图形数组
- for (var i = 0, len = fv.length; i < len; i++) {
- // 数据溢出值域检查
- if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
- // isDataEffective = false;
- return null;
- }
- xPx = xsLoc[i];
- yPx = dvb[1] - (fv[i] - codomain[0]) / uv;
- // 折线节点参数对象
- var poiSP = new Point_Point(xPx, yPx);
- // 折线节点 style
- poiSP.style = ShapeFactory.ShapeStyleTool({fillColor: "#ee9900"}, sets.pointStyle, sets.pointStyleByFields, sets.pointStyleByCodomain, i, fv[i]);
- // 折线节点 hover 样式
- poiSP.highlightStyle = ShapeFactory.ShapeStyleTool(null, sets.pointHoverStyle);
- // 折线节点 hover click
- if (typeof(sets.pointHoverAble) !== "undefined") {
- poiSP.hoverable = sets.pointHoverAble;
- }
- if (typeof(sets.pointClickAble) !== "undefined") {
- poiSP.clickable = sets.pointClickAble;
- }
- // 图形携带的数据信息
- poiSP.refDataID = this.data.id;
- poiSP.dataInfo = {
- field: this.fields[i],
- value: fv[i]
- };
- // 创建图形并把此图形添加到折线节点图形数组
- shapePois.push(this.shapeFactory.createShape(poiSP));
- // 添加折线节点到折线节点数组
- var poi = [xPx, yPx];
- poiLists.push(poi);
- }
- // 折线参数对象
- var lineSP = new Line_Line(poiLists);
- lineSP.style = ShapeFactory.ShapeStyleTool({strokeColor: "#ee9900"}, sets.lineStyle);
- // 禁止事件响应
- lineSP.clickable = false;
- lineSP.hoverable = false;
- var shapeLine = this.shapeFactory.createShape(lineSP);
- this.shapes.push(shapeLine);
- // 添加节点到图表图形数组
- this.shapes = this.shapes.concat(shapePois);
- // // 数据范围检测未通过,清空图形
- // if (isDataEffective === false) {
- // this.shapes = [];
- // }
- // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
- // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
- this.shapesConvertToRelativeCoordinate();
- }
- /**
- * @function FeatureThemeLine.prototype.calculateXShapeInfo
- * @description 计算 X 轴方向上的图形信息,此信息是一个对象,包含两个属性,
- * 属性 xPositions 是一个一维数组,该数组元素表示图形在 x 轴方向上的像素坐标值,
- * 如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
- * width 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
- * 本函数中图形配置对象 setting 可设属性:<br>
- * xShapeBlank - {Array.<number>} 水平方向上的图形空白间隔参数。
- * 长度为 2 的数组,第一元素表示第折线左端点与数据视图框左端的空白间距,第二个元素表示折线右端点右端与数据视图框右端端的空白间距 。
- * @returns {Object} 如果计算失败,返回 null;如果计算成功,返回 X 轴方向上的图形信息,此信息是一个对象,包含以下两个属性:<br>
- * xPositions - {Array.<number>} 表示图形在 x 轴方向上的像素坐标值,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。<br>
- * width - {number} 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
- */
- calculateXShapeInfo() {
- var dvb = this.dataViewBox; // 数据视图框
- var sets = this.setting; // 图表配置对象
- var fvc = this.dataValues.length; // 数组值个数
- if (fvc < 1) {
- return null;
- }
- var xBlank; // x 轴空白间隔参数
- var xShapePositions = []; // x 轴上图形的位置
- var xShapeWidth = 0; // x 轴上图形宽度(自适应)
- var dvbWidth = this.DVBWidth; // 数据视图框宽度
- var unitOffset = 0; // 单位偏移量
- // x 轴空白间隔参数处理
- if (sets.xShapeBlank && sets.xShapeBlank.length && sets.xShapeBlank.length == 2) {
- xBlank = sets.xShapeBlank;
- var xsLen = dvbWidth - (xBlank[0] + xBlank[1]);
- if (xsLen <= fvc) {
- return null;
- }
- unitOffset = xsLen / (fvc - 1);
- } else {
- // 默认使用等距离空白间隔,空白间隔为图形宽度
- unitOffset = dvbWidth / (fvc + 1);
- xBlank = [unitOffset, unitOffset, unitOffset];
- }
- // 图形 x 轴上的位置计算
- var xOffset = 0
- for (var i = 0; i < fvc; i++) {
- if (i == 0) {
- xOffset = xBlank[0];
- } else {
- xOffset += unitOffset;
- }
- xShapePositions.push(dvb[0] + xOffset);
- }
- return {
- "xPositions": xShapePositions,
- "width": xShapeWidth
- };
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/Pie.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FeatureThemePie
- * @aliasclass Feature.Theme.Pie
- * @deprecatedclass SuperMap.Feature.Theme.Pie
- * @classdesc 饼图。
- * @category Visualization Theme
- * @param {FeatureVector} data - 用户数据。
- * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
- * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
- * @param {FeatureThemePoint.setting} setting - 图表配置对象。
- * @param {LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
- * @extends FeatureThemeGraph
- * @example
- * // sectorStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
- * // start: 值域值下限(包含);
- * // end: 值域值上限(不包含);
- * // style: 数据可视化图形的 style,这个样式对象的可设属性: <ShapeParametersSector.style> 。
- * // sectorStyleByCodomain 数组形如:
- * [
- * {
- * start:0,
- * end:250,
- * style:{
- * fillColor:"#00CD00"
- * }
- * },
- * {
- * start:250,
- * end:500,
- * style:{
- * fillColor:"#00EE00"
- * }
- * },
- * {
- * start:500,
- * end:750,
- * style:{
- * fillColor:"#00FF7F"
- * }
- * },
- * {
- * start:750,
- * end:1500,
- * style:{
- * fillColor:"#00FF00"
- * }
- * }
- * ]
- * @usage
- * @private
- */
- class Pie extends Graph {
- constructor(data, layer, fields, setting, lonlat) {
- super(data, layer, fields, setting, lonlat);
- this.CLASS_NAME = "SuperMap.Feature.Theme.Pie";
- }
- /**
- * @function FeatureThemePie.prototype.destroy
- * @description 销毁此专题要素。调用 destroy 后此对象所以属性置为 null。
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function FeatureThemePie.prototype.assembleShapes
- * @description 装配图形(扩展接口)。
- */
- assembleShapes() {
- // 图表配置对象
- var sets = this.setting;
- // 一个默认 style 组
- var defaultStyleGroup = [
- {fillColor: "#ff9277"}, {fillColor: "#dddd00"}, {fillColor: "#ffc877"}, {fillColor: "#bbe3ff"}, {fillColor: "#d5ffbb"},
- {fillColor: "#bbbbff"}, {fillColor: "#ddb000"}, {fillColor: "#b0dd00"}, {fillColor: "#e2bbff"}, {fillColor: "#ffbbe3"},
- {fillColor: "#ff7777"}, {fillColor: "#ff9900"}, {fillColor: "#83dd00"}, {fillColor: "#77e3ff"}, {fillColor: "#778fff"},
- {fillColor: "#c877ff"}, {fillColor: "#ff77ab"}, {fillColor: "#ff6600"}, {fillColor: "#aa8800"}, {fillColor: "#77c7ff"},
- {fillColor: "#ad77ff"}, {fillColor: "#ff77ff"}, {fillColor: "#dd0083"}, {fillColor: "#777700"}, {fillColor: "#00aa00"},
- {fillColor: "#0088aa"}, {fillColor: "#8400dd"}, {fillColor: "#aa0088"}, {fillColor: "#dd0000"}, {fillColor: "#772e00"}
- ];
- // 重要步骤:初始化参数
- if (!this.initBaseParameter()) {
- return;
- }
- // 背景框,默认不启用
- if (sets.useBackground) {
- this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
- }
- // 数据值数组
- var fv = this.dataValues;
- if (fv.length < 1) {
- return;
- } // 没有数据
- // 值域范围
- var codomain = this.DVBCodomain;
- // 值域范围检测
- for (let i = 0; i < fv.length; i++) {
- if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
- return;
- }
- }
- // 值的绝对值总和
- var valueSum = 0;
- for (let i = 0; i < fv.length; i++) {
- valueSum += Math.abs(fv[i]);
- }
- // 重要步骤:定义图表 FeatureThemePie 数据视图框中单位值的含义,单位值:每度代表的数值
- this.DVBUnitValue = 360 / valueSum;
- var uv = this.DVBUnitValue;
- var dvbCenter = this.DVBCenterPoint; // 数据视图框中心作为扇心
- var startAngle = 0; // 扇形起始边角度
- var endAngle = 0; // 扇形终止边角度
- var startAngleTmp = startAngle; // 扇形临时起始边角度
- // 扇形(自适应)半径
- var r = this.DVBHeight < this.DVBWidth ? this.DVBHeight / 2 : this.DVBWidth / 2;
- for (var i = 0; i < fv.length; i++) {
- var fvi = Math.abs(fv[i]);
- //计算终止角
- if (i === 0) {
- endAngle = startAngle + fvi * uv;
- } else if (i === fvi.length - 1) {
- endAngle = startAngleTmp;
- } else {
- endAngle = startAngle + fvi * uv;
- }
- //矫正误差计算
- if ((endAngle - startAngle) >= 360) {
- endAngle = 359.9999999;
- }
- // 扇形参数对象
- var sectorSP = new Sector(dvbCenter[0], dvbCenter[1], r, startAngle, endAngle);
- // 扇形样式
- if (typeof(sets.sectorStyleByFields) === "undefined") {
- // 使用默认 style 组
- var colorIndex = i % defaultStyleGroup.length;
- sectorSP.style = ShapeFactory.ShapeStyleTool(null, sets.sectorStyle, defaultStyleGroup, null, colorIndex);
- } else {
- sectorSP.style = ShapeFactory.ShapeStyleTool(null, sets.sectorStyle, sets.sectorStyleByFields, sets.sectorStyleByCodomain, i, fv[i]);
- }
- // 扇形 hover 样式
- sectorSP.highlightStyle = ShapeFactory.ShapeStyleTool(null, sets.sectorHoverStyle);
- // 扇形 hover 与 click 设置
- if (typeof(sets.sectorHoverAble) !== "undefined") {
- sectorSP.hoverable = sets.sectorHoverAble;
- }
- if (typeof(sets.sectorClickAble) !== "undefined") {
- sectorSP.clickable = sets.sectorClickAble;
- }
- // 图形携带的数据信息
- sectorSP.refDataID = this.data.id;
- sectorSP.dataInfo = {
- field: this.fields[i],
- value: fv[i]
- };
- // 创建扇形并把此扇形添加到图表图形数组
- this.shapes.push(this.shapeFactory.createShape(sectorSP));
- // 把上一次的结束角度作为下一次的起始角度
- startAngle = endAngle;
- }
- // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
- // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
- this.shapesConvertToRelativeCoordinate();
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/Point.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FeatureThemePoint
- * @aliasclass Feature.Theme.Point
- * @deprecatedclass SuperMap.Feature.Theme.Point
- * @classdesc 点状图。
- * @category Visualization Theme
- * @param {FeatureVector} data - 用户数据。
- * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
- * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
- * @param {FeatureThemePoint.setting} setting - 图表配置对象。
- * @param {LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
- * @example
- * // pointStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
- * // start: 值域值下限(包含);
- * // end: 值域值上限(不包含);
- * // style: 数据可视化图形的 style,这个样式对象的可设属性: <Point.style> 。
- * // pointStyleByCodomain 数组形如:
- * [
- * {
- * start:0,
- * end:250,
- * style:{
- * fillColor:"#00CD00"
- * }
- * },
- * {
- * start:250,
- * end:500,
- * style:{
- * fillColor:"#00EE00"
- * }
- * },
- * {
- * start:500,
- * end:750,
- * style:{
- * fillColor:"#00FF7F"
- * }
- * },
- * {
- * start:750,
- * end:1500,
- * style:{
- * fillColor:"#00FF00"
- * }
- * }
- * ]
- * @extends FeatureThemeGraph
- * @usage
- * @private
- */
- class overlay_Point_Point extends Graph {
- constructor(data, layer, fields, setting, lonlat, options) {
- super(data, layer, fields, setting, lonlat, options);
- this.CLASS_NAME = "SuperMap.Feature.Theme.Point";
- }
- /**
- * @function FeatureThemePoint.prototype.destroy
- * @description 销毁此专题要素。调用 destroy 后此对象所以属性置为 null。
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function FeatureThemePoint.prototype.Point.assembleShapes
- * @description 装配图形(扩展接口)。
- */
- assembleShapes() {
- // 图表配置对象
- var sets = this.setting;
- // 默认数据视图框
- if (!sets.dataViewBoxParameter) {
- if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
- sets.dataViewBoxParameter = [45, 15, 15, 15];
- } else {
- sets.dataViewBoxParameter = [5, 5, 5, 5];
- }
- }
- // 重要步骤:初始化参数
- if (!this.initBaseParameter()) {
- return;
- }
- var dvb = this.dataViewBox;
- // 值域
- var codomain = this.DVBCodomain;
- // 重要步骤:定义图表 FeatureThemeBar 数据视图框中单位值的含义
- this.DVBUnitValue = (codomain[1] - codomain[0]) / this.DVBHeight;
- var uv = this.DVBUnitValue;
- var fv = this.dataValues;
- // 获取 x 轴上的图形信息
- var xShapeInfo = this.calculateXShapeInfo();
- if (!xShapeInfo) {
- return;
- }
- // 折线每个节点的 x 位置
- var xsLoc = xShapeInfo.xPositions;
- // 背景框,默认启用
- if (typeof(sets.useBackground) === "undefined" || sets.useBackground) {
- // 将背景框图形添加到模型的 shapes 数组,注意添加顺序,后添加的图形在先添加的图形之上。
- this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
- }
- // 点状图必须使用坐标轴
- this.shapes = this.shapes.concat(ShapeFactory.GraphAxis(this.shapeFactory, dvb, sets, xShapeInfo));
- var xPx; // 图形点 x 坐标
- var yPx; // 图形点 y 坐标
- for (var i = 0, len = fv.length; i < len; i++) {
- // 数据溢出值域检查
- if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
- //isDataEffective = false;
- return null;
- }
- xPx = xsLoc[i];
- yPx = dvb[1] - (fv[i] - codomain[0]) / uv;
- // 图形点参数对象
- var poiSP = new Point_Point(xPx, yPx);
- // 图形点 style
- poiSP.style = ShapeFactory.ShapeStyleTool({fillColor: "#ee9900"}, sets.pointStyle, sets.pointStyleByFields, sets.pointStyleByCodomain, i, fv[i]);
- // 图形点 hover 样式
- poiSP.highlightStyle = ShapeFactory.ShapeStyleTool(null, sets.pointHoverStyle);
- // 图形点 hover click
- if (typeof(sets.pointHoverAble) !== "undefined") {
- poiSP.hoverable = sets.pointHoverAble;
- }
- if (typeof(sets.pointClickAble) !== "undefined") {
- poiSP.clickable = sets.pointClickAble;
- }
- // 图形携带的数据信息
- poiSP.refDataID = this.data.id;
- poiSP.dataInfo = {
- field: this.fields[i],
- value: fv[i]
- };
- // 创建图形点并把此图形添加到图表图形数组
- this.shapes.push(this.shapeFactory.createShape(poiSP));
- }
- // 数据范围检测未通过,清空图形
- // if (isDataEffective === false) {
- // this.shapes = [];
- // }
- // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
- // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
- this.shapesConvertToRelativeCoordinate();
- }
- /**
- * @function FeatureThemePoint.prototype.calculateXShapeInfo
- * @description 计算 X 轴方向上的图形信息,此信息是一个对象,包含两个属性,
- * 属性 xPositions 是一个一维数组,该数组元素表示图形在 x 轴方向上的像素坐标值,
- * 如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
- * width 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
- * 本函数中图形配置对象 setting 可设属性:<br>
- * xShapeBlank - {Array.<number>} 水平方向上的图形空白间隔参数。
- * 长度为 2 的数组,第一元素表示第折线左端点与数据视图框左端的空白间距,第二个元素表示折线右端点右端与数据视图框右端端的空白间距 。
- * @returns {Object} 如果计算失败,返回 null;如果计算成功,返回 X 轴方向上的图形信息,此信息是一个对象,包含以下两个属性:<br>
- * xPositions - {Array.<number>} 表示图形在 x 轴方向上的像素坐标值,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
- * width - {number}表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
- */
- calculateXShapeInfo() {
- var dvb = this.dataViewBox; // 数据视图框
- var sets = this.setting; // 图表配置对象
- var fvc = this.dataValues.length; // 数组值个数
- if (fvc < 1) {
- return null;
- }
- var xBlank; // x 轴空白间隔参数
- var xShapePositions = []; // x 轴上图形的位置
- var xShapeWidth = 0; // x 轴上图形宽度(自适应)
- var dvbWidth = this.DVBWidth; // 数据视图框宽度
- var unitOffset = 0; // 单位偏移量
- // x 轴空白间隔参数处理
- if (sets.xShapeBlank && sets.xShapeBlank.length && sets.xShapeBlank.length == 2) {
- xBlank = sets.xShapeBlank;
- var xsLen = dvbWidth - (xBlank[0] + xBlank[1]);
- if (xsLen <= fvc) {
- return null;
- }
- unitOffset = xsLen / (fvc - 1);
- } else {
- // 默认使用等距离空白间隔,空白间隔为图形宽度
- unitOffset = dvbWidth / (fvc + 1);
- xBlank = [unitOffset, unitOffset, unitOffset];
- }
- // 图形 x 轴上的位置计算
- var xOffset = 0
- for (var i = 0; i < fvc; i++) {
- if (i == 0) {
- xOffset = xBlank[0];
- } else {
- xOffset += unitOffset;
- }
- xShapePositions.push(dvb[0] + xOffset);
- }
- return {
- "xPositions": xShapePositions,
- "width": xShapeWidth
- };
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/Ring.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FeatureThemeRing
- * @aliasclass Feature.Theme.Ring
- * @deprecatedclass SuperMap.Feature.Theme.Ring
- * @classdesc 环状图。
- * @category Visualization Theme
- * @description 基于路由对象计算指定点 M 值操作的参数类。通过该类提供参数信息。
- * @param {FeatureVector} data - 用户数据。
- * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
- * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
- * @param {FeatureThemeRing.setting} setting - 图表配置对象。
- * @param {LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
- * @example
- * // sectorStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
- * // start: 值域值下限(包含);
- * // end: 值域值上限(不包含);
- * // style: 数据可视化图形的 style,这个样式对象的可设属性: <ShapeParametersSector.style> 。
- * // sectorStyleByCodomain 数组形如:
- * [
- * {
- * start:0,
- * end:250,
- * style:{
- * fillColor:"#00CD00"
- * }
- * },
- * {
- * start:250,
- * end:500,
- * style:{
- * fillColor:"#00EE00"
- * }
- * },
- * {
- * start:500,
- * end:750,
- * style:{
- * fillColor:"#00FF7F"
- * }
- * },
- * {
- * start:750,
- * end:1500,
- * style:{
- * fillColor:"#00FF00"
- * }
- * }
- * ]
- * @param {Object} [sectorHoverStyle=true] - 环状图扇形 hover 状态时的样式,sectorHoverAble 为 true 时有效。
- * @param {boolean} [sectorHoverAble=true] - 是否允许环状图扇形使用 hover 状态。同时设置 sectorHoverAble 和 sectorClickAble 为 false,可以直接屏蔽环状图扇形对专题图层事件的响应。
- * @param {boolean} [sectorClickAble=true] - 是否允许环状图扇形被点击。同时设置 sectorHoverAble 和 sectorClickAble 为 false,可以直接屏蔽环状图扇形对专题图层事件的响应。
- *
- * @extends FeatureThemeGraph
- * @usage
- * @private
- */
- class Ring extends Graph {
- constructor(data, layer, fields, setting, lonlat) {
- super(data, layer, fields, setting, lonlat);
- this.CLASS_NAME = "SuperMap.Feature.Theme.Ring";
- }
- /**
- * @function FeatureThemeRing.prototype.destroy
- * @description 销毁此专题要素。调用 destroy 后此对象所以属性置为 null。
- */
- destroy() {
- super.destroy();
- }
- /**
- * @function FeatureThemeRing.prototype.assembleShapes
- * @description 装配图形(扩展接口)。
- */
- assembleShapes() {
- // 重要步骤:初始化参数
- if (!this.initBaseParameter()) {
- return;
- }
- // 一个默认 style 组
- var defaultStyleGroup = [
- {fillColor: "#ff9277"}, {fillColor: "#dddd00"}, {fillColor: "#ffc877"}, {fillColor: "#bbe3ff"}, {fillColor: "#d5ffbb"},
- {fillColor: "#bbbbff"}, {fillColor: "#ddb000"}, {fillColor: "#b0dd00"}, {fillColor: "#e2bbff"}, {fillColor: "#ffbbe3"},
- {fillColor: "#ff7777"}, {fillColor: "#ff9900"}, {fillColor: "#83dd00"}, {fillColor: "#77e3ff"}, {fillColor: "#778fff"},
- {fillColor: "#c877ff"}, {fillColor: "#ff77ab"}, {fillColor: "#ff6600"}, {fillColor: "#aa8800"}, {fillColor: "#77c7ff"},
- {fillColor: "#ad77ff"}, {fillColor: "#ff77ff"}, {fillColor: "#dd0083"}, {fillColor: "#777700"}, {fillColor: "#00aa00"},
- {fillColor: "#0088aa"}, {fillColor: "#8400dd"}, {fillColor: "#aa0088"}, {fillColor: "#dd0000"}, {fillColor: "#772e00"}
- ];
- // 图表配置对象
- var sets = this.setting;
- // 背景框,默认不启用
- if (sets.useBackground) {
- this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
- }
- // 数据值数组
- var fv = this.dataValues;
- if (fv.length < 1) {
- return;
- } // 没有数据
- // 值域范围
- var codomain = this.DVBCodomain;
- // 值域范围检测
- for (let i = 0; i < fv.length; i++) {
- if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
- return;
- }
- }
- // 值的绝对值总和
- var valueSum = 0;
- for (let i = 0; i < fv.length; i++) {
- valueSum += Math.abs(fv[i]);
- }
- // 重要步骤:定义图表 FeatureThemeRing 数据视图框中单位值的含义,单位值:每度代表的数值
- this.DVBUnitValue = 360 / valueSum;
- var uv = this.DVBUnitValue;
- var dvbCenter = this.DVBCenterPoint; // 数据视图框中心作为扇心
- var startAngle = 0; // 扇形起始边角度
- var endAngle = 0; // 扇形终止边角度
- var startAngleTmp = startAngle; // 扇形临时起始边角度
- // 扇形外环(自适应)半径
- var r = this.DVBHeight < this.DVBWidth ? this.DVBHeight / 2 : this.DVBWidth / 2;
- // 扇形内环(自适应)半径
- var isInRange = sets.innerRingRadius >= 0 && sets.innerRingRadius < r;
- var r0 = (
- typeof(sets.innerRingRadius) !== "undefined"
- && !isNaN(sets.innerRingRadius)
- && isInRange
- ) ? sets.innerRingRadius : 0;
- for (var i = 0; i < fv.length; i++) {
- var fvi = Math.abs(fv[i]);
- // 计算结束角度
- if (i === 0) {
- endAngle = startAngle + fvi * uv;
- } else if (i === fvi.length - 1) {
- endAngle = startAngleTmp;
- } else {
- endAngle = startAngle + fvi * uv;
- }
- // 扇形参数对象
- var sectorSP = new Sector(dvbCenter[0], dvbCenter[1], r, startAngle, endAngle, r0);
- // 扇形样式
- if (typeof(sets.sectorStyleByFields) === "undefined") {
- // 使用默认 style 组
- var colorIndex = i % defaultStyleGroup.length;
- sectorSP.style = ShapeFactory.ShapeStyleTool(null, sets.sectorStyle, defaultStyleGroup, null, colorIndex);
- } else {
- sectorSP.style = ShapeFactory.ShapeStyleTool(null, sets.sectorStyle, sets.sectorStyleByFields, sets.sectorStyleByCodomain, i, fv[i]);
- }
- // 扇形 hover 样式
- sectorSP.highlightStyle = ShapeFactory.ShapeStyleTool(null, sets.sectorHoverStyle);
- // 扇形 hover 与 click 设置
- if (typeof(sets.sectorHoverAble) !== "undefined") {
- sectorSP.hoverable = sets.sectorHoverAble;
- }
- if (typeof(sets.sectorClickAble) !== "undefined") {
- sectorSP.clickable = sets.sectorClickAble;
- }
- // 图形携带的数据信息
- sectorSP.refDataID = this.data.id;
- sectorSP.dataInfo = {
- field: this.fields[i],
- value: fv[i]
- };
- // 创建扇形并把此扇形添加到图表图形数组
- this.shapes.push(this.shapeFactory.createShape(sectorSP));
- // 把上一次的结束角度作为下一次的起始角度
- startAngle = endAngle;
- }
- // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
- // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
- this.shapesConvertToRelativeCoordinate();
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/ThemeVector.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FeatureThemeVector
- * @aliasclass Feature.Theme.ThemeVector
- * @deprecatedclass SuperMap.Feature.Theme.ThemeVector
- * @classdesc 矢量专题要素类。
- * @category Visualization Theme
- * @extends FeatureTheme
- * @param {FeatureVector} data - 用户数据,的类型为矢量数据 feature。
- * @param {SuperMap.Layer} layer - 此专题要素所在图层。
- * @param {Object} style - 样式。
- * @param {Object} options - 创建专题要素时的可选参数。
- * @param {number} [options.nodesClipPixel=2] - 节点抽稀像素距离, 单位:像素。
- * @param {boolean} [options.isHoverAble=true] - 图形是否可 hover。
- * @param {boolean} [options.isMultiHover=true] - 是否使用多图形高亮,isHoverAble 为 true 时生效。
- * @param {boolean} [options.isClickAble=true] - 图形是否可点击。
- * @param {Object} [options.highlightStyle] - 高亮样式。
- * @usage
- */
- class ThemeVector extends Theme_Theme {
- constructor(data, layer, style, options, shapeOptions) {
- super(data, layer);
- //数据的 geometry 属性必须存在且类型是 Geometry 或其子类的类型
- if (!data.geometry) {
- return;
- }
- if (!(data.geometry instanceof Geometry)) {
- return;
- }
- /**
- * @member {Bounds} [FeatureThemeVector.prototype.dataBounds]
- * @description 用户数据的(feature.geometry)地理范围。
- */
- this.dataBounds = data.geometry.getBounds();
- /**
- * @member {number} [FeatureThemeVector.prototype.nodesClipPixel=2]
- * @description 节点抽稀像素距离。
- */
- this.nodesClipPixel = 2;
- /**
- * @member {boolean} [FeatureThemeVector.prototype.isHoverAble=true]
- * @description 图形是否可 hover。
- */
- this.isHoverAble = true;
- /**
- * @member {boolean} [FeatureThemeVector.prototype.isMultiHover=true]
- * @description 是否使用多图形高亮,isHoverAble 为 true 时生效。
- */
- this.isMultiHover = true;
- /**
- * @member {boolean} [FeatureThemeVector.prototype.isClickAble=true]
- * @description 图形是否可点击。
- */
- this.isClickAble = true;
- /**
- * @member {Object} [FeatureThemeVector.prototype.highlightStyle]
- * @description 高亮样式。
- */
- this.highlightStyle = null;
- /**
- * @member {Object} [FeatureThemeVector.prototype.shapeOptions]
- * @description 添加到渲染器前修改 shape 的一些属性,非特殊情况通常不允许这么做。
- */
- this.shapeOptions = {};
- /**
- * @member {Object} [FeatureThemeVector.prototype.style]
- * @description 可视化图形的 style。在子类中规定其对象结构和默认属性值。
- */
- this.style = style || {};
- this.CLASS_NAME = "SuperMap.Feature.Theme.Vector";
- this.style = style ? style : {};
- if (options) {
- Util.copyAttributesWithClip(this, options, ["shapeOptions", "dataBounds"])
- }
- if (shapeOptions) {
- Util.copyAttributesWithClip(this.shapeOptions, shapeOptions);
- }
- //设置基础参数 dataBounds、lonlat、location
- var geometry = data.geometry;
- this.lonlat = this.dataBounds.getCenterLonLat();
- this.location = this.getLocalXY(this.lonlat);
- //将地理要素转为专题要素
- if (geometry instanceof LinearRing) {
- this.lineToTF(geometry);
- } else if (geometry instanceof LineString) {
- this.lineToTF(geometry);
- } else if (geometry instanceof Curve) {
- //独立几何体
- } else if (geometry instanceof MultiPoint) {
- this.multiPointToTF(geometry);
- } else if (geometry instanceof MultiLineString) {
- this.multiLineStringToTF(geometry);
- } else if (geometry instanceof MultiPolygon) {
- this.multiPolygonToTF(geometry);
- } else if (geometry instanceof Polygon) {
- this.polygonToTF(geometry);
- } else if (geometry instanceof Collection) {
- //独立几何体
- } else if (geometry instanceof Point) {
- this.pointToTF(geometry);
- } else if (geometry instanceof Rectangle) {
- this.rectangleToTF(geometry);
- } else if (geometry instanceof GeoText) {
- this.geoTextToTF(geometry);
- }
- }
- /**
- * @function FeatureThemeVector.prototype.destroy
- * @override
- */
- destroy() {
- this.style = null;
- this.dataBounds = null;
- this.nodesClipPixel = null;
- this.isHoverAble = null;
- this.isMultiHover = null;
- this.isClickAble = null;
- this.highlightStyle = null;
- this.shapeOptions = null;
- super.destroy();
- }
- /**
- * @function FeatureThemeVector.prototype.lineToTF
- * @description 转换线和线环要素。
- * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 GeometryLineString 或 GeometryLineRing。
- */
- lineToTF(geometry) {
- var components = geometry.components;
- //节点像素坐标
- var localLX = [];
- //参考位置,参考中心为
- var refLocal = [];
- var location = this.location;
- var pointList = [];
- //节点抽稀距离
- var nCPx = this.nodesClipPixel;
- for (var i = 0; i < components.length; i++) {
- var components_i = components[i];
- refLocal = [];
- localLX = this.getLocalXY(components_i);
- refLocal[0] = localLX[0] - location[0];
- refLocal[1] = localLX[1] - location[1];
- //抽稀 - 2 px
- if (pointList.length > 0) {
- var lastLocalXY = pointList[pointList.length - 1];
- if ((Math.abs(lastLocalXY[0] - refLocal[0]) <= nCPx) && (Math.abs(lastLocalXY[1] - refLocal[1]) <= nCPx)) {
- continue;
- }
- }
- //使用参考点
- pointList.push(refLocal);
- }
- if (pointList.length < 2) {
- return null;
- }
- //赋 style
- var style = new Object();
- style = Util.copyAttributesWithClip(style, this.style, ['pointList']);
- style.pointList = pointList;
- //创建图形
- var shape = new SmicBrokenLine({
- style: style,
- clickable: this.isClickAble,
- hoverable: this.isHoverAble
- });
- //设置高亮样式
- if (this.highlightStyle) {
- shape.highlightStyle = this.highlightStyle;
- }
- //设置参考中心,指定图形位置
- shape.refOriginalPosition = this.location;
- //储存数据 id 属性,用于事件
- shape.refDataID = this.data.id;
- //储存数据 id 属性,用于事件-多图形同时高亮
- shape.isHoverByRefDataID = this.isMultiHover;
- //添加到渲染器前修改 shape 的一些属性,非特殊情况通常不允许这么做
- if (this.shapeOptions) {
- Util.copyAttributesWithClip(shape, this.shapeOptions);
- }
- this.shapes.push(shape);
- }
- /**
- * @function FeatureThemeVector.prototype.multiPointToTF
- * @description 转多点要素。
- * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 MultiPoint。
- */
- multiPointToTF(geometry) {
- /* //-- 不抽稀
- var components = geometry.components;
- for(var i = 0; i < components.length; i++){
- var components_i = components[i];
- this.pointToTF(components_i);
- }
- */
- var components = geometry.components;
- //节点像素坐标
- var localLX = [];
- //参考位置,参考中心为
- var refLocal = [];
- var location = this.location;
- var pointList = [];
- //节点抽稀距离
- var nCPx = this.nodesClipPixel;
- for (var i = 0; i < components.length; i++) {
- var components_i = components[i];
- refLocal = [];
- localLX = this.getLocalXY(components_i);
- refLocal[0] = localLX[0] - location[0];
- refLocal[1] = localLX[1] - location[1];
- //抽稀
- if (pointList.length > 0) {
- var lastLocalXY = pointList[pointList.length - 1];
- if ((Math.abs(lastLocalXY[0] - refLocal[0]) <= nCPx) && (Math.abs(lastLocalXY[1] - refLocal[1]) <= nCPx)) {
- continue;
- }
- }
- //使用参考点
- pointList.push(refLocal);
- //赋 style
- var style = new Object();
- style.r = 6; //防止漏设此参数,默认 6 像素
- style = Util.copyAttributesWithClip(style, this.style);
- style.x = refLocal[0];
- style.y = refLocal[1];
- //创建图形
- var shape = new SmicPoint({
- style: style,
- clickable: this.isClickAble,
- hoverable: this.isHoverAble
- });
- //设置高亮样式
- if (this.highlightStyle) {
- shape.highlightStyle = this.highlightStyle;
- }
- //设置参考中心,指定图形位置
- shape.refOriginalPosition = location;
- //储存数据 id 属性,用于事件
- shape.refDataID = this.data.id;
- //储存数据 id 属性,用于事件-多图形同时高亮
- shape.isHoverByRefDataID = this.isMultiHover;
- //修改一些 shape 可选属性,通常不需要这么做
- if (this.shapeOptions) {
- Util.copyAttributesWithClip(shape, this.shapeOptions);
- }
- this.shapes.push(shape);
- }
- }
- /**
- * @function FeatureThemeVector.prototype.multiLineStringToTF
- * @description 转换多线要素。
- * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 MultiLineString。
- */
- multiLineStringToTF(geometry) {
- var components = geometry.components;
- for (var i = 0; i < components.length; i++) {
- var components_i = components[i];
- this.lineToTF(components_i);
- }
- }
- /**
- * @function FeatureThemeVector.prototype.multiPolygonToTF
- * @description 转换多面要素。
- * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 MultiPolygon。
- */
- multiPolygonToTF(geometry) {
- var components = geometry.components;
- for (var i = 0; i < components.length; i++) {
- var components_i = components[i];
- this.polygonToTF(components_i);
- }
- }
- /**
- * @function FeatureThemeVector.prototype.pointToTF
- * @description 转换点要素。
- * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 Point。
- */
- pointToTF(geometry) {
- //参考位置,参考中心为
- var location = this.location;
- //geometry 像素坐标
- var localLX = this.getLocalXY(geometry);
- //赋 style
- var style = new Object();
- style.r = 6; //防止漏设此参数,默认 6 像素
- style = Util.copyAttributesWithClip(style, this.style);
- style.x = localLX[0] - location[0];
- style.y = localLX[1] - location[1];
- //创建图形
- var shape = new SmicPoint({
- style: style,
- clickable: this.isClickAble,
- hoverable: this.isHoverAble
- });
- //设置高亮样式
- if (this.highlightStyle) {
- shape.highlightStyle = this.highlightStyle;
- }
- //设置参考中心,指定图形位置
- shape.refOriginalPosition = location;
- //储存数据 id 属性,用于事件
- shape.refDataID = this.data.id;
- //储存数据 id 属性,用于事件-多图形同时高亮
- shape.isHoverByRefDataID = this.isMultiHover;
- //修改一些 shape 可选属性,通常不需要这么做
- if (this.shapeOptions) {
- Util.copyAttributesWithClip(shape, this.shapeOptions);
- }
- this.shapes.push(shape);
- }
- /**
- * @function FeatureThemeVector.prototype.polygonToThemeFeature
- * @description 转换面要素。
- * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 Polygon。
- */
- polygonToTF(geometry) {
- var components = geometry.components;
- //节点像素坐标
- var localLX = [];
- //参考位置,参考中心为
- var refLocal = [];
- var location = this.location;
- var pointList = [];
- //岛洞
- var holePolygonPointList = [];
- var holePolygonPointLists = [];
- //节点抽稀距离
- var nCPx = this.nodesClipPixel;
- for (var i = 0; i < components.length; i++) {
- var components_i = components[i].components;
- if (i === 0) {
- // 第一个 component 正常绘制
- pointList = [];
- for (var j = 0; j < components_i.length; j++) {
- refLocal = [];
- localLX = this.getLocalXY(components_i[j]);
- refLocal[0] = localLX[0] - location[0];
- refLocal[1] = localLX[1] - location[1];
- //抽稀 - 2 px
- if (pointList.length > 0) {
- var lastLocalXY = pointList[pointList.length - 1];
- if ((Math.abs(lastLocalXY[0] - refLocal[0]) <= nCPx) && (Math.abs(lastLocalXY[1] - refLocal[1]) <= nCPx)) {
- continue;
- }
- }
- //使用参考点
- pointList.push(refLocal);
- }
- } else {
- // 其它 component 作为岛洞
- holePolygonPointList = [];
- for (var k = 0; k < components_i.length; k++) {
- refLocal = [];
- localLX = this.getLocalXY(components_i[k]);
- refLocal[0] = localLX[0] - location[0];
- refLocal[1] = localLX[1] - location[1];
- //抽稀 - 2 px
- if (holePolygonPointList.length > 0) {
- var lastXY = holePolygonPointList[holePolygonPointList.length - 1];
- if ((Math.abs(lastXY[0] - refLocal[0]) <= nCPx) && (Math.abs(lastXY[1] - refLocal[1]) <= nCPx)) {
- continue;
- }
- }
- //使用参考点
- holePolygonPointList.push(refLocal);
- }
- }
- if (holePolygonPointList.length < 2) {
- continue;
- }
- holePolygonPointLists.push(holePolygonPointList);
- }
- if (pointList.length < 2) {
- return;
- }
- //赋 style
- var style = {};
- style = Util.copyAttributesWithClip(style, this.style, ['pointList']);
- style.pointList = pointList;
- //创建图形
- var shape = new SmicPolygon({
- style: style,
- clickable: this.isClickAble,
- hoverable: this.isHoverAble
- });
- //设置高亮样式
- if (this.highlightStyle) {
- shape.highlightStyle = this.highlightStyle;
- }
- //设置参考中心,指定图形位置
- shape.refOriginalPosition = this.location;
- //储存数据 id 属性,用于事件
- shape.refDataID = this.data.id;
- //储存数据 id 属性,用于事件-多图形同时高亮
- shape.isHoverByRefDataID = this.isMultiHover;
- //岛洞面
- if (holePolygonPointLists.length > 0) {
- shape.holePolygonPointLists = holePolygonPointLists;
- }
- //修改一些 shape 可选属性,通常不需要这么做
- if (this.shapeOptions) {
- Util.copyAttributesWithClip(shape, this.shapeOptions);
- }
- this.shapes.push(shape);
- }
- /**
- * @function FeatureThemeVector.prototype.rectangleToTF
- * @description 转换矩形要素。
- * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 Rectangle。
- */
- rectangleToTF(geometry) {
- //参考位置,参考中心为
- var location = this.location;
- var ll = new LonLat(geometry.x, geometry.y);
- //地图分辨率
- var res = this.layer.map.getResolution();
- //geometry 像素坐标
- var localLX = this.getLocalXY(ll);
- //赋 style
- var style = new Object();
- style.r = 6; //防止漏设此参数,默认 6 像素
- style = Util.copyAttributesWithClip(style, this.style);
- style.x = localLX[0] - location[0];
- // Rectangle 使用左下角定位, SmicRectangle 使用左上角定位,需要转换
- style.y = (localLX[1] - location[1]) - 2 * geometry.width / res;
- style.width = geometry.width / res;
- style.height = geometry.height / res;
- //创建图形
- var shape = new SmicRectangle({
- style: style,
- clickable: this.isClickAble,
- hoverable: this.isHoverAble
- });
- //设置高亮样式
- if (this.highlightStyle) {
- shape.highlightStyle = this.highlightStyle;
- }
- //设置参考中心,指定图形位置
- shape.refOriginalPosition = location;
- //储存数据 id 属性,用于事件
- shape.refDataID = this.data.id;
- //储存数据 id 属性,用于事件-多图形同时高亮
- shape.isHoverByRefDataID = this.isMultiHover;
- //修改一些 shape 可选属性,通常不需要这么做
- if (this.shapeOptions) {
- Util.copyAttributesWithClip(shape, this.shapeOptions);
- }
- this.shapes.push(shape);
- }
- /**
- * @function FeatureThemeVector.prototype.geoTextToTF
- * @description 转换文本要素。
- * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 GeoText。
- */
- geoTextToTF(geometry) {
- //参考位置,参考中心为
- var location = this.location;
- //geometry 像素坐标
- var localLX = this.getLocalXY(geometry);
- //赋 style
- var style = new Object();
- style.r = 6; //防止漏设此参数,默认 6 像素
- style = Util.copyAttributesWithClip(style, this.style, ["x", "y", "text"]);
- style.x = localLX[0] - location[0];
- style.y = localLX[1] - location[1];
- style.text = geometry.text;
- //创建图形
- var shape = new SmicText({
- style: style,
- clickable: this.isClickAble,
- hoverable: this.isHoverAble
- });
- //设置高亮样式
- if (this.highlightStyle) {
- shape.highlightStyle = this.highlightStyle;
- }
- //设置参考中心,指定图形位置
- shape.refOriginalPosition = location;
- //储存数据 id 属性,用于事件
- shape.refDataID = this.data.id;
- //储存数据 id 属性,用于事件-多图形同时高亮
- shape.isHoverByRefDataID = this.isMultiHover;
- //修改一些 shape 可选属性,通常不需要这么做
- if (this.shapeOptions) {
- Util.copyAttributesWithClip(shape, this.shapeOptions);
- }
- this.shapes.push(shape);
- }
- /**
- * @function FeatureThemeVector.prototype.updateAndAddShapes
- * @description 修改位置,针对地图平移操作,地图漫游操作后调用此函数。
- */
- updateAndAddShapes() {
- var newLocalLX = this.getLocalXY(this.lonlat);
- this.location = newLocalLX;
- var render = this.layer.renderer;
- for (var i = 0, len = this.shapes.length; i < len; i++) {
- var shape = this.shapes[i];
- //设置参考中心,指定图形位置
- shape.refOriginalPosition = newLocalLX;
- render.addShape(shape);
- }
- }
- /**
- * @function FeatureThemeVector.prototype.getShapesCount
- * @description 获得专题要素中可视化图形的数量。
- * @returns {number} 可视化图形的数量。
- */
- getShapesCount() {
- return this.shapes.length;
- }
- /**
- * @function FeatureThemeVector.prototype.getLocalXY
- * @description 地理坐标转为像素坐标。
- * @param {LonLat} lonlat - 专题要素地理位置。
- */
- getLocalXY(lonlat) {
- return this.layer.getLocalXY(lonlat);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/feature/index.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Group.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class LevelRenderer.Group
- * @category Visualization Theme
- * @private
- * @classdesc Group 是一个容器,可以插入子节点,Group 的变换也会被应用到子节点上。
- * @extends {LevelRenderer.Transformable}
- * (code)
- * var g = new LevelRenderer.Group();
- * var Circle = new LevelRenderer.Shape.Circle();
- * g.position[0] = 100;
- * g.position[1] = 100;
- * g.addChild(new Circle({
- * style: {
- * x: 100,
- * y: 100,
- * r: 20,
- * brushType: 'fill'
- * }
- * }));
- * LR.addGroup(g);
- * (end)
- * @param {Array} options - Group 的配置(options)项,可以是 Group 的自有属性,也可以是自定义的属性。
- */
- class Group extends mixinExt(Eventful, Transformable) {
- constructor(options) {
- super(options)
- options = options || {};
- /**
- * @member {string} LevelRenderer.Group.prototype.id
- * @description Group 的唯一标识。
- */
- this.id = null;
- /**
- * @readonly
- * @member {string} [LevelRenderer.Group.prototype.type='group']
- * @description 类型。
- */
- this.type = 'group';
- //http://www.w3.org/TR/2dcontext/#clipping-region
- /**
- * @member {string} LevelRenderer.Group.prototype.clipShape
- * @description 用于裁剪的图形(shape),所有 Group 内的图形在绘制时都会被这个图形裁剪,该图形会继承 Group 的变换。
- */
- this.clipShape = null;
- /**
- * @member {Array} LevelRenderer.Group.prototype._children
- * @description _children。
- */
- this._children = [];
- /**
- * @member {Array} LevelRenderer.Group.prototype._storage
- * @description _storage。
- */
- this._storage = null;
- /**
- * @member {boolean} [LevelRenderer.Group.prototype.__dirty=true]
- * @description __dirty。
- */
- this.__dirty = true;
- /**
- * @member {boolean} [LevelRenderer.Group.prototype.ignore=false]
- * @description 是否忽略该 Group 及其所有子节点。
- */
- this.ignore = false;
- Util.extend(this, options);
- this.id = this.id || Util.createUniqueID("smShapeGroup_");
- this.CLASS_NAME = "SuperMap.LevelRenderer.Group";
- }
- /**
- * @function LevelRenderer.Group.prototype.destroy
- * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
- */
- destroy() {
- this.id = null;
- this.type = null;
- this.clipShape = null;
- this._children = null;
- this._storage = null;
- this.__dirty = null;
- this.ignore = null;
- super.destroy();
- }
- /**
- * @function LevelRenderer.Group.prototype.children
- * @description 复制并返回一份新的包含所有儿子节点的数组。
- * @returns {Array.<LevelRenderer.Shape>} 图形数组。
- */
- children() {
- return this._children.slice();
- }
- /**
- * @function LevelRenderer.Group.prototype.childAt
- * @description 获取指定 index 的儿子节点
- * @param {number} idx - 节点索引。
- * @returns {LevelRenderer.Shape} 图形。
- */
- childAt(idx) {
- return this._children[idx];
- }
- /**
- * @function LevelRenderer.Group.prototype.addChild
- * @description 添加子节点,可以是 Shape 或者 Group。
- * @param {(LevelRenderer.Shape|LevelRenderer.Group)} child - 节点图形。
- */
- // TODO Type Check
- addChild(child) {
- if (child == this) {
- return;
- }
- if (child.parent == this) {
- return;
- }
- if (child.parent) {
- child.parent.removeChild(child);
- }
- this._children.push(child);
- child.parent = this;
- if (this._storage && this._storage !== child._storage) {
- this._storage.addToMap(child);
- if (child instanceof Group) {
- child.addChildrenToStorage(this._storage);
- }
- }
- }
- /**
- * @function LevelRenderer.Group.prototype.removeChild
- * @description 移除子节点。
- * @param {LevelRenderer.Shape} child - 需要移除的子节点图形。
- */
- removeChild(child) {
- var idx = Util.indexOf(this._children, child);
- this._children.splice(idx, 1);
- child.parent = null;
- if (this._storage) {
- this._storage.delFromMap(child.id);
- if (child instanceof Group) {
- child.delChildrenFromStorage(this._storage);
- }
- }
- }
- /**
- * @function LevelRenderer.Group.prototype.eachChild
- * @description 遍历所有子节点。
- * @param {function} cb - 回调函数。
- * @param {Object} context - 上下文。
- */
- eachChild(cb, context) {
- var haveContext = !!context;
- for (var i = 0; i < this._children.length; i++) {
- var child = this._children[i];
- if (haveContext) {
- cb.call(context, child);
- } else {
- cb(child);
- }
- }
- }
- /**
- * @function LevelRenderer.Group.prototype.traverse
- * @description 深度优先遍历所有子孙节点。
- * @param {function} cb - 回调函数。
- * @param {Object} context - 上下文。
- */
- traverse(cb, context) {
- var haveContext = !!context;
- for (var i = 0; i < this._children.length; i++) {
- var child = this._children[i];
- if (haveContext) {
- cb.call(context, child);
- } else {
- cb(child);
- }
- if (child.type === 'group') {
- child.traverse(cb, context);
- }
- }
- }
- /**
- * @function LevelRenderer.Group.prototype.addChildrenToStorage
- * @description 把子图形添加到仓库。
- * @param {LevelRenderer.Storage} storage - 图形仓库。
- */
- addChildrenToStorage(storage) {
- for (var i = 0; i < this._children.length; i++) {
- var child = this._children[i];
- storage.addToMap(child);
- if (child.type === 'group') {
- child.addChildrenToStorage(storage);
- }
- }
- }
- /**
- * @function LevelRenderer.Group.prototype.delChildrenFromStorage
- * @description 从仓库把子图形删除。
- * @param {LevelRenderer.Storage} storage - 图形仓库。
- */
- delChildrenFromStorage(storage) {
- for (var i = 0; i < this._children.length; i++) {
- var child = this._children[i];
- storage.delFromMap(child.id);
- if (child.type === 'group') {
- child.delChildrenFromStorage(storage);
- }
- }
- }
- /**
- * @function LevelRenderer.Group.prototype.modSelf
- * @description 是否修改。
- */
- modSelf() {
- this.__dirty = true;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Storage.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @private
- * @class LevelRenderer.Storage
- * @category Visualization Theme
- * @classdesc 内容(图像)仓库 (M) 。
- */
- class Storage {
- constructor() {
- /**
- * @member {Object} LevelRenderer.Storage.prototype._elements
- * @description 所有常规形状,id 索引的 map。
- */
- this._elements = {};
- /**
- * @member {Array} LevelRenderer.Storage.prototype._hoverElements
- * @description 高亮层形状,不稳定,动态增删,数组位置也是 z 轴方向,靠前显示在下方。
- *
- */
- this._hoverElements = [];
- /**
- * @member {Array} LevelRenderer.Storage.prototype._roots
- * @description _roots。
- *
- */
- this._roots = [];
- /**
- * @member {Array} LevelRenderer.Storage.prototype._shapeList
- * @description _shapeList。
- *
- */
- this._shapeList = [];
- /**
- * @member {number} LevelRenderer.Storage.prototype._shapeListOffset
- * @description _shapeListOffset。默认值:0。
- *
- */
- this._shapeListOffset = 0;
- this.CLASS_NAME = "SuperMap.LevelRenderer.Storage";
- }
- /**
- * @function LevelRenderer.Storage.prototype.destroy
- * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
- */
- destroy() {
- this.dispose();
- this._shapeList = null;
- this._shapeListOffset = null;
- }
- /**
- * @function LevelRenderer.Storage.prototype.iterShape
- * @description 遍历迭代器。
- *
- * @param {function} fun - 迭代回调函数,return true终止迭代。
- * @param {Object} option - 迭代参数,缺省为仅降序遍历普通层图形。
- * @param {boolean} [hover=true] - 是否是高亮层图形。
- * @param {string} [normal='down'] - 是否是普通层图形,迭代时是否指定及z轴顺序。可设值:'down' ,'up'。
- * @param {boolean} [update=false] - 是否在迭代前更新形状列表。
- * @return {LevelRenderer.Storage} this。
- */
- iterShape(fun, option) {
- if (!option) {
- var defaultIterateOption = {
- hover: false,
- normal: 'down',
- update: false
- };
- option = defaultIterateOption;
- }
- if (option.hover) {
- // 高亮层数据遍历
- for (var i = 0, l = this._hoverElements.length; i < l; i++) {
- var el = this._hoverElements[i];
- el.updateTransform();
- if (fun(el)) {
- return this;
- }
- }
- }
- if (option.update) {
- this.updateShapeList();
- }
- // 遍历: 'down' | 'up'
- switch (option.normal) {
- case 'down':
- {
- // 降序遍历,高层优先
- let l = this._shapeList.length;
- while (l--) {
- if (fun(this._shapeList[l])) {
- return this;
- }
- }
- break;
- }
- // case 'up':
- default:
- {
- // 升序遍历,底层优先
- for (let i = 0, l = this._shapeList.length; i < l; i++) {
- if (fun(this._shapeList[i])) {
- return this;
- }
- }
- break;
- }
- }
- return this;
- }
- /**
- * @function LevelRenderer.Storage.prototype.getHoverShapes
- * @param {boolean} [update=false] - 是否在返回前更新图形的变换。
- * @return {Array.<LevelRenderer.Shape>} 图形数组。
- */
- getHoverShapes(update) {
- // hoverConnect
- var hoverElements = [], len = this._hoverElements.length;
- for (let i = 0; i < len; i++) {
- hoverElements.push(this._hoverElements[i]);
- var target = this._hoverElements[i].hoverConnect;
- if (target) {
- var shape;
- target = target instanceof Array ? target : [target];
- for (var j = 0, k = target.length; j < k; j++) {
- shape = target[j].id ? target[j] : this.get(target[j]);
- if (shape) {
- hoverElements.push(shape);
- }
- }
- }
- }
- hoverElements.sort(Storage.shapeCompareFunc);
- if (update) {
- for (let i = 0, l = hoverElements.length; i < l; i++) {
- hoverElements[i].updateTransform();
- }
- }
- return hoverElements;
- }
- /**
- * @function LevelRenderer.Storage.prototype.getShapeList
- * @description 返回所有图形的绘制队列。
- *
- * @param {boolean} [update=false] - 是否在返回前更新该数组。 详见:<LevelRenderer.Shape> updateShapeList。
- * @return {LevelRenderer.Shape} 图形。
- */
- getShapeList(update) {
- if (update) {
- this.updateShapeList();
- }
- return this._shapeList;
- }
- /**
- * @function LevelRenderer.Storage.prototype.updateShapeList
- * @description 更新图形的绘制队列。每次绘制前都会调用,该方法会先深度优先遍历整个树,更新所有Group和Shape的变换并且把所有可见的Shape保存到数组中,最后根据绘制的优先级(zlevel > z > 插入顺序)排序得到绘制队列。
- */
- updateShapeList() {
- this._shapeListOffset = 0;
- var rootsLen = this._roots.length;
- for (let i = 0; i < rootsLen; i++) {
- let root = this._roots[i];
- this._updateAndAddShape(root);
- }
- this._shapeList.length = this._shapeListOffset;
- var shapeListLen = this._shapeList.length;
- for (let i = 0; i < shapeListLen; i++) {
- this._shapeList[i].__renderidx = i;
- }
- this._shapeList.sort(Storage.shapeCompareFunc);
- }
- /**
- * @function LevelRenderer.Storage.prototype._updateAndAddShape
- * @description 更新并添加图形。
- *
- */
- _updateAndAddShape(el, clipShapes) {
- if (el.ignore) {
- return;
- }
- el.updateTransform();
- if (el.type == 'group') {
- if (el.clipShape) {
- // clipShape 的变换是基于 group 的变换
- el.clipShape.parent = el;
- el.clipShape.updateTransform();
- // PENDING 效率影响
- if (clipShapes) {
- clipShapes = clipShapes.slice();
- clipShapes.push(el.clipShape);
- } else {
- clipShapes = [el.clipShape];
- }
- }
- for (var i = 0; i < el._children.length; i++) {
- var child = el._children[i];
- // Force to mark as dirty if group is dirty
- child.__dirty = el.__dirty || child.__dirty;
- this._updateAndAddShape(child, clipShapes);
- }
- // Mark group clean here
- el.__dirty = false;
- } else {
- el.__clipShapes = clipShapes;
- this._shapeList[this._shapeListOffset++] = el;
- }
- }
- /**
- * @function LevelRenderer.Storage.prototype.mod
- * @description 修改图形(Shape)或者组(Group)。
- *
- * @param {string} elId - 唯一标识。
- * @param {Object} params - 参数。
- * @return {LevelRenderer.Storage} this。
- */
- mod(elId, params) {
- var el = this._elements[elId];
- if (el) {
- el.modSelf();
- if (params) {
- // 如果第二个参数直接使用 shape
- // parent, _storage, __startClip 三个属性会有循环引用
- // 主要为了向 1.x 版本兼容,2.x 版本不建议使用第二个参数
- if (params.parent || params._storage || params.__startClip) {
- var target = {};
- for (var name in params) {
- if (
- name == 'parent'
- || name == '_storage'
- || name == '__startClip'
- ) {
- continue;
- }
- if (params.hasOwnProperty(name)) {
- target[name] = params[name];
- }
- }
- new Util_Util().merge(el, target, true);
- } else {
- new Util_Util().merge(el, params, true);
- }
- }
- }
- return this;
- }
- /**
- * @function LevelRenderer.Storage.prototype.drift
- * @description 移动指定的图形(Shape)的位置。
- * @param {string} shapeId - 唯一标识。
- * @param {number} dx
- * @param {number} dy
- * @return {LevelRenderer.Storage} this。
- */
- drift(shapeId, dx, dy) {
- var shape = this._elements[shapeId];
- if (shape) {
- shape.needTransform = true;
- if (shape.draggable === 'horizontal') {
- dy = 0;
- } else if (shape.draggable === 'vertical') {
- dx = 0;
- }
- if (!shape.ondrift // ondrift
- // 有onbrush并且调用执行返回false或undefined则继续
- || (shape.ondrift && !shape.ondrift(dx, dy))
- ) {
- shape.drift(dx, dy);
- }
- }
- return this;
- }
- /**
- * @function LevelRenderer.Storage.prototype.addHover
- * @description 添加高亮层数据。
- * @param {LevelRenderer.Shape} shape - 图形。
- * @return {LevelRenderer.Storage} this。
- */
- addHover(shape) {
- shape.updateNeedTransform();
- this._hoverElements.push(shape);
- return this;
- }
- /**
- * @function LevelRenderer.Storage.prototype.delHover
- * @description 清空高亮层数据。
- * @return {LevelRenderer.Storage} this。
- */
- delHover() {
- this._hoverElements = [];
- return this;
- }
- /**
- * @function LevelRenderer.Storage.prototype.hasHoverShape
- * @description 是否有图形在高亮层里。
- * @return {boolean} 是否有图形在高亮层里。
- */
- hasHoverShape() {
- return this._hoverElements.length > 0;
- }
- /**
- * @function LevelRenderer.Storage.prototype.addRoot
- * @description 添加图形(Shape)或者组(Group)到根节点。
- *
- * @param {(LevelRenderer.Shape/LevelRenderer.Group)} el - 图形。
- *
- */
- addRoot(el) {
- if (el instanceof Group) {
- el.addChildrenToStorage(this);
- }
- this.addToMap(el);
- this._roots.push(el);
- }
- /**
- * @function LevelRenderer.Storage.prototype.delRoot
- * @description 删除指定的图形(Shape)或者组(Group)。
- *
- * @param {Array.<string>} elId - 删除图形(Shape)或者组(Group)的 id 数组。如果为空清空整个Storage。
- *
- */
- delRoot(elId) {
- if (typeof(elId) == 'undefined') {
- // 不指定elId清空
- for (var i = 0; i < this._roots.length; i++) {
- var root = this._roots[i];
- if (root instanceof Group) {
- root.delChildrenFromStorage(this);
- }
- }
- this._elements = {};
- this._hoverElements = [];
- this._roots = [];
- return;
- }
- if (elId instanceof Array) {
- var elIdLen = elId.length;
- for (let i = 0; i < elIdLen; i++) {
- this.delRoot(elId[i]);
- }
- return;
- }
- var el;
- if (typeof(elId) == 'string') {
- el = this._elements[elId];
- } else {
- el = elId;
- }
- var idx = new Util_Util().indexOf(this._roots, el);
- if (idx >= 0) {
- this.delFromMap(el.id);
- this._roots.splice(idx, 1);
- if (el instanceof Group) {
- el.delChildrenFromStorage(this);
- }
- }
- }
- /**
- * @function LevelRenderer.Storage.prototype.addToMap
- * @description 添加图形到 map。
- *
- * @param {LevelRenderer.Shape} el - 图形。
- * @return {LevelRenderer.Storage} this。
- */
- addToMap(el) {
- if (el instanceof Group) {
- el._storage = this;
- }
- el.modSelf();
- this._elements[el.id] = el;
- return this;
- }
- /**
- * @function LevelRenderer.Storage.prototype.get
- * @description 获取指定图形。
- *
- * @param {string} elId - 图形 id。
- * @return {LevelRenderer.Shape} 图形。
- */
- get(elId) {
- return this._elements[elId];
- }
- /**
- * @function LevelRenderer.Storage.prototype.delFromMap
- * @description 从 map 中删除指定图形。
- *
- * @param {string} elId - 图形id。
- * @return {LevelRenderer.Storage} this。
- */
- delFromMap(elId) {
- var el = this._elements[elId];
- if (el) {
- delete this._elements[elId];
- if (el instanceof Group) {
- el._storage = null;
- }
- }
- return this;
- }
- /**
- * @function LevelRenderer.Storage.prototype.dispose
- * @description 清空并且释放 Storage。
- */
- dispose() {
- this._elements = null;
- // this._renderList = null;
- this._roots = null;
- this._hoverElements = null;
- }
- static shapeCompareFunc(a, b) {
- if (a.zlevel == b.zlevel) {
- if (a.z == b.z) {
- return a.__renderidx - b.__renderidx;
- }
- return a.z - b.z;
- }
- return a.zlevel - b.zlevel;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Painter.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @private
- * @class LevelRenderer.Painter
- * @category Visualization Theme
- * @classdesc Painter 绘图模块。
- * @param {HTMLElement} root - 绘图区域(DIV)。
- * @param {LevelRenderer.Storage} storage - Storage 实例。
- */
- class Painter {
- constructor(root, storage) {
- /**
- * @member {HTMLElement} LevelRenderer.Painter.prototype.root
- * @description 绘图容器。
- *
- */
- this.root = root;
- /**
- * @member {Array} LevelRenderer.Painter.prototype.storage
- * @description 图形仓库。
- *
- */
- this.storage = storage;
- /**
- * @member {HTMLElement} LevelRenderer.Painter.prototype._domRoot
- * @description 容器根 dom 对象。
- *
- */
- this._domRoot = null;
- /**
- * @member {Object} LevelRenderer.Painter.prototype._layers
- * @description 绘制层对象。
- *
- */
- this._layers = {};
- /**
- * @member {Array} LevelRenderer.Painter.prototype._zlevelList
- * @description 层列表。
- *
- */
- this._zlevelList = [];
- /**
- * @member {Object} LevelRenderer.Painter.prototype._layerConfig
- * @description 绘制层配置对象。
- *
- */
- this._layerConfig = {};
- /**
- * @member {Object} LevelRenderer.Painter.prototype._bgDom
- * @description 背景层 Canvas (Dom)。
- *
- */
- this._bgDom = null;
- /**
- * @member {function} LevelRenderer.Painter.prototype.shapeToImage
- * @description 形状转图像函数。
- *
- */
- this.shapeToImage = null;
- // retina 屏幕优化
- Painter.devicePixelRatio = Math.max((window.devicePixelRatio || 1), 1);
- this.CLASS_NAME = "SuperMap.LevelRenderer.Painter";
- this.root.innerHTML = '';
- this._width = this._getWidth(); // 宽,缓存记录
- this._height = this._getHeight(); // 高,缓存记录
- var domRoot = document.createElement('div');
- this._domRoot = domRoot;
- // domRoot.onselectstart = returnFalse; // 避免页面选中的尴尬
- domRoot.style.position = 'relative';
- domRoot.style.overflow = 'hidden';
- domRoot.style.width = this._width + 'px';
- domRoot.style.height = this._height + 'px';
- this.root.appendChild(domRoot);
- this.shapeToImage = this._createShapeToImageProcessor();
- // 创建各层canvas
- // 背景
- //this._bgDom = Painter.createDom('bg', 'div', this);
- this._bgDom = Painter.createDom(Util.createUniqueID("SuperMap.Theme_background_"), 'div', this);
- domRoot.appendChild(this._bgDom);
- this._bgDom.onselectstart = returnFalse;
- this._bgDom.style['-webkit-user-select'] = 'none';
- this._bgDom.style['user-select'] = 'none';
- this._bgDom.style['-webkit-touch-callout'] = 'none';
- // 高亮
- //var hoverLayer = new PaintLayer('_hoverLayer_', this);
- var hoverLayer = new PaintLayer(Util.createUniqueID("_highLightLayer_"), this);
- this._layers['hover'] = hoverLayer;
- domRoot.appendChild(hoverLayer.dom);
- hoverLayer.initContext();
- hoverLayer.dom.onselectstart = returnFalse;
- hoverLayer.dom.style['-webkit-user-select'] = 'none';
- hoverLayer.dom.style['user-select'] = 'none';
- hoverLayer.dom.style['-webkit-touch-callout'] = 'none';
- var me = this;
- this.updatePainter = function (shapeList, callback) {
- me.refreshShapes(shapeList, callback);
- };
- // 返回false的方法,用于避免页面被选中
- function returnFalse() {
- return false;
- }
- /* eslint-disable */
- // 什么都不干的空方法
- function doNothing() { //NOSONAR
- }
- /* eslint-enable */
- }
- /**
- * @function LevelRenderer.Painter.prototype.destroy
- * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
- */
- destroy() {
- this.dispose();
- this._zlevelList = null;
- this._layerConfig = null;
- this._bgDom = null;
- this.shapeToImage = null;
- }
- /**
- * @function LevelRenderer.Painter.prototype.render
- * @description 渲染。首次绘图,创建各种 dom 和 context。
- *
- * @param {function} callback - 绘画结束后的回调函数。
- * @return {LevelRenderer.Painter} this。
- */
- render(callback) {
- // TODO
- this.refresh(callback, true);
- return this;
- }
- /**
- * @function LevelRenderer.Painter.prototype.refresh
- * @description 刷新。
- *
- * @param {function} callback - 刷新结束后的回调函数。
- * @param {boolean} paintAll - 强制绘制所有 shape。
- * @return {LevelRenderer.Painter} this。
- */
- refresh(callback, paintAll) {
- var list = this.storage.getShapeList(true);
- this._paintList(list, paintAll);
- if (typeof callback == 'function') {
- callback();
- }
- return this;
- }
- /**
- * Method: _paintList
- * 按列表绘制图形。
- */
- _paintList(list, paintAll) {
- if (typeof(paintAll) == 'undefined') {
- paintAll = false;
- }
- this._updateLayerStatus(list);
- var currentLayer;
- var currentZLevel;
- var ctx;
- for (var id in this._layers) {
- if (id !== 'hover') {
- this._layers[id].unusedCount++;
- this._layers[id].updateTransform();
- }
- }
- var invTransform = [];
- for (var i = 0, l = list.length; i < l; i++) {
- var shape = list[i];
- if (currentZLevel !== shape.zlevel) {
- if (currentLayer && currentLayer.needTransform) {
- ctx.restore();
- }
- currentLayer = this.getLayer(shape.zlevel);
- ctx = currentLayer.ctx;
- currentZLevel = shape.zlevel;
- // Reset the count
- currentLayer.unusedCount = 0;
- if (currentLayer.dirty || paintAll) {
- currentLayer.clear();
- }
- if (currentLayer.needTransform) {
- ctx.save();
- currentLayer.setTransform(ctx);
- }
- }
- // Start group clipping
- if (ctx && shape.__startClip) {
- var clipShape = shape.__startClip;
- ctx.save();
- // Set transform
- if (clipShape.needTransform) {
- let m = clipShape.transform;
- SUtil_SUtil.Util_matrix.invert(invTransform, m);
- ctx.transform(
- m[0], m[1],
- m[2], m[3],
- m[4], m[5]
- );
- }
- ctx.beginPath();
- clipShape.buildPath(ctx, clipShape.style);
- ctx.clip();
- // Transform back
- if (clipShape.needTransform) {
- let m = invTransform;
- ctx.transform(
- m[0], m[1],
- m[2], m[3],
- m[4], m[5]
- );
- }
- }
- if (((currentLayer && currentLayer.dirty) || paintAll) && !shape.invisible) {
- if (
- !shape.onbrush
- || (shape.onbrush && !shape.onbrush(ctx, false))
- ) {
- if (Config.catchBrushException) {
- try {
- shape.brush(ctx, false, this.updatePainter);
- } catch (error) {
- SUtil_SUtil.Util_log(
- error,
- 'brush error of ' + shape.type,
- shape
- );
- }
- } else {
- shape.brush(ctx, false, this.updatePainter);
- }
- }
- }
- // Stop group clipping
- if (ctx && shape.__stopClip) {
- ctx.restore();
- }
- shape.__dirty = false;
- }
- if (ctx && currentLayer && currentLayer.needTransform) {
- ctx.restore();
- }
- for (let id in this._layers) {
- if (id !== 'hover') {
- var layer = this._layers[id];
- layer.dirty = false;
- // 删除过期的层
- // PENDING
- // if (layer.unusedCount >= 500) {
- // this.delLayer(id);
- // }
- if (layer.unusedCount == 1) {
- layer.clear();
- }
- }
- }
- }
- /**
- * @function LevelRenderer.Painter.prototype.getLayer
- * @description 获取 zlevel 所在层,如果不存在则会创建一个新的层。
- *
- * @param {number} zlevel - zlevel。
- * @return {LevelRenderer.Painter} this。
- */
- getLayer(zlevel) {
- // Change draw layer
- var currentLayer = this._layers[zlevel];
- if (!currentLayer) {
- var len = this._zlevelList.length;
- var prevLayer = null;
- var i = -1;
- if (len > 0 && zlevel > this._zlevelList[0]) {
- for (i = 0; i < len - 1; i++) {
- if (
- this._zlevelList[i] < zlevel
- && this._zlevelList[i + 1] > zlevel
- ) {
- break;
- }
- }
- prevLayer = this._layers[this._zlevelList[i]];
- }
- this._zlevelList.splice(i + 1, 0, zlevel);
- // Create a new layer
- //currentLayer = new PaintLayer(zlevel, this);
- currentLayer = new PaintLayer(Util.createUniqueID("_levelLayer_" + zlevel), this);
- var prevDom = prevLayer ? prevLayer.dom : this._bgDom;
- if (prevDom.nextSibling) {
- prevDom.parentNode.insertBefore(
- currentLayer.dom,
- prevDom.nextSibling
- );
- } else {
- prevDom.parentNode.appendChild(
- currentLayer.dom
- );
- }
- currentLayer.initContext();
- this._layers[zlevel] = currentLayer;
- if (this._layerConfig[zlevel]) {
- new Util_Util().merge(currentLayer, this._layerConfig[zlevel], true);
- }
- currentLayer.updateTransform();
- }
- return currentLayer;
- }
- /**
- * @function LevelRenderer.Painter.prototype.getLayers
- * @description 获取所有已创建的层。
- * @return {Array.<Painter.Layer>} 已创建的层
- */
- getLayers() {
- return this._layers;
- }
- /**
- * Method: _updateLayerStatus
- * 更新绘制层状态。
- */
- _updateLayerStatus(list) {
- var layers = this._layers;
- var elCounts = {};
- for (let z in layers) {
- if (z !== 'hover') {
- elCounts[z] = layers[z].elCount;
- layers[z].elCount = 0;
- }
- }
- for (let i = 0; i < list.length; i++) {
- var shape = list[i];
- var zlevel = shape.zlevel;
- var layer = layers[zlevel];
- if (layer) {
- layer.elCount++;
- // 已经被标记为需要刷新
- if (layer.dirty) {
- continue;
- }
- layer.dirty = shape.__dirty;
- }
- }
- // 层中的元素数量有发生变化
- for (let z in layers) {
- if (z !== 'hover') {
- if (elCounts[z] !== layers[z].elCount) {
- layers[z].dirty = true;
- }
- }
- }
- }
- /**
- * @function LevelRenderer.Painter.prototype.refreshShapes
- * @description 更新的图形元素列表。
- *
- * @param {number} shapeList - 需要更新的图形元素列表。
- * @param {number} callback - 视图更新后回调函数。
- * @return {LevelRenderer.Painter} this。
- */
- refreshShapes(shapeList, callback) {
- for (var i = 0, l = shapeList.length; i < l; i++) {
- var shape = shapeList[i];
- this.storage.mod(shape.id);
- }
- this.refresh(callback);
- return this;
- }
- /**
- * @function LevelRenderer.Painter.prototype.clear
- * @description 清除 hover 层外所有内容。
- * @return {LevelRenderer.Painter} this。
- */
- clear() {
- for (var k in this._layers) {
- if (k == 'hover') {
- continue;
- }
- this._layers[k].clear();
- }
- return this;
- }
- /**
- * @function LevelRenderer.Painter.prototype.modLayer
- * @description 修改指定 zlevel 的绘制参数。
- *
- * @param {string} zlevel - zlevel。
- * @param {Object} config - 配置对象。
- * @param {string} [config.clearColor=0] - 每次清空画布的颜色。
- * @param {boolean} [config.motionBlur=false] - 是否开启动态模糊。
- * @param {number} [config.lastFrameAlpha=0.7] - 在开启动态模糊的时候使用,与上一帧混合的alpha值,值越大尾迹越明显。默认值:0.7。
- * @param {Array.<number>} config.position - 层的平移。
- * @param {Array.<number>} config.rotation - 层的旋转。
- * @param {Array.<number>} config.scale - 层的缩放。
- * @param {boolean} config.zoomable - 层是否支持鼠标缩放操作。默认值:false。
- * @param {boolean} config.panable - 层是否支持鼠标平移操作。默认值:false。
- *
- */
- modLayer(zlevel, config) {
- if (config) {
- if (!this._layerConfig[zlevel]) {
- this._layerConfig[zlevel] = config;
- } else {
- new Util_Util().merge(this._layerConfig[zlevel], config, true);
- }
- var layer = this._layers[zlevel];
- if (layer) {
- new Util_Util().merge(layer, this._layerConfig[zlevel], true);
- }
- }
- }
- /**
- * @function LevelRenderer.Painter.prototype.delLayer
- * @description 删除指定层。
- *
- * @param {string} zlevel - 层所在的 zlevel。
- */
- delLayer(zlevel) {
- var layer = this._layers[zlevel];
- if (!layer) {
- return;
- }
- // Save config
- this.modLayer(zlevel, {
- position: layer.position,
- rotation: layer.rotation,
- scale: layer.scale
- });
- layer.dom.parentNode.removeChild(layer.dom);
- delete this._layers[zlevel];
- this._zlevelList.splice(new Util_Util().indexOf(this._zlevelList, zlevel), 1);
- }
- /**
- * @function LevelRenderer.Painter.prototype.refreshHover
- * @description 刷新 hover 层。
- * @return {LevelRenderer.Painter} this。
- */
- refreshHover() {
- this.clearHover();
- var list = this.storage.getHoverShapes(true);
- for (var i = 0, l = list.length; i < l; i++) {
- this._brushHover(list[i]);
- }
- this.storage.delHover();
- return this;
- }
- /**
- * @function LevelRenderer.Painter.prototype.clearHover
- * @description 清除 hover 层所有内容。
- * @return {LevelRenderer.Painter} this。
- */
- clearHover() {
- var hover = this._layers.hover;
- hover && hover.clear();
- return this;
- }
- /**
- * @function LevelRenderer.Painter.prototype.resize
- * @description 区域大小变化后重绘。
- * @return {LevelRenderer.Painter} this。
- */
- resize() {
- var domRoot = this._domRoot;
- domRoot.style.display = 'none';
- var width = this._getWidth();
- var height = this._getHeight();
- domRoot.style.display = '';
- // 优化没有实际改变的resize
- if (this._width != width || height != this._height) {
- this._width = width;
- this._height = height;
- domRoot.style.width = width + 'px';
- domRoot.style.height = height + 'px';
- for (var id in this._layers) {
- this._layers[id].resize(width, height);
- }
- this.refresh(null, true);
- }
- return this;
- }
- /**
- * @function LevelRenderer.Painter.prototype.clearLayer
- * @description 清除指定的一个层。
- * @param {number} zLevel - 层。
- */
- clearLayer(zLevel) {
- var layer = this._layers[zLevel];
- if (layer) {
- layer.clear();
- }
- }
- /**
- * @function LevelRenderer.Painter.prototype.dispose
- * @description 释放。
- *
- */
- dispose() {
- this.root.innerHTML = '';
- this.root = null;
- this.storage = null;
- this._domRoot = null;
- this._layers = null;
- }
- /**
- * @function LevelRenderer.Painter.prototype.getDomHover
- * @description 获取 Hover 层的 Dom。
- */
- getDomHover() {
- return this._layers.hover.dom;
- }
- /**
- * @function LevelRenderer.Painter.prototype.toDataURL
- * @description 图像导出。
- * @param {string} type - 图片类型。
- * @param {string} backgroundColor - 背景色。默认值:'#fff'。
- * @param {Object} args
- * @return {string} 图片的Base64 url。
- */
- toDataURL(type, backgroundColor, args) {
- //var imageDom = Painter.createDom('image', 'canvas', this);
- var imageDom = Painter.createDom(Util.createUniqueID("SuperMap.Theme.image_"), 'canvas', this);
- this._bgDom.appendChild(imageDom);
- var ctx = imageDom.getContext('2d');
- Painter.devicePixelRatio != 1
- && ctx.scale(Painter.devicePixelRatio, Painter.devicePixelRatio);
- ctx.fillStyle = backgroundColor || '#fff';
- ctx.rect(
- 0, 0,
- this._width * Painter.devicePixelRatio,
- this._height * Painter.devicePixelRatio
- );
- ctx.fill();
- var self = this;
- // 升序遍历,shape上的zlevel指定绘画图层的z轴层叠
- this.storage.iterShape(
- function (shape) {
- if (!shape.invisible) {
- if (!shape.onbrush // 没有onbrush
- // 有onbrush并且调用执行返回false或undefined则继续粉刷
- || (shape.onbrush && !shape.onbrush(ctx, false))
- ) {
- if (Config.catchBrushException) {
- try {
- shape.brush(ctx, false, self.updatePainter);
- } catch (error) {
- SUtil_SUtil.Util_log(
- error,
- 'brush error of ' + shape.type,
- shape
- );
- }
- } else {
- shape.brush(ctx, false, self.updatePainter);
- }
- }
- }
- },
- {normal: 'up', update: true}
- );
- var image = imageDom.toDataURL(type, args);
- ctx = null;
- this._bgDom.removeChild(imageDom);
- return image;
- }
- /**
- * @function LevelRenderer.Painter.prototype.getWidth
- * @description 获取绘图区域宽度。
- * @return {number} 绘图区域宽度。
- */
- getWidth() {
- return this._width;
- }
- /**
- * @function LevelRenderer.Painter.prototype.getHeight
- * @description 获取绘图区域高度。
- * @return {number} 绘图区域高度。
- */
- getHeight() {
- return this._height;
- }
- /**
- * Method: _getWidth
- *
- */
- _getWidth() {
- var root = this.root;
- var stl = root.currentStyle
- || document.defaultView.getComputedStyle(root);
- return ((root.clientWidth || parseInt(stl.width, 10))
- - parseInt(stl.paddingLeft, 10) // 请原谅我这比较粗暴
- - parseInt(stl.paddingRight, 10)).toFixed(0) - 0;
- }
- /**
- * Method: _getHeight
- *
- */
- _getHeight() {
- var root = this.root;
- var stl = root.currentStyle
- || document.defaultView.getComputedStyle(root);
- return ((root.clientHeight || parseInt(stl.height, 10))
- - parseInt(stl.paddingTop, 10) // 请原谅我这比较粗暴
- - parseInt(stl.paddingBottom, 10)).toFixed(0) - 0;
- }
- /**
- * Method: _brushHover
- *
- */
- _brushHover(shape) {
- var ctx = this._layers.hover.ctx;
- if (!shape.onbrush // 没有onbrush
- // 有onbrush并且调用执行返回false或undefined则继续粉刷
- || (shape.onbrush && !shape.onbrush(ctx, true))
- ) {
- var layer = this.getLayer(shape.zlevel);
- if (layer.needTransform) {
- ctx.save();
- layer.setTransform(ctx);
- }
- // Retina 优化
- if (Config.catchBrushException) {
- try {
- shape.brush(ctx, true, this.updatePainter);
- } catch (error) {
- SUtil_SUtil.Util_log(
- error, 'hoverBrush error of ' + shape.type, shape
- );
- }
- } else {
- shape.brush(ctx, true, this.updatePainter);
- }
- if (layer.needTransform) {
- ctx.restore();
- }
- }
- }
- /**
- * Method: _shapeToImage
- *
- */
- _shapeToImage(id, shape, width, height, devicePixelRatio) {
- var canvas = document.createElement('canvas');
- var ctx = canvas.getContext('2d');
- var _devicePixelRatio = devicePixelRatio || window.devicePixelRatio || 1;
- canvas.style.width = width + 'px';
- canvas.style.height = height + 'px';
- canvas.setAttribute('width', width * _devicePixelRatio);
- canvas.setAttribute('height', height * _devicePixelRatio);
- ctx.clearRect(0, 0, width * _devicePixelRatio, height * _devicePixelRatio);
- var shapeTransform = {
- position: shape.position,
- rotation: shape.rotation,
- scale: shape.scale
- };
- shape.position = [0, 0, 0];
- shape.rotation = 0;
- shape.scale = [1, 1];
- if (shape) {
- shape.brush(ctx, false);
- }
- var imgShape = new SmicImage({
- id: id,
- style: {
- x: 0,
- y: 0,
- image: canvas
- }
- });
- if (shapeTransform.position != null) {
- imgShape.position = shape.position = shapeTransform.position;
- }
- if (shapeTransform.rotation != null) {
- imgShape.rotation = shape.rotation = shapeTransform.rotation;
- }
- if (shapeTransform.scale != null) {
- imgShape.scale = shape.scale = shapeTransform.scale;
- }
- return imgShape;
- }
- /**
- * Method: _createShapeToImageProcessor
- *
- */
- _createShapeToImageProcessor() {
- var me = this;
- return function (id, e, width, height) {
- return me._shapeToImage(
- id, e, width, height, Painter.devicePixelRatio
- );
- };
- }
- // SMIC-方法扩展 - start
- /**
- * @function LevelRenderer.Painter.prototype.updateHoverLayer
- * @description 更新设置显示高亮图层。
- * @param {Array} shapes - 图形数组。
- */
- updateHoverLayer(shapes) {
- if (!(shapes instanceof Array)) {
- return this;
- }
- //清除高亮
- this.clearHover();
- this.storage.delHover();
- for (var i = 0; i < shapes.length; i++) {
- this.storage.addHover(shapes[i]);
- this._brushHover(shapes[i]);
- }
- }
- /**
- * @function LevelRenderer.Painter.prototype.createDom
- * @description 创建 Dom。
- *
- * @param {string} id - Dom id
- * @param {string} type - Dom type
- * @param {LevelRenderer.Painter} painter - Painter 实例。
- * @return {Object} Dom
- */
- static createDom(id, type, painter) {
- var newDom = document.createElement(type);
- var width = painter._width;
- var height = painter._height;
- // 没append呢,请原谅我这样写,清晰~
- newDom.style.position = 'absolute';
- newDom.style.left = 0;
- newDom.style.top = 0;
- newDom.style.width = width + 'px';
- newDom.style.height = height + 'px';
- newDom.setAttribute('width', width * Painter.devicePixelRatio);
- newDom.setAttribute('height', height * Painter.devicePixelRatio);
- // id不作为索引用,避免可能造成的重名,定义为私有属性
- //newDom.setAttribute('data-zr-dom-id', id);
- newDom.setAttribute('id', id);
- return newDom;
- }
- }
- /**
- * @private
- * @class Painter.Layer
- * @classdesc 绘制层类。
- * @extends LevelRenderer.Transformable
- */
- class PaintLayer extends Transformable {
- /**
- * @function Painter.Layer.constructor
- * @description 构造函数。
- *
- * @param {string} id - id。
- * @param {LevelRenderer.Painter} painter - Painter 实例。
- *
- */
- constructor(id, painter) {
- super(id, painter);
- /**
- * @member {Object} Painter.Layer.prototype.dom
- * @description dom。
- */
- this.dom = null;
- /**
- * @member {Object} Painter.Layer.prototype.domBack
- * @description domBack。
- */
- this.domBack = null;
- /**
- * @member {Object} Painter.Layer.prototype.ctxBack
- * @description ctxBack。
- */
- this.ctxBack = null;
- /**
- * @member {LevelRenderer.Painter} Painter.Layer.prototype.painter
- * @description painter。
- */
- this.painter = painter;
- /**
- * @member {number} Painter.Layer.prototype.unusedCount
- * @description unusedCount。
- */
- this.unusedCount = 0;
- /**
- * @member {Object} Painter.Layer.prototype.config
- * @description config。
- */
- this.config = null;
- /**
- * @member {boolean} Painter.Layer.prototype.dirty
- * @description dirty。
- */
- this.dirty = true;
- /**
- * @member {number} Painter.Layer.prototype.elCount
- * @description elCount。
- */
- this.elCount = 0;
- // Configs
- /**
- * @member {string} Painter.Layer.prototype.clearColor
- * @description 每次清空画布的颜色。默认值:0;
- */
- this.clearColor = 0;
- /**
- * @member {boolean} Painter.Layer.prototype.motionBlur
- * @description 是否开启动态模糊。默认值:false;
- */
- this.motionBlur = false;
- /**
- * @member {number} Painter.Layer.prototype.lastFrameAlpha
- * @description 在开启动态模糊的时候使用,与上一帧混合的alpha值,值越大尾迹越明显
- */
- this.lastFrameAlpha = 0.7;
- /**
- * @member {boolean} Painter.Layer.prototype.zoomable
- * @description 层是否支持鼠标平移操作。默认值:false;
- */
- this.zoomable = false;
- /**
- * @member {boolean} Painter.Layer.prototype.panable
- * @description 层是否支持鼠标缩放操作。默认值:false;
- */
- this.panable = false;
- /**
- * @member {number} Painter.Layer.prototype.maxZoom
- * @description maxZoom。默认值:Infinity。
- */
- this.maxZoom = Infinity;
- /**
- * @member {number} Painter.Layer.prototype.minZoom
- * @description minZoom。默认值:0。
- */
- this.minZoom = 0;
- /**
- * @member {number} Painter.Layer.prototype.ctx
- * @description Canvas 上下文。
- */
- this.ctx = null;
- this.dom = Painter.createDom(Util.createUniqueID("SuperMap.Theme" + id), 'canvas', painter);
- this.dom.onselectstart = returnFalse; // 避免页面选中的尴尬
- this.dom.style['-webkit-user-select'] = 'none';
- this.dom.style['user-select'] = 'none';
- this.dom.style['-webkit-touch-callout'] = 'none';
- // Function
- // 返回false的方法,用于避免页面被选中
- function returnFalse() {
- return false;
- }
- this.CLASS_NAME = "SuperMap.LevelRenderer.Painter.Layer";
- }
- /**
- * @function Painter.Layer.prototype.destroy
- * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
- */
- destroy() {
- this.dom = null;
- this.domBack = null;
- this.ctxBack = null;
- this.painter = null;
- this.unusedCount = null;
- this.config = null;
- this.dirty = null;
- this.elCount = null;
- this.clearColor = null;
- this.motionBlur = null;
- this.lastFrameAlpha = null;
- this.zoomable = null;
- this.panable = null;
- this.maxZoom = null;
- this.minZoom = null;
- this.ctx = null;
- Transformable.destroy.apply(this, arguments);
- }
- /**
- * @function Painter.Layer.prototype.initContext
- * @description 初始化 Canvan 2D 上下文。
- */
- initContext() {
- this.ctx = this.dom.getContext('2d');
- if (Painter.devicePixelRatio != 1) {
- this.ctx.scale(Painter.devicePixelRatio, Painter.devicePixelRatio);
- }
- }
- /**
- * @function Painter.Layer.prototype.createBackBuffer
- * @description 创建备份缓冲。
- */
- createBackBuffer() {
- this.domBack = Painter.createDom(Util.createUniqueID("SuperMap.Theme.back-" + this.id), 'canvas', this.painter);
- this.ctxBack = this.domBack.getContext('2d');
- if (Painter.devicePixelRatio != 1) {
- this.ctxBack.scale(Painter.devicePixelRatio, Painter.devicePixelRatio);
- }
- }
- /**
- * @function Painter.Layer.prototype.resize
- * @description 改变大小。
- *
- * @param {number} width - 宽。
- * @param {number} height - 高。
- */
- resize(width, height) {
- this.dom.style.width = width + 'px';
- this.dom.style.height = height + 'px';
- this.dom.setAttribute('width', width * Painter.devicePixelRatio);
- this.dom.setAttribute('height', height * Painter.devicePixelRatio);
- if (Painter.devicePixelRatio != 1) {
- this.ctx.scale(Painter.devicePixelRatio, Painter.devicePixelRatio);
- }
- if (this.domBack) {
- this.domBack.setAttribute('width', width * Painter.devicePixelRatio);
- this.domBack.setAttribute('height', height * Painter.devicePixelRatio);
- if (Painter.devicePixelRatio != 1) {
- this.ctxBack.scale(Painter.devicePixelRatio, Painter.devicePixelRatio);
- }
- }
- }
- /**
- * @function Painter.Layer.prototype.clear
- * @description 清空该层画布。
- */
- clear() {
- var dom = this.dom;
- var ctx = this.ctx;
- var width = dom.width;
- var height = dom.height;
- var haveClearColor = this.clearColor;
- var haveMotionBLur = this.motionBlur;
- var lastFrameAlpha = this.lastFrameAlpha;
- if (haveMotionBLur) {
- if (!this.domBack) {
- this.createBackBuffer();
- }
- this.ctxBack.globalCompositeOperation = 'copy';
- this.ctxBack.drawImage(
- dom, 0, 0,
- width / Painter.devicePixelRatio,
- height / Painter.devicePixelRatio
- );
- }
- if (haveClearColor) {
- ctx.save();
- ctx.fillStyle = this.config.clearColor;
- ctx.fillRect(
- 0, 0,
- width / Painter.devicePixelRatio,
- height / Painter.devicePixelRatio
- );
- ctx.restore();
- } else {
- ctx.clearRect(
- 0, 0,
- width / Painter.devicePixelRatio,
- height / Painter.devicePixelRatio
- );
- }
- if (haveMotionBLur) {
- var domBack = this.domBack;
- ctx.save();
- ctx.globalAlpha = lastFrameAlpha;
- ctx.drawImage(
- domBack, 0, 0,
- width / Painter.devicePixelRatio,
- height / Painter.devicePixelRatio
- );
- ctx.restore();
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Handler.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @private
- * @class LevelRenderer.Handler
- * @category Visualization Theme
- * @classdesc Handler控制模块。
- * @extends {LevelRenderer.Eventful}
- * @param {HTMLElement} root - 绘图区域。
- * @param {LevelRenderer.Storage} storage - Storage 实例。
- * @param {LevelRenderer.Painter} painter - Painter 实例。
- */
- class Handler extends Eventful {
- constructor(root, storage, painter) {
- super(root, storage, painter);
- /**
- * @member {HTMLElement} LevelRenderer.Handler.prototype.root
- * @description 绘图区域
- */
- this.root = root;
- /**
- * @member {LevelRenderer.Storage} LevelRenderer.Handler.prototype.storage
- * @description Storage 实例
- */
- this.storage = storage;
- /**
- * @member {LevelRenderer.Painter} LevelRenderer.Handler.prototype.Painter
- * @description Painter 实例
- */
- this.painter = painter;
- /**
- * @member {number} [LevelRenderer.Handler.prototype._lastX=0]
- * @description 上一次鼠标位置x坐标值
- */
- this._lastX = 0;
- /**
- * @member {number} [LevelRenderer.Handler.prototype._lastY=0]
- * @description 上一次鼠标位置y坐标值
- */
- this._lastY = 0;
- /**
- * @member {number} [LevelRenderer.Handler.prototype._mouseX=0]
- * @description 当前鼠标位置x坐标值
- */
- this._mouseX = 0;
- /**
- * @member {number} [LevelRenderer.Handler.prototype._mouseY=0]
- * @description 当前鼠标位置y坐标值
- */
- this._mouseY = 0;
- /**
- * @member {function} LevelRenderer.Handler.prototype._findHover
- * @description 查找 Hover 图形
- */
- this._findHover = null;
- /**
- * @member {Object} LevelRenderer.Handler.prototype._domHover
- * @description 高亮 DOM
- */
- this._domHover = null;
- // 各种事件标识的私有变量
- // this._hasfound = false; // 是否找到 hover 图形元素
- // this._lastHover = null; // 最后一个 hover 图形元素
- // this._mouseDownTarget = null;
- // this._draggingTarget = null; // 当前被拖拽的图形元素
- // this._isMouseDown = false;
- // this._isDragging = false;
- // this._lastMouseDownMoment;
- // this._lastTouchMoment;
- // this._lastDownButton;
- this._findHover = bind3Arg(findHover, this);
- this._domHover = painter.getDomHover();
- this.CLASS_NAME = "SuperMap.LevelRenderer.Handler";
- var domHandlers = {
- /**
- * Method: resize
- * 窗口大小改变响应函数。
- *
- * Parameters:
- * event - {Event} event。
- *
- */
- resize: function (event) {
- event = event || window.event;
- this._lastHover = null;
- this._isMouseDown = 0;
- // 分发SuperMap.LevelRenderer.Config.EVENT.RESIZE事件,global
- this.dispatch(Config.EVENT.RESIZE, event);
- },
- /**
- * Method: click
- * 点击响应函数。
- *
- * Parameters:
- * event - {Event} event。
- *
- */
- click: function (event) {
- event = this._zrenderEventFixed(event);
- // 分发SuperMap.LevelRenderer.Config.EVENT.CLICK事件
- var _lastHover = this._lastHover;
- if ((_lastHover && _lastHover.clickable)
- || !_lastHover
- ) {
- // 判断没有发生拖拽才触发click事件
- if (this._clickThreshold < 10) {
- this._dispatchAgency(_lastHover, Config.EVENT.CLICK, event);
- }
- }
- this._mousemoveHandler(event);
- },
- /**
- * Method: dblclick
- * 双击响应函数。
- *
- * Parameters:
- * event - {Event} event。
- *
- */
- dblclick: function (event) {
- event = event || window.event;
- event = this._zrenderEventFixed(event);
- // 分发SuperMap.LevelRenderer.Config.EVENT.DBLCLICK事件
- var _lastHover = this._lastHover;
- if ((_lastHover && _lastHover.clickable)
- || !_lastHover
- ) {
- // 判断没有发生拖拽才触发dblclick事件
- if (this._clickThreshold < 5) {
- this._dispatchAgency(_lastHover, Config.EVENT.DBLCLICK, event);
- }
- }
- this._mousemoveHandler(event);
- },
- /**
- * Method: mousewheel
- * 鼠标滚轮响应函数。
- *
- * Parameters:
- * event - {Event} event。
- *
- */
- mousewheel: function (event) {
- event = this._zrenderEventFixed(event);
- // http://www.sitepoint.com/html5-javascript-mouse-wheel/
- // https://developer.mozilla.org/en-US/docs/DOM/DOM_event_reference/mousewheel
- var delta = event.wheelDelta // Webkit
- || -event.detail; // Firefox
- var scale = delta > 0 ? 1.1 : 1 / 1.1;
- var layers = this.painter.getLayers();
- var needsRefresh = false;
- for (var z in layers) {
- if (z !== 'hover') {
- var layer = layers[z];
- var pos = layer.position;
- if (layer.zoomable) {
- layer.__zoom = layer.__zoom || 1;
- var newZoom = layer.__zoom;
- newZoom *= scale;
- newZoom = Math.max(
- Math.min(layer.maxZoom, newZoom),
- layer.minZoom
- );
- scale = newZoom / layer.__zoom;
- layer.__zoom = newZoom;
- // Keep the mouse center when scaling
- pos[0] -= (this._mouseX - pos[0]) * (scale - 1);
- pos[1] -= (this._mouseY - pos[1]) * (scale - 1);
- layer.scale[0] *= scale;
- layer.scale[1] *= scale;
- layer.dirty = true;
- needsRefresh = true;
- }
- }
- }
- if (needsRefresh) {
- this.painter.refresh();
- }
- // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEWHEEL事件
- this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEWHEEL, event);
- this._mousemoveHandler(event);
- },
- /**
- * Method: mousemove
- * 鼠标(手指)移动响应函数。
- *
- * Parameters:
- * event - {Event} event。
- *
- */
- mousemove: function (event) {
- // 拖拽不触发click事件
- this._clickThreshold++;
- event = this._zrenderEventFixed(event);
- this._lastX = this._mouseX;
- this._lastY = this._mouseY;
- this._mouseX = SUtil_SUtil.Util_event.getX(event);
- this._mouseY = SUtil_SUtil.Util_event.getY(event);
- var dx = this._mouseX - this._lastX;
- var dy = this._mouseY - this._lastY;
- // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGSTART事件
- // 避免手抖点击误认为拖拽
- // if (this._mouseX - this._lastX > 1 || this._mouseY - this._lastY > 1) {
- this._processDragStart(event);
- // }
- this._hasfound = 0;
- this._event = event;
- this._iterateAndFindHover();
- // 找到的在迭代函数里做了处理,没找到得在迭代完后处理
- if (!this._hasfound) {
- // 过滤首次拖拽产生的mouseout和dragLeave
- if (!this._draggingTarget
- || (this._lastHover && this._lastHover != this._draggingTarget)
- ) {
- // 可能出现SuperMap.LevelRenderer.Config.EVENT.MOUSEOUT事件
- this._processOutShape(event);
- // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGLEAVE事件
- this._processDragLeave(event);
- }
- this._lastHover = null;
- this.storage.delHover();
- this.painter.clearHover();
- }
- // set cursor for root element
- var cursor = '';
- // 如果存在拖拽中元素,被拖拽的图形元素最后addHover
- if (this._draggingTarget) {
- this.storage.drift(this._draggingTarget.id, dx, dy);
- this._draggingTarget.modSelf();
- this.storage.addHover(this._draggingTarget);
- } else if (this._isMouseDown) {
- // Layer dragging
- var layers = this.painter.getLayers();
- var needsRefresh = false;
- for (var z in layers) {
- if (z !== 'hover') {
- var layer = layers[z];
- if (layer.panable) {
- // PENDING
- cursor = 'move';
- // Keep the mouse center when scaling
- layer.position[0] += dx;
- layer.position[1] += dy;
- needsRefresh = true;
- layer.dirty = true;
- }
- }
- }
- if (needsRefresh) {
- this.painter.refresh();
- }
- }
- if (this._draggingTarget || (this._hasfound && this._lastHover.draggable)) {
- cursor = 'move';
- } else if (this._hasfound && this._lastHover.clickable) {
- cursor = 'pointer';
- }
- this.root.style.cursor = cursor;
- // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEMOVE事件
- this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEMOVE, event);
- if (this._draggingTarget || this._hasfound || this.storage.hasHoverShape()) {
- this.painter.refreshHover();
- }
- },
- /**
- * Method: mouseout
- * 鼠标(手指)离开响应函数。
- *
- * Parameters:
- * event - {Event} event。
- *
- */
- mouseout: function (event) {
- event = this._zrenderEventFixed(event);
- var element = event.toElement || event.relatedTarget;
- if (element != this.root) {
- while (element && element.nodeType != 9) {
- // 忽略包含在root中的dom引起的mouseOut
- if (element == this.root) {
- this._mousemoveHandler(event);
- return;
- }
- element = element.parentNode;
- }
- }
- event.zrenderX = this._lastX;
- event.zrenderY = this._lastY;
- this.root.style.cursor = '';
- this._isMouseDown = 0;
- this._processOutShape(event);
- this._processDrop(event);
- this._processDragEnd(event);
- this.painter.refreshHover();
- this.dispatch(Config.EVENT.GLOBALOUT, event);
- },
- /**
- * Method: mousedown
- * 鼠标(手指)按下响应函数。
- *
- * Parameters:
- * event - {Event} event。
- *
- */
- mousedown: function (event) {
- // 重置 clickThreshold
- this._clickThreshold = 0;
- if (this._lastDownButton == 2) {
- this._lastDownButton = event.button;
- this._mouseDownTarget = null;
- // 仅作为关闭右键菜单使用
- return;
- }
- this._lastMouseDownMoment = new Date();
- event = this._zrenderEventFixed(event);
- this._isMouseDown = 1;
- // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEDOWN事件
- this._mouseDownTarget = this._lastHover;
- this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEDOWN, event);
- this._lastDownButton = event.button;
- },
- /**
- * Method: mouseup
- * 鼠标(手指)抬起响应函数。
- *
- * Parameters:
- * event - {Event} event。
- *
- */
- mouseup: function (event) {
- event = this._zrenderEventFixed(event);
- this.root.style.cursor = '';
- this._isMouseDown = 0;
- this._mouseDownTarget = null;
- // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEUP事件
- this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEUP, event);
- this._processDrop(event);
- this._processDragEnd(event);
- },
- /**
- * Method: touchstart
- * Touch 开始响应函数。
- *
- * Parameters:
- * event - {Event} event。
- *
- */
- touchstart: function (event) {
- // SUtil.Util_event.stop(event);// 阻止浏览器默认事件,重要
- event = this._zrenderEventFixed(event, true);
- this._lastTouchMoment = new Date();
- // 平板补充一次findHover
- this._mobildFindFixed(event);
- this._mousedownHandler(event);
- },
- /**
- * Method: touchmove
- * Touch 移动响应函数。
- *
- * Parameters:
- * event - {Event} event。
- *
- */
- touchmove: function (event) {
- event = this._zrenderEventFixed(event, true);
- this._mousemoveHandler(event);
- if (this._isDragging) {
- SUtil_SUtil.Util_event.stop(event);// 阻止浏览器默认事件,重要
- }
- },
- /**
- * Method: touchend
- * Touch 结束响应函数。
- *
- * Parameters:
- * event - {Event} event。
- *
- */
- touchend: function (event) {
- // SUtil.Util_event.stop(event);// 阻止浏览器默认事件,重要
- event = this._zrenderEventFixed(event, true);
- this._mouseupHandler(event);
- var now = new Date();
- if (now - this._lastTouchMoment < Config.EVENT.touchClickDelay) {
- this._mobildFindFixed(event);
- this._clickHandler(event);
- if (now - this._lastClickMoment < Config.EVENT.touchClickDelay / 2) {
- this._dblclickHandler(event);
- if (this._lastHover && this._lastHover.clickable) {
- SUtil_SUtil.Util_event.stop(event);// 阻止浏览器默认事件,重要
- }
- }
- this._lastClickMoment = now;
- }
- this.painter.clearHover();
- }
- };
- initDomHandler(this);
- // 初始化,事件绑定,支持的所有事件都由如下原生事件计算得来
- if (window.addEventListener) {
- window.addEventListener('resize', this._resizeHandler);
- if (SUtil_SUtil.Util_env.os.tablet || SUtil_SUtil.Util_env.os.phone) {
- // mobile支持
- root.addEventListener('touchstart', this._touchstartHandler);
- root.addEventListener('touchmove', this._touchmoveHandler);
- root.addEventListener('touchend', this._touchendHandler);
- } else {
- // mobile的click/move/up/down自己模拟
- root.addEventListener('click', this._clickHandler);
- root.addEventListener('dblclick', this._dblclickHandler);
- root.addEventListener('mousewheel', this._mousewheelHandler);
- root.addEventListener('mousemove', this._mousemoveHandler);
- root.addEventListener('mousedown', this._mousedownHandler);
- root.addEventListener('mouseup', this._mouseupHandler);
- }
- root.addEventListener('DOMMouseScroll', this._mousewheelHandler);
- root.addEventListener('mouseout', this._mouseoutHandler);
- } else {
- window.attachEvent('onresize', this._resizeHandler);
- root.attachEvent('onclick', this._clickHandler);
- //root.attachEvent('ondblclick ', this._dblclickHandler);
- root.ondblclick = this._dblclickHandler;
- root.attachEvent('onmousewheel', this._mousewheelHandler);
- root.attachEvent('onmousemove', this._mousemoveHandler);
- root.attachEvent('onmouseout', this._mouseoutHandler);
- root.attachEvent('onmousedown', this._mousedownHandler);
- root.attachEvent('onmouseup', this._mouseupHandler);
- }
- // 辅助函数 start
- /**
- * Method: bind1Arg
- * bind 一个参数的 function。
- *
- * Parameters:
- * handler - {function} 要 bind 的 function。
- * context - {Object} 运行时 this 环境。
- *
- * Returns:
- * {function}
- */
- function bind1Arg(handler, context) {
- return function (e) {
- return handler.call(context, e);
- };
- }
- /*
- // bind 两个参数的 function
- function bind2Arg(handler, context) {
- return function (arg1, arg2) {
- return handler.call(context, arg1, arg2);
- };
- }
- */
- // bind 三个参数的 function
- function bind3Arg(handler, context) {
- return function (arg1, arg2, arg3) {
- return handler.call(context, arg1, arg2, arg3);
- };
- }
- /**
- * Method: initDomHandler
- * 为控制类实例初始化 dom 事件处理函数。
- *
- * Parameters:
- * instance - {<LevelRenderer.Handler>} 控制类实例 。
- *
- * Returns:
- * {function}
- */
- function initDomHandler(instance) {
- var domHandlerNames = [
- 'resize', 'click', 'dblclick',
- 'mousewheel', 'mousemove', 'mouseout', 'mouseup', 'mousedown',
- 'touchstart', 'touchend', 'touchmove'
- ];
- var len = domHandlerNames.length;
- while (len--) {
- var name = domHandlerNames[len];
- instance['_' + name + 'Handler'] = bind1Arg(domHandlers[name], instance);
- }
- }
- /**
- * Method: findHover
- * 迭代函数,查找 hover 到的图形元素并即时做些事件分发。
- *
- * Parameters:
- * shape - {Object} 图形。
- * x - {number} 鼠标 x。
- * y - {number} 鼠标 y。
- *
- * Returns:
- * {boolean} 是否找到图形。
- *
- */
- function findHover(shape, x, y) {
- var me = this;
- if (
- (me._draggingTarget && me._draggingTarget.id == shape.id) // 迭代到当前拖拽的图形上
- || shape.isSilent() // 打酱油的路过,啥都不响应的shape~
- ) {
- return false;
- }
- var event = me._event;
- if (shape.isCover(x, y)) {
- if (shape.hoverable) {
- // SMIC-修改 - start
- if (shape.isHoverByRefDataID && shape.isHoverByRefDataID === true) {
- if (shape.refDataID) {
- var fid = shape.refDataID;
- //me.painter.clearHover();
- //me.storage.delHover();
- var hoverGroup = null;
- if (shape.refDataHoverGroup) {
- hoverGroup = shape.refDataHoverGroup;
- }
- //查找同一个用户数据 feature 的所有图形
- var shapeList = me.storage._shapeList;
- for (var i = 0, len = shapeList.length; i < len; i++) {
- var si = shapeList[i];
- if (si.refDataID && fid === si.refDataID) {
- if (hoverGroup) {
- if (si.refDataHoverGroup && hoverGroup === si.refDataHoverGroup) {
- me.storage.addHover(si);
- }
- } else {
- me.storage.addHover(si);
- }
- }
- }
- }
- } else {
- me.storage.addHover(shape);
- }
- //初始代码:
- // me.storage.addHover(shape);
- // SMIC-修改 - end
- }
- // 查找是否在 clipShape 中
- var p = shape.parent;
- while (p) {
- if (p.clipShape && !p.clipShape.isCover(me._mouseX, me._mouseY)) {
- // 已经被祖先 clip 掉了
- return false;
- }
- p = p.parent;
- }
- if (me._lastHover != shape) {
- me._processOutShape(event);
- // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGLEAVE事件
- me._processDragLeave(event);
- me._lastHover = shape;
- // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGENTER事件
- me._processDragEnter(event);
- }
- me._processOverShape(event);
- // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGOVER
- me._processDragOver(event);
- me._hasfound = 1;
- return true; // 找到则中断迭代查找
- }
- return false;
- }
- // 辅助函数 end
- }
- /**
- * @function LevelRenderer.Handler.prototype.destroy
- * @description 销毁对象,释放资源。调用此函数后所有属性将被置为null。
- */
- destroy() {
- this.dispose();
- this._lastX = null;
- this._lastY = null;
- this._mouseX = null;
- this._mouseY = null;
- this._findHover = null;
- Eventful.prototype.destroy.apply(this, arguments);
- }
- /**
- * @function LevelRenderer.Handler.prototype.on
- * @description 自定义事件绑定。
- * @param {string} eventName - 事件名称,resize、hover、drag等。
- * @param {function} handler - 响应函数。
- * @returns {LevelRenderer.Handler} this。
- */
- on(eventName, handler) {
- this.bind(eventName, handler);
- return this;
- }
- /**
- * @function LevelRenderer.Handler.prototype.un
- * @description 自定义事件解除绑定。
- * @param {string} eventName - 事件名称,resize、hover、drag等。
- * @param {function} handler - 响应函数。
- * @returns {LevelRenderer.Handler} this。
- */
- un(eventName, handler) {
- this.unbind(eventName, handler);
- return this;
- }
- /**
- * @function LevelRenderer.Handler.prototype.trigger
- * @description 事件触发。
- * @param {string} eventName - 事件名称,resize、hover、drag等。
- * @param {event} eventArgs - dom事件对象。
- */
- trigger(eventName, eventArgs) {
- var EVENT = Config.EVENT;
- switch (eventName) {
- case EVENT.RESIZE:
- case EVENT.CLICK:
- case EVENT.DBLCLICK:
- case EVENT.MOUSEWHEEL:
- case EVENT.MOUSEMOVE:
- case EVENT.MOUSEDOWN:
- case EVENT.MOUSEUP:
- case EVENT.MOUSEOUT:
- this['_' + eventName + 'Handler'](eventArgs);
- break;
- }
- }
- /**
- * @function LevelRenderer.Handler.prototype.dispose
- * @description 释放,解绑所有事件。
- */
- dispose() {
- var root = this.root;
- if (window.removeEventListener) {
- window.removeEventListener('resize', this._resizeHandler);
- if (SUtil_SUtil.Util_env.os.tablet || SUtil_SUtil.Util_env.os.phone) {
- // mobile支持
- root.removeEventListener('touchstart', this._touchstartHandler);
- root.removeEventListener('touchmove', this._touchmoveHandler);
- root.removeEventListener('touchend', this._touchendHandler);
- } else {
- // mobile的click自己模拟
- root.removeEventListener('click', this._clickHandler);
- root.removeEventListener('dblclick', this._dblclickHandler);
- root.removeEventListener('mousewheel', this._mousewheelHandler);
- root.removeEventListener('mousemove', this._mousemoveHandler);
- root.removeEventListener('mousedown', this._mousedownHandler);
- root.removeEventListener('mouseup', this._mouseupHandler);
- }
- root.removeEventListener('DOMMouseScroll', this._mousewheelHandler);
- root.removeEventListener('mouseout', this._mouseoutHandler);
- } else {
- window.detachEvent('onresize', this._resizeHandler);
- root.detachEvent('onclick', this._clickHandler);
- root.detachEvent('dblclick', this._dblclickHandler);
- root.detachEvent('onmousewheel', this._mousewheelHandler);
- root.detachEvent('onmousemove', this._mousemoveHandler);
- root.detachEvent('onmouseout', this._mouseoutHandler);
- root.detachEvent('onmousedown', this._mousedownHandler);
- root.detachEvent('onmouseup', this._mouseupHandler);
- }
- this.root = null;
- this._domHover = null;
- this.storage = null;
- this.painter = null;
- this.un();
- }
- /**
- * Method: _processDragStart
- * 拖拽开始。
- *
- * Parameters:
- * event - {Object} 事件对象。
- *
- */
- _processDragStart(event) {
- var _lastHover = this._lastHover;
- if (this._isMouseDown
- && _lastHover
- && _lastHover.draggable
- && !this._draggingTarget
- && this._mouseDownTarget == _lastHover
- ) {
- // 拖拽点击生效时长阀门,某些场景需要降低拖拽敏感度
- if (_lastHover.dragEnableTime &&
- new Date() - this._lastMouseDownMoment < _lastHover.dragEnableTime
- ) {
- return;
- }
- var _draggingTarget = _lastHover;
- this._draggingTarget = _draggingTarget;
- this._isDragging = 1;
- _draggingTarget.invisible = true;
- this.storage.mod(_draggingTarget.id);
- // 分发 Config.EVENT.DRAGSTART事件
- this._dispatchAgency(
- _draggingTarget,
- Config.EVENT.DRAGSTART,
- event
- );
- this.painter.refresh();
- }
- }
- /**
- * Method: _processDragEnter
- * 拖拽进入目标元素。
- *
- * Parameters:
- * event - {Object} 事件对象。
- *
- */
- _processDragEnter(event) {
- if (this._draggingTarget) {
- // 分发SuperMap.LevelRenderer.Config.EVENT.DRAGENTER事件
- this._dispatchAgency(
- this._lastHover,
- Config.EVENT.DRAGENTER,
- event,
- this._draggingTarget
- );
- }
- }
- /**
- * Method: _processDragOver
- * 拖拽在目标元素上移动。
- *
- * Parameters:
- * event - {Object} 事件对象。
- *
- */
- _processDragOver(event) {
- if (this._draggingTarget) {
- // 分发SuperMap.LevelRenderer.Config.EVENT.DRAGOVER事件
- this._dispatchAgency(
- this._lastHover,
- Config.EVENT.DRAGOVER,
- event,
- this._draggingTarget
- );
- }
- }
- /**
- * Method: _processDragLeave
- * 拖拽离开目标元素。
- *
- * Parameters:
- * event - {Object} 事件对象。
- *
- */
- _processDragLeave(event) {
- if (this._draggingTarget) {
- // 分发SuperMap.LevelRenderer.Config.EVENT.DRAGLEAVE事件
- this._dispatchAgency(
- this._lastHover,
- Config.EVENT.DRAGLEAVE,
- event,
- this._draggingTarget
- );
- }
- }
- /**
- * Method: _processDrop
- * 拖拽在目标元素上完成。
- *
- * Parameters:
- * event - {Object} 事件对象。
- *
- */
- _processDrop(event) {
- if (this._draggingTarget) {
- this._draggingTarget.invisible = false;
- this.storage.mod(this._draggingTarget.id);
- this.painter.refresh();
- // 分发SuperMap.LevelRenderer.Config.EVENT.DROP事件
- this._dispatchAgency(
- this._lastHover,
- Config.EVENT.DROP,
- event,
- this._draggingTarget
- );
- }
- }
- /**
- * Method: _processDragEnd
- * 拖拽结束。
- *
- * Parameters:
- * event - {Object} 事件对象。
- *
- */
- _processDragEnd(event) {
- if (this._draggingTarget) {
- // 分发SuperMap.LevelRenderer.Config.EVENT.DRAGEND事件
- this._dispatchAgency(
- this._draggingTarget,
- Config.EVENT.DRAGEND,
- event
- );
- this._lastHover = null;
- }
- this._isDragging = 0;
- this._draggingTarget = null;
- }
- /**
- * Method: _processOverShape
- * 鼠标在某个图形元素上移动。
- *
- * Parameters:
- * event - {Object} 事件对象。
- *
- */
- _processOverShape(event) {
- // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEOVER事件
- this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEOVER, event);
- }
- /**
- * Method: _processOutShape
- * 鼠标离开某个图形元素。
- *
- * Parameters:
- * event - {Object} 事件对象。
- *
- */
- _processOutShape(event) {
- // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEOUT事件
- this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEOUT, event);
- }
- /**
- * Method: _dispatchAgency
- * 鼠标离开某个图形元素。
- *
- * Parameters:
- * targetShape - {Object} 目标图形元素。
- * eventName - {Object} 事件名称。
- * event - {Object} 事件对象。
- * draggedShape - {Object} 拖拽事件特有,当前被拖拽图形元素。
- *
- */
- _dispatchAgency(targetShape, eventName, event, draggedShape) {
- var eventHandler = 'on' + eventName;
- var eventPacket = {
- type: eventName,
- event: event,
- target: targetShape,
- cancelBubble: false
- };
- var el = targetShape;
- if (draggedShape) {
- eventPacket.dragged = draggedShape;
- }
- while (el) {
- el[eventHandler]
- && (eventPacket.cancelBubble = el[eventHandler](eventPacket));
- el.dispatch(eventName, eventPacket);
- el = el.parent;
- if (eventPacket.cancelBubble) {
- break;
- }
- }
- if (targetShape) {
- // 冒泡到顶级 zrender 对象
- if (!eventPacket.cancelBubble) {
- this.dispatch(eventName, eventPacket);
- }
- } else if (!draggedShape) {
- // 无hover目标,无拖拽对象,原生事件分发
- this.dispatch(eventName, {
- type: eventName,
- event: event
- });
- }
- }
- /**
- * Method: _iterateAndFindHover
- * 迭代寻找 hover shape。
- *
- */
- _iterateAndFindHover() {
- var invTransform = SUtil_SUtil.Util_matrix.create();
- var list = this.storage.getShapeList();
- var currentZLevel;
- var currentLayer;
- var tmp = [0, 0];
- for (var i = list.length - 1; i >= 0; i--) {
- var shape = list[i];
- if (currentZLevel !== shape.zlevel) {
- currentLayer = this.painter.getLayer(shape.zlevel, currentLayer);
- tmp[0] = this._mouseX;
- tmp[1] = this._mouseY;
- if (currentLayer.needTransform) {
- SUtil_SUtil.Util_matrix.invert(invTransform, currentLayer.transform);
- SUtil_SUtil.Util_vector.applyTransform(tmp, tmp, invTransform);
- }
- }
- if (this._findHover(shape, tmp[0], tmp[1])) {
- break;
- }
- }
- }
- /**
- * Method: _mobildFindFixed
- * touch 有指尖错觉,四向尝试,让touch上的点击更好触发事件。
- *
- * Parameters:
- * event - {Object} 事件对象。
- *
- */
- _mobildFindFixed(event) {
- // touch指尖错觉的尝试偏移量配置
- var MOBILE_TOUCH_OFFSETS = [
- {x: 10},
- {x: -20},
- {x: 10, y: 10},
- {y: -20}
- ];
- this._lastHover = null;
- this._mouseX = event.zrenderX;
- this._mouseY = event.zrenderY;
- this._event = event;
- this._iterateAndFindHover();
- for (var i = 0; !this._lastHover && i < MOBILE_TOUCH_OFFSETS.length; i++) {
- var offset = MOBILE_TOUCH_OFFSETS[i];
- offset.x && (this._mouseX += offset.x);
- offset.y && (this._mouseX += offset.y);
- this._iterateAndFindHover();
- }
- if (this._lastHover) {
- event.zrenderX = this._mouseX;
- event.zrenderY = this._mouseY;
- }
- }
- /**
- * Method: _zrenderEventFixed
- * 如果存在第三方嵌入的一些dom触发的事件,或touch事件,需要转换一下事件坐标 。
- *
- * Parameters:
- * event - {Object} 事件。
- * isTouch - {boolean} 是否触摸。
- *
- */
- _zrenderEventFixed(event, isTouch) {
- if (event.zrenderFixed) {
- return event;
- }
- if (!isTouch) {
- event = event || window.event;
- // 进入对象优先~
- var target = event.toElement
- || event.relatedTarget
- || event.srcElement
- || event.target;
- if (target && target != this._domHover) {
- event.zrenderX = (typeof event.offsetX != 'undefined'
- ? event.offsetX
- : event.layerX)
- + target.offsetLeft;
- event.zrenderY = (typeof event.offsetY != 'undefined'
- ? event.offsetY
- : event.layerY)
- + target.offsetTop;
- }
- } else {
- var touch = event.type != 'touchend'
- ? event.targetTouches[0]
- : event.changedTouches[0];
- if (touch) {
- var rBounding = this.root.getBoundingClientRect();
- // touch事件坐标是全屏的~
- event.zrenderX = touch.clientX - rBounding.left;
- event.zrenderY = touch.clientY - rBounding.top;
- }
- }
- event.zrenderFixed = 1;
- return event;
- }
- // SMIC-方法扩展 - start
- /**
- * @function LevelRenderer.Handler.prototype.getLastHoverOne
- * @description 获取单个高亮图形
- */
- getLastHoverOne() {
- if (this._lastHover) {
- return this._lastHover;
- }
- return null;
- }
- // SMIC-方法扩展 - end
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Easing.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class LevelRenderer.Animation.easing
- * @category Visualization Theme
- * @classdesc 缓动
- * @private
- */
- // 缓动代码来自 https://github.com/sole/tween.js/blob/master/src/Tween.js
- // http://sole.github.io/tween.js/examples/03_graphs.html
- class Easing {
- constructor() {
- this.CLASS_NAME = "SuperMap.LevelRenderer.Animation.easing";
- }
- /**
- * @function LevelRenderer.Animation.easing.destroy
- * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
- */
- destroy() {
- }
- /**
- * @function LevelRenderer.Animation.easing.Linear
- * @description 线性缓动
- * @param {number} k - 参数
- * @return {number} 输入值
- */
- Linear(k) {
- return k;
- }
- /**
- * @function LevelRenderer.Animation.easing.QuadraticIn
- * @description 二次方的缓动(t^2)
- * @param {number} k - 参数
- * @return {number} 二次方的缓动的值
- */
- QuadraticIn(k) {
- return k * k;
- }
- /**
- * @function LevelRenderer.Animation.easing.QuadraticOut
- * @description 返回按二次方缓动退出的值
- * @param {number} k - 参数
- * @return {number} 按二次方缓动退出的值
- */
- QuadraticOut(k) {
- return k * (2 - k);
- }
- /**
- * @function LevelRenderer.Animation.easing.QuadraticInOut
- * @description 返回按二次方缓动进入和退出的值
- * @param {number} k - 参数
- * @return {number} 按二次方缓动进入和退出的值
- */
- QuadraticInOut(k) {
- if ((k *= 2) < 1) {
- return 0.5 * k * k;
- }
- return -0.5 * (--k * (k - 2) - 1);
- }
- /**
- * @function LevelRenderer.Animation.easing.CubicIn
- * @description 三次方的缓动(t^3)
- * @param {number} k - 参数
- * @return {number} 按三次方缓动的值
- */
- CubicIn(k) {
- return k * k * k;
- }
- /**
- * @function LevelRenderer.Animation.easing.CubicOut
- * @description 返回按三次方缓动退出的值
- * @param {number} k - 参数
- * @return {number} 按三次方缓动退出的值
- */
- CubicOut(k) {
- return --k * k * k + 1;
- }
- /**
- * @function LevelRenderer.Animation.easing.CubicInOut
- * @description 返回按三次方缓动进入退出的值
- * @param {number} k - 参数
- * @return {number} 按三次方缓动进入退出的值
- */
- CubicInOut(k) {
- if ((k *= 2) < 1) {
- return 0.5 * k * k * k;
- }
- return 0.5 * ((k -= 2) * k * k + 2);
- }
- /**
- * @function LevelRenderer.Animation.easing.QuarticIn
- * @description 返回按四次方缓动进入的值
- * @param {number} k - 参数
- * @return {number} 按四次方缓动进入的值
- */
- QuarticIn(k) {
- return k * k * k * k;
- }
- /**
- * @function LevelRenderer.Animation.easing.QuarticOut
- * @description 返回按四次方缓动退出的值
- * @param {number} k - 参数
- * @return {number} 按四次方缓动退出的值
- */
- QuarticOut(k) {
- return 1 - (--k * k * k * k);
- }
- /**
- * @function LevelRenderer.Animation.easing.QuarticInOut
- * @description 返回按四次方缓动进入退出的值
- * @param {number} k - 参数
- * @return {number} 按四次方缓动进入退出的值
- */
- QuarticInOut(k) {
- if ((k *= 2) < 1) {
- return 0.5 * k * k * k * k;
- }
- return -0.5 * ((k -= 2) * k * k * k - 2);
- }
- // 五次方的缓动(t^5)
- /**
- * @function LevelRenderer.Animation.easing.QuinticIn
- * @description 返回按五次方缓动的值
- * @param {number} k - 参数
- * @return {number} 按五次方缓动的值
- */
- QuinticIn(k) {
- return k * k * k * k * k;
- }
- /**
- * @function LevelRenderer.Animation.easing.QuinticOut
- * @description 返回按五次方缓动退出的值
- * @param {number} k - 参数
- * @return {number} 按五次方缓动退出的值
- */
- QuinticOut(k) {
- return --k * k * k * k * k + 1;
- }
- /**
- * @function LevelRenderer.Animation.easing.QuinticInOut
- * @description 返回按五次方缓动进入退出的值
- * @param {number} k - 参数
- * @return {number} 按五次方缓动进入退出的值
- */
- QuinticInOut(k) {
- if ((k *= 2) < 1) {
- return 0.5 * k * k * k * k * k;
- }
- return 0.5 * ((k -= 2) * k * k * k * k + 2);
- }
- // 正弦曲线的缓动(sin(t))
- /**
- * @function LevelRenderer.Animation.easing.SinusoidalIn
- * @description 返回按正弦曲线的缓动进入的值
- * @param {number} k - 参数
- * @return {number} 按正弦曲线的缓动进入的值
- */
- SinusoidalIn(k) {
- return 1 - Math.cos(k * Math.PI / 2);
- }
- /**
- * @function LevelRenderer.Animation.easing.SinusoidalOut
- * @description 返回按正弦曲线的缓动退出的值
- * @param {number} k - 参数
- * @return {number} 按正弦曲线的缓动退出的值
- */
- SinusoidalOut(k) {
- return Math.sin(k * Math.PI / 2);
- }
- /**
- * @function LevelRenderer.Animation.easing.SinusoidalInOut
- * @description 返回按正弦曲线的缓动进入退出的值
- * @param {number} k - 参数
- * @return {number} 按正弦曲线的缓动进入退出的值
- */
- SinusoidalInOut(k) {
- return 0.5 * (1 - Math.cos(Math.PI * k));
- }
- // 指数曲线的缓动(2^t)
- /**
- * @function LevelRenderer.Animation.easing.ExponentialIn
- * @description 返回按指数曲线的缓动进入的值
- * @param {number} k - 参数
- * @return {number} 按指数曲线的缓动进入的值
- */
- ExponentialIn(k) {
- return k === 0 ? 0 : Math.pow(1024, k - 1);
- }
- /**
- * @function LevelRenderer.Animation.easing.ExponentialOut
- * @description 返回按指数曲线的缓动退出的值
- * @param {number} k - 参数
- * @return {number} 按指数曲线的缓动退出的值
- */
- ExponentialOut(k) {
- return k === 1 ? 1 : 1 - Math.pow(2, -10 * k);
- }
- /**
- * @function LevelRenderer.Animation.easing.ExponentialInOut
- * @description 返回按指数曲线的缓动进入退出的值
- * @param {number} k - 参数
- * @return {number} 按指数曲线的缓动进入退出的值
- */
- ExponentialInOut(k) {
- if (k === 0) {
- return 0;
- }
- if (k === 1) {
- return 1;
- }
- if ((k *= 2) < 1) {
- return 0.5 * Math.pow(1024, k - 1);
- }
- return 0.5 * (-Math.pow(2, -10 * (k - 1)) + 2);
- }
- // 圆形曲线的缓动(sqrt(1-t^2))
- /**
- * @function LevelRenderer.Animation.easing.CircularIn
- * @description 返回按圆形曲线的缓动进入的值
- * @param {number} k - 参数
- * @return {number} 按圆形曲线的缓动进入的值
- */
- CircularIn(k) {
- return 1 - Math.sqrt(1 - k * k);
- }
- /**
- * @function LevelRenderer.Animation.easing.CircularOut
- * @description 返回按圆形曲线的缓动退出的值
- * @param {number} k - 参数
- * @return {number} 按圆形曲线的缓动退出的值
- */
- CircularOut(k) {
- return Math.sqrt(1 - (--k * k));
- }
- /**
- * @function LevelRenderer.Animation.easing.CircularInOut
- * @description 返回按圆形曲线的缓动进入退出的值
- * @param {number} k - 参数
- * @return {number} 按圆形曲线的缓动进入退出的值
- */
- CircularInOut(k) {
- if ((k *= 2) < 1) {
- return -0.5 * (Math.sqrt(1 - k * k) - 1);
- }
- return 0.5 * (Math.sqrt(1 - (k -= 2) * k) + 1);
- }
- // 创建类似于弹簧在停止前来回振荡的动画
- /**
- * @function LevelRenderer.Animation.easing.ElasticIn
- * @description 返回按类似于弹簧在停止前来回振荡的动画的缓动进入的值
- * @param {number} k - 参数
- * @return {number} 按类似于弹簧在停止前来回振荡的动画的缓动进入的值
- */
- ElasticIn(k) {
- var s;
- var a = 0.1;
- var p = 0.4;
- if (k === 0) {
- return 0;
- }
- if (k === 1) {
- return 1;
- }
- if (a < 1) {
- a = 1;
- s = p / 4;
- } else {
- s = p * Math.asin(1 / a) / (2 * Math.PI);
- }
- return -(a * Math.pow(2, 10 * (k -= 1)) *
- Math.sin((k - s) * (2 * Math.PI) / p));
- }
- /**
- * @function LevelRenderer.Animation.easing.ElasticOut
- * @description 返回按类似于弹簧在停止前来回振荡的动画的缓动退出的值
- * @param {number} k - 参数
- * @return {number} 按类似于弹簧在停止前来回振荡的动画的缓动退出的值
- */
- ElasticOut(k) {
- var s;
- var a = 0.1;
- var p = 0.4;
- if (k === 0) {
- return 0;
- }
- if (k === 1) {
- return 1;
- }
- if (a < 1) {
- a = 1;
- s = p / 4;
- } else {
- s = p * Math.asin(1 / a) / (2 * Math.PI);
- }
- return (a * Math.pow(2, -10 * k) *
- Math.sin((k - s) * (2 * Math.PI) / p) + 1);
- }
- /**
- * @function LevelRenderer.Animation.easing.ElasticInOut
- * @description 返回按类似于弹簧在停止前来回振荡的动画的缓动进入退出的值
- * @param {number} k - 参数
- * @return {number} 按类似于弹簧在停止前来回振荡的动画的缓动进入退出的值
- */
- ElasticInOut(k) {
- var s;
- var a = 0.1;
- var p = 0.4;
- if (k === 0) {
- return 0;
- }
- if (k === 1) {
- return 1;
- }
- if (a < 1) {
- a = 1;
- s = p / 4;
- } else {
- s = p * Math.asin(1 / a) / (2 * Math.PI);
- }
- if ((k *= 2) < 1) {
- return -0.5 * (a * Math.pow(2, 10 * (k -= 1))
- * Math.sin((k - s) * (2 * Math.PI) / p));
- }
- return a * Math.pow(2, -10 * (k -= 1))
- * Math.sin((k - s) * (2 * Math.PI) / p) * 0.5 + 1;
- }
- // 在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动
- /**
- * @function LevelRenderer.Animation.easing.BackIn
- * @description 返回按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动进入的值
- * @param {number} k - 参数
- * @return {number} 按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动进入的值
- */
- BackIn(k) {
- var s = 1.70158;
- return k * k * ((s + 1) * k - s);
- }
- /**
- * @function LevelRenderer.Animation.easing.BackOut
- * @description 返回按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动退出的值
- * @param {number} k - 参数
- * @return {number} 按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动退出的值
- */
- BackOut(k) {
- var s = 1.70158;
- return --k * k * ((s + 1) * k + s) + 1;
- }
- /**
- * @function LevelRenderer.Animation.easing.BackInOut
- * @description 返回按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动进入退出的值
- * @param {number} k - 参数
- * @return {number} 按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动进入退出的值
- */
- BackInOut(k) {
- var s = 1.70158 * 1.525;
- if ((k *= 2) < 1) {
- return 0.5 * (k * k * ((s + 1) * k - s));
- }
- return 0.5 * ((k -= 2) * k * ((s + 1) * k + s) + 2);
- }
- // 创建弹跳效果
- /**
- * @function LevelRenderer.Animation.easing.BounceIn
- * @description 返回按弹跳效果的缓动进入的值
- * @param {number} k - 参数
- * @return {number} 按弹跳效果的缓动进入的值
- */
- BounceIn(k) {
- return 1 - this.BounceOut(1 - k);
- }
- /**
- * @function LevelRenderer.Animation.easing.BounceOut
- * @description 返回按弹跳效果的缓动退出的值
- * @param {number} k - 参数
- * @return {number} 按弹跳效果的缓动退出的值
- */
- BounceOut(k) {
- if (k < (1 / 2.75)) {
- return 7.5625 * k * k;
- } else if (k < (2 / 2.75)) {
- return 7.5625 * (k -= (1.5 / 2.75)) * k + 0.75;
- } else if (k < (2.5 / 2.75)) {
- return 7.5625 * (k -= (2.25 / 2.75)) * k + 0.9375;
- } else {
- return 7.5625 * (k -= (2.625 / 2.75)) * k + 0.984375;
- }
- }
- /**
- * @function LevelRenderer.Animation.easing.BounceInOut
- * @description 返回按弹跳效果的缓动进入退出的值
- * @param {number} k - 参数
- * @return {number} 按弹跳效果的缓动进入退出的值
- */
- BounceInOut(k) {
- if (k < 0.5) {
- return this.BounceIn(k * 2) * 0.5;
- }
- return this.BounceOut(k * 2 - 1) * 0.5 + 0.5;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Clip.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class LevelRenderer.Animation.Clip
- * @category Visualization Theme
- * @classdesc 动画片段
- * @param {Object} options - 参数。
- * @param {Object} options.target - 动画对象,可以是数组,如果是数组的话会批量分发 onframe 等事件。
- * @param {number} [options.life=1000] - 动画时长。
- * @param {number} [options.delay=0] - 动画延迟时间。
- * @param {boolean} [options.loop=true] - 是否循环。
- * @param {number} [options.gap=0] - 循环的间隔时间。
- * @param {Object} options.onframe - 帧。
- * @param {boolean} options.easing - 是否消除。
- * @param {boolean} options.ondestroy - 是否销毁。
- * @param {boolean} options.onrestart - 是否重播。
- * @private
- */
- class Clip {
- constructor(options) {
- this._targetPool = options.target || {};
- if (!(this._targetPool instanceof Array)) {
- this._targetPool = [this._targetPool];
- }
- // 生命周期
- this._life = options.life || 1000;
- // 延时
- this._delay = options.delay || 0;
- // 开始时间
- this._startTime = new Date().getTime() + this._delay;// 单位毫秒
- // 结束时间
- this._endTime = this._startTime + this._life * 1000;
- // 是否循环
- this.loop = typeof options.loop == 'undefined'
- ? false : options.loop;
- this.gap = options.gap || 0;
- this.easing = options.easing || 'Linear';
- this.onframe = options.onframe;
- this.ondestroy = options.ondestroy;
- this.onrestart = options.onrestart;
- this.CLASS_NAME = "SuperMap.LevelRenderer.Animation.Clip";
- }
- /**
- * @function LevelRenderer.Animation.Clip.prototype.destroy
- * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
- */
- destroy() {
- }
- step(time) {
- var easing = new Easing();
- var percent = (time - this._startTime) / this._life;
- // 还没开始
- if (percent < 0) {
- return;
- }
- percent = Math.min(percent, 1);
- var easingFunc = typeof this.easing == 'string'
- ? easing[this.easing]
- : this.easing;
- var schedule = typeof easingFunc === 'function'
- ? easingFunc(percent)
- : percent;
- this.fire('frame', schedule);
- // 结束
- if (percent == 1) {
- if (this.loop) {
- this.restart();
- // 重新开始周期
- // 抛出而不是直接调用事件直到 stage.update 后再统一调用这些事件
- return 'restart';
- }
- // 动画完成将这个控制器标识为待删除
- // 在Animation.update中进行批量删除
- this._needsRemove = true;
- return 'destroy';
- }
- return null;
- }
- restart() {
- var time = new Date().getTime();
- var remainder = (time - this._startTime) % this._life;
- this._startTime = new Date().getTime() - remainder + this.gap;
- }
- fire(eventType, arg) {
- for (var i = 0, len = this._targetPool.length; i < len; i++) {
- if (this['on' + eventType]) {
- this['on' + eventType](this._targetPool[i], arg);
- }
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Animation.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class LevelRenderer.Animation
- * @classdesc 动画主类, 调度和管理所有动画控制器
- * @category Visualization Theme
- * @extends {LevelRenderer.Eventful}
- * @param {Object} options - 动画参数。
- * @param {Object} options.onframe - onframe。
- * @param {Object} options.stage - stage。
- * @example 例如:
- * (start code)
- * var animation = new LevelRenderer.Animation();
- * var obj = {
- * x: 100,
- * y: 100
- * };
- * animation.animate(node.position)
- * .when(1000, {
- * x: 500,
- * y: 500
- * })
- * .when(2000, {
- * x: 100,
- * y: 100
- * })
- * .start('spline');
- * (end)
- * @private
- */
- class Animation extends Eventful {
- constructor(options) {
- super(options);
- options = options || {};
- /**
- * @member {Object} LevelRenderer.Animation.prototype.stage
- * @description stage。
- */
- this.stage = {};
- /**
- * @member {Object} LevelRenderer.Animation.prototype.onframe
- * @description onframe。
- */
- this.onframe = function () {
- };
- /**
- * @member {Array} LevelRenderer.Animation.prototype._clips
- * @description _clips。
- */
- this._clips = [];
- /**
- * @member {boolean} LevelRenderer.Animation.prototype._running
- * @description _running。
- */
- this._running = false;
- /**
- * @member {number} LevelRenderer.Animation.prototype._time
- * @description _time。
- */
- this._time = 0;
- Util.extend(this, options);
- this.CLASS_NAME = "SuperMap.LevelRenderer.Animation";
- }
- /**
- * @function LevelRenderer.Animation.prototype.add
- * @description 添加动画片段。
- * @param {LevelRenderer.Animation.Clip} clip - 动画片段。
- */
- add(clip) {
- this._clips.push(clip);
- }
- /**
- * @function LevelRenderer.Animation.prototype.remove
- * @description 删除动画片段。
- * @param {LevelRenderer.Animation.Clip} clip - 动画片段。
- */
- remove(clip) {
- var idx = new Util_Util().indexOf(this._clips, clip);
- if (idx >= 0) {
- this._clips.splice(idx, 1);
- }
- }
- /**
- * @function LevelRenderer.Animation.prototype.update
- * @description 更新动画片段。
- */
- _update() {
- var time = new Date().getTime();
- var delta = time - this._time;
- var clips = this._clips;
- var len = clips.length;
- var deferredEvents = [];
- var deferredClips = [];
- for (let i = 0; i < len; i++) {
- var clip = clips[i];
- var e = clip.step(time);
- // Throw out the events need to be called after
- // stage.update, like destroy
- if (e) {
- deferredEvents.push(e);
- deferredClips.push(clip);
- }
- }
- if (this.stage.update) {
- this.stage.update();
- }
- // Remove the finished clip
- for (let i = 0; i < len;) {
- if (clips[i]._needsRemove) {
- clips[i] = clips[len - 1];
- clips.pop();
- len--;
- } else {
- i++;
- }
- }
- len = deferredEvents.length;
- for (let i = 0; i < len; i++) {
- deferredClips[i].fire(deferredEvents[i]);
- }
- this._time = time;
- this.onframe(delta);
- this.dispatch('frame', delta);
- }
- /**
- * @function LevelRenderer.Animation.prototype.start
- * @description 开始运行动画。
- */
- start() {
- var requestAnimationFrame = window.requestAnimationFrame
- || window.msRequestAnimationFrame
- || window.mozRequestAnimationFrame
- || window.webkitRequestAnimationFrame
- || function (func) {
- setTimeout(func, 16);
- };
- var self = this;
- this._running = true;
- function step() {
- if (self._running) {
- self._update();
- requestAnimationFrame(step);
- }
- }
- this._time = new Date().getTime();
- requestAnimationFrame(step);
- }
- /**
- * @function LevelRenderer.Animation.prototype.stop
- * @description 停止运行动画。
- */
- stop() {
- this._running = false;
- }
- /**
- * @function LevelRenderer.Animation.prototype.clear
- * @description 清除所有动画片段。
- */
- clear() {
- this._clips = [];
- }
- /**
- * @function LevelRenderer.Animation.prototype.animate
- * @description 对一个目标创建一个animator对象,可以指定目标中的属性使用动画。
- * @param {Object} target - 目标对象。
- * @param {Object} options - 动画参数选项。
- * @param {boolean} [options.loop=false] - 是否循环播放动画。
- * @param {function} [options.getter] - 如果指定getter函数,会通过getter函数取属性值。
- * @param {function} [options.setter] - 如果指定setter函数,会通过setter函数设置属性值。
- * @returns {LevelRenderer.Animation.Animator} Animator。
- */
- animate(target, options) {
- options = options || {};
- var deferred = new Animator(
- target,
- options.loop,
- options.getter,
- options.setter
- );
- deferred.animation = this;
- return deferred;
- }
- static _interpolateNumber(p0, p1, percent) {
- return (p1 - p0) * percent + p0;
- }
- static _interpolateArray(p0, p1, percent, out, arrDim) {
- var len = p0.length;
- if (arrDim == 1) {
- for (let i = 0; i < len; i++) {
- out[i] = Animation._interpolateNumber(p0[i], p1[i], percent);
- }
- } else {
- var len2 = p0[0].length;
- for (let i = 0; i < len; i++) {
- for (let j = 0; j < len2; j++) {
- out[i][j] = Animation._interpolateNumber(
- p0[i][j], p1[i][j], percent
- );
- }
- }
- }
- }
- static _isArrayLike(data) {
- switch (typeof data) {
- case 'undefined':
- case 'string':
- return false;
- }
- return typeof data.length !== 'undefined';
- }
- static _catmullRomInterpolateArray(p0, p1, p2, p3, t, t2, t3, out, arrDim) {
- var len = p0.length;
- if (arrDim == 1) {
- for (let i = 0; i < len; i++) {
- out[i] = Animation._catmullRomInterpolate(
- p0[i], p1[i], p2[i], p3[i], t, t2, t3
- );
- }
- } else {
- var len2 = p0[0].length;
- for (let i = 0; i < len; i++) {
- for (var j = 0; j < len2; j++) {
- out[i][j] = Animation._catmullRomInterpolate(
- p0[i][j], p1[i][j], p2[i][j], p3[i][j],
- t, t2, t3
- );
- }
- }
- }
- }
- static _catmullRomInterpolate(p0, p1, p2, p3, t, t2, t3) {
- var v0 = (p2 - p0) * 0.5;
- var v1 = (p3 - p1) * 0.5;
- return (2 * (p1 - p2) + v0 + v1) * t3
- + (-3 * (p1 - p2) - 2 * v0 - v1) * t2
- + v0 * t + p1;
- }
- static _cloneValue(value) {
- var arraySlice = Array.prototype.slice;
- if (Animation._isArrayLike(value)) {
- var len = value.length;
- if (Animation._isArrayLike(value[0])) {
- var ret = [];
- for (var i = 0; i < len; i++) {
- ret.push(arraySlice.call(value[i]));
- }
- return ret;
- } else {
- return arraySlice.call(value);
- }
- } else {
- return value;
- }
- }
- static rgba2String(rgba) {
- rgba[0] = Math.floor(rgba[0]);
- rgba[1] = Math.floor(rgba[1]);
- rgba[2] = Math.floor(rgba[2]);
- return 'rgba(' + rgba.join(',') + ')';
- }
- }
- /**
- * @class LevelRenderer.Animation.Animator
- */
- class Animator {
- /**
- * @function LevelRenderer.Animation.Animator.prototype.animate
- * @description 构造函数
- * @param {Object} target - 目标对象。
- * @param {Object} options - 动画参数选项。
- * @param {boolean} [loop=false] - 是否循环播放动画。
- * @param {function} [getterl] - 如果指定getter函数,会通过getter函数取属性值。
- * @param {function} [setter] - 如果指定setter函数,会通过setter函数设置属性值。
- */
- constructor(target, loop, getter, setter) {
- /**
- * @member {Object} LevelRenderer.Animation.Animator.prototype._tracks
- * @description _tracks。
- */
- this._tracks = {};
- /**
- * @member {Object} LevelRenderer.Animation.Animator.prototype._target
- * @description _target。
- */
- this._target = target;
- /**
- * @member {boolean} LevelRenderer.Animation.Animator.prototype._loop
- * @description _loop。
- */
- this._loop = loop || false;
- /**
- * @member {function} LevelRenderer.Animation.Animator.prototype._getter
- * @description _getter。
- */
- this._getter = getter || _defaultGetter;
- /**
- * @member {function} LevelRenderer.Animation.Animator.prototype._setter
- * @description _setter。
- */
- this._setter = setter || _defaultSetter;
- /**
- * @member {number} LevelRenderer.Animation.Animator.prototype._clipCount
- * @description _clipCount。
- */
- this._clipCount = 0;
- /**
- * @member {number} LevelRenderer.Animation.Animator.prototype._delay
- * @description _delay。
- */
- this._delay = 0;
- /**
- * @member {Array} LevelRenderer.Animation.Animator.prototype._doneList
- * @description _doneList。
- */
- this._doneList = [];
- /**
- * @member {Array} LevelRenderer.Animation.Animator.prototype._onframeList
- * @description _onframeList。
- */
- this._onframeList = [];
- /**
- * @member {Array} LevelRenderer.Animation.Animator.prototype._clipList
- * @description _clipList。
- */
- this._clipList = [];
- this.CLASS_NAME = "SuperMap.LevelRenderer.Animation.Animator";
- //Function
- function _defaultGetter(target, key) {
- return target[key];
- }
- function _defaultSetter(target, key, value) {
- target[key] = value;
- }
- }
- /**
- * @function LevelRenderer.Animation.Animator.prototype.when
- * @description 设置动画关键帧
- * @param {number} time - 关键帧时间,单位是ms
- * @param {Object} props - 关键帧的属性值,key-value表示
- * @returns {LevelRenderer.Animation.Animator} Animator
- */
- when(time /* ms */, props) {
- for (var propName in props) {
- if (!this._tracks[propName]) {
- this._tracks[propName] = [];
- // If time is 0
- // Then props is given initialize value
- // Else
- // Initialize value from current prop value
- if (time !== 0) {
- this._tracks[propName].push({
- time: 0,
- value: Animation._cloneValue(
- this._getter(this._target, propName)
- )
- });
- }
- }
- this._tracks[propName].push({
- time: parseInt(time, 10),
- value: props[propName]
- });
- }
- return this;
- }
- /**
- * @function LevelRenderer.Animation.Animator.prototype.during
- * @description 添加动画每一帧的回调函数
- * @param {RequestCallback} callback - 回调函数
- * @returns {LevelRenderer.Animation.Animator} Animator
- */
- during(callback) {
- this._onframeList.push(callback);
- return this;
- }
- /**
- * @function LevelRenderer.Animation.Animator.prototype.start
- * @description 开始执行动画
- * @param {(string|function)} easing - 动画缓动函数。详见:<{@link LevelRenderer.Animation.easing}>。
- * @returns {LevelRenderer.Animation.Animator} Animator
- */
- start(easing) {
- var self = this;
- var setter = this._setter;
- var getter = this._getter;
- var onFrameListLen = self._onframeList.length;
- var useSpline = easing === 'spline';
- var ondestroy = function () {
- self._clipCount--;
- if (self._clipCount === 0) {
- // Clear all tracks
- self._tracks = {};
- var len = self._doneList.length;
- for (var i = 0; i < len; i++) {
- self._doneList[i].call(self);
- }
- }
- };
- var createTrackClip = function (keyframes, propName) {
- var trackLen = keyframes.length;
- if (!trackLen) {
- return;
- }
- // Guess data type
- var firstVal = keyframes[0].value;
- var isValueArray = Animation._isArrayLike(firstVal);
- var isValueColor = false;
- // For vertices morphing
- var arrDim = (
- isValueArray
- && Animation._isArrayLike(firstVal[0])
- )
- ? 2 : 1;
- // Sort keyframe as ascending
- keyframes.sort(function (a, b) {
- return a.time - b.time;
- });
- var trackMaxTime = keyframes[trackLen - 1].time;
- // Percents of each keyframe
- var kfPercents = [];
- // Value of each keyframe
- var kfValues = [];
- for (let i = 0; i < trackLen; i++) {
- kfPercents.push(keyframes[i].time / trackMaxTime);
- // Assume value is a color when it is a string
- var value = keyframes[i].value;
- if (typeof(value) == 'string') {
- value = SUtil_SUtil.Util_color.toArray(value);
- if (value.length === 0) { // Invalid color
- value[0] = value[1] = value[2] = 0;
- value[3] = 1;
- }
- isValueColor = true;
- }
- kfValues.push(value);
- }
- // Cache the key of last frame to speed up when
- // animation playback is sequency
- var cacheKey = 0;
- var cachePercent = 0;
- var start;
- var i;
- var w;
- var p0;
- var p1;
- var p2;
- var p3;
- if (isValueColor) {
- var rgba = [0, 0, 0, 0];
- }
- var onframe = function (target, percent) {
- // Find the range keyframes
- // kf1-----kf2---------current--------kf3
- // find kf2 and kf3 and do interpolation
- if (percent < cachePercent) {
- // Start from next key
- start = Math.min(cacheKey + 1, trackLen - 1);
- for (i = start; i >= 0; i--) {
- if (kfPercents[i] <= percent) {
- break;
- }
- }
- i = Math.min(i, trackLen - 2);
- } else {
- for (i = cacheKey; i < trackLen; i++) {
- if (kfPercents[i] > percent) {
- break;
- }
- }
- i = Math.min(i - 1, trackLen - 2);
- }
- cacheKey = i;
- cachePercent = percent;
- var range = (kfPercents[i + 1] - kfPercents[i]);
- if (range === 0) {
- return;
- } else {
- w = (percent - kfPercents[i]) / range;
- }
- if (useSpline) {
- p1 = kfValues[i];
- p0 = kfValues[i === 0 ? i : i - 1];
- p2 = kfValues[i > trackLen - 2 ? trackLen - 1 : i + 1];
- p3 = kfValues[i > trackLen - 3 ? trackLen - 1 : i + 2];
- if (isValueArray) {
- Animation._catmullRomInterpolateArray(
- p0, p1, p2, p3, w, w * w, w * w * w,
- getter(target, propName),
- arrDim
- );
- } else {
- let value;
- if (isValueColor) {
- // value = LevelRenderer.Animation._catmullRomInterpolateArray(
- // p0, p1, p2, p3, w, w * w, w * w * w,
- // rgba, 1
- // );
- value = Animation.rgba2String(rgba);
- } else {
- value = Animation._catmullRomInterpolate(
- p0, p1, p2, p3, w, w * w, w * w * w
- );
- }
- setter(
- target,
- propName,
- value
- );
- }
- } else {
- if (isValueArray) {
- Animation._interpolateArray(
- kfValues[i], kfValues[i + 1], w,
- getter(target, propName),
- arrDim
- );
- } else {
- let value;
- if (isValueColor) {
- Animation._interpolateArray(
- kfValues[i], kfValues[i + 1], w,
- rgba, 1
- );
- value = Animation.rgba2String(rgba);
- } else {
- value = Animation._interpolateNumber(kfValues[i], kfValues[i + 1], w);
- }
- setter(
- target,
- propName,
- value
- );
- }
- }
- for (i = 0; i < onFrameListLen; i++) {
- self._onframeList[i](target, percent);
- }
- };
- var clip = new Clip({
- target: self._target,
- life: trackMaxTime,
- loop: self._loop,
- delay: self._delay,
- onframe: onframe,
- ondestroy: ondestroy
- });
- if (easing && easing !== 'spline') {
- clip.easing = easing;
- }
- self._clipList.push(clip);
- self._clipCount++;
- self.animation.add(clip);
- };
- for (var propName in this._tracks) {
- createTrackClip(this._tracks[propName], propName);
- }
- return this;
- }
- /**
- * @function LevelRenderer.Animation.Animator.prototype.stop
- * @description 停止动画
- */
- stop() {
- for (var i = 0; i < this._clipList.length; i++) {
- var clip = this._clipList[i];
- this.animation.remove(clip);
- }
- this._clipList = [];
- }
- /**
- * @function LevelRenderer.Animation.Animator.prototype.delay
- * @description 设置动画延迟开始的时间
- * @param {number} time - 时间,单位ms
- * @returns {LevelRenderer.Animation.Animator} Animator
- */
- delay(time) {
- this._delay = time;
- return this;
- }
- /**
- * @function LevelRenderer.Animation.Animator.prototype.done
- * @description 添加动画结束的回调
- * @param {function} cb - Function
- * @returns {LevelRenderer.Animation.Animator} Animator
- */
- done(cb) {
- if (cb) {
- this._doneList.push(cb);
- }
- return this;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Render.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
-
-
-
-
-
-
-
- /**
- * @private
- * @class LevelRenderer.Render
- * @category Visualization Theme
- * @classdesc Render 接口类,对外可用的所有接口都在这里。内部使用非 get 接口统一返回 this 对象,支持链式调用。
- * @param {string} id - 唯一标识。
- * @param {HTMLElement} dom - Dom 对象。
- */
- class Render {
- constructor(id, dom) {
- /**
- * @member {string} LevelRenderer.Render.prototype.id
- * @description 唯一标识。
- */
- this.id = id;
- /**
- * @member {LevelRenderer.Storage} LevelRenderer.Render.prototype.storage
- * @description 图形仓库对象。
- */
- this.storage = new Storage();
- /**
- * @member {LevelRenderer.Painter} LevelRenderer.Render.prototype.painter
- * @description 绘制器对象。
- *
- */
- this.painter = new Painter(dom, this.storage);
- /**
- * @member {LevelRenderer.Handler} LevelRenderer.Render.prototype.handler
- * @description 事件处理对象。
- *
- */
- this.handler = new Handler(dom, this.storage, this.painter);
- /**
- * @member {Array} LevelRenderer.Render.prototype.animatingElements
- * @description 动画控制数组。
- *
- */
- this.animatingElements = [];
- /**
- * @member {LevelRenderer.animation.Animation} LevelRenderer.Render.prototype.animation
- * @description 动画对象。
- *
- */
- this.animation = new Animation({
- stage: {
- update: Render.getFrameCallback(this)
- }
- });
- /**
- * @member {boolean} LevelRenderer.Render.prototype._needsRefreshNextFrame
- * @description 是否需要刷新下一帧。
- *
- */
- this._needsRefreshNextFrame = false;
- this.animation.start();
- this.CLASS_NAME = "SuperMap.LevelRenderer.Render";
- }
- /**
- * @function LevelRenderer.Render.prototype.destory
- * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
- */
- destroy() {
- this.id = null;
- this.storage = null;
- this.painter = null;
- this.handler = null;
- this.animatingElements = null;
- this.animation = null;
- this._needsRefreshNextFrame = null;
- }
- /**
- * @function LevelRenderer.Render.prototype.getId
- * @description 获取实例唯一标识。
- * @return {string} 实例唯一标识。
- */
- getId() {
- return this.id;
- }
- /**
- * @function LevelRenderer.Render.prototype.addShape
- * @description 添加图形形状到根节点。
- *
- * @param {LevelRenderer.Shape} shape - 图形对象,可用属性全集,详见各 shape。
- * @return {LevelRenderer.Render} this。
- */
- addShape(shape) {
- this.storage.addRoot(shape);
- return this;
- }
- /**
- * @function LevelRenderer.Render.prototype.addGroup
- * @description 添加组到根节点。
- *
- * (code)
- * //添加组到根节点例子
- * var render = new LevelRenderer.Render("Render",document.getElementById('lRendertest'));
- * render.clear();
- * var g = new LevelRenderer.Group();
- * g.addChild(new LevelRenderer.Shape.Circle({
- * style: {
- * x: 100,
- * y: 100,
- * r: 20,
- * brushType: 'fill'
- * }
- * }));
- * render.addGroup(g);
- * render.render();
- * (end)
- *
- * @param {LevelRenderer.Group} group - 组对象。
- * @return {LevelRenderer.Render} this。
- */
- addGroup(group) {
- this.storage.addRoot(group);
- return this;
- }
- /**
- * @function LevelRenderer.Render.prototype.delShape
- * @description 从根节点删除图形形状。
- *
- * @param {string} shapeId - 图形对象唯一标识。
- * @return {LevelRenderer.Render} this。
- */
- delShape(shapeId) {
- this.storage.delRoot(shapeId);
- return this;
- }
- /**
- * @function LevelRenderer.Render.prototype.delGroup
- * @description 从根节点删除组。
- *
- * @param {string} groupId - 组对象唯一标识。
- * @return {LevelRenderer.Render} this。
- */
- delGroup(groupId) {
- this.storage.delRoot(groupId);
- return this;
- }
- /**
- * @function LevelRenderer.Render.prototype.modShape
- * @description 修改图形形状。
- *
- * @param {string} shapeId - 图形对象唯一标识。
- * @param {LevelRenderer.Shape} shape - 图形对象。
- * @return {LevelRenderer.Render} this。
- */
- modShape(shapeId, shape) {
- this.storage.mod(shapeId, shape);
- return this;
- }
- /**
- * @function LevelRenderer.Render.prototype.modGroup
- * @description 修改组。
- *
- * @param {string} groupId - 组对象唯一标识。
- * @param {LevelRenderer.Group} group - 组对象。
- * @return {LevelRenderer.Render} this。
- */
- modGroup(groupId, group) {
- this.storage.mod(groupId, group);
- return this;
- }
- /**
- * @function LevelRenderer.Render.prototype.modLayer
- * @description 修改指定 zlevel 的绘制配置项。
- *
- * @param {string} zLevel - 组对象唯一标识。
- * @param {Object} config - 配置对象。
- * @param {string} clearColor - 每次清空画布的颜色。默认值:0。
- * @param {noolean} motionBlur - 是否开启动态模糊。默认值:false。
- * @param {number} lastFrameAlpha - 在开启动态模糊的时候使用,与上一帧混合的alpha值,值越大尾迹越明显。默认值:0.7。
- * @param {Array.<number>} position - 层的平移。
- * @param {Array.<number>} rotation - 层的旋转。
- * @param {Array.<number>} scale - 层的缩放。
- * @param {boolean} zoomable - 层是否支持鼠标缩放操作。默认值:false。
- * @param {boolean} panable - 层是否支持鼠标平移操作。默认值:false。
- * @return {LevelRenderer.Render} this。
- */
- modLayer(zLevel, config) {
- this.painter.modLayer(zLevel, config);
- return this;
- }
- /**
- * @function LevelRenderer.Render.prototype.addHoverShape
- * @description 添加额外高亮层显示,仅提供添加方法,每次刷新后高亮层图形均被清空。
- *
- * @param {LevelRenderer.Shape} shape - 图形对象。
- * @return {LevelRenderer.Render} this。
- */
- addHoverShape(shape) {
- this.storage.addHover(shape);
- return this;
- }
- /**
- * @function LevelRenderer.Render.prototype.render
- * @description 渲染。
- *
- * @callback {function} callback - 渲染结束后回调函数。
- * @return {LevelRenderer.Render} this。
- */
- render(callback) {
- this.painter.render(callback);
- this._needsRefreshNextFrame = false;
- return this;
- }
- /**
- * @function LevelRenderer.Render.prototype.refresh
- * @description 视图更新。
- *
- * @callback {function} callback - 视图更新后回调函数。
- * @return {LevelRenderer.Render} this。
- */
- refresh(callback) {
- this.painter.refresh(callback);
- this._needsRefreshNextFrame = false;
- return this;
- }
- /**
- * @function LevelRenderer.Render.prototype.refreshNextFrame
- * @description 标记视图在浏览器下一帧需要绘制。
- * @return {LevelRenderer.Render} this。
- */
- refreshNextFrame() {
- this._needsRefreshNextFrame = true;
- return this;
- }
- /**
- * @function LevelRenderer.Render.prototype.refreshHover
- * @description 绘制(视图更新)高亮层。
- * @callback {function} callback - 视图更新后回调函数。
- * @return {LevelRenderer.Render} this。
- */
- refreshHover(callback) {
- this.painter.refreshHover(callback);
- return this;
- }
- /**
- * @function LevelRenderer.Render.prototype.refreshShapes
- * @description 视图更新。
- *
- * @param {Array.<LevelRenderer.Shape>} shapeList - 需要更新的图形列表。
- * @callback {function} callback - 视图更新后回调函数。
- * @return {LevelRenderer.Render} this。
- */
- refreshShapes(shapeList, callback) {
- this.painter.refreshShapes(shapeList, callback);
- return this;
- }
- /**
- * @function LevelRenderer.Render.prototype.resize
- * @description 调整视图大小。
- * @return {LevelRenderer.Render} this。
- */
- resize() {
- this.painter.resize();
- return this;
- }
- /**
- * @function LevelRenderer.Render.prototype.animate
- * @description 动画。
- *
- * @example
- * zr.animate(circle.id, 'style', false)
- * .when(1000, {x: 10} )
- * .done(function(){ // Animation done })
- * .start()
- *
- *
- * @param {Array.<(LevelRenderer.Shape/LevelRenderer.Group)>} el - 动画对象。
- * @param {string} path - 需要添加动画的属性获取路径,可以通过 a.b.c 来获取深层的属性。若传入对象为<LevelRenderer.Group>,path需为空字符串。
- * @param {function} loop - 动画是否循环。
- * @return {LevelRenderer.animation.Animator} Animator。
- */
- animate(el, path, loop) {
- if (typeof(el) === 'string') {
- el = this.storage.get(el);
- }
- if (el) {
- var target;
- if (path) {
- var pathSplitted = path.split('.');
- var prop = el;
- for (var i = 0, l = pathSplitted.length; i < l; i++) {
- if (!prop) {
- continue;
- }
- prop = prop[pathSplitted[i]];
- }
- if (prop) {
- target = prop;
- }
- } else {
- target = el;
- }
- if (!target) {
- SUtil_SUtil.Util_log(
- 'Property "'
- + path
- + '" is not existed in element '
- + el.id
- );
- return;
- }
- var animatingElements = this.animatingElements;
- if (typeof el.__aniCount === 'undefined') {
- // 正在进行的动画记数
- el.__aniCount = 0;
- }
- if (el.__aniCount === 0) {
- animatingElements.push(el);
- }
- el.__aniCount++;
- return this.animation.animate(target, {loop: loop})
- .done(function () {
- el.__aniCount--;
- if (el.__aniCount === 0) {
- // 从animatingElements里移除
- var idx = new Util_Util().indexOf(animatingElements, el);
- animatingElements.splice(idx, 1);
- }
- });
- } else {
- SUtil_SUtil.Util_log('Element not existed');
- }
- }
- /**
- * @function LevelRenderer.Render.prototype.clearAnimation
- * @description 停止所有动画。
- *
- */
- clearAnimation() {
- this.animation.clear();
- }
- /**
- * @function LevelRenderer.Render.prototype.getWidth
- * @description 获取视图宽度。
- * @return {number} 视图宽度。
- */
- getWidth() {
- return this.painter.getWidth();
- }
- /**
- * @function LevelRenderer.Render.prototype.getHeight
- * @description 获取视图高度。
- * @return {number} 视图高度。
- */
- getHeight() {
- return this.painter.getHeight();
- }
- /**
- * @function LevelRenderer.Render.prototype.toDataURL
- * @description 图像导出。
- *
- * @param {string} type - 类型。
- * @param {string} backgroundColor - 背景色,默认值:"#FFFFFF"。
- * @param {string} args - 参数。
- * @return {string} 图片的 Base64 url。
- */
- toDataURL(type, backgroundColor, args) {
- return this.painter.toDataURL(type, backgroundColor, args);
- }
- /**
- * @function LevelRenderer.Render.prototype.shapeToImage
- * @description 将常规 shape 转成 image shape。
- *
- * @param {LevelRenderer.Shape} e - 图形。
- * @param {number} width - 宽度。
- * @param {number} height - 高度。
- * @return {Object} image shape。
- */
- shapeToImage(e, width, height) {
- var id = Util.createUniqueID("SuperMap.LevelRenderer.ToImage_");
- return this.painter.shapeToImage(id, e, width, height);
- }
- /**
- * @function LevelRenderer.Render.prototype.on
- * @description 事件绑定。
- *
- * @param {string} eventName - 事件名称。
- * @param {function} eventHandler - 响应函数。
- * @return {LevelRenderer.Render} this。
- */
- on(eventName, eventHandler) {
- this.handler.on(eventName, eventHandler);
- return this;
- }
- /**
- * @function LevelRenderer.Render.prototype.un
- * @description 事件解绑定,参数为空则解绑所有自定义事件。
- *
- * @param {string} eventName - 事件名称。
- * @param {function} eventHandler - 响应函数。
- * @return {LevelRenderer.Render} this。
- */
- un(eventName, eventHandler) {
- this.handler.un(eventName, eventHandler);
- return this;
- }
- /**
- * @function LevelRenderer.Render.prototype.trigger
- * @description 事件触发。
- *
- * @param {string} eventName - 事件名称,resize,hover,drag,etc。
- * @param {event} event - event dom事件对象。
- * @return {LevelRenderer.Render} this。
- */
- trigger(eventName, event) {
- this.handler.trigger(eventName, event);
- this.handler.dispatch(eventName, event);
- return this;
- }
- /**
- * @function LevelRenderer.Render.prototype.clear
- * @description 清除当前 Render 下所有类图的数据和显示,clear 后 MVC 和已绑定事件均还存在在,Render 可用。
- * @return {LevelRenderer.Render} this。
- */
- clear() {
- this.storage.delRoot();
- this.painter.clear();
- return this;
- }
- /**
- * @function LevelRenderer.Render.prototype.dispose
- * @description 释放当前 Render 实例(删除包括 dom,数据、显示和事件绑定),dispose后 Render 不可用。
- */
- dispose() {
- this.animation.stop();
- this.clear();
- this.storage.dispose();
- this.painter.dispose();
- this.handler.dispose();
- this.animation = null;
- this.animatingElements = null;
- this.storage = null;
- this.painter = null;
- this.handler = null;
- // 释放后告诉全局删除对自己的索引,没想到啥好方法
- // zrender.delInstance(this.id);
- }
- // SMIC-方法扩展 - start
- /**
- * @function LevelRenderer.Render.prototype.updateHoverShapes
- * @description 更新设置显示高亮图层。
- *
- * @param {Array.<LevelRenderer.Shape>} shapes - 图形数组。
- * @return {LevelRenderer.Render} this。
- */
- updateHoverShapes(shapes) {
- this.painter.updateHoverLayer(shapes);
- return this;
- }
- /**
- * @function LevelRenderer.Render.prototype.getAllShapes
- * @description 获取所有图形。
- * @return {Array.<LevelRenderer.Shape>} 图形数组。
- */
- getAllShapes() {
- return this.storage._shapeList;
- }
- /**
- * @function LevelRenderer.Render.prototype.clearAll
- * @description 清除高亮和图形图层。
- * @return {LevelRenderer.Render} this。
- */
- clearAll() {
- this.clear();
- this.painter.clearHover();
- return this;
- }
- /**
- * @function LevelRenderer.Render.prototype.getHoverOne
- * @description 获取单个高亮图形,当前鼠标对应。
- * @return {LevelRenderer.Shape} 高亮图形。
- */
- getHoverOne() {
- return this.handler.getLastHoverOne();
- }
- static getFrameCallback(renderInstance) {
- return function () {
- var animatingElements = renderInstance.animatingElements;
- //animatingElements instanceof Array 临时解决 destory 报错
- if (animatingElements instanceof Array) {
- for (var i = 0, l = animatingElements.length; i < l; i++) {
- renderInstance.storage.mod(animatingElements[i].id);
- }
- if (animatingElements.length || renderInstance._needsRefreshNextFrame) {
- renderInstance.refresh();
- }
- }
- };
- }
- // SMIC-方法扩展 - end
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/LevelRenderer.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class LevelRenderer
- * @deprecatedclass SuperMap.LevelRenderer
- * @category Visualization Theme
- * @classdesc LevelRenderer 渲染器
- * @example
- * //在渲染器上加上图形
- * var levelRenderer = new LevelRenderer();
- * var zr = levelRenderer.init(document.getElementById('lRendertest'));
- * zr.clear();
- * zr.addShape(new LevelRenderer.Shape.Circle({
- * style:{
- * x : 100,
- * y : 100,
- * r : 50,
- * brushType: 'fill'
- * }
- * }));
- * zr.render();
- * @private
- */
- class LevelRenderer {
- constructor() {
- /**
- * @member {Object} LevelRenderer.prototype._instances
- * @description LevelRenderer 实例 map 索引
- */
- LevelRenderer._instances = {};
- // 工具
- LevelRenderer.Tool = {};
- /**
- * @member {string} LevelRenderer.prototype.version
- * @description 版本。zRender(Baidu)的版本号
- * 记录当前 LevelRenderer 是在 zRender 的那个版本上构建而来。
- * 在每次完整评判和实施由 zRender(Baidu)升级带来的 LevelRenderer 升级后修改。
- */
- this.version = '2.0.4';
- this.CLASS_NAME = "SuperMap.LevelRenderer";
- }
- /**
- * @function LevelRenderer.prototype.destroy
- * @description 销毁对象,释放资源。调用此函数后所有属性将被置为null。
- */
- destroy() {
- this.dispose();
- this.version = null;
- }
- /**
- * @function LevelRenderer.prototype.init
- * @description 创建 LevelRenderer 实例。
- * @param {HTMLElement} dom - 绘图容器。
- * @returns {LevelRenderer} LevelRenderer 实例。
- */
- init(dom) {
- var zr = new Render(Util.createUniqueID("LRenderer_"), dom);
- LevelRenderer._instances[zr.id] = zr;
- return zr;
- }
- /**
- * @function LevelRenderer.prototype.dispose
- * @description LevelRenderer 实例销毁。
- * 可以通过 zrender.dispose(zr) 销毁指定 LevelRenderer.Render 实例。
- * 也可以通过 zr.dispose() 直接销毁
- * @param {LevelRenderer.Render} zr - ZRender对象,不传此参数则销毁全部。
- * @returns {LevelRenderer} this。
- */
- dispose(zr) {
- if (zr) {
- zr.dispose();
- this.delInstance(zr.id);
- } else {
- for (var key in LevelRenderer._instances) {
- LevelRenderer._instances[key].dispose();
- }
- LevelRenderer._instances = {};
- }
- return this;
- }
- /**
- * @function LevelRenderer.prototype.getInstance
- * @description 获取 LevelRenderer.Render 实例。
- * @param {string} id - ZRender对象索引。
- * @returns {LevelRenderer.Render} LevelRenderer.Render 实例。
- */
- getInstance(id) {
- return LevelRenderer._instances[id];
- }
- /**
- * @function LevelRenderer.prototype.delInstance
- * @description 删除 zrender 实例,LevelRenderer.Render 实例 dispose 时会调用,删除后 getInstance 则返回 undefined
- * @param {string} id - ZRender对象索引。
- * @param {string} id - LevelRenderer.Render 对象索引。
- * @returns {LevelRenderer} this。
- */
- delInstance(id) {
- delete LevelRenderer._instances[id];
- return this;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicEllipse.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @private
- * @class LevelRenderer.Shape.SmicEllipse
- * @category Visualization Theme
- * @classdesc 椭圆。
- * @extends LevelRenderer.Shape
- * @example
- * var shape = new LevelRenderer.Shape.SmicEllipse({
- * style: {
- * x: 100,
- * y: 100,
- * a: 40,
- * b: 20,
- * brushType: 'both',
- * color: 'blue',
- * strokeColor: 'red',
- * lineWidth: 3,
- * text: 'SmicEllipse'
- * }
- * });
- * levelRenderer.addShape(shape);
- * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
- *
- */
- class SmicEllipse extends (/* unused pure expression or super */ null && (Shape)) {
- constructor(options) {
- super(options);
- /**
- * @member {string} LevelRenderer.Shape.SmicEllipse.prototype.type
- * @description 图形类型。
- */
- this.type = 'smicellipse';
- if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
- this.refOriginalPosition = [0, 0];
- }
- this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicEllipse";
- }
- /**
- * @function LevelRenderer.Shape.SmicEllipse.prototype.destroy
- * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
- */
- destroy() {
- this.type = null;
- super.destroy();
- }
- /**
- * @function LevelRenderer.Shape.SmicEllipse.prototype.buildPath
- * @description 构建椭圆的 Path。
- *
- * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
- * @param {Object} style - style。
- *
- */
- buildPath(ctx, style) {
- if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
- this.refOriginalPosition = [0, 0];
- }
- var __OP = this.refOriginalPosition;
- var k = 0.5522848;
- var x = style.x + __OP[0];
- var y = style.y + __OP[1];
- var a = style.a;
- var b = style.b;
- var ox = a * k; // 水平控制点偏移量
- var oy = b * k; // 垂直控制点偏移量
- // 从椭圆的左端点开始顺时针绘制四条三次贝塞尔曲线
- ctx.moveTo(x - a, y);
- ctx.bezierCurveTo(x - a, y - oy, x - ox, y - b, x, y - b);
- ctx.bezierCurveTo(x + ox, y - b, x + a, y - oy, x + a, y);
- ctx.bezierCurveTo(x + a, y + oy, x + ox, y + b, x, y + b);
- ctx.bezierCurveTo(x - ox, y + b, x - a, y + oy, x - a, y);
- ctx.closePath();
- }
- /**
- * @function LevelRenderer.Shape.SmicEllipse.prototype.getRect
- * @description 计算返回椭圆包围盒矩形
- *
- * @param {Object} style - style
- * @return {Object} 边框对象。包含属性:x,y,width,height。
- *
- */
- getRect(style) {
- if (style.__rect) {
- return style.__rect;
- }
- if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
- this.refOriginalPosition = [0, 0];
- }
- var __OP = this.refOriginalPosition;
- var lineWidth;
- if (style.brushType == 'stroke' || style.brushType == 'fill') {
- lineWidth = style.lineWidth || 1;
- } else {
- lineWidth = 0;
- }
- style.__rect = {
- x: Math.round((style.x + __OP[0]) - style.a - lineWidth / 2),
- y: Math.round((style.x + __OP[1]) - style.b - lineWidth / 2),
- width: style.a * 2 + lineWidth,
- height: style.b * 2 + lineWidth
- };
- return style.__rect;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicIsogon.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @private
- * @class LevelRenderer.Shape.SmicIsogon
- * @category Visualization Theme
- * @classdesc 正多边形。
- * @extends LevelRenderer.Shape
- * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
- */
- class SmicIsogon extends (/* unused pure expression or super */ null && (Shape)) {
- constructor(options) {
- super(options);
- /**
- * @member {string} LevelRenderer.Shape.SmicIsogon.prototype.type
- * @description 图形类型。
- */
- this.type = 'smicisogon';
- if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
- this.refOriginalPosition = [0, 0];
- }
- this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicIsogon";
- }
- /**
- * @function LevelRenderer.Shape.SmicIsogon.prototype.destroy
- * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
- */
- destroy() {
- this.type = null;
- super.destroy();
- }
- /**
- * @function LevelRenderer.Shape.SmicIsogon.prototype.buildPath
- * @description 创建n角星(n>=3)路径。
- *
- * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
- * @param {Object} style - style。
- *
- */
- buildPath(ctx, style) {
- if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
- this.refOriginalPosition = [0, 0];
- }
- var __OP = this.refOriginalPosition;
- var sin = SUtil.Util_math.sin;
- var cos = SUtil.Util_math.cos;
- var PI = Math.PI;
- var n = style.n;
- if (!n || n < 2) {
- return;
- }
- var x = style.x + __OP[0];
- var y = style.y + __OP[1];
- var r = style.r;
- var dStep = 2 * PI / n;
- var deg = -PI / 2;
- var xStart = x + r * cos(deg);
- var yStart = y + r * sin(deg);
- deg += dStep;
- // 记录边界点,用于判断insight
- var pointList = style.pointList = [];
- pointList.push([xStart, yStart]);
- for (let i = 0, end = n - 1; i < end; i++) {
- pointList.push([x + r * cos(deg), y + r * sin(deg)]);
- deg += dStep;
- }
- pointList.push([xStart, yStart]);
- // 绘制
- ctx.moveTo(pointList[0][0], pointList[0][1]);
- for (let i = 0; i < pointList.length; i++) {
- ctx.lineTo(pointList[i][0], pointList[i][1]);
- }
- ctx.closePath();
- return;
- }
- /**
- * @function LevelRenderer.Shape.SmicIsogon.prototype.getRect
- * @description 计算返回正多边形的包围盒矩形。
- *
- * @param {Object} style - style
- * @return {Object} 边框对象。包含属性:x,y,width,height。
- */
- getRect(style) {
- if (style.__rect) {
- return style.__rect;
- }
- if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
- this.refOriginalPosition = [0, 0];
- }
- var __OP = this.refOriginalPosition;
- var lineWidth;
- if (style.brushType == 'stroke' || style.brushType == 'fill') {
- lineWidth = style.lineWidth || 1;
- } else {
- lineWidth = 0;
- }
- style.__rect = {
- x: Math.round((style.x + __OP[0]) - style.r - lineWidth / 2),
- y: Math.round((style.y + __OP[1]) - style.r - lineWidth / 2),
- width: style.r * 2 + lineWidth,
- height: style.r * 2 + lineWidth
- };
- return style.__rect;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicRing.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @private
- * @class LevelRenderer.Shape.SmicRing
- * @category Visualization Theme
- * @classdesc 圆环。
- * @extends LevelRenderer.Shape
- * @example
- * var shape = new LevelRenderer.Shape.SmicRing({
- * style: {
- * x: 100,
- * y: 100,
- * r0: 30,
- * r: 50
- * }
- * });
- * levelRenderer.addShape(shape);
- * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
- */
- class SmicRing extends (/* unused pure expression or super */ null && (Shape)) {
- constructor(options) {
- super(options);
- /**
- * @member {string} LevelRenderer.Shape.SmicRing.prototype.type
- * @description 图形类型。
- */
- this.type = 'smicring';
- if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
- this.refOriginalPosition = [0, 0];
- }
- this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicRing";
- }
- /**
- * @function LevelRenderer.Shape.SmicRing.prototype.destroy
- * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
- */
- destroy() {
- this.type = null;
- super.destroy();
- }
- /**
- * @function LevelRenderer.Shape.SmicRing.prototype.buildPath
- * @description 创建圆环路径。
- *
- * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
- * @param {Object} style - style。
- *
- */
- buildPath(ctx, style) {
- if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
- this.refOriginalPosition = [0, 0];
- }
- var __OP = this.refOriginalPosition;
- // 非零环绕填充优化
- ctx.arc(style.x + __OP[0], style.y + __OP[1], style.r, 0, Math.PI * 2, false);
- ctx.moveTo((style.x + __OP[0]) + style.r0, style.y + __OP[1]);
- ctx.arc(style.x + __OP[0], style.y + __OP[1], style.r0, 0, Math.PI * 2, true);
- return;
- }
- /**
- * @function LevelRenderer.Shape.SmicRing.prototype.getRect
- * @description 计算返回圆环包围盒矩阵
- *
- * @param {Object} style - style
- * @return {Object} 边框对象。包含属性:x,y,width,height。
- */
- getRect(style) {
- if (style.__rect) {
- return style.__rect;
- }
- if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
- this.refOriginalPosition = [0, 0];
- }
- var __OP = this.refOriginalPosition;
- var lineWidth;
- if (style.brushType == 'stroke' || style.brushType == 'fill') {
- lineWidth = style.lineWidth || 1;
- } else {
- lineWidth = 0;
- }
- style.__rect = {
- x: Math.round((style.x + __OP[0]) - style.r - lineWidth / 2),
- y: Math.round((style.y + __OP[1]) - style.r - lineWidth / 2),
- width: style.r * 2 + lineWidth,
- height: style.r * 2 + lineWidth
- };
- return style.__rect;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicStar.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @private
- * @class LevelRenderer.Shape.SmicStar
- * @category Visualization Theme
- * @classdesc n 角星(n>3)。
- * @extends LevelRenderer.Shape
- * @example
- * var shape = new LevelRenderer.Shape.SmicStar({
- * style: {
- * x: 200,
- * y: 100,
- * r: 150,
- * n: 5,
- * text: '五角星'
- * }
- * });
- * levelRenderer.addShape(shape);
- * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
- *
- */
- class SmicStar extends (/* unused pure expression or super */ null && (Shape)) {
- constructor(options) {
- super(options);
- /**
- * @member {string} LevelRenderer.Shape.SmicStar.prototype.type
- * @description 图形类型。
- */
- this.type = 'smicstar';
- if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
- this.refOriginalPosition = [0, 0];
- }
- this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicStar";
- }
- /**
- * @function LevelRenderer.Shape.SmicStar.prototype.destroy
- * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
- */
- destroy() {
- this.type = null;
- super.destroy();
- }
- /**
- * @function LevelRenderer.Shape.SmicStar.prototype.buildPath
- * @description 创建n 角星(n>3)路径。
- *
- * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
- * @param {Object} style - style。
- *
- */
- buildPath(ctx, style) {
- if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
- this.refOriginalPosition = [0, 0];
- }
- var __OP = this.refOriginalPosition;
- var n = style.n;
- if (!n || n < 2) {
- return;
- }
- var sin = SUtil.Util_math.sin;
- var cos = SUtil.Util_math.cos;
- var PI = Math.PI;
- var x = style.x + __OP[0];
- var y = style.y + __OP[1];
- var r = style.r;
- var r0 = style.r0;
- // 如果未指定内部顶点外接圆半径,则自动计算
- if (r0 == null) {
- r0 = n > 4
- // 相隔的外部顶点的连线的交点,
- // 被取为内部交点,以此计算r0
- ? r * cos(2 * PI / n) / cos(PI / n)
- // 二三四角星的特殊处理
- : r / 3;
- }
- var dStep = PI / n;
- var deg = -PI / 2;
- var xStart = x + r * cos(deg);
- var yStart = y + r * sin(deg);
- deg += dStep;
- // 记录边界点,用于判断inside
- var pointList = style.pointList = [];
- pointList.push([xStart, yStart]);
- for (var i = 0, end = n * 2 - 1, ri; i < end; i++) {
- ri = i % 2 === 0 ? r0 : r;
- pointList.push([x + ri * cos(deg), y + ri * sin(deg)]);
- deg += dStep;
- }
- pointList.push([xStart, yStart]);
- // 绘制
- ctx.moveTo(pointList[0][0], pointList[0][1]);
- for (let i = 0; i < pointList.length; i++) {
- ctx.lineTo(pointList[i][0], pointList[i][1]);
- }
- ctx.closePath();
- return;
- }
- /**
- * @function LevelRenderer.Shape.SmicStar.prototype.getRect
- * @description 返回 n 角星包围盒矩形。
- *
- * @param {Object} style - style
- * @return {Object} 边框对象。包含属性:x,y,width,height。
- */
- getRect(style) {
- if (style.__rect) {
- return style.__rect;
- }
- if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
- this.refOriginalPosition = [0, 0];
- }
- var __OP = this.refOriginalPosition;
- var lineWidth;
- if (style.brushType == 'stroke' || style.brushType == 'fill') {
- lineWidth = style.lineWidth || 1;
- } else {
- lineWidth = 0;
- }
- style.__rect = {
- x: Math.round((style.x + __OP[0]) - style.r - lineWidth / 2),
- y: Math.round((style.y + __OP[1]) - style.r - lineWidth / 2),
- width: style.r * 2 + lineWidth,
- height: style.r * 2 + lineWidth
- };
- return style.__rect;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/index.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- ;// CONCATENATED MODULE: ./src/common/overlay/index.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- ;// CONCATENATED MODULE: ./src/common/components/CommonTypes.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @description 该文件用于存储一些公用常量
- * @private
- */
- const FileTypes = {
- EXCEL: "EXCEL",
- CSV: "CSV",
- ISERVER: "ISERVER",
- GEOJSON: "GEOJSON",
- JSON: 'JSON'
- };
- const FileConfig = {
- fileMaxSize: 10 * 1024 * 1024
- };
- ;// CONCATENATED MODULE: ./src/common/components/openfile/FileModel.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FileModel
- * @deprecatedclass SuperMap.FileModel
- * @description 文件数据组件数据模型,用于存储一些文件数据或状态,todo 结构待完善
- * @category Components OpenFile
- * @private
- */
- class FileModel {
- constructor(options) {
- this.FileTypes = FileTypes;
- this.FileConfig = FileConfig;
- this.loadFileObject = options && options.loadFileObject ? options.loadFileObject : [];
- }
- /**
- * @function FileModel.prototype.set
- * @description 设置属性值
- * @param {string} key - 属性名称
- * @param {string|Object} value - 属性值
- */
- set(key, value) {
- this[key] = value;
- }
- /**
- * @function FileModel.prototype.get
- * @description 获取数据值
- * @param {string} key - 属性名称
- * @returns {string|Object} value - 返回属性值
- */
- get(key) {
- return this[key];
- }
- }
- ;// CONCATENATED MODULE: ./src/common/components/messagebox/MessageBox.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class MessageBox
- * @aliasclass Components.MessageBox
- * @deprecatedclass SuperMap.Components.MessageBox
- * @version 9.1.1
- * @classdesc 组件信息提示框。
- * @category Components Common
- * @usage
- */
- class MessageBox {
- constructor() {
- this._initView();
- }
- _initView() {
- //原生js形式
- const messageBoxContainer = document.createElement("div");
- messageBoxContainer.hidden = true;
- messageBoxContainer.setAttribute("class", "component-messageboxcontainer component-border-bottom-orange");
- //图标
- const iconContainer = document.createElement("div");
- iconContainer.setAttribute("class", "icon");
- this.icon = document.createElement("span");
- this.icon.setAttribute("class", "supermapol-icons-message-warning");
- iconContainer.appendChild(this.icon);
- messageBoxContainer.appendChild(iconContainer);
- //内容:
- const messageBox = document.createElement("div");
- messageBox.setAttribute("class", "component-messagebox");
- messageBox.innerHTML = "";
- messageBoxContainer.appendChild(messageBox);
- this.messageBox = messageBox;
- //关闭按钮
- const cancelContainer = document.createElement("div");
- cancelContainer.setAttribute("class", "component-messagebox__cancelbtncontainer");
- const cancelBtn = document.createElement("button");
- cancelBtn.setAttribute("class", "component-messagebox__cancelBtn");
- cancelBtn.innerHTML = "x";
- cancelBtn.onclick = this.closeView.bind(this);
- cancelContainer.appendChild(cancelBtn);
- messageBoxContainer.appendChild(cancelContainer);
- this.messageBoxContainer = messageBoxContainer;
- document.body.appendChild(this.messageBoxContainer);
- }
- /**
- * @function MessageBox.prototype.closeView
- * @description 关闭提示框。
- */
- closeView() {
- this.messageBoxContainer.hidden = true;
- }
- /**
- * @function MessageBox.prototype.showView
- * @description 显示提示框。
- * @param {string} message - 提示框显示内容。
- * @param {string}[type="warring"] 提示框类型,如 "warring", "failure", "success"。
- */
- showView(message, type = 'warring') {
- //设置提示框的样式:
- if (type === "success") {
- this.icon.setAttribute("class", "supermapol-icons-message-success");
- this.messageBoxContainer.setAttribute("class", "component-messageboxcontainer component-border-bottom-green");
- } else if (type === "failure") {
- this.icon.setAttribute("class", "supermapol-icons-message-failure");
- this.messageBoxContainer.setAttribute("class", "component-messageboxcontainer component-border-bottom-red");
- } else if (type === "warring") {
- this.icon.setAttribute("class", "supermapol-icons-message-warning");
- this.messageBoxContainer.setAttribute("class", "component-messageboxcontainer component-border-bottom-orange");
- }
- this.messageBox.innerHTML = message;
- this.messageBoxContainer.hidden = false;
- }
- }
- ;// CONCATENATED MODULE: external "function(){try{return echarts}catch(e){return {}}}()"
- const external_function_try_return_echarts_catch_e_return_namespaceObject = function(){try{return echarts}catch(e){return {}}}();
- var external_function_try_return_echarts_catch_e_return_default = /*#__PURE__*/__webpack_require__.n(external_function_try_return_echarts_catch_e_return_namespaceObject);
- ;// CONCATENATED MODULE: ./src/common/lang/locales/en-US.js
-
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * Namespace: SuperMap.Lang["en"]
- * Dictionary for English. Keys for entries are used in calls to
- * <SuperMap.Lang.translate>. Entry bodies are normal strings or
- * strings formatted for use with <SuperMap.String.format> calls.
- */
- let en = {
- 'title_dataFlowService': 'Data Flow Service',
- 'title_distributedAnalysis': 'Distributed Analysis',
- 'title_clientComputing': 'Client Computing',
- 'title_dataServiceQuery': 'Data Service Query',
- 'title_searchCity':'Search city',
- 'title_searchLayer':' Search layer',
- 'text_input_value_inputDataFlowUrl': 'Please enter the data stream service address such as: ws://{serviceRoot}/{dataFlowName}/dataflow/subscribe',
- 'text_displayFeaturesInfo': 'Display feature information',
- 'text_subscribe': 'subscribe',
- 'text_cancelSubscribe': 'unsubscribe',
- 'text_densityAnalysis': 'Density Analysis',
- 'text_CalculateTheValuePerUnitArea': 'Calculate the value per unit area within the neighborhood shape',
- 'text_option_selectDataset':'Please select a dataset',
- 'text_label_dataset': 'Dataset',
- 'text_option_simplePointDensityAnalysis': 'Simple point density analysis',
- 'text_option_nuclearDensityAnalysis': 'Nuclear density analysis',
- 'text_label_analyticalMethod': 'Analytical method',
- 'text_option_quadrilateral': 'Quadrilateral',
- 'text_option_hexagon': 'hexagon',
- 'text_label_meshType': 'Mesh type',
- 'text_option_notSet': 'Not set',
- 'text_label_weightField': 'Weight field',
- 'text_label_gridSizeInMeters': 'Grid size',
- 'text_label_searchRadius': 'Search radius',
- 'text_label_queryRange': 'Scope of analysis',
- 'text_label_areaUnit': 'Area unit',
- 'text_option_equidistantSegmentation': 'Equidistant segmentation',
- 'text_option_logarithm': 'Logarithm',
- 'text_option_equalCountingSegment': 'Equal counting segment',
- 'text_option_squareRootSegmentation': 'Square root segmentation',
- 'text_label_thematicMapSegmentationMode': 'Thematic map segmentation mode',
- 'text_label_thematicMapSegmentationParameters': 'Thematic map segmentation parameters',
- 'text_option_greenOrangePurpleGradient': 'Green orange purple gradient',
- 'text_option_greenOrangeRedGradient': 'Green orange red gradient',
- 'text_option_rainbowGradient': 'Rainbow gradient',
- 'text_option_spectralGradient': 'Spectral gradient',
- 'text_option_terrainGradient': 'Terrain gradient',
- 'text_label_thematicMapColorGradientMode': 'Thematic map color gradient mode',
- 'text_label_resultLayerName': 'Result layer name',
- 'text_chooseFile': 'Open File',
- 'text_isoline': 'Isoline',
- 'text_extractDiscreteValue': 'Extract discrete value generation curve',
- 'text_buffer': 'Buffer',
- 'text_specifyTheDistance': 'Specify the distance to create the surrounding area',
- 'text_label_analysisLayer': 'Analysis layer',
- 'text_label_extractField': 'Extract field',
- 'text_label_extractedValue': 'Extracted value',
- 'text_label_distanceAttenuation': 'Distance attenuation',
- 'text_label_gridSize': 'gridSize',
- 'text_label_bufferRadius': 'Buffer radius',
- 'text_label_defaultkilometers': 'Default 10 kilometers',
- 'text_label_kilometer': 'kilometer',
- 'text_label_unit': 'unit',
- 'text_retainOriginal': 'Retain original object field',
- 'text_mergeBuffer': 'Merge buffer',
- 'text_label_color': 'Color',
- 'text_label_buffer': '[Buffer]',
- 'text_label_isolines': '[Isolines]',
- 'text_label_queryRangeTips': 'The default is the full range of input data. Example: -74.050, 40.650, -73.850, 40.850',
- 'text_label_queryModel': 'Query mode',
- 'text_label_IDArrayOfFeatures': 'ID array of features',
- 'text_label_maxFeatures': 'The maximum number of features that can be returned',
- 'text_label_bufferDistance': 'Buffer distance',
- 'text_label_queryRange1': 'Query range',
- 'text_label_spatialQueryMode': 'Spatial query mode',
- 'text_label_featureFilter': 'Feature filter',
- 'text_label_geometricObject': 'Geometric object',
- 'text_label_queryMode': 'Query mode',
- 'text_label_searchTips': 'Search for city locations or layer features',
- 'text_label_chooseSearchLayers': 'Select a query layer',
- 'text_loadSearchCriteria': 'Load search criteria',
- 'text_saveSearchCriteria': 'Save search criteria',
- "btn_analyze": "Analyze",
- "btn_analyzing": "Analyzing",
- "btn_emptyTheAnalysisLayer": "Empty the analysis layer",
- "btn_cancelAnalysis": "Cancel",
- "btn_query": "Query",
- "btn_querying": "Querying",
- "btn_emptyTheRresultLayer": "Clear all result layers",
- 'msg_dataReturnedIsEmpty.': 'The request is successful and the data returned by the query is empty.',
- 'msg_dataFlowServiceHasBeenSubscribed': 'The data stream service has been subscribed to.',
- 'msg_inputDataFlowUrlFirst': 'Please enter the data stream service address first.',
- 'msg_datasetOrMethodUnsupport': 'This dataset does not support this analysis type. Please reselect the dataset.',
- 'msg_selectDataset': 'Please select a data set!',
- 'msg_setTheWeightField': 'Please set the weight field!',
- 'msg_theFieldNotSupportAnalysis': 'The field you currently select does not support analysis!',
- 'msg_resultIsEmpty': 'The result of the analysis is empty!',
- 'msg_openFileFail': 'Failed to open file!',
- 'msg_fileTypeUnsupported': 'File format is not supported!',
- 'msg_fileSizeExceeded': 'File size exceeded! The file size should not exceed 10M!',
- 'msg_dataInWrongGeoJSONFormat': 'Wrong data format! Non standard GEOJSON format data!',
- 'msg_dataInWrongFormat': 'Wrong data format! Non standard EXCEL, CSV or GEOJSON format data!',
- 'msg_searchKeywords': "Search keywords cannot be empty. Please enter your search criteria.",
- 'msg_searchGeocodeField':"Did not match the address matching service data!",
- 'msg_cityGeocodeField':"The address matching service of the current city is not configured.",
- 'msg_getFeatureField':"No related vector features found!",
- 'msg_dataflowservicesubscribed':'The data stream service has been subscribed to.',
- 'msg_subscribesucceeded':'The data stream service subscription was successful.',
- 'msg_crsunsupport':'Does not support the coordinate system of the current map',
- 'msg_tilematrixsetunsupport':'Incoming TileMatrixSet is not supported',
- 'msg_jsonResolveFiled': 'JSON format parsing failure!',
- 'msg_requestContentFiled': 'Failed to request data through iportal!',
- 'msg_getdatafailed': 'Failed to get data!'
- };
- ;// CONCATENATED MODULE: ./src/common/lang/locales/zh-CN.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * Namespace: SuperMap.Lang["zh-CN"]
- * Dictionary for Simplified Chinese. Keys for entries are used in calls to
- * <SuperMap.Lang.translate>. Entry bodies are normal strings or
- * strings formatted for use with <SuperMap.String.format> calls.
- */
- let zh = {
- 'title_dataFlowService': '数据流服务',
- 'title_distributedAnalysis': '分布式分析',
- 'title_clientComputing': '客户端计算',
- 'title_dataServiceQuery': '数据服务查询',
- 'title_searchCity':'搜索城市',
- 'title_searchLayer':'搜索图层',
- 'text_input_value_inputDataFlowUrl': '请输入数据流服务地址如:ws://{serviceRoot}/{dataFlowName}/dataflow/subscribe',
- 'text_displayFeaturesInfo': '显示要素信息',
- 'text_subscribe': '订阅',
- 'text_cancelSubscribe': '取消订阅',
-
- 'text_densityAnalysis': '密度分析',
- 'text_CalculateTheValuePerUnitArea': '计算点指定邻域形状内的每单位面积量值',
- 'text_option_selectDataset':'请选择数据集',
- 'text_label_dataset': '数据集',
- 'text_option_simplePointDensityAnalysis': '简单点密度分析',
- 'text_option_nuclearDensityAnalysis': '核密度分析',
- 'text_label_analyticalMethod': '分析方法',
- 'text_option_quadrilateral': '四边形',
- 'text_option_hexagon': '六边形',
- 'text_label_meshType': '网格面类型',
- 'text_option_notSet': '未设置',
- 'text_label_weightField': '权重字段',
- 'text_label_gridSizeInMeters': '网格大小',
- 'text_label_searchRadius': '搜索半径',
- 'text_label_queryRange': '分析范围',
- 'text_label_areaUnit': '面积单位',
- 'text_option_equidistantSegmentation': '等距离分段',
- 'text_option_logarithm': '对数',
- 'text_option_equalCountingSegment': '等计数分段',
- 'text_option_squareRootSegmentation': '平方根分段',
- 'text_label_thematicMapSegmentationMode': '专题图分段模式',
- 'text_label_thematicMapSegmentationParameters': '专题图分段参数',
- 'text_option_greenOrangePurpleGradient': '绿橙紫渐变',
- 'text_option_greenOrangeRedGradient': '绿橙红渐变',
- 'text_option_rainbowGradient': '彩虹渐变',
- 'text_option_spectralGradient': '光谱渐变',
- 'text_option_terrainGradient': '地形渐变',
- 'text_label_thematicMapColorGradientMode': '专题图颜色渐变模式',
- 'text_label_resultLayerName': '结果图层名称',
- 'text_chooseFile': '选择文件',
- 'text_isoline': '等值线',
- 'text_extractDiscreteValue': '提取离散值生成曲线',
- 'text_buffer': '缓冲区',
- 'text_specifyTheDistance': '指定距离创建周边区域',
- 'text_label_analysisLayer': '分析图层',
- 'text_label_extractField': '提取字段',
- 'text_label_extractedValue': '提取值',
- 'text_label_distanceAttenuation': '距离衰减',
- 'text_label_gridSize': '栅格大小',
- 'text_label_bufferRadius': '缓冲半径',
- 'text_label_defaultkilometers': '默认10千米',
- 'text_option_kilometer': '千米',
- 'text_label_unit': '单位',
- 'text_retainOriginal': '保留原对象字段属性',
- 'text_mergeBuffer': '合并缓冲区',
- 'text_label_color': '颜色',
- 'text_label_buffer': '[缓冲区]',
- 'text_label_isolines': '[等值线]',
- 'text_label_queryRangeTips': '默认为输入数据的全幅范围。范例:-74.050,40.650,-73.850,40.850',
- 'text_label_IDArrayOfFeatures': '要素 ID 数组',
- 'text_label_maxFeatures': '最多可返回的要素数量',
- 'text_label_bufferDistance': '缓冲区距离',
- 'text_label_queryRange1': '查询范围',
- 'text_label_spatialQueryMode': '空间查询模式',
- 'text_label_featureFilter': '要素过滤器',
- 'text_label_geometricObject': '几何对象',
- 'text_label_queryMode': '查询模式',
- 'text_label_searchTips': '搜索城市地点或图层要素',
- 'text_label_chooseSearchLayers': '选择查询图层',
- 'text_loadSearchCriteria': '加载搜索条件',
- 'text_saveSearchCriteria': '保存搜索条件',
- "btn_analyze": "分析",
- "btn_analyzing": "分析中",
- "btn_emptyTheAnalysisLayer": "清空分析图层",
- "btn_cancelAnalysis": "取消",
- "btn_query": "查询",
- "btn_querying": "查询中",
- "btn_emptyTheRresultLayer": "清除所有结果图层",
-
- 'msg_dataFlowServiceHasBeenSubscribed': '已订阅该数据流服务。',
- 'msg_inputDataFlowUrlFirst': '请先输入数据流服务地址。',
- 'msg_datasetOrMethodUnsupport': '该数据集不支持本分析类型,请重新选择数据集',
- 'msg_selectDataset': '请选择数据集!',
- 'msg_setTheWeightField': '请设置权重字段!',
- 'msg_theFieldNotSupportAnalysis': '您当前选择的字段不支持分析!',
- 'msg_resultIsEmpty': '分析的结果为空!',
- 'msg_dataReturnedIsEmpty': '请求成功,查询返回的数据为空。',
- 'msg_openFileFail': '打开文件失败!',
- 'msg_fileTypeUnsupported': '不支持该文件格式!',
- 'msg_fileSizeExceeded': '文件大小超限!文件大小不得超过 10M!',
- 'msg_dataInWrongGeoJSONFormat': '数据格式错误!非标准的 GEOJSON 格式数据!',
- 'msg_dataInWrongFormat': '数据格式错误!非标准的 EXCEL, CSV 或 GEOJSON 格式数据!',
- 'msg_searchKeywords': "搜索关键字不能为空,请输入搜索条件。",
- 'msg_searchGeocodeField':"未匹配到地址匹配服务数据!",
- 'msg_cityGeocodeField':"未配置当前城市的地址匹配服务。",
- 'msg_getFeatureField':"未查找到相关矢量要素!",
- 'msg_dataflowservicesubscribed':'已订阅该数据流服务。',
- 'msg_subscribesucceeded':'数据流服务订阅成功。',
- 'msg_crsunsupport':'不支持当前地图的坐标系',
- 'msg_tilematrixsetunsupport':'不支持传入的TileMatrixSet',
- 'msg_jsonResolveFiled': 'json格式解析失败!',
- 'msg_requestContentFiled': '通过iportal请求数据失败!',
- 'msg_getdatafailed': '获取数据失败!'
- };
- ;// CONCATENATED MODULE: ./src/common/lang/Lang.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
-
-
- /**
- * @name Lang
- * @namespace
- * @category BaseTypes Internationalization
- * @description 国际化的命名空间,包含多种语言和方法库来设置和获取当前的语言。
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.Lang.getCode();
- *
- * // 弃用的写法
- * const result = SuperMap.Lang.getCode();
- *
- * </script>
- *
- * // ES6 Import
- * import { Lang } from '{npm}';
- *
- * const result = Lang.getCode();
- *
- * ```
- */
- let Lang = {
- 'en-US': en,
- "zh-CN": zh,
- /**
- * @member {string} Lang.code
- * @description 当前所使用的语言类型。
- */
- code: null,
- /**
- * @member {string} [Lang.defaultCode='en-US']
- * @description 默认使用的语言类型。
- */
- defaultCode: "en-US",
- /**
- * @function Lang.getCode
- * @description 获取当前的语言代码。
- * @returns {string} 当前的语言代码。
- */
- getCode: function () {
- if (!Lang.code) {
- Lang.setCode();
- }
- return Lang.code;
- },
- /**
- * @function Lang.setCode
- * @description 设置语言代码。
- * @param {string} code - 此参数遵循IETF规范。
- */
- setCode: function () {
- var lang = this.getLanguageFromCookie();
- if (lang) {
- Lang.code = lang;
- return;
- }
- lang = Lang.defaultCode;
- if (navigator.appName === 'Netscape') {
- lang = navigator.language;
- } else {
- lang = navigator.browserLanguage;
- }
- if (lang.indexOf('zh') === 0) {
- lang = 'zh-CN';
- }
- if (lang.indexOf('en') === 0) {
- lang = 'en-US';
- }
- Lang.code = lang;
- },
- /**
- * @function Lang.getLanguageFromCookie
- * @description 从 cookie 中获取语言类型。
- */
- getLanguageFromCookie() {
- var name = 'language=';
- var ca = document.cookie.split(';');
- for (var i = 0; i < ca.length; i++) {
- var c = ca[i];
- while (c.charAt(0) === ' ') {
- c = c.substring(1)
- }
- if (c.indexOf(name) !== -1) {
- return c.substring(name.length, c.length)
- }
- }
- return "";
- },
- /**
- * @function Lang.i18n
- * @description 从当前语言字符串的字典查找 key。
- * @param {string} key - 字典中 i18n 字符串值的关键字。
- * @returns {string} 国际化的字符串。
- */
- i18n: function (key) {
- var dictionary = Lang[Lang.getCode()];
- var message = dictionary && dictionary[key];
- if (!message) {
- // Message not found, fall back to message key
- message = key;
- }
- return message;
- }
- };
- ;// CONCATENATED MODULE: external "function(){try{return XLSX}catch(e){return {}}}()"
- const external_function_try_return_XLSX_catch_e_return_namespaceObject = function(){try{return XLSX}catch(e){return {}}}();
- ;// CONCATENATED MODULE: ./src/common/components/util/FileReaderUtil.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @name FileReaderUtil
- * @namespace
- * @category Components OpenFile
- * @description 组件读取文件工具类。
- * @version 9.1.1
- * @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(*, *=))}}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.Components.FileReaderUtil.isXField(data);
- *
- * // 弃用的写法
- * const result = SuperMap.Components.FileReaderUtil.isXField(data);
- *
- * </script>
- *
- * // ES6 Import
- * import { FileReaderUtil } from '{npm}';
- *
- * const result = FileReaderUtil.isXField(data);
- * ```
- */
- let FileReaderUtil = {
- rABS: typeof FileReader !== 'undefined' && FileReader.prototype && FileReader.prototype.readAsBinaryString,
- rABF: typeof FileReader !== 'undefined' && FileReader.prototype && FileReader.prototype.readAsArrayBuffer,
- rAT: typeof FileReader !== 'undefined' && FileReader.prototype && FileReader.prototype.readAsText,
- /**
- * @function FileReaderUtil.prototype.readFile
- * @description 读取文件
- * @param {string} fileType - 当前读取的文件类型
- *
- * @param {Object} file - 读取回来的文件内容对象
- * @param {function} success - 读取文件成功回调函数
- * @param {function} failed - 读取文件失败回调函数
- * @param {Object} context - 回调重定向对象
- */
- readFile(fileType, file, success, failed, context) {
- if (FileTypes.JSON === fileType || FileTypes.GEOJSON === fileType) {
- this.readTextFile(file, success, failed, context)
- } else if (FileTypes.EXCEL === fileType || FileTypes.CSV === fileType) {
- this.readXLSXFile(file, success, failed, context)
- }
- },
- /**
- * @description 读取文本文件
- * @param {Object} file 文件内容对象
- * @param {function} success 读取文件成功回调函数
- * @param {function} failed 读取文件失败回调函数
- * @param {Object} context - 回调重定向对象
- */
- readTextFile(file, success, failed, context) {
- let reader = new FileReader();
- reader.onloadend = function (evt) {
- success && success.call(context, evt.target.result);
- };
- reader.onerror = function (error) {
- failed && failed.call(context, error)
- };
- this.rAT ? reader.readAsText(file.file, 'utf-8') : reader.readAsBinaryString(file.file);
- },
- /**
- * @description 读取excel或csv文件
- * @param {Object} file 文件内容对象
- * @param {function} success 读取文件成功回调函数
- * @param {function} failed 读取文件失败回调函数
- * @param {Object} context - 回调重定向对象
- */
- readXLSXFile(file, success, failed, context) {
- let reader = new FileReader();
- reader.onloadend = function (evt) {
- let xLSXData = new Uint8Array(evt.target.result);
- let workbook = external_function_try_return_XLSX_catch_e_return_namespaceObject.read(xLSXData, {type: "array"});
- try {
- if (workbook && workbook.SheetNames && workbook.SheetNames.length > 0) {
- //暂时只读取第一个sheets的内容
- let sheetName = workbook.SheetNames[0];
- let xLSXCSVString = external_function_try_return_XLSX_catch_e_return_namespaceObject.utils.sheet_to_csv(workbook.Sheets[sheetName]);
- success && success.call(context, xLSXCSVString);
- }
- } catch (error) {
- failed && failed.call(context, error);
- }
- };
- reader.onerror = function (error) {
- failed && failed.call(context, error)
- };
- this.rABF && reader.readAsArrayBuffer(file.file);
- },
- /**
- * @function FileReaderUtil.prototype.processDataToGeoJson
- * @description 将读取回来得数据统一处理为 GeoJSON 格式
- * @param {string} type - 文件类型
- * @param {Object} data - 读取返回的数据对象
- * @param {function} success - 数据处理成功的回调
- * @param {function} failed - 数据处理失败的回调
- * @param {Object} context - 回调重定向对象
- * @returns {GeoJSONObject} 返回标准 GeoJSON 规范格式数据
- * @private
- */
- processDataToGeoJson(type, data, success, failed, context) {
- let geojson = null;
- if (type === "EXCEL" || type === "CSV") {
- geojson = this.processExcelDataToGeoJson(data);
- success && success.call(context, geojson);
- } else if (type === 'JSON' || type === 'GEOJSON') {
- let result = data;
- //geojson、json未知,通过类容来判断
- if ((typeof result) === "string") {
- result = JSON.parse(result);
- }
- if (result.type === 'ISERVER') {
- geojson = result.data.recordsets[0].features;
- } else if (result.type === 'FeatureCollection') {
- //geojson
- geojson = result;
- } else {
- //不支持数据
- failed && failed.call(context, Lang.i18n('msg_dataInWrongGeoJSONFormat'));
- }
- success && success.call(context, geojson);
- } else {
- failed && failed.call(context, Lang.i18n('msg_dataInWrongFormat'));
- }
- },
- /**
- * @function FileReaderUtil.prototype.processExcelDataToGeoJson
- * @description 表格文件数据处理
- * @param {Object} data - 读取的表格文件数据
- * @returns {GeoJSONObject} 返回标准 GeoJSON 规范格式数据
- * @private
- */
- processExcelDataToGeoJson(data) {
- //处理为对象格式转化
- let dataContent = this.string2Csv(data);
- let fieldCaptions = dataContent.colTitles;
- //位置属性处理
- let xfieldIndex = -1,
- yfieldIndex = -1;
- for (let i = 0, len = fieldCaptions.length; i < len; i++) {
- if (this.isXField(fieldCaptions[i])) {
- xfieldIndex = i;
- }
- if (this.isYField(fieldCaptions[i])) {
- yfieldIndex = i;
- }
- }
- // feature 构建后期支持坐标系 4326/3857
- let features = [];
- for (let i = 0, len = dataContent.rows.length; i < len; i++) {
- let row = dataContent.rows[i];
- //if (featureFrom === "LonLat") {
- let x = Number(row[xfieldIndex]),
- y = Number(row[yfieldIndex]);
- //属性信息
- let attributes = {};
- for (let index in dataContent.colTitles) {
- let key = dataContent.colTitles[index];
- attributes[key] = dataContent.rows[i][index];
- }
- //目前csv 只支持处理点,所以先生成点类型的 geojson
- let feature = {
- "type": "Feature",
- "geometry": {
- "type": "Point",
- "coordinates": [x, y]
- },
- "properties": attributes
- };
- features.push(feature);
- }
- return features;
- },
- /**
- * @description 判断是否地理X坐标
- * @param {string} data 字段名
- */
- isXField(data) {
- var lowerdata = data.toLowerCase();
- return (lowerdata === "x" || lowerdata === "smx" ||
- lowerdata === "jd" || lowerdata === "经度" || lowerdata === "东经" || lowerdata === "longitude" ||
- lowerdata === "lot" || lowerdata === "lon" || lowerdata === "lng" || lowerdata === "x坐标");
- },
- /**
- * @description 判断是否地理Y坐标
- * @param {string} data 字段名
- */
- isYField(data) {
- var lowerdata = data.toLowerCase();
- return (lowerdata === "y" || lowerdata === "smy" ||
- lowerdata === "wd" || lowerdata === "纬度" || lowerdata === "北纬" ||
- lowerdata === "latitude" || lowerdata === "lat" || lowerdata === "y坐标");
- },
- /**
- * @description 字符串转为dataEditor 支持的csv格式数据
- * @param {string} string 待转化的字符串
- * @param {boolean} withoutTitle 是否需要列标题
- */
- string2Csv(string, withoutTitle) {
- // let rows = string.split('\r\n');
- let rows = string.split('\n');
- let result = {};
- if (!withoutTitle) {
- result["colTitles"] = rows[0].split(',');
- } else {
- result["colTitles"] = [];
- }
- result['rows'] = [];
- for (let i = (withoutTitle) ? 0 : 1; i < rows.length; i++) {
- rows[i] && result['rows'].push(rows[i].split(','));
- }
- return result;
- }
- };
- ;// CONCATENATED MODULE: ./src/common/components/chart/ChartModel.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ChartModel
- * @classdesc 图表组件数据模型
- * @private
- * @param {Object} datasets - 数据来源。
- * @category Components Chart
- * @fires ChartModel#getdatafailed
- */
- class ChartModel {
- constructor(datasets) {
- this.datasets = datasets;
- this.EVENT_TYPES = ['getdatafailed'];
- this.events = new Events(this, null, this.EVENT_TYPES);
- }
- /**
- * @private
- * @function ChartModel.prototype.getDatasetInfo
- * @description 获得数据集数据。
- * @param {string} datasetUrl - 数据集资源地址。
- */
- getDatasetInfo(success) {
- let datasetUrl = this.datasets.url;
- let me = this;
- FetchRequest.get(datasetUrl)
- .then(function (response) {
- return response.json();
- })
- .then(function (results) {
- if (results.datasetInfo) {
- let datasetInfo = results.datasetInfo;
- me.datasetsInfo = {
- dataSourceName: datasetInfo.dataSourceName,
- datasetName: datasetInfo.name,
- mapName: results.name
- };
- success({
- result: me.datasetsInfo
- });
- }
- })
- .catch(function (error) {
- console.log(error);
- me._fireFailedEvent(error);
- });
- }
- /**
- * @private
- * @function ChartModel.prototype.getDataFeatures
- * @description 请求数据集的数据信息
- * @param {Object} results - 数据集信息。
- * @param {function} success - 成功回调函数。
- */
- getDataFeatures(results, success) {
- let datasetsInfo = results.result;
- let getFeatureParam, getFeatureBySQLParams, getFeatureBySQLService;
- let params = {
- name: datasetsInfo.datasetName + '@' + datasetsInfo.dataSourceName
- };
- Object.assign(params, this.datasets.queryInfo);
- getFeatureParam = new FilterParameter(params);
- getFeatureBySQLParams = new GetFeaturesBySQLParameters({
- queryParameter: getFeatureParam,
- datasetNames: [datasetsInfo.dataSourceName + ':' + datasetsInfo.datasetName],
- fromIndex: 0,
- toIndex: 100000
- });
- getFeatureBySQLService = new GetFeaturesBySQLService(datasetsInfo.dataUrl, {
- eventListeners: {
- processCompleted: success,
- processFailed: function () {}
- }
- });
- getFeatureBySQLService.processAsync(getFeatureBySQLParams);
- }
- /**
- * @private
- * @function ChartModel.prototype.getLayerFeatures
- * @description 请求图层要素的数据信息
- * @param {Object} results - 数据集信息。
- * @param {Callbacks} success - 成功回调函数。
- */
- getLayerFeatures(results, success) {
- let datasetsInfo = results.result;
- let queryParam, queryBySQLParams, queryBySQLService;
- let params = {
- name: datasetsInfo.mapName
- };
- Object.assign(params, this.datasets.queryInfo);
- queryParam = new FilterParameter(params);
- queryBySQLParams = new QueryBySQLParameters({
- queryParams: [queryParam],
- expectCount: 100000
- });
- queryBySQLService = new QueryBySQLService(datasetsInfo.dataUrl, {
- eventListeners: {
- processCompleted: success,
- processFailed: function () {}
- }
- });
- queryBySQLService.processAsync(queryBySQLParams);
- }
- /**
- * @private
- * @function ChartModel.prototype.getDataInfoByIptl
- * @description 用dataId获取iportal的数据。
- * @param {Callbacks} success - 成功回调函数。
- *
- */
- getDataInfoByIptl(success) {
- // success是chart的回调
- this.getServiceInfo(this.datasets.url, success);
- }
- /**
- * @private
- * @function ChartModel.prototype.getServiceInfo
- * @description 用iportal获取dataItemServices。
- * @param {string} url
- * @param {Callbacks} success - 成功回调函数。
- * */
- getServiceInfo(url, success) {
- let me = this;
- FetchRequest.get(url, null, {
- withCredentials: this.datasets.withCredentials
- })
- .then((response) => {
- return response.json();
- })
- .then((data) => {
- if (data.succeed === false) {
- //请求失败
- me._fireFailedEvent(data);
- return;
- }
- // 是否有rest服务
- if (data.dataItemServices && data.dataItemServices.length > 0) {
- let dataItemServices = data.dataItemServices,
- resultData;
- dataItemServices.forEach((item) => {
- // 如果有restdata并且发布成功,就请求restdata服务
- // 如果有restmap并且发布成功,就请求restmap服务
- // 其他情况就请求iportal/content.json
- if (item.serviceType === 'RESTDATA' && item.serviceStatus === 'PUBLISHED') {
- resultData = item;
- } else if (item.serviceType === 'RESTMAP' && item.serviceStatus === 'PUBLISHED') {
- resultData = item;
- } else {
- me.getDatafromContent(url, success);
- return;
- }
- });
- // 如果有服务,获取数据源和数据集, 然后请求rest服务
- resultData && me.getDatafromRest(resultData.serviceType, resultData.address, success);
- } else {
- me.getDatafromContent(url, success);
- return;
- }
- })
- .catch((error) => {
- console.log(error);
- me._fireFailedEvent(error);
- });
- }
- /**
- * @private
- * @function ChartModel.prototype.getDatafromURL
- * @description 用iportal获取数据。(通过固定的url来请求,但是不能请求工作空间的数据)
- * @param {string} url
- * @param {Callbacks} success - 成功回调函数。
- */
- getDatafromContent(url, success) {
- // 成功回调传入的results
- let results = {
- result: {}
- },
- me = this;
- url += '/content.json?pageSize=9999999¤tPage=1';
- // 获取图层数据
- FetchRequest.get(url, null, {
- withCredentials: this.datasets.withCredentials
- })
- .then((response) => {
- return response.json();
- })
- .then((data) => {
- if (data.succeed === false) {
- //请求失败
- me._fireFailedEvent(data);
- return;
- }
- if (data.type) {
- if (data.type === 'JSON' || data.type === 'GEOJSON') {
- // 将字符串转换成json
- data.content = JSON.parse(data.content.trim());
- // 如果是json文件 data.content = {type:'fco', features},格式不固定
- if (!data.content.features) {
- //json格式解析失败
- console.log(Lang.i18n('msg_jsonResolveFiled'));
- return;
- }
- let features = this._formatGeoJSON(data.content);
- results.result.features = {
- type: data.content.type,
- features
- };
- } else if (data.type === 'EXCEL' || data.type === 'CSV') {
- let features = this._excelData2Feature(data.content);
- results.result.features = {
- type: 'FeatureCollection',
- features
- };
- }
- success(results, 'content');
- }
- }, this)
- .catch((error) => {
- console.log(error);
- me._fireFailedEvent(error);
- });
- }
- /**
- * @private
- * @function ChartModel.prototype._getDataSource
- * @description 获取数据源名和数据集名。
- * @param {string} serviceType 服务类型
- * @param {string} address 地址
- * @param {Callbacks} success - 成功回调函数。
- * @return {Array.<string>} ["数据源名:数据集名"]
- * @return {string} 图层名
- */
- getDatafromRest(serviceType, address, success) {
- let me = this,
- withCredentials = this.datasets.withCredentials;
- if (serviceType === 'RESTDATA') {
- let url = `${address}/data/datasources`,
- sourceName,
- datasetName;
- // 请求获取数据源名
- FetchRequest.get(url, null, {
- withCredentials
- })
- .then((response) => {
- return response.json();
- })
- .then((data) => {
- sourceName = data.datasourceNames[0];
- url = `${address}/data/datasources/${sourceName}/datasets`;
- // 请求获取数据集名
- FetchRequest.get(url, null, {
- withCredentials
- })
- .then((response) => {
- return response.json();
- })
- .then((data) => {
- datasetName = data.datasetNames[0];
- // 请求restdata服务
- me.getDatafromRestData(`${address}/data`, [sourceName + ':' + datasetName], success);
- return [sourceName + ':' + datasetName];
- })
- .catch(function (error) {
- me._fireFailedEvent(error);
- });
- })
- .catch(function (error) {
- me._fireFailedEvent(error);
- });
- } else {
- // 如果是地图服务
- let url = `${address}/maps`,
- mapName,
- layerName,
- path;
- // 请求获取地图名
- FetchRequest.get(url, null, {
- withCredentials
- })
- .then((response) => {
- return response.json();
- })
- .then((data) => {
- mapName = data[0].name;
- path = data[0].path;
- url = url = `${address}/maps/${mapName}/layers`;
- // 请求获取图层名
- FetchRequest.get(url, null, {
- withCredentials
- })
- .then((response) => {
- return response.json();
- })
- .then((data) => {
- layerName = data[0].subLayers.layers[0].caption;
- // 请求restmap服务
- me.getDatafromRestMap(layerName, path, success);
- return layerName;
- })
- .catch(function (error) {
- me._fireFailedEvent(error);
- });
- })
- .catch(function (error) {
- me._fireFailedEvent(error);
- });
- }
- }
- /**
- * @private
- * @function ChartModel.prototype.getDatafromRestData
- * @description 请求restdata服务
- * @param {string} url
- * @param {Array<string>} dataSource [数据源名:数据集名]
- * @param {Callbacks} success - 成功回调函数。
- */
- getDatafromRestData(url, dataSource, success) {
- let me = this;
- this.datasets.queryInfo.attributeFilter = this.datasets.queryInfo.attributeFilter || 'SmID>0';
- this._getFeatureBySQL(
- url,
- dataSource,
- this.datasets.queryInfo,
- (results) => {
- // 此时的features已经处理成geojson了
- success(results, 'RESTDATA');
- },
- (error) => {
- console.log(error);
- me._fireFailedEvent(error);
- }
- );
- }
- /**
- * @private
- * @function ChartModel.prototype.getDatafromRestMap
- * @description 请求restmap服务
- * @param {string} dataSource layerName
- * @param {string} path - map服务地址。
- * @param {Callbacks} success - 成功回调函数。
- */
- getDatafromRestMap(dataSource, path, success) {
- let me = this;
- this.datasets.queryInfo.attributeFilter = this.datasets.queryInfo.attributeFilter || 'smid=1';
- this._queryFeatureBySQL(
- path,
- dataSource,
- this.datasets.queryInfo,
- null,
- null,
- (results) => {
- // let features = result.result.recordsets[0].features;
- success(results, 'RESTMAP');
- },
- (error) => {
- console.log(error);
- me._fireFailedEvent(error);
- }
- );
- }
- /**
- * @private
- * @function ChartModel.prototype._getFeatureBySQL
- * @description 通过 sql 方式查询数据。
- */
- _getFeatureBySQL(url, datasetNames, queryInfo, processCompleted, processFaild) {
- let getFeatureParam, getFeatureBySQLService, getFeatureBySQLParams;
- let params = {
- name: datasetNames.join().replace(':', '@')
- };
- Object.assign(params, queryInfo);
- getFeatureParam = new FilterParameter(params);
- getFeatureBySQLParams = new GetFeaturesBySQLParameters({
- queryParameter: getFeatureParam,
- datasetNames: datasetNames,
- fromIndex: 0,
- toIndex: 100000,
- returnContent: true
- });
- let options = {
- eventListeners: {
- processCompleted: (getFeaturesEventArgs) => {
- processCompleted && processCompleted(getFeaturesEventArgs);
- },
- processFailed: (e) => {
- processFaild && processFaild(e);
- }
- }
- };
- getFeatureBySQLService = new GetFeaturesBySQLService(url, options);
- getFeatureBySQLService.processAsync(getFeatureBySQLParams);
- }
- /**
- * @private
- * @function ChartModel.prototype._queryFeatureBySQL
- * @description 通过 sql 方式查询数据。
- */
- _queryFeatureBySQL(
- url,
- layerName,
- queryInfo,
- fields,
- epsgCode,
- processCompleted,
- processFaild,
- startRecord,
- recordLength,
- onlyAttribute
- ) {
- var queryParam, queryBySQLParams;
- var filterParams = {
- name: layerName
- };
- Object.assign(filterParams, queryInfo);
- queryParam = new FilterParameter(filterParams);
- if (fields) {
- queryParam.fields = fields;
- }
- var params = {
- queryParams: [queryParam]
- };
- if (onlyAttribute) {
- params.queryOption = QueryOption.ATTRIBUTE;
- }
- startRecord && (params.startRecord = startRecord);
- recordLength && (params.expectCount = recordLength);
- if (epsgCode) {
- params.prjCoordSys = {
- epsgCode: epsgCode
- };
- }
- queryBySQLParams = new QueryBySQLParameters(params);
- this._queryBySQL(url, queryBySQLParams, (data) => {
- data.type === 'processCompleted' ? processCompleted(data) : processFaild(data);
- });
- }
- /**
- * @function ChartModel.prototype._queryBySQL
- * @description SQL 查询服务。
- * @param {QueryBySQLParameters} params - SQL 查询相关参数类。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 结果类型。
- */
- _queryBySQL(url, params, callback, resultFormat) {
- var me = this;
- var queryBySQLService = new QueryBySQLService(url, {
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: me._processFormat(resultFormat)
- });
- queryBySQLService.processAsync(params);
- }
- /**
- * @function ChartModel.prototype._processFormat
- * @description 将数据转换成geojson。
- * @param {Object} resultFormat - 返回结果集。
- * @return {Object} [resultFormat=DataFormat.GEOJSON] - 结果类型。
- */
- _processFormat(resultFormat) {
- return resultFormat ? resultFormat : DataFormat.GEOJSON;
- }
- /**
- * @private
- * @function ChartModel.prototype._formatGeoJSON
- * @description 格式 GeoJSON。
- * @param {GeoJSON} data - GeoJSON 数据。
- */
- _formatGeoJSON(data) {
- let features = data.features;
- features.forEach((row, index) => {
- row.properties['index'] = index;
- });
- return features;
- }
- /**
- * @private
- * @description 将 csv 和 xls 文件内容转换成 geojson
- * @function ChartModel.prototype._excelData2Feature
- * @param content 文件内容
- * @param layerInfo 图层信息
- * @returns {Array} feature的数组集合
- */
- _excelData2Feature(dataContent) {
- let fieldCaptions = dataContent.colTitles;
- //位置属性处理
- let xfieldIndex = -1,
- yfieldIndex = -1;
- for (let i = 0, len = fieldCaptions.length; i < len; i++) {
- if (FileReaderUtil.isXField(fieldCaptions[i])) {
- xfieldIndex = i;
- }
- if (FileReaderUtil.isYField(fieldCaptions[i])) {
- yfieldIndex = i;
- }
- }
- // feature 构建后期支持坐标系 4326/3857
- let features = [];
- for (let i = 0, len = dataContent.rows.length; i < len; i++) {
- let row = dataContent.rows[i];
- let x = Number(row[xfieldIndex]),
- y = Number(row[yfieldIndex]);
- //属性信息
- let attributes = {};
- for (let index in dataContent.colTitles) {
- let key = dataContent.colTitles[index];
- attributes[key] = dataContent.rows[i][index];
- }
- attributes['index'] = i + '';
- //目前csv 只支持处理点,所以先生成点类型的 geojson
- let feature = {
- type: 'Feature',
- geometry: {
- type: 'Point',
- coordinates: [x, y]
- },
- properties: attributes
- };
- features.push(feature);
- }
- return features;
- }
- /**
- * @private
- * @description 请求数据失败的事件
- * @function ChartModel.prototype._fireFailedEvent
- * @param {Object} error 错误信息
- */
- _fireFailedEvent(error) {
- let errorData = error
- ? {
- error,
- message: Lang.i18n('msg_getdatafailed')
- }
- : {
- message: Lang.i18n('msg_getdatafailed')
- };
- /**
- * @event ChartModel#getdatafailed
- * @description 监听到获取数据失败事件后触发
- * @property {Object} error - 事件对象。
- */
- this.events.triggerEvent('getdatafailed', errorData);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/components/chart/ChartViewModel.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ChartViewModel
- * @aliasclass Components.ChartViewModel
- * @deprecatedclass SuperMap.Components.ChartViewModel
- * @classdesc 图表组件功能类
- * @category Components Chart
- * @version 10.0.0
- * @param {Object} options - 可选参数。
- * @param {string} options.type - 图表类型。
- * @param {ChartView.Datasets} options.datasets - 数据来源。
- * @param {Array.<Object>} options.chartOptions - 图表可选配置。
- * @param {Array.<Object>} options.chartOptions.xAxis - X轴可选参数。
- * @param {string} options.chartOptions.xAxis.field - X轴字段名。
- * @param {string} options.chartOptions.xAxis.name - X轴名称。
- * @param {Array.<Object>} options.chartOptions.yAxis - Y轴可选参数。
- * @param {string} options.chartOptions.yAxis.field - Y轴字段名。
- * @param {string} options.chartOptions.yAxis.name - Y轴名称。
- * @fires ChartViewModel#getdatafailed
- * @usage
- */
- class ChartViewModel {
- constructor(options) {
- this.datasets = options.datasets;
- this.xField = [];
- this.yField = [];
- this.grid = {
- top: "50px",
- bottom: "50px",
- left: "50px",
- right: "60px"
- };
- this.chartType = options.type || "bar";
- this._initXYField(options.chartOptions);
- this.EVENT_TYPES = ["getdatafailed"];
- this.events = new Events(this, null, this.EVENT_TYPES);
- }
- /**
- * @function ChartViewModel.prototype._initXYField
- * @description 初始化XY字段。
- * @private
- * @param {Object} chartOptions - options里的图表参数。
- */
- _initXYField(chartOptions) {
- let me = this;
- if (chartOptions && chartOptions.length > 0) {
- chartOptions.forEach(function (option) {
- if (option.xAxis) {
- me.xField.push({
- field: option.xAxis.field,
- name: option.xAxis.name
- });
- }
- if (option.yAxis) {
- me.yField.push({
- field: option.yAxis.field,
- name: option.yAxis.name
- });
- }
- });
- }
- }
- /**
- * @function ChartViewModel.prototype.getDatasetInfo
- * @description 获得数据集数据。
- * @param {function} success - 成功回调函数。
- */
- getDatasetInfo(success) {
- this.createChart = success;
- if (this.datasets && this._checkUrl(this.datasets.url)) {
- this.chartModel = new ChartModel(this.datasets);
- if(this.datasets.type === 'iServer'){
- this.chartModel.getDatasetInfo(this._getDatasetInfoSuccess.bind(this));
- }else if(this.datasets.type === 'iPortal'){
- this.chartModel.getDataInfoByIptl(this._getDataInfoSuccess.bind(this));
- }
- /**
- * @event ChartViewModel#getdatafailed
- * @description 监听到获取数据失败事件后触发。
- * @property {Object} error - 事件对象。
- */
- this.chartModel.events.on({"getdatafailed": (error) => {
- this.events.triggerEvent("getdatafailed", error)
- }});
- }
- }
- /**
- * @function ChartViewModel.prototype._getDatasetInfoSuccess
- * @description 成功回调函数。
- * @private
- * @param {Object} results - 数据集信息。
- */
- _getDatasetInfoSuccess(results) {
- let datasetUrl = this.datasets.url;
- //判断服务为地图服务 或者 数据服务
- let restIndex = datasetUrl.indexOf("rest");
- if (restIndex > 0) {
- let index = datasetUrl.indexOf("/", restIndex + 5);
- let type = datasetUrl.substring(restIndex + 5, index);
- let dataUrl = datasetUrl.substring(0, restIndex + 4) + "/data";
- if (type === "maps") {
- let mapIndex = datasetUrl.indexOf("/", index + 1);
- let mapName = datasetUrl.substring(index + 1, mapIndex);
- dataUrl = datasetUrl.substring(0, restIndex + 4) + "/maps/" + mapName;
- results.result.dataUrl = dataUrl;
- this._getLayerFeatures(results);
- } else if (type === "data") {
- results.result.dataUrl = dataUrl;
- this._getDataFeatures(results);
- }
- }
- }
- /**
- * @function ChartViewModel.prototype._getDataInfoSuccess
- * @description 请求iportal数据成功之后的回调。
- * @private
- */
- _getDataInfoSuccess(results, type) {
- let me = this;
- if(type === 'RESTMAP'){
- me._getChartDatasFromLayer(results);
- }else{
- me._getChartDatas(results);
- }
- }
- /**
- * @function ChartViewModel.prototype._getDataFeatures
- * @description 请求数据集的数据信息
- * @private
- * @param {Object} results - 数据集信息
- */
- _getDataFeatures(results) {
- this.chartModel.getDataFeatures(results, this._getChartDatas.bind(this));
- }
- /**
- * @function ChartViewModel.prototype._getLayerFeatures
- * @description 请求图层的数据信息。
- * @private
- * @param {Object} results - 数据集信息。
- */
- _getLayerFeatures(results) {
- this.chartModel.getLayerFeatures(results, this._getChartDatasFromLayer.bind(this));
- }
- /**
- * @function ChartViewModel.prototype._getChartDatas
- * @description 将请求回来的数据转换为图表所需的数据格式。
- * @private
- * @param {Object} results - 数据要素信息。
- */
- _getChartDatas(results) {
- if (results) {
- // 数据来自restdata---results.result.features
- this.features = results.result.features;
- let features = this.features.features;
- let data = {};
- if (features.length) {
- let feature = features[0];
- let attrFields = [],
- itemTypes = [];
- for (let attr in feature.properties) {
- attrFields.push(attr);
- itemTypes.push(this._getDataType(feature.properties[attr]));
- }
- data = {
- features,
- fieldCaptions: attrFields,
- fieldTypes: itemTypes,
- fieldValues: []
- }
- for (let m in itemTypes) {
- let fieldValue = [];
- for (let j in features) {
- let feature = features[j];
- let caption = data.fieldCaptions[m];
- let value = feature.properties[caption];
- fieldValue.push(value);
- }
- data.fieldValues.push(fieldValue);
- }
- this.createChart(data);
- }
- }
- }
- /**
- * @function ChartViewModel.prototype._getChartDatasFromLayer
- * @description 将请求回来的数据转换为图表所需的数据格式。
- * @private
- * @param {Object} results - 图层数据要素信息。
- */
- _getChartDatasFromLayer(results) {
- if (results.result.recordsets) {
- let recordsets = results.result.recordsets[0];
- let features = recordsets.features.features;
- this.features = recordsets.features;
- let data = {};
- if (features.length) {
- data = {
- features: recordsets.features,
- fieldCaptions: recordsets.fieldCaptions,
- fieldTypes: recordsets.fieldTypes,
- fieldValues: []
- }
- for (let m in data.fieldCaptions) {
- let fieldValue = [];
- for (let j in features) {
- let feature = features[j];
- let caption = data.fieldCaptions[m];
- let value = feature.properties[caption];
- fieldValue.push(value);
- }
- data.fieldValues.push(fieldValue);
- }
- this.createChart(data);
- }
- }
- }
- /**
- * @function ChartViewModel.prototype._createChartOptions
- * @description 创建图表所需参数。
- * @private
- * @param {Object} data - 图表数据。
- */
- _createChartOptions(data) {
- this.calculatedData = this._createChartDatas(data);
- return this.updateChartOptions(this.chartType);
- }
- /**
- * @function ChartViewModel.prototype.changeType
- * @description 改变图表类型。
- * @param {string} type - 图表类型。
- */
- changeType(type) {
- if (type !== this.chartType) {
- this.chartType = type;
- return this.updateChartOptions(this.chartType);
- }
- }
- /**
- * @function ChartViewModel.prototype.updateData
- * @description 改变图表类型。
- * @param {ChartView.Datasets} datasets - 数据来源。
- * @param {function} success 成功回调函数。
- */
- updateData(datasets, chartOption, success) {
- this.updateChart = success;
- this.xField = [];
- this.yField = [];
- this._initXYField(chartOption);
- // type的设置默认值
- datasets.type = datasets.type || 'iServer';
- // withCredentials的设置默认值
- datasets.withCredentials = datasets.withCredentials || false;
- this.datasets = datasets;
- this.getDatasetInfo(this._updateDataSuccess.bind(this));
- }
- /**
- * @function ChartViewModel.prototype._updateDataSuccess
- * @description 改变图表类型。
- * @private
- * @param {Object} data - 图表数据。
- */
- _updateDataSuccess(data) {
- let options = this._createChartOptions(data);
- this.updateChart(options);
- }
- /**
- * @function ChartViewModel.prototype.updateChartOptions
- * @description 更新图表所需参数。
- * @param {string} type - 图表类型。
- * @param {Object} style - 图表样式。
- */
- updateChartOptions(type, style) {
- if (this.calculatedData) {
- let grid = this.grid;
- let series = this._createChartSeries(this.calculatedData, type);
- let datas = [];
- for (let i in this.calculatedData.XData) {
- datas.push({
- value: this.calculatedData.XData[i].fieldsData
- });
- }
- let xAxis = {
- type: "category",
- name: this.xField[0].name || "X",
- data: datas,
- nameTextStyle: {
- color: '#fff',
- fontSize: 14
- },
- splitLine: {
- show: false
- },
- axisLine: {
- lineStyle: {
- color: '#eee'
- }
- }
- }
- let yAxis = {
- type: "value",
- name: this.yFieldName || "Y",
- data: {},
- nameTextStyle: {
- color: '#fff',
- fontSize: 14
- },
- splitLine: {
- show: false
- },
- axisLine: {
- lineStyle: {
- color: '#eee'
- }
- }
- }
- let tooltip = {
- formatter: '{b0}: {c0}'
- };
- let backgroundColor = '#404a59';
- if (style) {
- if (style.grid) {
- grid = style.grid;
- }
- if (style.tooltip) {
- tooltip = style.tooltip;
- }
- if (style.backgroundColor) {
- backgroundColor = style.backgroundColor;
- }
- }
- return {
- backgroundColor: backgroundColor,
- grid: grid,
- series: series,
- xAxis: xAxis,
- yAxis: yAxis,
- tooltip: tooltip
- }
- }
- }
- /**
- * @function ChartViewModel.prototype._createChartDatas
- * @description 构建图表数据。
- * @private
- * @param {Object} data - 源数据。
- */
- _createChartDatas(data) {
- let fieldIndex = 0, yfieldIndexs = [];
- let fieldCaptions = data.fieldCaptions;
- let me = this;
- //X
- fieldCaptions.forEach(function (field, index) {
- if (me.xField[0] && field === me.xField[0].field) {
- fieldIndex = index;
- }
- });
- //Y
- this.yFieldName = "";
- this.yField.forEach(function (value, index) {
- if (index !== 0) {
- me.yFieldName = me.yFieldName + ",";
- }
- me.yFieldName = me.yFieldName + value.name;
- fieldCaptions.forEach(function (field, index) {
- if (field === value.field) {
- yfieldIndexs.push(index);
- }
- });
- })
- let datas = this._getAttrData(data, fieldIndex);
- let yDatas = [];
- if (yfieldIndexs.length > 0) {
- yfieldIndexs.forEach(function (yfieldIndex) {
- let yData = [];
- for (let i in data.fieldValues[yfieldIndex]) {
- yData.push({
- value: data.fieldValues[yfieldIndex][i]
- });
- }
- yDatas.push(yData);
- });
- } else { //未指定Y字段时,y轴计数
- let YData = [],
- XData = [],
- len = datas.length;
- //计算X轴,Y轴数据,并去重
- for (let i = 0; i < len; i++) {
- let isSame = false;
- for (let j = 0, leng = XData.length; j < leng; j++) {
- if (datas[i].fieldsData === XData[j].fieldsData) {
- YData[j].value++;
- XData[j].recordIndexs.push(i);
- isSame = true;
- break;
- }
- }
- if (!isSame) {
- if (datas[i].fieldsData) {
- XData.push({ fieldsData: datas[i].fieldsData, recordIndexs: [i] });
- YData.push({ value: 1 });
- }
- }
- }
- datas = XData;
- yDatas = [YData];
- }
- return {
- XData: datas,
- YData: yDatas
- }
- }
- /**
- * @function ChartViewModel.prototype._getAttrData
- * @description 选中字段数据。
- * @private
- * @param {Object} datacontent - 图表数据。
- * @param {number} index - 字段索引。
- */
- _getAttrData(datacontent, index) {
- if (index === 0) {
- this.xField = [{
- field: datacontent.fieldCaptions[index],
- name: datacontent.fieldCaptions[index]
- }];
- }
- let fieldsDatas = [];
- for (let i = 0, len = datacontent.fieldValues[index].length; i < len; i++) {
- let value = datacontent.fieldValues[index][i];
- fieldsDatas.push({
- recordIndexs: i,
- fieldsData: value
- });
- }
- return fieldsDatas;
- }
- /**
- * @function ChartViewModel.prototype._createChartSeries
- * @description 图表数据。
- * @private
- * @param {Object} calculatedData - 图表数据。
- * @param {string} chartType - 图表类型。
- */
- _createChartSeries(calculatedData, chartType) {
- let series = [];
- let yDatas = calculatedData.YData;
- yDatas.forEach(function (yData) {
- let value = 0;
- let serieData = [];
- for (let data of yData) {
- value = data.value;
- serieData.push({
- value: value
- });
- }
- let serie = {
- type: chartType,
- data: serieData,
- name: "y"
- };
- series.push(serie);
- });
- return series;
- }
- /**
- * @function ChartViewModel.prototype._isDate
- * @description 判断是否为日期。
- * @private
- * @param {string} data - 字符串。
- */
- _isDate(data) {
- 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;
- return reg.test(data);
- }
- /**
- * @function ChartViewModel.prototype._isNumber
- * @description 判断是否为数值。
- * @private
- * @param {string} data - 字符串。
- */
- _isNumber(data) {
- let mdata = Number(data);
- if (mdata === 0) {
- return true;
- }
- return !isNaN(mdata);
- }
- /**
- * @function ChartViewModel.prototype._getDataType
- * @description 判断数据的类型。
- * @private
- * @param {string} data - 字符串。
- */
- _getDataType(data) {
- if (data !== null && data !== undefined && data !== '') {
- if (this._isDate(data)) {
- return "DATE";
- }
- if (this._isNumber(data)) {
- return "NUMBER";
- }
- }
- return "STRING";
- }
- /**
- * @function ChartViewModel.prototype._checkUrl
- * @description 检查url是否符合要求。
- * @private
- * @param {string} url。
- */
- _checkUrl(url) {
- let match;
- if (url === '' || !this._isMatchUrl(url)) {
- match = false;
- } else if (/^http[s]?:\/\/localhost/.test(url) || /^http[s]?:\/\/127.0.0.1/.test(url)) {
- //不是实际域名
- match = false;
- } else {
- match = true;
- }
- return match;
- }
- /**
- * @function ChartViewModel.prototype._isMatchUrl
- * @description 判断输入的地址是否符合地址格式。
- * @private
- * @param {string} str - url。
- */
- _isMatchUrl(str) {
- var reg = new RegExp('(https?|http|file|ftp)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]');
- return reg.test(str);
- }
- /**
- * @function ChartViewModel.prototype.getStyle
- * @description 获取图表样式。
- */
- getStyle() {
- let style = {
- grid: this.grid,
- tooltip: this.tooltip,
- backgroundColor: this.backgroundColor
- }
- return style;
- }
- /**
- * @function ChartViewModel.prototype.getFeatures
- * @description 获取地图服务,数据服务请求返回的数据。
- */
- getFeatures() {
- return this.features;
- }
- /**
- * @function ChartViewModel.prototype.setStyle
- * @description 设置图表样式。
- * @param {Object} style - 图表样式
- */
- setStyle(style) {
- return this.updateChartOptions(this.chartType, style);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/components/chart/ChartView.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ChartView
- * @aliasclass Components.Chart
- * @deprecatedclass SuperMap.Components.Chart
- * @classdesc 图表组件
- * @version 9.1.2
- * @param {string} domID - 图表dom元素ID。
- * @param {Object} options - 可选参数。
- * @param {string} options.type - 图表类型。
- * @param {ChartView.Datasets} options.datasets - 数据来源
- * @param {Array.<Object>} options.chartOptions - 图表可选参数。
- * @param {Array.<Object>} options.chartOptions.xAxis - 图表X轴。
- * @param {string} options.chartOptions.xAxis.field - 图表X轴字段名。
- * @param {string} options.chartOptions.xAxis.name - 图表X轴名称。
- * @param {Array.<Object>} options.chartOptions.yAxis - 图表Y轴。
- * @param {string} options.chartOptions.yAxis.field - 图表Y轴字段名。
- * @param {string} options.chartOptions.yAxis.name - 图表Y轴名称。
- * @category Components Chart
- * @usage
- */
- /**
- * @typedef {Object} ChartView.Datasets - 数据来源
- * @property {string} [type = 'iServer'] - 服务类型 iServer, iPortal。
- * @property {string} url - 服务地址。
- * @property {boolean} [withCredentials = false] - 设置请求是否带cookie
- * @property {FilterParameter} queryInfo - 查询条件
- */
- class ChartView {
- constructor(domID, options) {
- this.domID = domID;
- this.chartType = options.type || "bar";
- // 设置options.datasets.type的默认值是iServer
- options.datasets.type = options.datasets.type || 'iServer';
- // 设置withCredentials的默认值为false
- options.datasets.withCredentials = options.datasets.withCredentials || false;
- this.viewModel = new ChartViewModel(options);
- //添加控件。
- this._fillDataToView();
- }
- /**
- * @function ChartView.prototype.onAdd
- * @description 创建图表之后成功回调
- * @param {function} addChart - 回调函数。
- */
- onAdd(addChart) {
- this.addChart = addChart;
- }
- /**
- * @function ChartView.prototype._fillDataToView
- * @description 填充数据到 view。
- * @private
- */
- _fillDataToView() {
- let messageboxs = new MessageBox();
- //iclient 绑定createChart事件成功回调
- this.viewModel.getDatasetInfo(this._createChart.bind(this));
- this.viewModel.events.on({
- "getdatafailed": (error) => {
- messageboxs.showView(error.message);
- }
- });
- }
- /**
- * @function ChartView.prototype.getStyle
- * @description 获取图表样式。
- */
- getStyle() {
- return this.viewModel.getStyle()
- }
- /**
- * @function ChartView.prototype.getFeatures
- * @description 获取地图服务,数据服务请求返回的数据。
- */
- getFeatures() {
- return this.viewModel.getFeatures();
- }
- /**
- * @function ChartView.prototype.setStyle
- * @description 设置图表样式。
- * @param {Object} style - 图表样式,参考Echarts-options样式设置。
- */
- setStyle(style) {
- let newOptions = this.viewModel.setStyle(style);
- this._updateChart(newOptions);
- }
- /**
- * @function ChartView.prototype.changeType
- * @description 改变图表类型。
- * @param {string} type - 图表类型。
- */
- changeType(type) {
- if (this.chartType !== type) {
- this.chartType = type;
- let newOptions = this.viewModel.changeType(type);
- this._updateChart(newOptions);
- }
- }
- /**
- * @function ChartView.prototype.updateData
- * @description 更新图表数据。
- * @param {ChartView.Datasets} datasets - 数据来源。
- * @param {Object} chartOption - X,Y轴信息。
- */
- updateData(datasets, chartOption) {
- let me = this;
- this.viewModel.updateData(datasets, chartOption, function (options) {
- me._updateChart(options);
- if (me.addChart) {
- me.addChart();
- }
- });
- }
- /**
- * @function ChartView.prototype._createChart
- * @description 创建图表。
- * @private
- * @param {Object} data - 图表数据。
- */
- _createChart(data) {
- this.echart = external_function_try_return_echarts_catch_e_return_default().init(
- document.getElementById(this.domID),
- null, {
- renderer: "canvas"
- }
- )
- let options = this.viewModel._createChartOptions(data);
- this.echart.setOption(options);
- if (this.addChart) {
- this.addChart();
- }
- }
- /**
- * @function ChartView.prototype._updateChart
- * @description 更新图表。
- * @private
- * @param {Object} options - 图表参数。
- */
- _updateChart(options) {
- if (this.echart) {
- this.echart.clear();
- this.echart.setOption(options);
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/components/templates/TemplateBase.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class TemplateBase
- * @aliasclass Components.TemplateBase
- * @deprecatedclass SuperMap.Components.TemplateBase
- * @classdesc 组件公用组件父类,用于约束统一封装的公用组件结构。
- * @version 9.1.1
- * @param {Object} options - 组件配置参数。
- * @param {string} options.id - 组件 dom 元素 id。
- * @category Components Common
- * @usage
- */
- class TemplateBase {
- constructor(options) {
- options = options ? options : {};
- /**
- * @member {string} [TemplateBase.prototype.id=null]
- * @description 组件 dom 元素 id。
- */
- this.id = options.id ? options.id : null;
- /**
- * @member {HTMLElement} [TemplateBase.prototype.rootContainer=null]
- * @description 组件 dom 元素对象。
- */
- this.rootContainer = null;
- }
- /**
- * @function TemplateBase.prototype.getElement
- * @description 获取当前组件元素对象。
- * @return {HTMLElement} 组件 dom 元素对象
- */
- getElement() {
- //todo 其实感觉再这里给组件设置不太合理
- if (this.id) {
- this.rootContainer.id = this.id;
- }
- return this.rootContainer;
- }
- /**
- * @function TemplateBase.prototype._initView
- * @private
- * @description 初始化模板。
- */
- _initView() {
- //子类实现此方法
- }
- /**
- * @function TemplateBase.prototype.showView
- * @description 显示组件。
- */
- showView() {
- this.rootContainer.hidden = false;
- }
- /**
- * @function TemplateBase.prototype.closeView
- * @description 隐藏组件。
- */
- closeView() {
- this.rootContainer.hidden = true;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/components/templates/CommonContainer.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class CommonContainer
- * @aliasclass Components.CommonContainer
- * @deprecatedclass SuperMap.Components.CommonContainer
- * @classdesc 组件统一外框。
- * @version 9.1.1
- * @param {Object} options - 组件配置参数。
- * @param {string} options.id - 组件 dom 元素 id。
- * @param {string} options.title - 标题。
- * @category Components Common
- * @extends {TemplateBase}
- * @usage
- */
- class CommonContainer extends TemplateBase {
- constructor(options) {
- super(options);
- let title = options.title ? options.title : "";
- this._initView(title);
- }
- /**
- * @private
- * @override
- */
- _initView(title) {
- const container = document.createElement("div");
- container.setAttribute("class", "component-container");
- //title
- const titleContainer = document.createElement("div");
- titleContainer.setAttribute("class", "component-title");
- const titleContent = document.createElement("div");
- titleContent.innerHTML = title;
- titleContainer.appendChild(titleContent);
- container.appendChild(titleContainer);
- //container
- const componentContent = document.createElement("div");
- componentContent.setAttribute("class", "component-content");
- container.appendChild(componentContent);
- this.content = componentContent;
- this.rootContainer = container;
- return container;
- }
- /**
- * @function CommonContainer.prototype.getContentElement
- * @description 获取内容元素容器。
- */
- getContentElement() {
- return this.content;
- }
- /**
- * @function CommonContainer.prototype.appendContent
- * @description 填充内容元素。
- */
- appendContent(element) {
- this.content.appendChild(element);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/components/templates/Select.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class Select
- * @aliasclass Components.Select
- * @deprecatedclass SuperMap.Components.Select
- * @classdesc 组件统一的文字下拉框。
- * @version 9.1.1
- * @param {Array.<string|Array>} options - 组件配置参数数组。
- * @param {string} options.id - 组件 dom 元素 id。
- * @param {string} [options.labelName] - label 名称。
- * @param {Array.<string>} options.optionsArr - 需要创建的 option 数据数组。
- * @param {function} [options.optionsClickCb] - option 点击事件回调函数。
- * @extends {TemplateBase}
- * @category Components Common
- * @usage
- */
- class Select extends TemplateBase {
- constructor(options) {
- super(options);
- this._initView(options);
- }
- _initView(options) {
- let selectTool = this._createElement('div', "component-selecttool");
- if (options.labelName) {
- let label = this._createElement('label', 'component-selecttool__lable--describe', selectTool);
- label.innerHTML = options.labelName;
- }
- let chartSelect = this._createElement('div', 'component-selecttool--chart', selectTool);
- chartSelect.setAttribute('tabindex', '1');
- let selectName = this._createElement('div', "component-selecttool__name", chartSelect);
- selectName.title = options.optionsArr[0];
- selectName.innerHTML = options.optionsArr[0];
- let chartTriangleBtn = this._createElement('div', 'component-selecttool__trianglebtn--chart', chartSelect);
- let triangleBtn = this._createElement('div', 'component-triangle-down-img', chartTriangleBtn);
- let selectContent = this._createElement('div', 'component-selecttool__content', chartSelect);
- let scrollarea = this._createElement('div', 'component-selecttool__content--chart', selectContent);
- let scrollareaContent = this._createElement('div', 'component-selecttool__scrollarea__content', scrollarea);
- scrollareaContent.setAttribute('tabindex', '1');
- this.createOptions(scrollareaContent, options.optionsArr);
- this.optionClickEvent(scrollareaContent, selectName, options.optionsClickCb);
- // 下拉框显示 & 隐藏事件
- this._selectClickEvent(chartSelect, selectContent, triangleBtn);
- this.rootContainer = selectTool;
- }
- /**
- * @function Select.prototype.createOptions
- * @description 创建所属下拉框选项。
- */
- createOptions(container, optionsArr) {
- for (let i in optionsArr) {
- let option = this._createElement('div', 'component-selecttool__option', container);
- option.title = optionsArr[i];
- option.innerHTML = optionsArr[i];
- }
- }
- /**
- * @function Select.prototype._selectClickEvent
- * @description select 点击显示&隐藏事件。
- * @private
- */
- _selectClickEvent(eventElement, contentElement, triangleBtn) {
- eventElement.onclick = function (e) {
- if (contentElement.style.display === "block") {
- contentElement.style.display = "none";
- triangleBtn.className = "component-triangle-down-img";
- } else {
- contentElement.style.display = "block";
- triangleBtn.className = "triangle-up-img";
- }
- e.preventDefault();
- e.stopPropagation();
- };
- eventElement.onmousedown = function (evt) {
- //console.log('dropdownbox onmousedown '+evt.target.className);
- if (evt.target !== this) {
- this.focus();
- evt.preventDefault();
- evt.stopPropagation()
- }
- };
- eventElement.onblur = function () {
- contentElement.style.display = "none";
- triangleBtn.className = "component-triangle-down-img";
- }
- }
- /**
- * @function Select.prototype._createElement
- * @description 通用创建元素。
- * @private
- */
- _createElement(tagName, className, parentEle) {
- let ele = document.createElement(tagName || 'div');
- className && (ele.className = className);
- parentEle && parentEle.appendChild(ele);
- return ele;
- }
- /**
- * @function Select.prototype.optionClickEvent
- * @description 下拉框的 option 的点击事件。
- */
- optionClickEvent(optionEleArr, selectNameEle, optionsClickCb) {
- for (let i = 0; i < optionEleArr.children.length; i++) {
- let childEle = optionEleArr.children[i];
- childEle.onclick = function () {
- selectNameEle.innerHTML = childEle.innerHTML;
- selectNameEle.title = childEle.title;
- if (childEle.getAttribute('data-value')) {
- selectNameEle.setAttribute('data-value', childEle.getAttribute('data-value'))
- }
- optionsClickCb && optionsClickCb(childEle);
- }
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/components/templates/DropDownBox.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class DropDownBox
- * @aliasclass Components.DropDownBox
- * @deprecatedclass SuperMap.Components.DropDownBox
- * @classdesc 组件统一的图片下拉框。
- * @version 9.1.1
- * @param {Array.<Object>} options - 组件配置参数数组。
- * @param {string} options.id - 组件 dom 元素 id。
- * @param {string} options.title - 下拉框 title。
- * @param {string} options.remark - 下拉框解释标记文本。
- * @param {string} [options.dataValue] - 下拉框 attribute 名为 data-value 的值 。
- * @param {string} [options.icon] - 下拉框图标。
- * @param {string} [options.icon.className] - 下拉框图标类名。
- * @param {string} [options.icon.background] - 下拉框图标背景 url。
- * @category Components Common
- * @extends {TemplateBase}
- * @usage
- */
- class DropDownBox extends TemplateBase {
- constructor(optionsArr) {
- super(optionsArr);
- this._initView(optionsArr);
- }
- /**
- * @function DropDownBox.prototype._initView
- * @description 初始化下拉框。
- * @private
- * @override
- */
- _initView(optionsArr) {
- let dropDownContainer = document.createElement('div');
- dropDownContainer.className = 'component-dropdownbox--container';
- let dropDownBox = document.createElement('div');
- dropDownBox.setAttribute('tabindex', '1');
- dropDownBox.className = "component-dropdownbox";
- dropDownContainer.appendChild(dropDownBox);
- let dropDownTopContainer = document.createElement('div');
- dropDownBox.appendChild(dropDownTopContainer);
- this._createDropDownOption(optionsArr[0], dropDownTopContainer);
- let triangleBtnContainer = document.createElement('div');
- triangleBtnContainer.className = 'component-dropdownbox__triangle-btn';
- dropDownBox.appendChild(triangleBtnContainer);
- let triangleBtn = document.createElement('div');
- triangleBtn.className = 'component-triangle-down-img';
- triangleBtnContainer.appendChild(triangleBtn);
- let createDropDownBoxParam = {
- "parentEle": dropDownBox,
- "dropDownContent": ['component-dropdownbox__content component-dropdownbox__content--chart', 'dropDownContent'],
- "scrollareaContent": 'component-selecttool__scrollarea__content',
- "optionsArr": optionsArr,
- "triangleBtn": triangleBtn,
- "dropDownTopContainer": dropDownTopContainer
- };
- this._createDropDownBox(createDropDownBoxParam);
- this.rootContainer = dropDownContainer;
- }
- /**
- * @function DropDownBox.prototype._createDropDownBox
- * @description 创建下拉框。
- * @private
- */
- _createDropDownBox(createDropDownBoxParam) {
- let dropDownBox = createDropDownBoxParam.parentEle;
- let dropDownTopContainer = createDropDownBoxParam.dropDownTopContainer;
- let dropDownContent = document.createElement('div');
- dropDownContent.className = createDropDownBoxParam.dropDownContent[0];
- dropDownBox.appendChild(dropDownContent);
- let scrollareaContent = document.createElement('div');
- scrollareaContent.className = createDropDownBoxParam.scrollareaContent;
- dropDownContent.appendChild(scrollareaContent);
- let optionsArr = createDropDownBoxParam.optionsArr;
- for (let i = 0; i < optionsArr.length; i++) {
- this._createDropDownOption(optionsArr[i], scrollareaContent)
- }
- // 下拉框显示 & 隐藏事件
- let triangleBtn = createDropDownBoxParam.triangleBtn;
- this._dropDownClickEvent(dropDownBox, dropDownContent, triangleBtn);
- this._eleOnblur(dropDownBox, dropDownContent, triangleBtn);
- // 下拉框 options 点击事件
- let scrollareaOptions = scrollareaContent.children;
- for (let i = 0; i < scrollareaOptions.length; i++) {
- scrollareaOptions[i].onclick = function () {
- dropDownTopContainer.innerHTML = scrollareaOptions[i].outerHTML;
- //evt.stopPropagation();
- }
- }
- }
- /**
- * @function DropDownBox.prototype._createDropDownOption
- * @description 创建下拉框子元素。
- * @private
- */
- _createDropDownOption(data, parentElement) {
- let ele = document.createElement('div');
- ele.className = 'component-dropdownbox__item';
- let dataItem = data;
- if (dataItem['dataValue']) {
- ele.setAttribute('data-value', dataItem['dataValue']);
- }
- parentElement.appendChild(ele);
- let imgContainer = document.createElement('div');
- imgContainer.className = 'component-dropdownbox__item__img';
- ele.appendChild(imgContainer);
- let img = document.createElement('div');
- if (dataItem.icon.className) {
- img.className = dataItem.icon.className;
- }
- if (dataItem.icon.background) {
- img.style.background = dataItem.icon.background;
- }
- imgContainer.appendChild(img);
- let title = document.createElement('div');
- title.className = 'component-dropdownbox__item__title';
- title.title = dataItem.title;
- title.innerHTML = dataItem.title;
- ele.appendChild(title);
- let remark = document.createElement('div');
- remark.className = 'component-dropdownbox__item__remark';
- remark.title = dataItem.remark;
- remark.innerHTML = dataItem.remark;
- ele.appendChild(remark);
- }
- /**
- * @function DropDownBox.prototype._dropDownClickEvent
- * @description 下拉框点击事件。
- * @private
- */
- _dropDownClickEvent(eventElement, contentElement, triangleBtn) {
- eventElement.onclick = function (e) {
- if (contentElement.style.display === "block") {
- contentElement.style.display = "none";
- triangleBtn.className = "component-triangle-down-img";
- } else {
- contentElement.style.display = "block";
- triangleBtn.className = "triangle-up-img";
- }
- e.preventDefault();
- e.stopPropagation()
- };
- eventElement.onmousedown = function (evt) {
- //console.log('dropdownbox onmousedown '+evt.target.className);
- if (evt.target !== this) {
- this.focus();
- evt.preventDefault();
- evt.stopPropagation()
- }
- }
- }
- /**
- * @function DropDownBox.prototype._eleOnblur
- * @description 下拉框失焦事件。
- * @private
- */
- _eleOnblur(eventElement, contentElement, triangleBtn) {
- eventElement.onblur = function () {
- contentElement.style.display = "none";
- triangleBtn.className = "component-triangle-down-img";
- }
- }
- /**
- * @function DropDownBox.prototype._createElement
- * @description 通用创建元素。
- * @private
- */
- _createElement(tagName, className, parentEle) {
- let ele = document.createElement(tagName || 'div');
- className && (ele.className = className);
- parentEle && parentEle.appendChild(ele);
- return ele;
- }
- }
- ;// CONCATENATED MODULE: ./src/common/components/templates/PopContainer.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class PopContainer
- * @aliasclass Components.PopContainer
- * @deprecatedclass SuperMap.Components.PopContainer
- * @classdesc 弹框组件。
- * @version 9.1.1
- * @param {Object} options - 组件配置参数。
- * @param {string} options.id - 组件 dom 元素 id。
- * @param {string} options.title - 弹框组件名称。
- * @extends {TemplateBase}
- * @category Components Common
- * @usage
- */
- class PopContainer extends TemplateBase {
- constructor(options) {
- options = options ? options : {};
- super(options);
- options.title = options.title ? options.title : "";
- this._initView(options.title);
- }
- /**
- * @private
- * @override
- */
- _initView(titile) {
- const container = document.createElement("div");
- container.setAttribute("class", "component-popcontainer");
- //header
- const header = document.createElement("div");
- header.setAttribute("class", "component-popcontainer__header");
- const title = document.createElement("label");
- title.setAttribute("class", "component-popcontainer__header__title");
- title.innerHTML = titile;
- header.appendChild(title);
- const closeBtn = document.createElement("span");
- closeBtn.setAttribute("class", "supermapol-icons-clear component-popcontainer__header__close");
- closeBtn.onclick = this.closeView.bind(this);
- container.appendChild(closeBtn);
- container.appendChild(header);
- //content
- const content = document.createElement("div");
- content.setAttribute("class", "component-popcontainer__content");
- this.content = content;
- container.appendChild(content);
- this.rootContainer = container;
- }
- /**
- * @function PopContainer.prototype.appendContent
- * @description 追加内容。
- * @param {HTMLElement} dom - 内容元素。
- */
- appendContent(dom) {
- this.content.appendChild(dom);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/components/templates/AttributesPopContainer.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class AttributesPopContainer
- * @aliasclass Components.AttributesPopContainer
- * @deprecatedclass SuperMap.Components.AttributesPopContainer
- * @classdesc 属性弹框组件
- * @version 9.1.1
- * @param {Object} options - 组件配置参数。
- * @param {string} options.id - 组件 dom 元素 id。
- * @param {Object} options.title - 属性弹框组件名称。
- * @param {Object} options.attributes - 组件需要显示的属性内容。
- * @extends {PopContainer}
- * @category Components Common
- * @usage
- */
- class AttributesPopContainer extends PopContainer {
- constructor(options) {
- //默认为属性:
- options.title = options.title ? options.title : "属性";
- super(options);
- this.rootContainer.firstChild.hidden = true;
- options.attributes = options.attributes ? options.attributes : [];
- this._createAttributesTable(options.attributes);
- }
- _createAttributesTable(attributes) {
- const table = document.createElement("table");
- table.setAttribute("class", "component-popcontainer__content__table");
- const tbody = document.createElement("tbody");
- let single = true;
- for (let name in attributes) {
- const tr = document.createElement("tr");
- if (single) {
- tr.setAttribute("class", "component-popcontainer__content__td--color");
- }
- const title = document.createElement("td");
- const titleSpan = document.createElement("Span");
- titleSpan.innerHTML = name;
- title.appendChild(titleSpan);
- const value = document.createElement("td");
- value.innerHTML = attributes[name];
- tr.appendChild(title);
- tr.appendChild(value);
- tbody.appendChild(tr);
- single = !single;
- }
- table.appendChild(tbody);
- this.appendContent(table);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/components/templates/IndexTabsPageContainer.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class IndexTabsPageContainer
- * @aliasclass Components.IndexTabsPageContainer
- * @deprecatedclass SuperMap.Components.IndexTabsPageContainer
- * @classdesc 标签索引组件。
- * @version 9.1.1
- * @param {Object} options - 组件配置参数。
- * @param {string} options.id - 组件 dom 元素 id。
- * @category Components Common
- * @extends {TemplateBase}
- * @usage
- */
- class IndexTabsPageContainer extends TemplateBase {
- constructor(options) {
- super(options);
- this._initView();
- }
- /**
- * @private
- * @override
- */
- _initView() {
- const container = document.createElement("div");
- container.setAttribute("class", "component-tabpage");
- const header = document.createElement("ul");
- this.header = header;
- const content = document.createElement("div");
- content.setAttribute("class", "component-tabpage__content");
- this.content = content;
- container.appendChild(header);
- container.appendChild(content);
- this.rootContainer = container;
- }
- /**
- * @function IndexTabsPageContainer.prototype.setTabs
- * @description 设置标签元素。
- * @param {Array.<HTMLElement>} tabs
- */
- setTabs(tabs) {
- this.removeAllTabs();
- this.appendTabs(tabs);
- }
- /**
- * @function IndexTabsPageContainer.prototype.appendTabs
- * @description 追加标签元素。
- * @param {Array.<HTMLElement>} tabs
- */
- appendTabs(tabs) {
- for (let i = 0; i < tabs.length; i++) {
- let title = document.createElement("span");
- title.index = i;
- title.appendChild(document.createTextNode(tabs[i].title));
- //绑定标签切换对应页面:
- title.onclick = this._changeTabsPage.bind(this);
- let content = tabs[i].content;
- content.index = i;
- content.hidden = true;
- this.header.appendChild(title);
- this.content.appendChild(content);
- }
- //todo 确认是否两个子元素的 index 相互对应
- //默认显示第一个标签对象
- this.header.firstChild.setAttribute("class", "on");
- this.content.firstChild.hidden = false;
- }
- /**
- * @function IndexTabsPageContainer.prototype.removeTab
- * @description 删除某个标签页面。
- * @param {number} index - 标签索引号。
- */
- removeTab(index) {
- this.header.removeChild(this.header.children[index]);
- this.content.removeChild(this.content.children[index]);
- }
- /**
- * @function IndexTabsPageContainer.prototype.removeAllTabs
- * @description 删除所有标签。
- */
- removeAllTabs() {
- for (let i = this.header.children.length; i > 0; i--) {
- this.header.removeChild(this.header.children[i]);
- this.content.removeChild(this.content.children[i]);
- }
- }
- _changeTabsPage(e) {
- const index = e.target.index;
- for (let i = 0; i < this.header.children.length; i++) {
- this.header.children[i].setAttribute("class", "");
- this.content.children[i].hidden = true;
- if (i === index) {
- this.header.children[i].setAttribute("class", "on");
- this.content.children[i].hidden = false;
- }
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/components/templates/CityTabsPage.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class CityTabsPage
- * @aliasclass Components.CityTabsPage
- * @deprecatedclass SuperMap.Components.CityTabsPage
- * @classdesc 城市地址匹配组件模板
- * @version 9.1.1
- * @param {Object} options - 组件配置参数。
- * @param {string} options.id - 组件 dom 元素 id。
- * @param {Object|Array.<string>} options.config - 城市名称配置列表,支持两种格式:{key1:{A:[],B:[]}, key2:{C:[],D:[]}} 或
- * ["成都市","北京市"],用户可根据自己的项目需求进行配置
- * @extends {IndexTabsPageContainer}
- * @category Components Common
- * @usage
- */
- class CityTabsPage extends IndexTabsPageContainer {
- constructor(options) {
- super(options);
- //去掉默认的边框阴影样式:
- this.rootContainer.classList.add("component-citytabpage--noneBoxShadow");
- this.config = options.config;
- //header,若 config为城市名称数组,则直接加载内容
- if (Util.isArray(this.config)) {
- this.header.hidden = true;
- this._createCityItem("城市", this.config);
- this.content.style.border = "none";
- } else {
- this._createTabs();
- this.header.onclick = (e) => {
- //关闭所有元素 是否有更简化的写法?
- for (let i = 0; i < this.header.children.length; i++) {
- this.header.children[i].setAttribute("class", "");
- }
- //打开点击内容元素
- e.target.setAttribute("class", "on");
- this._createCityContent(e.target.innerHTML);
- };
- }
- }
- /**
- * @function CityTabsPage.prototype._createTabs
- * @description 创建 Tabs
- * @private
- */
- _createTabs() {
- //header
- if (Util.isArray(this.config)) {
- for (let i = 0; i < this.config.length; i++) {
- let innerHTML = "";
- for (const key in this.config[i]) {
- innerHTML += key;
- }
- let li = document.createElement("li");
- li.innerHTML = innerHTML;
- this.header.appendChild(li);
- }
- } else {
- for (const key in this.config) {
- let li = document.createElement("li");
- li.innerHTML = key;
- this.header.appendChild(li);
- }
- }
- this.header.firstChild.setAttribute("class", "on");
- this._createCityContent(this.header.firstChild.innerHTML);
- }
- /**
- * @function CityTabsPage.prototype._createCityContent
- * @description 创建列表容器
- * @private
- */
- _createCityContent(keyName) {
- //清除元素:
- for (let i = this.content.children.length; i > 0; i--) {
- this.content.removeChild(this.content.children[i - 1]);
- }
- //创建对应元素
- const cities = this.config[keyName];
- for (let key in cities) {
- this._createCityItem(key, cities[key]);
- }
- }
- /**
- * @function CityTabsPage.prototype._createCityContent
- * @description 创建列表容器
- * @private
- */
- _createCityItem(key, cities) {
- const city = document.createElement("div");
- const cityClass = document.createElement("div");
- cityClass.setAttribute("class", "component-citytabpag__py-key");
- cityClass.innerHTML = key;
- city.appendChild(cityClass);
- const cityContent = document.createElement("div");
- cityContent.setAttribute("class", "component-citytabpag__content");
- for (let i = 0; i < cities.length; i++) {
- let span = document.createElement("span");
- span.innerHTML = cities[i];
- cityContent.appendChild(span);
- }
- //HOT 元素长度单独微调:
- if (key === "HOT") {
- cityContent.style.width = "428px";
- }
- city.appendChild(cityContent);
- this.content.appendChild(city);
- }
- }
- ;// CONCATENATED MODULE: ./src/common/components/templates/NavTabsPage.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class NavTabsPage
- * @aliasclass Components.NavTabsPage
- * @deprecatedclass SuperMap.Components.NavTabsPage
- * @classdesc 标签页面组件。
- * @version 9.1.1
- * @param {Object} options - 组件配置参数。
- * @param {string} options.id - 组件 dom 元素 id。
- * @param {Array.<Object>} [options.tabs=[]] - 标签对象数组,形如:[{title: "",content: HTMLElement}],初始时,传入则创建页面。
- * @extends {TemplateBase}
- * @category Components Common
- * @usage
- */
- // todo 思考拆分的控件应该以哪种方式使用
- class NavTabsPage extends TemplateBase {
- constructor(options) {
- super(options);
- this.navTabsTitle = null;
- this.navTabsContent = null;
- options.tabs = options.tabs ? options.tabs : [];
- this._initView(options.tabs);
- }
- /**
- * @override
- * @private
- */
- _initView(tabs) {
- const navTabsPage = document.createElement("div");
- navTabsPage.setAttribute("class", "component-navtabspage");
- //关闭按钮
- const closeBtn = document.createElement("span");
- closeBtn.setAttribute("class", "supermapol-icons-close");
- closeBtn.onclick = this.closeView.bind(this);
- navTabsPage.appendChild(closeBtn);
- //标签
- const navTabsTitle = document.createElement("div");
- this.navTabsTitle = navTabsTitle;
- navTabsTitle.setAttribute("class", "component-navtabspage__title");
- navTabsPage.appendChild(navTabsTitle);
- //内容
- const navTabsContent = document.createElement("div");
- this.navTabsContent = navTabsContent;
- navTabsContent.setAttribute("class", "component-navtabspage__content");
- navTabsPage.appendChild(navTabsContent);
- //若 tabs 初始传入值,则
- if (tabs.length > 0) {
- this.appendTabs(tabs);
- }
- this.rootContainer = navTabsPage;
- }
- /**
- * @function NavTabsPage.prototype.setTabs
- * @description 设置标签。
- * @param {Array.<Object>} tabs - 标签对象数组,形如:[{title: "",content: {}}]。
- */
- setTabs(tabs) {
- this.removeAllTabs();
- this.appendTabs(tabs);
- }
- /**
- * @function NavTabsPage.prototype.appendTabs
- * @description 添加标签页面。
- * @param {Array.<Object>} tabs - 标签对象数组,形如:[{title: "",content: {}}]。
- */
- appendTabs(tabs) {
- for (let i = 0; i < tabs.length; i++) {
- let title = document.createElement("span");
- title.index = i;
- title.appendChild(document.createTextNode(tabs[i].title));
- //绑定标签切换对应页面:
- title.onclick = this._changeTabsPage.bind(this);
- let content = tabs[i].content;
- content.index = i;
- content.hidden = true;
- this.navTabsTitle.appendChild(title);
- this.navTabsContent.appendChild(content);
- }
- //todo 确认是否两个子元素的 index 相互对应
- //默认显示第一个标签对象
- this.navTabsTitle.firstChild.setAttribute("class", "component-navtabspage__tabs--select");
- this.navTabsContent.firstChild.hidden = false;
- }
- /**
- * @function NavTabsPage.prototype.removeTab
- * @description 删除某个标签页面。
- * @param {number} index - 标签索引号。
- */
- removeTab(index) {
- this.navTabsTitle.removeChild(this.navTabsTitle.children[index]);
- this.navTabsContent.removeChild(this.navTabsContent.children[index]);
- }
- /**
- * @function NavTabsPage.prototype.removeAllTabs
- * @description 删除所有标签。
- */
- removeAllTabs() {
- for (let i = this.navTabsTitle.children.length; i > 0; i--) {
- this.navTabsTitle.removeChild(this.navTabsTitle.children[i]);
- this.navTabsContent.removeChild(this.navTabsContent.children[i]);
- }
- }
- _changeTabsPage(e) {
- const index = e.target.index;
- for (let i = 0; i < this.navTabsTitle.children.length; i++) {
- this.navTabsTitle.children[i].setAttribute("class", "");
- this.navTabsContent.children[i].hidden = true;
- if (i === index) {
- this.navTabsTitle.children[i].setAttribute("class", "component-navtabspage__tabs--select");
- this.navTabsContent.children[i].hidden = false;
- }
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/components/templates/PaginationContainer.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class PaginationContainer
- * @aliasclass Components.PaginationContainer
- * @deprecatedclass SuperMap.Components.PaginationContainer
- * @classdesc 分页组件模板。
- * @version 9.1.1
- * @param {Object} options - 组件配置参数。
- * @param {string} options.id - 组件 dom 元素 id。
- * @param {HTMLElement} options.contents - 页面填充的 DOM 元素对象。
- * @param {number} options.pageCounts - 页数。
- * @extends {TemplateBase}
- * @category Components Common
- * @usage
- */
- class PaginationContainer extends TemplateBase {
- constructor(options) {
- options = options ? options : {};
- super(options);
- this.currentPage = 0;
- this.pageNumberLis = [];
- this.currentPageNumberLis = [];
- this.linkageEvent = null;
- options.contents = options.contents ? options.contents : null;
- options.pageCounts = options.pageCounts ? options.pageCounts : 0;
- this._initView(options.contents, options.pageCounts);
- }
- /**
- * @function PaginationContainer.prototype.setLinkageEvent
- * @description 设置页面联动方法。
- * @param {function} linkageEvent - 联动方法,实现指定功能。
- */
- setLinkageEvent(linkageEvent) {
- this.linkageEvent = linkageEvent;
- }
- /**
- * @private
- * @override
- */
- _initView(contents, pageCounts) {
- const container = document.createElement("div");
- container.setAttribute("class", "component-pagination");
- //content
- const content = document.createElement("div");
- content.setAttribute("class", "component-pagination__content");
- container.appendChild(content);
- this.content = content;
- //link
- const link = document.createElement("ul");
- link.setAttribute("class", "component-pagination__link");
- link.onclick = this._changePageEvent.bind(this);
- container.appendChild(link);
- this._createLink(link);
- this.link = link;
- //填充内容:
- if (contents) {
- this.setContent(contents);
- }
- if (pageCounts !== 0) {
- this.setPageLink(pageCounts);
- }
- this.rootContainer = container;
- }
- /**---------以下是页面相关操作 **/
- /**
- * @function PaginationContainer.prototype.setContent
- * @description 设置页面内容。
- * @param {HTMLElement} element - 页面内容元素。
- */
- setContent(element) {
- this.clearContent();
- this.appendContent(element);
- }
- /**
- * @function PaginationContainer.prototype.appendContent
- * @description 追加内容。
- * @param {HTMLElement} element - 页面内容元素。
- */
- appendContent(element) {
- this.content.appendChild(element);
- }
- /**
- * @function PaginationContainer.prototype.clearContent
- * @description 清空内容元素。
- */
- clearContent() {
- for (let i = this.content.children.length - 1; i >= 0; i--) {
- this.content.removeChild(this.content.children[i]);
- }
- }
- /** -----以下是页码相关的操作:**/
- /**
- * @function PaginationContainer.prototype.setPageLink
- * @description 设置页码数。
- * @param {number} pageNumber - 页码数。
- */
- setPageLink(pageNumber) {
- //清空当前页码
- this.pageNumberLis = [];
- this.currentPageNumberLis = [];
- this.clearPageLink();
- //创建页码
- this._createPageLi(pageNumber);
- //添加页码到页码列表
- this._appendPageLink();
- }
- /**
- * @description 创建页码。
- * @param pageNumber
- * @private
- */
- _createPageLi(pageNumber) {
- for (let i = 0; i < pageNumber; i++) {
- const pageLi = document.createElement("li");
- pageLi.innerHTML = i + 1;
- /*const liContent = document.createElement("span");
- liContent.innerHTML = i + 1;*/
- // pageLi.appendChild(liContent);
- this.pageNumberLis.push(pageLi);
- }
- this.pageNumberLis[0].setAttribute("class", "active");
- this.currentPage = 1;
- if (pageNumber < 5) {
- this.currentPageNumberLis = this.pageNumberLis;
- } else {
- for (let i = 0; i < 5; i++) {
- this.currentPageNumberLis.push(this.pageNumberLis[i]);
- }
- }
- }
- /**
- * @description 添加页码到页码列表。
- * @private
- */
- _appendPageLink() {
- //todo 如何插入中间
- for (let i = 0; i < this.currentPageNumberLis.length; i++) {
- this.link.insertBefore(this.currentPageNumberLis[i], this.link.childNodes[this.link.children.length - 2]);
- }
- for (let i = 0; i < this.currentPageNumberLis.length; i++) {
- //清空 active 状态
- this.currentPageNumberLis[i].setAttribute("class", "");
- //给当前选中的 li 赋值 active 状态
- if (Number(this.currentPageNumberLis[i].innerHTML) === this.currentPage) {
- this.currentPageNumberLis[i].setAttribute("class", "active");
- }
- }
- //根据 currentPage 改变按钮状态
- this._changeDisableState();
- if (this.linkageEvent) {
- this.linkageEvent(this.currentPage);
- }
- }
- /**
- * @function PaginationContainer.prototype.clearPageLink
- * @description 清除页码列表。
- */
- clearPageLink() {
- for (let i = this.link.children.length - 3; i > 1; i--) {
- this.link.removeChild(this.link.children[i]);
- }
- }
- /**
- * @description 创建页码按钮。
- * @param ul
- * @private
- */
- _createLink(ul) {
- for (let i = 0; i < 4; i++) {
- const li = document.createElement("li");
- li.setAttribute("class", "disable");
- const liContent = document.createElement("span");
- li.appendChild(liContent);
- if (i === 0) {
- liContent.id = "first";
- liContent.setAttribute("class", "supermapol-icons-first");
- } else if (i === 1) {
- liContent.id = "prev";
- liContent.setAttribute("class", "supermapol-icons-prev");
- } else if (i === 2) {
- liContent.id = "next";
- liContent.setAttribute("class", "supermapol-icons-next");
- } else if (i === 3) {
- liContent.id = "last";
- liContent.setAttribute("class", "supermapol-icons-last");
- }
- ul.appendChild(li);
- }
- }
- /**
- * @description 点击页码事件。
- * @param e
- * @private
- */
- _changePageEvent(e) {
- //todo
- const trigger = e.target;
- //若列表禁用,点击无效
- if (trigger.parentElement.classList[0] === "disable") {
- return;
- }
- let targetLi;
- if (trigger.id) {
- targetLi = trigger.id;
- } else if (Number(trigger.innerHTML)) {
- targetLi = Number(trigger.innerHTML);
- } else {
- return;
- }
- //页码预处理:
- this._prePageNum(targetLi);
- //根据 currentPageNumberLis 创建页码列表
- this.clearPageLink();
- this._appendPageLink();
- }
- /**
- * @description 根据 currentPage 改变按钮状态。
- * @private
- */
- _changeDisableState() {
- this.link.children[0].setAttribute("class", "");
- this.link.children[1].setAttribute("class", "");
- this.link.children[this.link.children.length - 1].setAttribute("class", "");
- this.link.children[this.link.children.length - 2].setAttribute("class", "");
- if (this.currentPage === 1) {
- this.link.children[0].setAttribute("class", "disable");
- this.link.children[1].setAttribute("class", "disable");
- }
- if (this.currentPage === this.pageNumberLis.length) {
- this.link.children[this.link.children.length - 1].setAttribute("class", "disable");
- this.link.children[this.link.children.length - 2].setAttribute("class", "disable");
- }
- }
- /**
- * @description 根据点击页码列表事件准备需展现的页码列表。
- * @param {string|number} targetLi - 被点击的列表对象 id 或 被点击的页码值。
- * @private
- */
- _prePageNum(targetLi) {
- const currentPageNumberLis = [];
- if (targetLi === "first") {
- this.currentPage = 1;
- } else if (targetLi === "last") {
- this.currentPage = this.pageNumberLis.length;
- } else if (targetLi === "prev") {
- this.currentPage = this.currentPage - 1;
- } else if (targetLi === "next") {
- this.currentPage = this.currentPage + 1;
- } else {
- this.currentPage = targetLi;
- }
- if (this.pageNumberLis.length <= 5) {
- for (let i = 0; i < this.pageNumberLis.length; i++) {
- currentPageNumberLis.push(this.pageNumberLis[i]);
- }
- } else {
- //当前点击前三,都取前五
- if (this.currentPage <= 3) {
- for (let i = 0; i < 5; i++) {
- currentPageNumberLis.push(this.pageNumberLis[i]);
- }
- } else if (this.currentPage >= this.pageNumberLis.length - 3) {
- //点击后三,都取后5
- for (let i = this.pageNumberLis.length - 5; i < this.pageNumberLis.length; i++) {
- currentPageNumberLis.push(this.pageNumberLis[i]);
- }
- } else {
- //其他,取中间:
- for (let i = this.currentPage - 3; i <= this.currentPage + 1; i++) {
- currentPageNumberLis.push(this.pageNumberLis[i]);
- }
- }
- }
- if (currentPageNumberLis.length > 0) {
- this.currentPageNumberLis = currentPageNumberLis;
- }
- }
- }
- ;// CONCATENATED MODULE: ./src/common/components/util/Util.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @name ComponentsUtil
- * @namespace
- * @category BaseTypes Util
- * @description 获取文件类型工具类。
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.ComponentsUtil.getFileType(fileName);
- *
- * </script>
- * // ES6 Import
- * import { ComponentsUtil } from '{npm}';
- *
- * const result = ComponentsUtil.getFileType(fileName);
- * ```
- */
- let ComponentsUtil = {
- /**
- * @function ComponentsUtil.getFileType
- * @description 获取上传文件类型。
- * @param {string} fileName - 文件名称。
- */
- getFileType(fileName) {
- let regCSV = /^.*\.(?:csv)$/i;
- let regExcel = /^.*\.(?:xls|xlsx)$/i; //文件名可以带空格
- let regGeojson = /^.*\.(?:geojson|json)$/i;
- if (regExcel.test(fileName)) { //校验不通过
- return FileTypes.EXCEL;
- } else if (regCSV.test(fileName)) {
- return FileTypes.CSV;
- } else if (regGeojson.test(fileName)) {
- return FileTypes.GEOJSON;
- }
- return null;
- }
- };
- ;// CONCATENATED MODULE: ./src/common/components/util/index.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- ;// CONCATENATED MODULE: ./src/common/components/index.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- //数据
- //组件
- //提示框组件
- //图表组件
- //公用模板:
- //工具类
- ;// CONCATENATED MODULE: ./src/common/lang/index.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- ;// CONCATENATED MODULE: ./src/common/index.common.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- ;// CONCATENATED MODULE: ./src/common/index.all.js
- ;// CONCATENATED MODULE: ./src/common/namespace.js
- /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- // Lang
- SuperMap.Lang = Lang;
- SuperMap.i18n = SuperMap.Lang.i18n;
- // CommonUtil
- SuperMap.Util = { ...SuperMap.Util, ...Util };
- SuperMap.Browser = Browser;
- SuperMap.INCHES_PER_UNIT = INCHES_PER_UNIT;
- SuperMap.METERS_PER_INCH = METERS_PER_INCH;
- SuperMap.DOTS_PER_INCH = DOTS_PER_INCH;
- SuperMap.IS_GECKO = IS_GECKO;
- // FetchRequest
- SuperMap.setCORS = setCORS;
- SuperMap.isCORS = isCORS;
- SuperMap.setRequestTimeout = setRequestTimeout;
- SuperMap.getRequestTimeout = getRequestTimeout;
- SuperMap.FetchRequest = FetchRequest;
- // commontypes
- SuperMap.inherit = inheritExt;
- SuperMap.mixin = mixinExt;
- SuperMap.String = StringExt;
- SuperMap.Number = NumberExt;
- SuperMap.Function = FunctionExt;
- SuperMap.Array = ArrayExt;
- SuperMap.Date = DateExt;
- SuperMap.Event = Event;
- SuperMap.Bounds = Bounds;
- SuperMap.Credential = Credential;
- SuperMap.Events = Events;
- SuperMap.Feature = Feature;
- SuperMap.Geometry = Geometry;
- SuperMap.Pixel = Pixel;
- SuperMap.Size = Size;
- SuperMap.Feature.Vector = Vector;
- SuperMap.Geometry.Collection = Collection;
- SuperMap.Geometry.Curve = Curve;
- SuperMap.Geometry.GeoText = GeoText;
- SuperMap.Geometry.LinearRing = LinearRing;
- SuperMap.Geometry.LineString = LineString;
- SuperMap.Geometry.MultiLineString = MultiLineString;
- SuperMap.Geometry.MultiPoint = MultiPoint;
- SuperMap.Geometry.MultiPolygon = MultiPolygon;
- SuperMap.Geometry.Point = Point;
- SuperMap.Geometry.Polygon = Polygon;
- SuperMap.Geometry.Rectangle = Rectangle;
- // Components
- SuperMap.Components.Chart = ChartView;
- SuperMap.Components.ChartViewModel = ChartViewModel;
- SuperMap.Components.MessageBox = MessageBox;
- SuperMap.Components.AttributesPopContainer = AttributesPopContainer;
- SuperMap.Components.CityTabsPage = CityTabsPage;
- SuperMap.Components.CommonContainer = CommonContainer;
- SuperMap.Components.DropDownBox = DropDownBox;
- SuperMap.Components.IndexTabsPageContainer = IndexTabsPageContainer;
- SuperMap.Components.NavTabsPage = NavTabsPage;
- SuperMap.Components.PaginationContainer = PaginationContainer;
- SuperMap.Components.PopContainer = PopContainer;
- SuperMap.Components.Select = Select;
- SuperMap.Components.TemplateBase = TemplateBase;
- SuperMap.Components.FileReaderUtil = FileReaderUtil;
- // control
- SuperMap.TimeControlBase = TimeControlBase;
- SuperMap.TimeFlowControl = TimeFlowControl;
- // Format
- SuperMap.Format = SuperMap.Format || Format;
- SuperMap.Format.GeoJSON = GeoJSON;
- SuperMap.Format.JSON = JSONFormat;
- SuperMap.Format.WKT = WKT;
- // iManager
- SuperMap.iManager = IManager;
- SuperMap.iManagerCreateNodeParam = IManagerCreateNodeParam;
- SuperMap.iManagerServiceBase = IManagerServiceBase;
- // iPortal
- SuperMap.iPortal = IPortal;
- SuperMap.iPortalAddDataParam = IPortalAddDataParam;
- SuperMap.iPortalAddResourceParam = IPortalAddResourceParam;
- SuperMap.iPortalDataConnectionInfoParam = IPortalDataConnectionInfoParam;
- SuperMap.iPortalDataMetaInfoParam = IPortalDataMetaInfoParam;
- SuperMap.iPortalDataStoreInfoParam = IPortalDataStoreInfoParam;
- SuperMap.iPortalQueryParam = IPortalQueryParam;
- SuperMap.iPortalQueryResult = IPortalQueryResult;
- SuperMap.iPortalRegisterServiceParam = IPortalRegisterServiceParam;
- SuperMap.iPortalResource = IPortalResource;
- SuperMap.iPortalServiceBase = IPortalServiceBase;
- SuperMap.iPortalShareEntity = IPortalShareEntity;
- SuperMap.iPortalShareParam = IPortalShareParam;
- SuperMap.iPortalUser = IPortalUser;
- // iServer
- SuperMap.AddressMatchService = AddressMatchService;
- SuperMap.AggregationParameter = AggregationParameter;
- SuperMap.AreaSolarRadiationParameters = AreaSolarRadiationParameters;
- SuperMap.AreaSolarRadiationService = AreaSolarRadiationService;
- SuperMap.BucketAggParameter = BucketAggParameter;
- SuperMap.BufferAnalystParameters = BufferAnalystParameters;
- SuperMap.BufferAnalystService = BufferAnalystService;
- SuperMap.BufferDistance = BufferDistance;
- SuperMap.BuffersAnalystJobsParameter = BuffersAnalystJobsParameter;
- SuperMap.BuffersAnalystJobsService = BuffersAnalystJobsService;
- SuperMap.BufferSetting = BufferSetting;
- SuperMap.BurstPipelineAnalystParameters = BurstPipelineAnalystParameters;
- SuperMap.BurstPipelineAnalystService = BurstPipelineAnalystService;
- SuperMap.ChartFeatureInfoSpecsService = ChartFeatureInfoSpecsService;
- SuperMap.ChartQueryFilterParameter = ChartQueryFilterParameter;
- SuperMap.ChartQueryParameters = ChartQueryParameters;
- SuperMap.ChartQueryService = ChartQueryService;
- SuperMap.ClipParameter = ClipParameter;
- SuperMap.ColorDictionary = ColorDictionary;
- SuperMap.CommonServiceBase = CommonServiceBase;
- SuperMap.ComputeWeightMatrixParameters = ComputeWeightMatrixParameters;
- SuperMap.ComputeWeightMatrixService = ComputeWeightMatrixService;
- SuperMap.CreateDatasetParameters = CreateDatasetParameters;
- SuperMap.DataFlowService = DataFlowService;
- SuperMap.DataReturnOption = DataReturnOption;
- SuperMap.DatasetBufferAnalystParameters = DatasetBufferAnalystParameters;
- SuperMap.DatasetInfo = DatasetInfo;
- SuperMap.DatasetOverlayAnalystParameters = DatasetOverlayAnalystParameters;
- SuperMap.DatasetService = DatasetService;
- SuperMap.DatasetSurfaceAnalystParameters = DatasetSurfaceAnalystParameters;
- SuperMap.DatasetThiessenAnalystParameters = DatasetThiessenAnalystParameters;
- SuperMap.DatasourceConnectionInfo = DatasourceConnectionInfo;
- SuperMap.DatasourceService = DatasourceService;
- SuperMap.DensityAnalystService = DensityAnalystService;
- SuperMap.DensityKernelAnalystParameters = DensityKernelAnalystParameters;
- SuperMap.EditFeaturesParameters = EditFeaturesParameters;
- SuperMap.EditFeaturesService = EditFeaturesService;
- SuperMap.FacilityAnalyst3DParameters = FacilityAnalyst3DParameters;
- SuperMap.FacilityAnalystSinks3DParameters = FacilityAnalystSinks3DParameters;
- SuperMap.FacilityAnalystSinks3DService = FacilityAnalystSinks3DService;
- SuperMap.FacilityAnalystSources3DParameters = FacilityAnalystSources3DParameters;
- SuperMap.FacilityAnalystSources3DService = FacilityAnalystSources3DService;
- SuperMap.FacilityAnalystStreamParameters = FacilityAnalystStreamParameters;
- SuperMap.FacilityAnalystStreamService = FacilityAnalystStreamService;
- SuperMap.FacilityAnalystTracedown3DParameters = FacilityAnalystTracedown3DParameters;
- SuperMap.FacilityAnalystTracedown3DService = FacilityAnalystTracedown3DService;
- SuperMap.FacilityAnalystTraceup3DParameters = FacilityAnalystTraceup3DParameters;
- SuperMap.FacilityAnalystTraceup3DService = FacilityAnalystTraceup3DService;
- SuperMap.FacilityAnalystUpstream3DParameters = FacilityAnalystUpstream3DParameters;
- SuperMap.FacilityAnalystUpstream3DService = FacilityAnalystUpstream3DService;
- SuperMap.FieldParameters = FieldParameters;
- SuperMap.FieldsFilter = FieldsFilter;
- SuperMap.FieldStatisticService = FieldStatisticService;
- SuperMap.FieldStatisticsParameters = FieldStatisticsParameters;
- SuperMap.FilterParameter = FilterParameter;
- SuperMap.FindClosestFacilitiesParameters = FindClosestFacilitiesParameters;
- SuperMap.FindClosestFacilitiesService = FindClosestFacilitiesService;
- SuperMap.FindLocationParameters = FindLocationParameters;
- SuperMap.FindLocationService = FindLocationService;
- SuperMap.FindMTSPPathsParameters = FindMTSPPathsParameters;
- SuperMap.FindMTSPPathsService = FindMTSPPathsService;
- SuperMap.FindPathParameters = FindPathParameters;
- SuperMap.FindPathService = FindPathService;
- SuperMap.FindServiceAreasParameters = FindServiceAreasParameters;
- SuperMap.FindServiceAreasService = FindServiceAreasService;
- SuperMap.FindTSPPathsParameters = FindTSPPathsParameters;
- SuperMap.FindTSPPathsService = FindTSPPathsService;
- SuperMap.GenerateSpatialDataParameters = GenerateSpatialDataParameters;
- SuperMap.GenerateSpatialDataService = GenerateSpatialDataService;
- SuperMap.GeoCodingParameter = GeoCodingParameter;
- SuperMap.GeoDecodingParameter = GeoDecodingParameter;
- SuperMap.GeoHashGridAggParameter = GeoHashGridAggParameter;
- SuperMap.GeometryBatchAnalystService = GeometryBatchAnalystService;
- SuperMap.GeometryBufferAnalystParameters = GeometryBufferAnalystParameters;
- SuperMap.GeometryOverlayAnalystParameters = GeometryOverlayAnalystParameters;
- SuperMap.GeometrySurfaceAnalystParameters = GeometrySurfaceAnalystParameters;
- SuperMap.GeometryThiessenAnalystParameters = GeometryThiessenAnalystParameters;
- SuperMap.GeoprocessingService = GeoprocessingService;
- SuperMap.GeoRelationAnalystParameters = GeoRelationAnalystParameters;
- SuperMap.GeoRelationAnalystService = GeoRelationAnalystService;
- SuperMap.GetFeaturesByBoundsParameters = GetFeaturesByBoundsParameters;
- SuperMap.GetFeaturesByBoundsService = GetFeaturesByBoundsService;
- SuperMap.GetFeaturesByBufferParameters = GetFeaturesByBufferParameters;
- SuperMap.GetFeaturesByBufferService = GetFeaturesByBufferService;
- SuperMap.GetFeaturesByGeometryParameters = GetFeaturesByGeometryParameters;
- SuperMap.GetFeaturesByGeometryService = GetFeaturesByGeometryService;
- SuperMap.GetFeaturesByIDsParameters = GetFeaturesByIDsParameters;
- SuperMap.GetFeaturesByIDsService = GetFeaturesByIDsService;
- SuperMap.GetFeaturesBySQLParameters = GetFeaturesBySQLParameters;
- SuperMap.GetFeaturesBySQLService = GetFeaturesBySQLService;
- SuperMap.GetFeaturesParametersBase = GetFeaturesParametersBase;
- SuperMap.GetFeaturesServiceBase = GetFeaturesServiceBase;
- SuperMap.GetFieldsService = GetFieldsService;
- SuperMap.GetGridCellInfosParameters = GetGridCellInfosParameters;
- SuperMap.GetGridCellInfosService = GetGridCellInfosService;
- SuperMap.GetLayersInfoService = GetLayersInfoService;
- SuperMap.Grid = Grid;
- SuperMap.HillshadeParameter = HillshadeParameter;
- SuperMap.Image = UGCImage;
- SuperMap.ImageCollectionService = ImageCollectionService_ImageCollectionService;
- SuperMap.ImageGFAspect = ImageGFAspect;
- SuperMap.ImageGFHillShade = ImageGFHillShade;
- SuperMap.ImageGFOrtho = ImageGFOrtho;
- SuperMap.ImageGFSlope = ImageGFSlope;
- SuperMap.ImageRenderingRule = ImageRenderingRule;
- SuperMap.ImageSearchParameter = ImageSearchParameter;
- SuperMap.ImageService = ImageService_ImageService;
- SuperMap.ImageStretchOption = ImageStretchOption;
- SuperMap.InterpolationAnalystParameters = InterpolationAnalystParameters;
- SuperMap.InterpolationAnalystService = InterpolationAnalystService;
- SuperMap.InterpolationDensityAnalystParameters = InterpolationDensityAnalystParameters;
- SuperMap.InterpolationIDWAnalystParameters = InterpolationIDWAnalystParameters;
- SuperMap.InterpolationKrigingAnalystParameters = InterpolationKrigingAnalystParameters;
- SuperMap.InterpolationRBFAnalystParameters = InterpolationRBFAnalystParameters;
- SuperMap.JoinItem = JoinItem;
- SuperMap.KernelDensityJobParameter = KernelDensityJobParameter;
- SuperMap.KernelDensityJobsService = KernelDensityJobsService;
- SuperMap.LabelImageCell = LabelImageCell;
- SuperMap.LabelMatrixCell = LabelMatrixCell;
- SuperMap.LabelMixedTextStyle = LabelMixedTextStyle;
- SuperMap.LabelSymbolCell = LabelSymbolCell;
- SuperMap.LabelThemeCell = LabelThemeCell;
- SuperMap.LayerStatus = LayerStatus;
- SuperMap.LinkItem = LinkItem;
- SuperMap.MappingParameters = MappingParameters;
- SuperMap.MapService = MapService;
- SuperMap.MathExpressionAnalysisParameters = MathExpressionAnalysisParameters;
- SuperMap.MathExpressionAnalysisService = MathExpressionAnalysisService;
- SuperMap.MeasureParameters = MeasureParameters;
- SuperMap.MeasureService = MeasureService;
- SuperMap.MetricsAggParameter = MetricsAggParameter;
- SuperMap.NDVIParameter = NDVIParameter;
- SuperMap.NetworkAnalystServiceBase = NetworkAnalystServiceBase;
- SuperMap.OutputSetting = OutputSetting;
- SuperMap.OverlapDisplayedOptions = OverlapDisplayedOptions;
- SuperMap.OverlayAnalystParameters = OverlayAnalystParameters;
- SuperMap.OverlayAnalystService = OverlayAnalystService;
- SuperMap.OverlayGeoJobParameter = OverlayGeoJobParameter;
- SuperMap.OverlayGeoJobsService = OverlayGeoJobsService;
- SuperMap.PointWithMeasure = PointWithMeasure;
- SuperMap.ProcessingServiceBase = ProcessingServiceBase;
- SuperMap.QueryByBoundsParameters = QueryByBoundsParameters;
- SuperMap.QueryByBoundsService = QueryByBoundsService;
- SuperMap.QueryByDistanceParameters = QueryByDistanceParameters;
- SuperMap.QueryByDistanceService = QueryByDistanceService;
- SuperMap.QueryByGeometryParameters = QueryByGeometryParameters;
- SuperMap.QueryByGeometryService = QueryByGeometryService;
- SuperMap.QueryBySQLParameters = QueryBySQLParameters;
- SuperMap.QueryBySQLService = QueryBySQLService;
- SuperMap.QueryParameters = QueryParameters;
- SuperMap.QueryService = QueryService;
- SuperMap.RasterFunctionParameter = RasterFunctionParameter;
- SuperMap.Route = Route;
- SuperMap.RouteCalculateMeasureParameters = RouteCalculateMeasureParameters;
- SuperMap.RouteCalculateMeasureService = RouteCalculateMeasureService;
- SuperMap.RouteLocatorParameters = RouteLocatorParameters;
- SuperMap.RouteLocatorService = RouteLocatorService;
- SuperMap.ServerColor = ServerColor;
- SuperMap.ServerFeature = ServerFeature;
- SuperMap.ServerGeometry = ServerGeometry;
- SuperMap.ServerStyle = ServerStyle;
- SuperMap.ServerTextStyle = ServerTextStyle;
- SuperMap.ServerTheme = ServerTheme;
- SuperMap.SetDatasourceParameters = SetDatasourceParameters;
- SuperMap.SetLayerInfoParameters = SetLayerInfoParameters;
- SuperMap.SetLayerInfoService = SetLayerInfoService;
- SuperMap.SetLayersInfoParameters = SetLayersInfoParameters;
- SuperMap.SetLayersInfoService = SetLayersInfoService;
- SuperMap.SetLayerStatusParameters = SetLayerStatusParameters;
- SuperMap.SetLayerStatusService = SetLayerStatusService;
- SuperMap.SingleObjectQueryJobsParameter = SingleObjectQueryJobsParameter;
- SuperMap.SingleObjectQueryJobsService = SingleObjectQueryJobsService;
- SuperMap.Sortby = Sortby;
- SuperMap.SpatialAnalystBase = SpatialAnalystBase;
- SuperMap.StopQueryParameters = StopQueryParameters;
- SuperMap.StopQueryService = StopQueryService;
- SuperMap.SummaryAttributesJobsParameter = SummaryAttributesJobsParameter;
- SuperMap.SummaryAttributesJobsService = SummaryAttributesJobsService;
- SuperMap.SummaryMeshJobParameter = SummaryMeshJobParameter;
- SuperMap.SummaryMeshJobsService = SummaryMeshJobsService;
- SuperMap.SummaryRegionJobParameter = SummaryRegionJobParameter;
- SuperMap.SummaryRegionJobsService = SummaryRegionJobsService;
- SuperMap.SupplyCenter = SupplyCenter;
- SuperMap.SurfaceAnalystParameters = SurfaceAnalystParameters;
- SuperMap.SurfaceAnalystParametersSetting = SurfaceAnalystParametersSetting;
- SuperMap.SurfaceAnalystService = SurfaceAnalystService;
- SuperMap.TerrainCurvatureCalculationParameters = TerrainCurvatureCalculationParameters;
- SuperMap.TerrainCurvatureCalculationService = TerrainCurvatureCalculationService;
- SuperMap.Theme = Theme;
- SuperMap.ThemeDotDensity = ThemeDotDensity;
- SuperMap.ThemeFlow = ThemeFlow;
- SuperMap.ThemeGraduatedSymbol = ThemeGraduatedSymbol;
- SuperMap.ThemeGraduatedSymbolStyle = ThemeGraduatedSymbolStyle;
- SuperMap.ThemeGraph = ThemeGraph;
- SuperMap.ThemeGraphAxes = ThemeGraphAxes;
- SuperMap.ThemeGraphItem = ThemeGraphItem;
- SuperMap.ThemeGraphSize = ThemeGraphSize;
- SuperMap.ThemeGraphText = ThemeGraphText;
- SuperMap.ThemeGridRange = ThemeGridRange;
- SuperMap.ThemeGridRangeItem = ThemeGridRangeItem;
- SuperMap.ThemeGridUnique = ThemeGridUnique;
- SuperMap.ThemeGridUniqueItem = ThemeGridUniqueItem;
- SuperMap.ThemeLabel = ThemeLabel;
- SuperMap.ThemeLabelAlongLine = ThemeLabelAlongLine;
- SuperMap.ThemeLabelBackground = ThemeLabelBackground;
- SuperMap.ThemeLabelItem = ThemeLabelItem;
- SuperMap.ThemeLabelText = ThemeLabelText;
- SuperMap.ThemeLabelUniqueItem = ThemeLabelUniqueItem;
- SuperMap.ThemeMemoryData = ThemeMemoryData;
- SuperMap.ThemeOffset = ThemeOffset;
- SuperMap.ThemeParameters = ThemeParameters;
- SuperMap.ThemeRange = ThemeRange;
- SuperMap.ThemeRangeItem = ThemeRangeItem;
- SuperMap.ThemeService = ThemeService;
- SuperMap.ThemeUnique = ThemeUnique;
- SuperMap.ThemeUniqueItem = ThemeUniqueItem;
- SuperMap.ThiessenAnalystParameters = ThiessenAnalystParameters;
- SuperMap.ThiessenAnalystService = ThiessenAnalystService;
- SuperMap.TilesetsService = TilesetsService;
- SuperMap.TopologyValidatorJobsParameter = TopologyValidatorJobsParameter;
- SuperMap.TopologyValidatorJobsService = TopologyValidatorJobsService;
- SuperMap.TransferLine = TransferLine;
- SuperMap.TransferPathParameters = TransferPathParameters;
- SuperMap.TransferPathService = TransferPathService;
- SuperMap.TransferSolutionParameters = TransferSolutionParameters;
- SuperMap.TransferSolutionService = TransferSolutionService;
- SuperMap.TransportationAnalystParameter = TransportationAnalystParameter;
- SuperMap.TransportationAnalystResultSetting = TransportationAnalystResultSetting;
- SuperMap.UGCLayer = UGCLayer;
- SuperMap.UGCMapLayer = UGCMapLayer;
- SuperMap.UGCSubLayer = UGCSubLayer;
- SuperMap.UpdateDatasetParameters = UpdateDatasetParameters;
- SuperMap.UpdateEdgeWeightParameters = UpdateEdgeWeightParameters;
- SuperMap.UpdateEdgeWeightService = UpdateEdgeWeightService;
- SuperMap.UpdateTurnNodeWeightParameters = UpdateTurnNodeWeightParameters;
- SuperMap.UpdateTurnNodeWeightService = UpdateTurnNodeWeightService;
- SuperMap.Vector = Vector_Vector;
- SuperMap.VectorClipJobsParameter = VectorClipJobsParameter;
- SuperMap.VectorClipJobsService = VectorClipJobsService;
- SuperMap.WebPrintingJobContent = WebPrintingJobContent;
- SuperMap.WebPrintingJobCustomItems = WebPrintingJobCustomItems;
- SuperMap.WebPrintingJobExportOptions = WebPrintingJobExportOptions;
- SuperMap.WebPrintingJobImage = WebPrintingJobImage;
- SuperMap.WebPrintingJobLayers = WebPrintingJobLayers;
- SuperMap.WebPrintingJobLayoutOptions = WebPrintingJobLayoutOptions;
- SuperMap.WebPrintingJobLegendOptions = WebPrintingJobLegendOptions;
- SuperMap.WebPrintingJobLittleMapOptions = WebPrintingJobLittleMapOptions;
- SuperMap.WebPrintingJobNorthArrowOptions = WebPrintingJobNorthArrowOptions;
- SuperMap.WebPrintingJobParameters = WebPrintingJobParameters;
- SuperMap.WebPrintingJobScaleBarOptions = WebPrintingJobScaleBarOptions;
- SuperMap.WebPrintingService = WebPrintingService;
- //Online
- SuperMap.Online = Online;
- SuperMap.OnlineData = OnlineData;
- SuperMap.OnlineQueryDatasParameter = OnlineQueryDatasParameter;
- SuperMap.ServiceStatus = ServiceStatus;
- // 包含online中的DataItemType数据类型
- SuperMap.DataItemType = DataItemType;
- SuperMap.DataItemOrderBy = DataItemOrderBy;
- SuperMap.FilterField = FilterField;
- SuperMap.OnlineServiceBase = OnlineServiceBase;
- // overlay
- SuperMap.Feature = SuperMap.Feature || {};
- SuperMap.Feature.Theme = Theme_Theme;
- SuperMap.Feature.Theme.Bar = Bar;
- SuperMap.Feature.Theme.Bar3D = Bar3D;
- SuperMap.Feature.Theme.Circle = Circle;
- SuperMap.Feature.Theme.Graph = Graph;
- SuperMap.Feature.Theme.Line = Line;
- SuperMap.Feature.Theme.Pie = Pie;
- SuperMap.Feature.Theme.Point = overlay_Point_Point;
- SuperMap.Feature.Theme.RankSymbol = RankSymbol;
- SuperMap.Feature.Theme.Ring = Ring;
- SuperMap.Feature.Theme.ThemeVector = ThemeVector;
- SuperMap.Feature.ShapeParameters = ShapeParameters;
- SuperMap.Feature.ShapeParameters.Circle = Circle_Circle;
- SuperMap.Feature.ShapeParameters.Image = Image_Image;
- SuperMap.Feature.ShapeParameters.Label = Label;
- SuperMap.Feature.ShapeParameters.Line = Line_Line;
- SuperMap.Feature.ShapeParameters.Point = Point_Point;
- SuperMap.Feature.ShapeParameters.Polygon = Polygon_Polygon;
- SuperMap.Feature.ShapeParameters.Rectangle = Rectangle_Rectangle;
- SuperMap.Feature.ShapeParameters.Sector = Sector;
- SuperMap.Feature.ShapeFactory = ShapeFactory;
- // LevelRenderer
- SuperMap.LevelRenderer = LevelRenderer;
- // security
- SuperMap.KeyServiceParameter = KeyServiceParameter;
- SuperMap.SecurityManager = SecurityManager;
- SuperMap.ServerInfo = ServerInfo;
- SuperMap.TokenServiceParameter = TokenServiceParameter;
- // style
- SuperMap.ThemeStyle = ThemeStyle;
- SuperMap.CartoCSS = CartoCSS;
- // thirdparty
- // SuperMap.BinaryClassification = BinaryClassification;
- // SuperMap.LandcoverClassification = LandcoverClassification;
- // SuperMap.ObjectDetection = ObjectDetection;
- // SuperMap.WebMachineLearning = WebMachineLearning;
- SuperMap.ElasticSearch = ElasticSearch;
- // util
- SuperMap.ArrayStatistic = ArrayStatistic;
- SuperMap.ColorsPickerUtil = ColorsPickerUtil;
- // REST
- SuperMap.DataFormat = DataFormat;
- SuperMap.ServerType = ServerType;
- SuperMap.GeometryType = GeometryType;
- SuperMap.QueryOption = QueryOption;
- SuperMap.JoinType = JoinType;
- SuperMap.SpatialQueryMode = SpatialQueryMode;
- SuperMap.SpatialRelationType = SpatialRelationType;
- SuperMap.MeasureMode = MeasureMode;
- SuperMap.Unit = Unit;
- SuperMap.BufferRadiusUnit = BufferRadiusUnit;
- SuperMap.EngineType = EngineType;
- SuperMap.ThemeGraphTextFormat = ThemeGraphTextFormat;
- SuperMap.ThemeGraphType = ThemeGraphType;
- SuperMap.GraphAxesTextDisplayMode = GraphAxesTextDisplayMode;
- SuperMap.GraduatedMode = GraduatedMode;
- SuperMap.RangeMode = RangeMode;
- SuperMap.ThemeType = ThemeType;
- SuperMap.ColorGradientType = ColorGradientType;
- SuperMap.TextAlignment = TextAlignment;
- SuperMap.FillGradientMode = FillGradientMode;
- SuperMap.AlongLineDirection = AlongLineDirection;
- SuperMap.LabelBackShape = LabelBackShape;
- SuperMap.LabelOverLengthMode = LabelOverLengthMode;
- SuperMap.DirectionType = DirectionType;
- SuperMap.OverlayOperationType = OverlayOperationType;
- SuperMap.OutputType = OutputType;
- SuperMap.SideType = SideType;
- SuperMap.SupplyCenterType = SupplyCenterType;
- SuperMap.TurnType = TurnType;
- SuperMap.BufferEndType = BufferEndType;
- SuperMap.SmoothMethod = SmoothMethod;
- SuperMap.SurfaceAnalystMethod = SurfaceAnalystMethod;
- SuperMap.DataReturnMode = DataReturnMode;
- SuperMap.EditType = EditType;
- SuperMap.TransferTactic = TransferTactic;
- SuperMap.TransferPreference = TransferPreference;
- SuperMap.GridType = GridType;
- SuperMap.ColorSpaceType = ColorSpaceType;
- SuperMap.LayerType = LayerType;
- SuperMap.UGCLayerType = UGCLayerType;
- SuperMap.StatisticMode = StatisticMode;
- SuperMap.PixelFormat = PixelFormat;
- SuperMap.SearchMode = SearchMode;
- SuperMap.InterpolationAlgorithmType = InterpolationAlgorithmType;
- SuperMap.VariogramMode = VariogramMode;
- SuperMap.Exponent = Exponent;
- SuperMap.ClientType = ClientType;
- SuperMap.ChartType = ChartType;
- SuperMap.ClipAnalystMode = ClipAnalystMode;
- SuperMap.AnalystAreaUnit = AnalystAreaUnit;
- SuperMap.AnalystSizeUnit = AnalystSizeUnit;
- SuperMap.StatisticAnalystMode = StatisticAnalystMode;
- SuperMap.SummaryType = SummaryType;
- SuperMap.TopologyValidatorRule = TopologyValidatorRule;
- SuperMap.BucketAggType = BucketAggType;
- SuperMap.MetricsAggType = MetricsAggType;
- SuperMap.GetFeatureMode = GetFeatureMode;
- SuperMap.RasterFunctionType = RasterFunctionType;
- SuperMap.ResourceType = ResourceType;
- SuperMap.OrderBy = OrderBy;
- SuperMap.OrderType = OrderType;
- SuperMap.SearchType = SearchType;
- SuperMap.AggregationTypes = AggregationTypes;
- SuperMap.PermissionType = PermissionType;
- SuperMap.EntityType = EntityType;
- SuperMap.WebExportFormatType = WebExportFormatType;
- SuperMap.WebScaleOrientationType = WebScaleOrientationType;
- SuperMap.WebScaleType = WebScaleType;
- SuperMap.WebScaleUnit = WebScaleUnit;
- ;// CONCATENATED MODULE: external "L"
- const external_L_namespaceObject = L;
- var external_L_default = /*#__PURE__*/__webpack_require__.n(external_L_namespaceObject);
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/global.js
- /* harmony default export */ function global(defs) {
- defs('EPSG:4326', "+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees");
- defs('EPSG:4269', "+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees");
- defs('EPSG:3857', "+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs");
- defs.WGS84 = defs['EPSG:4326'];
- defs['EPSG:3785'] = defs['EPSG:3857']; // maintain backward compat, official code is 3857
- defs.GOOGLE = defs['EPSG:3857'];
- defs['EPSG:900913'] = defs['EPSG:3857'];
- defs['EPSG:102113'] = defs['EPSG:3857'];
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/constants/values.js
- var PJD_3PARAM = 1;
- var PJD_7PARAM = 2;
- var PJD_GRIDSHIFT = 3;
- var PJD_WGS84 = 4; // WGS84 or equivalent
- var PJD_NODATUM = 5; // WGS84 or equivalent
- var SRS_WGS84_SEMIMAJOR = 6378137.0; // only used in grid shift transforms
- var SRS_WGS84_SEMIMINOR = 6356752.314; // only used in grid shift transforms
- var SRS_WGS84_ESQUARED = 0.0066943799901413165; // only used in grid shift transforms
- var SEC_TO_RAD = 4.84813681109535993589914102357e-6;
- var HALF_PI = Math.PI/2;
- // ellipoid pj_set_ell.c
- var SIXTH = 0.1666666666666666667;
- /* 1/6 */
- var RA4 = 0.04722222222222222222;
- /* 17/360 */
- var RA6 = 0.02215608465608465608;
- var EPSLN = 1.0e-10;
- // you'd think you could use Number.EPSILON above but that makes
- // Mollweide get into an infinate loop.
- var D2R = 0.01745329251994329577;
- var R2D = 57.29577951308232088;
- var FORTPI = Math.PI/4;
- var TWO_PI = Math.PI * 2;
- // SPI is slightly greater than Math.PI, so values that exceed the -180..180
- // degree range by a tiny amount don't get wrapped. This prevents points that
- // have drifted from their original location along the 180th meridian (due to
- // floating point error) from changing their sign.
- var SPI = 3.14159265359;
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/constants/PrimeMeridian.js
- var PrimeMeridian_exports = {};
- PrimeMeridian_exports.greenwich = 0.0; //"0dE",
- PrimeMeridian_exports.lisbon = -9.131906111111; //"9d07'54.862\"W",
- PrimeMeridian_exports.paris = 2.337229166667; //"2d20'14.025\"E",
- PrimeMeridian_exports.bogota = -74.080916666667; //"74d04'51.3\"W",
- PrimeMeridian_exports.madrid = -3.687938888889; //"3d41'16.58\"W",
- PrimeMeridian_exports.rome = 12.452333333333; //"12d27'8.4\"E",
- PrimeMeridian_exports.bern = 7.439583333333; //"7d26'22.5\"E",
- PrimeMeridian_exports.jakarta = 106.807719444444; //"106d48'27.79\"E",
- PrimeMeridian_exports.ferro = -17.666666666667; //"17d40'W",
- PrimeMeridian_exports.brussels = 4.367975; //"4d22'4.71\"E",
- PrimeMeridian_exports.stockholm = 18.058277777778; //"18d3'29.8\"E",
- PrimeMeridian_exports.athens = 23.7163375; //"23d42'58.815\"E",
- PrimeMeridian_exports.oslo = 10.722916666667; //"10d43'22.5\"E"
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/constants/units.js
- /* harmony default export */ const units = ({
- ft: {to_meter: 0.3048},
- 'us-ft': {to_meter: 1200 / 3937}
- });
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/match.js
- var ignoredChar = /[\s_\-\/\(\)]/g;
- function match(obj, key) {
- if (obj[key]) {
- return obj[key];
- }
- var keys = Object.keys(obj);
- var lkey = key.toLowerCase().replace(ignoredChar, '');
- var i = -1;
- var testkey, processedKey;
- while (++i < keys.length) {
- testkey = keys[i];
- processedKey = testkey.toLowerCase().replace(ignoredChar, '');
- if (processedKey === lkey) {
- return obj[testkey];
- }
- }
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projString.js
- /* harmony default export */ function projString(defData) {
- var self = {};
- var paramObj = defData.split('+').map(function(v) {
- return v.trim();
- }).filter(function(a) {
- return a;
- }).reduce(function(p, a) {
- var split = a.split('=');
- split.push(true);
- p[split[0].toLowerCase()] = split[1];
- return p;
- }, {});
- var paramName, paramVal, paramOutname;
- var params = {
- proj: 'projName',
- datum: 'datumCode',
- rf: function(v) {
- self.rf = parseFloat(v);
- },
- lat_0: function(v) {
- self.lat0 = v * D2R;
- },
- lat_1: function(v) {
- self.lat1 = v * D2R;
- },
- lat_2: function(v) {
- self.lat2 = v * D2R;
- },
- lat_ts: function(v) {
- self.lat_ts = v * D2R;
- },
- lon_0: function(v) {
- self.long0 = v * D2R;
- },
- lon_1: function(v) {
- self.long1 = v * D2R;
- },
- lon_2: function(v) {
- self.long2 = v * D2R;
- },
- alpha: function(v) {
- self.alpha = parseFloat(v) * D2R;
- },
- gamma: function(v) {
- self.rectified_grid_angle = parseFloat(v);
- },
- lonc: function(v) {
- self.longc = v * D2R;
- },
- x_0: function(v) {
- self.x0 = parseFloat(v);
- },
- y_0: function(v) {
- self.y0 = parseFloat(v);
- },
- k_0: function(v) {
- self.k0 = parseFloat(v);
- },
- k: function(v) {
- self.k0 = parseFloat(v);
- },
- a: function(v) {
- self.a = parseFloat(v);
- },
- b: function(v) {
- self.b = parseFloat(v);
- },
- r_a: function() {
- self.R_A = true;
- },
- zone: function(v) {
- self.zone = parseInt(v, 10);
- },
- south: function() {
- self.utmSouth = true;
- },
- towgs84: function(v) {
- self.datum_params = v.split(",").map(function(a) {
- return parseFloat(a);
- });
- },
- to_meter: function(v) {
- self.to_meter = parseFloat(v);
- },
- units: function(v) {
- self.units = v;
- var unit = match(units, v);
- if (unit) {
- self.to_meter = unit.to_meter;
- }
- },
- from_greenwich: function(v) {
- self.from_greenwich = v * D2R;
- },
- pm: function(v) {
- var pm = match(PrimeMeridian_exports, v);
- self.from_greenwich = (pm ? pm : parseFloat(v)) * D2R;
- },
- nadgrids: function(v) {
- if (v === '@null') {
- self.datumCode = 'none';
- }
- else {
- self.nadgrids = v;
- }
- },
- axis: function(v) {
- var legalAxis = "ewnsud";
- if (v.length === 3 && legalAxis.indexOf(v.substr(0, 1)) !== -1 && legalAxis.indexOf(v.substr(1, 1)) !== -1 && legalAxis.indexOf(v.substr(2, 1)) !== -1) {
- self.axis = v;
- }
- },
- approx: function() {
- self.approx = true;
- }
- };
- for (paramName in paramObj) {
- paramVal = paramObj[paramName];
- if (paramName in params) {
- paramOutname = params[paramName];
- if (typeof paramOutname === 'function') {
- paramOutname(paramVal);
- }
- else {
- self[paramOutname] = paramVal;
- }
- }
- else {
- self[paramName] = paramVal;
- }
- }
- if(typeof self.datumCode === 'string' && self.datumCode !== "WGS84"){
- self.datumCode = self.datumCode.toLowerCase();
- }
- return self;
- }
- ;// CONCATENATED MODULE: ./node_modules/wkt-parser/parser.js
- /* harmony default export */ const parser = (parseString);
- var NEUTRAL = 1;
- var KEYWORD = 2;
- var NUMBER = 3;
- var QUOTED = 4;
- var AFTERQUOTE = 5;
- var ENDED = -1;
- var whitespace = /\s/;
- var latin = /[A-Za-z]/;
- var keyword = /[A-Za-z84_]/;
- var endThings = /[,\]]/;
- var digets = /[\d\.E\-\+]/;
- // const ignoredChar = /[\s_\-\/\(\)]/g;
- function Parser(text) {
- if (typeof text !== 'string') {
- throw new Error('not a string');
- }
- this.text = text.trim();
- this.level = 0;
- this.place = 0;
- this.root = null;
- this.stack = [];
- this.currentObject = null;
- this.state = NEUTRAL;
- }
- Parser.prototype.readCharicter = function() {
- var char = this.text[this.place++];
- if (this.state !== QUOTED) {
- while (whitespace.test(char)) {
- if (this.place >= this.text.length) {
- return;
- }
- char = this.text[this.place++];
- }
- }
- switch (this.state) {
- case NEUTRAL:
- return this.neutral(char);
- case KEYWORD:
- return this.keyword(char)
- case QUOTED:
- return this.quoted(char);
- case AFTERQUOTE:
- return this.afterquote(char);
- case NUMBER:
- return this.number(char);
- case ENDED:
- return;
- }
- };
- Parser.prototype.afterquote = function(char) {
- if (char === '"') {
- this.word += '"';
- this.state = QUOTED;
- return;
- }
- if (endThings.test(char)) {
- this.word = this.word.trim();
- this.afterItem(char);
- return;
- }
- throw new Error('havn\'t handled "' +char + '" in afterquote yet, index ' + this.place);
- };
- Parser.prototype.afterItem = function(char) {
- if (char === ',') {
- if (this.word !== null) {
- this.currentObject.push(this.word);
- }
- this.word = null;
- this.state = NEUTRAL;
- return;
- }
- if (char === ']') {
- this.level--;
- if (this.word !== null) {
- this.currentObject.push(this.word);
- this.word = null;
- }
- this.state = NEUTRAL;
- this.currentObject = this.stack.pop();
- if (!this.currentObject) {
- this.state = ENDED;
- }
- return;
- }
- };
- Parser.prototype.number = function(char) {
- if (digets.test(char)) {
- this.word += char;
- return;
- }
- if (endThings.test(char)) {
- this.word = parseFloat(this.word);
- this.afterItem(char);
- return;
- }
- throw new Error('havn\'t handled "' +char + '" in number yet, index ' + this.place);
- };
- Parser.prototype.quoted = function(char) {
- if (char === '"') {
- this.state = AFTERQUOTE;
- return;
- }
- this.word += char;
- return;
- };
- Parser.prototype.keyword = function(char) {
- if (keyword.test(char)) {
- this.word += char;
- return;
- }
- if (char === '[') {
- var newObjects = [];
- newObjects.push(this.word);
- this.level++;
- if (this.root === null) {
- this.root = newObjects;
- } else {
- this.currentObject.push(newObjects);
- }
- this.stack.push(this.currentObject);
- this.currentObject = newObjects;
- this.state = NEUTRAL;
- return;
- }
- if (endThings.test(char)) {
- this.afterItem(char);
- return;
- }
- throw new Error('havn\'t handled "' +char + '" in keyword yet, index ' + this.place);
- };
- Parser.prototype.neutral = function(char) {
- if (latin.test(char)) {
- this.word = char;
- this.state = KEYWORD;
- return;
- }
- if (char === '"') {
- this.word = '';
- this.state = QUOTED;
- return;
- }
- if (digets.test(char)) {
- this.word = char;
- this.state = NUMBER;
- return;
- }
- if (endThings.test(char)) {
- this.afterItem(char);
- return;
- }
- throw new Error('havn\'t handled "' +char + '" in neutral yet, index ' + this.place);
- };
- Parser.prototype.output = function() {
- while (this.place < this.text.length) {
- this.readCharicter();
- }
- if (this.state === ENDED) {
- return this.root;
- }
- throw new Error('unable to parse string "' +this.text + '". State is ' + this.state);
- };
- function parseString(txt) {
- var parser = new Parser(txt);
- return parser.output();
- }
- ;// CONCATENATED MODULE: ./node_modules/wkt-parser/process.js
- function mapit(obj, key, value) {
- if (Array.isArray(key)) {
- value.unshift(key);
- key = null;
- }
- var thing = key ? {} : obj;
- var out = value.reduce(function(newObj, item) {
- sExpr(item, newObj);
- return newObj
- }, thing);
- if (key) {
- obj[key] = out;
- }
- }
- function sExpr(v, obj) {
- if (!Array.isArray(v)) {
- obj[v] = true;
- return;
- }
- var key = v.shift();
- if (key === 'PARAMETER') {
- key = v.shift();
- }
- if (v.length === 1) {
- if (Array.isArray(v[0])) {
- obj[key] = {};
- sExpr(v[0], obj[key]);
- return;
- }
- obj[key] = v[0];
- return;
- }
- if (!v.length) {
- obj[key] = true;
- return;
- }
- if (key === 'TOWGS84') {
- obj[key] = v;
- return;
- }
- if (key === 'AXIS') {
- if (!(key in obj)) {
- obj[key] = [];
- }
- obj[key].push(v);
- return;
- }
- if (!Array.isArray(key)) {
- obj[key] = {};
- }
- var i;
- switch (key) {
- case 'UNIT':
- case 'PRIMEM':
- case 'VERT_DATUM':
- obj[key] = {
- name: v[0].toLowerCase(),
- convert: v[1]
- };
- if (v.length === 3) {
- sExpr(v[2], obj[key]);
- }
- return;
- case 'SPHEROID':
- case 'ELLIPSOID':
- obj[key] = {
- name: v[0],
- a: v[1],
- rf: v[2]
- };
- if (v.length === 4) {
- sExpr(v[3], obj[key]);
- }
- return;
- case 'PROJECTEDCRS':
- case 'PROJCRS':
- case 'GEOGCS':
- case 'GEOCCS':
- case 'PROJCS':
- case 'LOCAL_CS':
- case 'GEODCRS':
- case 'GEODETICCRS':
- case 'GEODETICDATUM':
- case 'EDATUM':
- case 'ENGINEERINGDATUM':
- case 'VERT_CS':
- case 'VERTCRS':
- case 'VERTICALCRS':
- case 'COMPD_CS':
- case 'COMPOUNDCRS':
- case 'ENGINEERINGCRS':
- case 'ENGCRS':
- case 'FITTED_CS':
- case 'LOCAL_DATUM':
- case 'DATUM':
- v[0] = ['name', v[0]];
- mapit(obj, key, v);
- return;
- default:
- i = -1;
- while (++i < v.length) {
- if (!Array.isArray(v[i])) {
- return sExpr(v, obj[key]);
- }
- }
- return mapit(obj, key, v);
- }
- }
- ;// CONCATENATED MODULE: ./node_modules/wkt-parser/index.js
- var wkt_parser_D2R = 0.01745329251994329577;
- function rename(obj, params) {
- var outName = params[0];
- var inName = params[1];
- if (!(outName in obj) && (inName in obj)) {
- obj[outName] = obj[inName];
- if (params.length === 3) {
- obj[outName] = params[2](obj[outName]);
- }
- }
- }
- function d2r(input) {
- return input * wkt_parser_D2R;
- }
- function cleanWKT(wkt) {
- if (wkt.type === 'GEOGCS') {
- wkt.projName = 'longlat';
- } else if (wkt.type === 'LOCAL_CS') {
- wkt.projName = 'identity';
- wkt.local = true;
- } else {
- if (typeof wkt.PROJECTION === 'object') {
- wkt.projName = Object.keys(wkt.PROJECTION)[0];
- } else {
- wkt.projName = wkt.PROJECTION;
- }
- }
- if (wkt.AXIS) {
- var axisOrder = '';
- for (var i = 0, ii = wkt.AXIS.length; i < ii; ++i) {
- var axis = [wkt.AXIS[i][0].toLowerCase(), wkt.AXIS[i][1].toLowerCase()];
- if (axis[0].indexOf('north') !== -1 || ((axis[0] === 'y' || axis[0] === 'lat') && axis[1] === 'north')) {
- axisOrder += 'n';
- } else if (axis[0].indexOf('south') !== -1 || ((axis[0] === 'y' || axis[0] === 'lat') && axis[1] === 'south')) {
- axisOrder += 's';
- } else if (axis[0].indexOf('east') !== -1 || ((axis[0] === 'x' || axis[0] === 'lon') && axis[1] === 'east')) {
- axisOrder += 'e';
- } else if (axis[0].indexOf('west') !== -1 || ((axis[0] === 'x' || axis[0] === 'lon') && axis[1] === 'west')) {
- axisOrder += 'w';
- }
- }
- if (axisOrder.length === 2) {
- axisOrder += 'u';
- }
- if (axisOrder.length === 3) {
- wkt.axis = axisOrder;
- }
- }
- if (wkt.UNIT) {
- wkt.units = wkt.UNIT.name.toLowerCase();
- if (wkt.units === 'metre') {
- wkt.units = 'meter';
- }
- if (wkt.UNIT.convert) {
- if (wkt.type === 'GEOGCS') {
- if (wkt.DATUM && wkt.DATUM.SPHEROID) {
- wkt.to_meter = wkt.UNIT.convert*wkt.DATUM.SPHEROID.a;
- }
- } else {
- wkt.to_meter = wkt.UNIT.convert;
- }
- }
- }
- var geogcs = wkt.GEOGCS;
- if (wkt.type === 'GEOGCS') {
- geogcs = wkt;
- }
- if (geogcs) {
- //if(wkt.GEOGCS.PRIMEM&&wkt.GEOGCS.PRIMEM.convert){
- // wkt.from_greenwich=wkt.GEOGCS.PRIMEM.convert*D2R;
- //}
- if (geogcs.DATUM) {
- wkt.datumCode = geogcs.DATUM.name.toLowerCase();
- } else {
- wkt.datumCode = geogcs.name.toLowerCase();
- }
- if (wkt.datumCode.slice(0, 2) === 'd_') {
- wkt.datumCode = wkt.datumCode.slice(2);
- }
- if (wkt.datumCode === 'new_zealand_geodetic_datum_1949' || wkt.datumCode === 'new_zealand_1949') {
- wkt.datumCode = 'nzgd49';
- }
- if (wkt.datumCode === 'wgs_1984' || wkt.datumCode === 'world_geodetic_system_1984') {
- if (wkt.PROJECTION === 'Mercator_Auxiliary_Sphere') {
- wkt.sphere = true;
- }
- wkt.datumCode = 'wgs84';
- }
- if (wkt.datumCode.slice(-6) === '_ferro') {
- wkt.datumCode = wkt.datumCode.slice(0, - 6);
- }
- if (wkt.datumCode.slice(-8) === '_jakarta') {
- wkt.datumCode = wkt.datumCode.slice(0, - 8);
- }
- if (~wkt.datumCode.indexOf('belge')) {
- wkt.datumCode = 'rnb72';
- }
- if (geogcs.DATUM && geogcs.DATUM.SPHEROID) {
- wkt.ellps = geogcs.DATUM.SPHEROID.name.replace('_19', '').replace(/[Cc]larke\_18/, 'clrk');
- if (wkt.ellps.toLowerCase().slice(0, 13) === 'international') {
- wkt.ellps = 'intl';
- }
- wkt.a = geogcs.DATUM.SPHEROID.a;
- wkt.rf = parseFloat(geogcs.DATUM.SPHEROID.rf, 10);
- }
- if (geogcs.DATUM && geogcs.DATUM.TOWGS84) {
- wkt.datum_params = geogcs.DATUM.TOWGS84;
- }
- if (~wkt.datumCode.indexOf('osgb_1936')) {
- wkt.datumCode = 'osgb36';
- }
- if (~wkt.datumCode.indexOf('osni_1952')) {
- wkt.datumCode = 'osni52';
- }
- if (~wkt.datumCode.indexOf('tm65')
- || ~wkt.datumCode.indexOf('geodetic_datum_of_1965')) {
- wkt.datumCode = 'ire65';
- }
- if (wkt.datumCode === 'ch1903+') {
- wkt.datumCode = 'ch1903';
- }
- if (~wkt.datumCode.indexOf('israel')) {
- wkt.datumCode = 'isr93';
- }
- }
- if (wkt.b && !isFinite(wkt.b)) {
- wkt.b = wkt.a;
- }
- function toMeter(input) {
- var ratio = wkt.to_meter || 1;
- return input * ratio;
- }
- var renamer = function(a) {
- return rename(wkt, a);
- };
- var list = [
- ['standard_parallel_1', 'Standard_Parallel_1'],
- ['standard_parallel_1', 'Latitude of 1st standard parallel'],
- ['standard_parallel_2', 'Standard_Parallel_2'],
- ['standard_parallel_2', 'Latitude of 2nd standard parallel'],
- ['false_easting', 'False_Easting'],
- ['false_easting', 'False easting'],
- ['false-easting', 'Easting at false origin'],
- ['false_northing', 'False_Northing'],
- ['false_northing', 'False northing'],
- ['false_northing', 'Northing at false origin'],
- ['central_meridian', 'Central_Meridian'],
- ['central_meridian', 'Longitude of natural origin'],
- ['central_meridian', 'Longitude of false origin'],
- ['latitude_of_origin', 'Latitude_Of_Origin'],
- ['latitude_of_origin', 'Central_Parallel'],
- ['latitude_of_origin', 'Latitude of natural origin'],
- ['latitude_of_origin', 'Latitude of false origin'],
- ['scale_factor', 'Scale_Factor'],
- ['k0', 'scale_factor'],
- ['latitude_of_center', 'Latitude_Of_Center'],
- ['latitude_of_center', 'Latitude_of_center'],
- ['lat0', 'latitude_of_center', d2r],
- ['longitude_of_center', 'Longitude_Of_Center'],
- ['longitude_of_center', 'Longitude_of_center'],
- ['longc', 'longitude_of_center', d2r],
- ['x0', 'false_easting', toMeter],
- ['y0', 'false_northing', toMeter],
- ['long0', 'central_meridian', d2r],
- ['lat0', 'latitude_of_origin', d2r],
- ['lat0', 'standard_parallel_1', d2r],
- ['lat1', 'standard_parallel_1', d2r],
- ['lat2', 'standard_parallel_2', d2r],
- ['azimuth', 'Azimuth'],
- ['alpha', 'azimuth', d2r],
- ['srsCode', 'name']
- ];
- list.forEach(renamer);
- if (!wkt.long0 && wkt.longc && (wkt.projName === 'Albers_Conic_Equal_Area' || wkt.projName === 'Lambert_Azimuthal_Equal_Area')) {
- wkt.long0 = wkt.longc;
- }
- if (!wkt.lat_ts && wkt.lat1 && (wkt.projName === 'Stereographic_South_Pole' || wkt.projName === 'Polar Stereographic (variant B)')) {
- wkt.lat0 = d2r(wkt.lat1 > 0 ? 90 : -90);
- wkt.lat_ts = wkt.lat1;
- }
- }
- /* harmony default export */ function wkt_parser(wkt) {
- var lisp = parser(wkt);
- var type = lisp.shift();
- var name = lisp.shift();
- lisp.unshift(['name', name]);
- lisp.unshift(['type', type]);
- var obj = {};
- sExpr(lisp, obj);
- cleanWKT(obj);
- return obj;
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/defs.js
- function defs(name) {
- /*global console*/
- var that = this;
- if (arguments.length === 2) {
- var def = arguments[1];
- if (typeof def === 'string') {
- if (def.charAt(0) === '+') {
- defs[name] = projString(arguments[1]);
- }
- else {
- defs[name] = wkt_parser(arguments[1]);
- }
- } else {
- defs[name] = def;
- }
- }
- else if (arguments.length === 1) {
- if (Array.isArray(name)) {
- return name.map(function(v) {
- if (Array.isArray(v)) {
- defs.apply(that, v);
- }
- else {
- defs(v);
- }
- });
- }
- else if (typeof name === 'string') {
- if (name in defs) {
- return defs[name];
- }
- }
- else if ('EPSG' in name) {
- defs['EPSG:' + name.EPSG] = name;
- }
- else if ('ESRI' in name) {
- defs['ESRI:' + name.ESRI] = name;
- }
- else if ('IAU2000' in name) {
- defs['IAU2000:' + name.IAU2000] = name;
- }
- else {
- console.log(name);
- }
- return;
- }
- }
- global(defs);
- /* harmony default export */ const lib_defs = (defs);
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/parseCode.js
- function testObj(code){
- return typeof code === 'string';
- }
- function testDef(code){
- return code in lib_defs;
- }
- var codeWords = ['PROJECTEDCRS', 'PROJCRS', 'GEOGCS','GEOCCS','PROJCS','LOCAL_CS', 'GEODCRS', 'GEODETICCRS', 'GEODETICDATUM', 'ENGCRS', 'ENGINEERINGCRS'];
- function testWKT(code){
- return codeWords.some(function (word) {
- return code.indexOf(word) > -1;
- });
- }
- var codes = ['3857', '900913', '3785', '102113'];
- function checkMercator(item) {
- var auth = match(item, 'authority');
- if (!auth) {
- return;
- }
- var code = match(auth, 'epsg');
- return code && codes.indexOf(code) > -1;
- }
- function checkProjStr(item) {
- var ext = match(item, 'extension');
- if (!ext) {
- return;
- }
- return match(ext, 'proj4');
- }
- function testProj(code){
- return code[0] === '+';
- }
- function parse(code){
- if (testObj(code)) {
- //check to see if this is a WKT string
- if (testDef(code)) {
- return lib_defs[code];
- }
- if (testWKT(code)) {
- var out = wkt_parser(code);
- // test of spetial case, due to this being a very common and often malformed
- if (checkMercator(out)) {
- return lib_defs["EPSG:3857"];
- }
- var maybeProjStr = checkProjStr(out);
- if (maybeProjStr) {
- return projString(maybeProjStr);
- }
- return out;
- }
- if (testProj(code)) {
- return projString(code);
- }
- }else{
- return code;
- }
- }
- /* harmony default export */ const parseCode = (parse);
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/extend.js
- /* harmony default export */ function extend(destination, source) {
- destination = destination || {};
- var value, property;
- if (!source) {
- return destination;
- }
- for (property in source) {
- value = source[property];
- if (value !== undefined) {
- destination[property] = value;
- }
- }
- return destination;
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/msfnz.js
- /* harmony default export */ function msfnz(eccent, sinphi, cosphi) {
- var con = eccent * sinphi;
- return cosphi / (Math.sqrt(1 - con * con));
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/sign.js
- /* harmony default export */ function sign(x) {
- return x<0 ? -1 : 1;
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/adjust_lon.js
- /* harmony default export */ function adjust_lon(x) {
- return (Math.abs(x) <= SPI) ? x : (x - (sign(x) * TWO_PI));
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/tsfnz.js
- /* harmony default export */ function tsfnz(eccent, phi, sinphi) {
- var con = eccent * sinphi;
- var com = 0.5 * eccent;
- con = Math.pow(((1 - con) / (1 + con)), com);
- return (Math.tan(0.5 * (HALF_PI - phi)) / con);
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/phi2z.js
- /* harmony default export */ function phi2z(eccent, ts) {
- var eccnth = 0.5 * eccent;
- var con, dphi;
- var phi = HALF_PI - 2 * Math.atan(ts);
- for (var i = 0; i <= 15; i++) {
- con = eccent * Math.sin(phi);
- dphi = HALF_PI - 2 * Math.atan(ts * (Math.pow(((1 - con) / (1 + con)), eccnth))) - phi;
- phi += dphi;
- if (Math.abs(dphi) <= 0.0000000001) {
- return phi;
- }
- }
- //console.log("phi2z has NoConvergence");
- return -9999;
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/merc.js
- function init() {
- var con = this.b / this.a;
- this.es = 1 - con * con;
- if(!('x0' in this)){
- this.x0 = 0;
- }
- if(!('y0' in this)){
- this.y0 = 0;
- }
- this.e = Math.sqrt(this.es);
- if (this.lat_ts) {
- if (this.sphere) {
- this.k0 = Math.cos(this.lat_ts);
- }
- else {
- this.k0 = msfnz(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts));
- }
- }
- else {
- if (!this.k0) {
- if (this.k) {
- this.k0 = this.k;
- }
- else {
- this.k0 = 1;
- }
- }
- }
- }
- /* Mercator forward equations--mapping lat,long to x,y
- --------------------------------------------------*/
- function forward(p) {
- var lon = p.x;
- var lat = p.y;
- // convert to radians
- if (lat * R2D > 90 && lat * R2D < -90 && lon * R2D > 180 && lon * R2D < -180) {
- return null;
- }
- var x, y;
- if (Math.abs(Math.abs(lat) - HALF_PI) <= EPSLN) {
- return null;
- }
- else {
- if (this.sphere) {
- x = this.x0 + this.a * this.k0 * adjust_lon(lon - this.long0);
- y = this.y0 + this.a * this.k0 * Math.log(Math.tan(FORTPI + 0.5 * lat));
- }
- else {
- var sinphi = Math.sin(lat);
- var ts = tsfnz(this.e, lat, sinphi);
- x = this.x0 + this.a * this.k0 * adjust_lon(lon - this.long0);
- y = this.y0 - this.a * this.k0 * Math.log(ts);
- }
- p.x = x;
- p.y = y;
- return p;
- }
- }
- /* Mercator inverse equations--mapping x,y to lat/long
- --------------------------------------------------*/
- function inverse(p) {
- var x = p.x - this.x0;
- var y = p.y - this.y0;
- var lon, lat;
- if (this.sphere) {
- lat = HALF_PI - 2 * Math.atan(Math.exp(-y / (this.a * this.k0)));
- }
- else {
- var ts = Math.exp(-y / (this.a * this.k0));
- lat = phi2z(this.e, ts);
- if (lat === -9999) {
- return null;
- }
- }
- lon = adjust_lon(this.long0 + x / (this.a * this.k0));
- p.x = lon;
- p.y = lat;
- return p;
- }
- var names = ["Mercator", "Popular Visualisation Pseudo Mercator", "Mercator_1SP", "Mercator_Auxiliary_Sphere", "merc"];
- /* harmony default export */ const merc = ({
- init: init,
- forward: forward,
- inverse: inverse,
- names: names
- });
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/longlat.js
- function longlat_init() {
- //no-op for longlat
- }
- function identity(pt) {
- return pt;
- }
- var longlat_names = ["longlat", "identity"];
- /* harmony default export */ const longlat = ({
- init: longlat_init,
- forward: identity,
- inverse: identity,
- names: longlat_names
- });
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections.js
- var projs = [merc, longlat];
- var projections_names = {};
- var projStore = [];
- function add(proj, i) {
- var len = projStore.length;
- if (!proj.names) {
- console.log(i);
- return true;
- }
- projStore[len] = proj;
- proj.names.forEach(function(n) {
- projections_names[n.toLowerCase()] = len;
- });
- return this;
- }
- function get(name) {
- if (!name) {
- return false;
- }
- var n = name.toLowerCase();
- if (typeof projections_names[n] !== 'undefined' && projStore[projections_names[n]]) {
- return projStore[projections_names[n]];
- }
- }
- function start() {
- projs.forEach(add);
- }
- /* harmony default export */ const projections = ({
- start: start,
- add: add,
- get: get
- });
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/constants/Ellipsoid.js
- var Ellipsoid_exports = {};
- Ellipsoid_exports.MERIT = {
- a: 6378137.0,
- rf: 298.257,
- ellipseName: "MERIT 1983"
- };
- Ellipsoid_exports.SGS85 = {
- a: 6378136.0,
- rf: 298.257,
- ellipseName: "Soviet Geodetic System 85"
- };
- Ellipsoid_exports.GRS80 = {
- a: 6378137.0,
- rf: 298.257222101,
- ellipseName: "GRS 1980(IUGG, 1980)"
- };
- Ellipsoid_exports.IAU76 = {
- a: 6378140.0,
- rf: 298.257,
- ellipseName: "IAU 1976"
- };
- Ellipsoid_exports.airy = {
- a: 6377563.396,
- b: 6356256.910,
- ellipseName: "Airy 1830"
- };
- Ellipsoid_exports.APL4 = {
- a: 6378137,
- rf: 298.25,
- ellipseName: "Appl. Physics. 1965"
- };
- Ellipsoid_exports.NWL9D = {
- a: 6378145.0,
- rf: 298.25,
- ellipseName: "Naval Weapons Lab., 1965"
- };
- Ellipsoid_exports.mod_airy = {
- a: 6377340.189,
- b: 6356034.446,
- ellipseName: "Modified Airy"
- };
- Ellipsoid_exports.andrae = {
- a: 6377104.43,
- rf: 300.0,
- ellipseName: "Andrae 1876 (Den., Iclnd.)"
- };
- Ellipsoid_exports.aust_SA = {
- a: 6378160.0,
- rf: 298.25,
- ellipseName: "Australian Natl & S. Amer. 1969"
- };
- Ellipsoid_exports.GRS67 = {
- a: 6378160.0,
- rf: 298.2471674270,
- ellipseName: "GRS 67(IUGG 1967)"
- };
- Ellipsoid_exports.bessel = {
- a: 6377397.155,
- rf: 299.1528128,
- ellipseName: "Bessel 1841"
- };
- Ellipsoid_exports.bess_nam = {
- a: 6377483.865,
- rf: 299.1528128,
- ellipseName: "Bessel 1841 (Namibia)"
- };
- Ellipsoid_exports.clrk66 = {
- a: 6378206.4,
- b: 6356583.8,
- ellipseName: "Clarke 1866"
- };
- Ellipsoid_exports.clrk80 = {
- a: 6378249.145,
- rf: 293.4663,
- ellipseName: "Clarke 1880 mod."
- };
- Ellipsoid_exports.clrk58 = {
- a: 6378293.645208759,
- rf: 294.2606763692654,
- ellipseName: "Clarke 1858"
- };
- Ellipsoid_exports.CPM = {
- a: 6375738.7,
- rf: 334.29,
- ellipseName: "Comm. des Poids et Mesures 1799"
- };
- Ellipsoid_exports.delmbr = {
- a: 6376428.0,
- rf: 311.5,
- ellipseName: "Delambre 1810 (Belgium)"
- };
- Ellipsoid_exports.engelis = {
- a: 6378136.05,
- rf: 298.2566,
- ellipseName: "Engelis 1985"
- };
- Ellipsoid_exports.evrst30 = {
- a: 6377276.345,
- rf: 300.8017,
- ellipseName: "Everest 1830"
- };
- Ellipsoid_exports.evrst48 = {
- a: 6377304.063,
- rf: 300.8017,
- ellipseName: "Everest 1948"
- };
- Ellipsoid_exports.evrst56 = {
- a: 6377301.243,
- rf: 300.8017,
- ellipseName: "Everest 1956"
- };
- Ellipsoid_exports.evrst69 = {
- a: 6377295.664,
- rf: 300.8017,
- ellipseName: "Everest 1969"
- };
- Ellipsoid_exports.evrstSS = {
- a: 6377298.556,
- rf: 300.8017,
- ellipseName: "Everest (Sabah & Sarawak)"
- };
- Ellipsoid_exports.fschr60 = {
- a: 6378166.0,
- rf: 298.3,
- ellipseName: "Fischer (Mercury Datum) 1960"
- };
- Ellipsoid_exports.fschr60m = {
- a: 6378155.0,
- rf: 298.3,
- ellipseName: "Fischer 1960"
- };
- Ellipsoid_exports.fschr68 = {
- a: 6378150.0,
- rf: 298.3,
- ellipseName: "Fischer 1968"
- };
- Ellipsoid_exports.helmert = {
- a: 6378200.0,
- rf: 298.3,
- ellipseName: "Helmert 1906"
- };
- Ellipsoid_exports.hough = {
- a: 6378270.0,
- rf: 297.0,
- ellipseName: "Hough"
- };
- Ellipsoid_exports.intl = {
- a: 6378388.0,
- rf: 297.0,
- ellipseName: "International 1909 (Hayford)"
- };
- Ellipsoid_exports.kaula = {
- a: 6378163.0,
- rf: 298.24,
- ellipseName: "Kaula 1961"
- };
- Ellipsoid_exports.lerch = {
- a: 6378139.0,
- rf: 298.257,
- ellipseName: "Lerch 1979"
- };
- Ellipsoid_exports.mprts = {
- a: 6397300.0,
- rf: 191.0,
- ellipseName: "Maupertius 1738"
- };
- Ellipsoid_exports.new_intl = {
- a: 6378157.5,
- b: 6356772.2,
- ellipseName: "New International 1967"
- };
- Ellipsoid_exports.plessis = {
- a: 6376523.0,
- rf: 6355863.0,
- ellipseName: "Plessis 1817 (France)"
- };
- Ellipsoid_exports.krass = {
- a: 6378245.0,
- rf: 298.3,
- ellipseName: "Krassovsky, 1942"
- };
- Ellipsoid_exports.SEasia = {
- a: 6378155.0,
- b: 6356773.3205,
- ellipseName: "Southeast Asia"
- };
- Ellipsoid_exports.walbeck = {
- a: 6376896.0,
- b: 6355834.8467,
- ellipseName: "Walbeck"
- };
- Ellipsoid_exports.WGS60 = {
- a: 6378165.0,
- rf: 298.3,
- ellipseName: "WGS 60"
- };
- Ellipsoid_exports.WGS66 = {
- a: 6378145.0,
- rf: 298.25,
- ellipseName: "WGS 66"
- };
- Ellipsoid_exports.WGS7 = {
- a: 6378135.0,
- rf: 298.26,
- ellipseName: "WGS 72"
- };
- var WGS84 = Ellipsoid_exports.WGS84 = {
- a: 6378137.0,
- rf: 298.257223563,
- ellipseName: "WGS 84"
- };
- Ellipsoid_exports.sphere = {
- a: 6370997.0,
- b: 6370997.0,
- ellipseName: "Normal Sphere (r=6370997)"
- };
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/deriveConstants.js
- function eccentricity(a, b, rf, R_A) {
- var a2 = a * a; // used in geocentric
- var b2 = b * b; // used in geocentric
- var es = (a2 - b2) / a2; // e ^ 2
- var e = 0;
- if (R_A) {
- a *= 1 - es * (SIXTH + es * (RA4 + es * RA6));
- a2 = a * a;
- es = 0;
- } else {
- e = Math.sqrt(es); // eccentricity
- }
- var ep2 = (a2 - b2) / b2; // used in geocentric
- return {
- es: es,
- e: e,
- ep2: ep2
- };
- }
- function sphere(a, b, rf, ellps, sphere) {
- if (!a) { // do we have an ellipsoid?
- var ellipse = match(Ellipsoid_exports, ellps);
- if (!ellipse) {
- ellipse = WGS84;
- }
- a = ellipse.a;
- b = ellipse.b;
- rf = ellipse.rf;
- }
- if (rf && !b) {
- b = (1.0 - 1.0 / rf) * a;
- }
- if (rf === 0 || Math.abs(a - b) < EPSLN) {
- sphere = true;
- b = a;
- }
- return {
- a: a,
- b: b,
- rf: rf,
- sphere: sphere
- };
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/constants/Datum.js
- var Datum_exports = {};
- Datum_exports.wgs84 = {
- towgs84: "0,0,0",
- ellipse: "WGS84",
- datumName: "WGS84"
- };
- Datum_exports.ch1903 = {
- towgs84: "674.374,15.056,405.346",
- ellipse: "bessel",
- datumName: "swiss"
- };
- Datum_exports.ggrs87 = {
- towgs84: "-199.87,74.79,246.62",
- ellipse: "GRS80",
- datumName: "Greek_Geodetic_Reference_System_1987"
- };
- Datum_exports.nad83 = {
- towgs84: "0,0,0",
- ellipse: "GRS80",
- datumName: "North_American_Datum_1983"
- };
- Datum_exports.nad27 = {
- nadgrids: "@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",
- ellipse: "clrk66",
- datumName: "North_American_Datum_1927"
- };
- Datum_exports.potsdam = {
- towgs84: "598.1,73.7,418.2,0.202,0.045,-2.455,6.7",
- ellipse: "bessel",
- datumName: "Potsdam Rauenberg 1950 DHDN"
- };
- Datum_exports.carthage = {
- towgs84: "-263.0,6.0,431.0",
- ellipse: "clark80",
- datumName: "Carthage 1934 Tunisia"
- };
- Datum_exports.hermannskogel = {
- towgs84: "577.326,90.129,463.919,5.137,1.474,5.297,2.4232",
- ellipse: "bessel",
- datumName: "Hermannskogel"
- };
- Datum_exports.osni52 = {
- towgs84: "482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",
- ellipse: "airy",
- datumName: "Irish National"
- };
- Datum_exports.ire65 = {
- towgs84: "482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",
- ellipse: "mod_airy",
- datumName: "Ireland 1965"
- };
- Datum_exports.rassadiran = {
- towgs84: "-133.63,-157.5,-158.62",
- ellipse: "intl",
- datumName: "Rassadiran"
- };
- Datum_exports.nzgd49 = {
- towgs84: "59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",
- ellipse: "intl",
- datumName: "New Zealand Geodetic Datum 1949"
- };
- Datum_exports.osgb36 = {
- towgs84: "446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",
- ellipse: "airy",
- datumName: "Airy 1830"
- };
- Datum_exports.s_jtsk = {
- towgs84: "589,76,480",
- ellipse: 'bessel',
- datumName: 'S-JTSK (Ferro)'
- };
- Datum_exports.beduaram = {
- towgs84: '-106,-87,188',
- ellipse: 'clrk80',
- datumName: 'Beduaram'
- };
- Datum_exports.gunung_segara = {
- towgs84: '-403,684,41',
- ellipse: 'bessel',
- datumName: 'Gunung Segara Jakarta'
- };
- Datum_exports.rnb72 = {
- towgs84: "106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",
- ellipse: "intl",
- datumName: "Reseau National Belge 1972"
- };
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/datum.js
- function datum(datumCode, datum_params, a, b, es, ep2, nadgrids) {
- var out = {};
- if (datumCode === undefined || datumCode === 'none') {
- out.datum_type = PJD_NODATUM;
- } else {
- out.datum_type = PJD_WGS84;
- }
- if (datum_params) {
- out.datum_params = datum_params.map(parseFloat);
- if (out.datum_params[0] !== 0 || out.datum_params[1] !== 0 || out.datum_params[2] !== 0) {
- out.datum_type = PJD_3PARAM;
- }
- if (out.datum_params.length > 3) {
- if (out.datum_params[3] !== 0 || out.datum_params[4] !== 0 || out.datum_params[5] !== 0 || out.datum_params[6] !== 0) {
- out.datum_type = PJD_7PARAM;
- out.datum_params[3] *= SEC_TO_RAD;
- out.datum_params[4] *= SEC_TO_RAD;
- out.datum_params[5] *= SEC_TO_RAD;
- out.datum_params[6] = (out.datum_params[6] / 1000000.0) + 1.0;
- }
- }
- }
- if (nadgrids) {
- out.datum_type = PJD_GRIDSHIFT;
- out.grids = nadgrids;
- }
- out.a = a; //datum object also uses these values
- out.b = b;
- out.es = es;
- out.ep2 = ep2;
- return out;
- }
- /* harmony default export */ const lib_datum = (datum);
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/nadgrid.js
- /**
- * Resources for details of NTv2 file formats:
- * - https://web.archive.org/web/20140127204822if_/http://www.mgs.gov.on.ca:80/stdprodconsume/groups/content/@mgs/@iandit/documents/resourcelist/stel02_047447.pdf
- * - http://mimaka.com/help/gs/html/004_NTV2%20Data%20Format.htm
- */
- var loadedNadgrids = {};
- /**
- * Load a binary NTv2 file (.gsb) to a key that can be used in a proj string like +nadgrids=<key>. Pass the NTv2 file
- * as an ArrayBuffer.
- */
- function nadgrid(key, data) {
- var view = new DataView(data);
- var isLittleEndian = detectLittleEndian(view);
- var header = readHeader(view, isLittleEndian);
- if (header.nSubgrids > 1) {
- console.log('Only single NTv2 subgrids are currently supported, subsequent sub grids are ignored');
- }
- var subgrids = readSubgrids(view, header, isLittleEndian);
- var nadgrid = {header: header, subgrids: subgrids};
- loadedNadgrids[key] = nadgrid;
- return nadgrid;
- }
- /**
- * Given a proj4 value for nadgrids, return an array of loaded grids
- */
- function getNadgrids(nadgrids) {
- // Format details: http://proj.maptools.org/gen_parms.html
- if (nadgrids === undefined) { return null; }
- var grids = nadgrids.split(',');
- return grids.map(parseNadgridString);
- }
- function parseNadgridString(value) {
- if (value.length === 0) {
- return null;
- }
- var optional = value[0] === '@';
- if (optional) {
- value = value.slice(1);
- }
- if (value === 'null') {
- return {name: 'null', mandatory: !optional, grid: null, isNull: true};
- }
- return {
- name: value,
- mandatory: !optional,
- grid: loadedNadgrids[value] || null,
- isNull: false
- };
- }
- function secondsToRadians(seconds) {
- return (seconds / 3600) * Math.PI / 180;
- }
- function detectLittleEndian(view) {
- var nFields = view.getInt32(8, false);
- if (nFields === 11) {
- return false;
- }
- nFields = view.getInt32(8, true);
- if (nFields !== 11) {
- console.warn('Failed to detect nadgrid endian-ness, defaulting to little-endian');
- }
- return true;
- }
- function readHeader(view, isLittleEndian) {
- return {
- nFields: view.getInt32(8, isLittleEndian),
- nSubgridFields: view.getInt32(24, isLittleEndian),
- nSubgrids: view.getInt32(40, isLittleEndian),
- shiftType: decodeString(view, 56, 56 + 8).trim(),
- fromSemiMajorAxis: view.getFloat64(120, isLittleEndian),
- fromSemiMinorAxis: view.getFloat64(136, isLittleEndian),
- toSemiMajorAxis: view.getFloat64(152, isLittleEndian),
- toSemiMinorAxis: view.getFloat64(168, isLittleEndian),
- };
- }
- function decodeString(view, start, end) {
- return String.fromCharCode.apply(null, new Uint8Array(view.buffer.slice(start, end)));
- }
- function readSubgrids(view, header, isLittleEndian) {
- var gridOffset = 176;
- var grids = [];
- for (var i = 0; i < header.nSubgrids; i++) {
- var subHeader = readGridHeader(view, gridOffset, isLittleEndian);
- var nodes = readGridNodes(view, gridOffset, subHeader, isLittleEndian);
- var lngColumnCount = Math.round(
- 1 + (subHeader.upperLongitude - subHeader.lowerLongitude) / subHeader.longitudeInterval);
- var latColumnCount = Math.round(
- 1 + (subHeader.upperLatitude - subHeader.lowerLatitude) / subHeader.latitudeInterval);
- // Proj4 operates on radians whereas the coordinates are in seconds in the grid
- grids.push({
- ll: [secondsToRadians(subHeader.lowerLongitude), secondsToRadians(subHeader.lowerLatitude)],
- del: [secondsToRadians(subHeader.longitudeInterval), secondsToRadians(subHeader.latitudeInterval)],
- lim: [lngColumnCount, latColumnCount],
- count: subHeader.gridNodeCount,
- cvs: mapNodes(nodes)
- });
- }
- return grids;
- }
- function mapNodes(nodes) {
- return nodes.map(function (r) {return [secondsToRadians(r.longitudeShift), secondsToRadians(r.latitudeShift)];});
- }
- function readGridHeader(view, offset, isLittleEndian) {
- return {
- name: decodeString(view, offset + 8, offset + 16).trim(),
- parent: decodeString(view, offset + 24, offset + 24 + 8).trim(),
- lowerLatitude: view.getFloat64(offset + 72, isLittleEndian),
- upperLatitude: view.getFloat64(offset + 88, isLittleEndian),
- lowerLongitude: view.getFloat64(offset + 104, isLittleEndian),
- upperLongitude: view.getFloat64(offset + 120, isLittleEndian),
- latitudeInterval: view.getFloat64(offset + 136, isLittleEndian),
- longitudeInterval: view.getFloat64(offset + 152, isLittleEndian),
- gridNodeCount: view.getInt32(offset + 168, isLittleEndian)
- };
- }
- function readGridNodes(view, offset, gridHeader, isLittleEndian) {
- var nodesOffset = offset + 176;
- var gridRecordLength = 16;
- var gridShiftRecords = [];
- for (var i = 0; i < gridHeader.gridNodeCount; i++) {
- var record = {
- latitudeShift: view.getFloat32(nodesOffset + i * gridRecordLength, isLittleEndian),
- longitudeShift: view.getFloat32(nodesOffset + i * gridRecordLength + 4, isLittleEndian),
- latitudeAccuracy: view.getFloat32(nodesOffset + i * gridRecordLength + 8, isLittleEndian),
- longitudeAccuracy: view.getFloat32(nodesOffset + i * gridRecordLength + 12, isLittleEndian),
- };
- gridShiftRecords.push(record);
- }
- return gridShiftRecords;
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/Proj.js
- function Projection(srsCode,callback) {
- if (!(this instanceof Projection)) {
- return new Projection(srsCode);
- }
- callback = callback || function(error){
- if(error){
- throw error;
- }
- };
- var json = parseCode(srsCode);
- if(typeof json !== 'object'){
- callback(srsCode);
- return;
- }
- var ourProj = Projection.projections.get(json.projName);
- if(!ourProj){
- callback(srsCode);
- return;
- }
- if (json.datumCode && json.datumCode !== 'none') {
- var datumDef = match(Datum_exports, json.datumCode);
- if (datumDef) {
- json.datum_params = json.datum_params || (datumDef.towgs84 ? datumDef.towgs84.split(',') : null);
- json.ellps = datumDef.ellipse;
- json.datumName = datumDef.datumName ? datumDef.datumName : json.datumCode;
- }
- }
- json.k0 = json.k0 || 1.0;
- json.axis = json.axis || 'enu';
- json.ellps = json.ellps || 'wgs84';
- json.lat1 = json.lat1 || json.lat0; // Lambert_Conformal_Conic_1SP, for example, needs this
- var sphere_ = sphere(json.a, json.b, json.rf, json.ellps, json.sphere);
- var ecc = eccentricity(sphere_.a, sphere_.b, sphere_.rf, json.R_A);
- var nadgrids = getNadgrids(json.nadgrids);
- var datumObj = json.datum || lib_datum(json.datumCode, json.datum_params, sphere_.a, sphere_.b, ecc.es, ecc.ep2,
- nadgrids);
- extend(this, json); // transfer everything over from the projection because we don't know what we'll need
- extend(this, ourProj); // transfer all the methods from the projection
- // copy the 4 things over we calculated in deriveConstants.sphere
- this.a = sphere_.a;
- this.b = sphere_.b;
- this.rf = sphere_.rf;
- this.sphere = sphere_.sphere;
- // copy the 3 things we calculated in deriveConstants.eccentricity
- this.es = ecc.es;
- this.e = ecc.e;
- this.ep2 = ecc.ep2;
- // add in the datum object
- this.datum = datumObj;
- // init the projection
- this.init();
- // legecy callback from back in the day when it went to spatialreference.org
- callback(null, this);
- }
- Projection.projections = projections;
- Projection.projections.start();
- /* harmony default export */ const Proj = (Projection);
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/datumUtils.js
- function compareDatums(source, dest) {
- if (source.datum_type !== dest.datum_type) {
- return false; // false, datums are not equal
- } else if (source.a !== dest.a || Math.abs(source.es - dest.es) > 0.000000000050) {
- // the tolerance for es is to ensure that GRS80 and WGS84
- // are considered identical
- return false;
- } else if (source.datum_type === PJD_3PARAM) {
- return (source.datum_params[0] === dest.datum_params[0] && source.datum_params[1] === dest.datum_params[1] && source.datum_params[2] === dest.datum_params[2]);
- } else if (source.datum_type === PJD_7PARAM) {
- return (source.datum_params[0] === dest.datum_params[0] && source.datum_params[1] === dest.datum_params[1] && source.datum_params[2] === dest.datum_params[2] && source.datum_params[3] === dest.datum_params[3] && source.datum_params[4] === dest.datum_params[4] && source.datum_params[5] === dest.datum_params[5] && source.datum_params[6] === dest.datum_params[6]);
- } else {
- return true; // datums are equal
- }
- } // cs_compare_datums()
- /*
- * The function Convert_Geodetic_To_Geocentric converts geodetic coordinates
- * (latitude, longitude, and height) to geocentric coordinates (X, Y, Z),
- * according to the current ellipsoid parameters.
- *
- * Latitude : Geodetic latitude in radians (input)
- * Longitude : Geodetic longitude in radians (input)
- * Height : Geodetic height, in meters (input)
- * X : Calculated Geocentric X coordinate, in meters (output)
- * Y : Calculated Geocentric Y coordinate, in meters (output)
- * Z : Calculated Geocentric Z coordinate, in meters (output)
- *
- */
- function geodeticToGeocentric(p, es, a) {
- var Longitude = p.x;
- var Latitude = p.y;
- var Height = p.z ? p.z : 0; //Z value not always supplied
- var Rn; /* Earth radius at location */
- var Sin_Lat; /* Math.sin(Latitude) */
- var Sin2_Lat; /* Square of Math.sin(Latitude) */
- var Cos_Lat; /* Math.cos(Latitude) */
- /*
- ** Don't blow up if Latitude is just a little out of the value
- ** range as it may just be a rounding issue. Also removed longitude
- ** test, it should be wrapped by Math.cos() and Math.sin(). NFW for PROJ.4, Sep/2001.
- */
- if (Latitude < -HALF_PI && Latitude > -1.001 * HALF_PI) {
- Latitude = -HALF_PI;
- } else if (Latitude > HALF_PI && Latitude < 1.001 * HALF_PI) {
- Latitude = HALF_PI;
- } else if (Latitude < -HALF_PI) {
- /* Latitude out of range */
- //..reportError('geocent:lat out of range:' + Latitude);
- return { x: -Infinity, y: -Infinity, z: p.z };
- } else if (Latitude > HALF_PI) {
- /* Latitude out of range */
- return { x: Infinity, y: Infinity, z: p.z };
- }
- if (Longitude > Math.PI) {
- Longitude -= (2 * Math.PI);
- }
- Sin_Lat = Math.sin(Latitude);
- Cos_Lat = Math.cos(Latitude);
- Sin2_Lat = Sin_Lat * Sin_Lat;
- Rn = a / (Math.sqrt(1.0e0 - es * Sin2_Lat));
- return {
- x: (Rn + Height) * Cos_Lat * Math.cos(Longitude),
- y: (Rn + Height) * Cos_Lat * Math.sin(Longitude),
- z: ((Rn * (1 - es)) + Height) * Sin_Lat
- };
- } // cs_geodetic_to_geocentric()
- function geocentricToGeodetic(p, es, a, b) {
- /* local defintions and variables */
- /* end-criterium of loop, accuracy of sin(Latitude) */
- var genau = 1e-12;
- var genau2 = (genau * genau);
- var maxiter = 30;
- var P; /* distance between semi-minor axis and location */
- var RR; /* distance between center and location */
- var CT; /* sin of geocentric latitude */
- var ST; /* cos of geocentric latitude */
- var RX;
- var RK;
- var RN; /* Earth radius at location */
- var CPHI0; /* cos of start or old geodetic latitude in iterations */
- var SPHI0; /* sin of start or old geodetic latitude in iterations */
- var CPHI; /* cos of searched geodetic latitude */
- var SPHI; /* sin of searched geodetic latitude */
- var SDPHI; /* end-criterium: addition-theorem of sin(Latitude(iter)-Latitude(iter-1)) */
- var iter; /* # of continous iteration, max. 30 is always enough (s.a.) */
- var X = p.x;
- var Y = p.y;
- var Z = p.z ? p.z : 0.0; //Z value not always supplied
- var Longitude;
- var Latitude;
- var Height;
- P = Math.sqrt(X * X + Y * Y);
- RR = Math.sqrt(X * X + Y * Y + Z * Z);
- /* special cases for latitude and longitude */
- if (P / a < genau) {
- /* special case, if P=0. (X=0., Y=0.) */
- Longitude = 0.0;
- /* if (X,Y,Z)=(0.,0.,0.) then Height becomes semi-minor axis
- * of ellipsoid (=center of mass), Latitude becomes PI/2 */
- if (RR / a < genau) {
- Latitude = HALF_PI;
- Height = -b;
- return {
- x: p.x,
- y: p.y,
- z: p.z
- };
- }
- } else {
- /* ellipsoidal (geodetic) longitude
- * interval: -PI < Longitude <= +PI */
- Longitude = Math.atan2(Y, X);
- }
- /* --------------------------------------------------------------
- * Following iterative algorithm was developped by
- * "Institut for Erdmessung", University of Hannover, July 1988.
- * Internet: www.ife.uni-hannover.de
- * Iterative computation of CPHI,SPHI and Height.
- * Iteration of CPHI and SPHI to 10**-12 radian resp.
- * 2*10**-7 arcsec.
- * --------------------------------------------------------------
- */
- CT = Z / RR;
- ST = P / RR;
- RX = 1.0 / Math.sqrt(1.0 - es * (2.0 - es) * ST * ST);
- CPHI0 = ST * (1.0 - es) * RX;
- SPHI0 = CT * RX;
- iter = 0;
- /* loop to find sin(Latitude) resp. Latitude
- * until |sin(Latitude(iter)-Latitude(iter-1))| < genau */
- do {
- iter++;
- RN = a / Math.sqrt(1.0 - es * SPHI0 * SPHI0);
- /* ellipsoidal (geodetic) height */
- Height = P * CPHI0 + Z * SPHI0 - RN * (1.0 - es * SPHI0 * SPHI0);
- RK = es * RN / (RN + Height);
- RX = 1.0 / Math.sqrt(1.0 - RK * (2.0 - RK) * ST * ST);
- CPHI = ST * (1.0 - RK) * RX;
- SPHI = CT * RX;
- SDPHI = SPHI * CPHI0 - CPHI * SPHI0;
- CPHI0 = CPHI;
- SPHI0 = SPHI;
- }
- while (SDPHI * SDPHI > genau2 && iter < maxiter);
- /* ellipsoidal (geodetic) latitude */
- Latitude = Math.atan(SPHI / Math.abs(CPHI));
- return {
- x: Longitude,
- y: Latitude,
- z: Height
- };
- } // cs_geocentric_to_geodetic()
- /****************************************************************/
- // pj_geocentic_to_wgs84( p )
- // p = point to transform in geocentric coordinates (x,y,z)
- /** point object, nothing fancy, just allows values to be
- passed back and forth by reference rather than by value.
- Other point classes may be used as long as they have
- x and y properties, which will get modified in the transform method.
- */
- function geocentricToWgs84(p, datum_type, datum_params) {
- if (datum_type === PJD_3PARAM) {
- // if( x[io] === HUGE_VAL )
- // continue;
- return {
- x: p.x + datum_params[0],
- y: p.y + datum_params[1],
- z: p.z + datum_params[2],
- };
- } else if (datum_type === PJD_7PARAM) {
- var Dx_BF = datum_params[0];
- var Dy_BF = datum_params[1];
- var Dz_BF = datum_params[2];
- var Rx_BF = datum_params[3];
- var Ry_BF = datum_params[4];
- var Rz_BF = datum_params[5];
- var M_BF = datum_params[6];
- // if( x[io] === HUGE_VAL )
- // continue;
- return {
- x: M_BF * (p.x - Rz_BF * p.y + Ry_BF * p.z) + Dx_BF,
- y: M_BF * (Rz_BF * p.x + p.y - Rx_BF * p.z) + Dy_BF,
- z: M_BF * (-Ry_BF * p.x + Rx_BF * p.y + p.z) + Dz_BF
- };
- }
- } // cs_geocentric_to_wgs84
- /****************************************************************/
- // pj_geocentic_from_wgs84()
- // coordinate system definition,
- // point to transform in geocentric coordinates (x,y,z)
- function geocentricFromWgs84(p, datum_type, datum_params) {
- if (datum_type === PJD_3PARAM) {
- //if( x[io] === HUGE_VAL )
- // continue;
- return {
- x: p.x - datum_params[0],
- y: p.y - datum_params[1],
- z: p.z - datum_params[2],
- };
- } else if (datum_type === PJD_7PARAM) {
- var Dx_BF = datum_params[0];
- var Dy_BF = datum_params[1];
- var Dz_BF = datum_params[2];
- var Rx_BF = datum_params[3];
- var Ry_BF = datum_params[4];
- var Rz_BF = datum_params[5];
- var M_BF = datum_params[6];
- var x_tmp = (p.x - Dx_BF) / M_BF;
- var y_tmp = (p.y - Dy_BF) / M_BF;
- var z_tmp = (p.z - Dz_BF) / M_BF;
- //if( x[io] === HUGE_VAL )
- // continue;
- return {
- x: x_tmp + Rz_BF * y_tmp - Ry_BF * z_tmp,
- y: -Rz_BF * x_tmp + y_tmp + Rx_BF * z_tmp,
- z: Ry_BF * x_tmp - Rx_BF * y_tmp + z_tmp
- };
- } //cs_geocentric_from_wgs84()
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/datum_transform.js
- function checkParams(type) {
- return (type === PJD_3PARAM || type === PJD_7PARAM);
- }
- /* harmony default export */ function datum_transform(source, dest, point) {
- // Short cut if the datums are identical.
- if (compareDatums(source, dest)) {
- return point; // in this case, zero is sucess,
- // whereas cs_compare_datums returns 1 to indicate TRUE
- // confusing, should fix this
- }
- // Explicitly skip datum transform by setting 'datum=none' as parameter for either source or dest
- if (source.datum_type === PJD_NODATUM || dest.datum_type === PJD_NODATUM) {
- return point;
- }
- // If this datum requires grid shifts, then apply it to geodetic coordinates.
- var source_a = source.a;
- var source_es = source.es;
- if (source.datum_type === PJD_GRIDSHIFT) {
- var gridShiftCode = applyGridShift(source, false, point);
- if (gridShiftCode !== 0) {
- return undefined;
- }
- source_a = SRS_WGS84_SEMIMAJOR;
- source_es = SRS_WGS84_ESQUARED;
- }
- var dest_a = dest.a;
- var dest_b = dest.b;
- var dest_es = dest.es;
- if (dest.datum_type === PJD_GRIDSHIFT) {
- dest_a = SRS_WGS84_SEMIMAJOR;
- dest_b = SRS_WGS84_SEMIMINOR;
- dest_es = SRS_WGS84_ESQUARED;
- }
- // Do we need to go through geocentric coordinates?
- if (source_es === dest_es && source_a === dest_a && !checkParams(source.datum_type) && !checkParams(dest.datum_type)) {
- return point;
- }
- // Convert to geocentric coordinates.
- point = geodeticToGeocentric(point, source_es, source_a);
- // Convert between datums
- if (checkParams(source.datum_type)) {
- point = geocentricToWgs84(point, source.datum_type, source.datum_params);
- }
- if (checkParams(dest.datum_type)) {
- point = geocentricFromWgs84(point, dest.datum_type, dest.datum_params);
- }
- point = geocentricToGeodetic(point, dest_es, dest_a, dest_b);
- if (dest.datum_type === PJD_GRIDSHIFT) {
- var destGridShiftResult = applyGridShift(dest, true, point);
- if (destGridShiftResult !== 0) {
- return undefined;
- }
- }
- return point;
- }
- function applyGridShift(source, inverse, point) {
- if (source.grids === null || source.grids.length === 0) {
- console.log('Grid shift grids not found');
- return -1;
- }
- var input = {x: -point.x, y: point.y};
- var output = {x: Number.NaN, y: Number.NaN};
- var onlyMandatoryGrids = false;
- var attemptedGrids = [];
- for (var i = 0; i < source.grids.length; i++) {
- var grid = source.grids[i];
- attemptedGrids.push(grid.name);
- if (grid.isNull) {
- output = input;
- break;
- }
- onlyMandatoryGrids = grid.mandatory;
- if (grid.grid === null) {
- if (grid.mandatory) {
- console.log("Unable to find mandatory grid '" + grid.name + "'");
- return -1;
- }
- continue;
- }
- var subgrid = grid.grid.subgrids[0];
- // skip tables that don't match our point at all
- var epsilon = (Math.abs(subgrid.del[1]) + Math.abs(subgrid.del[0])) / 10000.0;
- var minX = subgrid.ll[0] - epsilon;
- var minY = subgrid.ll[1] - epsilon;
- var maxX = subgrid.ll[0] + (subgrid.lim[0] - 1) * subgrid.del[0] + epsilon;
- var maxY = subgrid.ll[1] + (subgrid.lim[1] - 1) * subgrid.del[1] + epsilon;
- if (minY > input.y || minX > input.x || maxY < input.y || maxX < input.x ) {
- continue;
- }
- output = applySubgridShift(input, inverse, subgrid);
- if (!isNaN(output.x)) {
- break;
- }
- }
- if (isNaN(output.x)) {
- console.log("Failed to find a grid shift table for location '"+
- -input.x * R2D + " " + input.y * R2D + " tried: '" + attemptedGrids + "'");
- return -1;
- }
- point.x = -output.x;
- point.y = output.y;
- return 0;
- }
- function applySubgridShift(pin, inverse, ct) {
- var val = {x: Number.NaN, y: Number.NaN};
- if (isNaN(pin.x)) { return val; }
- var tb = {x: pin.x, y: pin.y};
- tb.x -= ct.ll[0];
- tb.y -= ct.ll[1];
- tb.x = adjust_lon(tb.x - Math.PI) + Math.PI;
- var t = nadInterpolate(tb, ct);
- if (inverse) {
- if (isNaN(t.x)) {
- return val;
- }
- t.x = tb.x - t.x;
- t.y = tb.y - t.y;
- var i = 9, tol = 1e-12;
- var dif, del;
- do {
- del = nadInterpolate(t, ct);
- if (isNaN(del.x)) {
- console.log("Inverse grid shift iteration failed, presumably at grid edge. Using first approximation.");
- break;
- }
- dif = {x: tb.x - (del.x + t.x), y: tb.y - (del.y + t.y)};
- t.x += dif.x;
- t.y += dif.y;
- } while (i-- && Math.abs(dif.x) > tol && Math.abs(dif.y) > tol);
- if (i < 0) {
- console.log("Inverse grid shift iterator failed to converge.");
- return val;
- }
- val.x = adjust_lon(t.x + ct.ll[0]);
- val.y = t.y + ct.ll[1];
- } else {
- if (!isNaN(t.x)) {
- val.x = pin.x + t.x;
- val.y = pin.y + t.y;
- }
- }
- return val;
- }
- function nadInterpolate(pin, ct) {
- var t = {x: pin.x / ct.del[0], y: pin.y / ct.del[1]};
- var indx = {x: Math.floor(t.x), y: Math.floor(t.y)};
- var frct = {x: t.x - 1.0 * indx.x, y: t.y - 1.0 * indx.y};
- var val= {x: Number.NaN, y: Number.NaN};
- var inx;
- if (indx.x < 0 || indx.x >= ct.lim[0]) {
- return val;
- }
- if (indx.y < 0 || indx.y >= ct.lim[1]) {
- return val;
- }
- inx = (indx.y * ct.lim[0]) + indx.x;
- var f00 = {x: ct.cvs[inx][0], y: ct.cvs[inx][1]};
- inx++;
- var f10= {x: ct.cvs[inx][0], y: ct.cvs[inx][1]};
- inx += ct.lim[0];
- var f11 = {x: ct.cvs[inx][0], y: ct.cvs[inx][1]};
- inx--;
- var f01 = {x: ct.cvs[inx][0], y: ct.cvs[inx][1]};
- var m11 = frct.x * frct.y, m10 = frct.x * (1.0 - frct.y),
- m00 = (1.0 - frct.x) * (1.0 - frct.y), m01 = (1.0 - frct.x) * frct.y;
- val.x = (m00 * f00.x + m10 * f10.x + m01 * f01.x + m11 * f11.x);
- val.y = (m00 * f00.y + m10 * f10.y + m01 * f01.y + m11 * f11.y);
- return val;
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/adjust_axis.js
- /* harmony default export */ function adjust_axis(crs, denorm, point) {
- var xin = point.x,
- yin = point.y,
- zin = point.z || 0.0;
- var v, t, i;
- var out = {};
- for (i = 0; i < 3; i++) {
- if (denorm && i === 2 && point.z === undefined) {
- continue;
- }
- if (i === 0) {
- v = xin;
- if ("ew".indexOf(crs.axis[i]) !== -1) {
- t = 'x';
- } else {
- t = 'y';
- }
- }
- else if (i === 1) {
- v = yin;
- if ("ns".indexOf(crs.axis[i]) !== -1) {
- t = 'y';
- } else {
- t = 'x';
- }
- }
- else {
- v = zin;
- t = 'z';
- }
- switch (crs.axis[i]) {
- case 'e':
- out[t] = v;
- break;
- case 'w':
- out[t] = -v;
- break;
- case 'n':
- out[t] = v;
- break;
- case 's':
- out[t] = -v;
- break;
- case 'u':
- if (point[t] !== undefined) {
- out.z = v;
- }
- break;
- case 'd':
- if (point[t] !== undefined) {
- out.z = -v;
- }
- break;
- default:
- //console.log("ERROR: unknow axis ("+crs.axis[i]+") - check definition of "+crs.projName);
- return null;
- }
- }
- return out;
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/toPoint.js
- /* harmony default export */ function toPoint(array){
- var out = {
- x: array[0],
- y: array[1]
- };
- if (array.length>2) {
- out.z = array[2];
- }
- if (array.length>3) {
- out.m = array[3];
- }
- return out;
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/checkSanity.js
- /* harmony default export */ function checkSanity(point) {
- checkCoord(point.x);
- checkCoord(point.y);
- }
- function checkCoord(num) {
- if (typeof Number.isFinite === 'function') {
- if (Number.isFinite(num)) {
- return;
- }
- throw new TypeError('coordinates must be finite numbers');
- }
- if (typeof num !== 'number' || num !== num || !isFinite(num)) {
- throw new TypeError('coordinates must be finite numbers');
- }
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/transform.js
- function checkNotWGS(source, dest) {
- return ((source.datum.datum_type === PJD_3PARAM || source.datum.datum_type === PJD_7PARAM) && dest.datumCode !== 'WGS84') || ((dest.datum.datum_type === PJD_3PARAM || dest.datum.datum_type === PJD_7PARAM) && source.datumCode !== 'WGS84');
- }
- function transform(source, dest, point, enforceAxis) {
- var wgs84;
- if (Array.isArray(point)) {
- point = toPoint(point);
- }
- checkSanity(point);
- // Workaround for datum shifts towgs84, if either source or destination projection is not wgs84
- if (source.datum && dest.datum && checkNotWGS(source, dest)) {
- wgs84 = new Proj('WGS84');
- point = transform(source, wgs84, point, enforceAxis);
- source = wgs84;
- }
- // DGR, 2010/11/12
- if (enforceAxis && source.axis !== 'enu') {
- point = adjust_axis(source, false, point);
- }
- // Transform source points to long/lat, if they aren't already.
- if (source.projName === 'longlat') {
- point = {
- x: point.x * D2R,
- y: point.y * D2R,
- z: point.z || 0
- };
- } else {
- if (source.to_meter) {
- point = {
- x: point.x * source.to_meter,
- y: point.y * source.to_meter,
- z: point.z || 0
- };
- }
- point = source.inverse(point); // Convert Cartesian to longlat
- if (!point) {
- return;
- }
- }
- // Adjust for the prime meridian if necessary
- if (source.from_greenwich) {
- point.x += source.from_greenwich;
- }
- // Convert datums if needed, and if possible.
- point = datum_transform(source.datum, dest.datum, point);
- if (!point) {
- return;
- }
- // Adjust for the prime meridian if necessary
- if (dest.from_greenwich) {
- point = {
- x: point.x - dest.from_greenwich,
- y: point.y,
- z: point.z || 0
- };
- }
- if (dest.projName === 'longlat') {
- // convert radians to decimal degrees
- point = {
- x: point.x * R2D,
- y: point.y * R2D,
- z: point.z || 0
- };
- } else { // else project
- point = dest.forward(point);
- if (dest.to_meter) {
- point = {
- x: point.x / dest.to_meter,
- y: point.y / dest.to_meter,
- z: point.z || 0
- };
- }
- }
- // DGR, 2010/11/12
- if (enforceAxis && dest.axis !== 'enu') {
- return adjust_axis(dest, true, point);
- }
- return point;
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/core.js
- var wgs84 = Proj('WGS84');
- function transformer(from, to, coords, enforceAxis) {
- var transformedArray, out, keys;
- if (Array.isArray(coords)) {
- transformedArray = transform(from, to, coords, enforceAxis) || {x: NaN, y: NaN};
- if (coords.length > 2) {
- if ((typeof from.name !== 'undefined' && from.name === 'geocent') || (typeof to.name !== 'undefined' && to.name === 'geocent')) {
- if (typeof transformedArray.z === 'number') {
- return [transformedArray.x, transformedArray.y, transformedArray.z].concat(coords.splice(3));
- } else {
- return [transformedArray.x, transformedArray.y, coords[2]].concat(coords.splice(3));
- }
- } else {
- return [transformedArray.x, transformedArray.y].concat(coords.splice(2));
- }
- } else {
- return [transformedArray.x, transformedArray.y];
- }
- } else {
- out = transform(from, to, coords, enforceAxis);
- keys = Object.keys(coords);
- if (keys.length === 2) {
- return out;
- }
- keys.forEach(function (key) {
- if ((typeof from.name !== 'undefined' && from.name === 'geocent') || (typeof to.name !== 'undefined' && to.name === 'geocent')) {
- if (key === 'x' || key === 'y' || key === 'z') {
- return;
- }
- } else {
- if (key === 'x' || key === 'y') {
- return;
- }
- }
- out[key] = coords[key];
- });
- return out;
- }
- }
- function checkProj(item) {
- if (item instanceof Proj) {
- return item;
- }
- if (item.oProj) {
- return item.oProj;
- }
- return Proj(item);
- }
- function proj4(fromProj, toProj, coord) {
- fromProj = checkProj(fromProj);
- var single = false;
- var obj;
- if (typeof toProj === 'undefined') {
- toProj = fromProj;
- fromProj = wgs84;
- single = true;
- } else if (typeof toProj.x !== 'undefined' || Array.isArray(toProj)) {
- coord = toProj;
- toProj = fromProj;
- fromProj = wgs84;
- single = true;
- }
- toProj = checkProj(toProj);
- if (coord) {
- return transformer(fromProj, toProj, coord);
- } else {
- obj = {
- forward: function (coords, enforceAxis) {
- return transformer(fromProj, toProj, coords, enforceAxis);
- },
- inverse: function (coords, enforceAxis) {
- return transformer(toProj, fromProj, coords, enforceAxis);
- }
- };
- if (single) {
- obj.oProj = toProj;
- }
- return obj;
- }
- }
- /* harmony default export */ const core = (proj4);
- ;// CONCATENATED MODULE: ./node_modules/mgrs/mgrs.js
- /**
- * UTM zones are grouped, and assigned to one of a group of 6
- * sets.
- *
- * {int} @private
- */
- var NUM_100K_SETS = 6;
- /**
- * The column letters (for easting) of the lower left value, per
- * set.
- *
- * {string} @private
- */
- var SET_ORIGIN_COLUMN_LETTERS = 'AJSAJS';
- /**
- * The row letters (for northing) of the lower left value, per
- * set.
- *
- * {string} @private
- */
- var SET_ORIGIN_ROW_LETTERS = 'AFAFAF';
- var A = 65; // A
- var I = 73; // I
- var O = 79; // O
- var V = 86; // V
- var Z = 90; // Z
- /* harmony default export */ const mgrs = ({
- forward: mgrs_forward,
- inverse: mgrs_inverse,
- toPoint: mgrs_toPoint
- });
- /**
- * Conversion of lat/lon to MGRS.
- *
- * @param {object} ll Object literal with lat and lon properties on a
- * WGS84 ellipsoid.
- * @param {int} accuracy Accuracy in digits (5 for 1 m, 4 for 10 m, 3 for
- * 100 m, 2 for 1000 m or 1 for 10000 m). Optional, default is 5.
- * @return {string} the MGRS string for the given location and accuracy.
- */
- function mgrs_forward(ll, accuracy) {
- accuracy = accuracy || 5; // default accuracy 1m
- return encode(LLtoUTM({
- lat: ll[1],
- lon: ll[0]
- }), accuracy);
- };
- /**
- * Conversion of MGRS to lat/lon.
- *
- * @param {string} mgrs MGRS string.
- * @return {array} An array with left (longitude), bottom (latitude), right
- * (longitude) and top (latitude) values in WGS84, representing the
- * bounding box for the provided MGRS reference.
- */
- function mgrs_inverse(mgrs) {
- var bbox = UTMtoLL(decode(mgrs.toUpperCase()));
- if (bbox.lat && bbox.lon) {
- return [bbox.lon, bbox.lat, bbox.lon, bbox.lat];
- }
- return [bbox.left, bbox.bottom, bbox.right, bbox.top];
- };
- function mgrs_toPoint(mgrs) {
- var bbox = UTMtoLL(decode(mgrs.toUpperCase()));
- if (bbox.lat && bbox.lon) {
- return [bbox.lon, bbox.lat];
- }
- return [(bbox.left + bbox.right) / 2, (bbox.top + bbox.bottom) / 2];
- };
- /**
- * Conversion from degrees to radians.
- *
- * @private
- * @param {number} deg the angle in degrees.
- * @return {number} the angle in radians.
- */
- function degToRad(deg) {
- return (deg * (Math.PI / 180.0));
- }
- /**
- * Conversion from radians to degrees.
- *
- * @private
- * @param {number} rad the angle in radians.
- * @return {number} the angle in degrees.
- */
- function radToDeg(rad) {
- return (180.0 * (rad / Math.PI));
- }
- /**
- * Converts a set of Longitude and Latitude co-ordinates to UTM
- * using the WGS84 ellipsoid.
- *
- * @private
- * @param {object} ll Object literal with lat and lon properties
- * representing the WGS84 coordinate to be converted.
- * @return {object} Object literal containing the UTM value with easting,
- * northing, zoneNumber and zoneLetter properties, and an optional
- * accuracy property in digits. Returns null if the conversion failed.
- */
- function LLtoUTM(ll) {
- var Lat = ll.lat;
- var Long = ll.lon;
- var a = 6378137.0; //ellip.radius;
- var eccSquared = 0.00669438; //ellip.eccsq;
- var k0 = 0.9996;
- var LongOrigin;
- var eccPrimeSquared;
- var N, T, C, A, M;
- var LatRad = degToRad(Lat);
- var LongRad = degToRad(Long);
- var LongOriginRad;
- var ZoneNumber;
- // (int)
- ZoneNumber = Math.floor((Long + 180) / 6) + 1;
- //Make sure the longitude 180.00 is in Zone 60
- if (Long === 180) {
- ZoneNumber = 60;
- }
- // Special zone for Norway
- if (Lat >= 56.0 && Lat < 64.0 && Long >= 3.0 && Long < 12.0) {
- ZoneNumber = 32;
- }
- // Special zones for Svalbard
- if (Lat >= 72.0 && Lat < 84.0) {
- if (Long >= 0.0 && Long < 9.0) {
- ZoneNumber = 31;
- }
- else if (Long >= 9.0 && Long < 21.0) {
- ZoneNumber = 33;
- }
- else if (Long >= 21.0 && Long < 33.0) {
- ZoneNumber = 35;
- }
- else if (Long >= 33.0 && Long < 42.0) {
- ZoneNumber = 37;
- }
- }
- LongOrigin = (ZoneNumber - 1) * 6 - 180 + 3; //+3 puts origin
- // in middle of
- // zone
- LongOriginRad = degToRad(LongOrigin);
- eccPrimeSquared = (eccSquared) / (1 - eccSquared);
- N = a / Math.sqrt(1 - eccSquared * Math.sin(LatRad) * Math.sin(LatRad));
- T = Math.tan(LatRad) * Math.tan(LatRad);
- C = eccPrimeSquared * Math.cos(LatRad) * Math.cos(LatRad);
- A = Math.cos(LatRad) * (LongRad - LongOriginRad);
- M = a * ((1 - eccSquared / 4 - 3 * eccSquared * eccSquared / 64 - 5 * eccSquared * eccSquared * eccSquared / 256) * LatRad - (3 * eccSquared / 8 + 3 * eccSquared * eccSquared / 32 + 45 * eccSquared * eccSquared * eccSquared / 1024) * Math.sin(2 * LatRad) + (15 * eccSquared * eccSquared / 256 + 45 * eccSquared * eccSquared * eccSquared / 1024) * Math.sin(4 * LatRad) - (35 * eccSquared * eccSquared * eccSquared / 3072) * Math.sin(6 * LatRad));
- var UTMEasting = (k0 * N * (A + (1 - T + C) * A * A * A / 6.0 + (5 - 18 * T + T * T + 72 * C - 58 * eccPrimeSquared) * A * A * A * A * A / 120.0) + 500000.0);
- var UTMNorthing = (k0 * (M + N * Math.tan(LatRad) * (A * A / 2 + (5 - T + 9 * C + 4 * C * C) * A * A * A * A / 24.0 + (61 - 58 * T + T * T + 600 * C - 330 * eccPrimeSquared) * A * A * A * A * A * A / 720.0)));
- if (Lat < 0.0) {
- UTMNorthing += 10000000.0; //10000000 meter offset for
- // southern hemisphere
- }
- return {
- northing: Math.round(UTMNorthing),
- easting: Math.round(UTMEasting),
- zoneNumber: ZoneNumber,
- zoneLetter: getLetterDesignator(Lat)
- };
- }
- /**
- * Converts UTM coords to lat/long, using the WGS84 ellipsoid. This is a convenience
- * class where the Zone can be specified as a single string eg."60N" which
- * is then broken down into the ZoneNumber and ZoneLetter.
- *
- * @private
- * @param {object} utm An object literal with northing, easting, zoneNumber
- * and zoneLetter properties. If an optional accuracy property is
- * provided (in meters), a bounding box will be returned instead of
- * latitude and longitude.
- * @return {object} An object literal containing either lat and lon values
- * (if no accuracy was provided), or top, right, bottom and left values
- * for the bounding box calculated according to the provided accuracy.
- * Returns null if the conversion failed.
- */
- function UTMtoLL(utm) {
- var UTMNorthing = utm.northing;
- var UTMEasting = utm.easting;
- var zoneLetter = utm.zoneLetter;
- var zoneNumber = utm.zoneNumber;
- // check the ZoneNummber is valid
- if (zoneNumber < 0 || zoneNumber > 60) {
- return null;
- }
- var k0 = 0.9996;
- var a = 6378137.0; //ellip.radius;
- var eccSquared = 0.00669438; //ellip.eccsq;
- var eccPrimeSquared;
- var e1 = (1 - Math.sqrt(1 - eccSquared)) / (1 + Math.sqrt(1 - eccSquared));
- var N1, T1, C1, R1, D, M;
- var LongOrigin;
- var mu, phi1Rad;
- // remove 500,000 meter offset for longitude
- var x = UTMEasting - 500000.0;
- var y = UTMNorthing;
- // We must know somehow if we are in the Northern or Southern
- // hemisphere, this is the only time we use the letter So even
- // if the Zone letter isn't exactly correct it should indicate
- // the hemisphere correctly
- if (zoneLetter < 'N') {
- y -= 10000000.0; // remove 10,000,000 meter offset used
- // for southern hemisphere
- }
- // There are 60 zones with zone 1 being at West -180 to -174
- LongOrigin = (zoneNumber - 1) * 6 - 180 + 3; // +3 puts origin
- // in middle of
- // zone
- eccPrimeSquared = (eccSquared) / (1 - eccSquared);
- M = y / k0;
- mu = M / (a * (1 - eccSquared / 4 - 3 * eccSquared * eccSquared / 64 - 5 * eccSquared * eccSquared * eccSquared / 256));
- phi1Rad = mu + (3 * e1 / 2 - 27 * e1 * e1 * e1 / 32) * Math.sin(2 * mu) + (21 * e1 * e1 / 16 - 55 * e1 * e1 * e1 * e1 / 32) * Math.sin(4 * mu) + (151 * e1 * e1 * e1 / 96) * Math.sin(6 * mu);
- // double phi1 = ProjMath.radToDeg(phi1Rad);
- N1 = a / Math.sqrt(1 - eccSquared * Math.sin(phi1Rad) * Math.sin(phi1Rad));
- T1 = Math.tan(phi1Rad) * Math.tan(phi1Rad);
- C1 = eccPrimeSquared * Math.cos(phi1Rad) * Math.cos(phi1Rad);
- R1 = a * (1 - eccSquared) / Math.pow(1 - eccSquared * Math.sin(phi1Rad) * Math.sin(phi1Rad), 1.5);
- D = x / (N1 * k0);
- var lat = phi1Rad - (N1 * Math.tan(phi1Rad) / R1) * (D * D / 2 - (5 + 3 * T1 + 10 * C1 - 4 * C1 * C1 - 9 * eccPrimeSquared) * D * D * D * D / 24 + (61 + 90 * T1 + 298 * C1 + 45 * T1 * T1 - 252 * eccPrimeSquared - 3 * C1 * C1) * D * D * D * D * D * D / 720);
- lat = radToDeg(lat);
- var lon = (D - (1 + 2 * T1 + C1) * D * D * D / 6 + (5 - 2 * C1 + 28 * T1 - 3 * C1 * C1 + 8 * eccPrimeSquared + 24 * T1 * T1) * D * D * D * D * D / 120) / Math.cos(phi1Rad);
- lon = LongOrigin + radToDeg(lon);
- var result;
- if (utm.accuracy) {
- var topRight = UTMtoLL({
- northing: utm.northing + utm.accuracy,
- easting: utm.easting + utm.accuracy,
- zoneLetter: utm.zoneLetter,
- zoneNumber: utm.zoneNumber
- });
- result = {
- top: topRight.lat,
- right: topRight.lon,
- bottom: lat,
- left: lon
- };
- }
- else {
- result = {
- lat: lat,
- lon: lon
- };
- }
- return result;
- }
- /**
- * Calculates the MGRS letter designator for the given latitude.
- *
- * @private
- * @param {number} lat The latitude in WGS84 to get the letter designator
- * for.
- * @return {char} The letter designator.
- */
- function getLetterDesignator(lat) {
- //This is here as an error flag to show that the Latitude is
- //outside MGRS limits
- var LetterDesignator = 'Z';
- if ((84 >= lat) && (lat >= 72)) {
- LetterDesignator = 'X';
- }
- else if ((72 > lat) && (lat >= 64)) {
- LetterDesignator = 'W';
- }
- else if ((64 > lat) && (lat >= 56)) {
- LetterDesignator = 'V';
- }
- else if ((56 > lat) && (lat >= 48)) {
- LetterDesignator = 'U';
- }
- else if ((48 > lat) && (lat >= 40)) {
- LetterDesignator = 'T';
- }
- else if ((40 > lat) && (lat >= 32)) {
- LetterDesignator = 'S';
- }
- else if ((32 > lat) && (lat >= 24)) {
- LetterDesignator = 'R';
- }
- else if ((24 > lat) && (lat >= 16)) {
- LetterDesignator = 'Q';
- }
- else if ((16 > lat) && (lat >= 8)) {
- LetterDesignator = 'P';
- }
- else if ((8 > lat) && (lat >= 0)) {
- LetterDesignator = 'N';
- }
- else if ((0 > lat) && (lat >= -8)) {
- LetterDesignator = 'M';
- }
- else if ((-8 > lat) && (lat >= -16)) {
- LetterDesignator = 'L';
- }
- else if ((-16 > lat) && (lat >= -24)) {
- LetterDesignator = 'K';
- }
- else if ((-24 > lat) && (lat >= -32)) {
- LetterDesignator = 'J';
- }
- else if ((-32 > lat) && (lat >= -40)) {
- LetterDesignator = 'H';
- }
- else if ((-40 > lat) && (lat >= -48)) {
- LetterDesignator = 'G';
- }
- else if ((-48 > lat) && (lat >= -56)) {
- LetterDesignator = 'F';
- }
- else if ((-56 > lat) && (lat >= -64)) {
- LetterDesignator = 'E';
- }
- else if ((-64 > lat) && (lat >= -72)) {
- LetterDesignator = 'D';
- }
- else if ((-72 > lat) && (lat >= -80)) {
- LetterDesignator = 'C';
- }
- return LetterDesignator;
- }
- /**
- * Encodes a UTM location as MGRS string.
- *
- * @private
- * @param {object} utm An object literal with easting, northing,
- * zoneLetter, zoneNumber
- * @param {number} accuracy Accuracy in digits (1-5).
- * @return {string} MGRS string for the given UTM location.
- */
- function encode(utm, accuracy) {
- // prepend with leading zeroes
- var seasting = "00000" + utm.easting,
- snorthing = "00000" + utm.northing;
- return utm.zoneNumber + utm.zoneLetter + get100kID(utm.easting, utm.northing, utm.zoneNumber) + seasting.substr(seasting.length - 5, accuracy) + snorthing.substr(snorthing.length - 5, accuracy);
- }
- /**
- * Get the two letter 100k designator for a given UTM easting,
- * northing and zone number value.
- *
- * @private
- * @param {number} easting
- * @param {number} northing
- * @param {number} zoneNumber
- * @return the two letter 100k designator for the given UTM location.
- */
- function get100kID(easting, northing, zoneNumber) {
- var setParm = get100kSetForZone(zoneNumber);
- var setColumn = Math.floor(easting / 100000);
- var setRow = Math.floor(northing / 100000) % 20;
- return getLetter100kID(setColumn, setRow, setParm);
- }
- /**
- * Given a UTM zone number, figure out the MGRS 100K set it is in.
- *
- * @private
- * @param {number} i An UTM zone number.
- * @return {number} the 100k set the UTM zone is in.
- */
- function get100kSetForZone(i) {
- var setParm = i % NUM_100K_SETS;
- if (setParm === 0) {
- setParm = NUM_100K_SETS;
- }
- return setParm;
- }
- /**
- * Get the two-letter MGRS 100k designator given information
- * translated from the UTM northing, easting and zone number.
- *
- * @private
- * @param {number} column the column index as it relates to the MGRS
- * 100k set spreadsheet, created from the UTM easting.
- * Values are 1-8.
- * @param {number} row the row index as it relates to the MGRS 100k set
- * spreadsheet, created from the UTM northing value. Values
- * are from 0-19.
- * @param {number} parm the set block, as it relates to the MGRS 100k set
- * spreadsheet, created from the UTM zone. Values are from
- * 1-60.
- * @return two letter MGRS 100k code.
- */
- function getLetter100kID(column, row, parm) {
- // colOrigin and rowOrigin are the letters at the origin of the set
- var index = parm - 1;
- var colOrigin = SET_ORIGIN_COLUMN_LETTERS.charCodeAt(index);
- var rowOrigin = SET_ORIGIN_ROW_LETTERS.charCodeAt(index);
- // colInt and rowInt are the letters to build to return
- var colInt = colOrigin + column - 1;
- var rowInt = rowOrigin + row;
- var rollover = false;
- if (colInt > Z) {
- colInt = colInt - Z + A - 1;
- rollover = true;
- }
- if (colInt === I || (colOrigin < I && colInt > I) || ((colInt > I || colOrigin < I) && rollover)) {
- colInt++;
- }
- if (colInt === O || (colOrigin < O && colInt > O) || ((colInt > O || colOrigin < O) && rollover)) {
- colInt++;
- if (colInt === I) {
- colInt++;
- }
- }
- if (colInt > Z) {
- colInt = colInt - Z + A - 1;
- }
- if (rowInt > V) {
- rowInt = rowInt - V + A - 1;
- rollover = true;
- }
- else {
- rollover = false;
- }
- if (((rowInt === I) || ((rowOrigin < I) && (rowInt > I))) || (((rowInt > I) || (rowOrigin < I)) && rollover)) {
- rowInt++;
- }
- if (((rowInt === O) || ((rowOrigin < O) && (rowInt > O))) || (((rowInt > O) || (rowOrigin < O)) && rollover)) {
- rowInt++;
- if (rowInt === I) {
- rowInt++;
- }
- }
- if (rowInt > V) {
- rowInt = rowInt - V + A - 1;
- }
- var twoLetter = String.fromCharCode(colInt) + String.fromCharCode(rowInt);
- return twoLetter;
- }
- /**
- * Decode the UTM parameters from a MGRS string.
- *
- * @private
- * @param {string} mgrsString an UPPERCASE coordinate string is expected.
- * @return {object} An object literal with easting, northing, zoneLetter,
- * zoneNumber and accuracy (in meters) properties.
- */
- function decode(mgrsString) {
- if (mgrsString && mgrsString.length === 0) {
- throw ("MGRSPoint coverting from nothing");
- }
- var length = mgrsString.length;
- var hunK = null;
- var sb = "";
- var testChar;
- var i = 0;
- // get Zone number
- while (!(/[A-Z]/).test(testChar = mgrsString.charAt(i))) {
- if (i >= 2) {
- throw ("MGRSPoint bad conversion from: " + mgrsString);
- }
- sb += testChar;
- i++;
- }
- var zoneNumber = parseInt(sb, 10);
- if (i === 0 || i + 3 > length) {
- // A good MGRS string has to be 4-5 digits long,
- // ##AAA/#AAA at least.
- throw ("MGRSPoint bad conversion from: " + mgrsString);
- }
- var zoneLetter = mgrsString.charAt(i++);
- // Should we check the zone letter here? Why not.
- if (zoneLetter <= 'A' || zoneLetter === 'B' || zoneLetter === 'Y' || zoneLetter >= 'Z' || zoneLetter === 'I' || zoneLetter === 'O') {
- throw ("MGRSPoint zone letter " + zoneLetter + " not handled: " + mgrsString);
- }
- hunK = mgrsString.substring(i, i += 2);
- var set = get100kSetForZone(zoneNumber);
- var east100k = getEastingFromChar(hunK.charAt(0), set);
- var north100k = getNorthingFromChar(hunK.charAt(1), set);
- // We have a bug where the northing may be 2000000 too low.
- // How
- // do we know when to roll over?
- while (north100k < getMinNorthing(zoneLetter)) {
- north100k += 2000000;
- }
- // calculate the char index for easting/northing separator
- var remainder = length - i;
- if (remainder % 2 !== 0) {
- throw ("MGRSPoint has to have an even number \nof digits after the zone letter and two 100km letters - front \nhalf for easting meters, second half for \nnorthing meters" + mgrsString);
- }
- var sep = remainder / 2;
- var sepEasting = 0.0;
- var sepNorthing = 0.0;
- var accuracyBonus, sepEastingString, sepNorthingString, easting, northing;
- if (sep > 0) {
- accuracyBonus = 100000.0 / Math.pow(10, sep);
- sepEastingString = mgrsString.substring(i, i + sep);
- sepEasting = parseFloat(sepEastingString) * accuracyBonus;
- sepNorthingString = mgrsString.substring(i + sep);
- sepNorthing = parseFloat(sepNorthingString) * accuracyBonus;
- }
- easting = sepEasting + east100k;
- northing = sepNorthing + north100k;
- return {
- easting: easting,
- northing: northing,
- zoneLetter: zoneLetter,
- zoneNumber: zoneNumber,
- accuracy: accuracyBonus
- };
- }
- /**
- * Given the first letter from a two-letter MGRS 100k zone, and given the
- * MGRS table set for the zone number, figure out the easting value that
- * should be added to the other, secondary easting value.
- *
- * @private
- * @param {char} e The first letter from a two-letter MGRS 100´k zone.
- * @param {number} set The MGRS table set for the zone number.
- * @return {number} The easting value for the given letter and set.
- */
- function getEastingFromChar(e, set) {
- // colOrigin is the letter at the origin of the set for the
- // column
- var curCol = SET_ORIGIN_COLUMN_LETTERS.charCodeAt(set - 1);
- var eastingValue = 100000.0;
- var rewindMarker = false;
- while (curCol !== e.charCodeAt(0)) {
- curCol++;
- if (curCol === I) {
- curCol++;
- }
- if (curCol === O) {
- curCol++;
- }
- if (curCol > Z) {
- if (rewindMarker) {
- throw ("Bad character: " + e);
- }
- curCol = A;
- rewindMarker = true;
- }
- eastingValue += 100000.0;
- }
- return eastingValue;
- }
- /**
- * Given the second letter from a two-letter MGRS 100k zone, and given the
- * MGRS table set for the zone number, figure out the northing value that
- * should be added to the other, secondary northing value. You have to
- * remember that Northings are determined from the equator, and the vertical
- * cycle of letters mean a 2000000 additional northing meters. This happens
- * approx. every 18 degrees of latitude. This method does *NOT* count any
- * additional northings. You have to figure out how many 2000000 meters need
- * to be added for the zone letter of the MGRS coordinate.
- *
- * @private
- * @param {char} n Second letter of the MGRS 100k zone
- * @param {number} set The MGRS table set number, which is dependent on the
- * UTM zone number.
- * @return {number} The northing value for the given letter and set.
- */
- function getNorthingFromChar(n, set) {
- if (n > 'V') {
- throw ("MGRSPoint given invalid Northing " + n);
- }
- // rowOrigin is the letter at the origin of the set for the
- // column
- var curRow = SET_ORIGIN_ROW_LETTERS.charCodeAt(set - 1);
- var northingValue = 0.0;
- var rewindMarker = false;
- while (curRow !== n.charCodeAt(0)) {
- curRow++;
- if (curRow === I) {
- curRow++;
- }
- if (curRow === O) {
- curRow++;
- }
- // fixing a bug making whole application hang in this loop
- // when 'n' is a wrong character
- if (curRow > V) {
- if (rewindMarker) { // making sure that this loop ends
- throw ("Bad character: " + n);
- }
- curRow = A;
- rewindMarker = true;
- }
- northingValue += 100000.0;
- }
- return northingValue;
- }
- /**
- * The function getMinNorthing returns the minimum northing value of a MGRS
- * zone.
- *
- * Ported from Geotrans' c Lattitude_Band_Value structure table.
- *
- * @private
- * @param {char} zoneLetter The MGRS zone to get the min northing for.
- * @return {number}
- */
- function getMinNorthing(zoneLetter) {
- var northing;
- switch (zoneLetter) {
- case 'C':
- northing = 1100000.0;
- break;
- case 'D':
- northing = 2000000.0;
- break;
- case 'E':
- northing = 2800000.0;
- break;
- case 'F':
- northing = 3700000.0;
- break;
- case 'G':
- northing = 4600000.0;
- break;
- case 'H':
- northing = 5500000.0;
- break;
- case 'J':
- northing = 6400000.0;
- break;
- case 'K':
- northing = 7300000.0;
- break;
- case 'L':
- northing = 8200000.0;
- break;
- case 'M':
- northing = 9100000.0;
- break;
- case 'N':
- northing = 0.0;
- break;
- case 'P':
- northing = 800000.0;
- break;
- case 'Q':
- northing = 1700000.0;
- break;
- case 'R':
- northing = 2600000.0;
- break;
- case 'S':
- northing = 3500000.0;
- break;
- case 'T':
- northing = 4400000.0;
- break;
- case 'U':
- northing = 5300000.0;
- break;
- case 'V':
- northing = 6200000.0;
- break;
- case 'W':
- northing = 7000000.0;
- break;
- case 'X':
- northing = 7900000.0;
- break;
- default:
- northing = -1.0;
- }
- if (northing >= 0.0) {
- return northing;
- }
- else {
- throw ("Invalid zone letter: " + zoneLetter);
- }
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/Point.js
- function lib_Point_Point(x, y, z) {
- if (!(this instanceof lib_Point_Point)) {
- return new lib_Point_Point(x, y, z);
- }
- if (Array.isArray(x)) {
- this.x = x[0];
- this.y = x[1];
- this.z = x[2] || 0.0;
- } else if(typeof x === 'object') {
- this.x = x.x;
- this.y = x.y;
- this.z = x.z || 0.0;
- } else if (typeof x === 'string' && typeof y === 'undefined') {
- var coords = x.split(',');
- this.x = parseFloat(coords[0], 10);
- this.y = parseFloat(coords[1], 10);
- this.z = parseFloat(coords[2], 10) || 0.0;
- } else {
- this.x = x;
- this.y = y;
- this.z = z || 0.0;
- }
- console.warn('proj4.Point will be removed in version 3, use proj4.toPoint');
- }
- lib_Point_Point.fromMGRS = function(mgrsStr) {
- return new lib_Point_Point(mgrs_toPoint(mgrsStr));
- };
- lib_Point_Point.prototype.toMGRS = function(accuracy) {
- return mgrs_forward([this.x, this.y], accuracy);
- };
- /* harmony default export */ const lib_Point = (lib_Point_Point);
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/pj_enfn.js
- var C00 = 1;
- var C02 = 0.25;
- var C04 = 0.046875;
- var C06 = 0.01953125;
- var C08 = 0.01068115234375;
- var C22 = 0.75;
- var C44 = 0.46875;
- var C46 = 0.01302083333333333333;
- var C48 = 0.00712076822916666666;
- var C66 = 0.36458333333333333333;
- var C68 = 0.00569661458333333333;
- var C88 = 0.3076171875;
- /* harmony default export */ function pj_enfn(es) {
- var en = [];
- en[0] = C00 - es * (C02 + es * (C04 + es * (C06 + es * C08)));
- en[1] = es * (C22 - es * (C04 + es * (C06 + es * C08)));
- var t = es * es;
- en[2] = t * (C44 - es * (C46 + es * C48));
- t *= es;
- en[3] = t * (C66 - es * C68);
- en[4] = t * es * C88;
- return en;
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/pj_mlfn.js
- /* harmony default export */ function pj_mlfn(phi, sphi, cphi, en) {
- cphi *= sphi;
- sphi *= sphi;
- return (en[0] * phi - cphi * (en[1] + sphi * (en[2] + sphi * (en[3] + sphi * en[4]))));
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/pj_inv_mlfn.js
- var MAX_ITER = 20;
- /* harmony default export */ function pj_inv_mlfn(arg, es, en) {
- var k = 1 / (1 - es);
- var phi = arg;
- for (var i = MAX_ITER; i; --i) { /* rarely goes over 2 iterations */
- var s = Math.sin(phi);
- var t = 1 - es * s * s;
- //t = this.pj_mlfn(phi, s, Math.cos(phi), en) - arg;
- //phi -= t * (t * Math.sqrt(t)) * k;
- t = (pj_mlfn(phi, s, Math.cos(phi), en) - arg) * (t * Math.sqrt(t)) * k;
- phi -= t;
- if (Math.abs(t) < EPSLN) {
- return phi;
- }
- }
- //..reportError("cass:pj_inv_mlfn: Convergence error");
- return phi;
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/tmerc.js
- // Heavily based on this tmerc projection implementation
- // https://github.com/mbloch/mapshaper-proj/blob/master/src/projections/tmerc.js
- function tmerc_init() {
- this.x0 = this.x0 !== undefined ? this.x0 : 0;
- this.y0 = this.y0 !== undefined ? this.y0 : 0;
- this.long0 = this.long0 !== undefined ? this.long0 : 0;
- this.lat0 = this.lat0 !== undefined ? this.lat0 : 0;
- if (this.es) {
- this.en = pj_enfn(this.es);
- this.ml0 = pj_mlfn(this.lat0, Math.sin(this.lat0), Math.cos(this.lat0), this.en);
- }
- }
- /**
- Transverse Mercator Forward - long/lat to x/y
- long/lat in radians
- */
- function tmerc_forward(p) {
- var lon = p.x;
- var lat = p.y;
- var delta_lon = adjust_lon(lon - this.long0);
- var con;
- var x, y;
- var sin_phi = Math.sin(lat);
- var cos_phi = Math.cos(lat);
- if (!this.es) {
- var b = cos_phi * Math.sin(delta_lon);
- if ((Math.abs(Math.abs(b) - 1)) < EPSLN) {
- return (93);
- }
- else {
- x = 0.5 * this.a * this.k0 * Math.log((1 + b) / (1 - b)) + this.x0;
- y = cos_phi * Math.cos(delta_lon) / Math.sqrt(1 - Math.pow(b, 2));
- b = Math.abs(y);
- if (b >= 1) {
- if ((b - 1) > EPSLN) {
- return (93);
- }
- else {
- y = 0;
- }
- }
- else {
- y = Math.acos(y);
- }
- if (lat < 0) {
- y = -y;
- }
- y = this.a * this.k0 * (y - this.lat0) + this.y0;
- }
- }
- else {
- var al = cos_phi * delta_lon;
- var als = Math.pow(al, 2);
- var c = this.ep2 * Math.pow(cos_phi, 2);
- var cs = Math.pow(c, 2);
- var tq = Math.abs(cos_phi) > EPSLN ? Math.tan(lat) : 0;
- var t = Math.pow(tq, 2);
- var ts = Math.pow(t, 2);
- con = 1 - this.es * Math.pow(sin_phi, 2);
- al = al / Math.sqrt(con);
- var ml = pj_mlfn(lat, sin_phi, cos_phi, this.en);
- x = this.a * (this.k0 * al * (1 +
- als / 6 * (1 - t + c +
- als / 20 * (5 - 18 * t + ts + 14 * c - 58 * t * c +
- als / 42 * (61 + 179 * ts - ts * t - 479 * t))))) +
- this.x0;
- y = this.a * (this.k0 * (ml - this.ml0 +
- sin_phi * delta_lon * al / 2 * (1 +
- als / 12 * (5 - t + 9 * c + 4 * cs +
- als / 30 * (61 + ts - 58 * t + 270 * c - 330 * t * c +
- als / 56 * (1385 + 543 * ts - ts * t - 3111 * t)))))) +
- this.y0;
- }
- p.x = x;
- p.y = y;
- return p;
- }
- /**
- Transverse Mercator Inverse - x/y to long/lat
- */
- function tmerc_inverse(p) {
- var con, phi;
- var lat, lon;
- var x = (p.x - this.x0) * (1 / this.a);
- var y = (p.y - this.y0) * (1 / this.a);
- if (!this.es) {
- var f = Math.exp(x / this.k0);
- var g = 0.5 * (f - 1 / f);
- var temp = this.lat0 + y / this.k0;
- var h = Math.cos(temp);
- con = Math.sqrt((1 - Math.pow(h, 2)) / (1 + Math.pow(g, 2)));
- lat = Math.asin(con);
- if (y < 0) {
- lat = -lat;
- }
- if ((g === 0) && (h === 0)) {
- lon = 0;
- }
- else {
- lon = adjust_lon(Math.atan2(g, h) + this.long0);
- }
- }
- else { // ellipsoidal form
- con = this.ml0 + y / this.k0;
- phi = pj_inv_mlfn(con, this.es, this.en);
- if (Math.abs(phi) < HALF_PI) {
- var sin_phi = Math.sin(phi);
- var cos_phi = Math.cos(phi);
- var tan_phi = Math.abs(cos_phi) > EPSLN ? Math.tan(phi) : 0;
- var c = this.ep2 * Math.pow(cos_phi, 2);
- var cs = Math.pow(c, 2);
- var t = Math.pow(tan_phi, 2);
- var ts = Math.pow(t, 2);
- con = 1 - this.es * Math.pow(sin_phi, 2);
- var d = x * Math.sqrt(con) / this.k0;
- var ds = Math.pow(d, 2);
- con = con * tan_phi;
- lat = phi - (con * ds / (1 - this.es)) * 0.5 * (1 -
- ds / 12 * (5 + 3 * t - 9 * c * t + c - 4 * cs -
- ds / 30 * (61 + 90 * t - 252 * c * t + 45 * ts + 46 * c -
- ds / 56 * (1385 + 3633 * t + 4095 * ts + 1574 * ts * t))));
- lon = adjust_lon(this.long0 + (d * (1 -
- ds / 6 * (1 + 2 * t + c -
- ds / 20 * (5 + 28 * t + 24 * ts + 8 * c * t + 6 * c -
- ds / 42 * (61 + 662 * t + 1320 * ts + 720 * ts * t)))) / cos_phi));
- }
- else {
- lat = HALF_PI * sign(y);
- lon = 0;
- }
- }
- p.x = lon;
- p.y = lat;
- return p;
- }
- var tmerc_names = ["Fast_Transverse_Mercator", "Fast Transverse Mercator"];
- /* harmony default export */ const tmerc = ({
- init: tmerc_init,
- forward: tmerc_forward,
- inverse: tmerc_inverse,
- names: tmerc_names
- });
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/sinh.js
- /* harmony default export */ function sinh(x) {
- var r = Math.exp(x);
- r = (r - 1 / r) / 2;
- return r;
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/hypot.js
- /* harmony default export */ function hypot(x, y) {
- x = Math.abs(x);
- y = Math.abs(y);
- var a = Math.max(x, y);
- var b = Math.min(x, y) / (a ? a : 1);
- return a * Math.sqrt(1 + Math.pow(b, 2));
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/log1py.js
- /* harmony default export */ function log1py(x) {
- var y = 1 + x;
- var z = y - 1;
- return z === 0 ? x : x * Math.log(y) / z;
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/asinhy.js
- /* harmony default export */ function asinhy(x) {
- var y = Math.abs(x);
- y = log1py(y * (1 + y / (hypot(1, y) + 1)));
- return x < 0 ? -y : y;
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/gatg.js
- /* harmony default export */ function gatg(pp, B) {
- var cos_2B = 2 * Math.cos(2 * B);
- var i = pp.length - 1;
- var h1 = pp[i];
- var h2 = 0;
- var h;
- while (--i >= 0) {
- h = -h2 + cos_2B * h1 + pp[i];
- h2 = h1;
- h1 = h;
- }
- return (B + h * Math.sin(2 * B));
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/clens.js
- /* harmony default export */ function clens(pp, arg_r) {
- var r = 2 * Math.cos(arg_r);
- var i = pp.length - 1;
- var hr1 = pp[i];
- var hr2 = 0;
- var hr;
- while (--i >= 0) {
- hr = -hr2 + r * hr1 + pp[i];
- hr2 = hr1;
- hr1 = hr;
- }
- return Math.sin(arg_r) * hr;
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/cosh.js
- /* harmony default export */ function cosh(x) {
- var r = Math.exp(x);
- r = (r + 1 / r) / 2;
- return r;
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/clens_cmplx.js
- /* harmony default export */ function clens_cmplx(pp, arg_r, arg_i) {
- var sin_arg_r = Math.sin(arg_r);
- var cos_arg_r = Math.cos(arg_r);
- var sinh_arg_i = sinh(arg_i);
- var cosh_arg_i = cosh(arg_i);
- var r = 2 * cos_arg_r * cosh_arg_i;
- var i = -2 * sin_arg_r * sinh_arg_i;
- var j = pp.length - 1;
- var hr = pp[j];
- var hi1 = 0;
- var hr1 = 0;
- var hi = 0;
- var hr2;
- var hi2;
- while (--j >= 0) {
- hr2 = hr1;
- hi2 = hi1;
- hr1 = hr;
- hi1 = hi;
- hr = -hr2 + r * hr1 - i * hi1 + pp[j];
- hi = -hi2 + i * hr1 + r * hi1;
- }
- r = sin_arg_r * cosh_arg_i;
- i = cos_arg_r * sinh_arg_i;
- return [r * hr - i * hi, r * hi + i * hr];
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/etmerc.js
- // Heavily based on this etmerc projection implementation
- // https://github.com/mbloch/mapshaper-proj/blob/master/src/projections/etmerc.js
- function etmerc_init() {
- if (!this.approx && (isNaN(this.es) || this.es <= 0)) {
- throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.');
- }
- if (this.approx) {
- // When '+approx' is set, use tmerc instead
- tmerc.init.apply(this);
- this.forward = tmerc.forward;
- this.inverse = tmerc.inverse;
- }
- this.x0 = this.x0 !== undefined ? this.x0 : 0;
- this.y0 = this.y0 !== undefined ? this.y0 : 0;
- this.long0 = this.long0 !== undefined ? this.long0 : 0;
- this.lat0 = this.lat0 !== undefined ? this.lat0 : 0;
- this.cgb = [];
- this.cbg = [];
- this.utg = [];
- this.gtu = [];
- var f = this.es / (1 + Math.sqrt(1 - this.es));
- var n = f / (2 - f);
- var np = n;
- this.cgb[0] = n * (2 + n * (-2 / 3 + n * (-2 + n * (116 / 45 + n * (26 / 45 + n * (-2854 / 675 ))))));
- this.cbg[0] = n * (-2 + n * ( 2 / 3 + n * ( 4 / 3 + n * (-82 / 45 + n * (32 / 45 + n * (4642 / 4725))))));
- np = np * n;
- this.cgb[1] = np * (7 / 3 + n * (-8 / 5 + n * (-227 / 45 + n * (2704 / 315 + n * (2323 / 945)))));
- this.cbg[1] = np * (5 / 3 + n * (-16 / 15 + n * ( -13 / 9 + n * (904 / 315 + n * (-1522 / 945)))));
- np = np * n;
- this.cgb[2] = np * (56 / 15 + n * (-136 / 35 + n * (-1262 / 105 + n * (73814 / 2835))));
- this.cbg[2] = np * (-26 / 15 + n * (34 / 21 + n * (8 / 5 + n * (-12686 / 2835))));
- np = np * n;
- this.cgb[3] = np * (4279 / 630 + n * (-332 / 35 + n * (-399572 / 14175)));
- this.cbg[3] = np * (1237 / 630 + n * (-12 / 5 + n * ( -24832 / 14175)));
- np = np * n;
- this.cgb[4] = np * (4174 / 315 + n * (-144838 / 6237));
- this.cbg[4] = np * (-734 / 315 + n * (109598 / 31185));
- np = np * n;
- this.cgb[5] = np * (601676 / 22275);
- this.cbg[5] = np * (444337 / 155925);
- np = Math.pow(n, 2);
- this.Qn = this.k0 / (1 + n) * (1 + np * (1 / 4 + np * (1 / 64 + np / 256)));
- this.utg[0] = n * (-0.5 + n * ( 2 / 3 + n * (-37 / 96 + n * ( 1 / 360 + n * (81 / 512 + n * (-96199 / 604800))))));
- this.gtu[0] = n * (0.5 + n * (-2 / 3 + n * (5 / 16 + n * (41 / 180 + n * (-127 / 288 + n * (7891 / 37800))))));
- this.utg[1] = np * (-1 / 48 + n * (-1 / 15 + n * (437 / 1440 + n * (-46 / 105 + n * (1118711 / 3870720)))));
- this.gtu[1] = np * (13 / 48 + n * (-3 / 5 + n * (557 / 1440 + n * (281 / 630 + n * (-1983433 / 1935360)))));
- np = np * n;
- this.utg[2] = np * (-17 / 480 + n * (37 / 840 + n * (209 / 4480 + n * (-5569 / 90720 ))));
- this.gtu[2] = np * (61 / 240 + n * (-103 / 140 + n * (15061 / 26880 + n * (167603 / 181440))));
- np = np * n;
- this.utg[3] = np * (-4397 / 161280 + n * (11 / 504 + n * (830251 / 7257600)));
- this.gtu[3] = np * (49561 / 161280 + n * (-179 / 168 + n * (6601661 / 7257600)));
- np = np * n;
- this.utg[4] = np * (-4583 / 161280 + n * (108847 / 3991680));
- this.gtu[4] = np * (34729 / 80640 + n * (-3418889 / 1995840));
- np = np * n;
- this.utg[5] = np * (-20648693 / 638668800);
- this.gtu[5] = np * (212378941 / 319334400);
- var Z = gatg(this.cbg, this.lat0);
- this.Zb = -this.Qn * (Z + clens(this.gtu, 2 * Z));
- }
- function etmerc_forward(p) {
- var Ce = adjust_lon(p.x - this.long0);
- var Cn = p.y;
- Cn = gatg(this.cbg, Cn);
- var sin_Cn = Math.sin(Cn);
- var cos_Cn = Math.cos(Cn);
- var sin_Ce = Math.sin(Ce);
- var cos_Ce = Math.cos(Ce);
- Cn = Math.atan2(sin_Cn, cos_Ce * cos_Cn);
- Ce = Math.atan2(sin_Ce * cos_Cn, hypot(sin_Cn, cos_Cn * cos_Ce));
- Ce = asinhy(Math.tan(Ce));
- var tmp = clens_cmplx(this.gtu, 2 * Cn, 2 * Ce);
- Cn = Cn + tmp[0];
- Ce = Ce + tmp[1];
- var x;
- var y;
- if (Math.abs(Ce) <= 2.623395162778) {
- x = this.a * (this.Qn * Ce) + this.x0;
- y = this.a * (this.Qn * Cn + this.Zb) + this.y0;
- }
- else {
- x = Infinity;
- y = Infinity;
- }
- p.x = x;
- p.y = y;
- return p;
- }
- function etmerc_inverse(p) {
- var Ce = (p.x - this.x0) * (1 / this.a);
- var Cn = (p.y - this.y0) * (1 / this.a);
- Cn = (Cn - this.Zb) / this.Qn;
- Ce = Ce / this.Qn;
- var lon;
- var lat;
- if (Math.abs(Ce) <= 2.623395162778) {
- var tmp = clens_cmplx(this.utg, 2 * Cn, 2 * Ce);
- Cn = Cn + tmp[0];
- Ce = Ce + tmp[1];
- Ce = Math.atan(sinh(Ce));
- var sin_Cn = Math.sin(Cn);
- var cos_Cn = Math.cos(Cn);
- var sin_Ce = Math.sin(Ce);
- var cos_Ce = Math.cos(Ce);
- Cn = Math.atan2(sin_Cn * cos_Ce, hypot(sin_Ce, cos_Ce * cos_Cn));
- Ce = Math.atan2(sin_Ce, cos_Ce * cos_Cn);
- lon = adjust_lon(Ce + this.long0);
- lat = gatg(this.cgb, Cn);
- }
- else {
- lon = Infinity;
- lat = Infinity;
- }
- p.x = lon;
- p.y = lat;
- return p;
- }
- var etmerc_names = ["Extended_Transverse_Mercator", "Extended Transverse Mercator", "etmerc", "Transverse_Mercator", "Transverse Mercator", "tmerc"];
- /* harmony default export */ const etmerc = ({
- init: etmerc_init,
- forward: etmerc_forward,
- inverse: etmerc_inverse,
- names: etmerc_names
- });
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/adjust_zone.js
- /* harmony default export */ function adjust_zone(zone, lon) {
- if (zone === undefined) {
- zone = Math.floor((adjust_lon(lon) + Math.PI) * 30 / Math.PI) + 1;
- if (zone < 0) {
- return 0;
- } else if (zone > 60) {
- return 60;
- }
- }
- return zone;
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/utm.js
- var dependsOn = 'etmerc';
- function utm_init() {
- var zone = adjust_zone(this.zone, this.long0);
- if (zone === undefined) {
- throw new Error('unknown utm zone');
- }
- this.lat0 = 0;
- this.long0 = ((6 * Math.abs(zone)) - 183) * D2R;
- this.x0 = 500000;
- this.y0 = this.utmSouth ? 10000000 : 0;
- this.k0 = 0.9996;
- etmerc.init.apply(this);
- this.forward = etmerc.forward;
- this.inverse = etmerc.inverse;
- }
- var utm_names = ["Universal Transverse Mercator System", "utm"];
- /* harmony default export */ const utm = ({
- init: utm_init,
- names: utm_names,
- dependsOn: dependsOn
- });
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/srat.js
- /* harmony default export */ function srat(esinp, exp) {
- return (Math.pow((1 - esinp) / (1 + esinp), exp));
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/gauss.js
- var gauss_MAX_ITER = 20;
- function gauss_init() {
- var sphi = Math.sin(this.lat0);
- var cphi = Math.cos(this.lat0);
- cphi *= cphi;
- this.rc = Math.sqrt(1 - this.es) / (1 - this.es * sphi * sphi);
- this.C = Math.sqrt(1 + this.es * cphi * cphi / (1 - this.es));
- this.phic0 = Math.asin(sphi / this.C);
- this.ratexp = 0.5 * this.C * this.e;
- this.K = Math.tan(0.5 * this.phic0 + FORTPI) / (Math.pow(Math.tan(0.5 * this.lat0 + FORTPI), this.C) * srat(this.e * sphi, this.ratexp));
- }
- function gauss_forward(p) {
- var lon = p.x;
- var lat = p.y;
- p.y = 2 * Math.atan(this.K * Math.pow(Math.tan(0.5 * lat + FORTPI), this.C) * srat(this.e * Math.sin(lat), this.ratexp)) - HALF_PI;
- p.x = this.C * lon;
- return p;
- }
- function gauss_inverse(p) {
- var DEL_TOL = 1e-14;
- var lon = p.x / this.C;
- var lat = p.y;
- var num = Math.pow(Math.tan(0.5 * lat + FORTPI) / this.K, 1 / this.C);
- for (var i = gauss_MAX_ITER; i > 0; --i) {
- lat = 2 * Math.atan(num * srat(this.e * Math.sin(p.y), - 0.5 * this.e)) - HALF_PI;
- if (Math.abs(lat - p.y) < DEL_TOL) {
- break;
- }
- p.y = lat;
- }
- /* convergence failed */
- if (!i) {
- return null;
- }
- p.x = lon;
- p.y = lat;
- return p;
- }
- var gauss_names = ["gauss"];
- /* harmony default export */ const gauss = ({
- init: gauss_init,
- forward: gauss_forward,
- inverse: gauss_inverse,
- names: gauss_names
- });
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/sterea.js
- function sterea_init() {
- gauss.init.apply(this);
- if (!this.rc) {
- return;
- }
- this.sinc0 = Math.sin(this.phic0);
- this.cosc0 = Math.cos(this.phic0);
- this.R2 = 2 * this.rc;
- if (!this.title) {
- this.title = "Oblique Stereographic Alternative";
- }
- }
- function sterea_forward(p) {
- var sinc, cosc, cosl, k;
- p.x = adjust_lon(p.x - this.long0);
- gauss.forward.apply(this, [p]);
- sinc = Math.sin(p.y);
- cosc = Math.cos(p.y);
- cosl = Math.cos(p.x);
- k = this.k0 * this.R2 / (1 + this.sinc0 * sinc + this.cosc0 * cosc * cosl);
- p.x = k * cosc * Math.sin(p.x);
- p.y = k * (this.cosc0 * sinc - this.sinc0 * cosc * cosl);
- p.x = this.a * p.x + this.x0;
- p.y = this.a * p.y + this.y0;
- return p;
- }
- function sterea_inverse(p) {
- var sinc, cosc, lon, lat, rho;
- p.x = (p.x - this.x0) / this.a;
- p.y = (p.y - this.y0) / this.a;
- p.x /= this.k0;
- p.y /= this.k0;
- if ((rho = Math.sqrt(p.x * p.x + p.y * p.y))) {
- var c = 2 * Math.atan2(rho, this.R2);
- sinc = Math.sin(c);
- cosc = Math.cos(c);
- lat = Math.asin(cosc * this.sinc0 + p.y * sinc * this.cosc0 / rho);
- lon = Math.atan2(p.x * sinc, rho * this.cosc0 * cosc - p.y * this.sinc0 * sinc);
- }
- else {
- lat = this.phic0;
- lon = 0;
- }
- p.x = lon;
- p.y = lat;
- gauss.inverse.apply(this, [p]);
- p.x = adjust_lon(p.x + this.long0);
- return p;
- }
- var sterea_names = ["Stereographic_North_Pole", "Oblique_Stereographic", "Polar_Stereographic", "sterea","Oblique Stereographic Alternative","Double_Stereographic"];
- /* harmony default export */ const sterea = ({
- init: sterea_init,
- forward: sterea_forward,
- inverse: sterea_inverse,
- names: sterea_names
- });
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/stere.js
- function ssfn_(phit, sinphi, eccen) {
- sinphi *= eccen;
- return (Math.tan(0.5 * (HALF_PI + phit)) * Math.pow((1 - sinphi) / (1 + sinphi), 0.5 * eccen));
- }
- function stere_init() {
- this.coslat0 = Math.cos(this.lat0);
- this.sinlat0 = Math.sin(this.lat0);
- if (this.sphere) {
- if (this.k0 === 1 && !isNaN(this.lat_ts) && Math.abs(this.coslat0) <= EPSLN) {
- this.k0 = 0.5 * (1 + sign(this.lat0) * Math.sin(this.lat_ts));
- }
- }
- else {
- if (Math.abs(this.coslat0) <= EPSLN) {
- if (this.lat0 > 0) {
- //North pole
- //trace('stere:north pole');
- this.con = 1;
- }
- else {
- //South pole
- //trace('stere:south pole');
- this.con = -1;
- }
- }
- this.cons = Math.sqrt(Math.pow(1 + this.e, 1 + this.e) * Math.pow(1 - this.e, 1 - this.e));
- if (this.k0 === 1 && !isNaN(this.lat_ts) && Math.abs(this.coslat0) <= EPSLN) {
- this.k0 = 0.5 * this.cons * msfnz(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts)) / tsfnz(this.e, this.con * this.lat_ts, this.con * Math.sin(this.lat_ts));
- }
- this.ms1 = msfnz(this.e, this.sinlat0, this.coslat0);
- this.X0 = 2 * Math.atan(this.ssfn_(this.lat0, this.sinlat0, this.e)) - HALF_PI;
- this.cosX0 = Math.cos(this.X0);
- this.sinX0 = Math.sin(this.X0);
- }
- }
- // Stereographic forward equations--mapping lat,long to x,y
- function stere_forward(p) {
- var lon = p.x;
- var lat = p.y;
- var sinlat = Math.sin(lat);
- var coslat = Math.cos(lat);
- var A, X, sinX, cosX, ts, rh;
- var dlon = adjust_lon(lon - this.long0);
- if (Math.abs(Math.abs(lon - this.long0) - Math.PI) <= EPSLN && Math.abs(lat + this.lat0) <= EPSLN) {
- //case of the origine point
- //trace('stere:this is the origin point');
- p.x = NaN;
- p.y = NaN;
- return p;
- }
- if (this.sphere) {
- //trace('stere:sphere case');
- A = 2 * this.k0 / (1 + this.sinlat0 * sinlat + this.coslat0 * coslat * Math.cos(dlon));
- p.x = this.a * A * coslat * Math.sin(dlon) + this.x0;
- p.y = this.a * A * (this.coslat0 * sinlat - this.sinlat0 * coslat * Math.cos(dlon)) + this.y0;
- return p;
- }
- else {
- X = 2 * Math.atan(this.ssfn_(lat, sinlat, this.e)) - HALF_PI;
- cosX = Math.cos(X);
- sinX = Math.sin(X);
- if (Math.abs(this.coslat0) <= EPSLN) {
- ts = tsfnz(this.e, lat * this.con, this.con * sinlat);
- rh = 2 * this.a * this.k0 * ts / this.cons;
- p.x = this.x0 + rh * Math.sin(lon - this.long0);
- p.y = this.y0 - this.con * rh * Math.cos(lon - this.long0);
- //trace(p.toString());
- return p;
- }
- else if (Math.abs(this.sinlat0) < EPSLN) {
- //Eq
- //trace('stere:equateur');
- A = 2 * this.a * this.k0 / (1 + cosX * Math.cos(dlon));
- p.y = A * sinX;
- }
- else {
- //other case
- //trace('stere:normal case');
- A = 2 * this.a * this.k0 * this.ms1 / (this.cosX0 * (1 + this.sinX0 * sinX + this.cosX0 * cosX * Math.cos(dlon)));
- p.y = A * (this.cosX0 * sinX - this.sinX0 * cosX * Math.cos(dlon)) + this.y0;
- }
- p.x = A * cosX * Math.sin(dlon) + this.x0;
- }
- //trace(p.toString());
- return p;
- }
- //* Stereographic inverse equations--mapping x,y to lat/long
- function stere_inverse(p) {
- p.x -= this.x0;
- p.y -= this.y0;
- var lon, lat, ts, ce, Chi;
- var rh = Math.sqrt(p.x * p.x + p.y * p.y);
- if (this.sphere) {
- var c = 2 * Math.atan(rh / (2 * this.a * this.k0));
- lon = this.long0;
- lat = this.lat0;
- if (rh <= EPSLN) {
- p.x = lon;
- p.y = lat;
- return p;
- }
- lat = Math.asin(Math.cos(c) * this.sinlat0 + p.y * Math.sin(c) * this.coslat0 / rh);
- if (Math.abs(this.coslat0) < EPSLN) {
- if (this.lat0 > 0) {
- lon = adjust_lon(this.long0 + Math.atan2(p.x, - 1 * p.y));
- }
- else {
- lon = adjust_lon(this.long0 + Math.atan2(p.x, p.y));
- }
- }
- else {
- lon = adjust_lon(this.long0 + Math.atan2(p.x * Math.sin(c), rh * this.coslat0 * Math.cos(c) - p.y * this.sinlat0 * Math.sin(c)));
- }
- p.x = lon;
- p.y = lat;
- return p;
- }
- else {
- if (Math.abs(this.coslat0) <= EPSLN) {
- if (rh <= EPSLN) {
- lat = this.lat0;
- lon = this.long0;
- p.x = lon;
- p.y = lat;
- //trace(p.toString());
- return p;
- }
- p.x *= this.con;
- p.y *= this.con;
- ts = rh * this.cons / (2 * this.a * this.k0);
- lat = this.con * phi2z(this.e, ts);
- lon = this.con * adjust_lon(this.con * this.long0 + Math.atan2(p.x, - 1 * p.y));
- }
- else {
- ce = 2 * Math.atan(rh * this.cosX0 / (2 * this.a * this.k0 * this.ms1));
- lon = this.long0;
- if (rh <= EPSLN) {
- Chi = this.X0;
- }
- else {
- Chi = Math.asin(Math.cos(ce) * this.sinX0 + p.y * Math.sin(ce) * this.cosX0 / rh);
- lon = adjust_lon(this.long0 + Math.atan2(p.x * Math.sin(ce), rh * this.cosX0 * Math.cos(ce) - p.y * this.sinX0 * Math.sin(ce)));
- }
- lat = -1 * phi2z(this.e, Math.tan(0.5 * (HALF_PI + Chi)));
- }
- }
- p.x = lon;
- p.y = lat;
- //trace(p.toString());
- return p;
- }
- var stere_names = ["stere", "Stereographic_South_Pole", "Polar Stereographic (variant B)"];
- /* harmony default export */ const stere = ({
- init: stere_init,
- forward: stere_forward,
- inverse: stere_inverse,
- names: stere_names,
- ssfn_: ssfn_
- });
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/somerc.js
- /*
- references:
- Formules et constantes pour le Calcul pour la
- projection cylindrique conforme à axe oblique et pour la transformation entre
- des systèmes de référence.
- http://www.swisstopo.admin.ch/internet/swisstopo/fr/home/topics/survey/sys/refsys/switzerland.parsysrelated1.31216.downloadList.77004.DownloadFile.tmp/swissprojectionfr.pdf
- */
- function somerc_init() {
- var phy0 = this.lat0;
- this.lambda0 = this.long0;
- var sinPhy0 = Math.sin(phy0);
- var semiMajorAxis = this.a;
- var invF = this.rf;
- var flattening = 1 / invF;
- var e2 = 2 * flattening - Math.pow(flattening, 2);
- var e = this.e = Math.sqrt(e2);
- this.R = this.k0 * semiMajorAxis * Math.sqrt(1 - e2) / (1 - e2 * Math.pow(sinPhy0, 2));
- this.alpha = Math.sqrt(1 + e2 / (1 - e2) * Math.pow(Math.cos(phy0), 4));
- this.b0 = Math.asin(sinPhy0 / this.alpha);
- var k1 = Math.log(Math.tan(Math.PI / 4 + this.b0 / 2));
- var k2 = Math.log(Math.tan(Math.PI / 4 + phy0 / 2));
- var k3 = Math.log((1 + e * sinPhy0) / (1 - e * sinPhy0));
- this.K = k1 - this.alpha * k2 + this.alpha * e / 2 * k3;
- }
- function somerc_forward(p) {
- var Sa1 = Math.log(Math.tan(Math.PI / 4 - p.y / 2));
- var Sa2 = this.e / 2 * Math.log((1 + this.e * Math.sin(p.y)) / (1 - this.e * Math.sin(p.y)));
- var S = -this.alpha * (Sa1 + Sa2) + this.K;
- // spheric latitude
- var b = 2 * (Math.atan(Math.exp(S)) - Math.PI / 4);
- // spheric longitude
- var I = this.alpha * (p.x - this.lambda0);
- // psoeudo equatorial rotation
- var rotI = Math.atan(Math.sin(I) / (Math.sin(this.b0) * Math.tan(b) + Math.cos(this.b0) * Math.cos(I)));
- var rotB = Math.asin(Math.cos(this.b0) * Math.sin(b) - Math.sin(this.b0) * Math.cos(b) * Math.cos(I));
- p.y = this.R / 2 * Math.log((1 + Math.sin(rotB)) / (1 - Math.sin(rotB))) + this.y0;
- p.x = this.R * rotI + this.x0;
- return p;
- }
- function somerc_inverse(p) {
- var Y = p.x - this.x0;
- var X = p.y - this.y0;
- var rotI = Y / this.R;
- var rotB = 2 * (Math.atan(Math.exp(X / this.R)) - Math.PI / 4);
- var b = Math.asin(Math.cos(this.b0) * Math.sin(rotB) + Math.sin(this.b0) * Math.cos(rotB) * Math.cos(rotI));
- var I = Math.atan(Math.sin(rotI) / (Math.cos(this.b0) * Math.cos(rotI) - Math.sin(this.b0) * Math.tan(rotB)));
- var lambda = this.lambda0 + I / this.alpha;
- var S = 0;
- var phy = b;
- var prevPhy = -1000;
- var iteration = 0;
- while (Math.abs(phy - prevPhy) > 0.0000001) {
- if (++iteration > 20) {
- //...reportError("omercFwdInfinity");
- return;
- }
- //S = Math.log(Math.tan(Math.PI / 4 + phy / 2));
- S = 1 / this.alpha * (Math.log(Math.tan(Math.PI / 4 + b / 2)) - this.K) + this.e * Math.log(Math.tan(Math.PI / 4 + Math.asin(this.e * Math.sin(phy)) / 2));
- prevPhy = phy;
- phy = 2 * Math.atan(Math.exp(S)) - Math.PI / 2;
- }
- p.x = lambda;
- p.y = phy;
- return p;
- }
- var somerc_names = ["somerc"];
- /* harmony default export */ const somerc = ({
- init: somerc_init,
- forward: somerc_forward,
- inverse: somerc_inverse,
- names: somerc_names
- });
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/omerc.js
- var TOL = 1e-7;
- function isTypeA(P) {
- var typeAProjections = ['Hotine_Oblique_Mercator','Hotine_Oblique_Mercator_Azimuth_Natural_Origin'];
- var projectionName = typeof P.PROJECTION === "object" ? Object.keys(P.PROJECTION)[0] : P.PROJECTION;
-
- return 'no_uoff' in P || 'no_off' in P || typeAProjections.indexOf(projectionName) !== -1;
- }
- /* Initialize the Oblique Mercator projection
- ------------------------------------------*/
- function omerc_init() {
- var con, com, cosph0, D, F, H, L, sinph0, p, J, gamma = 0,
- gamma0, lamc = 0, lam1 = 0, lam2 = 0, phi1 = 0, phi2 = 0, alpha_c = 0, AB;
-
- // only Type A uses the no_off or no_uoff property
- // https://github.com/OSGeo/proj.4/issues/104
- this.no_off = isTypeA(this);
- this.no_rot = 'no_rot' in this;
-
- var alp = false;
- if ("alpha" in this) {
- alp = true;
- }
- var gam = false;
- if ("rectified_grid_angle" in this) {
- gam = true;
- }
- if (alp) {
- alpha_c = this.alpha;
- }
-
- if (gam) {
- gamma = (this.rectified_grid_angle * D2R);
- }
-
- if (alp || gam) {
- lamc = this.longc;
- } else {
- lam1 = this.long1;
- phi1 = this.lat1;
- lam2 = this.long2;
- phi2 = this.lat2;
-
- if (Math.abs(phi1 - phi2) <= TOL || (con = Math.abs(phi1)) <= TOL ||
- Math.abs(con - HALF_PI) <= TOL || Math.abs(Math.abs(this.lat0) - HALF_PI) <= TOL ||
- Math.abs(Math.abs(phi2) - HALF_PI) <= TOL) {
- throw new Error();
- }
- }
-
- var one_es = 1.0 - this.es;
- com = Math.sqrt(one_es);
-
- if (Math.abs(this.lat0) > EPSLN) {
- sinph0 = Math.sin(this.lat0);
- cosph0 = Math.cos(this.lat0);
- con = 1 - this.es * sinph0 * sinph0;
- this.B = cosph0 * cosph0;
- this.B = Math.sqrt(1 + this.es * this.B * this.B / one_es);
- this.A = this.B * this.k0 * com / con;
- D = this.B * com / (cosph0 * Math.sqrt(con));
- F = D * D -1;
-
- if (F <= 0) {
- F = 0;
- } else {
- F = Math.sqrt(F);
- if (this.lat0 < 0) {
- F = -F;
- }
- }
-
- this.E = F += D;
- this.E *= Math.pow(tsfnz(this.e, this.lat0, sinph0), this.B);
- } else {
- this.B = 1 / com;
- this.A = this.k0;
- this.E = D = F = 1;
- }
-
- if (alp || gam) {
- if (alp) {
- gamma0 = Math.asin(Math.sin(alpha_c) / D);
- if (!gam) {
- gamma = alpha_c;
- }
- } else {
- gamma0 = gamma;
- alpha_c = Math.asin(D * Math.sin(gamma0));
- }
- this.lam0 = lamc - Math.asin(0.5 * (F - 1 / F) * Math.tan(gamma0)) / this.B;
- } else {
- H = Math.pow(tsfnz(this.e, phi1, Math.sin(phi1)), this.B);
- L = Math.pow(tsfnz(this.e, phi2, Math.sin(phi2)), this.B);
- F = this.E / H;
- p = (L - H) / (L + H);
- J = this.E * this.E;
- J = (J - L * H) / (J + L * H);
- con = lam1 - lam2;
-
- if (con < -Math.pi) {
- lam2 -=TWO_PI;
- } else if (con > Math.pi) {
- lam2 += TWO_PI;
- }
-
- this.lam0 = adjust_lon(0.5 * (lam1 + lam2) - Math.atan(J * Math.tan(0.5 * this.B * (lam1 - lam2)) / p) / this.B);
- gamma0 = Math.atan(2 * Math.sin(this.B * adjust_lon(lam1 - this.lam0)) / (F - 1 / F));
- gamma = alpha_c = Math.asin(D * Math.sin(gamma0));
- }
-
- this.singam = Math.sin(gamma0);
- this.cosgam = Math.cos(gamma0);
- this.sinrot = Math.sin(gamma);
- this.cosrot = Math.cos(gamma);
-
- this.rB = 1 / this.B;
- this.ArB = this.A * this.rB;
- this.BrA = 1 / this.ArB;
- AB = this.A * this.B;
-
- if (this.no_off) {
- this.u_0 = 0;
- } else {
- this.u_0 = Math.abs(this.ArB * Math.atan(Math.sqrt(D * D - 1) / Math.cos(alpha_c)));
-
- if (this.lat0 < 0) {
- this.u_0 = - this.u_0;
- }
- }
-
- F = 0.5 * gamma0;
- this.v_pole_n = this.ArB * Math.log(Math.tan(FORTPI - F));
- this.v_pole_s = this.ArB * Math.log(Math.tan(FORTPI + F));
- }
- /* Oblique Mercator forward equations--mapping lat,long to x,y
- ----------------------------------------------------------*/
- function omerc_forward(p) {
- var coords = {};
- var S, T, U, V, W, temp, u, v;
- p.x = p.x - this.lam0;
-
- if (Math.abs(Math.abs(p.y) - HALF_PI) > EPSLN) {
- W = this.E / Math.pow(tsfnz(this.e, p.y, Math.sin(p.y)), this.B);
-
- temp = 1 / W;
- S = 0.5 * (W - temp);
- T = 0.5 * (W + temp);
- V = Math.sin(this.B * p.x);
- U = (S * this.singam - V * this.cosgam) / T;
-
- if (Math.abs(Math.abs(U) - 1.0) < EPSLN) {
- throw new Error();
- }
-
- v = 0.5 * this.ArB * Math.log((1 - U)/(1 + U));
- temp = Math.cos(this.B * p.x);
-
- if (Math.abs(temp) < TOL) {
- u = this.A * p.x;
- } else {
- u = this.ArB * Math.atan2((S * this.cosgam + V * this.singam), temp);
- }
- } else {
- v = p.y > 0 ? this.v_pole_n : this.v_pole_s;
- u = this.ArB * p.y;
- }
-
- if (this.no_rot) {
- coords.x = u;
- coords.y = v;
- } else {
- u -= this.u_0;
- coords.x = v * this.cosrot + u * this.sinrot;
- coords.y = u * this.cosrot - v * this.sinrot;
- }
-
- coords.x = (this.a * coords.x + this.x0);
- coords.y = (this.a * coords.y + this.y0);
-
- return coords;
- }
- function omerc_inverse(p) {
- var u, v, Qp, Sp, Tp, Vp, Up;
- var coords = {};
-
- p.x = (p.x - this.x0) * (1.0 / this.a);
- p.y = (p.y - this.y0) * (1.0 / this.a);
- if (this.no_rot) {
- v = p.y;
- u = p.x;
- } else {
- v = p.x * this.cosrot - p.y * this.sinrot;
- u = p.y * this.cosrot + p.x * this.sinrot + this.u_0;
- }
-
- Qp = Math.exp(-this.BrA * v);
- Sp = 0.5 * (Qp - 1 / Qp);
- Tp = 0.5 * (Qp + 1 / Qp);
- Vp = Math.sin(this.BrA * u);
- Up = (Vp * this.cosgam + Sp * this.singam) / Tp;
-
- if (Math.abs(Math.abs(Up) - 1) < EPSLN) {
- coords.x = 0;
- coords.y = Up < 0 ? -HALF_PI : HALF_PI;
- } else {
- coords.y = this.E / Math.sqrt((1 + Up) / (1 - Up));
- coords.y = phi2z(this.e, Math.pow(coords.y, 1 / this.B));
-
- if (coords.y === Infinity) {
- throw new Error();
- }
-
- coords.x = -this.rB * Math.atan2((Sp * this.cosgam - Vp * this.singam), Math.cos(this.BrA * u));
- }
-
- coords.x += this.lam0;
-
- return coords;
- }
- var omerc_names = ["Hotine_Oblique_Mercator", "Hotine Oblique Mercator", "Hotine_Oblique_Mercator_Azimuth_Natural_Origin", "Hotine_Oblique_Mercator_Two_Point_Natural_Origin", "Hotine_Oblique_Mercator_Azimuth_Center", "Oblique_Mercator", "omerc"];
- /* harmony default export */ const omerc = ({
- init: omerc_init,
- forward: omerc_forward,
- inverse: omerc_inverse,
- names: omerc_names
- });
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/lcc.js
- function lcc_init() {
-
- //double lat0; /* the reference latitude */
- //double long0; /* the reference longitude */
- //double lat1; /* first standard parallel */
- //double lat2; /* second standard parallel */
- //double r_maj; /* major axis */
- //double r_min; /* minor axis */
- //double false_east; /* x offset in meters */
- //double false_north; /* y offset in meters */
-
- //the above value can be set with proj4.defs
- //example: proj4.defs("EPSG:2154","+proj=lcc +lat_1=49 +lat_2=44 +lat_0=46.5 +lon_0=3 +x_0=700000 +y_0=6600000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs");
- if (!this.lat2) {
- this.lat2 = this.lat1;
- } //if lat2 is not defined
- if (!this.k0) {
- this.k0 = 1;
- }
- this.x0 = this.x0 || 0;
- this.y0 = this.y0 || 0;
- // Standard Parallels cannot be equal and on opposite sides of the equator
- if (Math.abs(this.lat1 + this.lat2) < EPSLN) {
- return;
- }
- var temp = this.b / this.a;
- this.e = Math.sqrt(1 - temp * temp);
- var sin1 = Math.sin(this.lat1);
- var cos1 = Math.cos(this.lat1);
- var ms1 = msfnz(this.e, sin1, cos1);
- var ts1 = tsfnz(this.e, this.lat1, sin1);
- var sin2 = Math.sin(this.lat2);
- var cos2 = Math.cos(this.lat2);
- var ms2 = msfnz(this.e, sin2, cos2);
- var ts2 = tsfnz(this.e, this.lat2, sin2);
- var ts0 = tsfnz(this.e, this.lat0, Math.sin(this.lat0));
- if (Math.abs(this.lat1 - this.lat2) > EPSLN) {
- this.ns = Math.log(ms1 / ms2) / Math.log(ts1 / ts2);
- }
- else {
- this.ns = sin1;
- }
- if (isNaN(this.ns)) {
- this.ns = sin1;
- }
- this.f0 = ms1 / (this.ns * Math.pow(ts1, this.ns));
- this.rh = this.a * this.f0 * Math.pow(ts0, this.ns);
- if (!this.title) {
- this.title = "Lambert Conformal Conic";
- }
- }
- // Lambert Conformal conic forward equations--mapping lat,long to x,y
- // -----------------------------------------------------------------
- function lcc_forward(p) {
- var lon = p.x;
- var lat = p.y;
- // singular cases :
- if (Math.abs(2 * Math.abs(lat) - Math.PI) <= EPSLN) {
- lat = sign(lat) * (HALF_PI - 2 * EPSLN);
- }
- var con = Math.abs(Math.abs(lat) - HALF_PI);
- var ts, rh1;
- if (con > EPSLN) {
- ts = tsfnz(this.e, lat, Math.sin(lat));
- rh1 = this.a * this.f0 * Math.pow(ts, this.ns);
- }
- else {
- con = lat * this.ns;
- if (con <= 0) {
- return null;
- }
- rh1 = 0;
- }
- var theta = this.ns * adjust_lon(lon - this.long0);
- p.x = this.k0 * (rh1 * Math.sin(theta)) + this.x0;
- p.y = this.k0 * (this.rh - rh1 * Math.cos(theta)) + this.y0;
- return p;
- }
- // Lambert Conformal Conic inverse equations--mapping x,y to lat/long
- // -----------------------------------------------------------------
- function lcc_inverse(p) {
- var rh1, con, ts;
- var lat, lon;
- var x = (p.x - this.x0) / this.k0;
- var y = (this.rh - (p.y - this.y0) / this.k0);
- if (this.ns > 0) {
- rh1 = Math.sqrt(x * x + y * y);
- con = 1;
- }
- else {
- rh1 = -Math.sqrt(x * x + y * y);
- con = -1;
- }
- var theta = 0;
- if (rh1 !== 0) {
- theta = Math.atan2((con * x), (con * y));
- }
- if ((rh1 !== 0) || (this.ns > 0)) {
- con = 1 / this.ns;
- ts = Math.pow((rh1 / (this.a * this.f0)), con);
- lat = phi2z(this.e, ts);
- if (lat === -9999) {
- return null;
- }
- }
- else {
- lat = -HALF_PI;
- }
- lon = adjust_lon(theta / this.ns + this.long0);
- p.x = lon;
- p.y = lat;
- return p;
- }
- var lcc_names = [
- "Lambert Tangential Conformal Conic Projection",
- "Lambert_Conformal_Conic",
- "Lambert_Conformal_Conic_1SP",
- "Lambert_Conformal_Conic_2SP",
- "lcc",
- "Lambert Conic Conformal (1SP)",
- "Lambert Conic Conformal (2SP)"
- ];
- /* harmony default export */ const lcc = ({
- init: lcc_init,
- forward: lcc_forward,
- inverse: lcc_inverse,
- names: lcc_names
- });
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/krovak.js
- function krovak_init() {
- this.a = 6377397.155;
- this.es = 0.006674372230614;
- this.e = Math.sqrt(this.es);
- if (!this.lat0) {
- this.lat0 = 0.863937979737193;
- }
- if (!this.long0) {
- this.long0 = 0.7417649320975901 - 0.308341501185665;
- }
- /* if scale not set default to 0.9999 */
- if (!this.k0) {
- this.k0 = 0.9999;
- }
- this.s45 = 0.785398163397448; /* 45 */
- this.s90 = 2 * this.s45;
- this.fi0 = this.lat0;
- this.e2 = this.es;
- this.e = Math.sqrt(this.e2);
- this.alfa = Math.sqrt(1 + (this.e2 * Math.pow(Math.cos(this.fi0), 4)) / (1 - this.e2));
- this.uq = 1.04216856380474;
- this.u0 = Math.asin(Math.sin(this.fi0) / this.alfa);
- this.g = Math.pow((1 + this.e * Math.sin(this.fi0)) / (1 - this.e * Math.sin(this.fi0)), this.alfa * this.e / 2);
- this.k = Math.tan(this.u0 / 2 + this.s45) / Math.pow(Math.tan(this.fi0 / 2 + this.s45), this.alfa) * this.g;
- this.k1 = this.k0;
- this.n0 = this.a * Math.sqrt(1 - this.e2) / (1 - this.e2 * Math.pow(Math.sin(this.fi0), 2));
- this.s0 = 1.37008346281555;
- this.n = Math.sin(this.s0);
- this.ro0 = this.k1 * this.n0 / Math.tan(this.s0);
- this.ad = this.s90 - this.uq;
- }
- /* ellipsoid */
- /* calculate xy from lat/lon */
- /* Constants, identical to inverse transform function */
- function krovak_forward(p) {
- var gfi, u, deltav, s, d, eps, ro;
- var lon = p.x;
- var lat = p.y;
- var delta_lon = adjust_lon(lon - this.long0);
- /* Transformation */
- gfi = Math.pow(((1 + this.e * Math.sin(lat)) / (1 - this.e * Math.sin(lat))), (this.alfa * this.e / 2));
- u = 2 * (Math.atan(this.k * Math.pow(Math.tan(lat / 2 + this.s45), this.alfa) / gfi) - this.s45);
- deltav = -delta_lon * this.alfa;
- s = Math.asin(Math.cos(this.ad) * Math.sin(u) + Math.sin(this.ad) * Math.cos(u) * Math.cos(deltav));
- d = Math.asin(Math.cos(u) * Math.sin(deltav) / Math.cos(s));
- eps = this.n * d;
- ro = this.ro0 * Math.pow(Math.tan(this.s0 / 2 + this.s45), this.n) / Math.pow(Math.tan(s / 2 + this.s45), this.n);
- p.y = ro * Math.cos(eps) / 1;
- p.x = ro * Math.sin(eps) / 1;
- if (!this.czech) {
- p.y *= -1;
- p.x *= -1;
- }
- return (p);
- }
- /* calculate lat/lon from xy */
- function krovak_inverse(p) {
- var u, deltav, s, d, eps, ro, fi1;
- var ok;
- /* Transformation */
- /* revert y, x*/
- var tmp = p.x;
- p.x = p.y;
- p.y = tmp;
- if (!this.czech) {
- p.y *= -1;
- p.x *= -1;
- }
- ro = Math.sqrt(p.x * p.x + p.y * p.y);
- eps = Math.atan2(p.y, p.x);
- d = eps / Math.sin(this.s0);
- s = 2 * (Math.atan(Math.pow(this.ro0 / ro, 1 / this.n) * Math.tan(this.s0 / 2 + this.s45)) - this.s45);
- u = Math.asin(Math.cos(this.ad) * Math.sin(s) - Math.sin(this.ad) * Math.cos(s) * Math.cos(d));
- deltav = Math.asin(Math.cos(s) * Math.sin(d) / Math.cos(u));
- p.x = this.long0 - deltav / this.alfa;
- fi1 = u;
- ok = 0;
- var iter = 0;
- do {
- p.y = 2 * (Math.atan(Math.pow(this.k, - 1 / this.alfa) * Math.pow(Math.tan(u / 2 + this.s45), 1 / this.alfa) * Math.pow((1 + this.e * Math.sin(fi1)) / (1 - this.e * Math.sin(fi1)), this.e / 2)) - this.s45);
- if (Math.abs(fi1 - p.y) < 0.0000000001) {
- ok = 1;
- }
- fi1 = p.y;
- iter += 1;
- } while (ok === 0 && iter < 15);
- if (iter >= 15) {
- return null;
- }
- return (p);
- }
- var krovak_names = ["Krovak", "krovak"];
- /* harmony default export */ const krovak = ({
- init: krovak_init,
- forward: krovak_forward,
- inverse: krovak_inverse,
- names: krovak_names
- });
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/mlfn.js
- /* harmony default export */ function mlfn(e0, e1, e2, e3, phi) {
- return (e0 * phi - e1 * Math.sin(2 * phi) + e2 * Math.sin(4 * phi) - e3 * Math.sin(6 * phi));
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/e0fn.js
- /* harmony default export */ function e0fn(x) {
- return (1 - 0.25 * x * (1 + x / 16 * (3 + 1.25 * x)));
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/e1fn.js
- /* harmony default export */ function e1fn(x) {
- return (0.375 * x * (1 + 0.25 * x * (1 + 0.46875 * x)));
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/e2fn.js
- /* harmony default export */ function e2fn(x) {
- return (0.05859375 * x * x * (1 + 0.75 * x));
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/e3fn.js
- /* harmony default export */ function e3fn(x) {
- return (x * x * x * (35 / 3072));
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/gN.js
- /* harmony default export */ function gN(a, e, sinphi) {
- var temp = e * sinphi;
- return a / Math.sqrt(1 - temp * temp);
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/adjust_lat.js
- /* harmony default export */ function adjust_lat(x) {
- return (Math.abs(x) < HALF_PI) ? x : (x - (sign(x) * Math.PI));
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/imlfn.js
- /* harmony default export */ function imlfn(ml, e0, e1, e2, e3) {
- var phi;
- var dphi;
- phi = ml / e0;
- for (var i = 0; i < 15; i++) {
- dphi = (ml - (e0 * phi - e1 * Math.sin(2 * phi) + e2 * Math.sin(4 * phi) - e3 * Math.sin(6 * phi))) / (e0 - 2 * e1 * Math.cos(2 * phi) + 4 * e2 * Math.cos(4 * phi) - 6 * e3 * Math.cos(6 * phi));
- phi += dphi;
- if (Math.abs(dphi) <= 0.0000000001) {
- return phi;
- }
- }
- //..reportError("IMLFN-CONV:Latitude failed to converge after 15 iterations");
- return NaN;
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/cass.js
- function cass_init() {
- if (!this.sphere) {
- this.e0 = e0fn(this.es);
- this.e1 = e1fn(this.es);
- this.e2 = e2fn(this.es);
- this.e3 = e3fn(this.es);
- this.ml0 = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, this.lat0);
- }
- }
- /* Cassini forward equations--mapping lat,long to x,y
- -----------------------------------------------------------------------*/
- function cass_forward(p) {
- /* Forward equations
- -----------------*/
- var x, y;
- var lam = p.x;
- var phi = p.y;
- lam = adjust_lon(lam - this.long0);
- if (this.sphere) {
- x = this.a * Math.asin(Math.cos(phi) * Math.sin(lam));
- y = this.a * (Math.atan2(Math.tan(phi), Math.cos(lam)) - this.lat0);
- }
- else {
- //ellipsoid
- var sinphi = Math.sin(phi);
- var cosphi = Math.cos(phi);
- var nl = gN(this.a, this.e, sinphi);
- var tl = Math.tan(phi) * Math.tan(phi);
- var al = lam * Math.cos(phi);
- var asq = al * al;
- var cl = this.es * cosphi * cosphi / (1 - this.es);
- var ml = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, phi);
- x = nl * al * (1 - asq * tl * (1 / 6 - (8 - tl + 8 * cl) * asq / 120));
- y = ml - this.ml0 + nl * sinphi / cosphi * asq * (0.5 + (5 - tl + 6 * cl) * asq / 24);
- }
- p.x = x + this.x0;
- p.y = y + this.y0;
- return p;
- }
- /* Inverse equations
- -----------------*/
- function cass_inverse(p) {
- p.x -= this.x0;
- p.y -= this.y0;
- var x = p.x / this.a;
- var y = p.y / this.a;
- var phi, lam;
- if (this.sphere) {
- var dd = y + this.lat0;
- phi = Math.asin(Math.sin(dd) * Math.cos(x));
- lam = Math.atan2(Math.tan(x), Math.cos(dd));
- }
- else {
- /* ellipsoid */
- var ml1 = this.ml0 / this.a + y;
- var phi1 = imlfn(ml1, this.e0, this.e1, this.e2, this.e3);
- if (Math.abs(Math.abs(phi1) - HALF_PI) <= EPSLN) {
- p.x = this.long0;
- p.y = HALF_PI;
- if (y < 0) {
- p.y *= -1;
- }
- return p;
- }
- var nl1 = gN(this.a, this.e, Math.sin(phi1));
- var rl1 = nl1 * nl1 * nl1 / this.a / this.a * (1 - this.es);
- var tl1 = Math.pow(Math.tan(phi1), 2);
- var dl = x * this.a / nl1;
- var dsq = dl * dl;
- phi = phi1 - nl1 * Math.tan(phi1) / rl1 * dl * dl * (0.5 - (1 + 3 * tl1) * dl * dl / 24);
- lam = dl * (1 - dsq * (tl1 / 3 + (1 + 3 * tl1) * tl1 * dsq / 15)) / Math.cos(phi1);
- }
- p.x = adjust_lon(lam + this.long0);
- p.y = adjust_lat(phi);
- return p;
- }
- var cass_names = ["Cassini", "Cassini_Soldner", "cass"];
- /* harmony default export */ const cass = ({
- init: cass_init,
- forward: cass_forward,
- inverse: cass_inverse,
- names: cass_names
- });
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/qsfnz.js
- /* harmony default export */ function qsfnz(eccent, sinphi) {
- var con;
- if (eccent > 1.0e-7) {
- con = eccent * sinphi;
- return ((1 - eccent * eccent) * (sinphi / (1 - con * con) - (0.5 / eccent) * Math.log((1 - con) / (1 + con))));
- }
- else {
- return (2 * sinphi);
- }
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/laea.js
- /*
- reference
- "New Equal-Area Map Projections for Noncircular Regions", John P. Snyder,
- The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355.
- */
- var S_POLE = 1;
- var N_POLE = 2;
- var EQUIT = 3;
- var OBLIQ = 4;
- /* Initialize the Lambert Azimuthal Equal Area projection
- ------------------------------------------------------*/
- function laea_init() {
- var t = Math.abs(this.lat0);
- if (Math.abs(t - HALF_PI) < EPSLN) {
- this.mode = this.lat0 < 0 ? this.S_POLE : this.N_POLE;
- }
- else if (Math.abs(t) < EPSLN) {
- this.mode = this.EQUIT;
- }
- else {
- this.mode = this.OBLIQ;
- }
- if (this.es > 0) {
- var sinphi;
- this.qp = qsfnz(this.e, 1);
- this.mmf = 0.5 / (1 - this.es);
- this.apa = authset(this.es);
- switch (this.mode) {
- case this.N_POLE:
- this.dd = 1;
- break;
- case this.S_POLE:
- this.dd = 1;
- break;
- case this.EQUIT:
- this.rq = Math.sqrt(0.5 * this.qp);
- this.dd = 1 / this.rq;
- this.xmf = 1;
- this.ymf = 0.5 * this.qp;
- break;
- case this.OBLIQ:
- this.rq = Math.sqrt(0.5 * this.qp);
- sinphi = Math.sin(this.lat0);
- this.sinb1 = qsfnz(this.e, sinphi) / this.qp;
- this.cosb1 = Math.sqrt(1 - this.sinb1 * this.sinb1);
- this.dd = Math.cos(this.lat0) / (Math.sqrt(1 - this.es * sinphi * sinphi) * this.rq * this.cosb1);
- this.ymf = (this.xmf = this.rq) / this.dd;
- this.xmf *= this.dd;
- break;
- }
- }
- else {
- if (this.mode === this.OBLIQ) {
- this.sinph0 = Math.sin(this.lat0);
- this.cosph0 = Math.cos(this.lat0);
- }
- }
- }
- /* Lambert Azimuthal Equal Area forward equations--mapping lat,long to x,y
- -----------------------------------------------------------------------*/
- function laea_forward(p) {
- /* Forward equations
- -----------------*/
- var x, y, coslam, sinlam, sinphi, q, sinb, cosb, b, cosphi;
- var lam = p.x;
- var phi = p.y;
- lam = adjust_lon(lam - this.long0);
- if (this.sphere) {
- sinphi = Math.sin(phi);
- cosphi = Math.cos(phi);
- coslam = Math.cos(lam);
- if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {
- y = (this.mode === this.EQUIT) ? 1 + cosphi * coslam : 1 + this.sinph0 * sinphi + this.cosph0 * cosphi * coslam;
- if (y <= EPSLN) {
- return null;
- }
- y = Math.sqrt(2 / y);
- x = y * cosphi * Math.sin(lam);
- y *= (this.mode === this.EQUIT) ? sinphi : this.cosph0 * sinphi - this.sinph0 * cosphi * coslam;
- }
- else if (this.mode === this.N_POLE || this.mode === this.S_POLE) {
- if (this.mode === this.N_POLE) {
- coslam = -coslam;
- }
- if (Math.abs(phi + this.lat0) < EPSLN) {
- return null;
- }
- y = FORTPI - phi * 0.5;
- y = 2 * ((this.mode === this.S_POLE) ? Math.cos(y) : Math.sin(y));
- x = y * Math.sin(lam);
- y *= coslam;
- }
- }
- else {
- sinb = 0;
- cosb = 0;
- b = 0;
- coslam = Math.cos(lam);
- sinlam = Math.sin(lam);
- sinphi = Math.sin(phi);
- q = qsfnz(this.e, sinphi);
- if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {
- sinb = q / this.qp;
- cosb = Math.sqrt(1 - sinb * sinb);
- }
- switch (this.mode) {
- case this.OBLIQ:
- b = 1 + this.sinb1 * sinb + this.cosb1 * cosb * coslam;
- break;
- case this.EQUIT:
- b = 1 + cosb * coslam;
- break;
- case this.N_POLE:
- b = HALF_PI + phi;
- q = this.qp - q;
- break;
- case this.S_POLE:
- b = phi - HALF_PI;
- q = this.qp + q;
- break;
- }
- if (Math.abs(b) < EPSLN) {
- return null;
- }
- switch (this.mode) {
- case this.OBLIQ:
- case this.EQUIT:
- b = Math.sqrt(2 / b);
- if (this.mode === this.OBLIQ) {
- y = this.ymf * b * (this.cosb1 * sinb - this.sinb1 * cosb * coslam);
- }
- else {
- y = (b = Math.sqrt(2 / (1 + cosb * coslam))) * sinb * this.ymf;
- }
- x = this.xmf * b * cosb * sinlam;
- break;
- case this.N_POLE:
- case this.S_POLE:
- if (q >= 0) {
- x = (b = Math.sqrt(q)) * sinlam;
- y = coslam * ((this.mode === this.S_POLE) ? b : -b);
- }
- else {
- x = y = 0;
- }
- break;
- }
- }
- p.x = this.a * x + this.x0;
- p.y = this.a * y + this.y0;
- return p;
- }
- /* Inverse equations
- -----------------*/
- function laea_inverse(p) {
- p.x -= this.x0;
- p.y -= this.y0;
- var x = p.x / this.a;
- var y = p.y / this.a;
- var lam, phi, cCe, sCe, q, rho, ab;
- if (this.sphere) {
- var cosz = 0,
- rh, sinz = 0;
- rh = Math.sqrt(x * x + y * y);
- phi = rh * 0.5;
- if (phi > 1) {
- return null;
- }
- phi = 2 * Math.asin(phi);
- if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {
- sinz = Math.sin(phi);
- cosz = Math.cos(phi);
- }
- switch (this.mode) {
- case this.EQUIT:
- phi = (Math.abs(rh) <= EPSLN) ? 0 : Math.asin(y * sinz / rh);
- x *= sinz;
- y = cosz * rh;
- break;
- case this.OBLIQ:
- phi = (Math.abs(rh) <= EPSLN) ? this.lat0 : Math.asin(cosz * this.sinph0 + y * sinz * this.cosph0 / rh);
- x *= sinz * this.cosph0;
- y = (cosz - Math.sin(phi) * this.sinph0) * rh;
- break;
- case this.N_POLE:
- y = -y;
- phi = HALF_PI - phi;
- break;
- case this.S_POLE:
- phi -= HALF_PI;
- break;
- }
- lam = (y === 0 && (this.mode === this.EQUIT || this.mode === this.OBLIQ)) ? 0 : Math.atan2(x, y);
- }
- else {
- ab = 0;
- if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {
- x /= this.dd;
- y *= this.dd;
- rho = Math.sqrt(x * x + y * y);
- if (rho < EPSLN) {
- p.x = this.long0;
- p.y = this.lat0;
- return p;
- }
- sCe = 2 * Math.asin(0.5 * rho / this.rq);
- cCe = Math.cos(sCe);
- x *= (sCe = Math.sin(sCe));
- if (this.mode === this.OBLIQ) {
- ab = cCe * this.sinb1 + y * sCe * this.cosb1 / rho;
- q = this.qp * ab;
- y = rho * this.cosb1 * cCe - y * this.sinb1 * sCe;
- }
- else {
- ab = y * sCe / rho;
- q = this.qp * ab;
- y = rho * cCe;
- }
- }
- else if (this.mode === this.N_POLE || this.mode === this.S_POLE) {
- if (this.mode === this.N_POLE) {
- y = -y;
- }
- q = (x * x + y * y);
- if (!q) {
- p.x = this.long0;
- p.y = this.lat0;
- return p;
- }
- ab = 1 - q / this.qp;
- if (this.mode === this.S_POLE) {
- ab = -ab;
- }
- }
- lam = Math.atan2(x, y);
- phi = authlat(Math.asin(ab), this.apa);
- }
- p.x = adjust_lon(this.long0 + lam);
- p.y = phi;
- return p;
- }
- /* determine latitude from authalic latitude */
- var P00 = 0.33333333333333333333;
- var P01 = 0.17222222222222222222;
- var P02 = 0.10257936507936507936;
- var P10 = 0.06388888888888888888;
- var P11 = 0.06640211640211640211;
- var P20 = 0.01641501294219154443;
- function authset(es) {
- var t;
- var APA = [];
- APA[0] = es * P00;
- t = es * es;
- APA[0] += t * P01;
- APA[1] = t * P10;
- t *= es;
- APA[0] += t * P02;
- APA[1] += t * P11;
- APA[2] = t * P20;
- return APA;
- }
- function authlat(beta, APA) {
- var t = beta + beta;
- return (beta + APA[0] * Math.sin(t) + APA[1] * Math.sin(t + t) + APA[2] * Math.sin(t + t + t));
- }
- var laea_names = ["Lambert Azimuthal Equal Area", "Lambert_Azimuthal_Equal_Area", "laea"];
- /* harmony default export */ const laea = ({
- init: laea_init,
- forward: laea_forward,
- inverse: laea_inverse,
- names: laea_names,
- S_POLE: S_POLE,
- N_POLE: N_POLE,
- EQUIT: EQUIT,
- OBLIQ: OBLIQ
- });
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/asinz.js
- /* harmony default export */ function asinz(x) {
- if (Math.abs(x) > 1) {
- x = (x > 1) ? 1 : -1;
- }
- return Math.asin(x);
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/aea.js
- function aea_init() {
- if (Math.abs(this.lat1 + this.lat2) < EPSLN) {
- return;
- }
- this.temp = this.b / this.a;
- this.es = 1 - Math.pow(this.temp, 2);
- this.e3 = Math.sqrt(this.es);
- this.sin_po = Math.sin(this.lat1);
- this.cos_po = Math.cos(this.lat1);
- this.t1 = this.sin_po;
- this.con = this.sin_po;
- this.ms1 = msfnz(this.e3, this.sin_po, this.cos_po);
- this.qs1 = qsfnz(this.e3, this.sin_po, this.cos_po);
- this.sin_po = Math.sin(this.lat2);
- this.cos_po = Math.cos(this.lat2);
- this.t2 = this.sin_po;
- this.ms2 = msfnz(this.e3, this.sin_po, this.cos_po);
- this.qs2 = qsfnz(this.e3, this.sin_po, this.cos_po);
- this.sin_po = Math.sin(this.lat0);
- this.cos_po = Math.cos(this.lat0);
- this.t3 = this.sin_po;
- this.qs0 = qsfnz(this.e3, this.sin_po, this.cos_po);
- if (Math.abs(this.lat1 - this.lat2) > EPSLN) {
- this.ns0 = (this.ms1 * this.ms1 - this.ms2 * this.ms2) / (this.qs2 - this.qs1);
- }
- else {
- this.ns0 = this.con;
- }
- this.c = this.ms1 * this.ms1 + this.ns0 * this.qs1;
- this.rh = this.a * Math.sqrt(this.c - this.ns0 * this.qs0) / this.ns0;
- }
- /* Albers Conical Equal Area forward equations--mapping lat,long to x,y
- -------------------------------------------------------------------*/
- function aea_forward(p) {
- var lon = p.x;
- var lat = p.y;
- this.sin_phi = Math.sin(lat);
- this.cos_phi = Math.cos(lat);
- var qs = qsfnz(this.e3, this.sin_phi, this.cos_phi);
- var rh1 = this.a * Math.sqrt(this.c - this.ns0 * qs) / this.ns0;
- var theta = this.ns0 * adjust_lon(lon - this.long0);
- var x = rh1 * Math.sin(theta) + this.x0;
- var y = this.rh - rh1 * Math.cos(theta) + this.y0;
- p.x = x;
- p.y = y;
- return p;
- }
- function aea_inverse(p) {
- var rh1, qs, con, theta, lon, lat;
- p.x -= this.x0;
- p.y = this.rh - p.y + this.y0;
- if (this.ns0 >= 0) {
- rh1 = Math.sqrt(p.x * p.x + p.y * p.y);
- con = 1;
- }
- else {
- rh1 = -Math.sqrt(p.x * p.x + p.y * p.y);
- con = -1;
- }
- theta = 0;
- if (rh1 !== 0) {
- theta = Math.atan2(con * p.x, con * p.y);
- }
- con = rh1 * this.ns0 / this.a;
- if (this.sphere) {
- lat = Math.asin((this.c - con * con) / (2 * this.ns0));
- }
- else {
- qs = (this.c - con * con) / this.ns0;
- lat = this.phi1z(this.e3, qs);
- }
- lon = adjust_lon(theta / this.ns0 + this.long0);
- p.x = lon;
- p.y = lat;
- return p;
- }
- /* Function to compute phi1, the latitude for the inverse of the
- Albers Conical Equal-Area projection.
- -------------------------------------------*/
- function phi1z(eccent, qs) {
- var sinphi, cosphi, con, com, dphi;
- var phi = asinz(0.5 * qs);
- if (eccent < EPSLN) {
- return phi;
- }
- var eccnts = eccent * eccent;
- for (var i = 1; i <= 25; i++) {
- sinphi = Math.sin(phi);
- cosphi = Math.cos(phi);
- con = eccent * sinphi;
- com = 1 - con * con;
- dphi = 0.5 * com * com / cosphi * (qs / (1 - eccnts) - sinphi / com + 0.5 / eccent * Math.log((1 - con) / (1 + con)));
- phi = phi + dphi;
- if (Math.abs(dphi) <= 1e-7) {
- return phi;
- }
- }
- return null;
- }
- var aea_names = ["Albers_Conic_Equal_Area", "Albers", "aea"];
- /* harmony default export */ const aea = ({
- init: aea_init,
- forward: aea_forward,
- inverse: aea_inverse,
- names: aea_names,
- phi1z: phi1z
- });
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/gnom.js
- /*
- reference:
- Wolfram Mathworld "Gnomonic Projection"
- http://mathworld.wolfram.com/GnomonicProjection.html
- Accessed: 12th November 2009
- */
- function gnom_init() {
- /* Place parameters in static storage for common use
- -------------------------------------------------*/
- this.sin_p14 = Math.sin(this.lat0);
- this.cos_p14 = Math.cos(this.lat0);
- // Approximation for projecting points to the horizon (infinity)
- this.infinity_dist = 1000 * this.a;
- this.rc = 1;
- }
- /* Gnomonic forward equations--mapping lat,long to x,y
- ---------------------------------------------------*/
- function gnom_forward(p) {
- var sinphi, cosphi; /* sin and cos value */
- var dlon; /* delta longitude value */
- var coslon; /* cos of longitude */
- var ksp; /* scale factor */
- var g;
- var x, y;
- var lon = p.x;
- var lat = p.y;
- /* Forward equations
- -----------------*/
- dlon = adjust_lon(lon - this.long0);
- sinphi = Math.sin(lat);
- cosphi = Math.cos(lat);
- coslon = Math.cos(dlon);
- g = this.sin_p14 * sinphi + this.cos_p14 * cosphi * coslon;
- ksp = 1;
- if ((g > 0) || (Math.abs(g) <= EPSLN)) {
- x = this.x0 + this.a * ksp * cosphi * Math.sin(dlon) / g;
- y = this.y0 + this.a * ksp * (this.cos_p14 * sinphi - this.sin_p14 * cosphi * coslon) / g;
- }
- else {
- // Point is in the opposing hemisphere and is unprojectable
- // We still need to return a reasonable point, so we project
- // to infinity, on a bearing
- // equivalent to the northern hemisphere equivalent
- // This is a reasonable approximation for short shapes and lines that
- // straddle the horizon.
- x = this.x0 + this.infinity_dist * cosphi * Math.sin(dlon);
- y = this.y0 + this.infinity_dist * (this.cos_p14 * sinphi - this.sin_p14 * cosphi * coslon);
- }
- p.x = x;
- p.y = y;
- return p;
- }
- function gnom_inverse(p) {
- var rh; /* Rho */
- var sinc, cosc;
- var c;
- var lon, lat;
- /* Inverse equations
- -----------------*/
- p.x = (p.x - this.x0) / this.a;
- p.y = (p.y - this.y0) / this.a;
- p.x /= this.k0;
- p.y /= this.k0;
- if ((rh = Math.sqrt(p.x * p.x + p.y * p.y))) {
- c = Math.atan2(rh, this.rc);
- sinc = Math.sin(c);
- cosc = Math.cos(c);
- lat = asinz(cosc * this.sin_p14 + (p.y * sinc * this.cos_p14) / rh);
- lon = Math.atan2(p.x * sinc, rh * this.cos_p14 * cosc - p.y * this.sin_p14 * sinc);
- lon = adjust_lon(this.long0 + lon);
- }
- else {
- lat = this.phic0;
- lon = 0;
- }
- p.x = lon;
- p.y = lat;
- return p;
- }
- var gnom_names = ["gnom"];
- /* harmony default export */ const gnom = ({
- init: gnom_init,
- forward: gnom_forward,
- inverse: gnom_inverse,
- names: gnom_names
- });
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/iqsfnz.js
- /* harmony default export */ function iqsfnz(eccent, q) {
- var temp = 1 - (1 - eccent * eccent) / (2 * eccent) * Math.log((1 - eccent) / (1 + eccent));
- if (Math.abs(Math.abs(q) - temp) < 1.0E-6) {
- if (q < 0) {
- return (-1 * HALF_PI);
- }
- else {
- return HALF_PI;
- }
- }
- //var phi = 0.5* q/(1-eccent*eccent);
- var phi = Math.asin(0.5 * q);
- var dphi;
- var sin_phi;
- var cos_phi;
- var con;
- for (var i = 0; i < 30; i++) {
- sin_phi = Math.sin(phi);
- cos_phi = Math.cos(phi);
- con = eccent * sin_phi;
- dphi = Math.pow(1 - con * con, 2) / (2 * cos_phi) * (q / (1 - eccent * eccent) - sin_phi / (1 - con * con) + 0.5 / eccent * Math.log((1 - con) / (1 + con)));
- phi += dphi;
- if (Math.abs(dphi) <= 0.0000000001) {
- return phi;
- }
- }
- //console.log("IQSFN-CONV:Latitude failed to converge after 30 iterations");
- return NaN;
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/cea.js
- /*
- reference:
- "Cartographic Projection Procedures for the UNIX Environment-
- A User's Manual" by Gerald I. Evenden,
- USGS Open File Report 90-284and Release 4 Interim Reports (2003)
- */
- function cea_init() {
- //no-op
- if (!this.sphere) {
- this.k0 = msfnz(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts));
- }
- }
- /* Cylindrical Equal Area forward equations--mapping lat,long to x,y
- ------------------------------------------------------------*/
- function cea_forward(p) {
- var lon = p.x;
- var lat = p.y;
- var x, y;
- /* Forward equations
- -----------------*/
- var dlon = adjust_lon(lon - this.long0);
- if (this.sphere) {
- x = this.x0 + this.a * dlon * Math.cos(this.lat_ts);
- y = this.y0 + this.a * Math.sin(lat) / Math.cos(this.lat_ts);
- }
- else {
- var qs = qsfnz(this.e, Math.sin(lat));
- x = this.x0 + this.a * this.k0 * dlon;
- y = this.y0 + this.a * qs * 0.5 / this.k0;
- }
- p.x = x;
- p.y = y;
- return p;
- }
- /* Cylindrical Equal Area inverse equations--mapping x,y to lat/long
- ------------------------------------------------------------*/
- function cea_inverse(p) {
- p.x -= this.x0;
- p.y -= this.y0;
- var lon, lat;
- if (this.sphere) {
- lon = adjust_lon(this.long0 + (p.x / this.a) / Math.cos(this.lat_ts));
- lat = Math.asin((p.y / this.a) * Math.cos(this.lat_ts));
- }
- else {
- lat = iqsfnz(this.e, 2 * p.y * this.k0 / this.a);
- lon = adjust_lon(this.long0 + p.x / (this.a * this.k0));
- }
- p.x = lon;
- p.y = lat;
- return p;
- }
- var cea_names = ["cea"];
- /* harmony default export */ const cea = ({
- init: cea_init,
- forward: cea_forward,
- inverse: cea_inverse,
- names: cea_names
- });
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/eqc.js
- function eqc_init() {
- this.x0 = this.x0 || 0;
- this.y0 = this.y0 || 0;
- this.lat0 = this.lat0 || 0;
- this.long0 = this.long0 || 0;
- this.lat_ts = this.lat_ts || 0;
- this.title = this.title || "Equidistant Cylindrical (Plate Carre)";
- this.rc = Math.cos(this.lat_ts);
- }
- // forward equations--mapping lat,long to x,y
- // -----------------------------------------------------------------
- function eqc_forward(p) {
- var lon = p.x;
- var lat = p.y;
- var dlon = adjust_lon(lon - this.long0);
- var dlat = adjust_lat(lat - this.lat0);
- p.x = this.x0 + (this.a * dlon * this.rc);
- p.y = this.y0 + (this.a * dlat);
- return p;
- }
- // inverse equations--mapping x,y to lat/long
- // -----------------------------------------------------------------
- function eqc_inverse(p) {
- var x = p.x;
- var y = p.y;
- p.x = adjust_lon(this.long0 + ((x - this.x0) / (this.a * this.rc)));
- p.y = adjust_lat(this.lat0 + ((y - this.y0) / (this.a)));
- return p;
- }
- var eqc_names = ["Equirectangular", "Equidistant_Cylindrical", "eqc"];
- /* harmony default export */ const eqc = ({
- init: eqc_init,
- forward: eqc_forward,
- inverse: eqc_inverse,
- names: eqc_names
- });
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/poly.js
- var poly_MAX_ITER = 20;
- function poly_init() {
- /* Place parameters in static storage for common use
- -------------------------------------------------*/
- this.temp = this.b / this.a;
- this.es = 1 - Math.pow(this.temp, 2); // devait etre dans tmerc.js mais n y est pas donc je commente sinon retour de valeurs nulles
- this.e = Math.sqrt(this.es);
- this.e0 = e0fn(this.es);
- this.e1 = e1fn(this.es);
- this.e2 = e2fn(this.es);
- this.e3 = e3fn(this.es);
- this.ml0 = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, this.lat0); //si que des zeros le calcul ne se fait pas
- }
- /* Polyconic forward equations--mapping lat,long to x,y
- ---------------------------------------------------*/
- function poly_forward(p) {
- var lon = p.x;
- var lat = p.y;
- var x, y, el;
- var dlon = adjust_lon(lon - this.long0);
- el = dlon * Math.sin(lat);
- if (this.sphere) {
- if (Math.abs(lat) <= EPSLN) {
- x = this.a * dlon;
- y = -1 * this.a * this.lat0;
- }
- else {
- x = this.a * Math.sin(el) / Math.tan(lat);
- y = this.a * (adjust_lat(lat - this.lat0) + (1 - Math.cos(el)) / Math.tan(lat));
- }
- }
- else {
- if (Math.abs(lat) <= EPSLN) {
- x = this.a * dlon;
- y = -1 * this.ml0;
- }
- else {
- var nl = gN(this.a, this.e, Math.sin(lat)) / Math.tan(lat);
- x = nl * Math.sin(el);
- y = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, lat) - this.ml0 + nl * (1 - Math.cos(el));
- }
- }
- p.x = x + this.x0;
- p.y = y + this.y0;
- return p;
- }
- /* Inverse equations
- -----------------*/
- function poly_inverse(p) {
- var lon, lat, x, y, i;
- var al, bl;
- var phi, dphi;
- x = p.x - this.x0;
- y = p.y - this.y0;
- if (this.sphere) {
- if (Math.abs(y + this.a * this.lat0) <= EPSLN) {
- lon = adjust_lon(x / this.a + this.long0);
- lat = 0;
- }
- else {
- al = this.lat0 + y / this.a;
- bl = x * x / this.a / this.a + al * al;
- phi = al;
- var tanphi;
- for (i = poly_MAX_ITER; i; --i) {
- tanphi = Math.tan(phi);
- dphi = -1 * (al * (phi * tanphi + 1) - phi - 0.5 * (phi * phi + bl) * tanphi) / ((phi - al) / tanphi - 1);
- phi += dphi;
- if (Math.abs(dphi) <= EPSLN) {
- lat = phi;
- break;
- }
- }
- lon = adjust_lon(this.long0 + (Math.asin(x * Math.tan(phi) / this.a)) / Math.sin(lat));
- }
- }
- else {
- if (Math.abs(y + this.ml0) <= EPSLN) {
- lat = 0;
- lon = adjust_lon(this.long0 + x / this.a);
- }
- else {
- al = (this.ml0 + y) / this.a;
- bl = x * x / this.a / this.a + al * al;
- phi = al;
- var cl, mln, mlnp, ma;
- var con;
- for (i = poly_MAX_ITER; i; --i) {
- con = this.e * Math.sin(phi);
- cl = Math.sqrt(1 - con * con) * Math.tan(phi);
- mln = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, phi);
- mlnp = this.e0 - 2 * this.e1 * Math.cos(2 * phi) + 4 * this.e2 * Math.cos(4 * phi) - 6 * this.e3 * Math.cos(6 * phi);
- ma = mln / this.a;
- dphi = (al * (cl * ma + 1) - ma - 0.5 * cl * (ma * ma + bl)) / (this.es * Math.sin(2 * phi) * (ma * ma + bl - 2 * al * ma) / (4 * cl) + (al - ma) * (cl * mlnp - 2 / Math.sin(2 * phi)) - mlnp);
- phi -= dphi;
- if (Math.abs(dphi) <= EPSLN) {
- lat = phi;
- break;
- }
- }
- //lat=phi4z(this.e,this.e0,this.e1,this.e2,this.e3,al,bl,0,0);
- cl = Math.sqrt(1 - this.es * Math.pow(Math.sin(lat), 2)) * Math.tan(lat);
- lon = adjust_lon(this.long0 + Math.asin(x * cl / this.a) / Math.sin(lat));
- }
- }
- p.x = lon;
- p.y = lat;
- return p;
- }
- var poly_names = ["Polyconic", "poly"];
- /* harmony default export */ const poly = ({
- init: poly_init,
- forward: poly_forward,
- inverse: poly_inverse,
- names: poly_names
- });
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/nzmg.js
- /*
- reference
- Department of Land and Survey Technical Circular 1973/32
- http://www.linz.govt.nz/docs/miscellaneous/nz-map-definition.pdf
- OSG Technical Report 4.1
- http://www.linz.govt.nz/docs/miscellaneous/nzmg.pdf
- */
- /**
- * iterations: Number of iterations to refine inverse transform.
- * 0 -> km accuracy
- * 1 -> m accuracy -- suitable for most mapping applications
- * 2 -> mm accuracy
- */
- var iterations = 1;
- function nzmg_init() {
- this.A = [];
- this.A[1] = 0.6399175073;
- this.A[2] = -0.1358797613;
- this.A[3] = 0.063294409;
- this.A[4] = -0.02526853;
- this.A[5] = 0.0117879;
- this.A[6] = -0.0055161;
- this.A[7] = 0.0026906;
- this.A[8] = -0.001333;
- this.A[9] = 0.00067;
- this.A[10] = -0.00034;
- this.B_re = [];
- this.B_im = [];
- this.B_re[1] = 0.7557853228;
- this.B_im[1] = 0;
- this.B_re[2] = 0.249204646;
- this.B_im[2] = 0.003371507;
- this.B_re[3] = -0.001541739;
- this.B_im[3] = 0.041058560;
- this.B_re[4] = -0.10162907;
- this.B_im[4] = 0.01727609;
- this.B_re[5] = -0.26623489;
- this.B_im[5] = -0.36249218;
- this.B_re[6] = -0.6870983;
- this.B_im[6] = -1.1651967;
- this.C_re = [];
- this.C_im = [];
- this.C_re[1] = 1.3231270439;
- this.C_im[1] = 0;
- this.C_re[2] = -0.577245789;
- this.C_im[2] = -0.007809598;
- this.C_re[3] = 0.508307513;
- this.C_im[3] = -0.112208952;
- this.C_re[4] = -0.15094762;
- this.C_im[4] = 0.18200602;
- this.C_re[5] = 1.01418179;
- this.C_im[5] = 1.64497696;
- this.C_re[6] = 1.9660549;
- this.C_im[6] = 2.5127645;
- this.D = [];
- this.D[1] = 1.5627014243;
- this.D[2] = 0.5185406398;
- this.D[3] = -0.03333098;
- this.D[4] = -0.1052906;
- this.D[5] = -0.0368594;
- this.D[6] = 0.007317;
- this.D[7] = 0.01220;
- this.D[8] = 0.00394;
- this.D[9] = -0.0013;
- }
- /**
- New Zealand Map Grid Forward - long/lat to x/y
- long/lat in radians
- */
- function nzmg_forward(p) {
- var n;
- var lon = p.x;
- var lat = p.y;
- var delta_lat = lat - this.lat0;
- var delta_lon = lon - this.long0;
- // 1. Calculate d_phi and d_psi ... // and d_lambda
- // For this algorithm, delta_latitude is in seconds of arc x 10-5, so we need to scale to those units. Longitude is radians.
- var d_phi = delta_lat / SEC_TO_RAD * 1E-5;
- var d_lambda = delta_lon;
- var d_phi_n = 1; // d_phi^0
- var d_psi = 0;
- for (n = 1; n <= 10; n++) {
- d_phi_n = d_phi_n * d_phi;
- d_psi = d_psi + this.A[n] * d_phi_n;
- }
- // 2. Calculate theta
- var th_re = d_psi;
- var th_im = d_lambda;
- // 3. Calculate z
- var th_n_re = 1;
- var th_n_im = 0; // theta^0
- var th_n_re1;
- var th_n_im1;
- var z_re = 0;
- var z_im = 0;
- for (n = 1; n <= 6; n++) {
- th_n_re1 = th_n_re * th_re - th_n_im * th_im;
- th_n_im1 = th_n_im * th_re + th_n_re * th_im;
- th_n_re = th_n_re1;
- th_n_im = th_n_im1;
- z_re = z_re + this.B_re[n] * th_n_re - this.B_im[n] * th_n_im;
- z_im = z_im + this.B_im[n] * th_n_re + this.B_re[n] * th_n_im;
- }
- // 4. Calculate easting and northing
- p.x = (z_im * this.a) + this.x0;
- p.y = (z_re * this.a) + this.y0;
- return p;
- }
- /**
- New Zealand Map Grid Inverse - x/y to long/lat
- */
- function nzmg_inverse(p) {
- var n;
- var x = p.x;
- var y = p.y;
- var delta_x = x - this.x0;
- var delta_y = y - this.y0;
- // 1. Calculate z
- var z_re = delta_y / this.a;
- var z_im = delta_x / this.a;
- // 2a. Calculate theta - first approximation gives km accuracy
- var z_n_re = 1;
- var z_n_im = 0; // z^0
- var z_n_re1;
- var z_n_im1;
- var th_re = 0;
- var th_im = 0;
- for (n = 1; n <= 6; n++) {
- z_n_re1 = z_n_re * z_re - z_n_im * z_im;
- z_n_im1 = z_n_im * z_re + z_n_re * z_im;
- z_n_re = z_n_re1;
- z_n_im = z_n_im1;
- th_re = th_re + this.C_re[n] * z_n_re - this.C_im[n] * z_n_im;
- th_im = th_im + this.C_im[n] * z_n_re + this.C_re[n] * z_n_im;
- }
- // 2b. Iterate to refine the accuracy of the calculation
- // 0 iterations gives km accuracy
- // 1 iteration gives m accuracy -- good enough for most mapping applications
- // 2 iterations bives mm accuracy
- for (var i = 0; i < this.iterations; i++) {
- var th_n_re = th_re;
- var th_n_im = th_im;
- var th_n_re1;
- var th_n_im1;
- var num_re = z_re;
- var num_im = z_im;
- for (n = 2; n <= 6; n++) {
- th_n_re1 = th_n_re * th_re - th_n_im * th_im;
- th_n_im1 = th_n_im * th_re + th_n_re * th_im;
- th_n_re = th_n_re1;
- th_n_im = th_n_im1;
- num_re = num_re + (n - 1) * (this.B_re[n] * th_n_re - this.B_im[n] * th_n_im);
- num_im = num_im + (n - 1) * (this.B_im[n] * th_n_re + this.B_re[n] * th_n_im);
- }
- th_n_re = 1;
- th_n_im = 0;
- var den_re = this.B_re[1];
- var den_im = this.B_im[1];
- for (n = 2; n <= 6; n++) {
- th_n_re1 = th_n_re * th_re - th_n_im * th_im;
- th_n_im1 = th_n_im * th_re + th_n_re * th_im;
- th_n_re = th_n_re1;
- th_n_im = th_n_im1;
- den_re = den_re + n * (this.B_re[n] * th_n_re - this.B_im[n] * th_n_im);
- den_im = den_im + n * (this.B_im[n] * th_n_re + this.B_re[n] * th_n_im);
- }
- // Complex division
- var den2 = den_re * den_re + den_im * den_im;
- th_re = (num_re * den_re + num_im * den_im) / den2;
- th_im = (num_im * den_re - num_re * den_im) / den2;
- }
- // 3. Calculate d_phi ... // and d_lambda
- var d_psi = th_re;
- var d_lambda = th_im;
- var d_psi_n = 1; // d_psi^0
- var d_phi = 0;
- for (n = 1; n <= 9; n++) {
- d_psi_n = d_psi_n * d_psi;
- d_phi = d_phi + this.D[n] * d_psi_n;
- }
- // 4. Calculate latitude and longitude
- // d_phi is calcuated in second of arc * 10^-5, so we need to scale back to radians. d_lambda is in radians.
- var lat = this.lat0 + (d_phi * SEC_TO_RAD * 1E5);
- var lon = this.long0 + d_lambda;
- p.x = lon;
- p.y = lat;
- return p;
- }
- var nzmg_names = ["New_Zealand_Map_Grid", "nzmg"];
- /* harmony default export */ const nzmg = ({
- init: nzmg_init,
- forward: nzmg_forward,
- inverse: nzmg_inverse,
- names: nzmg_names
- });
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/mill.js
- /*
- reference
- "New Equal-Area Map Projections for Noncircular Regions", John P. Snyder,
- The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355.
- */
- /* Initialize the Miller Cylindrical projection
- -------------------------------------------*/
- function mill_init() {
- //no-op
- }
- /* Miller Cylindrical forward equations--mapping lat,long to x,y
- ------------------------------------------------------------*/
- function mill_forward(p) {
- var lon = p.x;
- var lat = p.y;
- /* Forward equations
- -----------------*/
- var dlon = adjust_lon(lon - this.long0);
- var x = this.x0 + this.a * dlon;
- var y = this.y0 + this.a * Math.log(Math.tan((Math.PI / 4) + (lat / 2.5))) * 1.25;
- p.x = x;
- p.y = y;
- return p;
- }
- /* Miller Cylindrical inverse equations--mapping x,y to lat/long
- ------------------------------------------------------------*/
- function mill_inverse(p) {
- p.x -= this.x0;
- p.y -= this.y0;
- var lon = adjust_lon(this.long0 + p.x / this.a);
- var lat = 2.5 * (Math.atan(Math.exp(0.8 * p.y / this.a)) - Math.PI / 4);
- p.x = lon;
- p.y = lat;
- return p;
- }
- var mill_names = ["Miller_Cylindrical", "mill"];
- /* harmony default export */ const mill = ({
- init: mill_init,
- forward: mill_forward,
- inverse: mill_inverse,
- names: mill_names
- });
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/sinu.js
- var sinu_MAX_ITER = 20;
- function sinu_init() {
- /* Place parameters in static storage for common use
- -------------------------------------------------*/
- if (!this.sphere) {
- this.en = pj_enfn(this.es);
- }
- else {
- this.n = 1;
- this.m = 0;
- this.es = 0;
- this.C_y = Math.sqrt((this.m + 1) / this.n);
- this.C_x = this.C_y / (this.m + 1);
- }
- }
- /* Sinusoidal forward equations--mapping lat,long to x,y
- -----------------------------------------------------*/
- function sinu_forward(p) {
- var x, y;
- var lon = p.x;
- var lat = p.y;
- /* Forward equations
- -----------------*/
- lon = adjust_lon(lon - this.long0);
- if (this.sphere) {
- if (!this.m) {
- lat = this.n !== 1 ? Math.asin(this.n * Math.sin(lat)) : lat;
- }
- else {
- var k = this.n * Math.sin(lat);
- for (var i = sinu_MAX_ITER; i; --i) {
- var V = (this.m * lat + Math.sin(lat) - k) / (this.m + Math.cos(lat));
- lat -= V;
- if (Math.abs(V) < EPSLN) {
- break;
- }
- }
- }
- x = this.a * this.C_x * lon * (this.m + Math.cos(lat));
- y = this.a * this.C_y * lat;
- }
- else {
- var s = Math.sin(lat);
- var c = Math.cos(lat);
- y = this.a * pj_mlfn(lat, s, c, this.en);
- x = this.a * lon * c / Math.sqrt(1 - this.es * s * s);
- }
- p.x = x;
- p.y = y;
- return p;
- }
- function sinu_inverse(p) {
- var lat, temp, lon, s;
- p.x -= this.x0;
- lon = p.x / this.a;
- p.y -= this.y0;
- lat = p.y / this.a;
- if (this.sphere) {
- lat /= this.C_y;
- lon = lon / (this.C_x * (this.m + Math.cos(lat)));
- if (this.m) {
- lat = asinz((this.m * lat + Math.sin(lat)) / this.n);
- }
- else if (this.n !== 1) {
- lat = asinz(Math.sin(lat) / this.n);
- }
- lon = adjust_lon(lon + this.long0);
- lat = adjust_lat(lat);
- }
- else {
- lat = pj_inv_mlfn(p.y / this.a, this.es, this.en);
- s = Math.abs(lat);
- if (s < HALF_PI) {
- s = Math.sin(lat);
- temp = this.long0 + p.x * Math.sqrt(1 - this.es * s * s) / (this.a * Math.cos(lat));
- //temp = this.long0 + p.x / (this.a * Math.cos(lat));
- lon = adjust_lon(temp);
- }
- else if ((s - EPSLN) < HALF_PI) {
- lon = this.long0;
- }
- }
- p.x = lon;
- p.y = lat;
- return p;
- }
- var sinu_names = ["Sinusoidal", "sinu"];
- /* harmony default export */ const sinu = ({
- init: sinu_init,
- forward: sinu_forward,
- inverse: sinu_inverse,
- names: sinu_names
- });
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/moll.js
- function moll_init() {}
- /* Mollweide forward equations--mapping lat,long to x,y
- ----------------------------------------------------*/
- function moll_forward(p) {
- /* Forward equations
- -----------------*/
- var lon = p.x;
- var lat = p.y;
- var delta_lon = adjust_lon(lon - this.long0);
- var theta = lat;
- var con = Math.PI * Math.sin(lat);
- /* Iterate using the Newton-Raphson method to find theta
- -----------------------------------------------------*/
- while (true) {
- var delta_theta = -(theta + Math.sin(theta) - con) / (1 + Math.cos(theta));
- theta += delta_theta;
- if (Math.abs(delta_theta) < EPSLN) {
- break;
- }
- }
- theta /= 2;
- /* If the latitude is 90 deg, force the x coordinate to be "0 + false easting"
- this is done here because of precision problems with "cos(theta)"
- --------------------------------------------------------------------------*/
- if (Math.PI / 2 - Math.abs(lat) < EPSLN) {
- delta_lon = 0;
- }
- var x = 0.900316316158 * this.a * delta_lon * Math.cos(theta) + this.x0;
- var y = 1.4142135623731 * this.a * Math.sin(theta) + this.y0;
- p.x = x;
- p.y = y;
- return p;
- }
- function moll_inverse(p) {
- var theta;
- var arg;
- /* Inverse equations
- -----------------*/
- p.x -= this.x0;
- p.y -= this.y0;
- arg = p.y / (1.4142135623731 * this.a);
- /* Because of division by zero problems, 'arg' can not be 1. Therefore
- a number very close to one is used instead.
- -------------------------------------------------------------------*/
- if (Math.abs(arg) > 0.999999999999) {
- arg = 0.999999999999;
- }
- theta = Math.asin(arg);
- var lon = adjust_lon(this.long0 + (p.x / (0.900316316158 * this.a * Math.cos(theta))));
- if (lon < (-Math.PI)) {
- lon = -Math.PI;
- }
- if (lon > Math.PI) {
- lon = Math.PI;
- }
- arg = (2 * theta + Math.sin(2 * theta)) / Math.PI;
- if (Math.abs(arg) > 1) {
- arg = 1;
- }
- var lat = Math.asin(arg);
- p.x = lon;
- p.y = lat;
- return p;
- }
- var moll_names = ["Mollweide", "moll"];
- /* harmony default export */ const moll = ({
- init: moll_init,
- forward: moll_forward,
- inverse: moll_inverse,
- names: moll_names
- });
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/eqdc.js
- function eqdc_init() {
- /* Place parameters in static storage for common use
- -------------------------------------------------*/
- // Standard Parallels cannot be equal and on opposite sides of the equator
- if (Math.abs(this.lat1 + this.lat2) < EPSLN) {
- return;
- }
- this.lat2 = this.lat2 || this.lat1;
- this.temp = this.b / this.a;
- this.es = 1 - Math.pow(this.temp, 2);
- this.e = Math.sqrt(this.es);
- this.e0 = e0fn(this.es);
- this.e1 = e1fn(this.es);
- this.e2 = e2fn(this.es);
- this.e3 = e3fn(this.es);
- this.sinphi = Math.sin(this.lat1);
- this.cosphi = Math.cos(this.lat1);
- this.ms1 = msfnz(this.e, this.sinphi, this.cosphi);
- this.ml1 = mlfn(this.e0, this.e1, this.e2, this.e3, this.lat1);
- if (Math.abs(this.lat1 - this.lat2) < EPSLN) {
- this.ns = this.sinphi;
- }
- else {
- this.sinphi = Math.sin(this.lat2);
- this.cosphi = Math.cos(this.lat2);
- this.ms2 = msfnz(this.e, this.sinphi, this.cosphi);
- this.ml2 = mlfn(this.e0, this.e1, this.e2, this.e3, this.lat2);
- this.ns = (this.ms1 - this.ms2) / (this.ml2 - this.ml1);
- }
- this.g = this.ml1 + this.ms1 / this.ns;
- this.ml0 = mlfn(this.e0, this.e1, this.e2, this.e3, this.lat0);
- this.rh = this.a * (this.g - this.ml0);
- }
- /* Equidistant Conic forward equations--mapping lat,long to x,y
- -----------------------------------------------------------*/
- function eqdc_forward(p) {
- var lon = p.x;
- var lat = p.y;
- var rh1;
- /* Forward equations
- -----------------*/
- if (this.sphere) {
- rh1 = this.a * (this.g - lat);
- }
- else {
- var ml = mlfn(this.e0, this.e1, this.e2, this.e3, lat);
- rh1 = this.a * (this.g - ml);
- }
- var theta = this.ns * adjust_lon(lon - this.long0);
- var x = this.x0 + rh1 * Math.sin(theta);
- var y = this.y0 + this.rh - rh1 * Math.cos(theta);
- p.x = x;
- p.y = y;
- return p;
- }
- /* Inverse equations
- -----------------*/
- function eqdc_inverse(p) {
- p.x -= this.x0;
- p.y = this.rh - p.y + this.y0;
- var con, rh1, lat, lon;
- if (this.ns >= 0) {
- rh1 = Math.sqrt(p.x * p.x + p.y * p.y);
- con = 1;
- }
- else {
- rh1 = -Math.sqrt(p.x * p.x + p.y * p.y);
- con = -1;
- }
- var theta = 0;
- if (rh1 !== 0) {
- theta = Math.atan2(con * p.x, con * p.y);
- }
- if (this.sphere) {
- lon = adjust_lon(this.long0 + theta / this.ns);
- lat = adjust_lat(this.g - rh1 / this.a);
- p.x = lon;
- p.y = lat;
- return p;
- }
- else {
- var ml = this.g - rh1 / this.a;
- lat = imlfn(ml, this.e0, this.e1, this.e2, this.e3);
- lon = adjust_lon(this.long0 + theta / this.ns);
- p.x = lon;
- p.y = lat;
- return p;
- }
- }
- var eqdc_names = ["Equidistant_Conic", "eqdc"];
- /* harmony default export */ const eqdc = ({
- init: eqdc_init,
- forward: eqdc_forward,
- inverse: eqdc_inverse,
- names: eqdc_names
- });
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/vandg.js
- /* Initialize the Van Der Grinten projection
- ----------------------------------------*/
- function vandg_init() {
- //this.R = 6370997; //Radius of earth
- this.R = this.a;
- }
- function vandg_forward(p) {
- var lon = p.x;
- var lat = p.y;
- /* Forward equations
- -----------------*/
- var dlon = adjust_lon(lon - this.long0);
- var x, y;
- if (Math.abs(lat) <= EPSLN) {
- x = this.x0 + this.R * dlon;
- y = this.y0;
- }
- var theta = asinz(2 * Math.abs(lat / Math.PI));
- if ((Math.abs(dlon) <= EPSLN) || (Math.abs(Math.abs(lat) - HALF_PI) <= EPSLN)) {
- x = this.x0;
- if (lat >= 0) {
- y = this.y0 + Math.PI * this.R * Math.tan(0.5 * theta);
- }
- else {
- y = this.y0 + Math.PI * this.R * -Math.tan(0.5 * theta);
- }
- // return(OK);
- }
- var al = 0.5 * Math.abs((Math.PI / dlon) - (dlon / Math.PI));
- var asq = al * al;
- var sinth = Math.sin(theta);
- var costh = Math.cos(theta);
- var g = costh / (sinth + costh - 1);
- var gsq = g * g;
- var m = g * (2 / sinth - 1);
- var msq = m * m;
- var con = Math.PI * this.R * (al * (g - msq) + Math.sqrt(asq * (g - msq) * (g - msq) - (msq + asq) * (gsq - msq))) / (msq + asq);
- if (dlon < 0) {
- con = -con;
- }
- x = this.x0 + con;
- //con = Math.abs(con / (Math.PI * this.R));
- var q = asq + g;
- con = Math.PI * this.R * (m * q - al * Math.sqrt((msq + asq) * (asq + 1) - q * q)) / (msq + asq);
- if (lat >= 0) {
- //y = this.y0 + Math.PI * this.R * Math.sqrt(1 - con * con - 2 * al * con);
- y = this.y0 + con;
- }
- else {
- //y = this.y0 - Math.PI * this.R * Math.sqrt(1 - con * con - 2 * al * con);
- y = this.y0 - con;
- }
- p.x = x;
- p.y = y;
- return p;
- }
- /* Van Der Grinten inverse equations--mapping x,y to lat/long
- ---------------------------------------------------------*/
- function vandg_inverse(p) {
- var lon, lat;
- var xx, yy, xys, c1, c2, c3;
- var a1;
- var m1;
- var con;
- var th1;
- var d;
- /* inverse equations
- -----------------*/
- p.x -= this.x0;
- p.y -= this.y0;
- con = Math.PI * this.R;
- xx = p.x / con;
- yy = p.y / con;
- xys = xx * xx + yy * yy;
- c1 = -Math.abs(yy) * (1 + xys);
- c2 = c1 - 2 * yy * yy + xx * xx;
- c3 = -2 * c1 + 1 + 2 * yy * yy + xys * xys;
- d = yy * yy / c3 + (2 * c2 * c2 * c2 / c3 / c3 / c3 - 9 * c1 * c2 / c3 / c3) / 27;
- a1 = (c1 - c2 * c2 / 3 / c3) / c3;
- m1 = 2 * Math.sqrt(-a1 / 3);
- con = ((3 * d) / a1) / m1;
- if (Math.abs(con) > 1) {
- if (con >= 0) {
- con = 1;
- }
- else {
- con = -1;
- }
- }
- th1 = Math.acos(con) / 3;
- if (p.y >= 0) {
- lat = (-m1 * Math.cos(th1 + Math.PI / 3) - c2 / 3 / c3) * Math.PI;
- }
- else {
- lat = -(-m1 * Math.cos(th1 + Math.PI / 3) - c2 / 3 / c3) * Math.PI;
- }
- if (Math.abs(xx) < EPSLN) {
- lon = this.long0;
- }
- else {
- lon = adjust_lon(this.long0 + Math.PI * (xys - 1 + Math.sqrt(1 + 2 * (xx * xx - yy * yy) + xys * xys)) / 2 / xx);
- }
- p.x = lon;
- p.y = lat;
- return p;
- }
- var vandg_names = ["Van_der_Grinten_I", "VanDerGrinten", "vandg"];
- /* harmony default export */ const vandg = ({
- init: vandg_init,
- forward: vandg_forward,
- inverse: vandg_inverse,
- names: vandg_names
- });
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/aeqd.js
- function aeqd_init() {
- this.sin_p12 = Math.sin(this.lat0);
- this.cos_p12 = Math.cos(this.lat0);
- }
- function aeqd_forward(p) {
- var lon = p.x;
- var lat = p.y;
- var sinphi = Math.sin(p.y);
- var cosphi = Math.cos(p.y);
- var dlon = adjust_lon(lon - this.long0);
- var e0, e1, e2, e3, Mlp, Ml, tanphi, Nl1, Nl, psi, Az, G, H, GH, Hs, c, kp, cos_c, s, s2, s3, s4, s5;
- if (this.sphere) {
- if (Math.abs(this.sin_p12 - 1) <= EPSLN) {
- //North Pole case
- p.x = this.x0 + this.a * (HALF_PI - lat) * Math.sin(dlon);
- p.y = this.y0 - this.a * (HALF_PI - lat) * Math.cos(dlon);
- return p;
- }
- else if (Math.abs(this.sin_p12 + 1) <= EPSLN) {
- //South Pole case
- p.x = this.x0 + this.a * (HALF_PI + lat) * Math.sin(dlon);
- p.y = this.y0 + this.a * (HALF_PI + lat) * Math.cos(dlon);
- return p;
- }
- else {
- //default case
- cos_c = this.sin_p12 * sinphi + this.cos_p12 * cosphi * Math.cos(dlon);
- c = Math.acos(cos_c);
- kp = c ? c / Math.sin(c) : 1;
- p.x = this.x0 + this.a * kp * cosphi * Math.sin(dlon);
- p.y = this.y0 + this.a * kp * (this.cos_p12 * sinphi - this.sin_p12 * cosphi * Math.cos(dlon));
- return p;
- }
- }
- else {
- e0 = e0fn(this.es);
- e1 = e1fn(this.es);
- e2 = e2fn(this.es);
- e3 = e3fn(this.es);
- if (Math.abs(this.sin_p12 - 1) <= EPSLN) {
- //North Pole case
- Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);
- Ml = this.a * mlfn(e0, e1, e2, e3, lat);
- p.x = this.x0 + (Mlp - Ml) * Math.sin(dlon);
- p.y = this.y0 - (Mlp - Ml) * Math.cos(dlon);
- return p;
- }
- else if (Math.abs(this.sin_p12 + 1) <= EPSLN) {
- //South Pole case
- Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);
- Ml = this.a * mlfn(e0, e1, e2, e3, lat);
- p.x = this.x0 + (Mlp + Ml) * Math.sin(dlon);
- p.y = this.y0 + (Mlp + Ml) * Math.cos(dlon);
- return p;
- }
- else {
- //Default case
- tanphi = sinphi / cosphi;
- Nl1 = gN(this.a, this.e, this.sin_p12);
- Nl = gN(this.a, this.e, sinphi);
- psi = Math.atan((1 - this.es) * tanphi + this.es * Nl1 * this.sin_p12 / (Nl * cosphi));
- Az = Math.atan2(Math.sin(dlon), this.cos_p12 * Math.tan(psi) - this.sin_p12 * Math.cos(dlon));
- if (Az === 0) {
- s = Math.asin(this.cos_p12 * Math.sin(psi) - this.sin_p12 * Math.cos(psi));
- }
- else if (Math.abs(Math.abs(Az) - Math.PI) <= EPSLN) {
- s = -Math.asin(this.cos_p12 * Math.sin(psi) - this.sin_p12 * Math.cos(psi));
- }
- else {
- s = Math.asin(Math.sin(dlon) * Math.cos(psi) / Math.sin(Az));
- }
- G = this.e * this.sin_p12 / Math.sqrt(1 - this.es);
- H = this.e * this.cos_p12 * Math.cos(Az) / Math.sqrt(1 - this.es);
- GH = G * H;
- Hs = H * H;
- s2 = s * s;
- s3 = s2 * s;
- s4 = s3 * s;
- s5 = s4 * s;
- c = Nl1 * s * (1 - s2 * Hs * (1 - Hs) / 6 + s3 / 8 * GH * (1 - 2 * Hs) + s4 / 120 * (Hs * (4 - 7 * Hs) - 3 * G * G * (1 - 7 * Hs)) - s5 / 48 * GH);
- p.x = this.x0 + c * Math.sin(Az);
- p.y = this.y0 + c * Math.cos(Az);
- return p;
- }
- }
- }
- function aeqd_inverse(p) {
- p.x -= this.x0;
- p.y -= this.y0;
- var rh, z, sinz, cosz, lon, lat, con, e0, e1, e2, e3, Mlp, M, N1, psi, Az, cosAz, tmp, A, B, D, Ee, F, sinpsi;
- if (this.sphere) {
- rh = Math.sqrt(p.x * p.x + p.y * p.y);
- if (rh > (2 * HALF_PI * this.a)) {
- return;
- }
- z = rh / this.a;
- sinz = Math.sin(z);
- cosz = Math.cos(z);
- lon = this.long0;
- if (Math.abs(rh) <= EPSLN) {
- lat = this.lat0;
- }
- else {
- lat = asinz(cosz * this.sin_p12 + (p.y * sinz * this.cos_p12) / rh);
- con = Math.abs(this.lat0) - HALF_PI;
- if (Math.abs(con) <= EPSLN) {
- if (this.lat0 >= 0) {
- lon = adjust_lon(this.long0 + Math.atan2(p.x, - p.y));
- }
- else {
- lon = adjust_lon(this.long0 - Math.atan2(-p.x, p.y));
- }
- }
- else {
- /*con = cosz - this.sin_p12 * Math.sin(lat);
- if ((Math.abs(con) < EPSLN) && (Math.abs(p.x) < EPSLN)) {
- //no-op, just keep the lon value as is
- } else {
- var temp = Math.atan2((p.x * sinz * this.cos_p12), (con * rh));
- lon = adjust_lon(this.long0 + Math.atan2((p.x * sinz * this.cos_p12), (con * rh)));
- }*/
- lon = adjust_lon(this.long0 + Math.atan2(p.x * sinz, rh * this.cos_p12 * cosz - p.y * this.sin_p12 * sinz));
- }
- }
- p.x = lon;
- p.y = lat;
- return p;
- }
- else {
- e0 = e0fn(this.es);
- e1 = e1fn(this.es);
- e2 = e2fn(this.es);
- e3 = e3fn(this.es);
- if (Math.abs(this.sin_p12 - 1) <= EPSLN) {
- //North pole case
- Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);
- rh = Math.sqrt(p.x * p.x + p.y * p.y);
- M = Mlp - rh;
- lat = imlfn(M / this.a, e0, e1, e2, e3);
- lon = adjust_lon(this.long0 + Math.atan2(p.x, - 1 * p.y));
- p.x = lon;
- p.y = lat;
- return p;
- }
- else if (Math.abs(this.sin_p12 + 1) <= EPSLN) {
- //South pole case
- Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);
- rh = Math.sqrt(p.x * p.x + p.y * p.y);
- M = rh - Mlp;
- lat = imlfn(M / this.a, e0, e1, e2, e3);
- lon = adjust_lon(this.long0 + Math.atan2(p.x, p.y));
- p.x = lon;
- p.y = lat;
- return p;
- }
- else {
- //default case
- rh = Math.sqrt(p.x * p.x + p.y * p.y);
- Az = Math.atan2(p.x, p.y);
- N1 = gN(this.a, this.e, this.sin_p12);
- cosAz = Math.cos(Az);
- tmp = this.e * this.cos_p12 * cosAz;
- A = -tmp * tmp / (1 - this.es);
- B = 3 * this.es * (1 - A) * this.sin_p12 * this.cos_p12 * cosAz / (1 - this.es);
- D = rh / N1;
- Ee = D - A * (1 + A) * Math.pow(D, 3) / 6 - B * (1 + 3 * A) * Math.pow(D, 4) / 24;
- F = 1 - A * Ee * Ee / 2 - D * Ee * Ee * Ee / 6;
- psi = Math.asin(this.sin_p12 * Math.cos(Ee) + this.cos_p12 * Math.sin(Ee) * cosAz);
- lon = adjust_lon(this.long0 + Math.asin(Math.sin(Az) * Math.sin(Ee) / Math.cos(psi)));
- sinpsi = Math.sin(psi);
- lat = Math.atan2((sinpsi - this.es * F * this.sin_p12) * Math.tan(psi), sinpsi * (1 - this.es));
- p.x = lon;
- p.y = lat;
- return p;
- }
- }
- }
- var aeqd_names = ["Azimuthal_Equidistant", "aeqd"];
- /* harmony default export */ const aeqd = ({
- init: aeqd_init,
- forward: aeqd_forward,
- inverse: aeqd_inverse,
- names: aeqd_names
- });
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/ortho.js
- function ortho_init() {
- //double temp; /* temporary variable */
- /* Place parameters in static storage for common use
- -------------------------------------------------*/
- this.sin_p14 = Math.sin(this.lat0);
- this.cos_p14 = Math.cos(this.lat0);
- }
- /* Orthographic forward equations--mapping lat,long to x,y
- ---------------------------------------------------*/
- function ortho_forward(p) {
- var sinphi, cosphi; /* sin and cos value */
- var dlon; /* delta longitude value */
- var coslon; /* cos of longitude */
- var ksp; /* scale factor */
- var g, x, y;
- var lon = p.x;
- var lat = p.y;
- /* Forward equations
- -----------------*/
- dlon = adjust_lon(lon - this.long0);
- sinphi = Math.sin(lat);
- cosphi = Math.cos(lat);
- coslon = Math.cos(dlon);
- g = this.sin_p14 * sinphi + this.cos_p14 * cosphi * coslon;
- ksp = 1;
- if ((g > 0) || (Math.abs(g) <= EPSLN)) {
- x = this.a * ksp * cosphi * Math.sin(dlon);
- y = this.y0 + this.a * ksp * (this.cos_p14 * sinphi - this.sin_p14 * cosphi * coslon);
- }
- p.x = x;
- p.y = y;
- return p;
- }
- function ortho_inverse(p) {
- var rh; /* height above ellipsoid */
- var z; /* angle */
- var sinz, cosz; /* sin of z and cos of z */
- var con;
- var lon, lat;
- /* Inverse equations
- -----------------*/
- p.x -= this.x0;
- p.y -= this.y0;
- rh = Math.sqrt(p.x * p.x + p.y * p.y);
- z = asinz(rh / this.a);
- sinz = Math.sin(z);
- cosz = Math.cos(z);
- lon = this.long0;
- if (Math.abs(rh) <= EPSLN) {
- lat = this.lat0;
- p.x = lon;
- p.y = lat;
- return p;
- }
- lat = asinz(cosz * this.sin_p14 + (p.y * sinz * this.cos_p14) / rh);
- con = Math.abs(this.lat0) - HALF_PI;
- if (Math.abs(con) <= EPSLN) {
- if (this.lat0 >= 0) {
- lon = adjust_lon(this.long0 + Math.atan2(p.x, - p.y));
- }
- else {
- lon = adjust_lon(this.long0 - Math.atan2(-p.x, p.y));
- }
- p.x = lon;
- p.y = lat;
- return p;
- }
- lon = adjust_lon(this.long0 + Math.atan2((p.x * sinz), rh * this.cos_p14 * cosz - p.y * this.sin_p14 * sinz));
- p.x = lon;
- p.y = lat;
- return p;
- }
- var ortho_names = ["ortho"];
- /* harmony default export */ const ortho = ({
- init: ortho_init,
- forward: ortho_forward,
- inverse: ortho_inverse,
- names: ortho_names
- });
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/qsc.js
- // QSC projection rewritten from the original PROJ4
- // https://github.com/OSGeo/proj.4/blob/master/src/PJ_qsc.c
- /* constants */
- var FACE_ENUM = {
- FRONT: 1,
- RIGHT: 2,
- BACK: 3,
- LEFT: 4,
- TOP: 5,
- BOTTOM: 6
- };
- var AREA_ENUM = {
- AREA_0: 1,
- AREA_1: 2,
- AREA_2: 3,
- AREA_3: 4
- };
- function qsc_init() {
- this.x0 = this.x0 || 0;
- this.y0 = this.y0 || 0;
- this.lat0 = this.lat0 || 0;
- this.long0 = this.long0 || 0;
- this.lat_ts = this.lat_ts || 0;
- this.title = this.title || "Quadrilateralized Spherical Cube";
- /* Determine the cube face from the center of projection. */
- if (this.lat0 >= HALF_PI - FORTPI / 2.0) {
- this.face = FACE_ENUM.TOP;
- } else if (this.lat0 <= -(HALF_PI - FORTPI / 2.0)) {
- this.face = FACE_ENUM.BOTTOM;
- } else if (Math.abs(this.long0) <= FORTPI) {
- this.face = FACE_ENUM.FRONT;
- } else if (Math.abs(this.long0) <= HALF_PI + FORTPI) {
- this.face = this.long0 > 0.0 ? FACE_ENUM.RIGHT : FACE_ENUM.LEFT;
- } else {
- this.face = FACE_ENUM.BACK;
- }
- /* Fill in useful values for the ellipsoid <-> sphere shift
- * described in [LK12]. */
- if (this.es !== 0) {
- this.one_minus_f = 1 - (this.a - this.b) / this.a;
- this.one_minus_f_squared = this.one_minus_f * this.one_minus_f;
- }
- }
- // QSC forward equations--mapping lat,long to x,y
- // -----------------------------------------------------------------
- function qsc_forward(p) {
- var xy = {x: 0, y: 0};
- var lat, lon;
- var theta, phi;
- var t, mu;
- /* nu; */
- var area = {value: 0};
- // move lon according to projection's lon
- p.x -= this.long0;
- /* Convert the geodetic latitude to a geocentric latitude.
- * This corresponds to the shift from the ellipsoid to the sphere
- * described in [LK12]. */
- if (this.es !== 0) {//if (P->es != 0) {
- lat = Math.atan(this.one_minus_f_squared * Math.tan(p.y));
- } else {
- lat = p.y;
- }
- /* Convert the input lat, lon into theta, phi as used by QSC.
- * This depends on the cube face and the area on it.
- * For the top and bottom face, we can compute theta and phi
- * directly from phi, lam. For the other faces, we must use
- * unit sphere cartesian coordinates as an intermediate step. */
- lon = p.x; //lon = lp.lam;
- if (this.face === FACE_ENUM.TOP) {
- phi = HALF_PI - lat;
- if (lon >= FORTPI && lon <= HALF_PI + FORTPI) {
- area.value = AREA_ENUM.AREA_0;
- theta = lon - HALF_PI;
- } else if (lon > HALF_PI + FORTPI || lon <= -(HALF_PI + FORTPI)) {
- area.value = AREA_ENUM.AREA_1;
- theta = (lon > 0.0 ? lon - SPI : lon + SPI);
- } else if (lon > -(HALF_PI + FORTPI) && lon <= -FORTPI) {
- area.value = AREA_ENUM.AREA_2;
- theta = lon + HALF_PI;
- } else {
- area.value = AREA_ENUM.AREA_3;
- theta = lon;
- }
- } else if (this.face === FACE_ENUM.BOTTOM) {
- phi = HALF_PI + lat;
- if (lon >= FORTPI && lon <= HALF_PI + FORTPI) {
- area.value = AREA_ENUM.AREA_0;
- theta = -lon + HALF_PI;
- } else if (lon < FORTPI && lon >= -FORTPI) {
- area.value = AREA_ENUM.AREA_1;
- theta = -lon;
- } else if (lon < -FORTPI && lon >= -(HALF_PI + FORTPI)) {
- area.value = AREA_ENUM.AREA_2;
- theta = -lon - HALF_PI;
- } else {
- area.value = AREA_ENUM.AREA_3;
- theta = (lon > 0.0 ? -lon + SPI : -lon - SPI);
- }
- } else {
- var q, r, s;
- var sinlat, coslat;
- var sinlon, coslon;
- if (this.face === FACE_ENUM.RIGHT) {
- lon = qsc_shift_lon_origin(lon, +HALF_PI);
- } else if (this.face === FACE_ENUM.BACK) {
- lon = qsc_shift_lon_origin(lon, +SPI);
- } else if (this.face === FACE_ENUM.LEFT) {
- lon = qsc_shift_lon_origin(lon, -HALF_PI);
- }
- sinlat = Math.sin(lat);
- coslat = Math.cos(lat);
- sinlon = Math.sin(lon);
- coslon = Math.cos(lon);
- q = coslat * coslon;
- r = coslat * sinlon;
- s = sinlat;
- if (this.face === FACE_ENUM.FRONT) {
- phi = Math.acos(q);
- theta = qsc_fwd_equat_face_theta(phi, s, r, area);
- } else if (this.face === FACE_ENUM.RIGHT) {
- phi = Math.acos(r);
- theta = qsc_fwd_equat_face_theta(phi, s, -q, area);
- } else if (this.face === FACE_ENUM.BACK) {
- phi = Math.acos(-q);
- theta = qsc_fwd_equat_face_theta(phi, s, -r, area);
- } else if (this.face === FACE_ENUM.LEFT) {
- phi = Math.acos(-r);
- theta = qsc_fwd_equat_face_theta(phi, s, q, area);
- } else {
- /* Impossible */
- phi = theta = 0;
- area.value = AREA_ENUM.AREA_0;
- }
- }
- /* Compute mu and nu for the area of definition.
- * For mu, see Eq. (3-21) in [OL76], but note the typos:
- * compare with Eq. (3-14). For nu, see Eq. (3-38). */
- mu = Math.atan((12 / SPI) * (theta + Math.acos(Math.sin(theta) * Math.cos(FORTPI)) - HALF_PI));
- t = Math.sqrt((1 - Math.cos(phi)) / (Math.cos(mu) * Math.cos(mu)) / (1 - Math.cos(Math.atan(1 / Math.cos(theta)))));
- /* Apply the result to the real area. */
- if (area.value === AREA_ENUM.AREA_1) {
- mu += HALF_PI;
- } else if (area.value === AREA_ENUM.AREA_2) {
- mu += SPI;
- } else if (area.value === AREA_ENUM.AREA_3) {
- mu += 1.5 * SPI;
- }
- /* Now compute x, y from mu and nu */
- xy.x = t * Math.cos(mu);
- xy.y = t * Math.sin(mu);
- xy.x = xy.x * this.a + this.x0;
- xy.y = xy.y * this.a + this.y0;
- p.x = xy.x;
- p.y = xy.y;
- return p;
- }
- // QSC inverse equations--mapping x,y to lat/long
- // -----------------------------------------------------------------
- function qsc_inverse(p) {
- var lp = {lam: 0, phi: 0};
- var mu, nu, cosmu, tannu;
- var tantheta, theta, cosphi, phi;
- var t;
- var area = {value: 0};
- /* de-offset */
- p.x = (p.x - this.x0) / this.a;
- p.y = (p.y - this.y0) / this.a;
- /* Convert the input x, y to the mu and nu angles as used by QSC.
- * This depends on the area of the cube face. */
- nu = Math.atan(Math.sqrt(p.x * p.x + p.y * p.y));
- mu = Math.atan2(p.y, p.x);
- if (p.x >= 0.0 && p.x >= Math.abs(p.y)) {
- area.value = AREA_ENUM.AREA_0;
- } else if (p.y >= 0.0 && p.y >= Math.abs(p.x)) {
- area.value = AREA_ENUM.AREA_1;
- mu -= HALF_PI;
- } else if (p.x < 0.0 && -p.x >= Math.abs(p.y)) {
- area.value = AREA_ENUM.AREA_2;
- mu = (mu < 0.0 ? mu + SPI : mu - SPI);
- } else {
- area.value = AREA_ENUM.AREA_3;
- mu += HALF_PI;
- }
- /* Compute phi and theta for the area of definition.
- * The inverse projection is not described in the original paper, but some
- * good hints can be found here (as of 2011-12-14):
- * http://fits.gsfc.nasa.gov/fitsbits/saf.93/saf.9302
- * (search for "Message-Id: <9302181759.AA25477 at fits.cv.nrao.edu>") */
- t = (SPI / 12) * Math.tan(mu);
- tantheta = Math.sin(t) / (Math.cos(t) - (1 / Math.sqrt(2)));
- theta = Math.atan(tantheta);
- cosmu = Math.cos(mu);
- tannu = Math.tan(nu);
- cosphi = 1 - cosmu * cosmu * tannu * tannu * (1 - Math.cos(Math.atan(1 / Math.cos(theta))));
- if (cosphi < -1) {
- cosphi = -1;
- } else if (cosphi > +1) {
- cosphi = +1;
- }
- /* Apply the result to the real area on the cube face.
- * For the top and bottom face, we can compute phi and lam directly.
- * For the other faces, we must use unit sphere cartesian coordinates
- * as an intermediate step. */
- if (this.face === FACE_ENUM.TOP) {
- phi = Math.acos(cosphi);
- lp.phi = HALF_PI - phi;
- if (area.value === AREA_ENUM.AREA_0) {
- lp.lam = theta + HALF_PI;
- } else if (area.value === AREA_ENUM.AREA_1) {
- lp.lam = (theta < 0.0 ? theta + SPI : theta - SPI);
- } else if (area.value === AREA_ENUM.AREA_2) {
- lp.lam = theta - HALF_PI;
- } else /* area.value == AREA_ENUM.AREA_3 */ {
- lp.lam = theta;
- }
- } else if (this.face === FACE_ENUM.BOTTOM) {
- phi = Math.acos(cosphi);
- lp.phi = phi - HALF_PI;
- if (area.value === AREA_ENUM.AREA_0) {
- lp.lam = -theta + HALF_PI;
- } else if (area.value === AREA_ENUM.AREA_1) {
- lp.lam = -theta;
- } else if (area.value === AREA_ENUM.AREA_2) {
- lp.lam = -theta - HALF_PI;
- } else /* area.value == AREA_ENUM.AREA_3 */ {
- lp.lam = (theta < 0.0 ? -theta - SPI : -theta + SPI);
- }
- } else {
- /* Compute phi and lam via cartesian unit sphere coordinates. */
- var q, r, s;
- q = cosphi;
- t = q * q;
- if (t >= 1) {
- s = 0;
- } else {
- s = Math.sqrt(1 - t) * Math.sin(theta);
- }
- t += s * s;
- if (t >= 1) {
- r = 0;
- } else {
- r = Math.sqrt(1 - t);
- }
- /* Rotate q,r,s into the correct area. */
- if (area.value === AREA_ENUM.AREA_1) {
- t = r;
- r = -s;
- s = t;
- } else if (area.value === AREA_ENUM.AREA_2) {
- r = -r;
- s = -s;
- } else if (area.value === AREA_ENUM.AREA_3) {
- t = r;
- r = s;
- s = -t;
- }
- /* Rotate q,r,s into the correct cube face. */
- if (this.face === FACE_ENUM.RIGHT) {
- t = q;
- q = -r;
- r = t;
- } else if (this.face === FACE_ENUM.BACK) {
- q = -q;
- r = -r;
- } else if (this.face === FACE_ENUM.LEFT) {
- t = q;
- q = r;
- r = -t;
- }
- /* Now compute phi and lam from the unit sphere coordinates. */
- lp.phi = Math.acos(-s) - HALF_PI;
- lp.lam = Math.atan2(r, q);
- if (this.face === FACE_ENUM.RIGHT) {
- lp.lam = qsc_shift_lon_origin(lp.lam, -HALF_PI);
- } else if (this.face === FACE_ENUM.BACK) {
- lp.lam = qsc_shift_lon_origin(lp.lam, -SPI);
- } else if (this.face === FACE_ENUM.LEFT) {
- lp.lam = qsc_shift_lon_origin(lp.lam, +HALF_PI);
- }
- }
- /* Apply the shift from the sphere to the ellipsoid as described
- * in [LK12]. */
- if (this.es !== 0) {
- var invert_sign;
- var tanphi, xa;
- invert_sign = (lp.phi < 0 ? 1 : 0);
- tanphi = Math.tan(lp.phi);
- xa = this.b / Math.sqrt(tanphi * tanphi + this.one_minus_f_squared);
- lp.phi = Math.atan(Math.sqrt(this.a * this.a - xa * xa) / (this.one_minus_f * xa));
- if (invert_sign) {
- lp.phi = -lp.phi;
- }
- }
- lp.lam += this.long0;
- p.x = lp.lam;
- p.y = lp.phi;
- return p;
- }
- /* Helper function for forward projection: compute the theta angle
- * and determine the area number. */
- function qsc_fwd_equat_face_theta(phi, y, x, area) {
- var theta;
- if (phi < EPSLN) {
- area.value = AREA_ENUM.AREA_0;
- theta = 0.0;
- } else {
- theta = Math.atan2(y, x);
- if (Math.abs(theta) <= FORTPI) {
- area.value = AREA_ENUM.AREA_0;
- } else if (theta > FORTPI && theta <= HALF_PI + FORTPI) {
- area.value = AREA_ENUM.AREA_1;
- theta -= HALF_PI;
- } else if (theta > HALF_PI + FORTPI || theta <= -(HALF_PI + FORTPI)) {
- area.value = AREA_ENUM.AREA_2;
- theta = (theta >= 0.0 ? theta - SPI : theta + SPI);
- } else {
- area.value = AREA_ENUM.AREA_3;
- theta += HALF_PI;
- }
- }
- return theta;
- }
- /* Helper function: shift the longitude. */
- function qsc_shift_lon_origin(lon, offset) {
- var slon = lon + offset;
- if (slon < -SPI) {
- slon += TWO_PI;
- } else if (slon > +SPI) {
- slon -= TWO_PI;
- }
- return slon;
- }
- var qsc_names = ["Quadrilateralized Spherical Cube", "Quadrilateralized_Spherical_Cube", "qsc"];
- /* harmony default export */ const qsc = ({
- init: qsc_init,
- forward: qsc_forward,
- inverse: qsc_inverse,
- names: qsc_names
- });
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/robin.js
- // Robinson projection
- // Based on https://github.com/OSGeo/proj.4/blob/master/src/PJ_robin.c
- // Polynomial coeficients from http://article.gmane.org/gmane.comp.gis.proj-4.devel/6039
- var COEFS_X = [
- [1.0000, 2.2199e-17, -7.15515e-05, 3.1103e-06],
- [0.9986, -0.000482243, -2.4897e-05, -1.3309e-06],
- [0.9954, -0.00083103, -4.48605e-05, -9.86701e-07],
- [0.9900, -0.00135364, -5.9661e-05, 3.6777e-06],
- [0.9822, -0.00167442, -4.49547e-06, -5.72411e-06],
- [0.9730, -0.00214868, -9.03571e-05, 1.8736e-08],
- [0.9600, -0.00305085, -9.00761e-05, 1.64917e-06],
- [0.9427, -0.00382792, -6.53386e-05, -2.6154e-06],
- [0.9216, -0.00467746, -0.00010457, 4.81243e-06],
- [0.8962, -0.00536223, -3.23831e-05, -5.43432e-06],
- [0.8679, -0.00609363, -0.000113898, 3.32484e-06],
- [0.8350, -0.00698325, -6.40253e-05, 9.34959e-07],
- [0.7986, -0.00755338, -5.00009e-05, 9.35324e-07],
- [0.7597, -0.00798324, -3.5971e-05, -2.27626e-06],
- [0.7186, -0.00851367, -7.01149e-05, -8.6303e-06],
- [0.6732, -0.00986209, -0.000199569, 1.91974e-05],
- [0.6213, -0.010418, 8.83923e-05, 6.24051e-06],
- [0.5722, -0.00906601, 0.000182, 6.24051e-06],
- [0.5322, -0.00677797, 0.000275608, 6.24051e-06]
- ];
- var COEFS_Y = [
- [-5.20417e-18, 0.0124, 1.21431e-18, -8.45284e-11],
- [0.0620, 0.0124, -1.26793e-09, 4.22642e-10],
- [0.1240, 0.0124, 5.07171e-09, -1.60604e-09],
- [0.1860, 0.0123999, -1.90189e-08, 6.00152e-09],
- [0.2480, 0.0124002, 7.10039e-08, -2.24e-08],
- [0.3100, 0.0123992, -2.64997e-07, 8.35986e-08],
- [0.3720, 0.0124029, 9.88983e-07, -3.11994e-07],
- [0.4340, 0.0123893, -3.69093e-06, -4.35621e-07],
- [0.4958, 0.0123198, -1.02252e-05, -3.45523e-07],
- [0.5571, 0.0121916, -1.54081e-05, -5.82288e-07],
- [0.6176, 0.0119938, -2.41424e-05, -5.25327e-07],
- [0.6769, 0.011713, -3.20223e-05, -5.16405e-07],
- [0.7346, 0.0113541, -3.97684e-05, -6.09052e-07],
- [0.7903, 0.0109107, -4.89042e-05, -1.04739e-06],
- [0.8435, 0.0103431, -6.4615e-05, -1.40374e-09],
- [0.8936, 0.00969686, -6.4636e-05, -8.547e-06],
- [0.9394, 0.00840947, -0.000192841, -4.2106e-06],
- [0.9761, 0.00616527, -0.000256, -4.2106e-06],
- [1.0000, 0.00328947, -0.000319159, -4.2106e-06]
- ];
- var FXC = 0.8487;
- var FYC = 1.3523;
- var C1 = R2D/5; // rad to 5-degree interval
- var RC1 = 1/C1;
- var NODES = 18;
- var poly3_val = function(coefs, x) {
- return coefs[0] + x * (coefs[1] + x * (coefs[2] + x * coefs[3]));
- };
- var poly3_der = function(coefs, x) {
- return coefs[1] + x * (2 * coefs[2] + x * 3 * coefs[3]);
- };
- function newton_rapshon(f_df, start, max_err, iters) {
- var x = start;
- for (; iters; --iters) {
- var upd = f_df(x);
- x -= upd;
- if (Math.abs(upd) < max_err) {
- break;
- }
- }
- return x;
- }
- function robin_init() {
- this.x0 = this.x0 || 0;
- this.y0 = this.y0 || 0;
- this.long0 = this.long0 || 0;
- this.es = 0;
- this.title = this.title || "Robinson";
- }
- function robin_forward(ll) {
- var lon = adjust_lon(ll.x - this.long0);
- var dphi = Math.abs(ll.y);
- var i = Math.floor(dphi * C1);
- if (i < 0) {
- i = 0;
- } else if (i >= NODES) {
- i = NODES - 1;
- }
- dphi = R2D * (dphi - RC1 * i);
- var xy = {
- x: poly3_val(COEFS_X[i], dphi) * lon,
- y: poly3_val(COEFS_Y[i], dphi)
- };
- if (ll.y < 0) {
- xy.y = -xy.y;
- }
- xy.x = xy.x * this.a * FXC + this.x0;
- xy.y = xy.y * this.a * FYC + this.y0;
- return xy;
- }
- function robin_inverse(xy) {
- var ll = {
- x: (xy.x - this.x0) / (this.a * FXC),
- y: Math.abs(xy.y - this.y0) / (this.a * FYC)
- };
- if (ll.y >= 1) { // pathologic case
- ll.x /= COEFS_X[NODES][0];
- ll.y = xy.y < 0 ? -HALF_PI : HALF_PI;
- } else {
- // find table interval
- var i = Math.floor(ll.y * NODES);
- if (i < 0) {
- i = 0;
- } else if (i >= NODES) {
- i = NODES - 1;
- }
- for (;;) {
- if (COEFS_Y[i][0] > ll.y) {
- --i;
- } else if (COEFS_Y[i+1][0] <= ll.y) {
- ++i;
- } else {
- break;
- }
- }
- // linear interpolation in 5 degree interval
- var coefs = COEFS_Y[i];
- var t = 5 * (ll.y - coefs[0]) / (COEFS_Y[i+1][0] - coefs[0]);
- // find t so that poly3_val(coefs, t) = ll.y
- t = newton_rapshon(function(x) {
- return (poly3_val(coefs, x) - ll.y) / poly3_der(coefs, x);
- }, t, EPSLN, 100);
- ll.x /= poly3_val(COEFS_X[i], t);
- ll.y = (5 * i + t) * D2R;
- if (xy.y < 0) {
- ll.y = -ll.y;
- }
- }
- ll.x = adjust_lon(ll.x + this.long0);
- return ll;
- }
- var robin_names = ["Robinson", "robin"];
- /* harmony default export */ const robin = ({
- init: robin_init,
- forward: robin_forward,
- inverse: robin_inverse,
- names: robin_names
- });
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/geocent.js
- function geocent_init() {
- this.name = 'geocent';
- }
- function geocent_forward(p) {
- var point = geodeticToGeocentric(p, this.es, this.a);
- return point;
- }
- function geocent_inverse(p) {
- var point = geocentricToGeodetic(p, this.es, this.a, this.b);
- return point;
- }
- var geocent_names = ["Geocentric", 'geocentric', "geocent", "Geocent"];
- /* harmony default export */ const geocent = ({
- init: geocent_init,
- forward: geocent_forward,
- inverse: geocent_inverse,
- names: geocent_names
- });
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/tpers.js
- var mode = {
- N_POLE: 0,
- S_POLE: 1,
- EQUIT: 2,
- OBLIQ: 3
- };
- var params = {
- h: { def: 100000, num: true }, // default is Karman line, no default in PROJ.7
- azi: { def: 0, num: true, degrees: true }, // default is North
- tilt: { def: 0, num: true, degrees: true }, // default is Nadir
- long0: { def: 0, num: true }, // default is Greenwich, conversion to rad is automatic
- lat0: { def: 0, num: true } // default is Equator, conversion to rad is automatic
- };
- function tpers_init() {
- Object.keys(params).forEach(function (p) {
- if (typeof this[p] === "undefined") {
- this[p] = params[p].def;
- } else if (params[p].num && isNaN(this[p])) {
- throw new Error("Invalid parameter value, must be numeric " + p + " = " + this[p]);
- } else if (params[p].num) {
- this[p] = parseFloat(this[p]);
- }
- if (params[p].degrees) {
- this[p] = this[p] * D2R;
- }
- }.bind(this));
- if (Math.abs((Math.abs(this.lat0) - HALF_PI)) < EPSLN) {
- this.mode = this.lat0 < 0 ? mode.S_POLE : mode.N_POLE;
- } else if (Math.abs(this.lat0) < EPSLN) {
- this.mode = mode.EQUIT;
- } else {
- this.mode = mode.OBLIQ;
- this.sinph0 = Math.sin(this.lat0);
- this.cosph0 = Math.cos(this.lat0);
- }
- this.pn1 = this.h / this.a; // Normalize relative to the Earth's radius
- if (this.pn1 <= 0 || this.pn1 > 1e10) {
- throw new Error("Invalid height");
- }
-
- this.p = 1 + this.pn1;
- this.rp = 1 / this.p;
- this.h1 = 1 / this.pn1;
- this.pfact = (this.p + 1) * this.h1;
- this.es = 0;
- var omega = this.tilt;
- var gamma = this.azi;
- this.cg = Math.cos(gamma);
- this.sg = Math.sin(gamma);
- this.cw = Math.cos(omega);
- this.sw = Math.sin(omega);
- }
- function tpers_forward(p) {
- p.x -= this.long0;
- var sinphi = Math.sin(p.y);
- var cosphi = Math.cos(p.y);
- var coslam = Math.cos(p.x);
- var x, y;
- switch (this.mode) {
- case mode.OBLIQ:
- y = this.sinph0 * sinphi + this.cosph0 * cosphi * coslam;
- break;
- case mode.EQUIT:
- y = cosphi * coslam;
- break;
- case mode.S_POLE:
- y = -sinphi;
- break;
- case mode.N_POLE:
- y = sinphi;
- break;
- }
- y = this.pn1 / (this.p - y);
- x = y * cosphi * Math.sin(p.x);
- switch (this.mode) {
- case mode.OBLIQ:
- y *= this.cosph0 * sinphi - this.sinph0 * cosphi * coslam;
- break;
- case mode.EQUIT:
- y *= sinphi;
- break;
- case mode.N_POLE:
- y *= -(cosphi * coslam);
- break;
- case mode.S_POLE:
- y *= cosphi * coslam;
- break;
- }
- // Tilt
- var yt, ba;
- yt = y * this.cg + x * this.sg;
- ba = 1 / (yt * this.sw * this.h1 + this.cw);
- x = (x * this.cg - y * this.sg) * this.cw * ba;
- y = yt * ba;
- p.x = x * this.a;
- p.y = y * this.a;
- return p;
- }
- function tpers_inverse(p) {
- p.x /= this.a;
- p.y /= this.a;
- var r = { x: p.x, y: p.y };
- // Un-Tilt
- var bm, bq, yt;
- yt = 1 / (this.pn1 - p.y * this.sw);
- bm = this.pn1 * p.x * yt;
- bq = this.pn1 * p.y * this.cw * yt;
- p.x = bm * this.cg + bq * this.sg;
- p.y = bq * this.cg - bm * this.sg;
- var rh = hypot(p.x, p.y);
- if (Math.abs(rh) < EPSLN) {
- r.x = 0;
- r.y = p.y;
- } else {
- var cosz, sinz;
- sinz = 1 - rh * rh * this.pfact;
- sinz = (this.p - Math.sqrt(sinz)) / (this.pn1 / rh + rh / this.pn1);
- cosz = Math.sqrt(1 - sinz * sinz);
- switch (this.mode) {
- case mode.OBLIQ:
- r.y = Math.asin(cosz * this.sinph0 + p.y * sinz * this.cosph0 / rh);
- p.y = (cosz - this.sinph0 * Math.sin(r.y)) * rh;
- p.x *= sinz * this.cosph0;
- break;
- case mode.EQUIT:
- r.y = Math.asin(p.y * sinz / rh);
- p.y = cosz * rh;
- p.x *= sinz;
- break;
- case mode.N_POLE:
- r.y = Math.asin(cosz);
- p.y = -p.y;
- break;
- case mode.S_POLE:
- r.y = -Math.asin(cosz);
- break;
- }
- r.x = Math.atan2(p.x, p.y);
- }
- p.x = r.x + this.long0;
- p.y = r.y;
- return p;
- }
- var tpers_names = ["Tilted_Perspective", "tpers"];
- /* harmony default export */ const tpers = ({
- init: tpers_init,
- forward: tpers_forward,
- inverse: tpers_inverse,
- names: tpers_names
- });
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/geos.js
- function geos_init() {
- this.flip_axis = (this.sweep === 'x' ? 1 : 0);
- this.h = Number(this.h);
- this.radius_g_1 = this.h / this.a;
- if (this.radius_g_1 <= 0 || this.radius_g_1 > 1e10) {
- throw new Error();
- }
- this.radius_g = 1.0 + this.radius_g_1;
- this.C = this.radius_g * this.radius_g - 1.0;
- if (this.es !== 0.0) {
- var one_es = 1.0 - this.es;
- var rone_es = 1 / one_es;
- this.radius_p = Math.sqrt(one_es);
- this.radius_p2 = one_es;
- this.radius_p_inv2 = rone_es;
- this.shape = 'ellipse'; // Use as a condition in the forward and inverse functions.
- } else {
- this.radius_p = 1.0;
- this.radius_p2 = 1.0;
- this.radius_p_inv2 = 1.0;
- this.shape = 'sphere'; // Use as a condition in the forward and inverse functions.
- }
- if (!this.title) {
- this.title = "Geostationary Satellite View";
- }
- }
- function geos_forward(p) {
- var lon = p.x;
- var lat = p.y;
- var tmp, v_x, v_y, v_z;
- lon = lon - this.long0;
- if (this.shape === 'ellipse') {
- lat = Math.atan(this.radius_p2 * Math.tan(lat));
- var r = this.radius_p / hypot(this.radius_p * Math.cos(lat), Math.sin(lat));
- v_x = r * Math.cos(lon) * Math.cos(lat);
- v_y = r * Math.sin(lon) * Math.cos(lat);
- v_z = r * Math.sin(lat);
- if (((this.radius_g - v_x) * v_x - v_y * v_y - v_z * v_z * this.radius_p_inv2) < 0.0) {
- p.x = Number.NaN;
- p.y = Number.NaN;
- return p;
- }
- tmp = this.radius_g - v_x;
- if (this.flip_axis) {
- p.x = this.radius_g_1 * Math.atan(v_y / hypot(v_z, tmp));
- p.y = this.radius_g_1 * Math.atan(v_z / tmp);
- } else {
- p.x = this.radius_g_1 * Math.atan(v_y / tmp);
- p.y = this.radius_g_1 * Math.atan(v_z / hypot(v_y, tmp));
- }
- } else if (this.shape === 'sphere') {
- tmp = Math.cos(lat);
- v_x = Math.cos(lon) * tmp;
- v_y = Math.sin(lon) * tmp;
- v_z = Math.sin(lat);
- tmp = this.radius_g - v_x;
- if (this.flip_axis) {
- p.x = this.radius_g_1 * Math.atan(v_y / hypot(v_z, tmp));
- p.y = this.radius_g_1 * Math.atan(v_z / tmp);
- } else {
- p.x = this.radius_g_1 * Math.atan(v_y / tmp);
- p.y = this.radius_g_1 * Math.atan(v_z / hypot(v_y, tmp));
- }
- }
- p.x = p.x * this.a;
- p.y = p.y * this.a;
- return p;
- }
- function geos_inverse(p) {
- var v_x = -1.0;
- var v_y = 0.0;
- var v_z = 0.0;
- var a, b, det, k;
- p.x = p.x / this.a;
- p.y = p.y / this.a;
- if (this.shape === 'ellipse') {
- if (this.flip_axis) {
- v_z = Math.tan(p.y / this.radius_g_1);
- v_y = Math.tan(p.x / this.radius_g_1) * hypot(1.0, v_z);
- } else {
- v_y = Math.tan(p.x / this.radius_g_1);
- v_z = Math.tan(p.y / this.radius_g_1) * hypot(1.0, v_y);
- }
- var v_zp = v_z / this.radius_p;
- a = v_y * v_y + v_zp * v_zp + v_x * v_x;
- b = 2 * this.radius_g * v_x;
- det = (b * b) - 4 * a * this.C;
- if (det < 0.0) {
- p.x = Number.NaN;
- p.y = Number.NaN;
- return p;
- }
- k = (-b - Math.sqrt(det)) / (2.0 * a);
- v_x = this.radius_g + k * v_x;
- v_y *= k;
- v_z *= k;
- p.x = Math.atan2(v_y, v_x);
- p.y = Math.atan(v_z * Math.cos(p.x) / v_x);
- p.y = Math.atan(this.radius_p_inv2 * Math.tan(p.y));
- } else if (this.shape === 'sphere') {
- if (this.flip_axis) {
- v_z = Math.tan(p.y / this.radius_g_1);
- v_y = Math.tan(p.x / this.radius_g_1) * Math.sqrt(1.0 + v_z * v_z);
- } else {
- v_y = Math.tan(p.x / this.radius_g_1);
- v_z = Math.tan(p.y / this.radius_g_1) * Math.sqrt(1.0 + v_y * v_y);
- }
- a = v_y * v_y + v_z * v_z + v_x * v_x;
- b = 2 * this.radius_g * v_x;
- det = (b * b) - 4 * a * this.C;
- if (det < 0.0) {
- p.x = Number.NaN;
- p.y = Number.NaN;
- return p;
- }
- k = (-b - Math.sqrt(det)) / (2.0 * a);
- v_x = this.radius_g + k * v_x;
- v_y *= k;
- v_z *= k;
- p.x = Math.atan2(v_y, v_x);
- p.y = Math.atan(v_z * Math.cos(p.x) / v_x);
- }
- p.x = p.x + this.long0;
- return p;
- }
- var geos_names = ["Geostationary Satellite View", "Geostationary_Satellite", "geos"];
- /* harmony default export */ const geos = ({
- init: geos_init,
- forward: geos_forward,
- inverse: geos_inverse,
- names: geos_names,
- });
- ;// CONCATENATED MODULE: ./node_modules/proj4/projs.js
- /* harmony default export */ function proj4_projs(proj4){
- proj4.Proj.projections.add(tmerc);
- proj4.Proj.projections.add(etmerc);
- proj4.Proj.projections.add(utm);
- proj4.Proj.projections.add(sterea);
- proj4.Proj.projections.add(stere);
- proj4.Proj.projections.add(somerc);
- proj4.Proj.projections.add(omerc);
- proj4.Proj.projections.add(lcc);
- proj4.Proj.projections.add(krovak);
- proj4.Proj.projections.add(cass);
- proj4.Proj.projections.add(laea);
- proj4.Proj.projections.add(aea);
- proj4.Proj.projections.add(gnom);
- proj4.Proj.projections.add(cea);
- proj4.Proj.projections.add(eqc);
- proj4.Proj.projections.add(poly);
- proj4.Proj.projections.add(nzmg);
- proj4.Proj.projections.add(mill);
- proj4.Proj.projections.add(sinu);
- proj4.Proj.projections.add(moll);
- proj4.Proj.projections.add(eqdc);
- proj4.Proj.projections.add(vandg);
- proj4.Proj.projections.add(aeqd);
- proj4.Proj.projections.add(ortho);
- proj4.Proj.projections.add(qsc);
- proj4.Proj.projections.add(robin);
- proj4.Proj.projections.add(geocent);
- proj4.Proj.projections.add(tpers);
- proj4.Proj.projections.add(geos);
- }
- ;// CONCATENATED MODULE: ./node_modules/proj4/lib/index.js
- core.defaultDatum = 'WGS84'; //default datum
- core.Proj = Proj;
- core.WGS84 = new core.Proj('WGS84');
- core.Point = lib_Point;
- core.toPoint = toPoint;
- core.defs = lib_defs;
- core.nadgrid = nadgrid;
- core.transform = transform;
- core.mgrs = mgrs;
- core.version = '__VERSION__';
- proj4_projs(core);
- /* harmony default export */ const lib = (core);
- ;// CONCATENATED MODULE: ./src/leaflet/core/Proj4Leaflet.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * Inspired by https://github.com/kartena/Proj4Leaflet
- */
- window.proj4 = lib;
- window.Proj4js = lib;
- (external_L_default()).Proj = (external_L_default()).Proj || {};
- (external_L_default()).Proj._isProj4Obj = function(a) {
- return typeof a.inverse !== 'undefined' && typeof a.forward !== 'undefined';
- };
- /**
- * @class L.Proj.Projection
- * @private
- * @classdesc Proj 投影定义类。
- * @category BaseTypes Projection
- * @extends {L.Class}
- * @param {string} code - proj srsCode
- * @param {string} def - 投影的 proj4 定义。{@link [详细]{https://iclient.supermap.io/web/introduction/leafletDevelop.html#projection}}
- * @param {L.Bounds} bounds - 投影范围参数
- */
- (external_L_default()).Proj.Projection = external_L_default().Class.extend({
- initialize: function(code, def, bounds, wrapLng) {
- var isP4 = external_L_default().Proj._isProj4Obj(code);
- this._proj = isP4 ? code : this._projFromCodeDef(code, def);
- var boundsOption = bounds;
- if (external_L_default().Util.isArray(bounds)) {
- boundsOption = external_L_default().bounds(bounds);
- }
- this.bounds = isP4 ? def : boundsOption;
- this.wrapLng = wrapLng;
- },
- /**
- * @function L.Proj.Projection.prototype.project
- * @description 通过地理坐标得到投影坐标。
- * @param {L.Latlng} latlng - 经纬度坐标。
- * @returns {L.Point} 返回投影坐标点。
- */
- project: function(latlng) {
- var point = this._proj.forward([latlng.lng, latlng.lat]);
- return new (external_L_default()).Point(point[0], point[1]);
- },
- /**
- * @function L.Proj.Projection.prototype.unproject
- * @description 通过投影坐标得到地理坐标。
- * @param {L.Point} point - 坐标点。
- * @param {number} unbounded - 坐标点高程值等。
- * @returns {L.LatLng} 返回经纬度坐标
- */
- unproject: function(point, zoom) {
- if (this.bounds && !this.wrapLng) {
- point.x =
- point.x < this.bounds.min.x
- ? this.bounds.min.x
- : point.x > this.bounds.max.x
- ? this.bounds.max.x
- : point.x;
- point.y =
- point.y < this.bounds.min.y
- ? this.bounds.min.y
- : point.y > this.bounds.max.y
- ? this.bounds.max.y
- : point.y;
- }
- var point2 = this._proj.inverse([point.x, point.y]);
- return new (external_L_default()).LatLng(point2[1], point2[0], zoom);
- },
- _projFromCodeDef: function(code, def) {
- if (def) {
- lib.defs(code, def);
- } else if (lib.defs[code] === undefined) {
- var urn = code.split(':');
- if (urn.length > 3) {
- code = urn[urn.length - 3] + ':' + urn[urn.length - 1];
- }
- if (lib.defs[code] === undefined) {
- throw 'No projection definition for code ' + code;
- }
- }
- return lib(code);
- },
- getUnits: function() {
- return this._proj.oProj.units || 'degrees';
- }
- });
- /**
- * @class CRS
- * @aliasclass Proj.CRS
- * @deprecatedclass L.Proj.CRS
- * @deprecatedclassinstance L.supermap.Proj.crs
- * @classdesc 基于 Proj4 坐标系统扩展类。
- * 为计算级别,`options.scales` `options.scaleDenominators` `options.resolutions` `options.bounds` 必须指定一个,先后顺序已按优先级排列。
- * 当指定`options.bounds` 时,第 0 级为一张 256 切片包含整个 bounds,即`Math.max(bounds.getSize().x, bounds.getSize().y)/256` 。
- * 为保证切片行列号正确,`options.origin` `options.bounds` 必须指定一个。
- * 当指定`options.bounds` 时,切片原点为 bounds 的左上角。
- * @category BaseTypes Projection
- * @extends {L.Class}
- * @param {string} srsCode - proj srsCode。
- * @param {Object} options - 参数。
- * @param {string} options.def - 投影的proj4定义。[详细]{@link https://iclient.supermap.io/web/introduction/leafletDevelop.html#multiProjection}
- * @param {(Array.<number>|L.Point)} [options.origin] - 原点。
- * @param {Array.<number>} [options.scales] - 比例尺数组。
- * @param {Array.<number>} [options.scaleDenominators] - 比例尺分母数组。
- * @param {Array.<number>} [options.resolutions] - 分辨率数组。
- * @param {(Array.<number>|L.Bounds)} [options.bounds] - 范围。
- * @param {number} [options.dpi=96] - dpi。
- * @param {Array.<number>} [options.wrapLng] - 定义经度(水平)坐标轴是否在给定范围内环绕。大多数情况下默认为[-180,180]。
- * @example
- * var crs =new CRS("EPSG:4326",{
- * origin: [-180,90],
- * scaleDenominators: [2000,1000,500,200,100,50,20,10],
- * });
- * var map=L.map('map', {
- * crs: crs
- * ...
- * })
- * @usage
- */
- var CRS = external_L_default().Class.extend({
- includes: (external_L_default()).CRS,
- options: {
- transformation: new (external_L_default()).Transformation(1, 0, -1, 0)
- },
- initialize: function(srsCode, options) {
- var code, proj, def;
- if (external_L_default().Proj._isProj4Obj(srsCode)) {
- proj = srsCode;
- code = proj.srsCode;
- options = options || {};
- this.projection = new (external_L_default()).Proj.Projection(proj, options.bounds,options.wrapLng);
- } else {
- code = srsCode;
- options = options || {};
- def = options.def || '';
- this.projection = new (external_L_default()).Proj.Projection(code, def, options.bounds,options.wrapLng);
- }
- external_L_default().Util.setOptions(this, options);
- if (this.options.wrapLng) {
- this.wrapLng = this.options.wrapLng;
- }
- this.code = code;
- this.transformation = this.options.transformation;
- this.options.dpi = this.options.dpi || 96;
- if (this.options.bounds) {
- this.options.bounds = external_L_default().bounds(this.options.bounds);
- }
- if (!this.options.origin && this.options.bounds) {
- this.options.origin = [this.options.bounds.min.x, this.options.bounds.max.y];
- }
- if (this.options.origin) {
- if (this.options.origin instanceof (external_L_default()).Point) {
- this.options.origin = [this.options.origin.x, this.options.origin.y];
- }
- this.transformation = new (external_L_default()).Transformation(1, -this.options.origin[0], -1, this.options.origin[1]);
- }
- if (this.options.scales && this.options.scales.length > 0) {
- this.scales = this.options.scales;
- this._scales = this._toProj4Scales(this.options.scales, this.options.dpi);
- } else if (this.options.scaleDenominators && this.options.scaleDenominators.length > 0) {
- this.scales = [];
- for (let i = 0; i < this.options.scaleDenominators.length; i++) {
- this.scales[i] = 1 / this.options.scaleDenominators[i];
- }
- this._scales = this._toProj4Scales(this.scales, this.options.dpi);
- } else if (this.options.resolutions && this.options.resolutions.length > 0) {
- this._scales = [];
- for (let i = this.options.resolutions.length - 1; i >= 0; i--) {
- if (this.options.resolutions[i]) {
- this._scales[i] = 1 / this.options.resolutions[i];
- }
- }
- } else if (this.options.bounds) {
- this._scales = this._getDefaultProj4ScalesByBounds(this.options.bounds);
- }
- this._rectify();
- this.infinite = !this.options.bounds;
- },
- _rectify: function() {
- if (this._scales) {
- if (!this.resolutions) {
- this.resolutions = [];
- this.resolutions = this._proj4ScalesToResolutions(this._scales);
- }
- if (!this.scales) {
- this.scales = [];
- for (let i = 0; i < this.resolutions.length; i++) {
- var scaleD =
- this.resolutions[i] *
- this.options.dpi *
- (1 / 0.0254) *
- this._getMeterPerMapUnit(this.projection.getUnits());
- this.scales[i] = 1.0 / scaleD;
- }
- }
- }
- },
- /**
- * @function CRS.prototype.scale
- * @description 通过缩放级别获取比例尺值。
- * @param {number} zoom - 缩放级别。
- * @returns 比例尺值。
- */
- scale: function(zoom) {
- var iZoom = Math.floor(zoom),
- baseScale,
- nextScale,
- scaleDiff,
- zDiff;
- if (zoom === iZoom) {
- return this._scales[zoom];
- } else {
- // Non-integer zoom, interpolate
- baseScale = this._scales[iZoom];
- nextScale = this._scales[iZoom + 1];
- scaleDiff = nextScale - baseScale;
- zDiff = zoom - iZoom;
- return baseScale + scaleDiff * zDiff;
- }
- },
- /**
- * @function CRS.prototype.zoom
- * @description 根据比例尺返回缩放级别。
- * @param {number} scale - 比例尺。
- * @returns {number} 缩放级别。
- */
- zoom: function(scale) {
- // Find closest number in this._scales, down
- var downScale = this._closestElement(this._scales, scale),
- downZoom = this._scales.indexOf(downScale),
- nextScale,
- nextZoom,
- scaleDiff;
- // Check if scale is downScale => return array index
- if (!downScale) {
- return 0;
- }
- if (scale === downScale) {
- return downZoom;
- }
- // Interpolate
- nextZoom = downZoom + 1;
- nextScale = this._scales[nextZoom];
- if (nextScale === undefined) {
- return downZoom;
- }
- scaleDiff = nextScale - downScale;
- return (scale - downScale) / scaleDiff + downZoom;
- },
- distance: (external_L_default()).CRS.Earth.distance,
- R: (external_L_default()).CRS.Earth.R,
- /* Get the closest lowest element in an array */
- _closestElement: function(array, element) {
- var low;
- for (var i = array.length; i--; ) {
- if (array[i] <= element && (low === undefined || low < array[i])) {
- low = array[i];
- }
- }
- return low;
- },
- _proj4ScalesToResolutions(_scales) {
- var resolutions = [];
- if (!_scales) {
- return resolutions;
- }
- for (var i = 0; i < _scales.length; i++) {
- resolutions[i] = 1.0 / _scales[i];
- }
- return resolutions;
- },
- _toProj4Scales: function(scales, dpi) {
- var proj4Scales = [];
- if (!scales) {
- return proj4Scales;
- }
- for (var i = 0; i < scales.length; i++) {
- var a = this.projection ? this._getMeterPerMapUnit(this.projection.getUnits()) : 1;
- proj4Scales[i] = 1 / (0.0254 / ((dpi || 96) * scales[i]) / a);
- }
- return proj4Scales;
- },
- _getMeterPerMapUnit: function(mapUnit) {
- var earchRadiusInMeters = 6378137;
- var meterPerMapUnit = 1;
- if (mapUnit === 'meter') {
- meterPerMapUnit = 1;
- } else if (mapUnit === 'degrees' || mapUnit === 'degree') {
- // 每度表示多少米。
- meterPerMapUnit = (Math.PI * 2 * earchRadiusInMeters) / 360;
- } else if (mapUnit === 'kilometer') {
- meterPerMapUnit = 1.0e-3;
- } else if (mapUnit === 'inch') {
- meterPerMapUnit = 1 / 2.5399999918e-2;
- } else if (mapUnit === 'feet') {
- meterPerMapUnit = 0.3048;
- }
- return meterPerMapUnit;
- },
- _getDefaultProj4ScalesByBounds: function(bounds) {
- if (!bounds) {
- return [];
- }
- var boundsSize = bounds.getSize();
- var extendsSize = Math.max(boundsSize.x, boundsSize.y);
- var resolution = extendsSize / 256;
- var scales = [];
- var maxZoom = 23;
- for (var i = 0; i < maxZoom; i++) {
- scales[i] = Math.pow(2, i) / resolution;
- }
- return scales;
- }
- });
- var crs = function(srsCode, options) {
- return new CRS(srsCode, options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/core/Attributions.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @enum attribution
- * @description 版权相关配置。
- * @type {string}
- * @private
- */
- let Attributions = {
- Prefix: `Leaflet with <span>© <a href='https://iclient.supermap.io' title='SuperMap iClient' target='_blank'>SuperMap iClient</a></span>`,
- Common: {
- attribution: `Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>`
- },
- Online: {
- attribution: `Map Data <span>© <a href='https://www.supermapol.com' title='SuperMap Online' target='_blank'>SuperMap Online</a></span>`
- },
- ECharts: {
- attribution: `© 2018 百度 ECharts`
- },
- MapV: {
- attribution: `© 2018 百度 MapV `
- },
- Turf: {
- attribution: `<span>© <a href='https://turfjs.org/' title='turfjs' target='_blank'>turfjs</a></span>`
- },
- Baidu: {
- attribution: `Map Data © 2018 Baidu - GS(2016)2089号 - Data © 长地万方`
- },
- Cloud: {
- attribution: `Map Data ©2014 SuperMap - GS(2014)6070号-data©Navinfo`
- },
- Tianditu: {
- attribution: `Map Data <a href='https://www.tianditu.gov.cn' target='_blank'><img style='background-color:transparent;bottom:2px;opacity:1;' src='https://api.tianditu.gov.cn/img/map/logo.png' width='53px' height='22px' opacity='0'></a>`
- }
- };
- /* harmony default export */ const core_Attributions = (Attributions);
- ;// CONCATENATED MODULE: ./src/leaflet/core/Base.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- external_L_default().Control.Attribution.include({
- options: {
- position: 'bottomright',
- prefix: core_Attributions.Prefix
- }
- });
- external_L_default().Map.include({
- /*
- * 获取精确的像素坐标.
- * 当需要绘制比较平滑的曲线的时候可调用此方法代替latLngToContainerPoint
- * @param latlng
- */
- latLngToAccurateContainerPoint: function (latlng) {
- var projectedPoint = this.project(external_L_default().latLng(latlng));
- var layerPoint = projectedPoint._subtract(this.getPixelOrigin());
- return external_L_default().point(layerPoint).add(this._getMapPanePos());
- }
- });
- wrapToGeoJSON([(external_L_default()).Polyline, (external_L_default()).Polygon, (external_L_default()).Marker, (external_L_default()).CircleMarker, (external_L_default()).Circle, (external_L_default()).LayerGroup]);
- function wrapToGeoJSON(objClassArray) {
- objClassArray.map((objClass) => {
- objClass.defaultFunction = objClass.prototype.toGeoJSON;
- objClass.include({
- toGeoJSON: function (precision) {
- return objClass.defaultFunction.call(this, precision || 10);
- }
- })
- return objClass;
- })
- }
- ;// CONCATENATED MODULE: ./src/leaflet/services/ServiceBase.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ServiceBase
- * @classdesc L.supermap 服务基类。
- * @category iServer Core
- * @param {string} url - 服务地址。
- * @param {Object} options - 参数。
- * @param {string} [options.proxy] - 服务代理地址。
- * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @fires ServiceBase#initialized
- * @fires ServiceBase#destroy
- * @extends {L.Evented}
- * @usage
- */
- var ServiceBase = external_L_default().Evented.extend({
- options: {
- url: null,
- proxy: null,
- withCredentials: false,
- crossOrigin: null
- },
- initialize: function (url, options) {
- if (url) {
- url = (url.indexOf("/") !== url.length - 1) ?
- url : url.substr(0, url.length - 1);
- }
- this.url = url;
- external_L_default().setOptions(this, options);
- /**
- * @event ServiceBase#initialized
- * @description 构造函数构造成功后触发。
- * @property {ServiceBase} this - this 对象。
- */
- this.fire("initialized", this);
- },
- /**
- * @function ServiceBase.prototype.destroy
- * @description 释放资源,将引用的资源属性置空。
- */
- destroy: function () {
- /**
- * @event ServiceBase#destroy
- * @description 资源释放成功后触发。
- * @property {ServiceBase} this - this 对象。
- */
- this.fire("destroy", this);
- }
- });
- ;// CONCATENATED MODULE: ./src/leaflet/services/MapService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class MapService
- * @deprecatedclassinstance L.supermap.mapService
- * @classdesc 地图信息服务类。
- * @category iServer Map
- * @extends {ServiceBase}
- * @param {string} url - 服务地址。
- * @param {Object} options - 参数。
- * @param {string} [options.proxy] - 服务代理地址。
- * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @example
- * new MapService(url)
- * .getMapInfo(function(result){
- * //doSomething
- * })
- * @usage
- */
- var MapService_MapService = ServiceBase.extend({
- options: {
- projection: null
- },
- initialize: function (url, options) {
- options = options || {};
- external_L_default().setOptions(this, options);
- if (options.projection) {
- this.options.projection = options.projection;
- }
- ServiceBase.prototype.initialize.call(this, url, options);
- },
- /**
- * @function MapService.prototype.getMapInfo
- * @description 获取地图信息。
- * @param {RequestCallback} callback - 回调函数。
- */
- getMapInfo: function (callback) {
- var me = this;
- var getMapStatusService = new MapService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- projection: me.options.projection
- });
- getMapStatusService.processAsync();
- },
- /**
- * @function MapService.prototype.getWkt
- * @description 获取WKT。
- * @param {RequestCallback} callback - 回调函数。
- */
- getWkt(callback) {
- var me = this;
- var getMapStatusService = new MapService(`${me.url}/prjCoordSys.wkt`, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- withoutFormatSuffix: true,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- }, projection: me.options.projection
- });
- getMapStatusService.processAsync();
- },
- /**
- * @function MapService.prototype.getTilesets
- * @description 获取切片列表信息。
- * @param {RequestCallback} callback - 回调函数。
- */
- getTilesets: function (callback) {
- var me = this;
- var tilesetsService = new TilesetsService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- }
- });
- tilesetsService.processAsync();
- }
- });
- var mapService = function (url, options) {
- return new MapService_MapService(url, options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/control/ChangeTileVersion.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ChangeTileVersion
- * @aliasclass control.ChangeTileVersion
- * @deprecatedclassinstance L.supermap.control.changeTileVersion
- * @classdesc 版本切换控件,支持 IE10 及以上。
- * @category Control
- * @extends {L.Control}
- * @example
- * new ChangeTileVersion({
- * layer: baseLayer,
- * position: "topleft",
- * orientation: "horizontal"
- * }).addTo(map);
- * @param {Object} options - 参数。
- * @param {L.Layer} options.layer - Leaflet Layer 对象。
- * @param {string} [options.position='topleft'] - 控件位置继承自 Leaflet control。
- * @param {string} [options.title='switch tile version'] - 鼠标滑过时提示。
- * @param {string} [options.tooltip='top'] - tooltip 提示显示位置 top | right | bottom | left。
- * @param {boolean} [options.collapsed=true] - 是否折叠。
- * @param {string} [options.nextText='+'] - 下一个版本的按钮布局。
- * @param {string} [options.lastText='-'] - 上一个版本的按钮布局。
- * @param {string} [options.ico='v'] - 控件显示的 logo。
- * @param {string} [options.orientation='horizontal'] - 方向 horizontal|vertical。
- * @param {boolean} [options.switch=true] - 是否显示上/下一个版本切换控件。
- * @usage
- */
- var ChangeTileVersion = external_L_default().Control.extend({
- options: {
- //绑定的底图图层
- layer: null,
- //控件位置 继承自leaflet control
- position: 'topleft',
- //鼠标滑过时提示
- title: 'switch tile version',
- //tooltip提示显示位置 top | right | bottom | left
- tooltip: "top",
- //是否折叠
- collapsed: true,
- //下一个版本的按钮布局
- nextText: "+",
- //上一个版本的按钮布局
- lastText: "-",
- //控件显示的logo
- ico: 'V',
- //方向horizontal|vertical
- orientation: 'horizontal',
- //是否显示上/下一个版本切换控件
- switch: true
- },
- /**
- * @private
- * @function ChangeTileVersion.prototype.onAdd
- * @description 添加控件。
- */
- onAdd: function () {
- if (this.options.orientation !== 'vertical') {
- this.options.orientation = 'horizontal';
- }
- var layout = this._initLayout();
- if (this.options.layer) {
- this.setLayer(this.options.layer);
- }
- return layout;
- },
- /**
- * @function ChangeTileVersion.prototype.setContent
- * @description 设置版本信息。
- * @param {Object} version - 版本信息。
- */
- setContent: function (version) {
- var content = external_L_default().Util.extend({}, version);
- this.setVersionName(content.desc).setToolTip(content.desc);
- },
- /**
- * @function ChangeTileVersion.prototype.setVersionName
- * @description 设置版本号。
- * @param {string} content - 版本信息。
- * @returns {ChangeTileVersion} ChangeTileVersion的实例对象。
- */
- setVersionName: function (content) {
- var value = content;
- if (!content) {
- value = this.getValue();
- }
- this._sliderValue.innerHTML = value;
- return this;
- },
- /**
- * @function ChangeTileVersion.prototype.setToolTip
- * @description 设置提示信息。
- * @param {(HTMLElement|string)} tooltip - 提示信息。
- * @returns {ChangeTileVersion} ChangeTileVersion的实例对象。
- */
- setToolTip: function (tooltip) {
- this.tooltip.innerHTML = tooltip;
- return this;
- },
- /**
- * @function ChangeTileVersion.prototype.updateLength
- * @description 更新进度条长度。
- * @param {number} length - 进度长度参数。
- */
- updateLength: function (length) {
- if (length > 0) {
- this.length = length;
- this.max = this.length - 1;
- this.slider.setAttribute("max", this.max);
- }
- },
- /**
- * @function ChangeTileVersion.prototype.setLayer
- * @description 设置需要绑定的图层。
- * @param {TiledMapLayer} layer - 绑定的图层。
- */
- setLayer: function (layer) {
- if (layer) {
- this.options.layer = layer;
- }
- var me = this;
- var tileLayer = me.options.layer;
- tileLayer.on("tilesetsinfoloaded", function (result) {
- var tileVersions = result && result.tileVersions;
- me.update(tileVersions);
- });
- tileLayer.on("tileversionschanged", function (result) {
- var tileVersions = result && result.tileVersion;
- me.setContent(tileVersions);
- });
- me.getTileSetsInfo();
- },
- /**
- * @function ChangeTileVersion.prototype.update
- * @description 更新缓存切片集和进度条长度。
- * @param {number} tileVersions - 待更新的切片版本号。
- */
- update: function (tileVersions) {
- this.tileVersions = tileVersions || [];
- this.updateLength(this.tileVersions.length);
- },
- /**
- * @function ChangeTileVersion.prototype.getTileSetsInfo
- * @description 获取切片集信息。
- */
- getTileSetsInfo: function () {
- var me = this;
- if (me.options.layer) {
- new MapService_MapService(me.options.layer._url).getTilesets(function getTilesInfoSucceed(info) {
- me.options.layer.setTileSetsInfo(info.result);
- });
- }
- },
- /**
- * @function ChangeTileVersion.prototype.removeLayer
- * @description 移除绑定的地图图层。
- */
- removeLayer: function () {
- this.options.layer = null;
- },
- /**
- * @function ChangeTileVersion.prototype.nextTilesVersion
- * @description 下一个版本,首次调用该函数默认为无版本。
- * @returns {ChangeTileVersion} ChangeTileVersion的实例对象。
- */
- nextTilesVersion: function () {
- if (this.firstLoad) {
- this.options.layer.nextTilesVersion();
- this.firstLoad = !!0;
- return this;
- }
- if (parseInt(this.slider.value) > this.max-1) {
- return this;
- }
- this.slider.value = parseInt(this.slider.value) + 1;
- this.options.layer.nextTilesVersion();
- return this;
- },
- /**
- * @function ChangeTileVersion.prototype.lastTilesVersion
- * @description 上一个版本。
- */
- lastTilesVersion: function () {
- if (parseInt(this.slider.value) < this.min + 1) {
- return this;
- }
- this.slider.value = parseInt(this.slider.value) - 1;
- this.options.layer.lastTilesVersion();
- return this;
- },
- /**
- * @function ChangeTileVersion.prototype.tilesVersion
- * @description 请求指定版本。
- * @param {string} version - 版本号参数。
- */
- tilesVersion: function (version) {
- var layer = this.options.layer,
- tileVersions = this.tileVersions;
- var len = tileVersions.length;
- for (var i = 0; i < len; i++) {
- if (tileVersions[i].name == version) {
- layer.updateCurrentTileSetsIndex(i);
- layer.changeTilesVersion();
- break;
- }
- }
- },
- /**
- * @function ChangeTileVersion.prototype.getValue
- * @description 获取进度条的值。(注:进度条的值并不是版本号)。
- */
- getValue: function () {
- return this.slider.value;
- },
- /**
- * @function ChangeTileVersion.prototype.getVersion
- * @description 获取当前进度条的值对应的版本号。
- */
- getVersion: function () {
- var version = this.tileVersions[this.getValue()];
- return version && version.name;
- },
- _initLayout: function () {
- var className = 'leaflet-control-ctv';
- this._container = external_L_default().DomUtil.create('div', className + ' ' + className + '-' + this.options.orientation);
- //正常情况下显示btn
- this._sliderBtn = external_L_default().DomUtil.create('a', className + '-toggle', this._container);
- this._sliderBtn.setAttribute("title", this.options.title);
- this._sliderBtn.innerHTML = this.options.ico;
- //滑块拖动时值显示区域
- this._sliderValue = external_L_default().DomUtil.create('p', className + '-value', this._container);
- this._sliderValue.innerHTML = this.options.ico;
- var sliderClassName = "leaflet-ctv-slider";
- this._sliderContent = external_L_default().DomUtil.create('div', sliderClassName + "-main" + " tooltip", this._container);
- //tooltip提示框
- this.tooltip = external_L_default().DomUtil.create("span", "tooltip-text" + " " + "tooltip-" + this.options.tooltip, this._sliderContent);
- this.tooltip.innerHTML = this.options.ico;
- //加控件
- if (this.options.switch) {
- this._next = external_L_default().DomUtil.create('a', sliderClassName + "-incdec" + " " + sliderClassName + '-next', this._sliderContent);
- this._next.innerHTML = this.options.nextText;
- external_L_default().DomEvent.on(this._next, 'click', this.nextTilesVersion, this);
- external_L_default().DomUtil.addClass(this._container, className + '-incdec');
- }
- //滑块
- this._sliderContainer = external_L_default().DomUtil.create('div', sliderClassName + '-container', this._sliderContent);
- this.slider = external_L_default().DomUtil.create('input', sliderClassName, this._sliderContainer);
- this.min = this.min == null || isNaN(this.min) ? 0 : parseInt(this.min);
- this.slider.setAttribute("title", this.options.title);
- this.slider.setAttribute("id", "slider");
- this.slider.setAttribute("type", "range");
- this.slider.setAttribute("min", this.min);
- this.slider.setAttribute("max", 0);
- this.slider.setAttribute("step", 1);
- this.slider.setAttribute("value", 0);
- // //判断浏览器是否支持Range滑动条
- // if (this.slider.type == "text") {
- // console.error("抱歉,您的浏览器不支持HTML5 range滑动条,请使用高版本浏览器");
- // }
- this.firstLoad = true;
- if ('oninput' in this.slider || 'onchange' in this.slider) {
- external_L_default().DomEvent.on(this.slider, "change", this._tilesVersion, this);
- } else {
- this.slider.onpropertychange = this._tilesVersion;
- }
- //减控件
- if (this.options.switch) {
- this._last = external_L_default().DomUtil.create('a', sliderClassName + "-incdec" + " " + sliderClassName + '-last', this._sliderContent);
- this._last.innerHTML = this.options.lastText;
- external_L_default().DomEvent.on(this._last, 'click', this.lastTilesVersion, this);
- }
- //if (window.matchMedia("screen and (-webkit-min-device-pixel-ratio:0)").matches && this.options.orientation == 'vertical') {
- if (this.options.orientation === 'vertical') {
- this.slider.style.width = 170 + 'px';
- this._sliderContainer.style.height = 170 + 'px';
- } else {
- this._sliderContainer.style.width = 150 + 'px';
- }
- external_L_default().DomEvent.disableClickPropagation(this._container);
- if (this.options.collapsed) {
- if (!(external_L_default()).Browser.android) {
- external_L_default().DomEvent.on(this._container, 'mouseenter', this._expand, this)
- .on(this._container, 'mouseleave', this._collapse, this);
- }
- if ((external_L_default()).Browser.touch) {
- external_L_default().DomEvent.on(this._sliderBtn, 'click', (external_L_default()).DomEvent.stop)
- .on(this._sliderBtn, 'click', this._expand, this);
- } else {
- external_L_default().DomEvent.on(this._sliderBtn, 'focus', this._expand, this);
- }
- } else {
- this._expand();
- }
- return this._container;
- },
- _expand: function () {
- external_L_default().DomUtil.addClass(this._container, 'leaflet-control-ctv-expanded');
- },
- _collapse: function () {
- external_L_default().DomUtil.removeClass(this._container, 'leaflet-control-ctv-expanded');
- },
- _tilesVersion: function () {
- var version = this.getVersion();
- this.tilesVersion(version);
- }
- });
- external_L_default().Map.mergeOptions({
- changeTileVersionControl: false
- });
- external_L_default().Map.addInitHook(function () {
- if (this.options.changeTileVersionControl) {
- this.changeTileVersionControl = new ChangeTileVersion();
- this.addControl(this.changeTileVersionControl);
- }
- });
- var changeTileVersion = function (options) {
- return new ChangeTileVersion(options);
- };
- ;// CONCATENATED MODULE: ./src/common/control/img/Logo.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- 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=";
- ;// CONCATENATED MODULE: ./src/leaflet/control/Logo.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class Logo
- * @aliasclass control.Logo
- * @deprecatedclassinstance L.supermap.control.logo
- * @classdesc Logo 控件。
- * @category Control
- * @extends {L.Control}
- * @example
- * new Logo({
- * imageUrl: xxx,//非必填项
- * }).addTo(map);
- * @param {Object} options - 参数。
- * @param {string} [options.position='bottomright'] - 控件位置继承自 leaflet control。
- * @param {string} [options.imageUrl] - logo 图片地址。
- * @param {string} [options.width] - logo 图片宽度。
- * @param {string} [options.height] - logo 图片高度。
- * @param {string} [options.link] - 跳转链接。
- * @param {string} [options.alt='SuperMap iClient'] - logo 图片失效时显示的提示文本。
- * @usage
- */
- var Logo = external_L_default().Control.extend({
- options: {
- position: 'bottomright',
- //logo图片地址
- imageUrl: null,
- //跳转链接
- link: null,
- //logo图片宽
- width: null,
- //logo图片高
- height: null,
- //logo图片失效时显示文本
- alt: "SuperMap iClient"
- },
- /**
- * @private
- * @function Logo.prototype.onAdd
- * @override
- * @description 添加 logo。
- * @returns {HTMLElement} 返回创建 logo 的 div。
- */
- onAdd: function () {
- var div = external_L_default().DomUtil.create('div', 'iclient-leaflet-logo');
- div.style.marginTop = 0;
- div.style.marginBottom = 0;
- div.style.marginLeft = 0;
- div.style.marginRight = 0;
- //iClient.png base64
- var imgSrc = LogoBase64;
- if (this.options.imageUrl) {
- imgSrc = this.options.imageUrl;
- }
- var alt = this.options.alt;
- var imageWidth = "94px";
- var imageHeight = "29px";
- var styleSize = "width:" + imageWidth + ";height:" + imageHeight + ";";
- if (this.options.imageUrl) {
- imageWidth = this.options.width;
- imageHeight = this.options.height;
- styleSize = "width:" + imageWidth + ";height:" + imageHeight + ";";
- if (!imageWidth || !imageHeight) {
- styleSize = "";
- }
- }
- var link = this.options.link || "https://iclient.supermap.io";
- div.innerHTML = "<a href='" + link + "' target='_blank' style='border: none;display: block;'>" +
- "<img src=" + imgSrc + " alt='" + alt + "' style='border: none;" + styleSize + "margin-right:5px;margin-bottom:2px;white-space: nowrap'></a>";
- return div;
- }
- });
- //map默认开启logoControl
- external_L_default().Map.mergeOptions({
- logoControl: true
- });
- //map默认开启logoControl
- external_L_default().Map.addInitHook(function () {
- if (!this._logoAdded && this.options.logoControl) {
- if (this.options.logoControl === true) {
- this.logoControl = new Logo();
- } else if (this.options.logoControl instanceof (external_L_default()).Control) {
- this.logoControl = this.options.logoControl;
- }
- if (this.logoControl) {
- this.addControl(this.logoControl);
- this._logoAdded = true;
- }
- }
- });
- var logo = function (options) {
- return new Logo(options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/control/index.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- ;// CONCATENATED MODULE: ./src/leaflet/core/CommontypesConversion.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
-
-
-
- const isArray = function(obj) {
- return Object.prototype.toString.call(obj) == '[object Array]';
- }
- /**
- * @class CommontypesConversion
- * @category BaseTypes Util
- * @classdesc Leaflet 对象和 SuperMap 对象转换工具。
- * @usage
- */
- const CommontypesConversion = {
- /**
- * @function CommontypesConversion.toSuperMapBounds
- * @description 将 Leaflet 对象的 bounds 转成 SuperMap 的 bounds对象。
- * @param {(L.Bounds|L.LatLngBounds)} bounds - 图层显示范围。
- * @returns {Bounds} SuperMap 的 bounds 对象。
- */
- toSuperMapBounds(bounds) {
- if (bounds && ["FeatureCollection", "Feature"].indexOf(bounds.type) !== -1) {
- bounds = external_L_default().geoJSON(bounds).getBounds();
- }
- if (bounds instanceof (external_L_default()).LatLngBounds) {
- return new Bounds(
- bounds.getSouthWest().lng,
- bounds.getSouthWest().lat,
- bounds.getNorthEast().lng,
- bounds.getNorthEast().lat
- );
- }
- if (bounds instanceof (external_L_default()).Bounds) {
- return new Bounds(
- bounds.min.x,
- bounds.min.y,
- bounds.max.x,
- bounds.max.y
- );
- }
- if (isArray(bounds)) {
- return new Bounds(
- bounds[0],
- bounds[1],
- bounds[2],
- bounds[3]
- );
- }
- return new Bounds();
- },
- /**
- * @function CommontypesConversion.isArray
- * @description 判断是否为数组格式。
- * @param {Object} obj - 待判断的对象。
- * @returns {boolean} 是否是数组。
- */
- isArray,
- /**
- * @function CommontypesConversion.toProcessingParam
- * @description 将 Region 节点数组转为 Processing 服务需要的分析参数。
- * @param {Array} points - Region 各个节点数组。
- * @returns processing 服务裁剪、查询分析的分析参数。
- */
- toProcessingParam(points) {
- var geometryParam = {};
- if (points.length < 1) {
- geometryParam = "";
- } else {
- var results = [];
- for (var i = 0; i < points.length; i++) {
- var point = {};
- point.x = points[i][0];
- point.y = points[i][1];
- results.push(point);
- }
- geometryParam.type = "REGION";
- geometryParam.points = results;
- }
- return geometryParam;
- }
- }
- ;// CONCATENATED MODULE: ./src/leaflet/core/ExtendsCRS.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @name BaiduCRS
- * @description 百度坐标对象。
- * @namespace
- * @category BaseTypes Projection
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const baiduCRS = {namespace}.CRS.BaiduCRS;
- *
- * // 弃用的写法
- * const baiduCRS = L.CRS.BaiduCRS;
- *
- * </script>
- * //ES6 Import
- * import { BaiduCRS } from "{npm}";
- *
- * const baiduCRS = BaiduCRS;
- * ```
- */
- var BaiduCRS = external_L_default().extend({}, (external_L_default()).CRS.EPSG3857, {
- code: 'Baidu',
- scale: function (zoom) {
- return (6378137 * Math.PI * 2) / Math.pow(2, 18 - zoom)
- },
- transformation: (function () {
- var scale = 0.5 / (Math.PI * 6378137);
- return new (external_L_default()).Transformation(scale, 0, -scale, 0);
- }())
- });
- var tdt_WGS84_resolutions = [];
- for (let i = 1; i < 19; i++) {
- tdt_WGS84_resolutions.push(0.703125 * 2 / (Math.pow(2, i)));
- }
- /**
- * @name TianDiTu_WGS84CRS
- * @deprecatedclass L.CRS.TianDiTu_WGS84CRS
- * @description 天地图 WGS84 坐标对象。
- * @namespace
- * @category BaseTypes Projection
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const tianDiTu_WGS84CRS = {namespace}.CRS.TianDiTu_WGS84CRS;
- *
- * // 弃用的写法
- * const tianDiTu_WGS84CRS = L.CRS.TianDiTu_WGS84CRS;
- *
- * </script>
- * //ES6 Import
- * import { TianDiTu_WGS84CRS } from "{npm}";
- *
- * const tianDiTu_WGS84CRS = TianDiTu_WGS84CRS;
- *
- * ```
- */
- var TianDiTu_WGS84CRS = crs("EPSG:4326",{
- origin: [-180, 90],
- resolutions: tdt_WGS84_resolutions,
- bounds: external_L_default().bounds([-180, -90], [180, 90]),
- wrapLng: [-180, 180]
- });
- const c = Math.PI * 2 * 6378137;
- const halfC = c / 2;
- var tdt_Mercator_resolutions = [];
- for (let i = 1; i < 19; i++) {
- tdt_Mercator_resolutions.push(c / 256 / Math.pow(2, i));
- }
- /**
- * @name TianDiTu_MercatorCRS
- * @deprecatedclass L.CRS.TianDiTu_MercatorCRS
- * @description 天地图墨卡托坐标对象。
- * @category BaseTypes Projection
- * @namespace
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const tianDiTu_MercatorCRS = {namespace}.CRS.TianDiTu_MercatorCRS;
- *
- * // 弃用的写法
- * const tianDiTu_MercatorCRS = L.CRS.TianDiTu_MercatorCRS;
- *
- * </script>
- * //ES6 Import
- * import { TianDiTu_MercatorCRS } from "{npm}";
- *
- * const tianDiTu_MercatorCRS = TianDiTu_MercatorCRS;
- *
- * ```
- */
- var TianDiTu_MercatorCRS = crs('EPSG:3857', {
- origin: [-halfC, halfC],
- resolutions: tdt_Mercator_resolutions,
- bounds: external_L_default().bounds([-halfC, -halfC], [halfC, halfC]),
- wrapLng: [-180, 180]
- });
- ;// CONCATENATED MODULE: ./src/leaflet/core/NonEarthCRS.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @private
- * @class NonProjection
- * @classdesc 平面无投影对象。
- * @category BaseTypes Projection
- * @extends {L.Class}
- * @param {L.Bounds} bounds - 坐标范围
- */
- var NonProjection = external_L_default().Class.extend({
- initialize: function (bounds) {
- this.bounds = bounds;
- },
- project: function (latlng) {
- return new (external_L_default()).Point(latlng.lng, latlng.lat);
- },
- unproject: function (point) {
- return new (external_L_default()).LatLng(point.y, point.x);
- }
- });
- var nonProjection = function (bounds) {
- return new NonProjection(bounds);
- };
- /**
- * @class NonEarthCRS
- * @aliasclass CRS.NonEarthCRS
- * @deprecatedclass L.CRS.NonEarthCRS
- * @deprecatedclassinstance L.supermap.CRS.nonEarthCRS
- * @classdesc 平面无投影坐标类。
- * @category BaseTypes Projection
- * @extends {L.Class}
- * @param {Object} options - 参数。
- * @param {Object} options.origin - 原点。
- * @param {L.Bounds} options.bounds - 范围。
- * @param {Array.<number>} [options.resolutions] - 分辨率。
- * @usage
- */
- var NonEarthCRS = external_L_default().Class.extend({
- /**
- * @member {Object} [NonEarthCRS.prototype.includes=L.CRS]
- * @description 坐标对象。
- */
- includes: (external_L_default()).CRS,
- initialize: function (options) {
- if (options.origin) {
- this.transformation = new (external_L_default()).Transformation(1, -options.origin.x, -1, options.origin.y);
- }
- this.projection = nonProjection(options.bounds);
- this.bounds = options.bounds;
- this.origin = options.origin;
- this.resolutions = options.resolutions;
- },
- /**
- * @function NonEarthCRS.prototype.scale
- * @description 通过缩放级别计算比例尺。
- * @param {number} zoom - 缩放级别。
- * @returns {number} 返回比例尺值。
- */
- scale: function (zoom) {
- let defaultScale;
- if (!this.resolutions || this.resolutions.length === 0) {
- const width = Math.max(this.bounds.getSize().x, this.bounds.getSize().y);
- defaultScale = 1.0 / (width / 256);
- return defaultScale * Math.pow(2, zoom);
- }
- if (this.resolutions[zoom]) {
- return 1.0 / this.resolutions[zoom];
- }
- return (1.0 / this.resolutions[0]) * Math.pow(2, zoom);
- },
- /**
- * @function NonEarthCRS.prototype.zoom
- * @description 通过比例尺计算范围。
- * @param {number} scale - 比例尺。
- * @returns {number} 返回空间范围值。
- */
- zoom: function (scale) {
- let defaultScale;
- if (!this.resolutions || this.resolutions.length === 0) {
- const width = Math.max(this.bounds.getSize().x, this.bounds.getSize().y);
- defaultScale = 1.0 / (width / 256);
- return Math.log(scale / defaultScale) / Math.LN2;
- }
- const index = this.resolutions.indexOf(1.0 / scale);
- if (index > -1) {
- return index;
- }
- return Math.log(scale / (1.0 / this.resolutions[0])) / Math.LN2;
- },
- /**
- * @function NonEarthCRS.prototype.distance
- * @description 通过两个坐标点计算之间的距离。
- * @param {L.LatLng} latlng1 - 坐标点1。
- * @param {L.LatLng} latlng2 - 坐标点2。
- * @returns {number} 返回距离长度。
- */
- distance: function (latlng1, latlng2) {
- var dx = latlng2.lng - latlng1.lng,
- dy = latlng2.lat - latlng1.lat;
- return Math.sqrt(dx * dx + dy * dy);
- },
- infinite: false
- });
- var nonEarthCRS = function (options) {
- return new NonEarthCRS(options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/core/Util.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
-
-
-
- /**
- * @function toGeoJSON
- * @category BaseTypes Util
- * @description 将传入对象转为 GeoJSON 格式。
- * @param {Object} feature - 待转参数。
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.Util.toGeoJSON(feature);
- *
- * </script>
- *
- * // ES6 Import
- * import { toGeoJSON } from '{npm}';
- *
- * const result = toGeoJSON(feature);
- * ```
- */
- var toGeoJSON = function(feature) {
- if (!feature) {
- return feature;
- }
- return new GeoJSON().toGeoJSON(feature);
- };
- /**
- * @function toSuperMapGeometry
- * @category BaseTypes Util
- * @description 将 GeoJSON 对象转为 SuperMap 几何图形。
- * @param {GeoJSONObject} geometry - GeoJSON 对象。
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.Util.toSuperMapGeometry(geometry);
- *
- * </script>
- *
- * // ES6 Import
- * import { toSuperMapGeometry } from '{npm}';
- *
- * const result = toSuperMapGeometry(geometry);
- * ```
- */
- var toSuperMapGeometry = function(geometry) {
- if (!geometry) {
- return geometry;
- }
- var result,
- format = new GeoJSON();
- if (['FeatureCollection', 'Feature', 'Geometry'].indexOf(geometry.type) != -1) {
- result = format.read(geometry, geometry.type);
- } else if (typeof geometry.toGeoJSON === 'function') {
- var geojson = geometry.toGeoJSON();
- result = geojson ? format.read(geojson, geojson.type) : geometry;
- }
- var serverResult = result || geometry;
- if (external_L_default().Util.isArray(result)) {
- if (result.length === 1) {
- serverResult = result[0];
- } else if (result.length > 1) {
- serverResult = [];
- result.map(function(item) {
- serverResult.push(item.geometry);
- return item;
- });
- }
- }
- return serverResult && serverResult.geometry ? serverResult.geometry : serverResult;
- };
- var Util_getMeterPerMapUnit = getMeterPerMapUnit;
- /**
- * @function resolutionToScale
- * @category BaseTypes Util
- * @description 通过分辨率计算比例尺。
- * @param {number} resolution - 分辨率。
- * @param {number} dpi - 屏幕分辨率。
- * @param {string} mapUnit - 地图单位。
- * @returns {number} 比例尺。
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.Util.resolutionToScale(resolution, dpi, mapUnit);
- *
- * </script>
- *
- * // ES6 Import
- * import { resolutionToScale } from '{npm}';
- *
- * const result = resolutionToScale(resolution, dpi, mapUnit);
- * ```
- */
- var resolutionToScale = function(resolution, dpi, mapUnit) {
- var inchPerMeter = 1 / 0.0254;
- // 地球半径。
- var meterPerMapUnit = Util_getMeterPerMapUnit(mapUnit);
- var scale = resolution * dpi * inchPerMeter * meterPerMapUnit;
- scale = 1 / scale;
- return scale;
- };
- /**
- * @function scaleToResolution
- * @category BaseTypes Util
- * @description 通过比例尺计算分辨率。
- * @param {number} scale - 比例尺。
- * @param {number} dpi - 屏幕分辨率。
- * @param {string} mapUnit - 地图单位。
- * @returns {number} 分辨率。
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.Util.scaleToResolution(scale, dpi, mapUnit);
- *
- * </script>
- *
- * // ES6 Import
- * import { scaleToResolution } from '{npm}';
- *
- * const result = scaleToResolution(scale, dpi, mapUnit);
- * ```
- */
- var Util_scaleToResolution = function(scale, dpi, mapUnit) {
- var inchPerMeter = 1 / 0.0254;
- var meterPerMapUnitValue = Util_getMeterPerMapUnit(mapUnit);
- var resolution = scale * dpi * inchPerMeter * meterPerMapUnitValue;
- resolution = 1 / resolution;
- return resolution;
- };
- /**
- * @function normalizeScale
- * @category BaseTypes Util
- * @description 转换比例尺。
- * @param {number} scale - 比例尺。
- * @returns {number} 正常的 scale 值。
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.Util.normalizeScale(scale);
- *
- * // 弃用的写法
- * const result = L.supermap.Util.NormalizeScale(scale);
- * const result = L.Util.NormalizeScale(scale);
- * </script>
- *
- * // ES6 Import
- * import { normalizeScale } from '{npm}';
- *
- * const result = normalizeScale(scale);
- * ```
- */
- var normalizeScale = function(scale) {
- return scale > 1.0 ? 1.0 / scale : scale;
- };
- /**
- * @function getResolutionFromScaleDpi
- * @category BaseTypes Util
- * @description 根据比例尺和 dpi 计算屏幕分辨率。
- * @param {number} scale - 比例尺。
- * @param {number} dpi - 图像分辨率,表示每英寸内的像素个数。
- * @param {string} [coordUnit] - 投影坐标系统的地图单位。
- * @param {number} [datumAxis=6378137] - 地理坐标系统椭球体长半轴。用户自定义地图的 Options 时,若未指定该参数的值,则 DPI 默认按照 WGS84 参考系的椭球体长半轴 6378137 来计算。
- * @returns {number} 当前比例尺下的屏幕分辨率。
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.Util.getResolutionFromScaleDpi(scale, dpi, coordUnit, datumAxis);
- *
- * // 弃用的写法
- * const result = L.supermap.Util.GetResolutionFromScaleDpi(scale, dpi, coordUnit, datumAxis);
- * const result = L.Util.GetResolutionFromScaleDpi(scale, dpi, coordUnit, datumAxis);
- * </script>
- *
- * // ES6 Import
- * import { getResolutionFromScaleDpi } from '{npm}';
- *
- * const result = getResolutionFromScaleDpi(scale, dpi, coordUnit, datumAxis);
- * ```
- */
- var getResolutionFromScaleDpi = function(scale, dpi, coordUnit, datumAxis) {
- var resolution = null,
- ratio = 10000;
- //用户自定义地图的Options时,若未指定该参数的值,则系统默认为6378137米,即WGS84参考系的椭球体长半轴。
- datumAxis = datumAxis || 6378137;
- coordUnit = coordUnit || '';
- if (scale > 0 && dpi > 0) {
- scale = normalizeScale(scale);
- if (
- coordUnit.toLowerCase() === 'degree' ||
- coordUnit.toLowerCase() === 'degrees' ||
- coordUnit.toLowerCase() === 'dd'
- ) {
- //scale = CommonUtil.normalizeScale(scale);
- resolution = (0.0254 * ratio) / dpi / scale / ((Math.PI * 2 * datumAxis) / 360) / ratio;
- return resolution;
- } else {
- resolution = (0.0254 * ratio) / dpi / scale / ratio;
- return resolution;
- }
- }
- return -1;
- };
- ;// CONCATENATED MODULE: ./src/leaflet/core/Transform.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @function transform
- * @description 转换要素坐标。
- * @category BaseTypes Util
- * @param {(L.Marker|L.CircleMarker|L.Polyline|L.Polygon|L.Rectangle|L.LatLngBounds|L.Bounds|Object)} feature - 待转换要素:Leaflet Vector Layers 。
- * 的 {@link L.Marker}|{@link L.CircleMarker}|{@link L.Polyline}|{@link L.Polygon}|{@link L.Rectangle}|{@link L.LatLngBounds}|{@link L.Bounds}|{@link GeoJSONObject} 类型。
- * @param {CRS} [sourceCRS=L.CRS.EPSG4326] - 转换要素的源坐标系。
- * @param {CRS} targetCRS - 转换要素的目标坐标系。
- * @returns {GeoJSONObject} 返回 GeoJSON 规范的数据类型。
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.Util.transform(feature, sourceCRS, targetCRS);
- *
- * // 弃用的写法:
- * L.Util.transform(feature, sourceCRS, targetCRS);
- *
- * </script>
- *
- * // ES6 Import
- * import { transform } from '{npm}';
- *
- * const result = transform(feature, sourceCRS, targetCRS);
- * ```
- */
- var Transform_transform = function (feature, sourceCRS = (external_L_default()).CRS.EPSG4326, targetCRS) {
- let selfFeatures = null;
- let selfCallback = null;
- //将数据统一为 geojson 格式处理:
- if (["FeatureCollection", "Feature", "Geometry"].indexOf(feature.type) === -1) {
- if (feature.toGeoJSON) {
- feature = feature.toGeoJSON();
- } else if (feature instanceof (external_L_default()).LatLngBounds) {
- feature = external_L_default().rectangle(feature).toGeoJSON();
- } else if (feature instanceof (external_L_default()).Bounds) {
- feature = external_L_default().rectangle([[feature.getTopLeft().x, feature.getTopLeft().y],
- [feature.getBottomRight().x, feature.getBottomRight().y]]).toGeoJSON();
- } else {
- throw new Error("This tool only supports data conversion in geojson format or Vector Layers of Leaflet.")
- }
- }
- //geojson 几种数据类型及处理形式
- const parseCoords = {
- "point": function (array) {
- return selfCallback(array);
- },
- "multipoint": function (array) {
- return parseCoords["linestring"].apply(this, [array])
- },
- "linestring": function (array) {
- let points = [];
- let p = null;
- for (let i = 0, len = array.length; i < len; ++i) {
- try {
- p = parseCoords["point"].apply(this, [array[i]]);
- } catch (err) {
- throw err;
- }
- points.push(p);
- }
- return points;
- },
- "multilinestring": function (array) {
- return parseCoords["polygon"].apply(this, [array]);
- },
- "polygon": function (array) {
- let rings = [];
- let l;
- for (let i = 0, len = array.length; i < len; ++i) {
- try {
- l = parseCoords["linestring"].apply(this, [array[i]]);
- } catch (err) {
- throw err;
- }
- rings.push(l);
- }
- return rings;
- },
- "multipolygon": function (array) {
- let polys = [];
- let p = null;
- for (let i = 0, len = array.length; i < len; ++i) {
- try {
- p = parseCoords["polygon"].apply(this, [array[i]]);
- } catch (err) {
- throw err;
- }
- polys.push(p);
- }
- return polys;
- }
- };
- //返回结果:
- return featureTransform(feature, _transformCoordinates);
- function featureTransform(feature, callback) {
- selfFeatures = feature;
- selfCallback = callback;
- //分离处理:
- if (feature.type === "Feature") {
- selfFeatures = _prepareFeatuers(feature);
- } else if (feature.type === "FeatureCollection") {
- let featureResults = [];
- for (let i = 0; i < feature.features.length; ++i) {
- try {
- featureResults.push(_prepareFeatuers(feature.features[i]));
- } catch (err) {
- featureResults = null;
- }
- }
- selfFeatures.features = featureResults;
- }
- return selfFeatures;
- }
- function _prepareFeatuers(feature) {
- const geometry = feature.geometry;
- if (!(Util.isArray(geometry.coordinates))) {
- throw "Geometry must have coordinates array: " + geometry;
- }
- if (!parseCoords[geometry.type.toLowerCase()]) {
- throw "Unsupported geometry type: " + geometry.type;
- }
- try {
- geometry.coordinates = parseCoords[geometry.type.toLowerCase()].apply(
- this, [geometry.coordinates]
- );
- } catch (err) {
- throw err;
- }
- feature.geometry = geometry;
- return feature;
- }
- function _transformCoordinates(coordinates) {
- //判断code 是投影坐标还是地理坐标
- var point = sourceCRS.unproject({x: coordinates[0], y: coordinates[1]});
- const transform = targetCRS.project(point);
- return [transform.x, transform.y];
- }
- };
- ;// CONCATENATED MODULE: ./src/leaflet/core/index.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- ;// CONCATENATED MODULE: ./src/leaflet/mapping/BaiduTileLayer.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class BaiduTileLayer
- * @deprecatedclassinstance L.supermap.baiduTileLayer
- * @classdesc 百度地图图层。
- * @category ThirdPartyMap
- * @extends {L.TileLayer}
- * @param {string} [url='https://online{num}.map.bdimg.com/onlinelabel/?qt=tile&x={x}&y={y}&z={z}&styles={styles}&udt=20150815&scaler=1'] - 切片地址。
- * @param {Object} options - 参数。
- * @param {number} [options.minZoom=3] - 最小缩放级别。
- * @param {number} [options.maxZoom=19] - 最大缩放级别。
- * @param {L.LatLngBounds} [options.bounds=L.latLngBounds([-85.0511287798, -180],[85.0511287798, 180])] - 显示范围。
- * @param {L.Browser} [options.retina=L.Browser.retina] - 浏览器显示分辨率。
- * @param {string} [options.tileProxy] - 服务代理地址。
- * @param {string} [options.attribution='Map Data © 2018 Baidu - GS(2016)2089号 - Data © 长地万方'] - 版权信息。
- * @usage
- */
- var BaiduTileLayer = external_L_default().TileLayer.extend({
- /**
- * @member {string} BaiduTileLayer.prototype.url
- * @description 切片地址。
- */
- url: "http://online{num}.map.bdimg.com/onlinelabel/?qt=tile&x={x}&y={y}&z={z}&styles={styles}&udt=20150815&scaler=1",
- options: {
- minZoom: 3,
- maxZoom: 19,
- bounds: external_L_default().latLngBounds(external_L_default().latLng(-85.0511287798, -180), external_L_default().latLng(85.0511287798, 180)),
- retina: (external_L_default()).Browser.retina,
- attribution: core_Attributions.Baidu.attribution
- },
- initialize: function (url, options) {
- if (url) {
- this.url = url;
- }
- external_L_default().setOptions(this, options);
- if (this.options.retina) {
- this.options.maxZoom = 18;
- }
- external_L_default().stamp(this);
- },
- /**
- * @function BaiduTileLayer.prototype.getTileUrl
- * @description 获取切片地址。
- * @param {Object} coords - 行列号。
- * @returns {string} 切片地址。
- */
- getTileUrl: function (coords) {
- var url = external_L_default().Util.template(this.url, {
- num: Math.abs((coords.x + coords.y) % 8) + 1,
- x: coords.x,
- y: -coords.y - 1,
- z: this._getZoomForUrl(),
- styles: this.options.retina ? 'ph' : 'pl'
- });
- //支持代理
- if (this.options.tileProxy) {
- url = this.options.tileProxy + encodeURIComponent(url);
- }
- return url;
- }
- });
- var baiduTileLayer = function (url, options) {
- return new BaiduTileLayer(url, options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/mapping/CloudTileLayer.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class CloudTileLayer
- * @deprecatedclassinstance L.supermap.cloudTileLayer
- * @classdesc 超图云服务图层。
- * @category ThirdPartyMap
- * @extends {L.TileLayer}
- * @param {string} [url='http://t2.dituhui.com/FileService/image?map={mapName}&type={type}&x={x}&y={y}&z={z}'] - 服务地址。
- * @param {Object} options - 参数。
- * @param {string} [options.type='web'] - type。
- * @param {number} [options.minZoom=3] - 最小缩放级别。
- * @param {number} [options.maxZoom=18] - 最大缩放级别。
- * @param {string} [options.mapName='quanguo'] - 地图名称。
- * @param {string} [options.attribution='Map Data ©2014 SuperMap - GS(2014)6070号-data©Navinfo'] - 版权信息。
- * @usage
- */
- var CloudTileLayer = external_L_default().TileLayer.extend({
- defaultURL: 'http://t2.dituhui.com/FileService/image',
- options: {
- /**
- * @member {string} [CloudTileLayer.prototype.options='quanguo']
- * @description 地图名称。
- */
- mapName: "quanguo",
- /**
- * @member {string} CloudTileLayer.prototype.type
- * @description 地图投影。
- */
- type: "web",
- minZoom: 3,
- maxZoom: 18,
- attribution: core_Attributions.Cloud.attribution
- },
- initialize: function (url, options) {
- external_L_default().setOptions(this, options);
- var cloudURL = url || this.defaultURL;
- this._url = cloudURL + "?map=" + this.options.mapName + "&type=" + this.options.type;
- external_L_default().stamp(this);
- },
- /**
- * @function CloudTileLayer.prototype.getTileUrl
- * @description 获取切片地址。
- * @param {Object} coords - 行列号。
- * @returns {string} 切片地址。
- */
- getTileUrl: function (coords) {
- var layerUrl = this._url;
- var tileUrl = layerUrl + "&x=" + coords.x + "&y=" + coords.y + "&z=" + coords.z;
- //支持代理
- if (this.options.tileProxy) {
- tileUrl = this.options.tileProxy + encodeURIComponent(tileUrl);
- }
- return tileUrl;
- }
- });
- var cloudTileLayer = function (url, options) {
- return new CloudTileLayer(url, options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/mapping/ImageMapLayer.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ImageMapLayer
- * @deprecatedclassinstance L.supermap.imageMapLayer
- * @classdesc SuperMap iServer 的 REST 地图服务的图层(SuperMap iServer Java 6R 及以上分块动态 REST 图层)。使用 Image 资源出图。
- * @category iServer Map Tile
- * @extends {L.Layer}
- * @example
- * new ImageMapLayer(url).addTo(map);
- * @param {string} url - 服务地址,如:http://{ip}:{port}/iserver/services/map-china400/rest/maps/China。
- * @param {Object} options - 参数。
- * @param {string} [options.layersID] - 获取需要切片的地图图层 ID,即指定需要切片的地图图层,可以是临时图层集,也可以是当前地图中图层的组合。
- * @param {boolean} [options.redirect=false] - 是否重定向,如果为 true,则将请求重定向到瓦片的真实地址;如果为 false,则响应体中是瓦片的字节流。
- * @param {boolean} [options.transparent=true] - 地图瓦片是否透明。
- * @param {boolean} [options.cacheEnabled=true] - 是否启用缓存。
- * @param {boolean} [options.clipRegionEnabled=false] - 是否启用地图裁剪。
- * @param {L.Path} [options.clipRegion] - 地图显示裁剪的区域(区域为一个面对象)。当 clipRegionEnabled = true 时有效,即地图只显示该区域覆盖的部分。
- * @param {Object} [options.prjCoordSys] - 请求的地图的坐标参考系统。 如:prjCoordSys={"epsgCode":3857}。
- * @param {boolean} [options.overlapDisplayed=false] - 地图对象在同一范围内,是否重叠显示。
- * @param {string} [options.overlapDisplayedOptions] - 避免地图对象压盖显示的过滤选项。
- * @param {number} [options.opacity=1] - 图层不透明度。
- * @param {string} [options.alt] - 图像无法显示时的提示文字。
- * @param {string} [options.pane='tilePane'] - 图层所归属的 map DOM 的分组。
- * @param {boolean} [options.interactive=false] - 是否响应鼠标点击或悬停等交互事件。
- * @param {boolean} [options.crossOrigin=false] - 是否设置跨域属性。
- * @param {string} [options.errorOverlayUrl] - 图层未能加载时显示的瓦片地址。
- * @param {number} [options.zIndex=1] - 设置图层的层级。
- * @param {string} [options.className] - 自定义 dom 元素的 className。
- * @param {number} [options.updateInterval=150] - 平移时图层延迟刷新间隔时间。
- * @param {string} [options.tileProxy] - 服务代理地址。
- * @param {string} [options.format='png'] - 瓦片表述类型,支持 "png" 、"webp"、"bmp" 、"jpg"、 "gif" 等图片格式。
- * @param {(NDVIParameter|HillshadeParameter)} [options.rasterfunction] - 栅格分析参数。
- * @param {string} [options.attribution='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>'] - 版权信息。
- * @fires ImageMapLayer#load
- * @fires ImageMapLayer#error
- * @fires ImageMapLayer#loading
- * @usage
- */
- var ImageMapLayer = external_L_namespaceObject.Layer.extend({
- options: {
- //如果有layersID,则是在使用专题图
- layersID: null,
- //如果为 true,则将请求重定向到图片的真实地址;如果为 false,则响应体中是图片的字节流
- redirect: false,
- //地图图片是否透明
- transparent: true,
- //是否启用服务器缓存
- cacheEnabled: true,
- //地图显示裁剪的区域是否有效
- clipRegionEnabled: false,
- //地图显示裁剪的区域
- clipRegion: null,
- //请求的地图的坐标参考系统。 如:prjCoordSys= {"epsgCode":3857}。
- prjCoordSys: null,
- //地图对象在同一范围内,是否重叠显示
- overlapDisplayed: false,
- //避免地图对象压盖显示的过滤选项
- overlapDisplayedOptions: null,
- //图层不透明度
- opacity: 1,
- //图像无法显示时的提示文字
- alt: '',
- //图层所归属的map DOM的分组。默认为:"tilePane"
- pane: 'tilePane',
- //是否响应鼠标点击或悬停交互事件
- interactive: false,
- //是否设置跨域属性
- crossOrigin: false,
- //图层未能加载时显示的瓦片地址
- errorOverlayUrl: '',
- //设置图层的显示层级
- zIndex: 1,
- //自定义的html class name
- className: '',
- //版权信息
- attribution: core_Attributions.Common.attribution,
- //平移时图层延迟刷新间隔时间。
- updateInterval: 150,
- //启用托管地址。
- tileProxy: null,
- format: 'png'
- },
- initialize: function(url, options) {
- this._url = url;
- external_L_namespaceObject.Util.setOptions(this, options);
- },
- /**
- * @private
- * @function ImageMapLayer.prototype.onAdd
- * @description 添加到地图。
- * @param {L.Map} map - Leaflet Map 对象。
- */
- onAdd: function(map) {
- this.update = external_L_namespaceObject.Util.throttle(this.update, this.options.updateInterval, this);
- map.on('moveend', this.update, this);
- if (this._currentImage && this._currentImage._bounds.equals(this._map.getBounds())) {
- map.addLayer(this._currentImage);
- } else if (this._currentImage) {
- this._map.removeLayer(this._currentImage);
- this._currentImage = null;
- }
- this.update();
- },
- /**
- * @private
- * @function ImageMapLayer.prototype.onRemove
- * @description 从地图上移除。
- */
- onRemove: function() {
- // eslint-disable-line no-unused-vars
- if (this._currentImage) {
- this._map.removeLayer(this._currentImage);
- }
- this._map.off('moveend', this.update, this);
- },
- /**
- * @function ImageMapLayer.prototype.bringToFront
- * @description 置顶当前图层。
- */
- bringToFront: function() {
- this.options.position = 'front';
- if (this._currentImage) {
- this._currentImage.bringToFront();
- }
- return this;
- },
- /**
- * @function ImageMapLayer.prototype.bringToFront
- * @description 置底当前图层。
- */
- bringToBack: function() {
- this.options.position = 'back';
- if (this._currentImage) {
- this._currentImage.bringToBack();
- }
- return this;
- },
- /**
- * @function ImageMapLayer.prototype.getOpacity
- * @description 获取图层透明度。
- * @returns {number} 图层的透明度。
- */
- getOpacity: function() {
- return this.options.opacity;
- },
- /**
- * @function ImageMapLayer.prototype.setOpacity
- * @description 设置图层不透明度。
- */
- setOpacity: function(opacity) {
- this.options.opacity = opacity;
- if (this._currentImage) {
- this._currentImage.setOpacity(opacity);
- }
- return this;
- },
- /**
- * @function ImageMapLayer.prototype.getImageUrl
- * @description 获取 image 图层请求地址,子类可重写实现。
- * @returns {string} 请求瓦片地址。
- */
- getImageUrl: function(params) {
- let serviceUrl = Util.urlPathAppend(this._url, `image.${this.options.format}`);
- let imageUrl =
- serviceUrl + external_L_namespaceObject.Util.getParamString(Object.assign({}, this._initAllRequestParams(), params), serviceUrl);
- imageUrl = SecurityManager.appendCredential(imageUrl);
- //支持代理
- if (this.options.tileProxy) {
- imageUrl = this.options.tileProxy + encodeURIComponent(imageUrl);
- }
- if (!this.options.cacheEnabled) {
- imageUrl += '&_t=' + new Date().getTime();
- }
- return imageUrl;
- },
- //获取请求瓦片宽高以及请求范围参数
- _getImageParams: function() {
- var size = this._calculateImageSize();
- return {
- viewBounds: this._compriseBounds(this._calculateBounds()),
- width: size.x,
- height: size.y
- };
- },
- //初始化服务请求参数
- _initAllRequestParams: function() {
- var me = this,
- options = me.options || {},
- params = {};
- var redirect = options.redirect === true ? options.redirect : false;
- params['redirect'] = redirect;
- var transparent = options.transparent === true ? options.transparent : false;
- params['transparent'] = transparent;
- var cacheEnabled = options.cacheEnabled === false ? options.cacheEnabled : true;
- params['cacheEnabled'] = cacheEnabled;
- if (options.prjCoordSys) {
- params['prjCoordSys'] = JSON.stringify(options.prjCoordSys);
- }
- if (options.layersID) {
- params['layersID'] = options.layersID;
- }
- if (options.rasterfunction) {
- params['rasterfunction'] = JSON.stringify(options.rasterfunction);
- }
- if (options.clipRegionEnabled && options.clipRegion) {
- params['clipRegionEnabled'] = options.clipRegionEnabled;
- params['clipRegion'] = JSON.stringify(ServerGeometry.fromGeometry(toSuperMapGeometry(options.clipRegion)));
- }
- if (options.overlapDisplayed === false) {
- params['overlapDisplayed'] = false;
- if (options.overlapDisplayedOptions) {
- params['overlapDisplayedOptions'] = me.overlapDisplayedOptions.toString();
- }
- } else {
- params['overlapDisplayed'] = true;
- }
- return params;
- },
- //初始化请求链接
- _requestImage: function(params, bounds) {
- var imageUrl = this.getImageUrl(params);
- this._loadImage(imageUrl, bounds);
- },
- //加载请求图层
- _loadImage: function(url, bounds) {
- if (!this._map) {
- return;
- }
- var image = new external_L_namespaceObject.ImageOverlay(url, bounds, {
- opacity: 0,
- alt: this.options.alt,
- zIndex: this.options.zIndex,
- className: this.options.className,
- errorOverlayUrl: this.options.error,
- crossOrigin: this.options.crossOrigin,
- pane: this.options.pane || this.getPane(),
- interactive: this.options.interactive
- }).addTo(this._map);
- var onLoad = function(e) {
- image.off('error', onError, this);
- var map = this._map;
- if (!map) {
- return;
- }
- var newImage = e.target;
- var oldImage = this._currentImage;
- if (newImage._bounds && newImage._bounds.equals(bounds) && newImage._bounds.equals(map.getBounds())) {
- this._currentImage = newImage;
- if (this.options.position === 'front') {
- this.bringToFront();
- }
- if (this.options.position === 'back') {
- this.bringToBack();
- }
- if (this._currentImage._map) {
- this._currentImage.setOpacity(this.options.opacity);
- }
- oldImage && map.removeLayer(oldImage);
- oldImage && oldImage._map && oldImage._map.removeLayer(oldImage);
- } else {
- map.removeLayer(newImage);
- }
- /**
- * @event ImageMapLayer#load
- * @description 请求图层加载完成后触发。
- * @property {L.Bounds} bounds - 图层 bounds。
- */
- this.fire('load', { bounds: bounds });
- };
- var onError = function() {
- this._map.removeLayer(image);
- /**
- * @event ImageMapLayer#error
- * @description 请求图层加载失败后触发。
- */
- this.fire('error');
- image.off('load', onLoad, this);
- }
- image.once('load', onLoad, this);
- image.once('error', onError, this);
- /**
- * @event ImageMapLayer#loading
- * @description 请求图层加载中触发。
- * @property {L.Bounds} bounds - 图层 bounds。
- */
- this.fire('loading', { bounds: bounds });
- },
- /**
- * @function ImageMapLayer.prototype.update
- * @description 更新图层。
- */
- update: function() {
- if (!this._map) {
- return;
- }
- var zoom = this._map.getZoom();
- var bounds = this._map.getBounds();
- if (zoom > (this._map.options.maxZoom|| 18) || zoom < (this._map.options.minZoom || 0)) {
- if (this._currentImage) {
- this._currentImage._map.removeLayer(this._currentImage);
- this._currentImage = null;
- }
- return;
- }
- var params = this._getImageParams();
- if (params) {
- this._requestImage(params, bounds);
- } else if (this._currentImage) {
- this._currentImage._map.removeLayer(this._currentImage);
- this._currentImage = null;
- }
- },
- //将像素坐标转成点坐标
- _calculateBounds: function() {
- var pixelBounds = this._map.getPixelBounds();
- var sw = this._map.unproject(pixelBounds.getBottomLeft());
- var ne = this._map.unproject(pixelBounds.getTopRight());
- var neProjected = this._map.options.crs.project(ne);
- var swProjected = this._map.options.crs.project(sw);
- return external_L_default().bounds(neProjected, swProjected);
- },
- //转换viewBounds为JSON字符串
- _compriseBounds: function(boundsProjected) {
- var projBounds = {
- leftBottom: {
- x: boundsProjected.getBottomLeft().x,
- y: boundsProjected.getTopRight().y
- },
- rightTop: {
- x: boundsProjected.getTopRight().x,
- y: boundsProjected.getBottomLeft().y
- }
- };
- return JSON.stringify(projBounds);
- },
- //计算图层的宽高
- _calculateImageSize: function() {
- var map = this._map;
- var bounds = map.getPixelBounds();
- var size = map.getSize();
- var sw = map.unproject(bounds.getBottomLeft());
- var ne = map.unproject(bounds.getTopRight());
- var top = map.latLngToLayerPoint(ne).y;
- var bottom = map.latLngToLayerPoint(sw).y;
- if (top > 0 || bottom < size.y) {
- size.y = bottom - top;
- }
- return size;
- }
- });
- var imageMapLayer = function(url, options) {
- return new ImageMapLayer(url, options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/mapping/TileLayer.WMTS.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class WMTSLayer
- * @deprecatedclassinstance L.supermap.wmtsLayer
- * @classdesc wmts 图层类。
- * @category OGC
- * @extends {L.TileLayer}
- * @param {string} url - 服务地址。
- * @param {Object} options - 参数。
- * @param {string} options.layer - 显示的图层。
- * @param {string} [options.tileProxy] - 服务代理地址。
- * @param {Object} [options.style] - 图层样式。
- * @param {string} [options.format='image/png'] - wmts 图像格式('image/png'用于具有透明度的图层)。
- * @param {(number|L.Point)} [options.tileSize='256'] - 瓦片大小。
- * @param {string} [options.requestEncoding='KVP'] - KVP 或者 REST 的请求方式。
- * @param {string} [options.tilematrixSet] - 瓦片矩阵集。
- * @param {Array.<WMTSLayer.matrix>} [options.matrixIds] - 瓦片矩阵对象。不设置时,默认为获取当前级别为 tilematrix 参数。
- * @param {string} [options.version='1.0.0'] - 版本。
- * @param {string} [options.attribution] - 版权信息。
- * @param {string} [options.noWrap=true] - 图层是否 X 方向平铺。
- * @usage
- */
- /**
- * @typedef {Object} WMTSLayer.matrix
- * @description 瓦片矩阵。
- * @property {string} identifier - 瓦片矩阵标识符。
- */
- var WMTSLayer = external_L_default().TileLayer.extend({
- options: {
- version: '1.0.0',
- style: '',
- tilematrixSet: '',
- format: 'image/png',
- tileSize: 256,
- matrixIds: null,
- layer: '',
- requestEncoding: 'KVP',
- attribution: '',
- noWrap: true
- },
- //todo 自动获取Capabilities
- initialize: function (url, options) { // (String, Object)
- this._url = url;
- external_L_default().setOptions(this, options);
- var opt = this.options;
- if (opt.requestEncoding === "REST") {
- var formatSuffixMap = {
- "image/png": "png",
- "image/png8": "png",
- "image/png24": "png",
- "image/png32": "png",
- "png": "png",
- "image/jpeg": "jpg",
- "image/jpg": "jpg",
- "jpeg": "jpg",
- "jpg": "jpg"
- };
- this.formatSuffix = "." + (formatSuffixMap[opt.format] || opt.format.split("/").pop() || "png");
- } else {
- opt.requestEncoding = "KVP";
- }
-
- },
- /**
- * @function WMTSLayer.prototype.getTileUrl
- * @description 获取切片地址。
- * @param {Object} coords - 行列号。
- * @returns {string} 切片地址。
- */
- getTileUrl: function (coords) { // (Point, Number) -> String
- var zoom = this._getZoomForUrl();
- var ident = this.options.matrixIds ? this.options.matrixIds[zoom].identifier : zoom;
- var index = this._url.indexOf('?');
- var url = index > -1 ? this._url.substring(0, this._url.indexOf('?')) : this._url;
- var urlParams = index > -1 ? this._url.substring(this._url.indexOf('?')) : '';
- url = external_L_default().Util.template(url, {s: this._getSubdomain(coords)});
- var obj = {
- service: 'WMTS',
- request: 'GetTile',
- version: this.options.version,
- style: this.options.style,
- tilematrixSet: this.options.tilematrixSet,
- format: this.options.format,
- width: this.options.tileSize,
- height: this.options.tileSize,
- layer: this.options.layer,
- tilematrix: ident,
- tilerow: coords.y,
- tilecol: coords.x
- };
- if (this.options.tileProxy) {
- url = this.options.tileProxy + url;
- }
- if (this.options.requestEncoding === 'KVP') {
- url += external_L_default().Util.getParamString(obj, url);
- } else if (this.options.requestEncoding === 'REST') {
- var params = "/" + obj.layer + "/" + obj.style + "/" + obj.tilematrixSet + "/" + obj.tilematrix + "/" + obj.tilerow + "/" + obj.tilecol + this.formatSuffix;
- url += params;
- }
- url = Util.urlAppend(url, urlParams);
- url = SecurityManager.appendCredential(url);
- return url;
- }
- });
- var wmtsLayer = function (url, options) {
- return new WMTSLayer(url, options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/mapping/TiandituTileLayer.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class TiandituTileLayer
- * @deprecatedclassinstance L.supermap.tiandituTileLayer
- * @classdesc 天地图图层类。
- * @category ThirdPartyMap
- * @extends WMTSLayer
- * @param {Object} options - 参数。
- * @param {string} [options.url='https://t{s}.tianditu.gov.cn/{layer}_{proj}/wmts?'] - 服务地址。
- * @param {string} options.key - 天地图服务密钥。详见 {@link https://lbs.tianditu.gov.cn/server/MapService.html}
- * @param {string} [options.layerType='vec'] - 图层类型。( vec: 矢量图层,img: 影像图层,ter: 地形图层)
- * @param {string} [options.style='default'] - 图层风格。
- * @param {string} [options.format='tiles'] - 格式。
- * @param {boolean} [options.isLabel=false] - 是否是标注图层。
- * @param {Array.<number>} [options.subdomains=[0, 1, 2, 3, 4, 5, 6, 7]] - 子域名数组。
- * @param {string} [options.attribution='Map Data <a href='https://www.tianditu.gov.cn' target='_blank'><img style='background-color:transparent;bottom:2px;opacity:1;' src='https://api.tianditu.gov.cn/img/map/logo.png' width='53px' height='22px' opacity='0'></a>'] - 版权信息
- * @param {string} [options.noWrap=true] - 图层是否 X 方向平铺。
- * @usage
- */
- var TiandituTileLayer = WMTSLayer.extend({
- layerLabelMap: {
- vec: 'cva',
- ter: 'cta',
- img: 'cia'
- },
- layerZoomMap: {
- vec: 18,
- ter: 14,
- img: 18
- },
- options: {
- layerType: 'vec', //(vec:矢量图层,vec:矢量标签图层,img:影像图层,cia:影像标签图层,ter:地形,cta:地形标签图层)
- isLabel: false,
- attribution: core_Attributions.Tianditu.attribution,
- url: 'https://t{s}.tianditu.gov.cn/{layer}_{proj}/wmts?',
- zoomOffset: 1,
- key: '',
- dpi: 96,
- style: 'default',
- format: 'tiles',
- subdomains: [0, 1, 2, 3, 4, 5, 6, 7],
- bounds: [
- [-90, -180],
- [90, 180]
- ],
- noWrap: true
- },
- initialize: function (options) {
- options = options || {};
- external_L_default().setOptions(this, options);
- this.options.layer = this.options.isLabel ? this.layerLabelMap[this.options.layerType] : this.options.layerType;
- this.options.maxZoom = this.layerZoomMap[this.options.layerType] - 1;
- WMTSLayer.prototype.initialize.call(this, this.options.url, this.options);
- external_L_default().stamp(this);
- if (this.options.key) {
- this._url = `${this._url}tk=${this.options.key}`;
- }
- },
- onAdd: function (map) {
- this.options.tilematrixSet = map.options.crs.code === "EPSG:4326" ? "c" : "w";
- this._url = this._url.replace("{layer}", this.options.layer).replace("{proj}", this.options.tilematrixSet);
- WMTSLayer.prototype.onAdd.call(this, map);
- },
- _isValidTile: function (coords) {
- const crs = this._map.options.crs;
- if (!crs.infinite) {
- const bounds = this._globalTileRange;
- if (
- ((!crs.wrapLng || this.options.noWrap) && (coords.x < bounds.min.x || coords.x > bounds.max.x)) ||
- (!crs.wrapLat && (coords.y < bounds.min.y || coords.y > bounds.max.y))
- ) {
- return false;
- }
- }
- if (!this.options.bounds) {
- return true;
- }
- const tileBounds = this._tileCoordsToBounds(coords);
- return external_L_default().latLngBounds(this.options.bounds).overlaps(tileBounds);
- }
- });
- var tiandituTileLayer = function (options) {
- return new TiandituTileLayer(options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/mapping/TiledMapLayer.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
-
-
-
-
-
-
-
-
-
- /**
- * @class TiledMapLayer
- * @deprecatedclassinstance L.supermap.tiledMapLayer
- * @classdesc SuperMap iServer 的 REST 地图服务的图层(SuperMap iServer Java 6R 及以上分块动态 REST 图层)。使用 TileImage 资源出图。
- * @category iServer Map Tile
- * @extends {L.TileLayer}
- * @example
- * new TiledMapLayer(url).addTo(map);
- * @param {string} url - 服务地址,例如: http://{ip}:{port}/iserver/services/map-world/rest/maps/World。
- * @param {Object} options - 参数。
- * @param {string} [options.layersID] - 获取进行切片的地图图层 ID,即指定进行地图切片的图层,可以是临时图层集,也可以是当前地图中图层的组合
- * @param {boolean} [options.redirect=false] - 是否重定向,如果为 true,则将请求重定向到瓦片的真实地址;如果为 false,则响应体中是瓦片的字节流。
- * @param {boolean} [options.transparent=true] - 是否背景透明。
- * @param {boolean} [options.cacheEnabled=true] - 启用缓存。
- * @param {boolean} [options.clipRegionEnabled=false] - 是否启用地图裁剪。
- * @param {L.Path} [options.clipRegion] - 地图显示裁剪的区域。是一个面对象,当 clipRegionEnabled = true 时有效,即地图只显示该区域覆盖的部分。
- * @param {Object} [options.prjCoordSys] - 请求的地图的坐标参考系统。 如:prjCoordSys={"epsgCode":3857}。
- * @param {boolean} [options.overlapDisplayed=false] - 地图对象在同一范围内时,是否重叠显示。
- * @param {string} [options.overlapDisplayedOptions] - 避免地图对象压盖显示的过滤选项。
- * @param {string} [options.tileversion] - 切片版本名称,cacheEnabled 为 true 时有效。如果没有设置 tileversion 参数,而且当前地图的切片集中存在多个版本,则默认使用最后一个更新版本。
- * @param {CRS} [options.crs] - 坐标系统类。
- * @param {string} [options.tileProxy] - 服务代理地址。
- * @param {string} [options.format='png'] - 瓦片表述类型,支持 "png" 、"webp"、"bmp" 、"jpg"、 "gif" 等图片格式。
- * @param {(number|L.Point)} [options.tileSize=256] - 瓦片大小。
- * @param {(NDVIParameter|HillshadeParameter)} [options.rasterfunction] - 栅格分析参数。
- * @param {string} [options.attribution='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>'] - 版权信息。
- * @param {Array.<number>} [options.subdomains] - 子域名数组。
- * @fires TiledMapLayer#tilesetsinfoloaded
- * @fires TiledMapLayer#tileversionschanged
- * @usage
- */
- var TiledMapLayer = external_L_default().TileLayer.extend({
- options: {
- //如果有layersID,则是在使用专题图
- layersID: null,
- //如果为 true,则将请求重定向到瓦片的真实地址;如果为 false,则响应体中是瓦片的字节流
- redirect: false,
- transparent: true,
- cacheEnabled: true,
- clipRegionEnabled: false,
- //地图显示裁剪的区域
- clipRegion: null,
- //请求的地图的坐标参考系统。 如:prjCoordSys={"epsgCode":3857}
- prjCoordSys: null,
- //地图对象在同一范围内时,是否重叠显示
- overlapDisplayed: false,
- //避免地图对象压盖显示的过滤选项
- overlapDisplayedOptions: null,
- //切片版本名称,cacheEnabled 为 true 时有效。
- tileversion: null,
- crs: null,
- format: 'png',
- //启用托管地址。
- tileProxy:null,
- attribution: core_Attributions.Common.attribution,
- subdomains: null
- },
- initialize: function (url, options) {
- this._url = url;
- external_L_default().TileLayer.prototype.initialize.apply(this, arguments);
- external_L_default().setOptions(this, options);
- external_L_default().stamp(this);
- //当前切片在切片集中的index
- this.tileSetsIndex = -1;
- this.tempIndex = -1;
- },
- /**
- * @private
- * @function TiledMapLayer.prototype.onAdd
- * @description 添加地图。
- * @param {L.Map} map - Leaflet Map 对象。
- */
- onAdd: function (map) {
- this._crs = this.options.crs || map.options.crs;
- external_L_default().TileLayer.prototype.onAdd.call(this, map);
- },
- /**
- * @function TiledMapLayer.prototype.getTileUrl
- * @description 根据行列号获取瓦片地址。
- * @param {Object} coords - 行列号。
- * @returns {string} 瓦片地址。
- */
- getTileUrl: function (coords) {
- var scale = this.getScaleFromCoords(coords);
- var layerUrl = this._getLayerUrl();
- var tileUrl = layerUrl + "&scale=" + scale + "&x=" + coords.x + "&y=" + coords.y;
- //支持代理
- if (this.options.tileProxy) {
- tileUrl = this.options.tileProxy + encodeURIComponent(tileUrl);
- }
- if (!this.options.cacheEnabled) {
- tileUrl += "&_t=" + new Date().getTime();
- }
- if (this.options.subdomains) {
- tileUrl = external_L_default().Util.template(tileUrl, {s: this._getSubdomain(coords)});
- }
- return tileUrl;
- },
- /**
- * @function TiledMapLayer.prototype.getScale
- * @description 根据缩放级别获取比例尺。
- * @param {number} zoom - 缩放级别。
- * @returns {number} 比例尺。
- */
- getScale: function (zoom) {
- var me = this;
- //返回当前比例尺
- var z = zoom || me._map.getZoom();
- return me.scales[z];
- },
- /**
- * @function TiledMapLayer.prototype.getScaleFromCoords
- * @description 通过行列号获取比例尺。
- * @param {Object} coords - 行列号。
- * @returns {number} 比例尺。
- */
- getScaleFromCoords: function (coords) {
- var me = this,
- scale;
- if (me.scales && me.scales[coords.z]) {
- return me.scales[coords.z];
- }
- me.scales = me.scales || {};
- scale = me.getDefaultScale(coords);
- me.scales[coords.z] = scale;
- return scale;
- },
- /**
- * @private
- * @function TiledMapLayer.prototype.getDefaultScale
- * @description 获取默认比例尺信息。
- * @param {Object} coords - 坐标对象参数。
- */
- getDefaultScale: function (coords) {
- var me = this,
- crs = me._crs;
- if (crs.scales) {
- return crs.scales[coords.z];
- } else {
- var tileBounds = me._tileCoordsToBounds(coords);
- var ne = crs.project(tileBounds.getNorthEast());
- var sw = crs.project(tileBounds.getSouthWest());
- var tileSize = me.options.tileSize;
- var resolution = Math.max(
- Math.abs(ne.x - sw.x) / tileSize,
- Math.abs(ne.y - sw.y) / tileSize
- );
- var mapUnit = Unit.METER;
- if (crs.code) {
- var array = crs.code.split(':');
- if (array && array.length > 1) {
- var code = parseInt(array[1]);
- mapUnit = code && code >= 4000 && code <= 5000 ? Unit.DEGREE : Unit.METER;
- }
- }
- return resolutionToScale(resolution, 96, mapUnit);
- }
- },
- /**
- * @function TiledMapLayer.prototype.setTileSetsInfo
- * @description 设置瓦片集信息。
- * @param {Object} tileSets - 瓦片对象集。
- */
- setTileSetsInfo: function (tileSets) {
- this.tileSets = tileSets;
- if (external_L_default().Util.isArray(this.tileSets)) {
- this.tileSets = this.tileSets[0];
- }
- if (!this.tileSets) {
- return;
- }
- /**
- * @event TiledMapLayer#tilesetsinfoloaded
- * @description 瓦片集信息设置完成后触发。
- * @property {Array.<Object>} tileVersions - 瓦片集信息。
- */
- this.fire('tilesetsinfoloaded', {
- tileVersions: this.tileSets.tileVersions
- });
- this.changeTilesVersion();
- },
- /**
- * @function TiledMapLayer.prototype.lastTilesVersion
- * @description 请求上一个版本切片,并重新绘制。
- */
- lastTilesVersion: function () {
- this.tempIndex = this.tileSetsIndex - 1;
- this.changeTilesVersion();
- },
- /**
- * @function TiledMapLayer.prototype.nextTilesVersion
- * @description 请求下一个版本切片,并重新绘制。
- */
- nextTilesVersion: function () {
- this.tempIndex = this.tileSetsIndex + 1;
- this.changeTilesVersion();
- },
- /**
- * @function TiledMapLayer.prototype.changeTilesVersion
- * @description 切换到某一版本的切片,并重绘。通过 this.tempIndex 保存需要切换的版本索引
- */
- changeTilesVersion: function () {
- var me = this;
- //切片版本集信息是否存在
- if (me.tileSets == null) {
- //版本信息为空,重新查询,查询成功继续跳转到相应的版本
- //me.getTileSetsInfo();
- return;
- }
- if (me.tempIndex === me.tileSetsIndex || this.tempIndex < 0) {
- return;
- }
- //检测index是否可用
- var tileVersions = me.tileSets.tileVersions;
- if (tileVersions && me.tempIndex < tileVersions.length && me.tempIndex >= 0) {
- var name = tileVersions[me.tempIndex].name;
- var result = me.mergeTileVersionParam(name);
- if (result) {
- me.tileSetsIndex = me.tempIndex;
- /**
- * @event TiledMapLayer#tileversionschanged
- * @description 切片的版本切换和重绘成功之后触发。
- * @property {Object} tileVersion - 该版本的切片。
- */
- me.fire('tileversionschanged', {
- tileVersion: tileVersions[me.tempIndex]
- });
- }
- }
- },
- /**
- * @function TiledMapLayer.prototype.updateCurrentTileSetsIndex
- * @description 手动设置当前切片集索引,目前主要提供给控件使用。
- * @param {number} index - 索引值。
- */
- updateCurrentTileSetsIndex: function (index) {
- this.tempIndex = index;
- },
- /**
- * @function TiledMapLayer.prototype.mergeTileVersionParam
- * @description 更改URL请求参数中的切片版本号,并重绘。
- * @param {string} version - 切片版本号。
- * @returns {boolean} 是否成功。
- */
- mergeTileVersionParam: function (version) {
- if (version) {
- this.requestParams["tileversion"] = version;
- this._paramsChanged = true;
- this.redraw();
- this._paramsChanged = false;
- return true;
- }
- return false;
- },
- _getLayerUrl: function () {
- if (this._paramsChanged) {
- this._layerUrl = this._createLayerUrl();
- }
- return this._layerUrl || this._createLayerUrl();
- },
- _createLayerUrl: function () {
- let layerUrl = Util.urlPathAppend(this._url, `tileImage.${this.options.format}`);
- this.requestParams = this.requestParams || this._getAllRequestParams();
- layerUrl = Util.urlAppend(layerUrl, external_L_namespaceObject.Util.getParamString(this.requestParams));
- layerUrl = SecurityManager.appendCredential(layerUrl);
- this._layerUrl = layerUrl;
- return layerUrl;
- },
- _getAllRequestParams: function () {
- var me = this,
- options = me.options || {},
- params = {};
- var tileSize = this.options.tileSize;
- if (!(tileSize instanceof (external_L_default()).Point)) {
- tileSize = external_L_default().point(tileSize, tileSize);
- }
- params["width"] = tileSize.x;
- params["height"] = tileSize.y;
- params["redirect"] = options.redirect === true;
- params["transparent"] = options.transparent === true;
- params["cacheEnabled"] = !(options.cacheEnabled === false);
- if (options.prjCoordSys) {
- params["prjCoordSys"] = JSON.stringify(options.prjCoordSys);
- }
- if (options.layersID) {
- params["layersID"] = options.layersID.toString();
- }
- if (options.clipRegionEnabled && options.clipRegion) {
- options.clipRegion = ServerGeometry.fromGeometry(toSuperMapGeometry(options.clipRegion));
- params["clipRegionEnabled"] = options.clipRegionEnabled;
- params["clipRegion"] = JSON.stringify(options.clipRegion);
- }
- //切片的起始参考点,默认为地图范围的左上角。
- var crs = me._crs;
- if (crs.options && crs.options.origin) {
- params["origin"] = JSON.stringify({
- x: crs.options.origin[0],
- y: crs.options.origin[1]
- });
- } else if (crs.projection && crs.projection.bounds) {
- var bounds = crs.projection.bounds;
- var tileOrigin = external_L_default().point(bounds.min.x, bounds.max.y);
- params["origin"] = JSON.stringify({
- x: tileOrigin.x,
- y: tileOrigin.y
- });
- }
- if (options.overlapDisplayed === false) {
- params["overlapDisplayed"] = false;
- if (options.overlapDisplayedOptions) {
- params["overlapDisplayedOptions"] = options.overlapDisplayedOptions;
- }
- } else {
- params["overlapDisplayed"] = true;
- }
- if (params.cacheEnabled === true && options.tileversion) {
- params["tileversion"] = options.tileversion.toString();
- }
- if (options.rasterfunction) {
- params["rasterfunction"] = JSON.stringify(options.rasterfunction);
- }
- return params;
- }
- });
- var tiledMapLayer = function (url, options) {
- return new TiledMapLayer(url, options);
- };
- // EXTERNAL MODULE: ./node_modules/jsonsql/index.js
- var jsonsql = __webpack_require__(545);
- var jsonsql_default = /*#__PURE__*/__webpack_require__.n(jsonsql);
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/carto/CartoDefaultStyle.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @constant DefaultStyle
- * @description 这个 style 对应的是默认设置。
- * @category BaseTypes Style
- * @private
- */
- var DefaultStyle = {
- /**
- * @constant DefaultStyle.prototype.TEXT
- * @description 默认文本样式。
- */
- "TEXT": {
- fontSize: "14px",
- fontFamily: "Arial Unicode MS Regular,Microsoft YaHei",
- textAlign: "left",
- color: "rgba(255,255,255,0)",
- fillColor: "rgba(80,80,80,1)",
- weight: 1,
- globalAlpha: 1
- },
- /**
- * @constant DefaultStyle.prototype.POINT
- * @description 默认点样式。
- */
- "POINT": {
- fillColor: "#ffcc00",
- color: "#cc3333",
- weight: 1,
- radius: 3,
- opacity: 1
- },
- /**
- * @constant DefaultStyle.prototype.LINE
- * @description 默认线样式。
- */
- "LINE": {
- color: "rgba(0,0,0,0)",
- weight: 1,
- lineCap: "butt",
- lineJoin: "round",
- dashOffset: 0,
- dashArray: [],
- opacity: 1
- },
- /**
- * @constant DefaultStyle.prototype.REGION
- * @description 默认多边形样式。
- */
- "REGION": {
- color: "rgba(0,0,0,0)",
- fillColor: "rgba(0,0,0,0)",
- weight: 1,
- lineCap: "butt",
- lineJoin: "round",
- dashOffset: 0,
- opacity: 1,
- fillOpacity: 1,
- dashArray: []
- }
- };
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/carto/CartoStyleMap.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @constant CartoStyleMap
- * @description CartoCSS 中的 style 属性名与 leaflet 的 style 属性名的对应表。
- * @category BaseTypes Style
- * @private
- */
- var CartoStyleMap = {
- /*
- * @constant CartoStyleMap.prototype.TEXT
- * @description 默认文本样式。
- */
- "TEXT": {
- "text-size": "fontSize",
- "text-face-name": "fontFamily",
- "text-align": "textAlign",
- "text-name": "textName",
- 'text-weight': 'fontWeight',
- "text-halo-color": "color",
- "text-fill": "fillColor",
- "text-comp-op": "globalCompositeOperation"
- },
- /*
- * @constant CartoStyleMap.prototype.POINT
- * @description 默认点样式。
- */
- "POINT": {
- "point-file": "iconUrl",
- "point-fill": "fillColor",
- "point-radius": "radius",
- "point-halo-color": "color",
- "point-comp-op": "globalCompositeOperation"
- },
- /*
- * @constant CartoStyleMap.prototype.LINE
- * @description 默认线样式。
- */
- "LINE": {
- "line-color": "color",
- "line-width": "weight",
- "line-cap": "lineCap",
- "line-join": "lineJoin",
- "line-dash-offset": "dashOffset",
- "line-opacity": "opacity",
- "line-dasharray": "dashArray",
- "line-comp-op": "globalCompositeOperation"
- },
- /*
- * @constant CartoStyleMap.prototype.REGION
- * @description 默认多边形样式。
- */
- "REGION": {
- "line-color": "color",
- "line-width": "weight",
- "line-cap": "lineCap",
- "line-join": "lineJoin",
- "line-dash-offset": "dashOffset",
- "line-opacity": "opacity",
- "line-dasharray": "dashArray",
- "polygon-fill": "fillColor",
- "polygon-opacity": "fillOpacity",
- "polygon-comp-op": "globalCompositeOperation"
- }
- };
- /**
- * @constant ServerStyleMap
- * @description 服务端传过来的 style 属性名与 leaflet 的 style 属性名的对应表。
- * @private
- */
- var ServerStyleMap = {
- /**
- * @member ServerStyleMap.prototype.lineWidth
- * @description 线宽。
- */
- lineWidth: {
- leafletStyle: "weight",
- type: "number",
- unit: "mm",
- defaultValue: 0.1
- },
- /**
- * @member ServerStyleMap.prototype.fillForeColor
- * @description 填充前景色。
- */
- fillForeColor: {
- leafletStyle: "fillColor",
- type: "color",
- defaultValue: "rgba(0,0,0,0)"
- },
- /**
- * @member ServerStyleMap.prototype.foreColor
- * @description 前景色。
- */
- foreColor: {
- leafletStyle: "color",
- type: "color",
- defaultValue: "rgba(0,0,0,0)"
- },
- /**
- * @member ServerStyleMap.prototype.markerSize
- * @description 图标大小。
- */
- markerSize: {
- leafletStyle: "markerSize",
- type: "number",
- unit: "mm",
- defaultValue: 2.4
- },
- /**
- * @member ServerStyleMap.prototype.lineColor
- * @description 线要素颜色。
- */
- lineColor: {
- leafletStyle: "color",
- type: "color",
- defaultValue: "#000000"
- }
- };
- /**
- * @constant CompOpMap
- * @description Canvas 中的 globalCompositeOperation 属性值与 CartoCSS 中的 CompOp 属性值对照表。
- * @private
- */
- var CompOpMap = {
- "clear": "",
- "src": "",
- "dst": "",
- "src-over": "source-over",
- "dst-over": "destination-over",
- "src-in": "source-in",
- "dst-in": "destination-in",
- "src-out": "source-out",
- "dst-out": "destination-out",
- "src-atop": "source-atop",
- "dst-atop": "destination-atop",
- "xor": "xor",
- "plus": "lighter",
- "minus": "",
- "multiply": "",
- "screen": "",
- "overlay": "",
- "darken": "",
- "lighten": "lighter",
- "color-dodge": "",
- "color-burn": "",
- "hard-light": "",
- "soft-light": "",
- "difference": "",
- "exclusion": "",
- "contrast": "",
- "invert": "",
- "invert-rgb": "",
- "grain-merge": "",
- "grain-extract": "",
- "hue": "",
- "saturation": "",
- "color": "",
- "value": ""
- };
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/carto/CartoCSSToLeaflet.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class CartoCSSToLeaflet
- * @classdesc CartoCSS 样式转 Leaflet 样式类。
- * @category BaseTypes Style
- * @param {string} url - 服务地址。
- * @private
- */
- class CartoCSSToLeaflet {
- constructor(url) {
- /**
- * @member CartoCSSToLeaflet.prototype.cartoCSS
- * @description CartoCSS 样式。
- */
- this.cartoCSS = null;
- /**
- * @member CartoCSSToLeaflet.prototype.mapUrl
- * @description 地图服务地址。
- */
- this.mapUrl = url;
- }
- /**
- * @function CartoCSSToLeaflet.prototype.pretreatedCartoCSS
- * @description CartoCSS 样式预处理。
- * @param {string} cartoStr - Carto 信息。
- * @param {Object} processCharacters - 需要处理的特征对象。
- */
- pretreatedCartoCSS(cartoStr, processCharacters) {
- if (processCharacters) {
- cartoStr = this.processCharacters(cartoStr);
- }
- this.cartoCSS = this.cartoCSS || {};
- var shaders = new CartoCSS(cartoStr).getShaders();
- if (!shaders) {
- return;
- }
- for (var i = 0; i < shaders.length; i++) {
- var element = shaders[i].elements[0];
- var attachment = shaders[i].attachment;
- this.cartoCSS[element.clean] = this.cartoCSS[element.clean] || {};
- this.cartoCSS[element.clean][attachment] = this.cartoCSS[element.clean][attachment] || [];
- this.cartoCSS[element.clean][attachment].push(shaders[i]);
- }
- }
- /**
- * @function CartoCSSToLeaflet.prototype.processCharacters
- * @description 替换一些关键符号。
- * @param {string} cartoCSSStr - cartoCSSS 信息。
- */
- processCharacters(cartoCSSStr) {
- var style = cartoCSSStr;
- if (!style) {
- return;
- }
- var me = this;
- style = style.replace(/[@]/gi, "___");
- style = style.replace(/\\#/gi, "\#");
- var cachedLayer = {};
- me.layersInfo && Object.keys(me.layersInfo).sort().forEach(function (attr) {
- var newAttr = attr.replace(/[@#\s]/gi, "___");
- var to = attr;
- var keys = Object.keys(cachedLayer);
- for (let index = keys.length; index > -1; index--) {
- if (attr.indexOf(keys[index]) > -1) {
- to = attr.replace(keys[index], cachedLayer[keys[index]]);
- break;
- }
- }
- to = to.replace(/[#]/gi, "\#");
- cachedLayer[attr] = newAttr;
- style = style.replace(new RegExp(to, "g"), newAttr);
- })
- style = style.replace(/[#]/gi, "\n#");
- //将zoom转化为scale,以免引起混淆
- style = style.replace(/\[zoom/gi, "[scale");
- return style;
- }
- /**
- * @function CartoCSSToLeaflet.prototype.pickShader
- * @description 拾取着色对象。
- * @param {string} layerName - 图层名称。
- */
- pickShader(layerName) {
- if (!this.cartoCSS) {
- return null;
- }
- var name = layerName.replace(/[@#\s]/gi, "___");
- return this.cartoCSS[name];
- }
- /**
- * @function CartoCSSToLeaflet.prototype.getDefaultStyle
- * @description 获取默认风格。
- * @param {string} type - 默认风格类型。
- */
- getDefaultStyle(type) {
- var style = {};
- //设置默认值
- var expandStyle = DefaultStyle[type];
- for (var prop in expandStyle) {
- var val = expandStyle[prop];
- style[prop] = val;
- }
- return style;
- }
- /**
- * @function CartoCSSToLeaflet.prototype.getStyleFromiPortalMarker
- * @description 从 iPortalMarker 中获取样式。
- * @param {string} icon - iPortal 图标。
- */
- getStyleFromiPortalMarker(icon) {
- if (icon.indexOf("./") == 0) {
- return null;
- }
- //兼容iportal示例的问题
- if (icon.indexOf("http://support.supermap.com.cn:8092/static/portal") == 0) {
- icon = icon.replace("http://support.supermap.com.cn:8092/static/portal", "http://support.supermap.com.cn:8092/apps/viewer/static");
- }
- return external_L_default().icon({
- iconUrl: icon,
- iconSize: external_L_default().point(48, 43),
- iconAnchor: external_L_default().point(24, 43),
- popupAnchor: external_L_default().point(0, -43)
- });
- }
- /**
- * @function CartoCSSToLeaflet.prototype.getStyleFromiPortalStyle
- * @description 从 iPortal 的风格中获取样式。
- * @param {Object} iPortalStyle - iPortal 的样式对象。
- * @param {string} type - 样式类型。
- * @param {Object} [fStyle] - 图标参数。
- */
- getStyleFromiPortalStyle(iPortalStyle, type, fStyle) {
- var featureStyle = fStyle ? JSON.parse(fStyle) : null;
- var style = {};
- if (type === 'Point' || type === 'MultiPoint') {
- var pointStyle = featureStyle || iPortalStyle.pointStyle;
- if (pointStyle.externalGraphic) {
- if (pointStyle.externalGraphic.indexOf("./") == 0) {
- return null;
- }
- //兼容iportal示例的问题
- if (pointStyle.externalGraphic.indexOf("http://support.supermap.com.cn:8092/static/portal") == 0) {
- pointStyle.externalGraphic = pointStyle.externalGraphic.replace("http://support.supermap.com.cn:8092/static/portal", "http://support.supermap.com.cn:8092/apps/viewer/static");
- }
- return external_L_default().icon({
- iconUrl: pointStyle.externalGraphic,
- iconSize: external_L_default().point(pointStyle.graphicWidth, pointStyle.graphicHeight),
- iconAnchor: external_L_default().point(-pointStyle.graphicXOffset, -pointStyle.graphicYOffset),
- popupAnchor: external_L_default().point(0, -pointStyle.graphicHeight)
- });
- }
- style.radius = pointStyle.pointRadius;
- style.color = pointStyle.strokeColor;
- style.opacity = pointStyle.strokeOpacity;
- style.lineCap = pointStyle.strokeLineCap;
- style.weight = pointStyle.strokeWidth;
- style.fillColor = pointStyle.fillColor;
- style.fillOpacity = pointStyle.fillOpacity;
- style.dashArray = this.dashStyle(pointStyle, 1);
- return style;
- }
- if (type === 'LineString' || type === 'MultiLineString' || type === 'Box') {
- var lineStyle = featureStyle || iPortalStyle.lineStyle;
- style.color = lineStyle.strokeColor;
- style.opacity = lineStyle.strokeOpacity;
- style.fillOpacity = lineStyle.fillOpacity;
- style.lineCap = lineStyle.strokeLineCap;
- style.weight = lineStyle.strokeWidth;
- style.dashArray = this.dashStyle(lineStyle, 1);
- return style;
- }
- if (type === 'Polygon' || type === 'MultiPolygon') {
- var polygonStyle = featureStyle || iPortalStyle.polygonStyle;
- style.color = polygonStyle.strokeColor;
- style.opacity = polygonStyle.strokeOpacity;
- style.lineCap = polygonStyle.strokeLineCap;
- style.weight = polygonStyle.strokeWidth;
- style.fillColor = polygonStyle.fillColor;
- style.fillOpacity = polygonStyle.fillOpacity;
- style.dashArray = this.dashStyle(polygonStyle, 1);
- return style;
- }
- }
- /**
- * @function CartoCSSToLeaflet.prototype.dashStyle
- * @description 符号样式。
- * @param {Object} style - 样式参数。
- * @param {number} widthFactor - 宽度系数。
- */
- dashStyle(style, widthFactor) {
- if (!style) {
- return [];
- }
- var w = style.strokeWidth * widthFactor;
- var str = style.strokeDashstyle;
- switch (str) {
- case 'solid':
- return [];
- case 'dot':
- return [1, 4 * w];
- case 'dash':
- return [4 * w, 4 * w];
- case 'dashdot':
- return [4 * w, 4 * w, 1, 4 * w];
- case 'longdash':
- return [8 * w, 4 * w];
- case 'longdashdot':
- return [8 * w, 4 * w, 1, 4 * w];
- default:
- if (!str) {
- return [];
- }
- if (Util.isArray(str)) {
- return str;
- }
- str = StringExt.trim(str).replace(/\s+/g, ",");
- return str.replace(/\[|\]/gi, "").split(",");
- }
- }
- /**
- * @function CartoCSSToLeaflet.prototype.getValidStyleFromCarto
- * @description 从 Carto 中获取有效的样式。
- * @param {number} zoom - 缩放级别。
- * @param {number} scale - 比例尺。
- * @param {Array.<Object>} shader - 渲染器对象数组。
- * @param {Object} feature - 要素。
- * @param {string} [fromServer] - 服务源。
- */
- getValidStyleFromCarto(zoom, scale, shader, feature, fromServer) {
- if (!shader) {
- return null;
- }
- var type = feature.type,
- attributes = feature.properties.attributes || {},
- style = this.getDefaultStyle(type);
- fromServer = (fromServer === undefined) ? true : fromServer;
- attributes.FEATUREID = feature.properties.id;
- attributes.SCALE = scale;
- var cartoStyleMap = CartoStyleMap[type];
- var fontSize, fontName;
- for (var i = 0, len = shader.length; i < len; i++) {
- var _shader = shader[i];
- var prop = cartoStyleMap[_shader.property];
- var value = _shader.getValue(attributes, zoom, true);
- if ((value !== null) && prop) {
- if (prop === "fontSize") {
- if (fromServer) {
- value *= 0.8
- }
- fontSize = value + "px";
- style.fontSize = fontSize;
- } else if (prop === "fontName") {
- fontName = value;
- style.fontName = fontName;
- } else {
- if (prop === "globalCompositeOperation") {
- value = CompOpMap[value];
- if (!value) {
- continue;
- }
- } else if (fromServer && prop === 'iconUrl') {
- value = this.mapUrl + '/tileFeature/symbols/' + value.replace(/(___)/gi, '@');
- value = value.replace(/(__0__0__)/gi, '__8__8__');
- style["iconUrl"] = value;
- continue;
- }
- if (prop === 'weight' && value < 1) {
- value = Math.ceil(value);
- }
- style[prop] = value;
- }
- }
- }
- return style;
- }
- /**
- * @function CartoCSSToLeaflet.prototype.getValidStyleFromLayerInfo
- * @description 通过图层信息获取有效的样式。
- * @param {Feature} feature - 要素。
- * @param {Object} layerInfo - 图层信息。
- */
- getValidStyleFromLayerInfo(feature, layerInfo) {
- var type = feature.type,
- style = this.getDefaultStyle(type),
- shader = layerInfo && layerInfo.layerStyle;
- if (!shader) {
- return style;
- }
- if (type === "POINT") {
- var size = Math.ceil(shader.markerSize * DOTS_PER_INCH * INCHES_PER_UNIT.mm) || 8;
- var symbolParameters = {
- "transparent": true,
- "resourceType": "SYMBOLMARKER",
- "picWidth": size,
- "picHeight": size,
- "style": JSON.stringify(shader)
- };
- style.iconUrl = Util.urlAppend(this.mapUrl + "/symbol.png", Util.getParameterString(symbolParameters));
- style.iconSize = [size, size];
- return style;
- }
- if (type === "TEXT") {
- shader = feature.properties.textStyle || layerInfo.layerStyle;
- //设置文本是否使用粗体
- style.fontWeight = shader.bold ? shader.fontWeight : "normal";
- //设置文本的尺寸(对应fontHeight属性)和行高,行高iserver不支持,默认5像素
- //固定大小的时候单位是毫米
- if (shader.fontHeight) {
- var text_h = shader.fontHeight * DOTS_PER_INCH * INCHES_PER_UNIT.mm * 0.85; //毫米转像素,服务端的字体貌似要稍微小一点
- style.fontSize = text_h + "px";
- style.textHeight = text_h;
- }
- //设置文本字体类型
- //在桌面字体钱加@时为了解决对联那种形式,但是在canvas不支持,并且添加了@会导致
- //字体大小被固定,这里需要去掉
- if (shader.fontName) {
- style.fontFamily = (shader.fontName.indexOf("@")) ?
- shader.fontName.replace(/@/g, "") : shader.fontName;
- }
- //设置对齐方式
- if (shader.align) {
- var alignStr = shader.align.replace(/TOP|MIDDLE|BASELINE|BOTTOM/, "");
- style.textAlign = alignStr.toLowerCase();
- }
- style.weight = shader.outline ? shader.outlineWidth : 0;
- if (shader.backColor) {
- style.color = "rgba(" + shader.backColor.red + "," +
- shader.backColor.green + "," +
- shader.backColor.blue +
- ",1)";
- }
- if (shader.foreColor) {
- style.fillColor = "rgba(" + shader.foreColor.red + "," +
- shader.foreColor.green + "," +
- shader.foreColor.blue +
- ",1)";
- }
- style.rotation = shader.rotation || 0;
- return style;
- }
- //目前只实现桌面系统默认的几种symbolID,非系统默认的面用颜色填充替代,线则用实线来替代
- var fillSymbolID = shader["fillSymbolID"] > 7 ? 0 : shader["fillSymbolID"];
- var lineSymbolID = shader["lineSymbolID"] > 5 ? 0 : shader["lineSymbolID"];
- for (var attr in shader) {
- var obj = ServerStyleMap[attr];
- if (!obj) {
- continue;
- }
- var leafletStyle = obj.leafletStyle;
- switch (obj.type) {
- case "number":
- {
- let value = shader[attr];
- if (obj.unit) {
- value = value * DOTS_PER_INCH * INCHES_PER_UNIT[obj.unit] * 2.5;
- }
- style[leafletStyle] = value;
- break;
- }
- case "color":
- {
- var color = shader[attr];
- let value, alpha = 1;
- if (leafletStyle === "fillColor") {
- if (fillSymbolID === 0 || fillSymbolID === 1) {
- //当fillSymbolID为0时,用颜色填充,为1是无填充,即为透明填充,alpha通道为0
- alpha = 1 - fillSymbolID;
- value = "rgba(" + color.red + "," + color.green + "," + color.blue + "," + alpha + ")";
- }
- } else if (leafletStyle === "color") {
- if (lineSymbolID === 0 || lineSymbolID === 5) {
- //对于lineSymbolID为0时,线为实线,为lineSymbolID为5时,为无线模式,即线为透明,即alpha通道为0
- alpha = lineSymbolID === 0 ? 1 : 0;
- } else {
- //以下几种linePattern分别模拟了桌面的SymbolID为1~4几种符号的linePattern
- var linePattern = [1, 0];
- switch (lineSymbolID) {
- case 1:
- linePattern = [9.7, 3.7];
- break;
- case 2:
- linePattern = [3.7, 3.7];
- break;
- case 3:
- linePattern = [9.7, 3.7, 2.3, 3.7];
- break;
- case 4:
- linePattern = [9.7, 3.7, 2.3, 3.7, 2.3, 3.7];
- break;
- default:
- break
- }
- style.lineDasharray = linePattern;
- }
- value = "rgba(" + color.red + "," + color.green + "," + color.blue + "," + alpha + ")";
- }
- style[leafletStyle] = value;
- break;
- }
- default:
- break;
- }
- }
- //处理标签文本的情况
- if (layerInfo.textField) {
- style.textAlign = "LEFT";
- }
- return style;
- }
- }
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/graphic/Graphic.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class Graphic
- * @deprecatedclassinstance L.supermap.graphic
- * @classdesc 高效率点图层要素类。
- * @category Visualization Graphic
- * @extends {L.Class}
- * @param {Object} options - 参数。
- * @param {L.LatLng} options.latLng - 经纬度。
- * @param {number} options.id - 要素id。
- * @param {(CircleStyle|CloverStyle|ImageStyle)} [options.style] - 点样式。
- * @param {Object} [options.attributes] - 要素属性。
- * @usage
- */
- var Graphic = external_L_default().Class.extend({
- initialize: function (options) {
- options = options || {};
- var latLng = options.latLng || options._latLng;
- this._latLng = external_L_default().latLng(latLng.lat, latLng.lng);
- this._style = options.style || options._canvas;
- this.attributes = options.attributes;
- this.id = options.id ? options.id : null;
- },
- /**
- * @function Graphic.prototype.getId
- * @description 获取当前要素 ID。
- * @returns {string} 要素 ID。
- */
- getId() {
- return this.id;
- },
- /**
- * @function Graphic.prototype.setId
- * @description 设置当前要素 ID。
- * @param {string} id - 要素 ID。
- */
- setId(id) {
- this.id = id;
- },
- /**
- * @function Graphic.prototype.setLatLng
- * @description 设置经纬度。
- * @param {L.LatLng} latLng - 经纬度参数。
- */
- setLatLng: function (latLng) {
- this._latLng = latLng;
- },
- /**
- * @deprecated
- * @function Graphic.prototype.setCanvas
- * @description 设置画布,已弃用该设置,请使用 setStyle 接口。
- * @param {HTMLCanvasElement} canvas - 传入需要设置的画布。
- */
- setCanvas: function (canvas) {
- this._style = canvas;
- },
- /**
- * @function Graphic.prototype.setAttributes
- * @description 设置要素属性。
- * @param {Object} attributes - 属性对象。
- */
- setAttributes: function (attributes) {
- this.attributes = attributes;
- },
- /**
- * @function Graphic.prototype.getLatLng
- * @description 获取经纬度。
- * @returns {L.LatLng} 经纬度。
- */
- getLatLng: function () {
- return this._latLng;
- },
- /**
- * @deprecated
- * @function Graphic.prototype.getCanvas
- * @description 获取画布,已弃用该设置,请使用 getStyle 接口
- * @returns {HTMLCanvasElement} 画布。
- */
- getCanvas: function () {
- return this._style;
- },
- /**
- * @function Graphic.prototype.getAttributes
- * @description 获取要素属性。
- * @returns {Object} 要素属性。
- */
- getAttributes: function () {
- return this.attributes;
- },
- /**
- * @function Graphic.prototype.setStyle
- * @description 设置样式。
- * @param {(CircleStyle|ImageStyle|CloverStyle)} style - 样式。
- */
- setStyle: function (style) {
- this._style = style;
- },
- /**
- * @function Graphic.prototype.getStyle
- * @description 获取样式。
- * @returns {(CircleStyle|ImageStyle|CloverStyle)} 样式。
- */
- getStyle: function () {
- return this._style;
- }
- });
- var graphic = function (options) {
- return new Graphic(options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/theme/ThemeFeature.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
-
-
-
-
-
-
- /**
- * @class ThemeFeature
- * @deprecatedclassinstance L.supermap.themeFeature
- * @classdesc 客户端专题图要素类。
- * 支持的 geometry 参数类型为 {@link L.Point},{@link L.LatLng},{@link L.Polyline},{@link L.Polygon}。
- * @category Visualization Theme
- * @extends {L.Class}
- * @param {(L.Path|L.Point|L.LatLng)} geometry - 要素图形。
- * @param {Object} attributes - 要素属性。
- * @usage
- */
- var ThemeFeature = external_L_default().Class.extend({
- initialize: function (geometry, attributes) {
- this.geometry = geometry;
- this.attributes = attributes;
- },
- /**
- * @function ThemeFeature.prototype.toFeature
- * @description 转为内部矢量要素。
- * @returns {FeatureVector} 内部矢量要素。
- */
- toFeature: function () {
- let geometry = this.geometry;
- if (geometry.toGeoJSON) {
- const geojsonObject = geometry.toGeoJSON();
- geojsonObject.properties = this.attributes;
- return new GeoJSON().read(geojsonObject)[0];
- }
- if (geometry.length === 3) {
- geometry = new GeoText(geometry[1], geometry[0], geometry[2]);
- } else if (geometry.length === 2) {
- geometry = new Point(geometry[0], geometry[1]);
- } else if (geometry instanceof (external_L_default()).LatLng) {
- geometry = new Point(geometry.lng, geometry.lat);
- } else if (geometry instanceof (external_L_default()).Point) {
- geometry = new Point(geometry.x, geometry.y);
- } else if (geometry instanceof (external_L_default()).CircleMarker) {
- var latLng = geometry.getLatLng();
- geometry = new Point(latLng.lng, latLng.lat);
- }
- return new Vector(geometry, this.attributes);
- },
- /**
- * @function ThemeFeature.prototype.reverseLatLngs
- * @description 坐标反转。
- * @param {L.LatLng} latlngs - 坐标值。
- */
- reverseLatLngs: function (latlngs) {
- if (!external_L_default().Util.isArray(latlngs)) {
- latlngs = [latlngs];
- }
- for (var i = 0; i < latlngs.length; i++) {
- latlngs[i] = [latlngs[i].lng, latlngs[i].lat];
- }
- return latlngs;
- }
- });
- var themeFeature = function (geometry, attributes) {
- return new ThemeFeature(geometry, attributes);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/theme/ThemeLayer.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ThemeLayer
- * @classdesc 专题图层基类,调用建议使用其子类实现类。
- * @category Visualization Theme
- * @extends {L.Layer}
- * @param {string} name - 专题图图层名称。
- * @param {Object} options - 参数。
- * @param {string} [options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
- * @param {number} [options.opacity=1] - 图层透明度。
- * @param {boolean} [options.alwaysMapCRS=false] - 要素坐标是否和地图坐标系一致,要素默认是经纬度坐标。
- * @param {string} [options.attribution='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>'] - 版权描述信息。
- * @param {Array} [options.TFEvents] - 专题要素事件临时存储。
- * @fires ThemeLayer#featuresremoved
- * @usage
- */
- var ThemeLayer = external_L_default().Layer.extend({
- options: {
- //要素坐标是否和地图坐标系一致,默认为false,要素默认是经纬度坐标。
- alwaysMapCRS: false,
- id: Util.createUniqueID("themeLayer_"),
- opacity: 1,
- // {Array} 专题要素事件临时存储,临时保存图层未添加到 map 前用户添加的事件监听,待图层添加到 map 后把这些事件监听添加到图层上,清空此图层。
- //这是一个二维数组,组成二维数组的每个一维数组长度为 2,分别是 event, callback。
- TFEvents: [],
- attribution: core_Attributions.Common.attribution
- },
- initialize: function (name, options) {
- external_L_default().Util.setOptions(this, options);
- this.name = name;
- this.features = [];
- this.TFEvents = this.options.TFEvents;
- this.levelRenderer = new LevelRenderer();
- this.movingOffset = [0, 0];
- },
- /**
- * @function ThemeLayer.prototype.getEvents
- * @description 获取图层事件。
- * @returns {Object} 返回图层事件。
- */
- getEvents: function () {
- var me = this;
- var events = {
- zoomend: me._reset,
- moveend: me._reset,
- resize: me._resize
- };
- if (this._map._zoomAnimated) {
- events.zoomanim = me._zoomAnim;
- }
- return events;
- },
- /**
- * @function ThemeLayer.prototype.onRemove
- * @description 删除某个地图。
- * @param {L.Map} map - Leaflet Map 对象。
- */
- onRemove: function (map) {
- var me = this;
- external_L_default().DomUtil.remove(me.container);
- map.off("mousemove", me.mouseMoveHandler);
- },
- /**
- * @function ThemeLayer.prototype.onAdd
- * @description 添加专题图。
- * @param {L.Map} map - Leaflet Map 对象。
- * @private
- */
- onAdd: function (map) {
- var me = this;
- me.map = me._map = map;
- me._initContainer();
- if (!me.levelRenderer) {
- map.removeLayer(me);
- return;
- }
- //初始化渲染器
- var size = map.getSize();
- me.container.style.width = size.x + "px";
- me.container.style.height = size.y + "px";
- me._updateOpacity();
- me.renderer = me.levelRenderer.init(me.container);
- me.renderer.clear();
- if (me.features && me.features.length > 0) {
- me._reset();
- }
- //处理用户预先(在图层添加到 map 前)监听的事件
- me.addTFEvents();
- me.mouseMoveHandler = function (e) {
- var xy = e.layerPoint;
- me.currentMousePosition = external_L_default().point(xy.x + me.movingOffset[0], xy.y + me.movingOffset[1]);
- };
- map.on("mousemove", me.mouseMoveHandler);
- me.update(map.getBounds());
- },
- /**
- * @function L.supermap.ThemeLayer.prototype.addFeatures
- * @description 向专题图图层中添加数据。
- * @param {(Array.<ServerFeature>|Array.<ThemeFeature>|Array.<GeoJSONObject>|ServerFeature|ThemeFeature|GeoJSONObject)} features - 待添加要素。
- */
- addFeatures: function (features) { // eslint-disable-line no-unused-vars
- //子类实现此方法
- },
- /**
- * @function ThemeLayer.prototype.redrawThematicFeatures
- * @description 抽象方法,实例化子类前先执行此方法。
- * @param {L.Bounds} bounds - 重绘专题要素范围。
- */
- redrawThematicFeatures: function (bounds) { // eslint-disable-line no-unused-vars
- //子类必须实现此方法
- },
- /**
- * @function ThemeLayer.prototype.destroyFeatures
- * @description 销毁要素。
- * @param {Array.<FeatureVector>|FeatureVector} features - 将被销毁的要素。
- */
- destroyFeatures: function (features) {
- if (features === undefined) {
- features = this.features;
- }
- if (!features) {
- return;
- }
- this.removeFeatures(features);
- if (!Array.isArray(features)) {
- features = [features];
- }
- for (var i = features.length - 1; i >= 0; i--) {
- features[i].destroy();
- }
- },
- /**
- * @function L.supermap.ThemeLayer.prototype.removeFeatures
- * @description 从专题图中删除 feature。这个函数删除所有传递进来的矢量要素。
- * @param {(Array.<FeatureVector>|FeatureVector|Function)} features - 将被删除的要素或用来过滤的回调函数。
- */
- removeFeatures: function (features) {
- var me = this;
- if (!features) {
- return;
- }
- if (features === me.features) {
- return me.removeAllFeatures();
- }
- if (!external_L_default().Util.isArray(features) && !(typeof features === 'function')) {
- features = [features];
- }
- var featuresFailRemoved = [];
- for (var i = 0; i < me.features.length; i++) {
- var feature = me.features[i];
- //如果我们传入的feature在features数组中没有的话,则不进行删除,
- //并将其放入未删除的数组中。
- if (features && typeof features === 'function') {
- if (features(feature)) {
- me.features.splice(i--, 1);
- }
- } else {
- var findex = external_L_default().Util.indexOf(features, feature);
- if (findex === -1) {
- featuresFailRemoved.push(feature);
- } else {
- me.features.splice(i--, 1);
- }
- }
- }
- var drawFeatures = [];
- for (var hex = 0, len = me.features.length; hex < len; hex++) {
- feature = me.features[hex];
- drawFeatures.push(feature);
- }
- me.features = [];
- me.addFeatures(drawFeatures);
- //绘制专题要素
- if (me.renderer) {
- if (me._map) {
- me.redrawThematicFeatures(me._map.getBounds());
- } else {
- me.redrawThematicFeatures();
- }
- }
- var succeed = featuresFailRemoved.length == 0;
- /**
- * @event ThemeLayer#featuresremoved
- * @description 删除的要素成功之后触发。
- * @property {Array.<FeatureVector>} features - 删除失败的要素数组。
- * @property {boolean} succeed - 要输是否删除成功,true 为删除成功,false 为删除失败。
- */
- me.fire("featuresremoved", {
- features: featuresFailRemoved,
- succeed: succeed
- });
- },
- /**
- * @function ThemeLayer.prototype.removeAllFeatures
- * @description 清除当前图层所有的矢量要素。
- */
- removeAllFeatures: function () {
- var me = this;
- if (me.renderer) {
- me.renderer.clear();
- }
- me.features = [];
- me.fire("featuresremoved", {
- features: [],
- succeed: true
- });
- },
- /**
- * @function ThemeLayer.prototype.getFeatures
- * @description 查看当前图层中的有效数据。
- * @param {Function} [filter] - 根据条件过滤要素的回调函数。
- * @returns {Array.<FeatureVector>} 返回图层中的要素。
- */
- getFeatures: function (filter) {
- var len = this.features.length;
- var clonedFeatures = [];
- for (var i = 0; i < len; ++i) {
- if (!filter || (filter && typeof filter === 'function' && filter(this.features[i]))) {
- clonedFeatures.push(this.features[i]);
- }
- }
- return clonedFeatures;
- },
- /**
- * @function L.supermap.ThemeLayer.prototype.getFeatureBy
- * @description 在专题图的要素数组 features 里面遍历每一个 feature,当 feature[property] === value 时,返回此 feature(并且只返回第一个)。
- * @param {string} property - 要的某个属性名。
- * @param {string} value - 对应属性名得值。
- * @returns {Array.<FeatureVector>} 返回图层中的要素。
- */
- getFeatureBy: function (property, value) {
- var me = this;
- var feature = null;
- for (var id in me.features) {
- if (me.features[id][property] !== value) {
- continue;
- }
- feature = me.features[id];
- break;
- }
- return feature;
- },
- /**
- * @function ThemeLayer.prototype.getFeatureById
- * @description 返回指定 ID 的矢量要素,不存在则返回 null。
- * @param {number} featureId - 要素 ID。
- * @returns {Array.<FeatureVector>} 返回图层中的要素。
- */
- getFeatureById: function (featureId) {
- return this.getFeatureBy('id', featureId);
- },
- /**
- * @function L.supermap.ThemeLayer.prototype.getFeaturesByAttribute
- * @description 通过给定一个属性的 key 值和 value 值,返回所有匹配的要素数组。
- * @param {string} attrName - key 值。
- * @param {string} attrValue - value 值。
- * @returns {Array.<FeatureVector>} 返回所有匹配的要素数组。
- */
- getFeaturesByAttribute: function (attrName, attrValue) {
- var me = this,
- feature,
- foundFeatures = [];
- for (var id in me.features) {
- feature = me.features[id];
- if (feature && feature.attributes && (feature.attributes[attrName] === attrValue)) {
- foundFeatures.push(feature);
- }
- }
- return foundFeatures;
- },
- /**
- * @function ThemeLayer.prototype.update
- * @description 更新图层。
- * @param {L.Bounds} bounds - 图层范围。
- */
- update: function (bounds) {
- var mapOffset = this._map.containerPointToLayerPoint([0, 0]);
- external_L_default().DomUtil.setPosition(this.container, mapOffset);
- var me = this;
- // var bounds = me._map.getBounds();
- // var topLeft = me._map.latLngToLayerPoint(bounds.getNorthWest());
- // var mapOffset = [parseInt(topLeft.x, 10) || 0, parseInt(topLeft.y, 10) || 0]
- // // var offsetLeft = parseInt(me._map.getContainer().style.left, 10);
- // // offsetLeft = -Math.round(offsetLeft);
- // //var offsetTop = parseInt(me._map.getContainer().style.top, 10);
- // //offsetTop = -Math.round(offsetTop);
- // me.container.style.left = mapOffset[0] + 'px';
- // me.container.style.top = mapOffset[1] + 'px';
- //绘制专题要素
- if (me.renderer) {
- me.redrawThematicFeatures(bounds);
- }
- if (me.currentMousePosition) {
- me.currentMousePosition = external_L_default().point(
- me.currentMousePosition.x - me.movingOffset[0],
- me.currentMousePosition.y - me.movingOffset[1]);
- }
- me.movingOffset = [0, 0];
- me._zoom = me._map.getZoom();
- me._center = me._map.getCenter();
- },
- /**
- * @function ThemeLayer.prototype.setOpacity
- * @description 设置图层的不透明度,取值 [0-1] 之间。
- * @param {number} opacity - 不透明度。
- */
- setOpacity: function (opacity) {
- var me = this;
- if (opacity === me.options.opacity) {
- return;
- }
- if (!isNaN(opacity)) {
- me.options.opacity = opacity;
- me._updateOpacity();
- }
- },
- /**
- * @function ThemeLayer.prototype.redraw
- * @description 重绘该图层。
- * @returns {boolean} 返回是否重绘成功。
- */
- redraw: function () {
- var me = this;
- if (!me.renderer) {
- return false;
- }
- if (me._map) {
- me.redrawThematicFeatures(me._map.getBounds());
- } else {
- me.redrawThematicFeatures();
- }
- return true;
- },
- /**
- * @function ThemeLayer.prototype.on
- * @description 监听事件。监听专题要素事件。
- * @param {Event} event - 监听事件。
- * @param {function} callback - 回调函数。
- * @param {string} context - 信息。
- */
- on: function (event, callback, context) { // eslint-disable-line no-unused-vars
- if (this.renderer) {
- this.renderer.on(event, callback);
- } else {
- external_L_default().Layer.prototype.on.call(this, event, callback);
- }
- return this;
- },
- /**
- * @function ThemeLayer.prototype.off
- * @description 移除事件监听。
- * @param {Event} event - 监听事件。
- * @param {function} callback - 回调函数。
- * @param {string} context - 信息。
- */
- off: function (event, callback, context) { // eslint-disable-line no-unused-vars
- var me = this;
- if (me.renderer) {
- me.renderer.un(event, callback);
- } else {
- external_L_default().Layer.prototype.off.call(this, event, callback);
- }
- return this;
- },
- fire: function (type, data, propagate) { // eslint-disable-line no-unused-vars
- if (this.renderer) {
- this.renderer.trigger(type, data);
- }
- external_L_default().Layer.prototype.fire.call(this, type, data, propagate);
- return this;
- },
- /**
- * @function ThemeLayer.prototype.addTFEvents
- * @description 先把事件监听添加到图层,再把图层添加到地图。
- * @private
- */
- addTFEvents: function () {
- var me = this;
- var tfEs = me.TFEvents;
- var len = tfEs.length;
- for (var i = 0; i < len; i++) {
- me.renderer.on(tfEs[i][0], tfEs[i][1]);
- }
- },
- /**
- * @function ThemeLayer.prototype.getLocalXY
- * @description 地理坐标转为像素坐标。
- * @param {Array} coordinate
- */
- getLocalXY: function (coordinate) {
- if (!this._map) {
- return coordinate;
- }
- var coor = coordinate;
- if (external_L_default().Util.isArray(coordinate)) {
- coor = external_L_default().point(coordinate[0], coordinate[1]);
- }
- if (!(coordinate instanceof (external_L_default()).Point)) {
- if (coordinate instanceof Point || coordinate instanceof GeoText) {
- coor = external_L_default().point(coordinate.x, coordinate.y);
- } else {
- coor = external_L_default().point(coordinate.lon, coordinate.lat);
- }
- }
- var point = this._map.latLngToAccurateContainerPoint(!this.options.alwaysMapCRS ? external_L_default().latLng(coor.y, coor.x) : this._map.options.crs.unproject(coor));
- return [point.x, point.y];
- },
- /**
- * @function ThemeLayer.prototype.toiClientFeature
- * @description 转为 iClient 要素。
- * @param {(Array.<ServerFeature>|Array.<ThemeFeature>|Array.<GeoJSONObject>|ServerFeature|ThemeFeature|GeoJSONObject)} features - 待转要素。
- * @returns {Array.<FeatureVector>} 转换后的 iClient 要素。
- */
- toiClientFeature: function (features) {
- //若 features 非数组形式 feature 则先做以下处理:
- if (!Util.isArray(features)) {
- features = [features];
- }
- let featuresTemp = [];
- for (let i = 0; i < features.length; i++) {
- //themeFeature 数据类型
- if (features[i] instanceof ThemeFeature) {
- featuresTemp.push(features[i].toFeature());
- } else if (features[i] instanceof Vector) {
- // 若是 FeatureVector 类型直接返回
- featuresTemp.push(features[i]);
- } else if (["FeatureCollection", "Feature", "Geometry"].indexOf(features[i].type) != -1) {
- //GeoJSON 规范数据类型
- const format = new GeoJSON();
- featuresTemp = featuresTemp.concat(format.read(features[i]));
- } else if (features[i].geometry && features[i].geometry.parts) {
- //iServer服务器返回数据格式 todo 暂未找到更好的参数判断,暂用 geometry.parts 试用
- featuresTemp.push(ServerFeature.fromJson(features[i]).toFeature());
- } else {
- throw new Error(`features[${i}]'s type is not be supported.`);
- }
- }
- return featuresTemp;
- },
- /**
- * @function ThemeLayer.prototype.toFeature
- * @deprecated
- * @description 转为 iClient 要素,该方法将被弃用,由 {@link ThemeLayer#toiClientFeature} 代替。
- * @param {(Array.<ServerFeature>|Array.<ThemeFeature>|Array.<GeoJSONObject>|ServerFeature|ThemeFeature|GeoJSONObject)} features - 待转要素。
- * @returns {FeatureVector} 转换后的 iClient 要素。
- */
- toFeature: function (features) {
- return this.toiClientFeature(features);
- },
- _initContainer: function () {
- var parentContainer = this.getPane();
- var animated = this._map.options.zoomAnimation && (external_L_default()).Browser.any3d;
- var className = 'themeLayer leaflet-layer leaflet-zoom-' + (animated ? 'animated' : 'hide');
- this.container = external_L_default().DomUtil.create("div", className, parentContainer);
- var originProp = external_L_default().DomUtil.testProp(['transformOrigin', 'WebkitTransformOrigin', 'msTransformOrigin']);
- this.container.id = this.options.id;
- this.container.style[originProp] = '50% 50%';
- this.container.style.position = "absolute";
- this.container.style.zIndex = 200;
- },
- _zoomAnim: function (e) {
- var scale = this._map.getZoomScale(e.zoom),
- offset = this._map._getCenterOffset(e.center)._multiplyBy(-scale).subtract(this._map._getMapPanePos());
- if ((external_L_default()).DomUtil.setTransform) {
- external_L_default().DomUtil.setTransform(this.container, offset, scale);
- } else {
- this.container.style[(external_L_default()).DomUtil.TRANSFORM] = external_L_default().DomUtil.getTranslateString(offset) + ' scale(' + scale + ')';
- }
- },
- _updateOpacity: function () {
- var me = this;
- Util.modifyDOMElement(me.container, null, null, null, null, null, null, me.options.opacity);
- if (me._map !== null) {
- /**
- * @event ThemeLayer#changelayer
- * @description 图层属性改变之后触发。
- * @property {Object} layer - 图层。
- * @property {string} property - 图层属性。
- */
- me._map.fire("changelayer", {
- layer: me,
- property: "opacity"
- });
- }
- },
- //缩放移动重绘
- _reset: function () {
- var me = this;
- var latLngBounds = me._map.getBounds();
- me.update(latLngBounds);
- var size = me._map.getSize();
- // var bounds = me._map.getBounds();
- // var topLeft = me._map.latLngToLayerPoint(bounds.getNorthWest());
- // var mapOffset = [parseInt(topLeft.x, 10) || 0, parseInt(topLeft.y, 10) || 0]
- // var offsetLeft = parseInt(me._map.getContainer().style.left, 10);
- // offsetLeft = -Math.round(offsetLeft);
- //var offsetTop = parseInt(me._map.getContainer().style.top, 10);
- //offsetTop = -Math.round(offsetTop);
- //me.container.style.left = mapOffset[0] + 'px';
- //me.container.style.top = mapOffset[1] + 'px';
- var mapOffset = this._map.containerPointToLayerPoint([0, 0]);
- external_L_default().DomUtil.setPosition(this.container, mapOffset);
- if (parseFloat(me.container.width) !== parseFloat(size.x)) {
- me.container.width = size.x + 'px';
- }
- if (parseFloat(me.container.height) !== parseFloat(size.y)) {
- me.container.height = size.y + 'px';
- }
- me.redraw();
- },
- //通知渲染器的尺寸变化
- _resize: function () {
- var me = this;
- var newSize = me._map.getSize();
- me.container.style.width = newSize.x + "px";
- me.container.style.height = newSize.y + "px";
- me.renderer.resize();
- }
- });
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/theme/GeoFeatureThemeLayer.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
-
-
-
-
-
-
- /**
- * @class GeoFeatureThemeLayer
- * @classdesc 地理几何专题要素型专题图层基类。此类型专题图的专题要素形状就是由 feature.geometry 决定。此类不建议直接实例化调用。
- * @category Visualization Theme
- * @extends ThemeLayer
- * @category Visualization Graphic
- * @param {string} name - 专题图名。
- * @param {Object} options - 参数。
- * @param {string} [options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
- * @param {number} [options.opacity=1] - 图层透明度。
- * @param {boolean} [options.alwaysMapCRS=false] - 要素坐标是否和地图坐标系一致,要素默认是经纬度坐标。
- * @param {string} [options.attribution='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>'] - 版权描述信息。
- * @param {Array} [options.TFEvents] - 专题要素事件临时存储。
- * @param {number} [options.nodesClipPixel=2] - 节点抽稀像素距离。
- * @param {boolean} [options.isHoverAble=false] - 图形是否在 hover 时高亮。
- * @param {boolean} [options.isMultiHover=false] - 是否多图形同时高亮,用于高亮同一个数据对应的所有图形(如:多面)。
- * @param {boolean} [options.isClickAble=true] - 图形是否可点击。
- * @param {boolean} [options.isAllowFeatureStyle=false] - 是否允许 feature 样式(style) 中的有效属性应用到专题图层。
- * 禁止对专题要素使用数据(feature)的 style。
- * 此属性可强制将数据 feature 的 style 中有效属性应用到专题要素上,且拥有比图层 style 和 styleGroups 更高的优先级,使专题要素
- * 的样式脱离专题图层的控制。可以通过此方式实现对特殊数据(feature) 对应专题要素赋予独立 style。
- * @fires GeoFeatureThemeLayer#beforefeaturesadded
- * @usage
- */
- var GeoFeatureThemeLayer = ThemeLayer.extend({
- options: {
- // {number} 节点抽稀像素距离,默认值 2。
- nodesClipPixel: 2,
- //{boolean} 图形是否在 hover 时高亮 ,默认值:false。
- isHoverAble: false,
- //{boolean} 是否多图形同时高亮,用于高亮同一个数据对应的所有图形(如:多面),默认值:false。
- isMultiHover: false,
- // {boolean} 图形是否可点击,默认 true
- isClickAble: true,
- //是否允许 feature 样式(style) 中的有效属性应用到专题图层。
- //默认值为: false,禁止对专题要素使用数据(feature)的 style。
- //此属性可强制将数据 feature 的 style 中有效属性应用到专题要素上,且拥有比图层 style 和 styleGroups 更高的优先级,使专题要素
- //的样式脱离专题图层的控制。可以通过此方式实现对特殊数据(feature) 对应专题要素赋予独立 style。
- isAllowFeatureStyle: false
- },
- initialize: function (name, options) {
- ThemeLayer.prototype.initialize.call(this, name, options);
- external_L_default().Util.setOptions(this, options);
- var me = this;
- me.cache = {};
- me.cacheFields = [];
- me.style = {};
- me.highlightStyle = {};
- },
- /**
- * @function GeoFeatureThemeLayer.prototype.addFeatures
- * @description 添加数据。
- * @param {(Array.<ServerFeature>|Array.<ThemeFeature>|Array.<GeoJSONObject>|ServerFeature|ThemeFeature|GeoJSONObject)} features - 待填加的要素。
- */
- addFeatures: function (features) {
- var me = this;
- /**
- * @event GeoFeatureThemeLayer#beforefeaturesadded
- * @description 添加数据之前触发。
- * @property {(Array.<ServerFeature>|Array.<ThemeFeature>|Array.<GeoJSONObject>|ServerFeature|ThemeFeature|GeoJSONObject)} features - 要素。
- */
- me.fire("beforefeaturesadded", {features: features});
- //转换 features 形式
- this.features = this.toiClientFeature(features);
- if (!me.isCustomSetMaxCacheCount) {
- me.maxCacheCount = me.features.length * 5;
- }
- if (!me.renderer) {
- return;
- }
- //绘制专题要素
- if (me._map) {
- me.redrawThematicFeatures(me._map.getBounds());
- } else {
- me.redrawThematicFeatures();
- }
- },
- /**
- * @function GeoFeatureThemeLayer.prototype.removeFeatures
- * @description 删除专题图中 features。参数中的 features 数组中的每一项,必须是已经添加到当前图层中的 feature。
- * @param {(Array.<FeatureVector>|FeatureVector|Function)} features - 要删除的要素或用于条件删除的回调函数。
- */
- removeFeatures: function (features) { // eslint-disable-line no-unused-vars
- this.clearCache();
- ThemeLayer.prototype.removeFeatures.call(this, features);
- },
- /**
- * @function GeoFeatureThemeLayer.prototype.removeAllFeatures
- * @description 清除当前图层所有的矢量要素。
- */
- removeAllFeatures: function () {
- this.clearCache();
- ThemeLayer.prototype.removeAllFeatures.call(this, arguments);
- },
- /**
- * @function GeoFeatureThemeLayer.prototype.redrawThematicFeatures
- * @description 重绘所有专题要素。
- * 此方法包含绘制专题要素的所有步骤,包含用户数据到专题要素的转换,抽稀,缓存等步骤。
- * 地图漫游时调用此方法进行图层刷新。
- * @param {L.Bounds} bounds - 重绘的范围。
- */
- redrawThematicFeatures: function (bounds) {
- var me = this;
- //获取高亮专题要素对应的用户 id
- var hoverone = me.renderer.getHoverOne();
- var hoverFid = null;
- if (hoverone && hoverone.refDataID) {
- hoverFid = hoverone.refDataID;
- }
- if (this.options.alwaysMapCRS && bounds && bounds instanceof (external_L_default()).LatLngBounds) {
- var crs = this._map.options.crs;
- bounds = external_L_default().bounds(crs.project(bounds.getSouthWest()), crs.project(bounds.getNorthEast()));
- }
- bounds = CommontypesConversion.toSuperMapBounds(bounds);
- //清除当前所有可视元素
- me.renderer.clearAll();
- var features = me.features;
- var cache = me.cache;
- var cacheFields = me.cacheFields;
- var cmZoom = me._map.getZoom();
- var maxCC = me.maxCacheCount;
- for (var i = 0, len = features.length; i < len; i++) {
- var feature = features[i];
- var feaBounds = feature.geometry.getBounds();
- //剔除当前视图(地理)范围以外的数据
- if (bounds && !bounds.intersectsBounds(feaBounds)) {
- continue;
- }
- //缓存字段
- var fields = feature.id + "_zoom_" + cmZoom.toString();
- if (cache[fields]) {
- cache[fields].updateAndAddShapes();
- continue;
- }
- var thematicFeature = me.createThematicFeature(features[i]);
- //检查 thematicFeature 是否有可视化图形
- if (thematicFeature.getShapesCount() < 1) {
- continue;
- }
- //加入缓存
- cache[fields] = thematicFeature;
- cacheFields.push(fields);
- //缓存数量限制
- if (cacheFields.length > maxCC) {
- var fieldsTemp = cacheFields[0];
- cacheFields.splice(0, 1);
- delete cache[fieldsTemp];
- }
- }
- me.renderer.render();
- //地图漫游后,重新高亮图形
- if (hoverFid && me.options.isHoverAble && me.options.isMultiHover) {
- var hShapes = this.getShapesByFeatureID(hoverFid);
- this.renderer.updateHoverShapes(hShapes);
- }
- },
- /**
- * @function GeoFeatureThemeLayer.prototype.createThematicFeature
- * @description 创建专题要素。
- * @param {FeatureVector} feature - 要创建的要素。
- * @returns {Array.<FeatureVector>} 返回矢量要素。
- */
- createThematicFeature: function (feature) {
- var me = this;
- var style = me.getStyleByData(feature);
- if (feature.style && me.isAllowFeatureStyle) {
- style = Util.copyAttributesWithClip(feature.style);
- }
- //创建专题要素时的可选参数
- var options = {};
- options.nodesClipPixel = me.options.nodesClipPixel;
- options.isHoverAble = me.options.isHoverAble;
- options.isMultiHover = me.options.isMultiHover;
- options.isClickAble = me.options.isClickAble;
- options.highlightStyle = ShapeFactory.transformStyle(me.highlightStyle);
- //将数据转为专题要素(Vector)
- var thematicFeature = new ThemeVector(feature, me, ShapeFactory.transformStyle(style), options);
- //直接添加图形到渲染器
- for (var m = 0; m < thematicFeature.shapes.length; m++) {
- me.renderer.addShape(thematicFeature.shapes[m]);
- }
- return thematicFeature;
- },
- /**
- * @function GeoFeatureThemeLayer.prototype.redraw
- * @description 重绘该图层。
- */
- redraw: function () {
- this.clearCache();
- return ThemeLayer.prototype.redraw.apply(this, arguments);
- },
- /**
- * @function GeoFeatureThemeLayer.prototype.clearCache
- * @description 清除缓存数据。
- */
- clearCache: function () {
- this.cache = {};
- this.cacheFields = [];
- },
- /**
- * @function GeoFeatureThemeLayer.prototype.clear
- * @description 清除的内容包括数据(features) 、专题要素、缓存。
- */
- clear: function () {
- var me = this;
- me.renderer.clearAll();
- me.renderer.refresh();
- me.removeAllFeatures();
- me.clearCache();
- },
- /**
- * @function GeoFeatureThemeLayer.prototype.getCacheCount
- * @description 获取当前缓存数量。
- * @returns {number} 返回当前缓存数量。
- */
- getCacheCount: function () {
- return this.cacheFields.length;
- },
- /**
- * @function GeoFeatureThemeLayer.prototype.setMaxCacheCount
- * @description 设置最大缓存数量。
- * @param {number} cacheCount - 最大缓存量。
- */
- setMaxCacheCount: function (cacheCount) {
- if (isNaN(cacheCount)) {
- return;
- }
- this.maxCacheCount = cacheCount;
- this.isCustomSetMaxCacheCount = true;
- },
- /**
- * @function GeoFeatureThemeLayer.prototype.getShapesByFeatureID
- * @description 通过 FeatureID 获取 feature 关联的所有图形。如果不传入此参数,函数将返回所有图形。
- * @param {number} featureID - 要素 ID。
- * @returns {Array} 返回图形数组
- */
- getShapesByFeatureID: function (featureID) {
- var me = this,
- list = [],
- shapeList = me.renderer.getAllShapes();
- if (!featureID) {
- return shapeList
- }
- for (var i = 0, len = shapeList.length; i < len; i++) {
- var si = shapeList[i];
- if (si.refDataID && featureID === si.refDataID) {
- list.push(si);
- }
- }
- return list;
- }
- });
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/UniqueThemeLayer.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
-
-
-
- /**
- * @class UniqueThemeLayer
- * @deprecatedclassinstance L.supermap.uniqueThemeLayer
- * @category Visualization Theme
- * @classdesc 客户端单值专题图。单值专题图是利用不同的颜色或符号(线型、填充)表示图层中某一属性信息的不同属性值,属性值相同的要素具有相同的渲染风格。
- * 比如土壤类型分布图、土地利用图、行政区划图等。单值专题图着重表示现象质的差别,一般不表示数量的特征。
- * @extends GeoFeatureThemeLayer
- * @param {string} name - 专题图层名。
- * @param {Object} options - 参数。
- * @param {string} [options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
- * @param {number} [options.opacity=1] - 图层透明度。
- * @param {boolean} [options.alwaysMapCRS=false] - 要素坐标是否和地图坐标系一致,要素默认是经纬度坐标。
- * @param {Array} [options.TFEvents] - 专题要素事件临时存储。
- * @param {number} [options.nodesClipPixel=2] - 节点抽稀像素距离。
- * @param {boolean} [options.isHoverAble=false] - 图形是否在 hover 时高亮。
- * @param {boolean} [options.isMultiHover=false] - 是否多图形同时高亮,用于高亮同一个数据对应的所有图形(如:多面)。
- * @param {boolean} [options.isClickAble=true] - 图形是否可点击。
- * @param {string} [options.attribution='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>'] - 版权描述信息。
- * @param {boolean} [options.isAllowFeatureStyle=false] - 是否允许 feature 的 style 中的有效属性应用到专题图层。
- * 此属性可强制将数据 feature 的 style 中有效属性应用到专题要素上,且拥有比图层 style 和 styleGroups 更高的优先级,使专题要素
- * 的样式脱离专题图层的控制。可以通过此方式实现对特殊数据(feature) 对应专题要素赋予独立 style。
- * @usage
- */
- var UniqueThemeLayer = GeoFeatureThemeLayer.extend({
-
- /**
- * @member {Object} UniqueThemeLayer.prototype.style
- * @description 专题图样式。
- */
-
- /**
- * @member {Object} UniqueThemeLayer.prototype.styleGroups
- * @description 各专题类型样式组。
- */
- /**
- * @member {Object} UniqueThemeLayer.prototype.highlightStyle
- * @description 开启 hover 事件后,触发的样式风格。
- */
- initialize: function (name, options) {
- GeoFeatureThemeLayer.prototype.initialize.call(this, name, options);
- //{Array.<ThemeStyle>} 图层中专题要素的样式
- this.style = [];
- //{string} 用于指定专题要素样式的属性字段名称。
- // 此属性字段是要用户数据(feature) attributes 中包含的字段,且字段对应的值的类型必须是数值型。使用标签分组显示还需要设置 styleGroups 属性。
- this.themeField = null;
- //使用此属性需要设置 themeField 属性。
- //1.没有同时设置 themeField 和 styleGroups,则所有专题要素都使用本图层的 style 进行渲染;
- //2.同时设置 themeField 和 styleGroups,则按照 themeField 指定的字段名称获取用户数据(feature)attributes 中对应的属性值;
- // a.如果属性值等于 styleGroups 数组里某个元素定义的 value 值,则此专题要素取 styleGroups 数组中该元素定义的 style 进行渲染。
- // b.如果属性值不等于 styleGroups 数组里任何元素定义的 value 值,则此专题要素按照本图层的 style 进行渲染。
- //此数组每个元素对象必须有两个属性:value : 与字段 themeField 相对应的属性值;style:专题要素 style。
- this.styleGroups = [];
- },
- /**
- * @private
- * @function UniqueThemeLayer.prototype.getStyleByData
- * @description 根据用户数据(feature)设置专题要素的 Style。
- * @param {FeatureVector} feat - 用户要素数据。
- * @returns {Array.<ThemeStyle>} 返回包含专题要素 style 的对象。
- */
- getStyleByData: function (feat) {
- var me = this,
- feature = feat,
- style = Util.copyAttributesWithClip({}, me.style);
- var groups = me.styleGroups,
- isSfInAttributes = false,//指定的 themeField 是否是 feature 的属性字段之一
- attribute = null; //属性值
- var isValidStyleGroup = me.styleGroups && me.styleGroups.length > 0;
- if (me.themeField && isValidStyleGroup && feature.attributes) {
- var tf = me.themeField,
- attributes = feature.attributes;
- for (var property in attributes) {
- if (tf !== property) {
- continue;
- }
- isSfInAttributes = true;
- attribute = attributes[property];
- break;
- }
- }
- //判断属性值是否属于styleGroups的某一个范围,以便对获取分组 style
- if (isSfInAttributes) {
- for (var i = 0, len = groups.length; i < len; i++) {
- if ((attribute).toString() === ( groups[i].value).toString()) {
- var sty1 = groups[i].style;
- style = Util.copyAttributesWithClip(style, sty1);
- }
- }
- }
- return style;
- }
- });
- var uniqueThemeLayer = function (name, options) {
- return new UniqueThemeLayer(name, options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/RangeThemeLayer.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class RangeThemeLayer
- * @deprecatedclassinstance L.supermap.rangeThemeLayer
- * @category Visualization Theme
- * @classdesc 范围分段专题图。范围分段专题图对数据({@link FeatureVector})属性字段(attributes)的属性值进行分段,使用不同的颜色或符号(线型、填充)渲染不同范围段的属性值。
- * 分段专题图一般用来反映连续分布现象的数量或程度特征,如降水量的分布,土壤侵蚀强度的分布等。
- * @extends GeoFeatureThemeLayer
- * @param {string} name - 图层名
- * @param {Object} options - 参数。
- * @param {string} [options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
- * @param {number} [options.opacity=1] - 图层透明度。
- * @param {boolean} [options.alwaysMapCRS=false] - 要素坐标是否和地图坐标系一致,要素默认是经纬度坐标。
- * @param {string} [options.attribution='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>'] - 版权描述信息。
- * @param {Array} [options.TFEvents] - 专题要素事件临时存储。
- * @param {number} [options.nodesClipPixel=2] - 节点抽稀像素距离。
- * @param {boolean} [options.isHoverAble=false] - 图形是否在 hover 时高亮。
- * @param {boolean} [options.isMultiHover=false] - 是否多图形同时高亮,用于高亮同一个数据对应的所有图形(如:多面)。
- * @param {boolean} [options.isClickAble=true] - 图形是否可点击。
- * @param {boolean} [options.isAllowFeatureStyle=false] - 是否允许 feature 的 style 中的有效属性应用到专题图层。此属性可强制将数据 feature 的 style 中有效属性应用到专题要素上,且拥有比图层 style 和 styleGroups 更高的优先级,使专题要素
- * 的样式脱离专题图层的控制。可以通过此方式实现对特殊数据(feature) 对应专题要素赋予独立 style。
- * @param {string} [options.attribution='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>'] - 版权描述信息。
- * @usage
- */
- var RangeThemeLayer = GeoFeatureThemeLayer.extend({
-
- /**
- * @member {Object} RangeThemeLayer.prototype.style
- * @description 专题图样式。
- */
-
- /**
- * @member {Object} RangeThemeLayer.prototype.styleGroups
- * @description 各专题类型样式组。
- */
- /**
- * @member {Object} RangeThemeLayer.prototype.highlightStyle
- * @description hover 的样式风格。
- */
- initialize: function (name, options) {
- GeoFeatureThemeLayer.prototype.initialize.call(this, name, options);
- //{Array.<ThemeStyle>} 图层中专题要素的样式
- this.style = [];
- //{string} 用于指定专题要素样式的属性字段名称。
- // 此属性字段是要用户数据(feature) attributes 中包含的字段,且字段对应的值的类型必须是数值型。使用标签分组显示还需要设置 styleGroups 属性。
- this.themeField = null;
- //使用此属性需要设置 themeField 属性。
- //1.没有同时设置 themeField 和 styleGroups,则所有专题要素都使用本图层的 style 进行渲染;
- //2.同时设置 themeField 和 styleGroups,则按照 themeField 指定的字段名称获取用户数据(feature)attributes 中对应的属性值;
- // a.如果属性值等于 styleGroups 数组里某个元素定义的 value 值,则此专题要素取 styleGroups 数组中该元素定义的 style 进行渲染。
- // b.如果属性值不等于 styleGroups 数组里任何元素定义的 value 值,则此专题要素按照本图层的 style 进行渲染。
- //此数组每个元素对象必须有两个属性:value : 与字段 themeField 相对应的属性值;style:专题要素 style。
- this.styleGroups = [];
- },
- /**
- * @function RangeThemeLayer.prototype.getStyleByData
- * @description 根据用户数据( feature )设置专题要素的 Style。
- * @param {FeatureVector} feat - 矢量要素对象。
- * @returns {Array.<ThemeStyle>} 专题要素的 Style。
- */
- getStyleByData: function (feat) {
- var me = this,
- feature = feat,
- style = Util.copyAttributesWithClip({}, me.style);
- var groups = me.styleGroups,
- isSfInAttributes = false,//指定的 themeField 是否是 feature 的属性字段之一
- attribute = null; //属性值
- var isValidStyleGroup = me.styleGroups && me.styleGroups.length > 0;
- if (me.themeField && isValidStyleGroup && feature.attributes) {
- var Sf = me.themeField,
- attributes = feature.attributes;
- for (var property in attributes) {
- if (Sf !== property) {
- continue;
- }
- isSfInAttributes = true;
- attribute = attributes[property];
- break;
- }
- }
- //判断属性值是否属于styleGroups的某一个范围,以便对获取分组 style
- if (isSfInAttributes) {
- for (var i = 0, len = groups.length; i < len; i++) {
- var isContianed = i === len-1 ? ((attribute >= groups[i].start) && (attribute <= groups[i].end)) : ((attribute >= groups[i].start) && (attribute < groups[i].end));
- if (isContianed) {
- var sty1 = groups[i].style;
- style = Util.copyAttributesWithClip(style, sty1);
- }
- }
- }
- return style;
- }
- });
- var rangeThemeLayer = function (name, options) {
- return new RangeThemeLayer(name, options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/LabelThemeLayer.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
-
-
-
-
-
-
-
- /**
- * @class LabelThemeLayer
- * @deprecatedclassinstance L.supermap.labelThemeLayer
- * @classdesc 标签专题图。
- * @category Visualization Theme
- * @extends GeoFeatureThemeLayer
- * @param {string} name - 图层名。
- * @param {Object} options - 参数。
- * @param {string} options.themeFields - 指定创建专题图字段。
- * @param {string} [options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
- * @param {boolean} [options.isAvoid=true] - 是否进行地图边缘的避让处理。
- * @param {boolean} [options.alwaysMapCRS=false] - 要素坐标是否和地图坐标系一致,要素默认是经纬度坐标。
- * @param {boolean} [options.isOverLay=true] - 是否进行压盖处理,如果设为 true,图表绘制过程中将隐藏对已在图层中绘制的图表产生压盖的图表。
- * @param {number} [options.opacity=1] - 图层透明度。
- * @param {Array} [options.TFEvents] - 专题要素事件临时存储。
- * @param {number} [options.nodesClipPixel=2] - 节点抽稀像素距离。
- * @param {boolean} [options.isHoverAble=false] - 图形是否在 hover 时高亮。
- * @param {boolean} [options.isMultiHover=false] - 是否多图形同时高亮,用于高亮同一个数据对应的所有图形(如:多面)。
- * @param {boolean} [options.isClickAble=true] - 图形是否可点击。
- * @param {boolean} [options.isAllowFeatureStyle=false] - 是否允许 feature 的 style 中的有效属性应用到专题图层。此属性可强制将数据 feature 的 style 中有效属性应用到专题要素上,且拥有比图层 style 和 styleGroups 更高的优先级,使专题要素
- * 的样式脱离专题图层的控制。可以通过此方式实现对特殊数据(feature) 对应专题要素赋予独立 style。
- * @param {string} [options.attribution='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>'] - 版权描述信息。
- * @usage
- */
- var LabelThemeLayer = GeoFeatureThemeLayer.extend({
- /**
- * @member {Object} LabelThemeLayer.prototype.style
- * @description 专题图样式。
- */
- /**
- * @member {Object} LabelThemeLayer.prototype.styleGroups
- * @description 各专题类型样式组。
- */
- /**
- * @member {Object} LabelThemeLayer.prototype.highlightStyle
- * @description 开启 hover 事件后,触发的样式风格。
- */
- options: {
- //是否进行压盖处理,如果设为true,将隐藏被压盖的标签,默认为true。
- isOverLay: true,
- //是否进行地图边缘的避让处理,如果设为true,将把与地图边缘相交的标签移到地图范围内,默认为 true,在地图边缘处做避让处理。
- isAvoid: true
- },
- initialize: function (name, options) {
- GeoFeatureThemeLayer.prototype.initialize.call(this, name, options);
- external_L_default().Util.setOptions(this, options);
- //图层中专题要素的样式
- this.style = [];
- //用于指定专题要素样式的属性字段名称。
- // 此属性字段是要用户数据(feature) attributes 中包含的字段,且字段对应的值的类型必须是数值型。使用标签分组显示还需要设置 styleGroups 属性。
- this.themeField = null;
- //使用此属性需要设置 themeField 属性。
- //1.没有同时设置 themeField 和 styleGroups,则所有专题要素都使用本图层的 style 进行渲染;
- //2.同时设置 themeField 和 styleGroups,则按照 themeField 指定的字段名称获取用户数据(feature)attributes 中对应的属性值;
- // a.如果属性值等于 styleGroups 数组里某个元素定义的 value 值,则此专题要素取 styleGroups 数组中该元素定义的 style 进行渲染。
- // b.如果属性值不等于 styleGroups 数组里任何元素定义的 value 值,则此专题要素按照本图层的 style 进行渲染。
- //此数组每个元素对象必须有两个属性:value : 与字段 themeField 相对应的属性值;style:专题要素 style。
- this.styleGroups = [];
- this.defaultStyle = {
- //默认文本样式
- fontColor: "#000000",
- fontOpacity: 1,
- fontSize: "12px",
- fontStyle: "normal",
- fontWeight: "normal",
- labelAlign: "cm",
- labelXOffset: 0,
- labelYOffset: 0,
- labelRotation: 0,
- //默认样式
- fill: false,
- fillColor: "#ee9900",
- fillOpacity: 0.4,
- stroke: false,
- strokeColor: "#ee9900",
- strokeOpacity: 1,
- strokeWidth: 1,
- strokeLinecap: "round",
- strokeDashstyle: "solid",
- //默认显示背景框
- labelRect: true,
- //对用户隐藏但必须保持此值的属性
- //cursor: "pointer",
- labelSelect: true,
- //用 _isGeoTextStrategyStyle 标记此style,携带此类style的要素特指GeoText策略中的标签要素
- _isGeoTextStrategyStyle: true
- };
- //获取标签像素 bounds 的方式。0 - 表示通过文本类容和文本风格计算获取像素范围,现在支持中文、英文; 1 - 表示通过绘制的文本标签获取像素范围,支持各个语种的文字范围获取,但性能消耗较大(尤其是采用SVG渲染)。默认值为0。
- this.getPxBoundsMode = 0;
- this.labelFeatures = [];
- },
- /**
- * @function LabelThemeLayer.prototype.onAdd
- * @description 添加专题图。
- * @param {L.Map} map - Leaflet Map 对象。
- * @private
- */
- onAdd: function (map) {
- GeoFeatureThemeLayer.prototype.onAdd.call(this, map);
- this.container.style.zIndex = 200;
- },
- /**
- * @function LabelThemeLayer.prototype.redrawThematicFeatures
- * @description 重绘所有专题要素。
- * 此方法包含绘制专题要素的所有步骤,包含用户数据到专题要素的转换,抽稀,缓存等步骤。
- * 地图漫游时调用此方法进行图层刷新。
- * @param {L.Bounds} bounds - 重绘范围。
- */
- redrawThematicFeatures: function (bounds) {
- if (this.features.length > 0 && this.labelFeatures.length == 0) {
- var feats = this.setLabelsStyle(this.features);
- for (var i = 0, len = feats.length; i < len; i++) {
- this.labelFeatures.push(feats[i]);
- }
- }
- this.features = this.getDrawnLabels(this.labelFeatures);
- GeoFeatureThemeLayer.prototype.redrawThematicFeatures.call(this, bounds);
- },
- /**
- * @function LabelThemeLayer.prototype.removeFeatures
- * @description 从专题图中删除 feature。这个函数删除所有传递进来的矢量要素。参数中的 features 数组中的每一项,必须是已经添加到当前图层中的 feature。
- * @param {(Array.<FeatureVector>|FeatureVector|Function)} features - 要删除的要素或用于条件删除的回调函数。
- */
- removeFeatures: function (features) { // eslint-disable-line no-unused-vars
- this.labelFeatures = [];
- GeoFeatureThemeLayer.prototype.removeFeatures.call(this, features);
- },
- /**
- * @function LabelThemeLayer.prototype.removeAllFeatures
- * @description 清除当前图层所有的矢量要素。
- */
- removeAllFeatures: function () {
- this.labelFeatures = [];
- GeoFeatureThemeLayer.prototype.removeAllFeatures.call(this, arguments);
- },
- /**
- * @function LabelThemeLayer.prototype.getDrawnLabels
- * @description 获取经(压盖)处理后将要绘制在图层上的标签要素。
- * @param {Array.<FeatureVector>} labelFeatures - 所有标签要素的数组。
- * @returns {Array.<FeatureVector>} 最终要绘制的标签要素数组。
- */
- getDrawnLabels: function (labelFeatures) {
- var feas = [], //最终要绘制的标签要素集
- fea, //最终要绘制的标签要素
- fi, //临时标签要素,用户的第i个标签
- labelsB = [], //不产生压盖的标签要素范围集
- styTmp, //用于临时存储要素style的变量
- feaSty, //标签要素最终的style
- // styleTemp用于屏蔽文本style中带有偏移性质style属性,偏移已经在计算bounds的过程中参与了运算,
- // 所以在最终按照bounds来绘制标签时,需屏蔽style中带有偏移性质属性,否则文本的偏移量将扩大一倍。
- styleTemp = {
- labelAlign: "cm",
- labelXOffset: 0,
- labelYOffset: 0
- };
- var map = this._map;
- var mapSize = map.getSize();
- var zoom = map.getZoom();
- //对用户的每个标签要素进行处理与判断
- for (var i = 0, len = labelFeatures.length; i < len; i++) {
- fi = labelFeatures[i];
- //检查fi的style在避让中是否被改变,如果改变,重新设置要素的style
- if (fi.isStyleChange || fi.isStyleChange === undefined) {
- fi = this.setStyle(fi);
- }
- //标签最终的中心点像素位置 (偏移后)
- var loc = this.getLabelPxLocation(fi);
- //过滤掉地图范围外的标签 (偏移后)
- if ((loc.x >= 0 && loc.x <= mapSize.x) && (loc.y >= 0 && loc.y <= mapSize.y)) {
- //根据当前地图缩放级别过滤标签
- if (fi.style.minZoomLevel > -1) {
- if (zoom <= fi.style.minZoomLevel) {
- continue;
- }
- }
- if (fi.style.maxZoomLevel > -1) {
- if (zoom > fi.style.maxZoomLevel) {
- continue;
- }
- }
- //计算标签bounds
- var boundsQuad = null;
- if (fi.isStyleChange) {
- fi.isStyleChange = null;
- boundsQuad = this.calculateLabelBounds(fi, loc);
- } else {
- if (fi.geometry.bsInfo.w && fi.geometry.bsInfo.h) {
- //使用calculateLabelBounds2可以提高bounds的计算效率,尤其是在getPxBoundsMode = 1时
- boundsQuad = this.calculateLabelBounds2(fi, loc);
- } else {
- boundsQuad = this.calculateLabelBounds(fi, loc);
- }
- }
- //避让处理 -start
- var mapViewBounds = new Bounds(0, mapSize.y, mapSize.x, 0), //地图像素范围
- quadlen = boundsQuad.length;
- if (this.options.isAvoid) {
- var avoidInfo = this.getAvoidInfo(mapViewBounds, boundsQuad); //避让信息
- if (avoidInfo) {
- //横向(x方向)上的避让
- if (avoidInfo.aspectW === "left") {
- fi.style.labelXOffset += avoidInfo.offsetX;
- for (let j = 0; j < quadlen; j++) {
- boundsQuad[j].x += avoidInfo.offsetX;
- }
- } else if (avoidInfo.aspectW === "right") {
- fi.style.labelXOffset += (-avoidInfo.offsetX);
- for (let j = 0; j < quadlen; j++) {
- boundsQuad[j].x += (-avoidInfo.offsetX);
- }
- }
- //纵向(y方向)上的避让
- if (avoidInfo.aspectH === "top") {
- fi.style.labelYOffset += avoidInfo.offsetY;
- for (let j = 0; j < quadlen; j++) {
- boundsQuad[j].y += avoidInfo.offsetY;
- }
- } else if (avoidInfo.aspectH === "bottom") {
- fi.style.labelYOffset += (-avoidInfo.offsetY);
- for (let j = 0; j < quadlen; j++) {
- boundsQuad[j].y += (-avoidInfo.offsetY);
- }
- }
- //如果style发生变化,记录下来
- fi.isStyleChange = true;
- }
- }
- //避让处理 -end
- //压盖处理 -start
- if (this.options.isOverLay) {
- //是否压盖
- var isOL = false;
- if (i != 0) {
- for (let j = 0; j < labelsB.length; j++) {
- //压盖判断
- if (this.isQuadrilateralOverLap(boundsQuad, labelsB[j])) {
- isOL = true;
- break;
- }
- }
- }
- if (isOL) {
- continue;
- } else {
- labelsB.push(boundsQuad);
- }
- }
- //压盖处理 -end
- //背景(事件)-start
- //将标签像素范围转为地理范围
- var geoBs = [];
- for (let j = 0; j < quadlen - 1; j++) {
- geoBs.push(map.containerPointToLatLng(boundsQuad[j]));
- }
- //屏蔽有偏移性质的style属性,偏移量在算bounds时已经加入计算
- var leftBottom = geoBs[3];
- var rightTop = geoBs[1];
- var bounds = new Bounds(leftBottom.lng, leftBottom.lat, rightTop.lng, rightTop.lat);
- var center = bounds.getCenterLonLat();
- var label = new GeoText(center.lon, center.lat, fi.attributes[this.themeField]);
- label.calculateBounds();
- styTmp = Util.cloneObject(fi.style);
- feaSty = Util.cloneObject(Util.copyAttributes(styTmp, styleTemp));
- fea = new Vector(label, fi.attributes, feaSty);
- //赋予id
- fea.id = fi.id;
- fea.fid = fi.fid;
- feas.push(fea);
- }
- }
- //返回最终要绘制的标签要素
- return feas;
- },
- /**
- * @function LabelThemeLayer.prototype.getStyleByData
- * @description 根据用户数据(feature)设置专题要素的 Style。
- * @param {FeatureVector} feat - 矢量要素对象。
- * @returns {Array.<ThemeStyle>} 专题要素的 Style。
- */
- getStyleByData: function (feat) {
- var feature = feat;
- feature.style = Util.copyAttributes(feature.style, this.defaultStyle);
- //将style赋给标签
- if (this.style && this.style.fontSize && parseFloat(this.style.fontSize) < 12) {
- this.style.fontSize = "12px";
- }
- feature.style = Util.copyAttributes(feature.style, this.style);
- if (this.themeField && this.styleGroups && feature.attributes) {
- var Sf = this.themeField;
- var attributes = feature.attributes;
- var groups = this.styleGroups;
- var isSfInAttrs = false; //指定的 groupField 是否是geotext的属性字段之一
- var attr = null; //属性值
- for (var property in attributes) {
- if (Sf === property) {
- isSfInAttrs = true;
- attr = attributes[property];
- break;
- }
- }
- //判断属性值是否属于styleGroups的某一个范围,以便对标签分组
- if (isSfInAttrs) {
- for (var i = 0, len = groups.length; i < len; i++) {
- if ((attr >= groups[i].start) && (attr < groups[i].end)) {
- var sty1 = groups[i].style;
- if (sty1 && sty1.fontSize && parseFloat(sty1.fontSize) < 12) {
- sty1.fontSize = "12px";
- }
- feature.style = Util.copyAttributes(feature.style, sty1);
- }
- }
- }
- feature.style.label = feature.attributes[this.themeField]
- }
- return feature.style;
- },
- /**
- * @function LabelThemeLayer.prototype.setLabelsStyle
- * @description 设置标签要素的 Style。
- * @param {Array.<FeatureVector>} labelFeatures - 需要设置 Style 的标签要素数组。
- * @returns {Array.<FeatureVector>} 赋予 Style 后的标签要素数组。
- */
- setLabelsStyle: function (labelFeatures) {
- var fea, labelFeas = [];
- for (var i = 0, len = labelFeatures.length; i < len; i++) {
- var feature = labelFeatures[i];
- if (feature.geometry.CLASS_NAME === "SuperMap.Geometry.GeoText") {
- //设置标签的Style
- if (feature.geometry.bsInfo.w || feature.geometry.bsInfo.h) {
- feature.geometry.bsInfo.w = null;
- feature.geometry.bsInfo.h = null;
- feature.geometry.labelWTmp = null;
- }
- fea = this.setStyle(feature);
- //为标签要素指定图层
- fea.layer = this.layer;
- labelFeas.push(fea);
- } else {
- return labelFeatures;
- }
- }
- return labelFeas;
- },
- /**
- * @function LabelThemeLayer.prototype.setStyle
- * @description 设置标签要素的 Style。
- * @param {FeatureVector} feat - 需要赋予 style 的要素。
- */
- setStyle: function (feat) {
- var feature = feat;
- feature.style = Util.copyAttributes(feature.style, this.defaultStyle);
- //将style赋给标签
- if (this.style && this.style.fontSize && parseFloat(this.style.fontSize) < 12) {
- this.style.fontSize = "12px";
- }
- feature.style = Util.copyAttributes(feature.style, this.style);
- if (this.groupField && this.styleGroups && feature.attributes) {
- var Sf = this.groupField;
- var Attrs = feature.attributes;
- var Gro = this.styleGroups;
- var isSfInAttrs = false; //指定的 groupField 是否是geotext的属性字段之一
- var attr = null; //属性值
- for (var property in Attrs) {
- if (Sf === property) {
- isSfInAttrs = true;
- attr = Attrs[property];
- break;
- }
- }
- //判断属性值是否属于styleGroups的某一个范围,以便对标签分组
- if (isSfInAttrs) {
- for (var i = 0, len = Gro.length; i < len; i++) {
- if ((attr >= Gro[i].start) && (attr < Gro[i].end)) {
- //feature.style = Util.copyAttributes(feature.style, this.defaultStyle);
- var sty1 = Gro[i].style;
- if (sty1 && sty1.fontSize && parseFloat(sty1.fontSize) < 12) {
- sty1.fontSize = "12px";
- }
- feature.style = Util.copyAttributes(feature.style, sty1);
- }
- }
- }
- }
- //将文本内容赋到标签要素的style上
- feature.style.label = feature.geometry.text;
- return feature;
- },
- /**
- * @function LabelThemeLayer.prototype.getLabelPxLocation
- * @description 获取标签要素的像素坐标。
- * @param {FeatureVector} feature - 标签要素。
- * @returns {L.Point} 标签位置。
- */
- getLabelPxLocation: function (feature) {
- var geoText = feature.geometry;
- var styleTmp = feature.style;
- //将标签的地理位置转为像素位置
- var locationTmp = geoText.getCentroid();
- var locTmp = this._map.latLngToContainerPoint(!this.options.alwaysMapCRS ? external_L_default().latLng(locationTmp.y, locationTmp.x) : this._map.options.crs.unproject(external_L_default().point(locationTmp.x, locationTmp.y)));
- var loc = external_L_default().point(locTmp.x, locTmp.y);
- //偏移处理
- if (styleTmp.labelXOffset || styleTmp.labelYOffset) {
- var xOffset = isNaN(styleTmp.labelXOffset) ? 0 : styleTmp.labelXOffset;
- var yOffset = isNaN(styleTmp.labelYOffset) ? 0 : styleTmp.labelYOffset;
- var point = loc.add(external_L_default().point(xOffset, -yOffset));
- return external_L_default().point(point.x, point.y);
- } else {
- return external_L_default().point(loc.x, loc.y);
- }
- },
- /**
- * @function LabelThemeLayer.prototype.calculateLabelBounds
- * @description 获得标签要素的最终范围。
- *
- * @param {FeatureVector} feature - 需要计算 bounds 的标签要素数。
- * @param {L.Point} loc - 标签位置。
- *
- * @returns {Array.<Object>} 四边形节点数组。例如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
- */
- calculateLabelBounds: function (feature, loc) {
- var geoText = feature.geometry;
- //标签范围(未旋转前)
- var labB = null;
- var labelInfo = null;
- //获取bounds的方式
- if (this.getPxBoundsMode == 0) {
- labB = geoText.getLabelPxBoundsByText(loc, feature.style);
- } else if (this.getPxBoundsMode === 1) {
- //canvas
- labelInfo = this.getLabelInfo(feature.geometry.getCentroid(), feature.style);
- labB = geoText.getLabelPxBoundsByLabel(loc, labelInfo.w, labelInfo.h, feature.style);
- } else {
- return null;
- }
- //旋转Bounds
- var boundsQuad = [];
- if ((feature.style.labelRotation % 180) == 0) {
- boundsQuad = [{
- "x": labB.left,
- "y": labB.top
- },
- {
- "x": labB.right,
- "y": labB.top
- },
- {
- "x": labB.right,
- "y": labB.bottom
- },
- {
- "x": labB.left,
- "y": labB.bottom
- },
- {
- "x": labB.left,
- "y": labB.top
- }
- ];
- } else {
- boundsQuad = this.rotationBounds(labB, loc, feature.style.labelRotation);
- }
- //重置GeoText的bounds
- geoText.bounds = new Bounds(boundsQuad[1].x, boundsQuad[3].y, boundsQuad[2].x, boundsQuad[4].y);
- return boundsQuad;
- },
- /**
- * @function LabelThemeLayer.prototype.calculateLabelBounds2
- * @description 获得标签要素的最终范围的另一种算法(通过记录下的标签宽高),提高计算 bounds 的效率。
- *
- * @param {FeatureVector} feature - 需要计算 bounds 的标签要素数。
- * @param {L.Point} loc - 标签位置。
- *
- * @returns {Array.<Object>} 四边形节点数组。例如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
- */
- calculateLabelBounds2: function (feature, loc) {
- var labB, left, bottom, top, right;
- var labelSize = feature.geometry.bsInfo;
- var style = feature.style;
- var locationPx = Util.cloneObject(loc);
- //处理文字对齐
- if (style.labelAlign && style.labelAlign !== "cm") {
- switch (style.labelAlign) {
- case "lt":
- locationPx.x += labelSize.w / 2;
- locationPx.y += labelSize.h / 2;
- break;
- case "lm":
- locationPx.x += labelSize.w / 2;
- break;
- case "lb":
- locationPx.x += labelSize.w / 2;
- locationPx.y -= labelSize.h / 2;
- break;
- case "ct":
- locationPx.y += labelSize.h / 2;
- break;
- case "cb":
- locationPx.y -= labelSize.h / 2;
- break;
- case "rt":
- locationPx.x -= labelSize.w / 2;
- locationPx.y += labelSize.h / 2;
- break;
- case "rm":
- locationPx.x -= labelSize.w / 2;
- break;
- case "rb":
- locationPx.x -= labelSize.w / 2;
- locationPx.y -= labelSize.h / 2;
- break;
- default:
- break;
- }
- }
- left = locationPx.x - labelSize.w / 2;
- bottom = locationPx.y + labelSize.h / 2;
- //处理斜体字
- if (style.fontStyle && style.fontStyle === "italic") {
- right = locationPx.x + labelSize.w / 2 + parseInt(parseFloat(style.fontSize) / 2);
- } else {
- right = locationPx.x + labelSize.w / 2;
- }
- top = locationPx.y - labelSize.h / 2;
- labB = new Bounds(left, bottom, right, top);
- //旋转Bounds
- var boundsQuad = [];
- if ((style.labelRotation % 180) == 0) {
- boundsQuad = [{
- "x": labB.left,
- "y": labB.top
- },
- {
- "x": labB.right,
- "y": labB.top
- },
- {
- "x": labB.right,
- "y": labB.bottom
- },
- {
- "x": labB.left,
- "y": labB.bottom
- },
- {
- "x": labB.left,
- "y": labB.top
- }
- ];
- } else {
- boundsQuad = this.rotationBounds(labB, loc, style.labelRotation);
- }
- //重置GeoText的bounds
- feature.geometry.bounds = new Bounds(boundsQuad[1].x, boundsQuad[3].y, boundsQuad[2].x, boundsQuad[4].y);
- return boundsQuad;
- },
- /**
- * @function LabelThemeLayer.prototype.getLabelInfo
- * @description 根据当前位置获取绘制后的标签信息,包括标签的宽,高和行数等。
- * @returns {Object} 绘制后的标签信息。
- */
- getLabelInfo: function (location, style) {
- var LABEL_ALIGN = {
- "l": "left",
- "r": "right",
- "t": "top",
- "b": "bottom"
- },
- LABEL_FACTOR = {
- "l": 0,
- "r": -1,
- "t": 0,
- "b": -1
- };
- style = Util.extend({
- fontColor: "#000000",
- labelAlign: "cm"
- }, style);
- var pt = this.getLocalXY(location);
- var labelWidth = 0;
- if (style.labelXOffset || style.labelYOffset) {
- var xOffset = isNaN(style.labelXOffset) ? 0 : style.labelXOffset;
- var yOffset = isNaN(style.labelYOffset) ? 0 : style.labelYOffset;
- pt[0] += xOffset;
- pt[1] -= yOffset;
- }
- var canvas = document.createElement('canvas');
- canvas.globalAlpha = 0;
- canvas.lineWidth = 1;
- var ctx = canvas.getContext("2d");
- ctx.fillStyle = style.fontColor;
- ctx.globalAlpha = style.fontOpacity || 1.0;
- var fontStyle = [style.fontStyle ? style.fontStyle : "normal",
- "normal",
- style.fontWeight ? style.fontWeight : "normal",
- style.fontSize ? style.fontSize : "1em",
- style.fontFamily ? style.fontFamily : "sans-serif"
- ].join(" ");
- var labelRows = style.label.split('\n');
- var numRows = labelRows.length;
- var vfactor, lineHeight, labelWidthTmp;
- if (ctx.fillText) {
- // HTML5
- ctx.font = fontStyle;
- ctx.textAlign = LABEL_ALIGN[style.labelAlign[0]] ||
- "center";
- ctx.textBaseline = LABEL_ALIGN[style.labelAlign[1]] ||
- "middle";
- vfactor = LABEL_FACTOR[style.labelAlign[1]];
- if (vfactor == null) {
- vfactor = -.5;
- }
- lineHeight = ctx.measureText('Mg').height ||
- ctx.measureText('xx').width;
- pt[1] += lineHeight * vfactor * (numRows - 1);
- for (let i = 0; i < numRows; i++) {
- labelWidthTmp = ctx.measureText(labelRows[i]).width;
- if (labelWidth < labelWidthTmp) {
- labelWidth = labelWidthTmp;
- }
- }
- } else if (ctx.mozDrawText) {
- // Mozilla pre-Gecko1.9.1 (<FF3.1)
- ctx.mozTextStyle = fontStyle;
- vfactor = LABEL_FACTOR[style.labelAlign[1]];
- if (vfactor == null) {
- vfactor = -.5;
- }
- lineHeight = ctx.mozMeasureText('xx');
- pt[1] += lineHeight * (1 + (vfactor * numRows));
- for (let i = 0; i < numRows; i++) {
- labelWidthTmp = ctx.measureText(labelRows[i]).width;
- if (labelWidth < labelWidthTmp) {
- labelWidth = labelWidthTmp;
- }
- }
- }
- var labelInfo = {}; //标签信息
- if (labelWidth) {
- labelInfo.w = labelWidth; //标签的宽
- } else {
- return null;
- }
- labelInfo.h = style.fontSize; //一行标签的高
- labelInfo.rows = labelRows.length; //标签的行数
- return labelInfo;
- },
- /**
- * @function LabelThemeLayer.prototype.rotationBounds
- * @description 旋转 bounds。
- *
- * @param {Bounds} bounds - 要旋转的 bounds。
- * @param {Object} rotationCenterPoi - 旋转中心点对象,此对象含有属性x(横坐标),属性y(纵坐标)。
- * @param {number} angle - 旋转角度(顺时针)。
- *
- * @returns {Array.<Object>} bounds旋转后形成的多边形节点数组。是一个四边形,形如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
- */
- rotationBounds: function (bounds, rotationCenterPoi, angle) {
- var ltPoi = external_L_default().point(bounds.left, bounds.top);
- var rtPoi = external_L_default().point(bounds.right, bounds.top);
- var rbPoi = external_L_default().point(bounds.right, bounds.bottom);
- var lbPoi = external_L_default().point(bounds.left, bounds.bottom);
- var ver = [];
- ver.push(this.getRotatedLocation(ltPoi.x, ltPoi.y, rotationCenterPoi.x, rotationCenterPoi.y, angle));
- ver.push(this.getRotatedLocation(rtPoi.x, rtPoi.y, rotationCenterPoi.x, rotationCenterPoi.y, angle));
- ver.push(this.getRotatedLocation(rbPoi.x, rbPoi.y, rotationCenterPoi.x, rotationCenterPoi.y, angle));
- ver.push(this.getRotatedLocation(lbPoi.x, lbPoi.y, rotationCenterPoi.x, rotationCenterPoi.y, angle));
- //bounds旋转后形成的多边形节点数组
- var quad = [];
- for (var i = 0; i < ver.length; i++) {
- quad.push({
- "x": ver[i].x,
- "y": ver[i].y
- });
- }
- quad.push({
- "x": ver[0].x,
- "y": ver[0].y
- });
- return quad;
- },
- /**
- * @function LabelThemeLayer.prototype.getRotatedLocation
- * @description 获取一个点绕旋转中心顺时针旋转后的位置。(此方法用于屏幕坐标)。
- *
- * @param {number} x - 旋转点横坐标。
- * @param {number} y - 旋转点纵坐标。
- * @param {number} rx - 旋转中心点横坐标。
- * @param {number} ry - 旋转中心点纵坐标。
- * @param {number} angle - 旋转角度。
- *
- * @returns {Object} 旋转后的坐标位置对象,该对象含有属性 x(横坐标),属性 y(纵坐标)。
- */
- getRotatedLocation: function (x, y, rx, ry, angle) {
- var loc = {},
- x0, y0;
- y = -y;
- ry = -ry;
- angle = -angle; //顺时针旋转
- x0 = (x - rx) * Math.cos((angle / 180) * Math.PI) - (y - ry) * Math.sin((angle / 180) * Math.PI) + rx;
- y0 = (x - rx) * Math.sin((angle / 180) * Math.PI) + (y - ry) * Math.cos((angle / 180) * Math.PI) + ry;
- loc.x = x0;
- loc.y = -y0;
- return loc;
- },
- /**
- * @function LabelThemeLayer.prototype.getAvoidInfo
- * @description 获取避让的信息。
- *
- * @param {Bounds} bounds - 地图像素范围。
- * @param {Array.<Object>} quadrilateral - 四边形节点数组。例如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
- *
- * @returns {Object} 避让的信息。
- */
- getAvoidInfo: function (bounds, quadrilateral) {
- if (quadrilateral.length !== 5) {
- return null;
- } //不是四边形
- //将bound序列化为点数组形式
- var bounddQuad = [{
- "x": bounds.left,
- "y": bounds.top
- },
- {
- "x": bounds.right,
- "y": bounds.top
- },
- {
- "x": bounds.right,
- "y": bounds.bottom
- },
- {
- "x": bounds.left,
- "y": bounds.bottom
- },
- {
- "x": bounds.left,
- "y": bounds.top
- }
- ];
- var isIntersection = false,
- bqLen = bounddQuad.length,
- quadLen = quadrilateral.length;
- var offsetX = 0,
- offsetY = 0,
- aspectH = "",
- aspectW = "";
- for (var i = 0; i < bqLen - 1; i++) {
- for (var j = 0; j < quadLen - 1; j++) {
- var isLineIn = Util.lineIntersection(bounddQuad[i], bounddQuad[i + 1], quadrilateral[j], quadrilateral[j + 1]);
- if (isLineIn.CLASS_NAME === "SuperMap.Geometry.Point") {
- //设置避让信息
- setInfo(quadrilateral[j]);
- setInfo(quadrilateral[j + 1]);
- isIntersection = true;
- }
- }
- }
- if (isIntersection) {
- //组织避让操作所需的信息
- return {
- "aspectW": aspectW,
- "aspectH": aspectH,
- "offsetX": offsetX,
- "offsetY": offsetY
- };
- } else {
- return null;
- }
- //内部函数:设置避让信息
- //参数:vec-{Object} quadrilateral四边形单个节点。如:{"x":1,"y":1}。
- function setInfo(vec) {
- //四边形不在bounds内的节点
- if (!bounds.contains(vec.x, vec.y)) {
- //bounds的Top边
- if (vec.y < bounds.top) {
- let oY = Math.abs(bounds.top - vec.y);
- if (oY > offsetY) {
- offsetY = oY;
- aspectH = "top";
- }
- }
- //bounds的Bottom边
- if (vec.y > bounds.bottom) {
- let oY = Math.abs(vec.y - bounds.bottom);
- if (oY > offsetY) {
- offsetY = oY;
- aspectH = "bottom";
- }
- }
- //bounds的left边
- if (vec.x < bounds.left) {
- let oX = Math.abs(bounds.left - vec.x);
- if (oX > offsetX) {
- offsetX = oX;
- aspectW = "left";
- }
- }
- //bounds的right边
- if (vec.x > bounds.right) {
- let oX = Math.abs(vec.x - bounds.right);
- if (oX > offsetX) {
- offsetX = oX;
- aspectW = "right";
- }
- }
- }
- }
- },
- /**
- * @function LabelThemeLayer.prototype.isQuadrilateralOverLap
- * @description 判断两个四边形是否有压盖。
- *
- * @param {Array.<Object>} quadrilateral - 四边形节点数组。例如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
- * @param {Array.<Object>} quadrilateral2 - 第二个四边形节点数组。
- *
- * @returns {boolean} 是否压盖,true表示压盖。
- */
- isQuadrilateralOverLap: function (quadrilateral, quadrilateral2) {
- var quadLen = quadrilateral.length,
- quad2Len = quadrilateral2.length;
- if (quadLen !== 5 || quad2Len !== 5) {
- return null;
- } //不是四边形
- var OverLap = false;
- //如果两四边形互不包含对方的节点,则两个四边形不相交
- for (let i = 0; i < quadLen; i++) {
- if (this.isPointInPoly(quadrilateral[i], quadrilateral2)) {
- OverLap = true;
- break;
- }
- }
- for (let i = 0; i < quad2Len; i++) {
- if (this.isPointInPoly(quadrilateral2[i], quadrilateral)) {
- OverLap = true;
- break;
- }
- }
- //加上两矩形十字相交的情况
- for (let i = 0; i < quadLen - 1; i++) {
- if (OverLap) {
- break;
- }
- for (var j = 0; j < quad2Len - 1; j++) {
- var isLineIn = Util.lineIntersection(quadrilateral[i], quadrilateral[i + 1], quadrilateral2[j], quadrilateral2[j + 1]);
- if (isLineIn.CLASS_NAME === "SuperMap.Geometry.Point") {
- OverLap = true;
- break;
- }
- }
- }
- return OverLap;
- },
- /**
- * @function LabelThemeLayer.prototype.isPointInPoly
- * @description 判断一个点是否在多边形里面。(射线法)。
- *
- * @param {Object} pt - 需要判定的点对象,该对象含有属性 x(横坐标),属性 y(纵坐标)。
- * @param {Array.<Object>} poly - 多边形节点数组。例如一个四边形:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
- * @returns {boolean} 点是否在多边形内。
- */
- isPointInPoly: function (pt, poly) {
- for (var isIn = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i) {
- ((poly[i].y <= pt.y && pt.y < poly[j].y) || (poly[j].y <= pt.y && pt.y < poly[i].y)) &&
- (pt.x < (poly[j].x - poly[i].x) * (pt.y - poly[i].y) / (poly[j].y - poly[i].y) + poly[i].x) &&
- (isIn = !isIn);
- }
- return isIn;
- }
- });
- var labelThemeLayer = function (name, options) {
- return new LabelThemeLayer(name, options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/services/FeatureService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
-
-
-
-
-
-
-
-
-
-
-
-
-
- /**
- * @class FeatureService
- * @deprecatedclassinstance L.supermap.featureService
- * @classdesc 要素数据集类。提供:ID 查询,范围查询,SQL 查询,几何查询,bounds 查询,缓冲区查询,地物编辑。
- * @category iServer Data Feature
- * @example
- * new FeatureService(url)
- * .getFeaturesByIDs(param,function(result){
- * //doSomething
- * })
- * @extends {ServiceBase}
- * @param {string} url - 服务地址。
- * @param {Object} options - 参数。
- * @param {string} [options.proxy] - 服务代理地址。
- * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- var FeatureService = ServiceBase.extend({
- initialize: function (url, options) {
- ServiceBase.prototype.initialize.call(this, url, options);
- },
- /**
- * @function FeatureService.prototype.getFeaturesByIDs
- * @description 数据集 ID 查询服务。
- * @param {GetFeaturesByIDsParameters} params - ID 查询参数类。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- getFeaturesByIDs: function (params, callback, resultFormat) {
- var me = this;
- var getFeaturesByIDsService = new GetFeaturesByIDsService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin:me.options.crossOrigin,
- headers:me.options.headers,
- eventListeners: {
- processCompleted: callback,
- processFailed: callback
- },
- format: me._processFormat(resultFormat)
- });
- getFeaturesByIDsService.processAsync(me._processParams(params));
- },
- /**
- * @function FeatureService.prototype.getFeaturesByBounds
- * @description 数据集 bounds 查询服务。
- * @param {GetFeaturesByBoundsParameters} params - 数据集范围查询参数类。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- getFeaturesByBounds: function (params, callback, resultFormat) {
- var me = this;
- var getFeaturesByBoundsService = new GetFeaturesByBoundsService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin:me.options.crossOrigin,
- headers:me.options.headers,
- eventListeners: {
- processCompleted: callback,
- processFailed: callback
- },
- format: me._processFormat(resultFormat)
- });
- getFeaturesByBoundsService.processAsync(me._processParams(params));
- },
- /**
- * @function FeatureService.prototype.getFeaturesByBuffer
- * @description 数据集 buffer 查询服务。
- * @param {GetFeaturesByBufferParameters} params - 数据集缓冲区查询参数类。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- getFeaturesByBuffer: function (params, callback, resultFormat) {
- var me = this;
- var getFeatureService = new GetFeaturesByBufferService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin:me.options.crossOrigin,
- headers:me.options.headers,
- eventListeners: {
- processCompleted: callback,
- processFailed: callback
- },
- format: me._processFormat(resultFormat)
- });
- getFeatureService.processAsync(me._processParams(params));
- },
- /**
- * @function FeatureService.prototype.getFeaturesBySQL
- * @description 数据集 SQL 查询服务。
- * @param {GetFeaturesBySQLParameters} params - 数据集 SQL 查询参数类。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- getFeaturesBySQL: function (params, callback, resultFormat) {
- var me = this;
- var getFeatureBySQLService = new GetFeaturesBySQLService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin:me.options.crossOrigin,
- headers:me.options.headers,
- eventListeners: {
- processCompleted: callback,
- processFailed: callback
- },
- format: me._processFormat(resultFormat)
- });
- getFeatureBySQLService.processAsync(me._processParams(params));
- },
- /**
- * @function FeatureService.prototype.getFeaturesByGeometry
- * @description 数据集几何查询服务类。
- * @param {GetFeaturesByGeometryParameters} params - 数据集几何查询参数类。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- getFeaturesByGeometry: function (params, callback, resultFormat) {
- var me = this;
- var getFeaturesByGeometryService = new GetFeaturesByGeometryService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin:me.options.crossOrigin,
- headers:me.options.headers,
- eventListeners: {
- processCompleted: callback,
- processFailed: callback
- },
- format: me._processFormat(resultFormat)
- });
- getFeaturesByGeometryService.processAsync(me._processParams(params));
- },
- /**
- * @function FeatureService.prototype.editFeatures
- * @description 地物编辑服务。
- * @param {EditFeaturesParameters} params - 数据服务中数据集添加、修改、删除参数类。
- * @param {RequestCallback} callback - 回调函数。
- */
- editFeatures: function (params, callback) {
- if (!params || !params.dataSourceName || !params.dataSetName) {
- return;
- }
- var me = this,
- url = me.url,
- dataSourceName = params.dataSourceName,
- dataSetName = params.dataSetName;
- url = Util.urlPathAppend(url, "datasources/" + dataSourceName + "/datasets/" + dataSetName);
- var editFeatureService = new EditFeaturesService(url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin:me.options.crossOrigin,
- headers:me.options.headers,
- eventListeners: {
- processCompleted: callback,
- processFailed: callback
- }
- });
- editFeatureService.processAsync(me._processParams(params));
- },
- _processParams: function (params) {
- if (!params) {
- return {};
- }
- params.returnContent = (params.returnContent == null) ? true : params.returnContent;
- params.fromIndex = params.fromIndex ? params.fromIndex : 0;
- params.toIndex = params.toIndex ? params.toIndex : -1;
- params.isUseBatch = (params.isUseBatch == null) ? false : params.isUseBatch;
- if (params.bounds) {
- params.bounds = CommontypesConversion.toSuperMapBounds(params.bounds);
- }
- if (params.geometry) {
- params.geometry = toSuperMapGeometry(params.geometry);
- }
- if (params.editType) {
- params.editType = params.editType.toLowerCase();
- }
- var me = this;
- if (params.features) {
- var features = [];
- if (external_L_default().Util.isArray(params.features)) {
- params.features.map(function (feature) {
- features.push(me._createServerFeature(feature));
- return feature;
- });
- } else {
- features.push(me._createServerFeature(params.features));
- }
- params.features = features;
- }
- return params;
- },
- _createServerFeature: function (geoFeature) {
- var geoJSONFeature, feature = {}, fieldNames = [], fieldValues = [];
- geoJSONFeature = geoFeature || {};
- for (var key in geoJSONFeature.properties) {
- fieldNames.push(key);
- fieldValues.push(geoJSONFeature.properties[key]);
- }
- feature.fieldNames = fieldNames;
- feature.fieldValues = fieldValues;
- if (geoJSONFeature.id) {
- feature.id = geoJSONFeature.id;
- }
- feature.geometry = toSuperMapGeometry(geoJSONFeature);
- return feature;
- },
- _processFormat: function (resultFormat) {
- return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
- }
- });
- var FeatureService_featureService = function (url, options) {
- return new FeatureService(url, options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/UnicodeMarker.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class UnicodeMarker
- * @deprecatedclassinstance L.supermap.unicodeMarker
- * @classdesc Unicode 字符图标。
- * @category Visualization Marker
- * @extends {L.Path}
- * @param {L.LatLngBounds} latlng - 经纬度坐标。
- * @param {Object} options - 参数。
- * @param {string} options.label - 符号 Unicode 值。
- * @param {string} [options.labelRotation='0'] - 符号旋转角度。
- * @param {string} [options.globalAlpha='1'] - 符号的透明值。
- * @param {string} [options.fontStyle='normal'] - 符号的风格。
- * @param {string} [options.fontWeight='normal'] - 符号的粗细。
- * @param {string} [options.fontSize='1em'] - 符号的尺寸。
- * @param {string} [options.fontFamily='sans-serif'] - 符号的字体。
- * @param {string} [options.textAlign='center'] - 符号内容的对齐方式。
- * @param {string} [options.textBaseline='middle'] - 绘制符号时使用的基线。
- * @fires UnicodeMarker#move
- * @usage
- */
- var UnicodeMarker = external_L_default().Path.extend({
- // @section
- // @aka CircleMarker options
- options: {
- fontStyle: "normal",
- fontWeight: "normal",
- fontSize: "1em",
- fontFamily: "sans-serif",
- textAlign: "center",
- textBaseline: "middle",
- vfactor: -.5,
- labelRotation: 0,
- globalAlpha: 1,
- label: ""
- },
- initialize: function (latlng, options) {
- external_L_default().Util.setOptions(this, options);
- this._latlng = latlng;
- },
- /**
- * @function UnicodeMarker.prototype.setLatLng
- * @description 设置 marker 新坐标。
- * @param {L.LatLng} setLatLng - 需要设置的新坐标。
- */
- setLatLng: function (latlng) {
- this._latlng = latlng;
- this.redraw();
- /**
- * @event UnicodeMarker#move
- * @description circle marker 重设坐标之后触发。
- * @property {L.LatLng} latlng - 当前 marker 坐标。
- */
- return this.fire('move', {latlng: this._latlng});
- },
- /**
- * @function UnicodeMarker.prototype.getLatLng
- * @description 获取 marker 坐标。
- * @returns {L.LatLng} 返回当前 marker 坐标。
- */
- getLatLng: function () {
- return this._latlng;
- },
- _project: function () {
- this._point = this._map.latLngToLayerPoint(this._latlng);
- this._updateBounds();
- },
- _updateBounds: function () {
- var w = this._clickTolerance(),
- p = [w, w];
- this._pxBounds = new (external_L_default()).Bounds(this._point.subtract(p), this._point.add(p));
- },
- _update: function () {
- if (this._map) {
- this._updatePath();
- }
- },
- _updatePath: function () {
- this._renderer._updateUnicode(this);
- },
- // Needed by the `Canvas` renderer for interactivity
- _containsPoint: function (p) {
- return p.distanceTo(this._point) <= this._clickTolerance();
- }
- })
- var unicodeMarker = function (latlng, options) {
- return new UnicodeMarker(latlng, options);
- };
- external_L_default().Canvas.include({
- _updateUnicode: function (layer) {
- if (!this._drawing) {
- return;
- }
- let pt = {x: layer._point.x, y: layer._point.y},
- ctx = this._ctx,
- fontStyle = [layer.options.fontStyle,
- "normal", layer.options.fontWeight,
- layer.options.fontSize,
- layer.options.fontFamily].join(" ");
- let label = layer.options.label.replace(/^&#x/, '');
- label = String.fromCharCode(parseInt(label, 16));
- let labelRows = label.split('\n');
- let numRows = labelRows.length;
- // if (layer.options.labelXOffset || layer.options.labelYOffset) {
- // let xOffset = isNaN(layer.options.labelXOffset) ? 0 : layer.options.labelXOffset;
- // let yOffset = isNaN(layer.options.labelYOffset) ? 0 : layer.options.labelYOffset;
- // pt.x += xOffset;
- // pt.y -= yOffset;
- // }
- ctx.fillStyle = layer.options.fontColor;
- ctx.globalAlpha = 1.0;
- if (layer.options.fontOpacity >= 0 && layer.options.fontOpacity < 1) {
- ctx.globalAlpha = layer.options.fontOpacity;
- }
- if (ctx.fillText) {
- // HTML5
- ctx.font = fontStyle;
- ctx.textAlign = layer.options.textAlign;
- ctx.textBaseline = layer.options.textBaseline;
- let vfactor = layer.options.vfactor;
- let lineHeight =
- ctx.measureText('Mg').height ||
- ctx.measureText('xx').width;
- pt.y += lineHeight * vfactor * (numRows - 1);
- for (let i = 0; i < numRows; i++) {
- if (layer.options.labelRotation != 0) {
- ctx.save();
- ctx.translate(pt.x, pt.y);
- ctx.rotate(layer.options.labelRotation * Math.PI / 180);
- ctx.fillText(labelRows[i], 0, (lineHeight * i));
- ctx.restore();
- } else {
- ctx.fillText(labelRows[i], pt.x, pt.y);
- }
- }
- } else if (ctx.mozDrawText) {
- // Mozilla pre-Gecko1.9.1 (<FF3.1)
- ctx.mozTextStyle = fontStyle;
- // No built-in text alignment, so we measure and adjust the position
- let hfactor = layer.options.textAlign;
- let vfactor = layer.options.vfactor;
- let lineHeight = ctx.mozMeasureText('xx');
- pt.y += lineHeight * (1 + (vfactor * numRows));
- for (let i = 0; i < numRows; i++) {
- let x = pt.x + (hfactor * ctx.mozMeasureText(labelRows[i]));
- let y = pt.y + (i * lineHeight);
- ctx.translate(x, y);
- ctx.mozDrawText(labelRows[i]);
- ctx.translate(-x, -y);
- }
- }
- }
- });
- ;// CONCATENATED MODULE: ./src/leaflet/mapping/WebMap.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class WebMap
- * @deprecatedclassinstance L.supermap.webMap
- * @classdesc 对接 iPortal/Online 地图类。
- * @category iPortal/Online Resources Map
- * @extends {L.LayerGroup}
- * @param {number} id - iPortal/Online 地图 id。
- * @param {Object} options - 参数。
- * @param {string} [options.map='map'] - 地图容器 id。
- * @param {string} [options.server='https://www.supermapol.com'] - iPortal/Online 服务地址。
- * @param {boolean} [options.featureLayerPopupEnable=true] - 是否启动要素图层提示框。
- * @param {string} [options.featureLayerPopup] - 提示框提示信息。
- * @param {string} [options.credentialValue] - 证书值。
- * @param {string} [options.credentialKey='key'] - 证书密钥。
- * @param {string} [options.attribution='Map Data <span>© <a href='https://www.supermapol.com' title='SuperMap Online' target='_blank'>SuperMap Online</a></span>'] - 版权信息。
- * @fires WebMap#maploaded
- * @fires WebMap#coordconvertsuccess
- * @fires WebMap#coordconvertfailed
- * @fires WebMap#featureunselected
- * @fires WebMap#featureselected
- * @fires WebMap#featuremousemove
- * @usage
- */
- var WebMap = external_L_default().LayerGroup.extend({
- options: {
- map: 'map',
- server: 'https://www.supermapol.com',
- featureLayerPopupEnable: true,
- featureLayerPopup: null,
- credentialValue: null,
- credentialKey: 'key',
- attribution: core_Attributions.Online.attribution
- },
- /**
- * @private
- * @function WebMap.prototype.defaultFeatureLayerPopup
- * @description 默认图层弹出框。
- * @param {L.Layer} layer - Leaflet Layer 对象。
- * @returns {string} 图层弹出框内容。
- */
- defaultFeatureLayerPopup: function (layer) {
- return layer.feature.properties.attributes.title + ":" + layer.feature.properties.attributes.description;
- },
- initialize: function (id, options) {
- if (!id && !options) {
- return;
- }
- this._layers = {};
- external_L_default().setOptions(this, options);
- this.id = id;
- this.load();
- this.cartoCSSToLeaflet = new CartoCSSToLeaflet();
- },
- /**
- * @private
- * @function WebMap.prototype.load
- * @description 登陆后添加地图图层。
- */
- load: function () {
- if (this.options.server.indexOf('http://') < 0 && this.options.server.indexOf('https://') < 0) {
- this.options.server = "http://" + this.options.server;
- }
- var mapUrl = this.options.server + '/web/maps/' + this.id + '.json';
- if (this.options.credentialValue) {
- mapUrl += ('?' + this.options.credentialKey + '=' + this.options.credentialValue);
- }
- var me = this;
- FetchRequest.get(mapUrl).then(function (response) {
- return response.json()
- }).then(function (jsonObj) {
- if (!jsonObj) {
- return;
- }
- var layers = jsonObj.layers;
- me.mapInfo = jsonObj;
- me.createLayersByJson(layers);
- });
- },
- /**
- * @private
- * @function WebMap.prototype.addLayerWrapper
- * @description 添加图层容器。
- * @param {L.Layer} layer - Leaflet Layer 对象。
- * @param {boolean} [isBaseLayer] - 是否为底图层。
- * @param {Object} options - 参数。
- * @returns {WebMap} WebMap的实例对象。
- */
- addLayerWrapper: function (layer, isBaseLayer, options) {
- if (isBaseLayer) {
- this.createMap(options);
- }
- this.addLayer(layer);
- if (layer.labelLayer) {
- this.addLayer(layer.labelLayer);
- }
- return this;
- },
- /**
- * @private
- * @function WebMap.prototype.createLayersByJson
- * @description 通过 JSON 创建图层。
- * @param {JSONObject} layersJson - 图层的 JSON 信息。
- */
- createLayersByJson: function (layersJson) {
- if (!external_L_default().Util.isArray(layersJson)) {
- return;
- }
- if (layersJson.length === 0) {
- return;
- }
- this.layers = [];
- var layerQueue = [];
- for (var i = 0; i < layersJson.length; i++) {
- var layerJson = layersJson[i];
- layerJson["_originIndex"] = i;
- var layerJsonType = layerJson.layerType = layerJson.layerType || "BASE_LAYER";
- if (layerJsonType !== "BASE_LAYER") {
- //如果图层不是底图,则先加到图层队列里面等待底图完成后再处理
- layerQueue.unshift(layerJson);
- continue;
- } else {
- layerJson.isBaseLayer = true;
- this.createLayer(layerJson.type, layerJson);
- }
- }
- //底图加载完成后开始处理图层队列里的图层
- while (layerQueue.length > 0) {
- var layerInfo = layerQueue.pop();
- var type = layerInfo.type;
- var layerType = layerInfo.layerType = layerInfo.layerType || "BASE_LAYER";
- if (layerType !== "OVERLAY_LAYER") {
- type = layerType;
- }
- this.createLayer(type, layerInfo);
- }
- /**
- * @event WebMap#maploaded
- * @description 底图加载完成后触发。
- * @property {L.Map} map - Leaflet Map 对象。
- */
- this.fire('maploaded', {
- map: this._map
- });
- },
- /**
- * @private
- * @function WebMap.prototype.createCRS
- * @description 创建坐标对象。
- * @param {number} epsgCode - epsg 编码。
- * @param {string} type - 坐标类型。
- * @param {number} resolutions - 分辨率。
- * @param {L.Point} origin - 切片原点。
- * @param {L.Bounds} bounds - 地图范围。
- */
- createCRS: function (epsgCode, type, resolutions, origin, bounds) {
- if (epsgCode < 0) {
- return new NonEarthCRS({
- bounds: bounds,
- origin: origin,
- resolutions: resolutions
- })
- }
- if (epsgCode === 910112 || epsgCode === 910102) {
- return BaiduCRS;
- }
- if (epsgCode === 910111) {
- epsgCode = 3857
- //todo 火星mercator
- }
- if (epsgCode === 910101) {
- epsgCode = 4326
- //todo 火星
- }
- return crs("EPSG:" + epsgCode, {
- origin: origin,
- resolutions: resolutions,
- bounds: bounds
- })
- },
- /**
- * @private
- * @function WebMap.prototype.createMap
- * @description 创建地图。
- * @param {Object} options - 参数。
- */
- createMap: function (options) {
- var crs = options.crs || (external_L_default()).CRS.EPSG3857;
- var bounds = external_L_default().latLngBounds(crs.unproject(options.bounds.min), crs.unproject(options.bounds.max));
- this._map = external_L_default().map(this.options.map, {
- center: bounds.getCenter(),
- maxZoom: options.maxZoom || 22,
- minZoom: options.minZoom || 0,
- zoom: options.zoom || 0,
- crs: crs,
- renderer: external_L_default().canvas()
- });
- if (crs instanceof NonEarthCRS) {
- this._map.setZoom(options.zoom ? options.zoom + 2 : 2, {
- maxZoom: options.maxZoom || 22
- });
- } else {
- this._map.fitBounds(bounds, {
- maxZoom: options.maxZoom || 22
- });
- }
- },
- /**
- * @private
- * @function WebMap.prototype.getResolutionsFromScales
- * @description 通过比例尺获取分辨率。
- * @param {Array.<number>} scales - 排序比例尺数组。
- * @param {number} dpi - 屏幕分辨率。
- * @param {string} units - 地图的单位。
- * @param {Datum} datum - 大地参照系类。
- * @returns {Array.<number>} 返回给定比例尺所对应的分辨率。
- */
- getResolutionsFromScales: function (scales, dpi, units, datum) {
- var resolutions = [];
- for (var i = 0; i < scales.length; i++) {
- resolutions.push(getResolutionFromScaleDpi(scales[i], dpi, units, datum))
- }
- return resolutions;
- },
- /**
- * @private
- * @function WebMap.prototype.createLayer
- * @description 创建图层。
- * @param {string} type - 图层类型。
- * @param {Object} layerInfo - 图层信息。
- */
- createLayer: function (type, layerInfo) {
- var prjCoordSys = layerInfo.prjCoordSys,
- epsgCode = prjCoordSys && prjCoordSys.epsgCode || this.mapInfo.epsgCode,
- center = this.mapInfo.center || layerInfo.center,
- level = this.mapInfo.level || layerInfo.level,
- bounds = this.mapInfo.extent || layerInfo.bounds,
- scales = layerInfo.scales,
- isBaseLayer = layerInfo.isBaseLayer,
- opacity = layerInfo.opacity;
- var mapBounds = external_L_default().bounds([bounds.leftBottom.x, bounds.leftBottom.y], [bounds.rightTop.x, bounds.rightTop.y]);
- var layerBounds = layerInfo.bounds ? external_L_default().bounds([layerInfo.bounds.leftBottom.x, layerInfo.bounds.leftBottom.y], [layerInfo.bounds.rightTop.x, layerInfo.bounds.rightTop.y]) : mapBounds;
- if (!center) {
- center = layerBounds.getCenter();
- }
- var origin = external_L_default().point(layerBounds.min.x, layerBounds.max.y);
- var resolutions = !scales ? null : this.getResolutionsFromScales(scales, 96, layerInfo.units);
- var crs = this.createCRS(epsgCode, prjCoordSys ? prjCoordSys.type : '', resolutions, origin, layerBounds);
- var mapOptions = {
- bounds: mapBounds,
- center: external_L_default().point(center.x, center.y),
- crs: crs,
- zoom: level
- };
- var layer;
- switch (type) {
- case "SUPERMAP_REST":
- layer = tiledMapLayer(layerInfo.url, {
- transparent: true,
- opacity: opacity
- });
- break;
- case "SUPERMAP_REST_VECTOR":
- //ToDO
- break;
- case "TIANDITU_VEC":
- case "TIANDITU_IMG":
- case "TIANDITU_TER":
- mapOptions.crs = epsgCode === 4326 ? TianDiTu_WGS84CRS : TianDiTu_MercatorCRS;
- mapOptions.minZoom = 1;
- mapOptions.zoom = 1 + mapOptions.zoom;
- layer = this.createTiandituLayer(layerInfo);
- break;
- case "BAIDU":
- mapOptions.crs = BaiduCRS;
- mapOptions.zoom = 3 + mapOptions.zoom;
- mapOptions.minZoom = 3;
- layer = baiduTileLayer();
- break;
- case 'BING':
- //todo
- break;
- case "WMS":
- layer = this.createWmsLayer(layerInfo);
- break;
- case "WMTS":
- mapOptions.resolutions = this.getResolutionsFromScales(scales, 90.71446714322, layerInfo.units);
- var identifier = layerInfo.identifier;
- var layerName = identifier.substring(identifier.indexOf("_") + 1);
- layer = wmtsLayer(layerInfo.url, {
- layer: layerName,
- style: "default",
- tilematrixSet: identifier,
- format: "image/png"
- });
- break;
- case "CLOUD":
- mapOptions.crs = (external_L_default()).CRS.EPSG3857;
- mapOptions.zoom = 3 + mapOptions.zoom;
- mapOptions.minZoom = 3;
- layer = cloudTileLayer(layerInfo.url, {
- opacity: opacity
- });
- break;
- case "MARKER_LAYER":
- layer = this.createMarkersLayer(layerInfo, crs);
- break;
- case "FEATURE_LAYER":
- if (layerInfo.identifier == "ANIMATORVECTOR") {
- //todo
- } else if (layerInfo.identifier == "THEME") {
- layer = this.createThemeLayer(layerInfo);
- } else {
- layer = this.createVectorLayer(layerInfo, crs);
- }
- break;
- default:
- throw new Error('unSupported Layer Type');
- }
- if (layer && layerInfo.isVisible) {
- this.addLayerWrapper(layer, isBaseLayer, mapOptions);
- }
- },
- /**
- * @private
- * @function WebMap.prototype.createTiandituLayer
- * @description 创建天地图图层。
- * @param {Object} layerInfo - 图层信息。
- * @returns {tiandituTileLayer} 返回天地图图层对象。
- */
- createTiandituLayer: function (layerInfo) {
- var type = layerInfo.type.split('_')[1].toLowerCase();
- var isLabel = layerInfo.layerType === 'OVERLAY_LAYER';
- var layer = new TiandituTileLayer({
- layerType: type,
- isLabel: isLabel
- });
- return layer;
- },
- /**
- * @private
- * @function WebMap.prototype.createMarkersLayer
- * @description 创建图标图层。
- * @param {Object} layerInfo - 图层信息。
- * @param {Object} crs - 坐标对象。
- * @returns {L.Layer} 返回 marker 图层。
- */
- createMarkersLayer: function (layerInfo, crs) {
- var that = this;
- var markers = layerInfo.markers || [];
- //style = layerInfo.style,
- //opacity = layerInfo.opacity,
- //marker, point, size, offset, icon, that = this;
- //todo offset
- var coordsToLatLng = function (coords) {
- var ll = crs.unproject(external_L_default().point(coords[0], coords[1]));
- return new (external_L_default()).LatLng(ll.lat, ll.lng, coords[2]);
- };
- var layer = external_L_default().geoJSON(toGeoJSON(markers), {
- pointToLayer: function (geojson, latlng) {
- var m = new (external_L_default()).Marker(latlng);
- m.setStyle = function (style) {
- if (style) {
- m.setIcon(style);
- }
- };
- return m;
- },
- coordsToLatLng: coordsToLatLng,
- style: function (geoJsonFeature) {
- return that.cartoCSSToLeaflet.getStyleFromiPortalMarker(geoJsonFeature.properties.icon);
- }
- });
- if (this.options.featureLayerPopupEnable) {
- layer.bindPopup(this.options.featureLayerPopup || this.defaultFeatureLayerPopup)
- }
- return layer;
- },
- /**
- * @private
- * @function WebMap.prototype.createWmsLayer
- * @description 创建 Wms 图层。
- * @param {Object} layerInfo - 图层信息。
- * @returns {L.Layer} 返回 Wms 图层对象。
- */
- createWmsLayer: function (layerInfo) {
- var url = layerInfo.url,
- opacity = layerInfo.opacity,
- subLayers = layerInfo.subLayers;
- if (!subLayers || subLayers === "undefined" || subLayers === "null") {
- subLayers = "0";
- }
- return external_L_default().tileLayer.wms(url, {
- layers: subLayers,
- format: 'image/png',
- transparent: true,
- noWrap: true,
- opacity: opacity
- })
- },
- /**
- * @private
- * @function WebMap.prototype.createVectorLayer
- * @description 创建矢量要素图层。
- * @param {Object} layerInfo - 图层信息。
- * @param {Object} crs - 坐标对象。
- * @returns {L.Layer} 返回矢量要素图层对象。
- */
- createVectorLayer: function (layerInfo, crs) {
- var style = layerInfo.style,
- opacity = layerInfo.opacity,
- me = this;
- //todo readonly = layerInfo.readonly;
- var coordsToLatLng = function (coords) {
- var ll = crs.unproject(external_L_default().point(coords[0], coords[1]));
- return new (external_L_default()).LatLng(ll.lat, ll.lng, coords[2]);
- };
- if (!layerInfo.url) {
- var layer = external_L_default().geoJSON(toGeoJSON(layerInfo.features), {
- pointToLayer: function (geojson, latlng) {
- var m = new (external_L_default()).Marker(latlng);
- m.setStyle = function (style) {
- if (style) {
- m.setIcon(style);
- }
- }
- return m;
- },
- coordsToLatLng: coordsToLatLng,
- style: function (geoJsonFeature) {
- let lStyle = me.cartoCSSToLeaflet.getStyleFromiPortalStyle(style ? style : {}, geoJsonFeature.geometry.type, geoJsonFeature.properties.style);
- if (lStyle && lStyle.dashArray && lStyle.dashArray.length == 0) {
- lStyle.dashArray = null;
- }
- return lStyle;
- },
- opacity: opacity
- });
- if (this.options.featureLayerPopupEnable) {
- layer.bindPopup(this.options.featureLayerPopup || this.defaultFeatureLayerPopup)
- }
- return layer;
- } else {
- var url = layerInfo.url,
- datasourceName = layerInfo.name,
- datasets = layerInfo.features;
- for (var setNameIndex = 0; setNameIndex < datasets.length; setNameIndex++) {
- var dataset = datasets[setNameIndex];
- if (dataset.visible) {
- this.getFeaturesBySQL(url, datasourceName, dataset.name, "", DataFormat.GEOJSON, (serviceResult) => {
- var layer = external_L_default().geoJSON(serviceResult.result, {
- pointToLayer: function (geojson, latlng) {
- var m = new (external_L_default()).Marker(latlng);
- m.setStyle = function (style) {
- if (style) {
- m.setIcon(style);
- }
- };
- return m;
- },
- coordsToLatLng: coordsToLatLng,
- style: function (geoJsonFeature) {
- return this.cartoCSSToLeaflet.getStyleFromiPortalStyle(style ? style : {}, geoJsonFeature.geometry.type, geoJsonFeature.properties.style);
- },
- opacity: opacity
- });
- if (this.options.featureLayerPopupEnable) {
- layer.bindPopup(me.options.featureLayerPopup || me.defaultFeatureLayerPopup)
- }
- this.addLayer(layer);
- })
- }
- }
- }
- },
- getFeaturesBySQL: function (url, datasourceName, datasetName, filter, format, callback) {
- filter = filter || "SMID > 0";
- var sqlParam = new GetFeaturesBySQLParameters({
- queryParameter: {
- name: datasetName + "@" + datasourceName,
- attributeFilter: filter
- },
- datasetNames: [datasourceName + ":" + datasetName],
- fromIndex: 0,
- toIndex: 100000
- });
- FeatureService_featureService(url).getFeaturesBySQL(sqlParam, callback, format);
- },
- /**
- * @private
- * @function WebMap.prototype.createThemeLayer
- * @description 创建专题图图层。
- * @param {Object} layerInfo - 图层信息。
- * @returns {L.Layer} 返回专题图图层对象。
- */
- createThemeLayer: function (layerInfo) {
- var themeSettings = layerInfo.themeSettings && JSON.parse(layerInfo.themeSettings);
- var layer;
- var type = themeSettings.type;
- layerInfo.themeSettings = themeSettings;
- if (type === "HEAT") {
- layer = this.createHeatLayer(layerInfo, themeSettings);
- } else if (type === "UNIQUE") {
- layer = this.createUniqueLayer(layerInfo, themeSettings);
- } else if (type === "RANGE") {
- layer = this.createRangeLayer(layerInfo, themeSettings);
- } else {
- layer = this.createBaseThemeLayer(layerInfo, themeSettings);
- }
- if (layer) {
- this.addFeature2ThemeLayer(layerInfo, layer);
- layer.on('add', (e) => {
- this.registerThemeEvent(e.target);
- })
- }
- if (themeSettings && themeSettings.labelField) {
- var labelLayer = this.createLabelLayer(layerInfo, themeSettings);
- labelLayer.on('add', (e) => {
- this.registerThemeEvent(e.target);
- });
- layer.labelLayer = labelLayer;
- }
- return layer;
- },
- createBaseThemeLayer: function (layerInfo, themeSettings) {
- let style = layerInfo.style,
- opacity = layerInfo.opacity,
- vectorType = themeSettings.vectorType,
- featureStyle = style.pointStyle;
- if (vectorType === "LINE") {
- featureStyle.fill = false;
- } else {
- featureStyle.fill = true;
- }
- var pointStyle = {};
- pointStyle.radius = featureStyle.pointRadius;
- pointStyle.color = featureStyle.strokeColor;
- pointStyle.opacity = featureStyle.strokeOpacity;
- pointStyle.lineCap = featureStyle.strokeLineCap;
- pointStyle.weight = featureStyle.strokeWidth;
- pointStyle.fillColor = featureStyle.fillColor;
- pointStyle.fillOpacity = featureStyle.fillOpacity;
- var pointToLayer = (geojson, latlng) => {
- return external_L_default().circleMarker(latlng, pointStyle);
- };
- if (featureStyle.unicode) {
- pointToLayer = (geojson, latlng) => {
- return new UnicodeMarker(latlng, featureStyle)
- }
- }
- return external_L_default().geoJSON({
- type: "GeometryCollection",
- geometries: []
- }, {
- pointToLayer: pointToLayer,
- opacity: opacity
- });
- //this.registerVectorEvent(vector);
- },
- createUniqueLayer: function (layerInfo, themeSettings) {
- var title = layerInfo.title;
- var themeField = themeSettings.field,
- styleGroups = [],
- settings = themeSettings.settings,
- isVisible = layerInfo.isVisible,
- opacity = layerInfo.opacity,
- vectorType = themeSettings.vectorType;
- //组成styleGroup
- for (var i = 0; i < settings.length; i++) {
- var object = {};
- object.value = settings[i].value;
- object.style = settings[i].style;
- styleGroups.push(object);
- }
- var unique = new UniqueThemeLayer(title, {
- opacity: opacity,
- visibility: isVisible
- });
- this.registerThemeEvent(unique);
- unique.style = layerInfo.style.pointStyle;
- if (vectorType === "LINE") {
- unique.style.fill = false;
- } else {
- unique.style.fill = true;
- }
- unique.style.stroke = true;
- unique.themeField = themeField;
- unique.styleGroups = styleGroups;
- var that = this;
- unique.on('click', function (event) {
- if (event.target && event.target.refDataID) {
- var currenFeature = unique.getFeatureById(event.target.refDataID);
- that.events.triggerEvent("uniquefeatureclicked", currenFeature, unique);
- }
- });
- return unique;
- },
- createRangeLayer: function (layerInfo, themeSettings) {
- var title = layerInfo.title;
- var themeField = themeSettings.field,
- styleGroups = [],
- settings = themeSettings.settings,
- isVisible = layerInfo.isVisible,
- opacity = layerInfo.opacity,
- vectorType = themeSettings.vectorType,
- featureStyle = layerInfo.style.pointStyle;
- if (vectorType === "LINE") {
- featureStyle.fill = false;
- } else {
- featureStyle.fill = true;
- }
- //组成styleGroup
- for (var i = 0; i < settings.length; i++) {
- var object = {};
- object.start = settings[i].start;
- object.end = settings[i].end;
- object.style = settings[i].style;
- styleGroups.push(object);
- }
- var range = new RangeThemeLayer(title, {
- visibility: isVisible,
- opacity: opacity
- });
- this.registerThemeEvent(range);
- range.style = layerInfo.style.pointStyle;
- range.style.stroke = true;
- range.themeField = themeField;
- range.styleGroups = styleGroups;
- return range;
- },
- createLabelLayer: function (layerInfo, themeSettings) {
- var title = layerInfo.title;
- var labelField = themeSettings.labelField,
- settings = themeSettings.settings,
- isVisible = layerInfo.isVisible;
- //目前只是同一样式
- var style;
- if (!settings || settings.length > 0) {
- style = {
- "fillColor": "#ffffff"
- };
- } else {
- style = settings[0].style;
- }
- var layerStyle = external_L_default().Util.extend(new ThemeStyle(), style);
- layerStyle.fontWeight = "bold";
- layerStyle.fontSize = "14px";
- //默认显示标签边框背景
- layerStyle.labelRect = true;
- layerStyle.strokeColor = layerStyle.fillColor;
- layerStyle.fontColor = themeSettings.labelColor;
- if (themeSettings.labelFont) {
- layerStyle.fontFamily = themeSettings.labelFont;
- }
- var label = new LabelThemeLayer(title, {
- visibility: isVisible,
- opacity: 0.7
- });
- this.registerThemeEvent(label);
- label.style = layerStyle;
- label.themeField = labelField;
- //styleGroup, 目前只是同一样式
- label.styleGroups = [];
- return label;
- },
- createHeatLayer: function (layerInfo, themeSettings) {
- let colors = themeSettings.colors || ['blue', 'cyan', 'lime', 'yellow', 'red'];
- let gradient = {},
- featureWeight;
- for (let i = 0, len = colors.length, index = 1; i < len; i++) {
- gradient[index / len] = colors[i];
- index++;
- }
- let radius = themeSettings.settings[0].radius;
- //判断单位
- if (themeSettings.heatUnit === "千米" || themeSettings.heatUnit === "km") {
- radius = themeSettings.heatRadius * 1000
- }
- //权重
- if (themeSettings.settings[0] && themeSettings.settings[0].featureWeight) {
- featureWeight = themeSettings.settings[0].featureWeight;
- }
- return external_L_default().heatLayer([], {
- radius: radius / 2,
- minOpacity: layerInfo.opacity,
- gradient: gradient,
- blur: radius / 2,
- featureWeight: featureWeight
- })
- },
- addFeature2ThemeLayer: function (layerInfo, layer) {
- if (layerInfo.layerType !== "FEATURE_LAYER" || layerInfo.identifier !== "THEME") {
- return;
- }
- var me = this;
- var isRestData = !!layerInfo.datasourceName;
- var cartoCSS = layerInfo.cartoCSS;
- if (cartoCSS) {
- var needTransform = this.getCartoCSS2Obj(cartoCSS).needTransform;
- var isAddFile = this.getCartoCSS2Obj(cartoCSS).isAddFile;
- }
- var url = layerInfo.url,
- subLayers, subLayer, layerName, credential = layerInfo.credential,
- themeSettings = layerInfo.themeSettings,
- filter = themeSettings.filter;
- if (isAddFile) {
- var position = JSON.parse(layerInfo.datasourceName);
- var sql = this.getSQLFromFilter(filter);
- if (url) {
- this.getFeatureFromFileAdded(layerInfo, function (data) {
- var sFeaturesArr = [],
- features, result;
- if (data.type === 'EXCEL' || data.type === 'CSV') {
- features = me.parseFeatureFromEXCEL.apply(me, [data.content.rows, data.content.colTitles, false, position]);
- for (var x = 0, len = features.length; x < len; x++) {
- result = jsonsql_default()({
- attr: features[x].attributes
- }, sql);
- if (result.length > 0) {
- sFeaturesArr.push(features[x])
- }
- }
- } else {
- features = me.parseFeatureFromJson(data.content);
- for (var i = 0, length = features.length; i < length; i++) {
- result = jsonsql_default()({
- attr: features[i].attributes
- }, sql);
- if (result.length > 0) {
- sFeaturesArr.push(features[i]);
- }
- }
- }
- var newEpsgCode = '4326',
- oldEpsgCode = layerInfo.prjCoordSys && layerInfo.prjCoordSys.epsgCode;
- if (needTransform) {
- me.changeFeatureLayerEpsgCode(oldEpsgCode, newEpsgCode, layer, sFeaturesArr, function (features) {
- addFeatures(features);
- });
- } else {
- addFeatures(sFeaturesArr);
- }
- }, function () {});
- } else {
- var newFeautures = [],
- features = layerInfo.features;
- for (var i = 0, len = features.length; i < len; i++) {
- var feature = features[i];
- var sqlResult = jsonsql_default()({
- attr: feature.attributes
- }, sql);
- if (sqlResult.length > 0) {
- var lon = feature.geometry.points[0].x,
- lat = feature.geometry.points[0].y;
- var point = new Point(lon, lat);
- var vector = new Vector(point, feature.attributes, feature.style);
- newFeautures.push(vector);
- }
- }
- addFeatures(newFeautures);
- }
- } else if (isRestData) {
- var dataSourceName = layerInfo.datasourceName;
- subLayers = layerInfo.subLayers && JSON.parse(layerInfo.subLayers);
- if (subLayers.length && subLayers.length > 0) {
- subLayer = subLayers[0];
- } else {
- subLayer = subLayers;
- }
- layerName = subLayer && subLayer.name;
- this.getFeaturesBySQL(layerInfo.url, dataSourceName, layerName, themeSettings.filter, DataFormat.ISERVER, (getFeaturesEventArgs) => {
- var features, feature, result = getFeaturesEventArgs.result,
- addedFeatures = [];
- if (result && result.features) {
- features = result.features;
- for (var fi = 0, felen = features.length; fi < felen; fi++) {
- feature = ServerFeature.fromJson(features[fi]).toFeature();
- addedFeatures.push(feature);
- }
- var newEpsgCode = '4326',
- oldEpsgCode = layerInfo.prjCoordSys && layerInfo.prjCoordSys.epsgCode;
- if (needTransform) {
- this.changeFeatureLayerEpsgCode(oldEpsgCode, newEpsgCode, layer, addedFeatures, function (features) {
- addFeatures(features);
- });
- } else {
- addFeatures(features);
- }
- }
- })
- } else {
- subLayers = layerInfo.subLayers && JSON.parse(layerInfo.subLayers);
- if (subLayers.length && subLayers.length > 0) {
- subLayer = subLayers[0];
- } else {
- subLayer = subLayers;
- }
- layerName = subLayer && subLayer.name;
- var oldEpsgCode = layerInfo.prjCoordSys && layerInfo.prjCoordSys.epsgCode;
- this.getFeaturesBySQL(url, credential, layerName, filter, DataFormat.ISERVER, function (features) {
- var newEpsgCode = '4326';
- if (needTransform) {
- me.changeFeatureLayerEpsgCode(oldEpsgCode, newEpsgCode, layer, features, function (features) {
- addFeatures(features);
- });
- } else {
- addFeatures(features);
- }
- });
- }
- function addFeatures(features) {
- if (layer && layer.labelLayer instanceof LabelThemeLayer) {
- me.addFeature2LabelLayer(layer.labelLayer, features, layerInfo);
- }
- if ((external_L_default()).HeatLayer && layer instanceof (external_L_default()).HeatLayer) {
- var heatPoints = [];
- for (let i = 0, len = features.length; i < len; i++) {
- let geometry = features[i].geometry;
- heatPoints[i] = external_L_default().latLng(geometry.y, geometry.x);
- if (layer.options.featureWeight) {
- heatPoints[i] = [heatPoints[i].lat, heatPoints[i].lng, parseFloat(features[i].attributes[layer.options.featureWeight])];
- }
- }
- layer.setLatLngs(heatPoints);
- } else if (layer instanceof (external_L_default()).GeoJSON) {
- layer.addData(new GeoJSON().toGeoJSON(features));
- } else {
- layer.addFeatures(features);
- }
- }
- },
- addFeature2LabelLayer: function (layer, features, layerInfo) {
- if (!features) {
- return;
- }
- var feature, geoTextFeature;
- var themeSettings = layerInfo.themeSettings;
- themeSettings = typeof themeSettings === "string" ? JSON.parse(layerInfo.themeSettings) : layerInfo.themeSettings;
- var themeField = themeSettings.labelField;
- var style = layer.style;
- var labelFeatures = [],
- lngLat;
- var styleInfo = layerInfo.styleString && JSON.parse(layerInfo.styleString);
- for (var i = 0; i < features.length; i++) {
- lngLat = this.getLabelLngLat(themeSettings.vectorType, features[i]);
- //设置标签的偏移量
- this.setLabelOffset(themeSettings.vectorType, styleInfo, features[i], style);
- feature = features[i];
- var attributes = feature.attributes;
- geoTextFeature = new ThemeFeature([lngLat.lat, lngLat.lng, attributes[themeField]], attributes);
- labelFeatures.push(geoTextFeature);
- }
- layer.style = style;
- layer.addFeatures(labelFeatures);
- },
- setLabelOffset: function (vectorType, styleInfo, feature, layerStyle) {
- if (vectorType === 'POINT') {
- var pointRadius = styleInfo.pointStyle.pointRadius || 0;
- var strokeWidth = styleInfo.pointStyle.strokeWidth || 0;
- var fontSize = parseInt(styleInfo.pointStyle.fontSize) || 0;
- layerStyle.labelXOffset = 0;
- layerStyle.labelYOffset = styleInfo.pointStyle.unicode ? 20 + fontSize : 25 + (pointRadius + strokeWidth);
- } else {
- return;
- }
- },
- getLabelLngLat: function (vectorType, feature) {
- var lngLat = {};
- if (vectorType === 'POINT') {
- var geometry = feature.geometry;
- lngLat.lng = geometry.x;
- lngLat.lat = geometry.y;
- } else if (vectorType === 'LINE') {
- //一条线所有顶点的数量
- var length, index;
- var components = feature.geometry.components;
- if (components[0].x) {
- //说明是lineString类型
- length = components.length;
- //线取中间点下一个显示标签
- index = parseInt(length / 2);
- lngLat.lng = components[index].x;
- lngLat.lat = components[index].y;
- } else {
- //说明是MultiLineString类型,取第一条线
- var lineOne = components[0].components;
- length = lineOne.length;
- index = parseInt(length / 2);
- lngLat.lng = lineOne[index].x;
- lngLat.lat = lineOne[index].y;
- }
- } else {
- var centroid = feature.geometry.getCentroid();
- lngLat.lng = centroid.x;
- lngLat.lat = centroid.y;
- }
- return lngLat;
- },
- changeFeatureLayerEpsgCode: function (oldEpsgCode, newEpsgCode, layer, features, success) {
- var me = this,
- i, len;
- var points = [];
- if (!oldEpsgCode || !newEpsgCode) {
- return;
- }
- if (features && features.length > 0) {
- for (i = 0, len = features.length; i < len; i++) {
- var feature = features[i];
- var geometry = feature.geometry;
- var vertices = geometry.getVertices();
- points = points.concat(vertices);
- }
- oldEpsgCode = 'EPSG:' + oldEpsgCode;
- newEpsgCode = 'EPSG:' + newEpsgCode;
- me.coordsTransform(oldEpsgCode, newEpsgCode, points, function (layer, features) {
- return function (newCoors) {
- var start = 0,
- len = newCoors.length;
- for (i = start; i < len; i++) {
- var point = points[i],
- coor = newCoors[i];
- point.x = coor.x;
- point.y = coor.y;
- point.calculateBounds();
- }
- for (i = 0, len = features.length; i < len; i++) {
- var feature = features[i];
- var geometry = feature.geometry;
- if (geometry.components) {
- me.calculateComponents(geometry.components);
- }
- geometry.calculateBounds();
- }
- success && success.call(me, features);
- }
- }(layer, features));
- }
- return true;
- },
- calculateComponents: function (components) {
- if (components) {
- if (components.components) {
- this.calculateComponents(components.components);
- } else {
- for (var i = 0, len = components.length; i < len; i++) {
- var component = components[i];
- if (component.components) {
- this.calculateComponents(component.components)
- }
- component.calculateBounds();
- }
- }
- }
- },
- coordsTransform: function (fromEpsg, toEpsg, point, success) {
- var newCoord;
- var from = this.SERVER_TYPE_MAP[fromEpsg],
- to = this.SERVER_TYPE_MAP[toEpsg];
- if (fromEpsg === toEpsg || !from || !to) {
- if (point && point.length !== undefined) {
- newCoord = [];
- for (var i = 0, len = point.length; i < len; i++) {
- var coor = {
- x: point[i].x,
- y: point[i].y
- };
- newCoord.push(coor);
- }
- } else {
- newCoord = {
- x: point.x,
- y: point.y
- };
- }
- if (success) {
- success.call(this, newCoord);
- }
- } else {
- var mercator = this.SERVER_TYPE_MAP['EPSG:3857'],
- wgs84 = this.SERVER_TYPE_MAP['EPSG:4326'];
- if ((from === mercator || from === wgs84) && (to === mercator || to === wgs84)) {
- this.projTransform(fromEpsg, toEpsg, point, success);
- } else {
- var convertType = from + '_' + to;
- this.postTransform(convertType, point, success);
- }
- }
- },
- projTransform: function (fromEpsg, toEpsg, point, success) {
- var newCoor, me = this;
- if (!lib) {
- return;
- }
- if (point && point.length !== undefined) {
- newCoor = [];
- for (var i = 0, len = point.length; i < len; i++) {
- var coor = lib(fromEpsg, toEpsg, [point[i].x, point[i].y]);
- newCoor.push({
- x: coor[0],
- y: coor[1]
- });
- }
- } else {
- newCoor = lib(fromEpsg, toEpsg, [point.x, point.y]);
- newCoor = {
- x: newCoor[0],
- y: newCoor[1]
- };
- }
- if (success) {
- /**
- * @event WebMap#coordconvertsuccess
- * @description 坐标转换成功后触发。
- * @property {L.LatLng} newCoor - 转换成功后的坐标。
- */
- me.fire('coordconvertsuccess', {
- newCoor: newCoor
- });
- success.call(me, newCoor);
- }
- },
- postTransform: function (convertType, point, success) {
- var me = this,
- epsgArray = [];
- if (!convertType) {
- return success.call(me, null);
- }
- if (point && point.length !== undefined) {
- for (var i = 0, len = point.length; i < len; i++) {
- epsgArray.push({
- x: point[i].x,
- y: point[i].y
- });
- }
- } else {
- epsgArray = [{
- x: point.x,
- y: point.y
- }];
- }
- if (epsgArray.length === 0) {
- return success.call(me, null);
- }
- var postData = {
- "convertType": convertType,
- "points": epsgArray
- };
- var url = this.server + "/apps/viewer/coordconvert.json";
- postData = JSON.stringify(postData);
- var options = {};
- if (!Util.isInTheSameDomain(url) && this.proxy) {
- options.proxy = this.proxy;
- }
- FetchRequest.post(url, postData, options).then((response) => {
- return response.json()
- }).then((jsonObj) => {
- var newCoors = jsonObj;
- if (!point && point.length !== undefined) {
- newCoors = newCoors[0];
- }
- this.fire('coordconvertsuccess', {
- newCoors: newCoors
- });
- success.call(this, newCoors);
- }).catch((err) => {
- if (!this.actived) {
- return;
- }
- /**
- * @event WebMap#coordconvertfailed
- * @description 坐标转换失败后触发。
- * @property {Object} err - error 对象。
- */
- this.fire('coordconvertfailed', {
- err: err
- });
- })
- },
- getSQLFromFilter: function (filter) {
- if (!filter) {
- return ' * where (1==1||1>=0)'
- } else {
- filter = filter.replace(/=/g, '==').replace(/and|AND/g, '&&').replace(/or|OR/g, '||').replace(/>==/g, '>=').replace(/<==/g, '<=');
- return ' * where (' + filter + ')';
- }
- },
- getAttributesObjFromTable: function (cols, colTitles) {
- if (cols.length === 0 || colTitles.length === 0) {
- return;
- }
- var attrArr = [];
- for (var i = 0; i < cols.length; i++) {
- var obj = {};
- for (var j = 0; j < colTitles.length; j++) {
- obj[colTitles[j]] = cols[i][j]
- }
- attrArr.push(obj);
- }
- return attrArr;
- },
- parseFeatureFromEXCEL: function (rows, colTitles, isGraphic, position) {
- var attrArr = this.getAttributesObjFromTable(rows, colTitles);
- var features = [];
- for (var i = 0, len = attrArr.length; i < len; i++) {
- var lon = attrArr[i][position["lon"]];
- var lat = attrArr[i][position["lat"]];
- if (!lon || !lat) {
- continue;
- }
- lon = parseFloat(lon);
- lat = parseFloat(lat);
- var geometry = new Point(lon, lat);
- var pointGraphic;
- if (isGraphic) {
- pointGraphic = new Graphic(geometry, attrArr[i], null);
- } else {
- pointGraphic = new Vector(geometry, attrArr[i], null);
- }
- features.push(pointGraphic);
- }
- return features;
- },
- parseFeatureFromJson: function (feature) {
- var format = new GeoJSON();
- var features = format.read(feature);
- //兼容insights数据格式
- if (features == null) {
- var content = JSON.parse(feature.replace(/'/, '"'));
- if (content.isAnalyseResult || content.type === 'MapEditor' || content.type === 'DataInsights' || content.type === 'ISERVER') {
- content = content.data.recordsets[0].features;
- }
- format = new GeoJSON();
- features = format.read(content);
- }
- for (var i = 0, len = features.length; i < len; i++) {
- features[i].attributes = features[i].attributes.properties || features[i].attributes;
- }
- return features;
- },
- getFeatureFromFileAdded: function (layerInfo, success, failed, isGraphic) {
- var url = isGraphic ? layerInfo.url + '?currentPage=1&&pageSize=9999999' : layerInfo.url;
- FetchRequest.get(url).then(response => response.json()).then(data => {
- success && success(data);
- }).catch(err => failed && failed(err));
- },
- getCartoCSS2Obj: function (cartoCSS) {
- var isAddFile, needTransform = false;
- if (cartoCSS.indexOf('}') > -1) {
- cartoCSS = JSON.parse(cartoCSS);
- needTransform = cartoCSS.needTransform;
- isAddFile = cartoCSS.isAddFile;
- } else {
- if (cartoCSS === 'needTransform') {
- needTransform = true;
- //layerInfo.needTransform = true;
- isAddFile = false;
- } else {
- isAddFile = cartoCSS === 'true';
- }
- }
- return {
- isAddFile: isAddFile,
- needTransform: needTransform
- }
- },
- registerThemeEvent: function (themeLayer) {
- themeLayer.on('click', evt => {
- if (!themeLayer.map) {
- return;
- }
- if (this.selectedFeature) {
- /**
- * @event WebMap#featureunselected
- * @description 重置选中的要素为空。
- * @property {FeatureVector} feature - 在重置之前选中的要素。
- */
- this.fire('featureunselected', {
- feature: this.selectedFeature
- });
- this.selectedFeature = null;
- }
- let feature;
- if (evt.target && evt.target.refDataID) {
- feature = themeLayer.getFeatureById(evt.target.refDataID);
- }
- if (feature) {
- this.selectedFeature = feature;
- /**
- * @event WebMap#featureselected
- * @description 点击要素,要素存在之后触发。设置选中的要素。
- * @property {FeatureVector} feature - 点击的要素。
- */
- this.fire('featureselected', {
- feature: feature
- });
- }
- });
- themeLayer.on('mousemove', evt => {
- if (!themeLayer.map) {
- return;
- }
- if (evt.target && evt.target.refDataID) {
- let feature;
- if (evt.target && evt.target.refDataID) {
- feature = themeLayer.getFeatureById(evt.target.refDataID);
- }
- if (feature) {
- /**
- * @event WebMap#featuremousemove
- * @description 鼠标移动到要素上之后触发。
- * @property {FeatureVector} feature - 当前被移动到的要素。
- */
- this.fire('featuremousemove', {
- feature: feature
- });
- }
- }
- });
- },
- SERVER_TYPE_MAP: {
- "EPSG:4326": "WGS84",
- "EPSG:3857": "MERCATOR",
- "EPSG:900913": "MERCATOR",
- "EPSG:102113": "MERCATOR",
- "EPSG:910101": "GCJ02",
- "EPSG:910111": "GCJ02MERCATOR",
- "EPSG:910102": "BD",
- "EPSG:910112": "BDMERCATOR"
- }
- });
- var webMap = function (id, options) {
- return new WebMap(id, options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/mapping/ImageTileLayer.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ImageTileLayer
- * @deprecatedclassinstance L.supermap.imageTileLayer
- * @version 10.2.0
- * @classdesc iServer 影像服务图层源。根据请求参数,返回指定的影像数据栅格瓦片并渲染。
- * @category iServer Image
- * @extends {L.TileLayer}
- * @example
- * new ImageTileLayer(url,{collectionId:'xxx'}).addTo(map);
- * @param {string} url - 服务地址,例如: http://{ip}:{port}/iserver/{imageservice-imageserviceName}/restjsr/
- * @param {Object} options - 参数。
- * @param {string} options.collectionId - 影像集合(Collection)的ID,在一个影像服务中唯一标识影像集合。
- * @param {string} [options.sqlFilter] 对所显示影像的过滤条件。相当于sql查询中的where子句。支持st_geometry空间函数过滤。11.0版本暂不支持通过ECQL进行过滤。
- * @param {ImageRenderingRule} [options.renderingRule] 指定影像显示的风格,包含拉伸显示方式、颜色表、波段组合以及应用栅格函数进行快速处理等。不指定时,使用发布服务时所配置的风格。
- * @param {Array.<number>} [options.ids] 返回影像集合中指定ID的影像,该id为系统维护的一个自增id,为SuperMap SDX引擎的SmID字段内容。
- * @param {Array.<string>} [options.names] 返回影像集合中指定名称影像的瓦片资源。影像名称包含文件后缀,如S-60-45.tif。
- * @param {string} [options.format='png'] - 瓦片表述类型,瓦片格式目前支持png、jpg和webp三种格式。
- * @param {boolean} [options.transparent=true] - 瓦片是否透明。默认透明。
- * @param {boolean} [options.cacheEnabled=true] - 启用缓存。
- * @param {string} [options.attribution='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>'] - 版权信息。
- * @param {Array.<number>} [options.subdomains] - 子域名数组。
- * @param {string} [options.tileProxy] - 服务代理地址。
- * @usage
- */
- var ImageTileLayer = external_L_default().TileLayer.extend({
- options: {
- collectionId: null,
- sqlFilter: null,
- ids: null,
- names: null,
- renderingRule: null,
- format: 'png',
- zoomOffset: 1,
- transparent: true,
- cacheEnabled: true,
- tileProxy: null, //启用托管地址。
- attribution: core_Attributions.Common.attribution,
- subdomains: null
- },
- initialize: function (url, options) {
- this._url = url;
- external_L_default().TileLayer.prototype.initialize.apply(this, arguments);
- external_L_default().setOptions(this, options);
- external_L_default().stamp(this);
- },
- /**
- * @private
- * @function ImageTileLayer.prototype.onAdd
- * @description 添加地图。
- * @param {L.Map} map - Leaflet Map 对象。
- */
- onAdd: function (map) {
- external_L_default().TileLayer.prototype.onAdd.call(this, map);
- },
- /**
- * @function ImageTileLayer.prototype.getTileUrl
- * @description 根据行列号获取瓦片地址。
- * @param {Object} coords - 行列号。
- * @returns {string} 瓦片地址。
- */
- getTileUrl: function (coords) {
- var layerUrl = this._getLayerUrl();
- var tileUrl = layerUrl + '&z=' + this._getZoomForUrl() + '&x=' + coords.x + '&y=' + coords.y;
- //支持代理
- if (this.options.tileProxy) {
- tileUrl = this.options.tileProxy + encodeURIComponent(tileUrl);
- }
- if (!this.options.cacheEnabled) {
- tileUrl += '&_t=' + new Date().getTime();
- }
- if (this.options.subdomains) {
- tileUrl = external_L_default().Util.template(tileUrl, { s: this._getSubdomain(coords) });
- }
- return tileUrl;
- },
- _getLayerUrl: function () {
- return this._layerUrl || this._createLayerUrl();
- },
- _createLayerUrl: function () {
- let layerUrl = Util.urlPathAppend(
- this._url,
- `/collections/${this.options.collectionId}/tile.${this.options.format}`
- );
- this.requestParams = this.requestParams || this._getAllRequestParams();
- layerUrl = Util.urlAppend(layerUrl, external_L_namespaceObject.Util.getParamString(this.requestParams));
- layerUrl = SecurityManager.appendCredential(layerUrl);
- this._layerUrl = layerUrl;
- return layerUrl;
- },
- _getAllRequestParams: function () {
- var me = this,
- options = me.options || {},
- params = {};
- params['transparent'] = options.transparent === true;
- params['cacheEnabled'] = !(options.cacheEnabled === false);
- if (options.sqlFilter) {
- params['sqlFilter'] = options.sqlFilter;
- }
- if (options.renderingRule) {
- params['renderingRule'] = JSON.stringify(options.renderingRule);
- }
- if (options.ids) {
- params['ids'] = options.ids.join(',');
- }
- if (options.names) {
- params['names'] = options.names.join(',');
- }
- return params;
- }
- });
- var imageTileLayer = function (url, options) {
- return new ImageTileLayer(url, options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/mapping/initMap.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @function initMap
- * @description 根据 SuperMap iServer 服务参数,创建地图与图层。目前仅支持SuperMap iServer 地图服务,创建的图层为 TiledMapLayer。
- * @category BaseTypes Util
- * @version 11.0.1
- * @example
- * initMap(url, {mapOptions, layerOptions});
- * @param {string} url - 服务地址,例如: http://{ip}:{port}/iserver/services/map-world/rest/maps/World。
- * @param {Object} [options] - 参数。
- * @param {L.MapOptions} [options.mapOptions] - 地图参数,未设置的情况下,默认使用 SuperMap iServer 服务参数进行设置。
- * @param {Object} [options.layerOptions] - 图层参数,参考<a href="TiledMapLayer.html">TiledMapLayer</a>的参数。
- * @returns {Promise} Promise 对象, 返回{ map, layer }。
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const initMap = {namespace}.initMap;
- * initMap(url, {mapOptions, layerOptions});
- *
- * </script>
- * // ES6 Import
- * import { initMap } from "{npm}";
- *
- * initMap(url, {mapOptions, layerOptions});
- *
- * ```
- */
- function initMap(url, options) {
- options = options || {};
- const mapOptions = options.mapOptions || {};
- const layerOptions = options.layerOptions || {};
- return new Promise((resolve, reject) => {
- new MapService_MapService(url).getMapInfo(async (res) => {
- if (res.type === 'processCompleted') {
- const { prjCoordSys } = res.result;
- const epsgCodeStr = getEpsgCodeStr(prjCoordSys);
- if (!isPlaneProjection(prjCoordSys)) {
- await setProj(url, epsgCodeStr);
- }
- const mapInfoOptions = getMapOptions(res.result, mapOptions);
- const map = external_L_default().map('map', { ...mapInfoOptions, ...mapOptions });
- const layer = new TiledMapLayer(url, { ...{ noWrap: true }, ...layerOptions });
- layer.addTo(map);
- resolve({ map, layer });
- return;
- }
- reject();
- });
- });
- }
- /**
- * @function crsFromMapJSON
- * @description 通过iServer REST地图的配置信息,构建地图的CRS(非平面投影、EPSG:3857、EPSG:4326需要先注册投影)。
- * @category BaseTypes Util
- * @version 11.0.1
- * @param {Object} mapJSONObj - 地图参数。
- * @param {Object} mapJSONObj.prjCoordSys - 投影配置。
- * @param {Object} mapJSONObj.bounds - 范围。
- * @param {number} mapJSONObj.dpi - dpi。
- * @param {Array} mapJSONObj.visibleScales - 自定义比例尺。
- * @param {Array} mapJSONObj.coordUnit - 地图单位。
- * @param {Object} [mapOptions] - 地图参数。
- * @param {Object} [mapOptions.maxZoom=22] - 地图最大缩放级别。没有设置固定比例尺时生效。
- * @returns {CRS} 返回CRS。
- */
- function crsFromMapJSON(mapJSONObj, mapOptions) {
- const { maxZoom = 22 } = mapOptions || {};
- const { bounds, prjCoordSys, dpi, visibleScales, coordUnit } = mapJSONObj;
- const resolutions = scalesToResolutions(visibleScales, bounds, dpi, coordUnit, maxZoom);
- if (isPlaneProjection(prjCoordSys)) {
- return getNonEarthCRS(bounds);
- }
- const epsgCodeStr = getEpsgCodeStr(prjCoordSys);
- if (!hasRegisterProj(epsgCodeStr)) {
- return;
- }
- return getCRS(epsgCodeStr, { bounds, dpi, resolutions });
- }
- /**
- * @private
- * @function isPlaneProjection
- * @description 是否是平面坐标系。
- * @param {Object} prjCoordSys - prjCoordSys
- * @returns {boolean}
- */
- function isPlaneProjection(prjCoordSys) {
- return prjCoordSys.type === 'PCS_NON_EARTH';
- }
- /**
- * @private
- * @function setProj
- * @description 注册4214 4610 4490等投影。
- * @param {string} url
- * @param {string} epsgCodeStr - epsgCode。
- */
- async function setProj(url, epsgCodeStr) {
- if (!hasRegisterProj(epsgCodeStr, false)) {
- const def = await getWKT(url);
- def && lib.defs(epsgCodeStr, def);
- }
- }
- /**
- * @private
- * @function hasRegisterProj
- * @description 判断是否注册了投影。
- * @param {string} epsgCodeStr - epsgCode。
- * @param {boolean} isConsole - 是否在控制台打印。
- * @returns {boolean}
- */
- function hasRegisterProj(epsgCodeStr, isConsole = true) {
- try {
- lib(epsgCodeStr);
- } catch (e) {
- if (isConsole) {
- console.error(
- `The projection of ${epsgCodeStr} is missing, please register the projection of ${epsgCodeStr} first, refer to the documentation: https://iclient.supermap.io/web/introduction/leafletDevelop.html#multiProjection`
- );
- }
- return false;
- }
- return true;
- }
- /**
- * @private
- * @function getMapOptions
- * @description 获取地图参数。
- * @param {Object} mapJSONObj - 地图 JSON 对象。
- * @param {Object} [mapOptions] - 地图参数。
- * @param {Object} [mapOptions.maxZoom=22] - 地图最大缩放级别(没有设置固定比例尺时生效)。
- * @returns {Object} mapParams。
- */
- function getMapOptions(mapJSONObj, mapOptions) {
- const { bounds, center, scale, visibleScales, prjCoordSys, dpi, coordUnit } = mapJSONObj;
- const { maxZoom = 22 } = mapOptions;
- const resolutions = scalesToResolutions(visibleScales, bounds, dpi, coordUnit, maxZoom);
- const crs = crsFromMapJSON({ prjCoordSys, bounds, dpi, visibleScales, coordUnit }, { maxZoom });
- const visableResolutions = crs.resolutions || resolutions;
- const mapParams = {
- crs,
- center: getCenter(crs, { center, bounds }),
- zoom: getZoomByScale({ scale, dpi, coordUnit }, visableResolutions),
- maxZoom: getMaxZoom(resolutions)
- };
- return mapParams;
- }
- /**
- * @private
- * @function getZoomByScale
- * @description 获取Zoom。
- * @param {Object} options
- * @param {string} options.scale - scale。
- * @param {number} options.dpi - dpi
- * @param {string} options.coordUnit - coordUnit
- * @param {Object} visableResolutions - visableResolutions
- * @returns {number} zoom。
- */
- function getZoomByScale({ scale, dpi, coordUnit }, visableResolutions) {
- const resolution = Util_scaleToResolution(scale, dpi, coordUnit);
- return getZoomByResolution(resolution, visableResolutions);
- }
- /**
- * @private
- * @function getMaxZoom
- * @description 获取maxZoom。
- * @param {Array} visibleResolutions - visibleResolutions
- * @returns {number} maxZoom。
- */
- function getMaxZoom(visibleResolutions) {
- if (visibleResolutions.length > 0) {
- return visibleResolutions.length - 1;
- }
- return 22;
- }
- /**
- * @private
- * @function getCenter
- * @description 获取center。
- * @param {CRS} crs - crs。
- * @param {Object} mapJSONObj - 地图 JSON 对象。
- * @param {Object} mapJSONObj.center - 地图参数。
- * @param {Object} mapJSONObj.bounds - 地图最大缩放级别。
- * @returns {Object} center。
- */
- function getCenter(crs, { center, bounds }) {
- const code = typeof crs === 'string' ? crs : crs.code;
- if (typeof center.x !== 'number' && typeof center.y !== 'number') {
- center = { lat: (bounds.bottom + bounds.top) / 2, lng: (bounds.left + bounds.right) / 2 };
- }
- if (code === 'EPSG:4326') {
- return { lat: center.y, lng: center.x };
- }
- return crs.unproject(external_L_default().point(center.x, center.y));
- }
- /**
- * @private
- * @function getCenter
- * @description 获取center。
- * @param {Object} prjCoordSys
- * @returns {string} center。
- */
- function getEpsgCodeStr(prjCoordSys) {
- const { type, epsgCode } = prjCoordSys;
- if (type == 'PCS_NON_EARTH') {
- // 平面投影
- return '';
- }
- return 'EPSG:' + epsgCode;
- }
- async function getWKT(url) {
- return new Promise((resolve, reject) => {
- new MapService_MapService(url, { withoutFormatSuffix: true }).getWkt((res) => {
- if (res.type === 'processCompleted') {
- const proj4def = res.result.data;
- resolve(proj4def);
- return;
- }
- reject();
- });
- });
- }
- function getNonEarthCRS(bounds) {
- let options = {
- bounds: external_L_default().bounds([bounds.left, bounds.bottom], [bounds.right, bounds.top]),
- origin: external_L_default().point(bounds.left, bounds.top)
- };
- return new NonEarthCRS(options);
- }
- function getCRS(epsgCodeStr, { bounds, dpi, resolutions }) {
- const wrapLngLeft = lib(epsgCodeStr, 'EPSG:4326').forward([bounds.left, 0], true);
- const wrapLngRight = lib(epsgCodeStr, 'EPSG:4326').forward([bounds.right, 0], true);
- const wrapLng = [parseInt(wrapLngLeft[0]), parseInt(wrapLngRight[0])];
- let options = {
- wrapLng,
- bounds: external_L_default().bounds([bounds.left, bounds.bottom], [bounds.right, bounds.top]),
- origin: [bounds.left, bounds.top],
- dpi: dpi
- };
- if (resolutions && resolutions.length > 0) {
- options.resolutions = resolutions;
- }
- return new CRS(epsgCodeStr, options);
- }
- ;// CONCATENATED MODULE: ./src/leaflet/mapping/index.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- ;// CONCATENATED MODULE: ./src/leaflet/services/DataFlowService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class DataFlowService
- * @deprecatedclassinstance L.supermap.dataFlowService
- * @classdesc 数据流服务类。
- * @category iServer DataFlow
- * @extends {ServiceBase}
- * @param {string} url - 服务地址。
- * @param {Object} options - 参数。
- * @param {function} [options.style] - 设置数据加载样式。
- * @param {function} [options.onEachFeature] - 给该元素绑定事件和弹窗。
- * @param {GeoJSONObject} [options.geometry] - 指定几何范围,该范围内的要素才能被订阅。
- * @param {Object} [options.excludeField] - 排除字段。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @fires DataFlowService#broadcastSocketConnected
- * @fires DataFlowService#broadcastSocketError
- * @fires DataFlowService#broadcastFailed
- * @fires DataFlowService#broadcastSucceeded
- * @fires DataFlowService#subscribeSocketError
- * @fires DataFlowService#messageSucceeded
- * @fires DataFlowService#setFilterParamSucceeded
- * @usage
- */
- var DataFlowService_DataFlowService = ServiceBase.extend({
- options: {
- geometry: null,
- prjCoordSys: null,
- excludeField: null
- },
- initialize: function (url, options) {
- options = options || {};
- external_L_default().setOptions(this, options);
- if (options.projection) {
- this.options.prjCoordSys = options.projection;
- }
- ServiceBase.prototype.initialize.call(this, url, options);
- this.dataFlow = new DataFlowService(url, options);
- /**
- * @event DataFlowService#broadcastSocketConnected
- * @description broadcast Socket 连接成功。
- */
- /**
- * @event DataFlowService#broadcastSocketError
- * @description broadcast Socket 连接失败。
- */
- /**
- * @event DataFlowService#broadcastFailed
- * @description 广播失败。
- */
- /**
- * @event DataFlowService#broadcastSucceeded
- * @description 广播成功。
- */
- /**
- * @event DataFlowService#subscribeSocketConnected
- * @description 订阅数据连接成功。
- */
- /**
- * @event DataFlowService#subscribeSocketError
- * @description 订阅数据连接失败。
- */
- /**
- * @event DataFlowService#messageSucceeded
- * @description 获取信息成功。
- */
- /**
- * @event DataFlowService#setFilterParamSucceeded
- * @description 设置过滤参数成功。
- */
- this.dataFlow.events.on({
- "broadcastSocketConnected": this._defaultEvent,
- "broadcastSocketError": this._defaultEvent,
- "broadcastFailed": this._defaultEvent,
- "broadcastSucceeded": this._defaultEvent,
- "subscribeSocketConnected": this._defaultEvent,
- "subscribeSocketError": this._defaultEvent,
- "messageSucceeded": this._defaultEvent,
- "setFilterParamSucceeded": this._defaultEvent,
- scope: this
- })
- },
- /**
- * @function DataFlowService.prototype.initBroadcast
- * @description 初始化广播。
- */
- initBroadcast: function () {
- this.dataFlow.initBroadcast();
- return this;
- },
- /**
- * @function DataFlowService.prototype.broadcast
- * @description 加载广播数据。
- * @param {JSONObject} obj - JSON 格式的要素数据。
- */
- broadcast: function (obj) {
- this.dataFlow.broadcast(obj);
- },
- /**
- * @function DataFlowService.prototype.initSubscribe
- * @description 初始化订阅数据。
- */
- initSubscribe: function () {
- this.dataFlow.initSubscribe();
- return this;
- },
- /**
- * @function DataFlowService.prototype.setExcludeField
- * @description 设置排除字段。
- * @param {Object} excludeField - 排除字段。
- */
- setExcludeField: function (excludeField) {
- this.dataFlow.setExcludeField(excludeField);
- this.options.excludeField = excludeField;
- return this;
- },
- /**
- * @function DataFlowService.prototype.setGeometry
- * @description 设置添加的 GeoJSON 几何要素数据。
- * @param {GeoJSONObject} geometry - 指定几何范围,该范围内的要素才能被订阅。
- */
- setGeometry: function (geometry) {
- this.dataFlow.setGeometry(geometry);
- this.options.geometry = geometry;
- return this;
- },
- /**
- * @function DataFlowService.prototype.unSubscribe
- * @description 结束订阅数据。
- */
- unSubscribe: function () {
- this.dataFlow.unSubscribe();
- },
- /**
- * @function DataFlowService.prototype.unBroadcast
- * @description 结束加载广播。
- */
- unBroadcast: function () {
- this.dataFlow.unBroadcast();
- },
- _defaultEvent: function (e) {
- this.fire(e.eventType || e.type, e);
- }
- });
- var dataFlowService = function (url, options) {
- return new DataFlowService_DataFlowService(url, options);
- };
- ;// CONCATENATED MODULE: external "function(){try{return mapv}catch(e){return {}}}()"
- const external_function_try_return_mapv_catch_e_return_namespaceObject = function(){try{return mapv}catch(e){return {}}}();
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/mapv/MapVRenderer.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- var BaseLayer = external_function_try_return_mapv_catch_e_return_namespaceObject.baiduMapLayer ? external_function_try_return_mapv_catch_e_return_namespaceObject.baiduMapLayer.__proto__ : Function;
- /**
- * @class MapVRenderer
- * @classdesc 地图渲染类。
- * @category Visualization MapV
- * @private
- * @extends mapv.BaseLayer
- * @param {L.Map} map - Leaflet Map 对象。
- * @param {L.Layer} layer - Leaflet Layer 对象。
- * @param {DataSet} dataSet - 待渲染的数据集。
- * @param {Object} options - 参数。
- * @usage
- */
- class MapVRenderer extends BaseLayer {
- constructor(map, layer, dataSet, options) {
- super(map, dataSet, options);
- if (!BaseLayer) {
- return;
- }
- var self = this;
- options = options || {};
- self.init(options);
- self.argCheck(options);
- this.canvasLayer = layer;
- this.clickEvent = this.clickEvent.bind(this);
- this.mousemoveEvent = this.mousemoveEvent.bind(this);
- this._moveStartEvent = this.moveStartEvent.bind(this);
- this._moveEndEvent = this.moveEndEvent.bind(this);
- this._zoomStartEvent = this.zoomStartEvent.bind(this);
- this.bindEvent();
- }
- /**
- * @function MapVRenderer.prototype.clickEvent
- * @description 鼠标点击事件。
- * @param {Object} e - 触发对象。
- */
- clickEvent(e) {
- var offset = this.map.containerPointToLayerPoint([0, 0]);
- var devicePixelRatio = this.devicePixelRatio = this.canvasLayer.devicePixelRatio = window.devicePixelRatio || 1 ;
- var pixel = e.layerPoint;
- super.clickEvent(external_L_default().point((pixel.x - offset.x) / devicePixelRatio, (pixel.y - offset.y) / devicePixelRatio), e);
- }
- /**
- * @function MapVRenderer.prototype.mousemoveEvent
- * @description 鼠标移动事件。
- * @param {Object} e - 触发对象。
- */
- mousemoveEvent(e) {
- var pixel = e.layerPoint;
- super.mousemoveEvent(pixel, e);
- }
- /**
- * @function MapVRenderer.prototype.bindEvent
- * @description 监听鼠标移动和点击事件。
- * @param {Object} e - 触发对象。
- */
- bindEvent() {
- var map = this.map;
- if (this.options.methods) {
- if (this.options.methods.click) {
- map.on('click', this.clickEvent);
- }
- if (this.options.methods.mousemove) {
- map.on('mousemove', this.mousemoveEvent);
- }
- }
- this.map.on('movestart', this._moveStartEvent);
- this.map.on('moveend', this._moveEndEvent);
- this.map.on('zoomstart', this._zoomStartEvent);
- }
- /**
- * @function MapVRenderer.prototype.destroy
- * @description 释放资源。
- */
- destroy() {
- this.unbindEvent();
- this.clearData();
- this.animator && this.animator.stop();
- this.animator = null;
- this.canvasLayer = null;
- }
- /**
- * @function MapVRenderer.prototype.unbindEvent
- * @description 移除鼠标事件。
- * @param {Object} e - 触发对象。
- */
- unbindEvent() {
- var map = this.map;
- if (this.options.methods) {
- if (this.options.methods.click) {
- map.off('click', this.clickEvent);
- }
- if (this.options.methods.mousemove) {
- map.off('mousemove', this.mousemoveEvent);
- }
- }
- this.map.off('movestart', this._moveStartEvent);
- this.map.off('moveend', this._moveEndEvent);
- this.map.off('zoomstart', this._zoomStartEvent);
- }
- /**
- * @function MapVRenderer.prototype.getContext
- * @description 获取信息。
- */
- getContext() {
- return this.canvasLayer.getCanvas().getContext(this.context);
- }
- /**
- * @function MapVRenderer.prototype.addData
- * @description 添加数据。
- * @param {Object} data - 待添加的数据。
- * @param {Object} options - 参数。
- */
- addData(data, options) {
- var _data = data;
- if (data && data.get) {
- _data = data.get();
- }
- this.dataSet.add(_data);
- this.update({
- options: options
- });
- }
- /**
- * @function MapVRenderer.prototype.update
- * @description 更新图层。
- * @param {Object} opt - 待更新的数据。
- * @param {Object} opt.data - mapv 数据集。
- * @param {Object} opt.options - mapv 绘制参数。
- */
- update(opt) {
- var update = opt || {};
- var _data = update.data;
- if (_data && _data.get) {
- _data = _data.get();
- }
- if (_data != undefined) {
- this.dataSet.set(_data);
- }
- super.update({
- options: update.options
- });
- }
- /**
- * @function MapVRenderer.prototype.getData
- * @description 获取数据
- */
- getData() {
- return this.dataSet;
- }
- /**
- * @function MapVRenderer.prototype.removeData
- * @description 删除符合过滤条件的数据。
- * @param {function} filter - 过滤条件。参数为数据项,返回值为 true,表示删除该元素;否则表示不删除。
- */
- removeData(filter) {
- if (!this.dataSet) {
- return;
- }
- var newData = this.dataSet.get({
- filter: function (data) {
- return (filter != null && typeof filter === "function") ? !filter(data) : true;
- }
- });
- this.dataSet.set(newData);
- this.update({
- options: null
- });
- }
- /**
- * @function MapVRenderer.prototype.clearData
- * @description 清除数据。
- */
- clearData() {
- this.dataSet && this.dataSet.clear();
- this.update({
- options: null
- });
- }
- _canvasUpdate(time) {
- if (!this.canvasLayer) {
- return;
- }
- var self = this;
- var animationOptions = self.options.animation;
- var context = this.getContext();
- var map = this.map;
- if (self.isEnabledTime()) {
- if (time === undefined) {
- this.clear(context);
- return;
- }
- if (this.context === '2d') {
- context.save();
- context.globalCompositeOperation = 'destination-out';
- context.fillStyle = 'rgba(0, 0, 0, .1)';
- context.fillRect(0, 0, context.canvas.width, context.canvas.height);
- context.restore();
- }
- } else {
- this.clear(context);
- }
- if (this.context === '2d') {
- for (var key in self.options) {
- context[key] = self.options[key];
- }
- } else {
- context.clear(context.COLOR_BUFFER_BIT);
- }
- if (self.options.minZoom && map.getZoom() < self.options.minZoom || self.options.maxZoom && map.getZoom() > self.options.maxZoom) {
- return;
- }
- var bounds = map.getBounds();
- //获取当前像素下的地理范围
- var dw = bounds.getEast() - bounds.getWest();
- var dh = bounds.getNorth() - bounds.getSouth();
- var mapCanvas = map.getSize();
- var resolutionX = dw / mapCanvas.x,
- resolutionY = dh / mapCanvas.y;
- // 一个像素是多少米
- var zoomUnit = Util_getMeterPerMapUnit('DEGREE') * resolutionX;
- //var centerPx = map.latLngToLayerPoint(map.getCenter());
- //获取屏幕左上角的地理坐标坐标
- //左上角屏幕坐标为0,0
- var topLeft = this.canvasLayer.getTopLeft();
- var topLeftPX = map.latLngToAccurateContainerPoint(topLeft);
- // var lopLeft = map.containerPointToLatLng([0, 0]);
- var dataGetOptions = {
- transferCoordinate: function (coordinate) {
- var offset;
- if (self.context === '2d') {
- offset = map.latLngToAccurateContainerPoint(external_L_default().latLng(coordinate[1], coordinate[0]));
- } else {
- offset = {
- 'x': (coordinate[0] - topLeft.lng) / resolutionX,
- 'y': (topLeft.lat - coordinate[1]) / resolutionY
- };
- }
- var pixel = {
- x: offset.x - topLeftPX.x,
- y: offset.y - topLeftPX.y
- };
- return [pixel.x, pixel.y];
- }
- };
- if (time !== undefined) {
- dataGetOptions.filter = function (item) {
- var trails = animationOptions.trails || 10;
- return (time && item.time > (time - trails) && item.time < time);
- }
- }
- var data = self.dataSet.get(dataGetOptions);
- this.processData(data);
- var worldPoint = map.latLngToContainerPoint(external_L_default().latLng(0, 0));
- var pixel = {
- x: worldPoint.x - topLeftPX.x,
- y: worldPoint.y - topLeftPX.y
- };
- // 兼容unit为'm'的情况
- if (self.options.unit === 'm') {
- if (self.options.size) {
- self.options._size = self.options.size / zoomUnit;
- }
- if (self.options.width) {
- self.options._width = self.options.width / zoomUnit;
- }
- if (self.options.height) {
- self.options._height = self.options.height / zoomUnit;
- }
- } else {
- self.options._size = self.options.size;
- self.options._height = self.options.height;
- self.options._width = self.options.width;
- }
- this.drawContext(context, data, self.options, pixel);
- self.options.updateCallback && self.options.updateCallback(time);
- }
- init(options) {
- var self = this;
- self.options = options;
- this.initDataRange(options);
- this.context = self.options.context || '2d';
- if (self.options.zIndex) {
- this.canvasLayer && this.canvasLayer.setZIndex(self.options.zIndex);
- }
- this.initAnimator();
- }
- addAnimatorEvent() {}
- /**
- * @function MapVRenderer.prototype.moveStartEvent
- * @description 开始移动事件。
- */
- moveStartEvent() {
- var animationOptions = this.options.animation;
- if (this.isEnabledTime() && this.animator) {
- this.steps.step = animationOptions.stepsRange.start;
- this._hide();
- }
- }
- /**
- * @function MapVRenderer.prototype.moveEndEvent
- * @description 移除移动事件。
- */
- moveEndEvent() {
- this.canvasLayer.draw();
- this._show();
- }
- /**
- * @function MapVRenderer.prototype.zoomStartEvent
- * @description 隐藏渲染样式。
- */
- zoomStartEvent() {
- this._hide();
- }
- /**
- * @function MapVRenderer.prototype.clear
- * @description 清除信息。
- * @param {string} context - 指定要清除的信息。
- */
- clear(context) {
- context && context.clearRect && context.clearRect(0, 0, context.canvas.width, context.canvas.height);
- }
- _hide() {
- this.canvasLayer.canvas.style.display = 'none';
- }
- _show() {
- this.canvasLayer.canvas.style.display = 'block';
- }
- /**
- * @function MapVRenderer.prototype.draw
- * @description 绘制渲染。
- */
- draw() {
- this.canvasLayer.draw();
- }
- }
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/MapVLayer.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class MapVLayer
- * @deprecatedclassinstance L.supermap.mapVLayer
- * @classdesc MapV 图层。
- * @category Visualization MapV
- * @extends {L.Layer}
- * @param {Mapv.DataSet} dataSet - MapV 图层数据集。
- * @param {Object} mapVOptions - MapV 图层参数。
- * @param {Object} options - 参数。
- * @param {string} [options.attributionPrefix] - 版权信息前缀。
- * @param {string} [options.attribution='© 2018 百度 MapV'] - 版权信息。
- * @fires MapVLayer#loaded
- * @usage
- */
- var MapVLayer = external_L_default().Layer.extend({
- options: {
- attributionPrefix: null,
- attribution: core_Attributions.MapV.attribution
- },
- initialize: function (dataSet, mapVOptions, options) {
- options = options || {};
- this.dataSet = dataSet || {};
- this.mapVOptions = mapVOptions || {};
- this.render = this.render.bind(this);
- external_L_default().Util.setOptions(this, options);
- if (this.options.attributionPrefix) {
- this.options.attribution = this.options.attributionPrefix + this.options.attribution;
- }
- this.canvas = this._createCanvas();
- external_L_default().stamp(this);
- },
- /**
- * @private
- * @function MapVLayer.prototype.onAdd
- * @description 添加地图图层。
- * @param {L.Map} map - Leaflet Map 对象。
- */
- onAdd: function (map) {
- this._map = map;
- var overlayPane = this.getPane();
- var container = this.container = external_L_default().DomUtil.create("div", "leaflet-layer leaflet-zoom-animated", overlayPane);
- container.appendChild(this.canvas);
- var size = map.getSize();
- container.style.width = size.x + "px";
- container.style.height = size.y + "px";
- this.renderer = new MapVRenderer(map, this, this.dataSet, this.mapVOptions);
- this.draw();
- /**
- * @event MapVLayer#loaded
- * @description 图层添加完成之后触发。
- */
- this.fire("loaded");
- },
- // _hide: function () {
- // this.canvas.style.display = 'none';
- // },
- // _show: function () {
- // this.canvas.style.display = 'block';
- // },
- /**
- * @private
- * @function MapVLayer.prototype.onRemove
- * @description 删除地图图层。
- */
- onRemove: function () {
- external_L_default().DomUtil.remove(this.container);
- this.renderer.destroy();
- },
- /**
- * @function MapVLayer.prototype.addData
- * @description 添加数据。
- * @param {Object} data - 需要添加的数据。
- * @param {Object} options - 参数。
- */
- addData: function (data, options) {
- this.renderer.addData(data, options);
- },
- /**
- * @function MapVLayer.prototype.update
- * @description 更新图层。
- * @param {Object} opt - 待更新的数据。
- * @param {Object} data - mapv 数据集。
- * @param {Object} options - 参数。
- */
- update: function (opt) {
- this.renderer.update(opt);
- },
- /**
- * @function MapVLayer.prototype.getData
- * @description 获取数据。
- * @returns {Mapv.DataSet} mapv 数据集。
- */
- getData: function () {
- if (this.renderer) {
- this.dataSet = this.renderer.getData();
- }
- return this.dataSet;
- },
- /**
- * @function MapVLayer.prototype.removeData
- * @description 删除数据。
- * @param {function} filter - 过滤条件。指定数据项后,返回值为 true,表示删除该元素;否则表示不删除。
- * @example
- * filter=function(data){
- * if(data.id=="1"){
- * return true
- * }
- * return false;
- * }
- */
- removeData: function (filter) {
- this.renderer && this.renderer.removeData(filter);
- },
- /**
- * @function MapVLayer.prototype.clearData
- * @description 清除数据。
- */
- clearData: function () {
- this.renderer.clearData();
- },
- /**
- * @function MapVLayer.prototype.draw
- * @description 绘制图层。
- */
- draw: function () {
- return this._reset();
- },
- /**
- * @function MapVLayer.prototype.setZIndex
- * @description 设置 canvas 层级。
- * @param {number} zIndex - canvas 层级。
- */
- setZIndex: function (zIndex) {
- this.canvas.style.zIndex = zIndex;
- },
- /**
- * @function MapVLayer.prototype.render
- * @description 渲染。
- */
- render: function () {
- this.renderer._canvasUpdate();
- },
- /**
- * @function MapVLayer.prototype.getCanvas
- * @description 获取 canvas。
- * @returns {HTMLElement} 返回 mapV 图层包含的 canvas 对象。
- */
- getCanvas: function () {
- return this.canvas;
- },
- /**
- * @function MapVLayer.prototype.getContainer
- * @description 获取容器。
- * @returns {HTMLElement} 返回包含 mapV 图层的 dom 对象。
- */
- getContainer: function () {
- return this.container;
- },
- /**
- * @function MapVLayer.prototype.getTopLeft
- * @description 获取左上角坐标。
- * @returns {L.Bounds} 返回左上角坐标。
- */
- getTopLeft: function () {
- var map = this._map;
- var topLeft;
- if (map) {
- var bounds = map.getBounds();
- topLeft = bounds.getNorthWest();
- }
- return topLeft;
- },
- _createCanvas: function () {
- var canvas = document.createElement('canvas');
- canvas.style.position = 'absolute';
- canvas.style.top = 0 + "px";
- canvas.style.left = 0 + "px";
- canvas.style.pointerEvents = "none";
- canvas.style.zIndex = this.options.zIndex || 600;
- var global$2 = typeof window === 'undefined' ? {} : window;
- var devicePixelRatio = this.devicePixelRatio = global$2.devicePixelRatio || 1;
- if (!this.mapVOptions.context || this.mapVOptions.context === '2d') {
- canvas.getContext('2d').scale(devicePixelRatio, devicePixelRatio);
- }
- return canvas;
- },
- _resize: function () {
- var canvas = this.canvas;
- if (!canvas) {
- return;
- }
- var map = this._map;
- var size = map.getSize();
- if (this.mapVOptions.draw === 'heatmap') {
- canvas.width = parseInt(size.x) * this.devicePixelRatio;
- canvas.height = parseInt(size.y) * this.devicePixelRatio;
- } else {
- canvas.width = parseInt(size.x);
- canvas.height = parseInt(size.y);
- }
- canvas.style.width = size.x + 'px';
- canvas.style.height = size.y + 'px';
- var bounds = map.getBounds();
- var topLeft = map.latLngToLayerPoint(bounds.getNorthWest());
- external_L_default().DomUtil.setPosition(canvas, topLeft);
- },
- _reset: function () {
- this._resize();
- this._render()
- },
- redraw: function () {
- this._resize();
- this._render()
- },
- _render: function () {
- this.render();
- }
- });
- var mapVLayer = function (dataSet, mapVOptions, options) {
- return new MapVLayer(dataSet, mapVOptions, options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/dataflow/MapvRenderer.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- *
- * @class MapvRenderer
- * @classdesc 数据流图层 MapV 渲染器。
- * @category iServer DataFlow
- * @extends {MapVLayer}
- * @param {string} url - 服务地址
- * @param {Object} options - 参数。
- * @param {Object} [options.geometry] - GeoJSON 几何对象。
- * @param {Object} [options.prjCoordSys] - 投影坐标对象。
- * @param {string} [options.excludeField] - 排除字段。
- * @param {string} [options.idField='id'] - 要素属性中表示唯一标识的字段。
- * @usage
- */
- var MapvRenderer = MapVLayer.extend({
- initialize: function (url, options) {
- options = options || {};
- external_L_default().Util.setOptions(this, options);
- this.data = [];
- this.mapVOptions = {
- draw: 'simple'
- };
- MapVLayer.prototype.initialize.call(this, new window.mapv.DataSet([]), this.mapVOptions, options)
- this.idCache = {};
- this.url = url;
- this._last = new Date();
- this._imageCache = {};
- },
- onMessageSuccessed: function (msg) {
- const geoID = msg.featureResult.properties['id'];
- const geometry = msg.featureResult.geometry;
- //设置每个点的经纬度和图片的样式
- const item = {
- geometry: msg.featureResult.geometry
- }
- if (geometry.type === 'Point' && this.options.pointToLayer) {
- //const pointStyle = this.options.pointToLayer ? this.options.pointToLayer(msg.featureResult, L.latLng(geometry.coordinates[1],geometry.coordinates[0])) : new L.marker(L.latLng(geometry.coordinates[1],geometry.coordinates[0]));
- const pointStyle = this.options.pointToLayer(msg.featureResult, external_L_default().latLng(geometry.coordinates[1], geometry.coordinates[0]));
- if (pointStyle instanceof (external_L_default()).Marker) {
- this.mapVOptions.draw = 'icon';
- let icon = pointStyle.options.icon;
- const imgUrl = icon._getIconUrl('icon');
- const imgWidth = icon.options.iconSize ? icon.options.iconSize[0] : null;
- const imgHeight = icon.options.iconSize ? icon.options.iconSize[1] : null;
- const iconKey = `${imgUrl}_${imgWidth}_${imgHeight}`;
- let img = this._imageCache[iconKey];
- if (!img) {
- img = icon.createIcon();
- this._imageCache[iconKey] = img;
- img.onload = () => {
- this.update({
- data: this.data,
- options: this.mapVOptions
- });
- }
- }
- item.icon = img;
- if (icon.options.iconSize || img.style.height) {
- this.mapVOptions.offset = {
- x: 0,
- y: -(icon.options.iconSize[1] || img.style.height) / 2
- };
- }
- if (this.options.deg) {
- item.deg = this.options.deg
- if (typeof item.deg === 'function') {
- if(this.idCache[geoID]&&this.data[this.idCache[geoID]]){
- item.deg = item.deg(msg.featureResult, external_L_default().latLng(geometry.coordinates[1], geometry.coordinates[0]),this.data[this.idCache[geoID]]);
- }
-
- }
- }
- }
- if (pointStyle instanceof (external_L_default()).CircleMarker) {
- this.mapVOptions.draw = 'simple';
- const sty = this._toMapvStyle(pointStyle);
- for (const key in sty) {
- if (sty.hasOwnProperty(key)) {
- item[key] = sty[key];
- }
- }
- }
- } else if (this.options.style) {
- const sty = this._toMapvStyle(this.options.style(msg.featureResult));
- for (const key in sty) {
- if (sty.hasOwnProperty(key)) {
- item[key] = sty[key];
- }
- }
- }
- if (this.idCache[geoID] == undefined) {
- this.data.push(item);
- this.idCache[geoID] = this.data.length - 1;
- } else {
- this.data[this.idCache[geoID]] = item;
- }
- //绘制图层
- if (new Date() - this._last > 200) {
- this._last = new Date();
- this.update({
- data: this.data,
- options: this.mapVOptions
- });
- }
- },
- _toMapvStyle: function (options) {
- const mapvOps = {
- draw: 'simple'
- };
- mapvOps.strokeStyle = options.color;
- mapvOps.lineWidth = options.width;
- mapvOps.globalAlpha = options.fillOpacity || options.opacity;
- mapvOps.lineCap = options.lineCap;
- mapvOps.lineJoin = options.lineJoin;
- mapvOps.fillStyle = options.fillColor;
- mapvOps.size = options.radius;
- return mapvOps;
- }
- });
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/dataflow/NormalRenderer.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class NormalRenderer
- * @classdesc 数据流图层普通渲染器。
- * @category iServer DataFlow
- * @extends {L.GeoJSON}
- * @param {string} url - 服务地址
- * @param {Object} options - 参数。
- * @param {GeoJSONObject} [options.geometry] - GeoJSON 几何对象。
- * @param {Object} [options.prjCoordSys] - 投影坐标对象。
- * @param {string} [options.excludeField] - 排除字段。
- * @param {string} [options.idField='id'] - 要素属性中表示唯一标识的字段。
- * @usage
- */
- var NormalRenderer = external_L_default().GeoJSON.extend({
- initialize: function (url, options) {
- options = options || {};
- if (options.style && !options.pointToLayer) {
- options.pointToLayer = function (geojson, latlng) {
- return external_L_default().circleMarker(latlng, options.style());
- }
- }
- external_L_default().Util.setOptions(this, options);
- this._layers = {};
- external_L_default().stamp(this);
- this.url = url;
- this.idCache = {};
- },
- onMessageSuccessed: function (msg) {
- const geojson = msg.featureResult;
- const geoID = msg.featureResult.properties[this.options.idField];
- let layer = null;
- if (geoID !== undefined && this.idCache[geoID]) {
- layer = this.getLayer(this.idCache[geoID]);
- this._updateLayerData(layer, geojson);
- } else {
- layer = external_L_default().GeoJSON.geometryToLayer(geojson, this.options);
- layer.feature = external_L_default().GeoJSON.asFeature(geojson);
- this.addLayer(layer);
- if (geoID !== undefined) {
- this.idCache[geoID] = this.getLayerId(layer);
- }
- }
- if (this.options.onEachFeature) {
- this.options.onEachFeature(geojson, layer);
- }
- },
- _updateLayerData: function (layer, geojson) {
- if (geojson.properties) {
- layer.feature.properties = geojson.properties;
- }
- var latlngs = [];
- switch (geojson.geometry.type) {
- case 'Point':
- latlngs = external_L_default().GeoJSON.coordsToLatLng(geojson.geometry.coordinates);
- layer.setLatLng(latlngs);
- break;
- case 'LineString':
- latlngs = external_L_default().GeoJSON.coordsToLatLngs(geojson.geometry.coordinates, 0);
- layer.setLatLngs(latlngs);
- break;
- case 'MultiLineString':
- case 'Polygon':
- latlngs = external_L_default().GeoJSON.coordsToLatLngs(geojson.geometry.coordinates, 1);
- layer.setLatLngs(latlngs);
- break;
- case 'MultiPolygon':
- latlngs = external_L_default().GeoJSON.coordsToLatLngs(geojson.geometry.coordinates, 2);
- layer.setLatLngs(latlngs);
- break;
- }
- }
- });
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/DataFlowLayer.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class DataFlowLayer
- * @deprecatedclassinstance L.supermap.dataFlowLayer
- * @classdesc 数据流图层源。订阅SuperMap iServer 数据流服务并上图。订阅得到的数据会根据 `options.idField` 自动更新。
- * @category iServer DataFlow
- * @extends {L.LayerGroup}
- * @param {string} url - 服务地址。
- * @param {Object} options - 参数。
- * @param {Object} [options.render='normal'] - 绘制方式。可选值为'normal','mapv'。
- 'normal' 表示以 {( {@link L.LatLng}|{@link L.Polyline}|{@link L.Polygon}|{@link L.Marker} )} 方式绘制数据流。'mapv' 表示以 {@link MapVLayer} 方式绘制实时数据。
- * @param {GeoJSONObject} [options.geometry] - 指定几何范围,该范围内的要素才能被订阅。
- * @param {Object} [options.prjCoordSys] - 投影坐标对象。
- * @param {string} [options.excludeField] - 排除字段。
- * @param {string} [options.idField='id'] - 要素属性中表示唯一标识的字段。
- * @param {function} [options.pointToLayer] - 定义点要素如何绘制在地图上。
- `function(geoJsonPoint, latlng) {
- return L.marker(latlng);
- }`
- * @param {function} [options.style] - 定义点、线、面要素样式。参数为{@link L.Path-option}。</br>
- `function (feature) {
- return {
- fillColor: "red",
- fillOpacity: 1,
- radius: 6,
- weight: 0
- };
- }`
- * @param {function|number} [options.deg] - 定义图标的旋转角度。`options.render` 为 `mapv` 时有效。</br>
- `function (feature,latlng) {
- return feature.properties['rotate'];
- }`
- * @fires DataFlowLayer#subscribesucceeded
- * @fires DataFlowLayer#subscribefailed
- * @fires DataFlowLayer#setfilterparamsucceeded
- * @fires DataFlowLayer#dataupdated
- * @usage
- */
- var DataFlowLayer = external_L_default().LayerGroup.extend({
- options: {
- geometry: null,
- prjCoordSys: null,
- excludeField: null,
- idField: "id",
- render: 'normal'
- },
- initialize: function (url, options) {
- options = options || {};
- external_L_default().Util.setOptions(this, options);
- this.url = url;
- this._layers = {};
- this.dataService = new DataFlowService_DataFlowService(this.url, {
- geometry: this.options.geometry,
- prjCoordSys: this.options.prjCoordSys,
- excludeField: this.options.excludeField
- })
- },
- /**
- * @private
- * @function DataFlowLayer.prototype.onAdd
- * @description 添加地图。
- * @param {L.Map} map - Leaflet Map 对象。
- */
- onAdd: function (map) { // eslint-disable-line no-unused-vars
- this.dataService.initSubscribe();
- /**
- * @event DataFlowLayer#subscribesucceeded
- * @description 初始化成功后触发。
- * @property {Object} e - 事件对象。
- */
- this.dataService.on('subscribeSocketConnected', (e) => this.fire("subscribesucceeded", e));
- /**
- * @event DataFlowLayer#subscribefailed
- * @description 初始化失败后触发。
- * @property {Object} e - 事件对象。
- */
- this.dataService.on('subscribeSocketError', (e) => this.fire("subscribefailed", e))
- this.dataService.on('messageSucceeded', (msg) => this._onMessageSuccessed(msg));
- /**
- * @event DataFlowLayer#setfilterparamsucceeded
- * @description 过滤参数设置成功后触发。
- * @property {Object} e - 事件对象。
- */
- this.dataService.on('setFilterParamSucceeded', (msg) => this.fire("setfilterparamsucceeded", msg));
- if (this.options.render === 'mapv') {
- this.addLayer(new MapvRenderer(this.url, this.options));
- } else {
- this.addLayer(new NormalRenderer(this.url, this.options));
- }
- external_L_default().LayerGroup.prototype.onAdd.call(this, map);
- },
- /**
- * @private
- * @function DataFlowLayer.prototype.onRemove
- * @description 删除指定地图。
- * @param {L.Map} map - Leaflet Map 对象。
- */
- onRemove: function (map) { // eslint-disable-line no-unused-vars
- external_L_default().LayerGroup.prototype.onRemove.call(this, map);
- this.dataService && this.dataService.unSubscribe();
- },
- /**
- * @function DataFlowLayer.prototype.setExcludeField
- * @description 设置唯一字段。
- * @param {string} excludeField - 唯一字段。
- */
- setExcludeField: function (excludeField) {
- this.dataService.setExcludeField(excludeField);
- this.options.excludeField = excludeField;
- return this;
- },
- /**
- * @function DataFlowLayer.prototype.setGeometry
- * @description 设置集合要素。
- * @param {GeoJSONObject} geometry - 待设置的 GeoJSON 几何要素对象。
- */
- setGeometry: function (geometry) {
- this.dataService.setGeometry(geometry);
- this.options.geometry = geometry;
- return this;
- },
- _onMessageSuccessed: function (msg) {
- this.getLayers().map((layer) => {
- if (layer.onMessageSuccessed) {
- layer.onMessageSuccessed(msg);
- /**
- * @description 图层数据更新成功后触发。
- * @event DataFlowLayer#dataupdated
- * @property {Object} layer - 更新数据成功的图层。
- * @property {Object} data - 更新的要素。
- */
- this.fire("dataupdated", {
- layer: layer,
- data: msg.featureResult
- });
- }
- return layer;
- })
- }
- });
- var dataFlowLayer = function (url, options) {
- return new DataFlowLayer(url, options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/EChartsLayer.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class EchartsLayer
- * @deprecatedclassinstance L.supermap.echartsLayer
- * @classdesc 百度 ECharts 图层类。
- * @category Visualization ECharts
- * @extends {L.Layer}
- * @param {Object} echartsOptions - 图表参数。
- * @param {Object} options - 参数。
- * @param {boolean} [options.loadWhileAnimating=false] - 是否在移动时实时绘制。
- * @param {string} [options.attribution='© 2018 百度 ECharts'] - 版权信息。
- * @usage
- */
- const EchartsLayer = external_L_default().Layer.extend({
- includes: [],
- _echartsContainer: null,
- _map: null,
- _ec: null,
- _echartsOptions: null,
- options: {
- attribution: core_Attributions.ECharts.attribution,
- loadWhileAnimating: false
- },
- initialize: function (echartsOptions, options) {
- external_L_default().Util.setOptions(this, options);
- this.setOption(echartsOptions);
- },
- /**
- * @function EchartsLayer.prototype.setOption
- * @description 设置图表地图参数。
- * @param {Object} echartsOptions - 图表参数。
- * @param {string} lazyUpdate - 后台自动更新。
- * @param {boolean} [notMerge] - 是否合并参数。
- */
- setOption: function (echartsOptions, notMerge, lazyUpdate) {
- const baseOption = echartsOptions.baseOption || echartsOptions;
- baseOption.LeafletMap = baseOption.LeafletMap || {
- roam: true
- };
- baseOption.animation = baseOption.animation === true;
- this._echartsOptions = echartsOptions;
- this._ec && this._ec.setOption(echartsOptions, notMerge, lazyUpdate);
- },
- getEcharts: function () {
- return this._ec;
- },
- _disableEchartsContainer: function () {
- this._echartsContainer.style.visibility = "hidden";
- },
- _enableEchartsContainer: function () {
- this._echartsContainer.style.visibility = "visible";
- },
- /**
- * @private
- * @function EchartsLayer.prototype.onAdd
- * @description 添加地图。
- * @param {L.Map} map - Leaflet Map 对象。
- */
- onAdd: function (map) {
- this._map = map;
- this._initEchartsContainer();
- this._ec = external_function_try_return_echarts_catch_e_return_default().init(this._echartsContainer);
- this._ec.leafletMap= map;
- const me = this;
- map.on("zoomstart", function () {
- me._disableEchartsContainer();
- });
- !me.options.loadWhileAnimating && map.on("movestart", function () {
- me._disableEchartsContainer();
- });
- external_function_try_return_echarts_catch_e_return_default().registerAction({
- type: 'LeafletMapLayout',
- event: 'LeafletMapLayout',
- update: 'updateLayout'
- }, function (payload ) { // eslint-disable-line no-unused-vars
- });
- external_function_try_return_echarts_catch_e_return_default().registerCoordinateSystem(
- 'leaflet', LeafletMapCoordSys
- );
- external_function_try_return_echarts_catch_e_return_default().extendComponentModel({
- type: 'LeafletMap',
- getBMap: function () {
- return this.__LeafletMap;
- },
- defaultOption: {
- roam: false
- }
- });
- external_function_try_return_echarts_catch_e_return_default().extendComponentView({
- type: 'LeafletMap',
- render: function (LeafletMapModel, ecModel, api) {
- let rendering = true;
- let leafletMap = ecModel.scheduler.ecInstance.leafletMap;
- const viewportRoot = api.getZr().painter.getViewportRoot();
- const animated = leafletMap.options.zoomAnimation && (external_L_default()).Browser.any3d;
- viewportRoot.className = ' leaflet-layer leaflet-zoom-' + (animated ? 'animated' : 'hide') + ' echarts-layer';
- const originProp = external_L_default().DomUtil.testProp(['transformOrigin', 'WebkitTransformOrigin', 'msTransformOrigin']);
- viewportRoot.style[originProp] = '50% 50%';
- const coordSys = LeafletMapModel.coordinateSystem;
- const ecLayers = api.getZr().painter.getLayers();
- _setCanvasPosition(me._map, viewportRoot);
- const moveHandler = function () {
- if (rendering) {
- return;
- }
- const mapOffset = _setCanvasPosition(me._map, viewportRoot);
- if (!me.options.loadWhileAnimating) {
- for (let item in ecLayers) {
- if (!ecLayers.hasOwnProperty(item)) {
- continue;
- }
- ecLayers[item] && clearContext(ecLayers[item].ctx);
- }
- me._enableEchartsContainer();
- }
- coordSys.setMapOffset(mapOffset);
- LeafletMapModel.__mapOffset = mapOffset;
- api.dispatchAction({
- type: 'LeafletMapLayout'
- });
- };
- function clearContext(context) {
- context && context.clearRect && context.clearRect(0, 0, context.canvas.width, context.canvas.height);
- }
- function zoomEndHandler() {
- if (rendering) {
- return;
- }
- api.dispatchAction({
- type: 'LeafletMapLayout'
- });
- me._enableEchartsContainer();
- }
- if (me._oldMoveHandler) {
- leafletMap.off(me.options.loadWhileAnimating ? 'move' : 'moveend', me._oldMoveHandler);
- }
- if (me._oldZoomEndHandler) {
- leafletMap.off('zoomend', me._oldZoomEndHandler);
- }
- leafletMap.on(me.options.loadWhileAnimating ? 'move' : 'moveend', moveHandler);
- leafletMap.on('zoomend', zoomEndHandler);
- me._oldMoveHandler = moveHandler;
- me._oldZoomEndHandler = zoomEndHandler;
- rendering = false;
- }
- });
- this._ec.setOption(this._echartsOptions);
- },
- onRemove: function () {
- // 销毁echarts实例
- this._ec.clear();
- this._ec.dispose();
- delete this._ec;
- external_L_default().DomUtil.remove(this._echartsContainer);
-
- if (this._oldZoomEndHandler) {
- this._map.off("zoomend", this._oldZoomEndHandler);
- this._oldZoomEndHandler = null;
- }
- if (this._oldMoveHandler) {
- this._map.off(this.options.loadWhileAnimating ? 'move' : 'moveend', this._oldMoveHandler);
- this._oldMoveHandler = null;
- }
- if (this._resizeHandler) {
- this._map.off('resize', this._resizeHandler);
- this._resizeHandler = null;
- }
- delete this._map;
- },
- _initEchartsContainer: function () {
- const size = this._map.getSize();
- const _div = document.createElement('div');
- _div.style.position = 'absolute';
- _div.style.height = size.y + 'px';
- _div.style.width = size.x + 'px';
- _div.style.zIndex = 10;
- this._echartsContainer = _div;
- this.getPane().appendChild(this._echartsContainer);
- const me = this;
- function _resizeHandler(e) {
- let size = e.newSize;
- me._echartsContainer.style.width = size.x + 'px';
- me._echartsContainer.style.height = size.y + 'px';
- me._ec.resize()
- }
- this._map.on('resize', _resizeHandler);
- this._resizeHandler = _resizeHandler
- }
- });
- /**
- * @class LeafletMapCoordSys
- * @private
- * @classdesc 地图坐标系统类。
- * @param {L.Map} leafletMap - Leaflet Map 对象。
- */
- function LeafletMapCoordSys(leafletMap) {
- this._LeafletMap = leafletMap;
- this.dimensions = ['lng', 'lat'];
- this._mapOffset = _getMapOffset(leafletMap);
- }
- LeafletMapCoordSys.prototype.dimensions = ['lng', 'lat'];
- LeafletMapCoordSys.prototype.setMapOffset = function (mapOffset) {
- this._mapOffset = mapOffset
- };
- LeafletMapCoordSys.prototype.getBMap = function () {
- return this._LeafletMap
- };
- LeafletMapCoordSys.prototype.prepareCustoms = function () {
- const zrUtil = (external_function_try_return_echarts_catch_e_return_default()).util;
- const rect = this.getViewRect();
- return {
- coordSys: {
- // The name exposed to user is always 'cartesian2d' but not 'grid'.
- type: 'leaflet',
- x: rect.x,
- y: rect.y,
- width: rect.width,
- height: rect.height
- },
- api: {
- coord: zrUtil.bind(this.dataToPoint, this),
- size: zrUtil.bind(dataToCoordSize, this)
- }
- };
- function dataToCoordSize(dataSize, dataItem) {
- dataItem = dataItem || [0, 0];
- return zrUtil.map([0, 1], function (dimIdx) {
- const val = dataItem[dimIdx];
- const halfSize = dataSize[dimIdx] / 2;
- const p1 = [];
- const p2 = [];
- p1[dimIdx] = val - halfSize;
- p2[dimIdx] = val + halfSize;
- p1[1 - dimIdx] = p2[1 - dimIdx] = dataItem[1 - dimIdx];
- return Math.abs(this.dataToPoint(p1)[dimIdx] - this.dataToPoint(p2)[dimIdx]);
- }, this);
- }
- };
- LeafletMapCoordSys.prototype.dataToPoint = function (data) {
- //处理数据中的null值
- if (data[1] === null) {
- data[1] = (external_L_default()).CRS.EPSG3857.projection.MAX_LATITUDE;
- }
- //平面坐标系不能这么处理
- //data[1] = this.fixLat(data[1]);
- const px = this._LeafletMap.latLngToLayerPoint([data[1], data[0]]);
- const mapOffset = this._mapOffset;
- return [px.x - mapOffset[0], px.y - mapOffset[1]];
- };
- LeafletMapCoordSys.prototype.fixLat = function (lat) {
- if (lat >= 90) {
- return 89.99999999999999;
- }
- if (lat <= -90) {
- return -89.99999999999999;
- }
- return lat;
- };
- LeafletMapCoordSys.prototype.pointToData = function (pt) {
- let mapOffset = this._mapOffset;
- let point = this._LeafletMap.layerPointToLatLng([pt[0] + mapOffset[0], pt[1] + mapOffset[1]]);
- return [point.lng, point.lat];
- };
- LeafletMapCoordSys.prototype.getViewRect = function () {
- const size = this._LeafletMap.getSize();
- return new (external_function_try_return_echarts_catch_e_return_default()).graphic.BoundingRect(0, 0, size.x, size.y);
- };
- LeafletMapCoordSys.prototype.getRoamTransform = function () {
- return external_function_try_return_echarts_catch_e_return_default().matrix.create();
- };
- LeafletMapCoordSys.dimensions = LeafletMapCoordSys.prototype.dimensions;
- LeafletMapCoordSys.create = function (ecModel) {
- let coordSys;
- let leafletMap = ecModel.scheduler.ecInstance.leafletMap;
- ecModel.eachComponent('LeafletMap', function (leafletMapModel) {
- if (!coordSys) {
- coordSys = new LeafletMapCoordSys(leafletMap);
- }
- leafletMapModel.coordinateSystem = coordSys;
- leafletMapModel.coordinateSystem.setMapOffset(leafletMapModel.__mapOffset || _getMapOffset(leafletMap));
- });
- ecModel.eachSeries(function (seriesModel) {
- if (!seriesModel.get('coordinateSystem') || seriesModel.get('coordinateSystem') === 'leaflet') {
- if (!coordSys) {
- coordSys = new LeafletMapCoordSys(leafletMap);
- }
- seriesModel.coordinateSystem = coordSys;
- seriesModel.animation = seriesModel.animation === true;
- }
- })
- };
- function _getMapOffset(map) {
- const offset = map.containerPointToLayerPoint([0, 0]);
- const mapOffset = [offset.x || 0, offset.y || 0];
- return mapOffset;
- }
- function _setCanvasPosition(map, viewportRoot) {
- const mapOffset = _getMapOffset(map);
- viewportRoot.style.left = mapOffset[0] + 'px';
- viewportRoot.style.top = mapOffset[1] + 'px';
- return mapOffset;
- }
- const echartsLayer = function (echartsOptions, options) {
- return new EchartsLayer(echartsOptions, options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/core/Detector.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- class Detector {
- static supportWebGL() {
- return getContext('webgl');
- }
- static supportWebGL2() {
- return getContext('webgl2');
- }
- static supportCanvas() {
- return getContext('2d');
- }
- }
- function getContext(context) {
- var canvas = document.createElement('canvas');
- return canvas && canvas.getContext(context);
- }
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/graphic/CloverStyle.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class CloverStyle
- * @deprecatedclassinstance L.supermap.cloverStyle
- * @classdesc 三叶草要素风格。
- * @category Visualization Graphic
- * @extends {L.Class}
- * @param {Object} options - 参数。
- * @param {number} [options.angle=60] - 三叶草每个扇叶的圆心角,单位弧度。
- * @param {number} [options.spaceAngle=0] - 扇叶间隔角度,通过计算获取。
- * @param {number} [options.count=3] - 扇叶数量。
- * @param {boolean} [options.stroke=true] - 是否描边。
- * @param {number} [options.strokeWidth=1] - 边框宽度。
- * @param {string} [options.color='#3388ff'] - 颜色。
- * @param {number} [options.weight=1] - 线宽。
- * @param {number} [options.opacity=1] - 透明度。
- * @param {string} [options.lineCap='round'] - 线帽形状。
- * @param {string} [options.lineJoin='round'] - 线条交汇边角形状。
- * @param {boolean} [options.fill=false] - 是否填充。
- * @param {string} [options.fillColor='#66ccff'] - 填充色。
- * @param {number} [options.fillOpacity=0.2] - 填充透明度。
- * @param {string} [options.fillRule='evenodd'] - 填充形状。
- * @param {number} [options.radius=10] - 半径。
- * @usage
- */
- var CloverStyle = external_L_default().Class.extend({
- options: {
- radius: 10,
- angele: 60,
- spaceAngle: 0,
- count: 3,
- fill: false,
- stroke: true,
- color: '#3388ff',
- weight: 1,
- lineCap: 'round',
- lineJoin: 'round',
- fillColor: '#66ccff',
- fillOpacity: 0.2,
- fillRule: 'evenodd',
- opacity: 1,
- strokeWidth:1
- },
-
- initialize: function (options) {
- options = options || {};
- external_L_default().Util.setOptions(this, options);
- this._canvas = document.createElement('canvas');
- this._canvas.width = 2 * (this.options.radius + this.options.weight);
- this._canvas.height = 2 * (this.options.radius + this.options.weight);
- this._ctx = this._canvas.getContext('2d');
- var strokeWidth = this.options.strokeWidth === undefined ? 1 : this.options.strokeWidth;
- this.options.width = 2 * (this.options.radius + strokeWidth) + 1;
- this._initStyle();
- },
- /**
- * @function CloverStyle.prototype.getStyle
- * @description 获取画布。
- */
- getStyle: function () {
- return this._canvas;
- },
- /**
- * @function CloverStyle.prototype.drawSector
- * @description 绘制扇形。
- * @param {CanvasRenderingContext2D} ctx - context 对象。
- * @param {number} x - 中心点 x。
- * @param {number} y - 中心点 y。
- * @param {number} r - 中心点 r。
- * @param {number} sAngle - 扇叶起始角度。
- * @param {number} eAngle - 扇叶终止角度。
- */
- drawSector: function (ctx, x, y, r, sAngle, eAngle) {
- //角度转换
- sAngle = sAngle / 180 * Math.PI;
- eAngle = eAngle / 180 * Math.PI;
- ctx.moveTo(x, y);
- ctx.lineTo(x + r * Math.cos(sAngle), y + r * Math.sin(sAngle));
- ctx.arc(x, y, r, sAngle, eAngle);
- ctx.lineTo(x, y);
- },
- _initStyle: function () {
- //起始角度
- var sAngle = 0;
- var options = this.options;
- var eAngle = options.angle;
- options.spaceAngle = 360 / options.count - options.angle;
- if (options.spaceAngle < 0) {
- return;
- }
- this._ctx.beginPath();
- this.anchor = [options.width / 2, options.width / 2];
- for (var i = 0; i < options.count; i++) {
- this.drawSector(this._ctx, this.anchor[0], this.anchor[1], options.radius, sAngle, eAngle);
- sAngle = eAngle + options.spaceAngle;
- eAngle = sAngle + options.angle;
- }
- this._fillStroke();
- },
- _fillStroke: function () {
- var options = this.options;
- if (options.fill) {
- this._ctx.globalAlpha = options.fillOpacity;
- this._ctx.fillStyle = options.fillColor || options.color;
- this._ctx.fill(options.fillRule || 'evenodd');
- }
- if (options.stroke && options.weight !== 0) {
- this._ctx.globalAlpha = options.opacity;
- this._ctx.lineWidth = options.weight;
- this._ctx.strokeStyle = options.color;
- this._ctx.lineCap = options.lineCap;
- this._ctx.lineJoin = options.lineJoin;
- this._ctx.stroke();
- }
- }
- });
- var cloverStyle = function (options) {
- return new CloverStyle(options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/graphic/CircleStyle.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class CircleStyle
- * @deprecatedclassinstance L.supermap.circleStyle
- * @classdesc 圆形要素风格。
- * @category Visualization Graphic
- * @extends {L.Class}
- * @param {Object} options - 参数。
- * @param {boolean} [options.stroke=true] - 是否描边。
- * @param {string} [options.color='#3388ff'] - 颜色。
- * @param {number} [options.weight=1] - 线宽。
- * @param {number} [options.opacity=1] - 透明度。
- * @param {string} [options.lineCap='round'] - 线帽形状。
- * @param {string} [options.lineJoin='round'] - 线条交汇边角形状。
- * @param {boolean} [options.fill=false] - 是否填充。
- * @param {string} [options.fillColor] - 填充色。
- * @param {number} [options.fillOpacity=0.2] - 填充透明度。
- * @param {string} [options.fillRule='evenodd'] - 填充形状。
- * @param {number} [options.radius=3] - 半径。
- * @usage
- */
- var CircleStyle = external_L_default().Class.extend({
- options: {
- stroke: true,
- color: '#3388ff',
- weight: 1,
- opacity: 1,
- lineCap: 'round',
- lineJoin: 'round',
- fill: false,
- fillColor: null,
- fillOpacity: 0.2,
- fillRule: 'evenodd',
- radius: 3
- },
- initialize: function (options) {
- options = options || {};
- external_L_default().Util.setOptions(this, options);
- this._canvas = document.createElement('canvas');
- this._canvas.width = 2 * (this.options.radius + this.options.weight);
- this._canvas.height = 2 * (this.options.radius + this.options.weight);
- this._ctx = this._canvas.getContext('2d');
- this._initStyle();
- },
- /**
- * @deprecated
- * @function CircleStyle.prototype.getCanvas
- * @description 获取画布,已弃用该设置,请使用 getStyle 接口。
- */
- getCanvas: function () {
- return this._canvas;
- },
- /**
- * @function CircleStyle.prototype.getStyle
- * @description 获取画布。
- */
- getStyle: function () {
- return this._canvas;
- },
- _initStyle: function () {
- this._ctx.beginPath();
- this._ctx.arc(this._canvas.width / 2, this._canvas.height / 2, this.options.radius, 0, Math.PI * 2);
- this._fillStroke();
- },
- _fillStroke: function () {
- var options = this.options;
- if (options.fill) {
- this._ctx.globalAlpha = options.fillOpacity;
- this._ctx.fillStyle = options.fillColor || options.color;
- this._ctx.fill(options.fillRule || 'evenodd');
- }
- if (options.stroke && options.weight !== 0) {
- this._ctx.globalAlpha = options.opacity;
- this._ctx.lineWidth = options.weight;
- this._ctx.strokeStyle = options.color;
- this._ctx.lineCap = options.lineCap;
- this._ctx.lineJoin = options.lineJoin;
- this._ctx.stroke();
- }
- }
- });
- var circleStyle = function (options) {
- return new CircleStyle(options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/graphic/ImageStyle.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ImageStyle
- * @deprecatedclassinstance L.supermap.imageStyle
- * @classdesc 自定义图形要素风格。
- * @category Visualization Graphic
- * @extends {L.Class}
- * @param {Object} options - 参数。
- * @param {HTMLImageElement} options.img - image 对象。
- * @param {Array.<number>} [options.origin=[0.0]] - 中心点。
- * @param {Array} [options.anchor] - 偏移量。
- * @param {Array} [options.size] - 图形大小,即高度和宽度[width,height]。
- * @param {Array} [options.radius] - 半径。
- * @param {Array} [options.weight] - 宽度。
- * @usage
- */
- var ImageStyle = external_L_default().Class.extend({
- options: {
- img: null,
- origin: [0, 0],
- anchor: null,
- size: null
- },
- initialize: function (options) {
- options = options || {};
- external_L_default().Util.setOptions(this, options);
- this._canvas = document.createElement('canvas');
- this._canvas.width = 2 * (this.options.radius + this.options.weight);
- this._canvas.height = 2 * (this.options.radius + this.options.weight);
- this._ctx = this._canvas.getContext('2d');
- },
- /**
- * @function ImageStyle.prototype.getStyle
- * @description 获取样式。
- */
- getStyle: function () {
- return this.options;
- }
- });
- var imageStyle = function (options) {
- return new ImageStyle(options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/graphic/CanvasRenderer.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- const emptyFunc = (external_L_default()).Util.falseFn;
- var GraphicCanvasRenderer = external_L_default().Class.extend({
- initialize: function (layer, options) {
- this.layer = layer;
- options = options || {};
- external_L_default().Util.setOptions(this, options);
- },
- /**
- * @private
- * @function GraphicCanvasRenderer.prototype.getRenderer
- * @description 返回渲染器,提供图层后续的数据增删改。
- * @returns {L.Canvas}
- */
- getRenderer: function () {
- return this.options.renderer;
- },
- /**
- * @private
- * @function GraphicCanvasRenderer.prototype.update
- * @description 更新图层,数据或者样式改变后调用。
- */
- update: function () {
- this.getRenderer()._clear();
- this.getRenderer()._draw();
- },
- _getGraphicAtPoint: function (p) {
- const layer = this.layer;
- const map = layer._map;
- let graphics = layer._getGraphicsInBounds();
- for (let i = graphics.length - 1; i >= 0; i--) {
- let p1, p2, bounds;
- const center = map.latLngToLayerPoint(graphics[i].getLatLng());
- let style = graphics[i].getStyle();
- if (!style && this.defaultStyle) {
- style = this.defaultStyle;
- }
- if (style.img) {
- let imgWidth = style.img.width;
- let imgHeight = style.img.height;
- if (style.size && style.size[0] && style.size[1]) {
- imgWidth = style.size[0];
- imgHeight = style.size[1];
- }
- const anchor = style.anchor || [imgWidth / 2, imgHeight / 2];
- p1 = external_L_default().point(center.x - anchor[0], center.y - anchor[1]);
- p2 = external_L_default().point(p1.x + imgWidth, p1.y + imgHeight);
- } else {
- p1 = external_L_default().point(center.x - style.width / 2, center.y - style.height / 2);
- p2 = external_L_default().point(center.x + style.width / 2, center.y + style.height / 2);
- }
- bounds = external_L_default().bounds(p1, p2);
- if (bounds.contains(p)) {
- return graphics[i];
- }
- }
- return null;
- },
- containsPoint: function (p) {
- return !!this._getGraphicAtPoint(p);
- },
- _handleClick: function (evt) {
- evt.target = null;
- const layer = this.layer;
- const map = layer._map;
- const graphic = this._getGraphicAtPoint(map.latLngToLayerPoint(evt.latlng));
- if (graphic) {
- this.layer._renderer._ctx.canvas.style.cursor = 'pointer';
- evt.target = graphic;
- if (evt.type === 'click' && layer.options.onClick) {
- layer.options.onClick.call(layer, graphic, evt);
- }
- return;
- }
- this.layer._renderer._ctx.canvas.style.cursor = 'auto';
- },
- //跟GraphicWebGLRenderer保持一致
- _clearBuffer: emptyFunc
- });
- external_L_default().Canvas.include({
- drawGraphics: function (graphics, defaultStyle) {
- var me = this;
- if (!me._drawing) {
- return;
- }
- //this._ctx.clearRect(0, 0, this._ctx.canvas.width, me._ctx.canvas.height);
- graphics.forEach(function (graphic) {
- var style = graphic.getStyle();
- if (!style && defaultStyle) {
- style = defaultStyle;
- }
- if (style.img) {
- //绘制图片
- me._drawImage.call(me, me._ctx, style, graphic.getLatLng());
- } else {
- //绘制canvas
- me._drawCanvas.call(me, me._ctx, style, graphic.getLatLng());
- }
- });
- },
- _drawCanvas: function (ctx, style, latLng) {
- var canvas = style;
- var pt = this._map.latLngToLayerPoint(latLng);
- var p0 = pt.x - canvas.width / 2;
- var p1 = pt.y - canvas.height / 2;
- var width = canvas.width;
- var height = canvas.height;
- ctx.drawImage(canvas, p0, p1, width, height);
- },
- _drawImage: function (ctx, style, latLng) {
- //设置图片的大小
- var width, height;
- if (style.size) {
- var size = style.size;
- width = size[0];
- height = size[1];
- } else {
- width = style.img.width;
- height = style.img.height;
- }
- //设置偏移
- var point = this._coordinateToPoint(latLng);
- var pt = external_L_default().point(point),
- ac = external_L_default().point(style.anchor || [width / 2, height / 2]);
- point = [pt.x - ac.x, pt.y - ac.y];
- //参数分别为:图片,图片裁剪下x,y位置,裁剪长宽,放置在画布的位置x,y, 占取画布长宽
- //ctx.drawImage(style.img, 0, 0, width, height, point[0], point[1], width, height);
- ctx.drawImage(style.img, point[0], point[1], width, height);
- },
- _coordinateToPoint: function (coordinate) {
- if (!this._map) {
- return coordinate;
- }
- var latLng = coordinate;
- if (external_L_default().Util.isArray(coordinate)) {
- latLng = external_L_default().latLng(coordinate[0], coordinate[1]);
- } else if (coordinate instanceof (external_L_default()).LatLng) {
- latLng = external_L_default().latLng(coordinate.lat, coordinate.lng);
- }
- var point = this._map.latLngToLayerPoint(latLng);
- return [point.x, point.y];
- }
- });
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/graphic/WebGLRenderer.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- const WebGLRenderer_emptyFunc = (external_L_default()).Util.falseFn;
- /**
- * @private
- * @class GraphicWebGLRenderer
- * @classdesc 高效率点图层 webgl 渲染器。
- * @category Visualization Graphic
- * @extends {L.Layer}
- * @param {Array.<GraphicLayer>} layer - 高效率点图层。
- * @param {Object} options - 参数。
- * @param {number} options.width - 地图宽度。
- * @param {number} options.height - 地图高度。
- * @param {HTMLElement} options.container - 放置渲染器的父元素。
- * @param {Array.<number>} [options.color=[0, 0, 0, 255]] - 颜色,目前只支持 rgba 数组。
- * @param {number} [options.radius=10] - 半径。
- * @param {number} [options.opacity=0.8] - 不透明度。
- * @param {Array} [options.highlightColor] - 高亮颜色,目前只支持 rgba 数组。
- * @param {number} [options.radiusScale=1] - 点放大倍数。
- * @param {number} [options.radiusMinPixels=0] - 半径最小值,单位为像素。
- * @param {number} [options.radiusMaxPixels=Number.MAX_SAFE_INTEGER] - 半径最大值,单位为像素。
- * @param {number} [options.strokeWidth=1] - 边框大小。
- * @param {boolean} [options.outline=false] - 是否显示边框。
- * @param {function} [options.onClick] - 点击事件。
- * @param {function} [options.onHover] - 悬停事件。
- */
- const CSS_TRANSFORM = (function () {
- let div = document.createElement('div');
- let props = [
- 'transform',
- 'WebkitTransform',
- 'MozTransform',
- 'OTransform',
- 'msTransform'
- ];
- for (let i = 0; i < props.length; i++) {
- let prop = props[i];
- if (div.style[prop] !== undefined) {
- return prop;
- }
- }
- return props[0];
- })();
- var GraphicWebGLRenderer = external_L_default().Class.extend({
- initialize: function (layer, options) {
- this.layer = layer;
- let opt = options || {};
- external_L_default().Util.setOptions(this, opt);
- this.options.radius = this._pixelToMeter(this.options.radius);
- this._initContainer();
- },
- /**
- * @private
- * @function GraphicWebGLRenderer.prototype.getRenderer
- * @description 返回渲染器,可对图层数据增加、删除和修改。
- * @returns {GraphicWebGLRenderer}
- */
- getRenderer: function () {
- return this;
- },
- /**
- * @private
- * @function GraphicWebGLRenderer.prototype.update
- * @description 更新图层。
- */
- update: function (graphics) {
- if (graphics && graphics.length > -1) {
- this._data = graphics;
- }
- this._renderLayer.setChangeFlags({
- dataChanged: true,
- propsChanged: true,
- viewportChanged: true,
- updateTriggersChanged: true
- });
- this._refreshData();
- let state = this._getLayerState();
- state.data = this._data || [];
- this._layerDefaultStyleCache = null;
- this._renderLayer.setNeedsRedraw(true);
- this._renderLayer.setState(state);
- },
- /**
- * @private
- * @function GraphicWebGLRenderer.prototype.drawGraphics
- * @description 绘制点要素。
- */
- drawGraphics: function (graphics) {
- this._clearBuffer();
- let size = this.layer._map.getSize();
- if (this._container.width !== size.x) {
- this._container.width = size.x;
- }
- if (this._container.height !== size.y) {
- this._container.height = size.y;
- }
- let mapPane = this.layer._map.getPanes().mapPane;
- let point = mapPane._leaflet_pos;
- this._container.style[CSS_TRANSFORM] = 'translate(' +
- -Math.round(point.x) + 'px,' +
- -Math.round(point.y) + 'px)';
- this._data = graphics || [];
- if (!this._renderLayer) {
- this._createInnerRender();
- }
- this._draw();
- },
- _initContainer: function () {
- this._container = this._createCanvas(this.options.width, this.options.height);
- this._layerContainer = this.options.container;
- this._wrapper = external_L_default().DomUtil.create('div', "deck-wrapper", this._layerContainer);
- this._wrapper.appendChild(this._container);
- },
- _createCanvas: function (width, height) {
- //leaflet-layer 对应的css会自动设置position
- let canvas = external_L_default().DomUtil.create('canvas', 'graphicLayer leaflet-layer leaflet-zoom-hide');
- canvas.oncontextmenu = (external_L_default()).Util.falseFn;
- canvas.width = width;
- canvas.height = height;
- canvas.style.width = width + "px";
- canvas.style.height = height + "px";
- return canvas;
- },
- _pixelToMeter: function (pixel) {
- const bounds = this.layer._map.getBounds();
- const latlngRes = (bounds.getEast() - bounds.getWest()) / this.layer._map.getSize().x
- const meterRes = latlngRes * (Math.PI * 6378137 / 180);
- return pixel * meterRes;
- },
- _createInnerRender: function () {
- let me = this;
- let state = this._getLayerState();
- let {
- color,
- radius,
- opacity,
- highlightColor,
- radiusScale,
- radiusMinPixels,
- radiusMaxPixels,
- strokeWidth,
- outline
- } = state;
- let innerLayerOptions = {
- id: 'scatter-plot',
- data: me._data,
- pickable: Boolean(this.options.onClick) || Boolean(this.options.onHover),
- autoHighlight: true,
- color: color,
- opacity: opacity,
- radius: radius,
- radiusScale: radiusScale,
- highlightColor: highlightColor,
- radiusMinPixels: radiusMinPixels,
- radiusMaxPixels: radiusMaxPixels,
- strokeWidth: strokeWidth,
- coordinateSystem:this._isWGS84()?window.DeckGL.COORDINATE_SYSTEM.LNGLAT_OFFSETS:window.DeckGL.COORDINATE_SYSTEM.LNGLAT,
- isGeographicCoordinateSystem: this._isWGS84(),
- outline: outline,
- getPosition: function (point) {
- if (!point) {
- return [0, 0, 0];
- }
- let lngLat = point.getLatLng();
- return lngLat && [lngLat.lng, lngLat.lat, 0];
- },
- getColor: function (point) {
- let defaultStyle = me._getLayerDefaultStyle();
- let style = point && point.options;
- return style && style.color || defaultStyle.color
- },
- getRadius: function (point) {
- let defaultStyle = me._getLayerDefaultStyle();
- let style = point && point.getStyle();
- return style && style.radius || defaultStyle.radius
- },
- updateTriggers: {
- getColor: [color],
- getRadius: [radius]
- }
- };
- let _self = this;
- if (this.options.onClick) {
- innerLayerOptions.onClick = function () {
- _self._container.style.cursor = "pointer";
- _self.options.onClick.apply(_self, arguments)
- };
- }
- if (this.options.onHover) {
- innerLayerOptions.onHover = function () {
- _self._container.style.cursor = "pointer";
- _self.options.onHover.apply(_self, arguments)
- };
- }
- me._renderLayer = new window.DeckGL.ScatterplotLayer(innerLayerOptions);
- },
- _getLayerDefaultStyle: function () {
- if (this._layerDefaultStyleCache) {
- return this._layerDefaultStyleCache;
- }
- let {
- color,
- opacity,
- radius,
- radiusScale,
- radiusMinPixels,
- radiusMaxPixels,
- strokeWidth,
- outline
- } = this.layer.options;
- radius = this._pixelToMeter(radius);
- this._layerDefaultStyleCache = {
- color,
- opacity,
- radius,
- radiusScale,
- radiusMinPixels,
- radiusMaxPixels,
- strokeWidth,
- outline
- }
- return this._layerDefaultStyleCache
- },
- _getLayerState: function () {
- let state = this.layer.getState();
- state.zoom = state.zoom - 1;
- return state;
- },
- _draw: function () {
- let state = this._getLayerState();
- this._refreshData();
- state.data = this._data || [];
- let deckOptions = {};
- for (let key in state) {
- deckOptions[key] = state[key];
- }
- this._layerDefaultStyleCache = null;
- this._renderLayer.setNeedsRedraw(true);
- deckOptions.layers = [this._renderLayer];
- deckOptions.canvas = this._container;
- deckOptions.onBeforeRender = this._onBeforeRender.bind(this);
- deckOptions.onAfterRender = this._onAfterRender.bind(this);
- deckOptions.coordinateSystem = this._isWGS84()? window.DeckGL.COORDINATE_SYSTEM.LNGLAT_OFFSETS:window.DeckGL.COORDINATE_SYSTEM.LNGLAT;
- deckOptions.isGeographicCoordinateSystem = this._isWGS84();
- if (!this.deckGL) {
- this.deckGL = new window.DeckGL.experimental.DeckGLJS(deckOptions);
- } else {
- this.deckGL.setProps(deckOptions);
- }
- },
- _clearBuffer: function () {
- if (this.deckGL) {
- let lm = this.deckGL.layerManager;
- lm && lm.context.gl.clear(lm.context.gl.COLOR_BUFFER_BIT);
- }
- return this;
- },
- _refreshData: function () {
- let graphics = this._data || [];
- let sGraphics = !external_L_default().Util.isArray(graphics) ? [graphics] : [].concat(graphics);
- //this.layer.props.data不能被重新赋值,只能在原数组上进行操作
- if (!this._renderLayer.props.data) {
- this._renderLayer.props.data = [];
- }
- this._renderLayer.props.data.length = 0;
- for (let i = 0; i < sGraphics.length; i++) {
- this._renderLayer.props.data.push(sGraphics[i]);
- }
- this._data = this._renderLayer.props.data;
- },
- _handleClick: WebGLRenderer_emptyFunc,
- //deck渲染开始前调用,可以重写
- _onBeforeRender: WebGLRenderer_emptyFunc,
- //deck渲染结束后调用,可以重写
- _onAfterRender: WebGLRenderer_emptyFunc,
- //以下为leaflet再带的renderer的方法,为了保持接口正常调用,故增加这几个方法
- _removePath: function () {
- this._wrapper.parentElement.removeChild(this._wrapper);
- this._container = null;
- this._wrapper = null;
- return this;
- },
- _initPath: WebGLRenderer_emptyFunc,
- _addPath: WebGLRenderer_emptyFunc,
- containsPoint: WebGLRenderer_emptyFunc,
- _isWGS84(){
- return this.layer._map.options.crs.code === "EPSG:4326";
- }
- });
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/graphic/index.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/GraphicLayer.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- const Renderer = ['canvas', 'webgl'];
- const defaultProps = {
- color: [0, 0, 0, 255],
- opacity: 0.8,
- radius: 10,
- radiusScale: 1,
- radiusMinPixels: 0,
- radiusMaxPixels: Number.MAX_SAFE_INTEGER,
- strokeWidth: 1,
- outline: false
- };
- const BASE_RESOLUTIONS = {
- 'EPSG:4326': 360.0 / 256,
- 'EPSG:3857': (20037508.34279 * 2) / 256
- };
- const DEFAULT_ZOOM_OFFSET = {
- 'EPSG:4326': 1,
- 'EPSG:3857': 0
- };
- /**
- * @class GraphicLayer
- * @deprecatedclassinstance L.supermap.graphicLayer
- * @classdesc 高效率点图层类。
- * @category Visualization Graphic
- * @extends {L.Path}
- * @param {Array.<Graphic>} graphics - 要素对象。
- * @param {Object} options - 参数。
- * @param {string} [options.render='canvas'] - 指定使用的渲染器。可选值:'webgl','canvas'( webgl 渲染目前只支持散点)。
- * @param {Array.<number>} [options.color=[0, 0, 0, 255]] - 要素颜色。
- * @param {Array.<number>} [options.highlightColor] - webgl 渲染时要素高亮颜色。
- * @param {number} [options.opacity=0.8] - 要素透明度,。当 {@link Graphic} 的 style 参数传入设置了 fillOpacity 或 opacity 的 {@link CircleStyle} 或 {@link CloverStyle},此参数无效。{@link Graphic} 的 style 传入 {@link ImageStyle} 后不支持此参数。
- * @param {number} [options.radius=10] - 要素半径,单位为像素。当 {@link Graphic} 的 style 参数传入了 radius,此参数无效。
- * @param {number} [options.radiusScale=1] - webgl 渲染时的要素放大倍数。
- * @param {number} [options.radiusMinPixels=0] - webgl 渲染时的要素半径最小值,单位为像素。
- * @param {number} [options.radiusMaxPixels=Number.MAX_SAFE_INTEGER] - webgl 渲染时的要素半径最大值,单位为像素。
- * @param {number} [options.strokeWidth=1] - 边框大小。当 {@link Graphic} 的 style 参数传入了 weight,此参数无效。
- * @param {boolean} [options.outline=false] - 是否显示边框。当 {@link Graphic} 的 style 参数传入设置了 stroke 的 {@link CircleStyle} 或 {@link CloverStyle},此参数无效。
- * @param {function} [options.onClick] - 图层鼠标点击响应事件(支持 webgl、canvas 渲染)。
- * @param {function} [options.onHover] - 图层鼠标悬停响应事件(只支持 webgl 渲染)。
- * @usage
- */
- var GraphicLayer = external_L_default().Path.extend({
- initialize: function (graphics, options) {
- this.graphics = [].concat(graphics);
- let opt = options || {};
- // 由于是canvas实现所以不能更改pane
- opt.pane = 'overlayPane';
- external_L_default().Util.setOptions(this, opt);
- //因为跟基类的renderer冲突,所以采用render这个名字
- this.options.render = this.options.render || Renderer[0];
- //浏览器支持webgl并且指定使用webgl渲染才使用webgl渲染
- if (!Detector.supportWebGL2()) {
- this.options.render = Renderer[0];
- }
- if (this.options.interactive) {
- this.on('click mousemove dblclick mousedown mouseup mouseout contextmenu', this._handleClick, this);
- }
- },
- /**
- * @private
- * @function GraphicLayer.prototype.getEvents
- * @description 获取事件。
- * @returns {Object} 返回该图层支持的事件对象。
- */
- getEvents: function () {
- const events = {
- resize: this._resize.bind(this),
- moveend: this._moveEnd.bind(this)
- };
- return events;
- },
- /**
- * @private
- * @function GraphicLayer.prototype.onAdd
- * @description 添加图形。
- */
- onAdd: function (map) {
- this._map = map;
- this._crs = map.options.crs;
- this.defaultStyle = this._getDefaultStyle(this.options);
- this._renderer = this._createRenderer();
- this._container = this._renderer._container;
- // this.addInteractiveTarget(this._container);
- external_L_default().Path.prototype.onAdd.call(this);
- },
- /**
- * @private
- * @override
- * @function GraphicLayer.prototype.onRemove
- * @description 移除图层。
- */
- onRemove: function () {
- this.off('click mousemove dblclick mousedown mouseup contextmenu', this._handleClick, this);
- this._renderer._removePath(this);
- },
- /**
- * @function GraphicLayer.prototype.setGraphics
- * @description 设置绘制的点要素数据,会覆盖之前的所有要素。
- * @param {Array.<Graphic>} graphics - 点要素对象数组。
- */
- setGraphics: function (graphics) {
- this.graphics = this.graphics || [];
- this.graphics.length = 0;
- let sGraphics = !external_L_default().Util.isArray(graphics) ? [graphics] : [].concat(graphics);
- this.graphics = [].concat(sGraphics);
- this.update();
- },
- /**
- * @function GraphicLayer.prototype.addGraphics
- * @description 追加点要素,不会覆盖之前的要素。
- * @param {Array.<Graphic>} graphics - 点要素对象数组。
- */
- addGraphics: function (graphics) {
- this.graphics = this.graphics || [];
- let sGraphics = !external_L_default().Util.isArray(graphics) ? [graphics] : [].concat(graphics);
- this.graphics = this.graphics.concat(sGraphics);
- this.update();
- },
- /**
- * @function GraphicLayer.prototype.getGraphicBy
- * @description 指定属性名和属性值,获取第一个匹配的要素数组。
- * @param {string} property - 属性名称。
- * @param {string} value - 属性值。
- * @returns {Graphic} 返回匹配的 graphic 。
- */
- getGraphicBy(property, value) {
- let graphic = null;
- for (let index in this.graphics) {
- if (this.graphics[index][property] === value) {
- graphic = this.graphics[index];
- break;
- }
- }
- return graphic;
- },
- /**
- * @function GraphicLayer.prototype.getGraphicById
- * @description 获取指定 id 的矢量要素。
- * @param {string} graphicId - 矢量要素的属性 id。
- * @returns {Graphic} 返回匹配的 graphic。
- */
- getGraphicById(graphicId) {
- return this.getGraphicBy('id', graphicId);
- },
- /**
- * @function GraphicLayer.prototype.getGraphicsByAttribute
- * @description 指定属性名和属性值,获取所有匹配的要素数组。
- * @param {string} attrName - 属性名称。
- * @param {string} attrValue - 属性值。
- * @returns {Array.<Graphic>} 返回匹配的 graphic 数组。
- */
- getGraphicsByAttribute(attrName, attrValue) {
- var graphic,
- foundgraphics = [];
- for (let index in this.graphics) {
- graphic = this.graphics[index];
- if (graphic && graphic.attributes) {
- if (graphic.attributes[attrName] === attrValue) {
- foundgraphics.push(graphic);
- }
- }
- }
- return foundgraphics;
- },
- /**
- * @function GraphicLayer.prototype.removeGraphics
- * @description 删除要素数组,默认删除所有要素。
- * @param {Array.<Graphic>} [graphics=null] - 删除的 graphics 数组。
- */
- removeGraphics(graphics = null) {
- //当 graphics 为 null 、为空数组,或 === this.graphics,则清除所有要素
- if (!graphics || graphics.length === 0 || graphics === this.graphics) {
- this.graphics.length = 0;
- this.update();
- return;
- }
- if (!Util.isArray(graphics)) {
- graphics = [graphics];
- }
- for (let i = graphics.length - 1; i >= 0; i--) {
- let graphic = graphics[i];
- //如果我们传入的grapchic在graphics数组中没有的话,则不进行删除,
- //并将其放入未删除的数组中。
- let findex = Util.indexOf(this.graphics, graphic);
- if (findex === -1) {
- continue;
- }
- this.graphics.splice(findex, 1);
- }
- //删除完成后重新设置 setGraphics,以更新
- this.update();
- },
- /**
- * @function GraphicLayer.prototype.setStyle
- * @description 设置图层要素整体样式。
- * @param {Object} styleOptions - 样式对象。
- * @param {Array.<number>} [styleOptions.color=[0, 0, 0, 255]] - 点颜色。
- * @param {number} [styleOptions.radius=10] - 点半径。
- * @param {number} [styleOptions.opacity=0.8] - 不透明度。
- * @param {Array} [styleOptions.highlightColor] - 高亮颜色,目前只支持 rgba 数组。
- * @param {number} [styleOptions.radiusScale=1] - 点放大倍数。
- * @param {number} [styleOptions.radiusMinPixels=0] - 半径最小值,单位为像素。
- * @param {number} [styleOptions.radiusMaxPixels=Number.MAX_SAFE_INTEGER] - 半径最大值,单位为像素。
- * @param {number} [styleOptions.strokeWidth=1] - 边框大小。
- * @param {boolean} [styleOptions.outline=false] - 是否显示边框。
- */
- setStyle: function (styleOptions) {
- let _opt = this.options;
- let styleOpt = {
- color: _opt.color,
- radius: _opt.radius,
- opacity: _opt.opacity,
- highlightColor: _opt.highlightColor,
- radiusScale: _opt.radiusScale,
- radiusMinPixels: _opt.radiusMinPixels,
- radiusMaxPixels: _opt.radiusMaxPixels,
- strokeWidth: _opt.strokeWidth,
- outline: _opt.outline
- };
- this.options = external_L_default().Util.extend(this.options, styleOpt, styleOptions);
- this.defaultStyle = this._getDefaultStyle(this.options);
- this.update();
- },
- /**
- * @function GraphicLayer.prototype.update
- * @description 更新图层,数据或者样式改变后调用。
- */
- update: function () {
- this._layerRenderer.update(this.graphics);
- },
- /**
- * @function GraphicLayer.prototype.clear
- * @description 释放图层资源。
- */
- clear: function () {
- this.removeGraphics();
- },
- /**
- * @function GraphicLayer.prototype.getRenderer
- * @description 获取渲染器。
- * @returns {Object} 内部渲染器。
- */
- getRenderer: function () {
- return this._renderer;
- },
- /**
- * @function GraphicLayer.prototype.getState
- * @description 获取当前地图和图层状态。
- * @returns {Object} 地图和图层状态,包含地图状态信息和本图层相关状态。
- */
- getState: function () {
- let map = this._map;
- let width = map.getSize().x;
- let height = map.getSize().y;
- let center = map.getCenter();
- let longitude = center.lng;
- let latitude = center.lat;
- let zoomOffset = DEFAULT_ZOOM_OFFSET[this._crs.code] || 0;
- if(BASE_RESOLUTIONS[this._crs.code] && this._crs.resolutions && this._crs.resolutions.length > 0 ){
- zoomOffset = Math.round(Math.log2(BASE_RESOLUTIONS[this._crs.code]/this._crs.resolutions[0]))
- }
- let zoom = map.getZoom() + zoomOffset;
- let maxZoom = map.getMaxZoom() + zoomOffset;
- let mapViewport = {
- longitude: longitude,
- latitude: latitude,
- zoom: zoom,
- maxZoom: maxZoom,
- pitch: 0,
- bearing: 0
- };
- let state = {};
- for (let key in mapViewport) {
- state[key] = mapViewport[key];
- }
- state.width = width;
- state.height = height;
- let options = this.options;
- state.color = options.color;
- state.radius = options.radius;
- state.opacity = options.opacity;
- state.highlightColor = options.highlightColor;
- state.radiusScale = options.radiusScale;
- state.radiusMinPixels = options.radiusMinPixels;
- state.radiusMaxPixels = options.radiusMaxPixels;
- state.strokeWidth = options.strokeWidth;
- state.outline = options.outline;
- return state;
- },
- _resize: function () {
- let size = this._map.getSize();
- this._container.width = size.x;
- this._container.height = size.y;
- this._container.style.width = size.x + 'px';
- this._container.style.height = size.y + 'px';
- let mapOffset = this._map.containerPointToLayerPoint([0, 0]);
- external_L_default().DomUtil.setPosition(this._container, mapOffset);
- this._update();
- },
- _moveEnd: function () {
- if (this._layerRenderer instanceof GraphicWebGLRenderer) {
- this._update();
- }
- },
- //使用canvas渲染或webgl渲染
- _createRenderer: function () {
- let map = this._map;
- let width = map.getSize().x;
- let height = map.getSize().y;
- let _renderer;
- if (this.options.render === Renderer[0]) {
- _renderer = new GraphicCanvasRenderer(this, {
- width: width,
- height: height,
- renderer: map.getRenderer(this)
- });
- } else {
- let optDefault = external_L_default().Util.setOptions({}, defaultProps);
- let opt = external_L_default().Util.setOptions(
- {
- options: optDefault
- },
- this.options
- );
- opt = external_L_default().Util.setOptions(this, opt);
- opt.container = map.getPane('overlayPane');
- opt.width = width;
- opt.height = height;
- _renderer = new GraphicWebGLRenderer(this, opt);
- }
- _renderer.defaultStyle = this.defaultStyle;
- this._layerRenderer = _renderer;
- return this._layerRenderer.getRenderer();
- },
- /**
- * @private
- * @override
- */
- _update: function () {
- if (this._map) {
- this._updatePath();
- }
- },
- /**
- * @private
- * @override
- */
- _updatePath: function () {
- let graphics = this._getGraphicsInBounds();
- this._renderer.drawGraphics(graphics, this.defaultStyle);
- },
- /**
- * @private
- * @override
- */
- _project: function () {
- let me = this;
- me._getGraphicsInBounds().map(function (graphic) {
- let point = me._map.latLngToLayerPoint(graphic.getLatLng());
- let w = me._clickTolerance();
- let p = [graphic._anchor + w, graphic._anchor + w];
- graphic._pxBounds = new (external_L_default()).Bounds(point.subtract(p), point.add(p));
- return graphic;
- });
- me._pxBounds = external_L_default().bounds(external_L_default().point(0, 0), external_L_default().point(this._container.width, this._container.height));
- },
- _getDefaultStyle: function (options) {
- const target = {};
- if (options.color) {
- target.fill = true;
- const color = this.toRGBA(options.color);
- target.color = color;
- target.fillColor = color;
- }
- if (options.opacity) {
- target.opacity = options.opacity;
- target.fillOpacity = options.opacity;
- }
- if (options.radius) {
- target.radius = options.radius;
- }
- if (options.strokeWidth) {
- target.weight = options.strokeWidth;
- }
- if (options.outline) {
- target.stroke = options.outline;
- }
- return new CircleStyle(target).getStyle();
- },
- toRGBA(colorArray) {
- return `rgba(${colorArray[0]},${colorArray[1]},${colorArray[2]},${(colorArray[3] || 255) / 255})`;
- },
- _getGraphicsInBounds: function () {
- let me = this;
- let graphicsInBounds = [];
- let viewBounds = me._map.getBounds();
- this.graphics.map(function (graphic) {
- if (viewBounds.contains(graphic.getLatLng())) {
- graphicsInBounds.push(graphic);
- }
- return graphic;
- });
- return graphicsInBounds;
- },
- _handleClick: function (evt) {
- this._layerRenderer._handleClick(evt);
- },
- /**
- * @private
- * @override
- */
- beforeAdd: (external_L_default()).Util.falseFn,
- /**
- * @private
- * @override
- */
- _containsPoint: function (p) {
- return this._layerRenderer.containsPoint(p);
- }
- });
- let graphicLayer = function (graphics, options) {
- return new GraphicLayer(graphics, options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/GraphThemeLayer.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
-
-
-
-
-
-
-
-
- /**
- * @class GraphThemeLayer
- * @deprecatedclassinstance L.supermap.graphThemeLayer
- * @category Visualization Theme
- * @classdesc 统计专题图图层。统计专题图通过为每个要素绘制统计图表来反映其对应的专题值的大小。它可同时表示多个字段属性信息,在区域本身与各区域之间形成横向和纵向的对比。
- * 统计专题图多用于具有相关数量特征的地图上,比如表示不同地区多年的粮食产量、GDP、人口等,不同时段客运量、地铁流量等。
- * 目前提供的统计图类型有:柱状图(Bar),折线图(Line),饼图(Pie),三维柱状图(Bar3D),点状图(Point),环状图(Ring)。
- * @extends ThemeLayer
- * @param {string} name - 专题图表名称。
- * @param {string} chartsType - 图表类型。目前可用:"Bar","Bar3D","Line","Point","Pie","Ring"。
- * @param {Object} options - 参数。
- * @param {boolean} [options.isOverLay=true] - 是否进行压盖处理,如果设为 true,图表绘制过程中将隐藏对已在图层中绘制的图表产生压盖的图表。
- * @param {string} options.themeFields - 指定创建专题图字段。
- * @param {boolean} [options.alwaysMapCRS=false] - 要素坐标是否和地图坐标系一致,要素默认是经纬度坐标。
- * @param {Object} [options.cache] - 缓存。
- * @param {Object} [options.charts] - 图表。
- * @param {string} [options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
- * @param {number} [options.opacity=1] - 图层透明度。
- * @param {Array} [options.TFEvents] - 专题要素事件临时存储。专题要素事件临时存储。
- * @param {Object} options.chartsSetting - 各类型图表的 chartsSetting 对象可设属性请参考具体图表模型类的注释中对 chartsSetting 对象可设属性的描述。chartsSetting 对象通常都具有以下 5 个基础可设属性:</br>
- * @param {number} options.chartsSetting.width - 专题要素(图表)宽度。
- * @param {number} options.chartsSetting.height - 专题要素(图表)高度。
- * @param {Array.<number>} options.chartsSetting.codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
- * @param {number} [options.chartsSetting.XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位为像素。
- * @param {number} [options.chartsSetting.YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位为像素。
- * @param {Array.<number>} [options.chartsSetting.dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值,长度为 4 的一维数组。
- * @param {number} [options.chartsSetting.decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
- * @param {string} [options.attribution='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>'] - 版权描述信息。
- * @usage
- */
- var GraphThemeLayer = ThemeLayer.extend({
- options: {
- //是否进行压盖处理,如果设为 true,图表绘制过程中将隐藏对已在图层中绘制的图表产生压盖的图表,默认值:true。
- isOverLay: true
- },
- initialize: function (name, chartsType, options) {
- var newArgs = [];
- newArgs.push(name);
- newArgs.push(options);
- ThemeLayer.prototype.initialize.apply(this, newArgs);
- this.chartsType = chartsType;
- this.themeFields = options && options.themeFields ? options.themeFields : null;
- this.charts = options && options.charts ? options.charts : [];
- this.cache = options && options.cache ? options.cache : {};
- this.chartsSetting = options && options.chartsSetting ? options.chartsSetting : {};
- },
- /**
- * @function GraphThemeLayer.prototype.setChartsType
- * @description 设置图表类型,此函数可动态改变图表类型。在调用此函数前请通过 chartsSetting 为新类型的图表做相关配置。图表类型,目前支持:"Bar", "Bar3D", "Line","Point","Pie","Ring"。
- * @param {string} chartsType - 图表类型。目前可用:"Bar", "Bar3D", "Line","Point","Pie","Ring"。
- */
- setChartsType: function (chartsType) {
- this.chartsType = chartsType;
- this.redraw();
- },
- /**
- * @function GraphThemeLayer.prototype.addFeatures
- * @description 向专题图图层中添加数据。
- * @param {(Array.<ServerFeature>|Array.<ThemeFeature>|Array.<GeoJSONObject>|ServerFeature|ThemeFeature|GeoJSONObject)} features - 待添加的要素。
- */
- addFeatures: function (features) {
- var me = this;
- /**
- * @event GraphThemeLayer#beforefeaturesadded
- * @description 向专题图图层中添加数据之前触发。
- * @property {(Array.<ServerFeature>|Array.<ThemeFeature>|Array.<GeoJSONObject>|ServerFeature|ThemeFeature|GeoJSONObject)} features - 待添加的要素。
- */
- me.fire("beforefeaturesadded", {features: features});
- //转换 features 形式
- this.features = this.toiClientFeature(features);
- //绘制专题要素
- if (!me.renderer) {
- return;
- }
- if (me._map) {
- me.redrawThematicFeatures(me._map.getBounds());
- } else {
- me.redrawThematicFeatures();
- }
- },
- /**
- * @function GraphThemeLayer.prototype.redrawThematicFeatures
- * @description 重绘所有专题要素 此方法包含绘制专题要素的所有步骤,包含用户数据到专题要素的转换,压盖处理,缓存等步骤。地图漫游时调用此方法进行图层刷新。
- * @param {L.Bounds} bounds - 重绘的范围。
- */
- redrawThematicFeatures: function (bounds) {
- var me = this;
- //清除当前所有可视元素
- me.renderer.clearAll();
- var features = me.features;
- if (this.options.alwaysMapCRS && bounds && bounds instanceof (external_L_default()).LatLngBounds) {
- var crs = this._map.options.crs;
- bounds = external_L_default().bounds(crs.project(bounds.getSouthWest()), crs.project(bounds.getNorthEast()));
- }
- bounds = CommontypesConversion.toSuperMapBounds(bounds);
- for (var i = 0, len = features.length; i < len; i++) {
- var feature = features[i];
- // 要素范围判断
- var feaBounds = feature.geometry.getBounds();
- //剔除当前视图(地理)范围以外的数据
- if (bounds && !bounds.intersectsBounds(feaBounds)) {
- continue;
- }
- var cache = me.cache;
- // 用feature id 做缓存标识
- var cacheField = feature.id;
- // 数据对应的图表是否已缓存,没缓存则重新创建图表
- if (!cache[cacheField]) {
- cache[cacheField] = cacheField;
- var chart = me.createThematicFeature(feature);
- // 压盖处理权重值
- var isValidOverlayWeightField = me.overlayWeightField
- && feature.attributes[me.overlayWeightField]
- && !isNaN(feature.attributes[me.overlayWeightField]);
- if (chart && isValidOverlayWeightField) {
- chart["__overlayWeight"] = feature.attributes[me.overlayWeightField];
- }
- if (chart) {
- me.charts.push(chart);
- }
- }
- }
- me.drawCharts();
- },
- /**
- * @function GraphThemeLayer.prototype.createThematicFeature
- * @description 创建专题要素(图表)。
- * @param {Object} feature - 待创建的要素。
- */
- createThematicFeature: function (feature) {
- var me = this;
- var thematicFeature;
- // 检查图表创建条件并创建图形
- if (Theme_Theme[me.chartsType] && me.themeFields && me.chartsSetting) {
- thematicFeature = new Theme_Theme[me.chartsType](feature, me, me.themeFields, me.chartsSetting);
- }
- // thematicFeature 是否创建成功
- if (!thematicFeature) {
- return false
- }
- // 对专题要素执行图形装载
- thematicFeature.assembleShapes();
- return thematicFeature;
- },
- /**
- * @function GraphThemeLayer.prototype.drawCharts
- * @description 绘制图表。包含压盖处理。
- */
- drawCharts: function () {
- var me = this;
- if (!me.renderer) {
- return;
- }
- // 图表权重值处理
- if (me.overlayWeightField) {
- me._sortChart();
- }
- if (me.options && !me.options.isOverLay) {
- // 不进行避让
- me._addOverlayShape();
- } else {
- //进行避让
- me._addNoOverlayShape();
- }
- // 绘制图形
- me.renderer.render();
- },
- /**
- * @function GraphThemeLayer.prototype.getShapesByFeatureID
- * @description 通过 FeatureID 获取 feature 关联的所有图形。如果不传入此参数,函数将返回所有图形。
- * @param {number} featureID - 要素 ID。
- */
- getShapesByFeatureID: function (featureID) {
- var me = this, list = [];
- var shapeList = me.renderer.getAllShapes();
- if (!featureID) {
- return shapeList;
- }
- for (var i = 0, len = shapeList.length; i < len; i++) {
- var si = shapeList[i];
- if (si.refDataID && featureID === si.refDataID) {
- list.push(si);
- }
- }
- return list;
- },
- /**
- * @function GraphThemeLayer.prototype.isQuadrilateralOverLap
- * @description 判断两个四边形是否有压盖。
- * @param {Array.<Object>} quadrilateral - 四边形节点数组。
- * @example
- * [{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}];
- * @param {Array.<Object>} quadrilateral2 - 第二个四边形节点数组。
- */
- isQuadrilateralOverLap: function (quadrilateral, quadrilateral2) {
- var me = this;
- var quadLen = quadrilateral.length,
- quad2Len = quadrilateral2.length;
- if (quadLen !== 5 || quad2Len !== 5) {
- return null;
- }//不是四边形
- var OverLap = false;
- //如果两四边形互不包含对方的节点,则两个四边形不相交
- for (var i = 0; i < quadLen; i++) {
- if (me.isPointInPoly(quadrilateral[i], quadrilateral2)) {
- OverLap = true;
- break;
- }
- }
- for (let i = 0; i < quad2Len; i++) {
- if (me.isPointInPoly(quadrilateral2[i], quadrilateral)) {
- OverLap = true;
- break;
- }
- }
- //加上两矩形十字相交的情况
- for (let i = 0; i < quadLen - 1; i++) {
- if (OverLap) {
- break;
- }
- for (let j = 0; j < quad2Len - 1; j++) {
- var isLineIn = Util.lineIntersection(quadrilateral[i], quadrilateral[i + 1], quadrilateral2[j], quadrilateral2[j + 1]);
- if (isLineIn.CLASS_NAME === "SuperMap.Geometry.Point") {
- OverLap = true;
- break;
- }
- }
- }
- return OverLap;
- },
- /**
- * @function GraphThemeLayer.prototype.isPointInPoly
- * @description 判断一个点是否在多边形里面(射线法)。
- * @param {Object} pt - 需要判定的点对象,该对象含有属性 x(横坐标),属性 y(纵坐标)。
- * @param {Array.<Object>} poly - 多边形节点数组。
- * 例如一个四边形:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
- */
- isPointInPoly: function (pt, poly) {
- for (var isIn = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i) {
- ((poly[i].y <= pt.y && pt.y < poly[j].y) || (poly[j].y <= pt.y && pt.y < poly[i].y))
- && (pt.x < (poly[j].x - poly[i].x) * (pt.y - poly[i].y) / (poly[j].y - poly[i].y) + poly[i].x)
- && (isIn = !isIn);
- }
- return isIn;
- },
- /**
- * @function GraphThemeLayer.prototype.isChartInMap
- * @description 判断图表是否在地图里。
- * @param {Bounds} mapPxBounds - 地图像素范围。
- * @param {Array.<Object>} chartPxBounds - 图表范围的四边形节点数组。
- * 例如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
- */
- isChartInMap: function (mapPxBounds, chartPxBounds) {
- var mb = mapPxBounds;
- var isIn = false;
- for (var i = 0, len = chartPxBounds.length; i < len; i++) {
- var cb = chartPxBounds[i];
- if (cb.x >= mb.left && cb.x <= mb.right && cb.y >= mb.top && cb.y <= mb.bottom) {
- isIn = true;
- break;
- }
- }
- return isIn;
- },
- /**
- * @function GraphThemeLayer.prototype.clearCache
- * @description 清除缓存数据。
- */
- clearCache: function () {
- this.cache = {};
- this.charts = [];
- },
- /**
- * @function GraphThemeLayer.prototype.removeFeatures
- * @description 从专题图中删除 feature。这个函数删除所有传递进来的矢量要素(数据)。
- * @param {(Array.<FeatureVector>|FeatureVector|Function)} features - 待删除的要素或用于条件删除的回调函数。
- */
- removeFeatures: function (features) { // eslint-disable-line no-unused-vars
- var me = this;
- me.clearCache();
- ThemeLayer.prototype.removeFeatures.call(me, features);
- },
- /**
- * @function GraphThemeLayer.prototype.removeAllFeatures
- * @description 清除当前图层所有的矢量要素。
- */
- removeAllFeatures: function () {
- var me = this;
- me.clearCache();
- ThemeLayer.prototype.removeAllFeatures.apply(me, arguments);
- },
- /**
- * @function GraphThemeLayer.prototype.redraw
- * @description 重绘该图层,成功则返回 true,否则返回 false。
- */
- redraw: function () {
- var me = this;
- me.clearCache();
- return ThemeLayer.prototype.redraw.apply(me, arguments);
- },
- /**
- * @function GraphThemeLayer.prototype.clear
- * @description 清除图层。清除的内容包括数据(features) 、专题要素、缓存。
- */
- clear: function () {
- var me = this;
- if (me.renderer) {
- me.renderer.clearAll();
- me.renderer.refresh();
- }
- me.removeAllFeatures();
- me.clearCache();
- },
- /**
- * @function GraphThemeLayer.prototype.getWeightFieldValue
- * @description 获取权重字段的值。
- * @param {FeatureVector} feature - 矢量要素。
- * @param {Array.<string>} weightField - 字段名数组。
- * @param {number} defaultValue - 当通过 weightField 获取不到权重值时,使用 defaultValue 作为权重值。
- */
- getWeightFieldValue: function (feature, weightField, defaultValue) {
- if (typeof(defaultValue) === "undefined" || isNaN(defaultValue)) {
- defaultValue = 0;
- }
- if (!feature.attributes) {
- return defaultValue;
- }
- var fieldValue = feature.attributes[weightField];
- if (typeof(fieldValue) === "undefined" || isNaN(fieldValue)) {
- fieldValue = defaultValue
- }
- return fieldValue;
- },
- _sortChart: function () {
- var me = this;
- if (!me.charts) {
- return;
- }
- me.charts.sort(function (cs, ce) {
- if (typeof(cs["__overlayWeight"]) === "undefined" && typeof(ce["__overlayWeight"]) === "undefined") {
- return 0;
- } else if (typeof(cs["__overlayWeight"]) !== "undefined" && typeof(ce["__overlayWeight"]) === "undefined") {
- return -1;
- } else if (typeof(cs["__overlayWeight"]) === "undefined" && typeof(ce["__overlayWeight"]) !== "undefined") {
- return 1;
- } else if (typeof(cs["__overlayWeight"]) !== "undefined" && typeof(ce["__overlayWeight"]) !== "undefined") {
- return (parseFloat(cs["__overlayWeight"]) < parseFloat(ce["__overlayWeight"])) ? 1 : -1;
- }
- return 0;
- });
- },
- _addOverlayShape: function () {
- var me = this;
- var charts = me.charts;
- for (var m = 0, len_m = charts.length; m < len_m; m++) {
- var chart_m = charts[m];
- // 图形参考位置 (reSetLocation 会更新 chartBounds)
- var shapeROP_m = chart_m.resetLocation();
- // 添加图形
- var shapes_m = chart_m.shapes;
- for (var n = 0, slen_n = shapes_m.length; n < slen_n; n++) {
- shapes_m[n].refOriginalPosition = shapeROP_m;
- me.renderer.addShape(shapes_m[n]);
- }
- }
- },
- _addNoOverlayShape: function () {
- var me = this;
- // 压盖判断所需 chartsBounds 集合
- var mapBounds = me._map.getBounds();
- var crs = this._map.options.crs;
- if (this.options.alwaysMapCRS) {
- mapBounds = external_L_default().bounds(crs.project(mapBounds.getSouthWest()), crs.project(mapBounds.getNorthEast()));
- }
- mapBounds = CommontypesConversion.toSuperMapBounds(mapBounds);
- var charts = me.charts;
- var chartsBounds = [];
- // 获取地图像素 bounds
- var mapPxLT = me.getLocalXY(new LonLat(mapBounds.left, mapBounds.top));
- var mapPxRB = me.getLocalXY(new LonLat(mapBounds.right, mapBounds.bottom));
- var mBounds = new Bounds(mapPxLT[0], mapPxRB[1], mapPxRB[0], mapPxLT[1]);
- // 压盖处理 & 添加图形
- for (var i = 0, len = charts.length; i < len; i++) {
- var chart = charts[i];
- // 图形参考位置 (reSetLocation 会更新 chartBounds)
- var shapeROP = chart.resetLocation();
- // 图表框
- var cbs = chart.chartBounds;
- var cBounds = [
- {"x": cbs.left, "y": cbs.top},
- {"x": cbs.left, "y": cbs.bottom},
- {"x": cbs.right, "y": cbs.bottom},
- {"x": cbs.right, "y": cbs.top},
- {"x": cbs.left, "y": cbs.top}
- ];
- // 地图范围外不绘制
- if (mBounds && !me.isChartInMap(mBounds, cBounds)) {
- continue;
- }
- // 是否压盖
- var isOverlay = false;
- for (let j = 0; j < chartsBounds.length; j++) {
- //压盖判断
- if (me.isQuadrilateralOverLap(cBounds, chartsBounds[j])) {
- isOverlay = true;
- break;
- }
- }
- if (isOverlay) {
- continue;
- } else {
- chartsBounds.push(cBounds);
- }
- // 添加图形
- var shapes = chart.shapes;
- for (let j = 0, slen = shapes.length; j < slen; j++) {
- shapes[j].refOriginalPosition = shapeROP;
- me.renderer.addShape(shapes[j]);
- }
- }
- }
- });
- var graphThemeLayer = function (name, chartsType, options) {
- return new GraphThemeLayer(name, chartsType, options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/RankSymbolThemeLayer.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class RankSymbolThemeLayer
- * @deprecatedclassinstance L.supermap.rankSymbolThemeLayer
- * @category Visualization Theme
- * @classdesc 符号专题图图层。符号专题图通过为每个要素绘制符号大小来反映其对应的专题值的大小;它只能表示单个字段属性信息。
- * 符号专题图多用于具有相关数量特征的地图上,比如表示不同地区粮食产量、GDP、人口等。
- * 即通过制作一个符号专题图,就可以清晰展示各个区域相关 Value 的分布差异等。
- * 目前提供的符号图形有:圆形(后续进行扩展、心形、五角星、多角心、图片等)。
- * @extends {GraphThemeLayer}
- * @param {string} name - 专题图层名。
- * @param {ChartType} symbolType - 符号类型。目前支持:'Circle'。
- * @param {Object} options - 参数。
- * @param {boolean} [options.isOverLay=true] - 是否进行压盖处理,如果设为 true,表示在图表绘制过程中隐藏对已存在的图表产生压盖的图表。
- * @param {string} options.themeFields - 指定创建专题图字段。
- * @param {boolean} [options.alwaysMapCRS=false] - 要素坐标是否和地图坐标系一致,要素默认是经纬度坐标。
- * @param {string} [options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
- * @param {number} [options.opacity=1] - 图层透明度。
- * @param {Array} [options.TFEvents] - 专题要素事件临时存储。
- * @param {string} [options.attribution='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>'] - 版权描述信息。
- * @usage
- */
- var RankSymbolThemeLayer = GraphThemeLayer.extend({
- /**
- * @member {Object} RankSymbolThemeLayer.prototype.symbolSetting
- * @description 符号 Circle 配置对象。
- * @property {Array} codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
- * @property {number} [maxR] - 圆形的最大半径。
- * @property {number} [minR] - 圆形的最小半径。
- * @property {string} [fillColor] - 圆形的填充色,如:fillColor: "#FFB980"。
- * @property {Object} [circleStyle] - 圆形的基础 style,此参数控制圆形基础样式,优先级低于 circleStyleByFields 和 circleStyleByCodomain。
- * @property {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
- * @property {Object} [circleHoverStyle] - 圆形 hover 状态时的样式,circleHoverAble 为 true 时有效。
- * @property {boolean} [circleHoverAble=true] - 是否允许圆形使用 hover 状态。同时设置 circleHoverAble 和 circleClickAble 为 false,可以直接屏蔽图形对专题图层事件的响应。
- * @property {boolean} [circleClickAble=true] - 是否允许圆形被点击。同时设置 circleHoverAble 和 circleClickAble 为 false,可以直接屏蔽图形对专题图层事件的响应。
- */
- initialize: function (name, symbolType, options) { // eslint-disable-line no-unused-vars
- GraphThemeLayer.prototype.initialize.apply(this, arguments);
- this.symbolType = symbolType;
- this.symbolSetting = {};
- },
- /**
- * @function RankSymbolThemeLayer.prototype.setSymbolType
- * @description 设置符号类型,此函数可动态改变图表类型。在调用此函数前请通过 symbolSetting 为新类型的图表做相关配置。
- * @param {ChartType} symbolType - 目前支持:'Circle'。
- *
- */
- //todo 这里怎么又是supermap的类型
- setSymbolType: function (symbolType) {
- this.symbolType = symbolType;
- this.redraw();
- },
- /**
- * @private
- * @function RankSymbolThemeLayer.prototype.createThematicFeature
- * @description 创建专题要素(图形)。
- * @param {FeatureVector} feature - 要创建的专题图形要素。
- * @returns {FeatureTheme} 专题图形。
- */
- createThematicFeature: function (feature) {
- var me = this;
- var thematicFeature;
- // 检查图形创建条件并创建图形
- if (Theme_Theme[me.symbolType] && me.themeField && me.symbolSetting) {
- thematicFeature = new Theme_Theme[me.symbolType](feature, me, [me.themeField], me.symbolSetting);
- }
- // thematicFeature 是否创建成功
- if (!thematicFeature) {
- return false;
- }
- // 对专题要素执行图形装载
- thematicFeature.assembleShapes();
- return thematicFeature;
- }
- });
- var rankSymbolThemeLayer = function (name, symbolType, options) {
- return new RankSymbolThemeLayer(name, symbolType, options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/vectortile/SVGRenderer.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class SVGRenderer
- * @classdesc 矢量图层缩放渲染器类。
- * @category Visualization VectorTile
- * @private
- * @extends {L.SVG}
- * @param {Object} tileCoord - 切片坐标系。
- * @param {number} tileSize - 切片大小。
- * @param {Object} options - 渲染器参数。
- */
- var SVGRenderer = external_L_default().SVG.extend({
- initialize: function (tileCoord, tileSize, options) {
- external_L_default().SVG.prototype.initialize.call(this, options);
- this._tileCoord = tileCoord;
- this._size = tileSize;
- this._initContainer();
- this._container.setAttribute('width', this._size.x);
- this._container.setAttribute('height', this._size.y);
- this._container.setAttribute('viewBox', [0, 0, this._size.x, this._size.y].join(' '));
- this._layers = {};
- },
- /**
- * @function SVGRenderer.prototype.getCoord
- * @description 获取坐标。
- */
- getCoord: function () {
- return this._tileCoord;
- },
- /**
- * @function SVGRenderer.prototype.getContainer
- * @description 获取容器。
- */
- getContainer: function () {
- return this._container;
- },
- onAdd: (external_L_default()).Util.falseFn,
- /**
- * @function SVGRenderer.prototype.addTo
- * @description 添加到地图。
- * @param {L.Map} map - Leaflet Map 对象。
- */
- addTo: function (map) {
- this._map = map;
- if (this.options.interactive) {
- for (var i in this._layers) {
- var layer = this._layers[i];
- layer._path.style.pointerEvents = 'auto';
- this._map._targets[external_L_default().stamp(layer._path)] = layer;
- }
- }
- },
- /**
- * @function SVGRenderer.prototype.removeFrom
- * @description 从地图移除。
- * @param {L.Map} map - Leaflet Map 对象。
- */
- removeFrom: function (map) {
- var _map = map || this._map;
- if (this.options.interactive) {
- for (var i in this._layers) {
- var layer = this._layers[i];
- delete _map._targets[external_L_default().stamp(layer._path)];
- }
- }
- delete this._map;
- },
- _addPath: function (layer) {
- if (!this._rootGroup) {
- this._initContainer();
- }
- if (!this._rootGroup) {
- this._rootGroup = this._container;
- }
- this._rootGroup.appendChild(layer._path);
- this._layers[external_L_default().stamp(layer)] = layer;
- },
- _updateIcon: function (layer) {
- var path = layer._path = external_L_default().SVG.create('image'),
- options = layer.options,
- iconUrl = options.iconUrl;
- if (options.iconSize) {
- var size = external_L_default().point(options.iconSize),
- anchor = size && size.divideBy(2, true),
- p = layer._point.subtract(anchor);
- path.setAttribute('x', p.x);
- path.setAttribute('y', p.y);
- path.setAttribute('width', size.x + 'px');
- path.setAttribute('height', size.y + 'px');
- } else {
- var img = new Image();
- img.src = iconUrl;
- external_L_default().DomEvent.on(img, 'load', function () {
- var size = external_L_default().point([img.width, img.height]),
- anchor = size && size.divideBy(2, true),
- p = layer._point.subtract(anchor);
- path.setAttribute('x', p.x);
- path.setAttribute('y', p.y);
- path.setAttribute('width', size.x + 'px');
- path.setAttribute('height', size.y + 'px');
- });
- }
- path.setAttribute('href', iconUrl);
- }
- });
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/vectortile/CanvasRenderer.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class CanvasRenderer
- * @private
- * @classdesc 画布渲染器。
- * @category Visualization VectorTile
- * @extends {L.Canvas}
- * @param {Object} tileCoord - 切片坐标系。
- * @param {number} tileSize - 切片大小。
- * @param {Object} options - 渲染器参数。
- */
- var CanvasRenderer = external_L_default().Canvas.extend({
- initialize: function (tileCoord, tileSize, options) {
- external_L_default().Canvas.prototype.initialize.call(this, options);
- this._tileCoord = tileCoord;
- this._size = tileSize;
- this._initContainer();
- this._container.setAttribute('width', this._size.x);
- this._container.setAttribute('height', this._size.y);
- this._layers = {};
- this._drawnLayers = {};
- this._drawing = true;
- if (options.interactive) {
- this._container.style.pointerEvents = 'auto';
- }
- },
- /**
- * @function CanvasRenderer.prototype.getCoord
- * @description 获取坐标。
- */
- getCoord: function () {
- return this._tileCoord;
- },
- /**
- * @function CanvasRenderer.prototype.getContainer
- * @description 获取容器。
- */
- getContainer: function () {
- return this._container;
- },
- /**
- * @function CanvasRenderer.prototype.getOffset
- * @description 停止渲染。
- */
- getOffset: function () {
- return this._tileCoord.scaleBy(this._size).subtract(this._map.getPixelOrigin());
- },
- onAdd: (external_L_default()).Util.falseFn,
- /**
- * @function CanvasRenderer.prototype.addTo
- * @description 添加到地图。
- * @param {L.Map} map - Leaflet Map 对象。
- */
- addTo: function (map) {
- this._map = map;
- },
- /**
- * @function CanvasRenderer.prototype.removeFrom
- * @description 从地图移除。
- * @param {L.Map} map - Leaflet Map 对象。
- */
- removeFrom: function (map) { // eslint-disable-line no-unused-vars
- delete this._map;
- },
- _updateDashArray: function (layer) {
- var array = layer.options.dashArray;
- if (array && typeof array === "string") {
- var parts = array.split(','),
- dashArray = [],
- i;
- for (i = 0; i < parts.length; i++) {
- dashArray.push(Number(parts[i]));
- }
- layer.options._dashArray = dashArray;
- } else {
- layer.options._dashArray = array;
- }
- },
- _onClick: function (e) {
- var point = this._map.mouseEventToLayerPoint(e).subtract(this.getOffset()), layer, clickedLayer;
- for (var id in this._layers) {
- layer = this._layers[id];
- if (layer.options.interactive && layer._containsPoint(point) && !this._map._draggableMoved(layer)) {
- clickedLayer = layer;
- }
- }
- if (clickedLayer) {
- external_L_default().DomEvent.stop(e);
- this._fireEvent([clickedLayer], e);
- }
- },
- _onMouseMove: function (e) {
- if (!this._map || this._map.dragging.moving() || this._map._animatingZoom) {
- return;
- }
- var point = this._map.mouseEventToLayerPoint(e).subtract(this.getOffset());
- this._handleMouseHover(e, point);
- },
- _updateIcon: function (layer) {
- if (!this._drawing) {
- return;
- }
- var options = layer.options,
- ctx = this._ctx,
- img = layer._getImage();
- if (options.iconSize && img.complete) {
- var size = external_L_default().point(options.iconSize),
- anchor = size && size.divideBy(2, true),
- p = layer._point.subtract(anchor);
- ctx.drawImage(img, p.x, p.y, size.x, size.y);
- } else {
- external_L_default().DomEvent.on(img, 'load', function () {
- var size = external_L_default().point([img.width, img.height]),
- anchor = size && size.divideBy(2, true),
- p = layer._point.subtract(anchor);
- ctx.drawImage(img, p.x, p.y, size.x, size.y);
- });
- }
- this._drawnLayers[layer._leaflet_id] = layer;
- }
- });
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/vectortile/VectorFeatureType.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @constant VectorFeatureType
- * @description 矢量图层要素类型,和 SuperMap.CartoStyleMap 中的类型相对应。
- * @category Visualization VectorTile
- * @private
- */
- var VectorFeatureType = {
- LABEL: "LABEL",//label实际处理成TEXT
- TEXT: "TEXT",
- POINT: "POINT",
- LINE: "LINE",
- REGION: "REGION"
- };
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/vectortile/Symbolizer.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class Symbolizer
- * @description 符号类。
- * @category Visualization VectorTile
- * @private
- * @extends {L.Class}
- * @param {Object} feature — 要素。
- */
- var Symbolizer = external_L_default().Class.extend({
- initialize: function (feature) {
- this.properties = feature.properties;
- this.type = feature.type;
- this.layerName = feature.layerName;
- },
- /**
- * @function Symbolizer.prototype.render
- * @description 绘制线符号。
- * @param {Object} renderer - 渲染器。
- * @param {string} style - 符号样式。
- */
- render: function (renderer, style) {
- this._renderer = renderer;
- this._container = renderer._container;
- this.options = style;
- renderer._initPath(this);
- renderer._updateStyle(this);
- var elem = this.getElement();
- if (elem && this.layerName) {
- external_L_default().DomUtil.addClass(elem, this.layerName);
- }
- },
- /**
- * @function Symbolizer.prototype.updateStyle
- * @description 更新符号样式。
- * @param {Object} renderer - 渲染器。
- * @param {string} style - 符号样式。
- */
- updateStyle: function (renderer, style) {
- this.options = style;
- renderer._updateStyle(this);
- },
- /**
- * @function Symbolizer.prototype.getElement
- * @description 获取文本信息。
- */
- getElement: function () {
- return this._path || this._renderer._container;
- },
- _getPixelBounds: function () {
- var parts = this._parts;
- var bounds = external_L_default().bounds([]);
- for (var i = 0; i < parts.length; i++) {
- var part = parts[i];
- for (var j = 0; j < part.length; j++) {
- bounds.extend(part[j]);
- }
- }
- var w = this._clickTolerance(),
- p = new (external_L_default()).Point(w, w);
- bounds.min._subtract(p);
- bounds.max._add(p);
- return bounds;
- },
- _clickTolerance: (external_L_default()).Path.prototype._clickTolerance
- });
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/vectortile/TextSymbolizer.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class TextSymbolizer
- * @classdesc 文本符号类。
- * @category Visualization VectorTile
- * @private
- * @extends {L.Path}
- * @param {Object} feature - 要素。
- * @param {number} pxPerExtent - 文本符号大小。
- */
- var TextSymbolizer = external_L_default().Path.extend({
- /**
- * @member TextSymbolizer.prototype.includes
- * @description 包含的符号。
- */
- includes: Symbolizer.prototype,
- options: {
- color: 'white',
- fillColor: 'black',
- fill: true,
- fillOpacity: 1,
- opacity: 0.6,
- weight: 1,
- rotation: 0.0,
- stroke: true,
- fontFamily: "Arial Unicode MS Regular",
- fontSize: 14,
- fontWeight: 'normal',
- textAlign: 'center',
- offsetX: 1,
- offsetY: 1
- },
- initialize: function (feature, pxPerExtent) {
- Symbolizer.prototype.initialize.call(this, feature);
- this._makeFeatureParts(feature, pxPerExtent);
- this.options.offsetX = pxPerExtent || 1;
- this.options.offsetY = pxPerExtent || 1;
- },
- /**
- * @function TextSymbolizer.prototype.render
- * @description 绘制点符号。
- * @param {Object} renderer - 渲染器。
- * @param {string} style - 符号样式。
- */
- render: function (renderer, style) {
- //原本类型就是text的情况
- if (this.properties.texts) {
- this._text = this.properties.texts[0];
- }
- //类型是label的情况
- if (!this._text) {
- var attributes = this.properties.attributes;
- this._text = (attributes && this.properties.textField) ?
- attributes[this.properties.textField] || "" : "";
- }
- var options = this.options;
- this._pxBounds = external_L_default().bounds(this._point, this._point);
- Symbolizer.prototype.render.apply(this, [renderer, style]);
- this.options = external_L_default().Util.extend(options, style);
- this._updatePath();
- },
- _makeFeatureParts: function (feat, pxPerExtent) {
- pxPerExtent = pxPerExtent || {x: 1, y: 1};
- var coord = feat.geometry[0];
- if (typeof coord[0] === 'object' && 'x' in coord[0]) {
- this._point = external_L_default().point(coord[0]).scaleBy(pxPerExtent);
- this._empty = (external_L_default()).Util.falseFn;
- } else {
- this._point = external_L_default().point(coord).scaleBy(pxPerExtent);
- this._empty = (external_L_default()).Util.falseFn;
- }
- },
- /**
- * @function TextSymbolizer.prototype.makeInteractive
- * @description 设置交互。
- */
- makeInteractive: function () {
- this._updateBounds();
- },
- /**
- * @function TextSymbolizer.prototype.updateStyle
- * @description 更新符号样式。
- * @param {Object} renderer - 渲染器。
- * @param {string} style - 符号样式。
- */
- updateStyle: function (renderer, style) {
- this._updateBounds();
- return Symbolizer.prototype.updateStyle.call(this, renderer, style);
- },
- _updateBounds: function () {
- var w = this._renderer._getTextWidth(this);
- var p = [w / 2, w / 2];
- this._pxBounds = external_L_default().bounds(this._point.subtract(p), this._point.add(p));
- },
- _updatePath: function () {
- this._renderer._updateText(this);
- },
- _containsPoint: function (point) { // eslint-disable-line no-unused-vars
- return false;
- }
- });
- CanvasRenderer.include({
- _getTextWidth: function (layer) {
- return this._ctx.measureText(layer._text).width;
- },
- _updateText: function (layer) {
- if (!this._drawing || layer._empty()) {
- return;
- }
- var container = this.getContainer();
- var size = this._map.getSize();
- container.width = size.x;
- container.height = size.y;
- container.style.width = size.x + 'px';
- container.style.height = size.y + 'px';
- var ctx = this._ctx,
- options = layer.options,
- offsetX = options.offsetX || 1,
- offsetY = options.offsetY || 1,
- p = layer._point.subtract(external_L_default().point(offsetX, offsetY));
- if (!options.fill) {
- return;
- }
- this._drawnLayers[layer._leaflet_id] = layer;
- ctx.fillRect(0, 0, size.x, size.y);
- ctx.font = [
- options.fontWeight ? options.fontWeight : "normal",
- options.fontSize ? options.fontSize : "14px",
- options.fontFamily ? options.fontFamily : "Arial Unicode MS Regular,Microsoft Yahei"
- ].join(" ");
- ctx.textAlign = options.textAlign;
- ctx.lineWidth = options.weight;
- ctx.fillStyle = options.fillColor;
- ctx.fillText(layer._text, p.x, p.y);
- ctx.strokeStyle = options.color;
- ctx.strokeText(layer._text, p.x, p.y);
- ctx.rotate(options.rotation);
- }
- });
- SVGRenderer.include({
- _getTextWidth: function (layer) {
- return layer._path.getComputedTextLength() || 0;
- },
- _initPath: function (layer) {
- var path;
- if (TextSymbolizer && layer instanceof TextSymbolizer) {
- path = layer._path = external_L_default().SVG.create("text");
- path.textContent = layer._text;
- } else {
- path = layer._path = external_L_default().SVG.create("path");
- }
- if (layer.options.className) {
- external_L_default().DomUtil.addClass(path, layer.options.className);
- }
- if (layer.options.interactive) {
- external_L_default().DomUtil.addClass(path, 'leaflet-interactive');
- }
- this._updateStyle(layer);
- this._layers[external_L_default().stamp(layer)] = layer;
- },
- _updateText: function (layer) {
- var path = layer._path,
- options = layer.options,
- offsetX = options.offsetX || 1,
- offsetY = options.offsetY || 1,
- p = layer._point.subtract(external_L_default().point(offsetX, offsetY));
- path.setAttribute('x', p.x);
- path.setAttribute('y', p.y);
- options.rotation = options.rotation || 0;
- path.setAttribute('transform', 'rotate(' + options.rotation / Math.PI * 180 + ' ' + p.x + ' ' + p.y + ')');
- path.setAttribute('text-anchor', options.textAlign === 'center' ? 'middle' : options.textAlign);
- path.style.fontSize = options.fontSize;
- path.style.fontFamily = options.fontFamily;
- path.style.fontWeight = options.fontWeight || "normal";
- path.style.glyphOrientationVertical = options.rotation||'';
- if (options.stroke) {
- path.setAttribute('stroke', options.color);
- path.setAttribute('stroke-linecap', 'round');
- path.setAttribute('stroke-linejoin', 'round');
- path.setAttribute('stroke-opacity', options.opacity);
- path.setAttribute('stroke-width', options.weight > 1 ? options.weight / 10 : options.weight);
- } else {
- path.setAttribute('stroke', 'none');
- }
- if (options.fill) {
- path.setAttribute('fill', options.fillColor || options.color);
- path.setAttribute('fill-opacity', options.fillOpacity);
- } else {
- path.setAttribute('fill', 'none');
- }
- }
- });
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/vectortile/PointSymbolizer.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class PointSymbolizer
- * @classdesc 点符号类。
- * @category Visualization VectorTile
- * @private
- * @extends {L.CircleMarker}
- * @param {Object} feature - 点要素。
- * @param {number} pxPerExtent - 点符号大小。
- */
- var PointSymbolizer = external_L_default().CircleMarker.extend({
- /**
- * @member PointSymbolizer.prototype.includes
- * @description 包含的符号。
- */
- includes: Symbolizer.prototype,
- statics: {
- iconCache: {}
- },
- initialize: function (feature, pxPerExtent) {
- Symbolizer.prototype.initialize.call(this, feature);
- this._makeFeatureParts(feature, pxPerExtent);
- },
- getLatLng: undefined,
- /**
- * @function PointSymbolizer.prototype.render
- * @description 绘制点符号。
- * @param {Object} renderer - 渲染器。
- * @param {string} style - 符号样式。
- */
- render: function (renderer, style) {
- Symbolizer.prototype.render.call(this, renderer, style);
- this._radius = style.radius || (external_L_default()).CircleMarker.prototype.options.radius;
- this._updatePath();
- },
- _makeFeatureParts: function (feat, pxPerExtent) {
- pxPerExtent = pxPerExtent || {x: 1, y: 1};
- var coord = feat.geometry[0];
- if (typeof coord[0] === 'object' && 'x' in coord[0]) {
- this._point = external_L_default().point(coord[0]).scaleBy(pxPerExtent);
- this._empty = (external_L_default()).Util.falseFn;
- } else {
- this._point = external_L_default().point(coord).scaleBy(pxPerExtent);
- this._empty = (external_L_default()).Util.falseFn;
- }
- },
- /**
- * @function PointSymbolizer.prototype.makeInteractive
- * @description 设置交互。
- */
- makeInteractive: function () {
- this._updateBounds();
- },
- /**
- * @function PointSymbolizer.prototype.updateStyle
- * @description 更新符号样式。
- * @param {Object} renderer - 渲染器。
- * @param {string} style - 符号样式。
- */
- updateStyle: function (renderer, style) {
- this._radius = style.radius || this._radius;
- this._updateBounds();
- return Symbolizer.prototype.updateStyle.call(this, renderer, style);
- },
- _updateBounds: function () {
- var icon = this.options.iconUrl;
- if (icon && this.options.iconSize) {
- var size = external_L_default().point(this.options.iconSize),
- anchor = size && size.divideBy(2, true),
- p = this._point.subtract(anchor);
- this._pxBounds = new (external_L_default()).Bounds(p, p.add(size));
- } else {
- external_L_default().CircleMarker.prototype._updateBounds.call(this);
- }
- },
- _updatePath: function () {
- if (this.options.iconUrl) {
- this._renderer._updateIcon(this)
- } else {
- external_L_default().CircleMarker.prototype._updatePath.call(this);
- }
- },
- _getImage: function () {
- if (!this.options.iconUrl) {
- return null;
- }
- var url = this.options.iconUrl,
- img = PointSymbolizer.iconCache[url];
- if (!img) {
- var iconSize = this.options.iconSize || [50, 50];
- img = PointSymbolizer.iconCache[url] = this._createIcon(url, iconSize);
- }
- return img;
- },
- _createIcon: function (url, iconSize) {
- var src = url;
- if (!src) {
- throw new Error('iconUrl not set in Icon options (see the docs).');
- }
- var img = document.createElement('img'), name = "icon";
- img.src = src;
- img.className = 'leaflet-marker-' + name + ' ' + (this.layerName || '');
- // var options = this.options;
- var sizeOption = iconSize;
- if (typeof sizeOption === 'number') {
- sizeOption = [sizeOption, sizeOption];
- }
- if (sizeOption) {
- var size = external_L_default().point(sizeOption),
- anchor = external_L_default().point(size && size.divideBy(2, true));
- if (size) {
- img.style.width = size.x + 'px';
- img.style.height = size.y + 'px';
- }
- if (anchor) {
- img.style.marginLeft = (-anchor.x) + 'px';
- img.style.marginTop = (-anchor.y) + 'px';
- }
- }
- img.onload = function () {
- if (!sizeOption) {
- img.style.width = this.width + 'px';
- img.style.height = this.height + 'px';
- }
- };
- return img;
- },
- _containsPoint: function (p) {
- var icon = this.options.iconUrl;
- if (icon) {
- return this._pxBounds.contains(p);
- } else {
- return external_L_default().CircleMarker.prototype._containsPoint.call(this, p);
- }
- }
- });
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/vectortile/SymbolizerPolyBase.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class PolyBase
- * @classdesc 多边形基类。
- * @category Visualization VectorTile
- * @private
- */
- //@type {{_makeFeatureParts: PolyBase._makeFeatureParts, makeInteractive: PolyBase.makeInteractive}}
- var PolyBase = {
- _makeFeatureParts: function (feat, pxPerExtent) {
- pxPerExtent = pxPerExtent || {x: 1, y: 1};
- var rings = feat.geometry;
- var coord;
- this._parts = [];
- for (var i = 0; i < rings.length; i++) {
- var ring = rings[i];
- var part = [];
- for (var j = 0; j < ring.length; j++) {
- coord = ring[j];
- part.push(external_L_default().point(coord).scaleBy(pxPerExtent));
- }
- this._parts.push(part);
- }
- },
- /**
- * @function PolyBase.prototype.makeInteractive
- * @description 设置交互。
- */
- makeInteractive: function () {
- this._pxBounds = this._getPixelBounds();
- }
- };
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/vectortile/LineSymbolizer.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class LineSymbolizer
- * @classdesc 线符号类。
- * @category Visualization VectorTile
- * @private
- * @extends {L.Polyline}
- * @param {Object} feature - 线要素。
- * @param {number} pxPerExtent - 线长。
- */
- var LineSymbolizer = external_L_default().Polyline.extend({
- /**
- * @member LineSymbolizer.prototype.includes
- * @description 包含符号。
- */
- includes: [Symbolizer.prototype, PolyBase],
- initialize: function (feature, pxPerExtent) {
- Symbolizer.prototype.initialize.call(this, feature);
- this._makeFeatureParts(feature, pxPerExtent);
- },
- /**
- * @function LineSymbolizer.prototype.render
- * @description 绘制线符号。
- * @param {Object} renderer - 渲染器。
- * @param {string} style - 符号样式。
- */
- render: function (renderer, style) {
- style.fill = false;
- Symbolizer.prototype.render.call(this, renderer, style);
- this._updatePath();
- },
- /**
- * @function LineSymbolizer.prototype.updateStyle
- * @description 更新符号样式。
- * @param {Object} renderer - 渲染器。
- * @param {string} style - 符号样式。
- */
- updateStyle: function (renderer, style) {
- style.fill = false;
- Symbolizer.prototype.updateStyle.call(this, renderer, style);
- }
- });
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/vectortile/RegionSymbolizer.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class RegionSymbolizer
- * @classdesc 面符号类。
- * @category Visualization VectorTile
- * @private
- * @extends {L.Polygon}
- * @param {Object} feature - 面要素。
- * @param {number} pxPerExtent - 面积像素大小。
- */
- var RegionSymbolizer = external_L_default().Polygon.extend({
- /**
- * @member RegionSymbolizer.prototype.includes
- * @description 包含的符号。
- */
- includes: [Symbolizer.prototype, PolyBase],
- initialize: function (feature, pxPerExtent) {
- Symbolizer.prototype.initialize.call(this, feature);
- this._makeFeatureParts(feature, pxPerExtent);
- },
- /**
- * @function RegionSymbolizer.prototype.render
- * @description 绘制面符号。
- * @param {Object} renderer - 渲染器。
- * @param {string} style - 符号样式。
- */
- render: function (renderer, style) {
- Symbolizer.prototype.render.call(this, renderer, style);
- this._updatePath();
- }
- });
- // EXTERNAL MODULE: ./node_modules/pbf/index.js
- var node_modules_pbf = __webpack_require__(614);
- var pbf_default = /*#__PURE__*/__webpack_require__.n(node_modules_pbf);
- // EXTERNAL MODULE: ./node_modules/@mapbox/vector-tile/index.js
- var vector_tile = __webpack_require__(929);
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/vectortile/VectorTilePBF.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class VectorTilePBF
- * @classdesc 矢量瓦片 PBF(MVT) 表述出图。
- * @category Visualization VectorTile
- * @private
- * @extends {L.Class}
- * @param {string} url - 服务地址。
- */
- var VectorTilePBF = external_L_default().Class.extend({
- initialize: function (url) {
- this.url = url;
- },
- /**
- * @function VectorTilePBF.prototype.getTile
- * @description 获取瓦片 PBF(MVT)。
- * @returns {Promise} 返回包含矢量瓦片信息的 Promise 对象。
- */
- getTile: function () {
- var me = this;
- return FetchRequest.get(me.url, null, {
- timeout: 10000
- }).then(function (response) {
- if (!response.ok) {
- return {layers: []};
- }
- return response.blob().then(function (blob) {
- var reader = new FileReader();
- return new Promise(function (resolve) {
- reader.addEventListener("loadend", function () {
- var pbf = new (pbf_default())(reader.result);
- return resolve(new vector_tile.VectorTile(pbf));
- });
- reader.readAsArrayBuffer(blob);
- });
- });
- }).then(function (json) {
- return me._processVectorTileSpec(json);
- });
- },
- _processVectorTileSpec: function (vectorTile) {
- var layers = [];
- for (var layerName in vectorTile.layers) {
- var feats = [];
- for (var i = 0; i < vectorTile.layers[layerName].length; i++) {
- var feat = vectorTile.layers[layerName].feature(i);
- feat.geometry = feat.loadGeometry();
- feat.layerName = layerName;
- feat.properties = {attributes: external_L_default().Util.extend({}, feat.properties), id: feat.id};
- switch (feat.type) {
- case 1:
- feat.type = VectorFeatureType.POINT;
- break;
- case 2:
- feat.type = VectorFeatureType.LINE;
- break;
- case 3:
- feat.type = VectorFeatureType.REGION;
- break;
- default:
- break;
- }
- feats.push(feat);
- }
- var layer = {};
- layer.features = feats;
- layer.layerName = layerName;
- layer.extent = vectorTile.layers[layerName].extent;
- layers.push(layer);
- }
- return layers;
- }
- });
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/vectortile/VectorTileJSON.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class VectorTileJSON
- * @classdesc iServer 矢量瓦片 JSON 表述出图。
- * @category Visualization VectorTile
- * @private
- * @extends {L.Class}
- * @param {string} url - 服务地址。
- */
- var VectorTileJSON = external_L_default().Class.extend({
- initialize: function (url) {
- this.url = url;
- },
- /**
- * @function VectorTileJSON.prototype.getTile
- * @description 获取瓦片。
- * @returns {Promise} 返回包含矢量瓦片信息的 Promise 对象。
- */
- getTile: function () {
- var me = this;
- return FetchRequest.get(me.url, null, {
- timeout: 10000
- }).then(function (response) {
- return response.json()
- }).then(function (json) {
- return me._processRecordSets(json, me);
- });
- },
- _processRecordSets: function (records, scope) {
- var recordsets = records.recordsets;
- // 如果iServer支持了tileFeature geojson表述则不需要此步骤
- recordsets = scope._convertToGeoJSON(recordsets);
- if (!recordsets) {
- return null;
- }
- //类似VT标准的数据格式,并为每个要素添加一个layerName字段
- for (var i = 0; i < recordsets.length; i++) {
- var recordset = recordsets[i];
- for (var j = 0; j < recordset.features.length; j++) {
- var feature = recordset.features[j];
- feature = scope._convertToVectorLayerFeature(feature, scope);
- feature.layerName = recordset.layerName;
- recordset.features[j] = feature;
- }
- recordset.extent = 256;
- delete recordset.fieldTypes;
- delete recordset.fields;
- }
- return recordsets;
- },
- _convertToVectorLayerFeature: function (feature, scope) {
- if (!feature.geometry) {
- return;
- }
- var newFeature = {};
- var geom = feature.geometry,
- type = geom.type,
- coords = geom.coordinates,
- tags = feature.properties,
- id = tags.id,
- i, j, rings, projectedRing;
- if (type === 'Point') {
- newFeature = (tags && tags.texts) ?
- scope._createFeature(id, VectorFeatureType.TEXT, [coords], tags) :
- scope._createFeature(id, VectorFeatureType.POINT, [coords], tags);
- } else if (type === 'MultiPoint') {
- newFeature = scope._createFeature(id, VectorFeatureType.POINT, coords, tags);
- } else if (type === 'LineString') {
- newFeature = scope._createFeature(id, VectorFeatureType.LINE, [coords], tags);
- } else if (type === 'MultiLineString' || type === 'Polygon') {
- rings = [];
- for (i = 0; i < coords.length; i++) {
- projectedRing = coords[i];
- if (type === 'Polygon') {
- projectedRing.outer = (i === 0);
- }
- rings.push(projectedRing);
- }
- var featureType = (type === 'Polygon') ?
- VectorFeatureType.REGION :
- VectorFeatureType.LINE;
- newFeature = scope._createFeature(id, featureType, rings, tags);
- } else if (type === 'MultiPolygon') {
- rings = [];
- for (i = 0; i < coords.length; i++) {
- for (j = 0; j < coords[i].length; j++) {
- projectedRing = coords[i][j];
- projectedRing.outer = (j === 0);
- rings.push(projectedRing);
- }
- }
- newFeature = scope._createFeature(id, VectorFeatureType.REGION, rings, tags);
- } else {
- throw new Error('Illegal GeoJSON object');
- }
- return newFeature;
- },
- _convertToGeoJSON: function (recordsets) {
- if (!recordsets) {
- return;
- }
- for (var i = 0; i < recordsets.length; i++) {
- var recordset = recordsets[i];
- for (var j = 0; j < recordset.features.length; j++) {
- var feature = recordset.features[j];
- var points = [];
- var startIndex = 0;
- for (var k = 0; k < feature.geometry.parts.length; k++) {
- var partPointsLength = feature.geometry.parts[k] * 2;
- for (var l = 0, index = startIndex; l < partPointsLength; l += 2, index += 2) {
- var x = feature.geometry.points[index];
- var y = feature.geometry.points[index + 1];
- points.push({x: x, y: y});
- }
- startIndex += partPointsLength;
- }
- feature.geometry.points = points;
- }
- recordset.features = toGeoJSON(recordset.features).features;
- }
- return recordsets;
- },
- _createFeature: function (id, type, geometry, properties) {
- return {
- id: id,
- type: type,
- geometry: geometry,
- properties: properties
- }
- }
- });
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/VectorTileFormat.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @enum VectorTileFormat
- * @category BaseTypes Constant
- * @description 矢量瓦片格式
- * @type {string}
- * @usage
- * ```
- * // 浏览器
- * <script type="text/javascript" src="{cdn}"></script>
- * <script>
- * const result = {namespace}.VectorTileFormat.JSON;
- *
- * </script>
- * // ES6 Import
- * import { VectorTileFormat } from '{npm}';
- *
- * const result = VectorTileFormat.JSON;
- * ```
- */
- var VectorTileFormat = {
- /** JSON */
- JSON: "JSON",
- /** MVT */
- MVT: "MVT",
- /** PBF */
- PBF: "PBF"
- };
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/vectortile/VectorTile.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class VectorTile
- * @classdesc 矢量瓦片图层基类。
- * @category Visualization VectorTile
- * @private
- * @extends {L.Class}
- * @param {Object} options - 参数。
- * @param {string} [options.layer] - 图层名称。
- * @param {(number|L.Point)} [options.tileSize=256] - 瓦片大小。
- * @param {string} [options.format] - 返回值类型。
- * @param {Object} [options.coords] - 坐标系统对象。
- * @param {Object} [options.renderer] - 渲染器对象。
- * @param {function} done - 回调函数。
- */
- var VectorTile = external_L_default().Class.extend({
- initialize: function (options, done) {
- this.layer = options.layer;
- this.tileSize = options.layer.getTileSize();
- this.format = options.format;
- this.coords = options.coords;
- this.renderer = options.renderer;
- this.done = done;
- this.layer._textVectorTiles = {};
- },
- /**
- * @function VectorTile.prototype.renderTile
- * @description 渲染切片。
- */
- renderTile: function () {
- var me = this, layer = me.layer, coords = me.coords;
- var tileFeatureUrl = layer._getTileUrl(coords);
- var format = [VectorTileFormat.MVT, VectorTileFormat.PBF];
- var tileFeaturePromise;
- if (format.indexOf(me.format.toUpperCase()) > -1) {
- tileFeaturePromise = new VectorTilePBF(tileFeatureUrl);
- } else {
- tileFeaturePromise = new VectorTileJSON(tileFeatureUrl)
- }
- tileFeaturePromise.getTile().then(function (tileFeature) {
- me.render(tileFeature, coords);
- })
- },
- /**
- * @function VectorTile.prototype.render
- * @description 渲染切片要素。
- * @param {Object} tileFeature - 需要渲染的切片要素。
- * @param {Object} coords - 切片坐标参数对象。
- */
- render: function (tileFeature, coords) {
- if (!tileFeature) {
- return;
- }
- var me = this,
- renderer = me.renderer,
- tileLayer = me.layer;
- for (var k = 0; k < tileFeature.length; k++) {
- var layer = tileFeature[k], layerName = layer.layerName;
- tileLayer._dataLayerNames[layerName] = true;
- var pxPerExtent = me.tileSize.divideBy(layer.extent);
- var layerStyleInfo = tileLayer.getLayerStyleInfo(layer.layerName);
- for (var i = 0; i < layer.features.length; i++) {
- var feat = layer.features[i];
- if (!feat) {
- continue;
- }
- //标签图层处理为文本
- if (layerStyleInfo && layerStyleInfo.type === VectorFeatureType.LABEL
- && feat.type === VectorFeatureType.POINT
- && feat.properties.attributes) {
- feat.type = VectorFeatureType.TEXT;
- }
- var styleOptions = me._getStyleOptions(coords, feat, layerName, me);
- if (!styleOptions.length) {
- continue;
- }
- var featureLayer = me._createFeatureLayer(feat, pxPerExtent);
- if (!featureLayer) {
- continue;
- }
- // 保存文本图层单独绘制,避免被压盖
- var param = {scope: me, coords: coords, renderer: renderer};
- if (me._extractTextLayer(feat, featureLayer, styleOptions, param)) {
- continue;
- }
- for (var j = 0; j < styleOptions.length; j++) {
- var style = me._validateStyle(styleOptions[j], feat.type);
- featureLayer.render(renderer, style);
- renderer._addPath(featureLayer);
- }
- if (tileLayer.options.interactive) {
- featureLayer.makeInteractive();
- }
- var featureKey = tileLayer._getFeatureKey(feat.id, layerName);
- renderer._features[featureKey] = {
- layerName: layerName,
- feature: featureLayer
- };
- }
- }
- if (tileLayer._map) {
- renderer.addTo(tileLayer._map);
- }
- external_L_default().Util.requestAnimFrame(me.done.bind(coords, null, me.layer._vectorTiles[me.layer._tileCoordsToKey(coords)]));
- },
- // 保存文本图层单独绘制,避免被压盖
- _extractTextLayer: function (feat, featureLayer, style, param) {
- if (feat.type !== VectorFeatureType.TEXT) {
- return false;
- }
- var me = param.scope,
- coords = param.coords,
- tileLayer = me.layer,
- key = tileLayer._tileCoordsToKey(coords);
- var id = feat.id,
- layerName = feat.layerName;
- var textTileLayers = tileLayer._textVectorTiles[key];
- if (!textTileLayers) {
- textTileLayers = {
- layers: {},
- coords: coords,
- renderer: param.renderer
- };
- }
- // 不同瓦片可能请求到同一个文本图层,为避免重复绘制,只保存绘制最后一个
- textTileLayers.layers[id] = {
- layer: featureLayer,
- style: style,
- layerName: layerName
- };
- tileLayer._textVectorTiles[key] = textTileLayers;
- return true;
- },
- _getStyleOptions: function (coords, feature, layerName, scope) {
- var me = scope;
- var tileLayer = me.layer;
- var styleOptions = tileLayer.getVectorTileLayerStyle(coords, feature) || me._defaultStyle(feature.type);
- //根据id和layerName识别唯一要素
- var id = feature.id,
- styleKey = tileLayer._getFeatureKey(id, layerName),
- styleOverride = tileLayer._overriddenStyles[styleKey];
- styleOptions = styleOverride ? styleOverride : styleOptions;
- styleOptions = (styleOptions instanceof Function) ? styleOptions(feature.properties, coords.z) : styleOptions;
- styleOptions = !(styleOptions instanceof Array) ? [styleOptions] : styleOptions;
- return styleOptions;
- },
- _createFeatureLayer: function (feat, pxPerExtent) {
- var layer;
- switch (feat.type) {
- case VectorFeatureType.POINT:
- layer = new PointSymbolizer(feat, pxPerExtent);
- break;
- case VectorFeatureType.LINE:
- layer = new LineSymbolizer(feat, pxPerExtent);
- break;
- case VectorFeatureType.REGION:
- layer = new RegionSymbolizer(feat, pxPerExtent);
- break;
- case VectorFeatureType.TEXT:
- layer = new TextSymbolizer(feat, pxPerExtent);
- break;
- default:
- break;
- }
- var vectorLayer = this.layer;
- if (layer && vectorLayer.options.interactive) {
- layer.addEventParent(vectorLayer);
- }
- return layer;
- },
- //矫正一些参数
- _validateStyle: function (style, type) {
- //默认leaflet path的边宽为3,矩形颜色填充透明度为0.2,跟iClient不一样,故作调整
- (external_L_default()).Path.prototype.options.weight = 1;
- (external_L_default()).Path.prototype.options.fillOpacity = 1;
- switch (type) {
- case VectorFeatureType.POINT:
- return external_L_default().extend({}, (external_L_default()).CircleMarker.prototype.options, style);
- case VectorFeatureType.LINE:
- return external_L_default().extend({}, (external_L_default()).Polyline.prototype.options, style);
- case VectorFeatureType.REGION:
- return external_L_default().extend({}, (external_L_default()).Polygon.prototype.options, style);
- case VectorFeatureType.TEXT:
- return external_L_default().extend({}, TextSymbolizer.prototype.options, style);
- default:
- break;
- }
- },
- //如果cartoCSS和layerInfo都没有得到样式,则使用该默认样式
- _defaultStyle: function (type) {
- var defaultOptions = (external_L_default()).Path.prototype.options;
- defaultOptions.weight = 1;
- defaultOptions.fillOpacity = 1;
- defaultOptions.radius = 3;
- switch (type) {
- case VectorFeatureType.POINT:
- return external_L_default().extend({}, defaultOptions, (external_L_default()).CircleMarker.prototype.options);
- case VectorFeatureType.LINE:
- return external_L_default().extend({}, defaultOptions, (external_L_default()).Polyline.prototype.options);
- case VectorFeatureType.REGION:
- return external_L_default().extend({}, defaultOptions, (external_L_default()).Polygon.prototype.options);
- case VectorFeatureType.TEXT:
- return external_L_default().extend({}, defaultOptions, TextSymbolizer.prototype.options);
- default:
- break;
- }
- }
- });
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/vectortile/VectorGrid.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * Inspired by https://github.com/Leaflet/Leaflet.VectorGrid
- */
- /**
- * @class VectorGrid
- * @classdesc 矢量瓦片图层基类。
- * @category Visualization VectorTile
- * @extends {L.GridLayer}
- * @param {Object} options - 参数。
- * @param {Object} [options.vectorTileLayerStyles] - 矢量网片图层风格。
- * @param {string} [options.renderer='SVG'] - 渲染器类型。
- * @param {VectorTileFormat} [options.format=VectorTileFormat.JSON] - 矢量瓦片格式。
- * @param {boolean} [options.interactive=true] - 是否可交互。
- * @param {number} [options.maxZoom=23] - 最大缩放级别。
- * @usage
- */
- var VectorGrid = external_L_default().GridLayer.extend({
- options: {
- vectorTileLayerStyles: null,
- //SVG or Canvas
- renderer: "SVG",
- format: VectorTileFormat.JSON,
- interactive: true,
- maxZoom:23
- },
- initialize: function (options) {
- var me = this;
- external_L_default().setOptions(me, options);
- external_L_default().GridLayer.prototype.initialize.call(me, options);
- me._vectorTiles = {};
- //交互事件使用,键值为id_layerName
- me._overriddenStyles = {};
- me.vectorTileLayerStyles = me.options.vectorTileLayerStyles;
- me.on('tileunload', function (e) {
- var key = me._tileCoordsToKey(e.coords),
- tile = me._vectorTiles[key];
- if (tile && me._map) {
- tile.removeFrom(me._map);
- }
- delete me._vectorTiles[key];
- }, me);
- me.on('tileerror ', me._renderText, me);
- me.on('load', me._renderText, me);
- me._dataLayerNames = {};
- },
- /**
- * @private
- * @function VectorGrid.prototype.createTile
- * @description 创建切片图层。
- * @param {Object} coords - 切片坐标参数对象。
- * @param {function} done - todo。
- */
- createTile: function (coords, done) {
- var me = this;
- var tileSize = me.getTileSize();
- var renderer = null;
- if (me.options.renderer === "Canvas") {
- renderer = new CanvasRenderer(coords, tileSize, me.options);
- } else {
- renderer = new SVGRenderer(coords, tileSize, me.options);
- }
- me._vectorTiles[me._tileCoordsToKey(coords)] = renderer;
- renderer._features = {};
- new VectorTile({
- layer: me,
- format: me.options.format,
- coords: coords,
- renderer: renderer
- }, done).renderTile();
- return renderer.getContainer();
- },
- /**
- * @function VectorGrid.prototype.getStyles
- * @description 获取图层样式。
- * @returns {Object} 所有图层的样式。
- */
- getStyles: function () {
- return this.vectorTileLayerStyles;
- },
- /**
- * @function VectorGrid.prototype.getStyle
- * @description 获取指定图层样式。
- * @param {string} layerName - 图层名称。
- * @returns {Object} 指定图层的样式。
- */
- getStyle: function (layerName) {
- return this.vectorTileLayerStyles && this.vectorTileLayerStyles[layerName];
- },
- /**
- * @function VectorGrid.prototype.setFeatureStyle
- * @description 指定要素 ID 和图层名称设置要素风格。
- * @param {number} id - 要素 ID。
- * @param {string} layerName - 图层名称。
- * @param {(Array|function)} layerStyle - 图层样式。
- * @returns {VectorGrid} VectorGrid的实例对象。
- */
- setFeatureStyle: function (id, layerName, layerStyle) {
- var featureKey = this._getFeatureKey(id, layerName);
- this._overriddenStyles[featureKey] = layerStyle;
- for (var tileKey in this._vectorTiles) {
- var tile = this._vectorTiles[tileKey];
- var features = tile._features;
- var data = features[featureKey];
- if (data) {
- var feat = data.feature;
- this._updateStyles(feat, tile, layerStyle);
- }
- }
- return this;
- },
- /**
- * @function VectorGrid.prototype.resetFeatureStyle
- * @description 指定要素 ID 和图层名称重绘要素风格。
- * @param {number} id - 要素 ID。
- * @param {string} layerName - 图层名称。
- * @returns {VectorGrid} VectorGrid的实例对象。
- */
- resetFeatureStyle: function (id, layerName) {
- var featureKey = this._getFeatureKey(id, layerName);
- delete this._overriddenStyles[featureKey];
- for (var tileKey in this._vectorTiles) {
- var tile = this._vectorTiles[tileKey];
- var data = tile._features[featureKey];
- if (data) {
- var feat = data.feature;
- var styleOptions = this.vectorTileLayerStyles[data.layerName];
- this._updateStyles(feat, tile, styleOptions);
- }
- }
- return this;
- },
- /**
- * @function VectorGrid.prototype.getDataLayerNames
- * @description 获取数据图层名称。
- * @returns {Array} 返回数据图层名称数组。
- */
- getDataLayerNames: function () {
- return Object.keys(this._dataLayerNames);
- },
- _removeAllTiles: function () {
- external_L_default().GridLayer.prototype._removeAllTiles.call(this);
- this._textVectorTiles = {};
- },
- _renderText: function () {
- var textVectorTiles = this._textVectorTiles;
- for (var key in textVectorTiles) {
- var textTiles = textVectorTiles[key];
- var renderer = textTiles.renderer;
- for (var layerId in textTiles.layers) {
- var tile = textTiles.layers[layerId];
- var styleOptions = tile.style,
- featureLayer = tile.layer;
- for (var j = 0; j < styleOptions.length; j++) {
- featureLayer.render(renderer, styleOptions[j]);
- renderer._addPath(featureLayer);
- }
- if (this.options.interactive) {
- featureLayer.makeInteractive();
- }
- }
- }
- },
- _getFeatureKey: function (id, layerName) {
- id = id || 0;
- layerName = layerName || "null";
- return id + "_" + layerName;
- },
- _updateStyles: function (feat, renderer, styleOptions) {
- styleOptions = (styleOptions instanceof Function) ?
- styleOptions(feat.properties, renderer.getCoord().z) :
- styleOptions;
- if (!(styleOptions instanceof Array)) {
- styleOptions = [styleOptions];
- }
- for (var j = 0; j < styleOptions.length; j++) {
- var style = this._extendStyle(styleOptions[j], feat.type);
- feat.updateStyle(renderer, style);
- }
- },
- //矫正一些参数
- _extendStyle: function (style, type) {
- switch (type) {
- case VectorFeatureType.POINT:
- return external_L_default().extend({}, (external_L_default()).CircleMarker.prototype.options, style);
- case VectorFeatureType.LINE:
- return external_L_default().extend({}, (external_L_default()).Polyline.prototype.options, style);
- case VectorFeatureType.REGION:
- return external_L_default().extend({}, (external_L_default()).Polygon.prototype.options, style);
- case VectorFeatureType.TEXT:
- return external_L_default().extend({}, TextSymbolizer.prototype.options, style);
- default:
- break;
- }
- }
- });
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/TiledVectorLayer.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
-
-
-
-
-
-
-
-
-
-
-
- /**
- * @class TiledVectorLayer
- * @deprecatedclassinstance L.supermap.tiledVectorLayer
- * @classdesc SuperMap iServer 的矢量瓦片图层。
- * @category Visualization VectorTile
- * @extends VectorGrid
- * @example
- * new TiledVectorLayer(url).addTo(map);
- * @param {string} url - 服务地址。
- * @param {Object} options - 参数。
- * @param {string} options.layerNames - 指定图层的名称列表,支持的类型为矢量图层。
- * @param {string} options.layersID - 获取进行切片的地图图层 ID。
- * @param {string} [options.cartoCSS] - 客户端 CartoCSS 样式字符串。
- * @param {boolean} [options.serverCartoCSSStyle=true] - 是否使用服务端 CartoCSS 样式。
- * @param {boolean} [options.processCharacters=false] - 设置客户端 CartoCSS 样式时是否进行特定字符转换。
- * @param {CRS} [options.crs] - 坐标系统类。
- * @param {boolean} [options.returnAttributes=false] - 是否返回 attributes。
- * @param {string} [options.expands] - expands。
- * @param {boolean} [options.cacheEnabled=true] - 是否启用缓存。
- * @param {Object} [options.tileTemplate] - 瓦片模板,如果设置了此参数,则按此模板出图。默认出图方式为 URL 对接的第三方瓦片。
- * @param {string} [options.subdomains] - 子域名。
- * @param {number} [options.timeout=10000] - 延时。
- * @param {string} [options.attribution='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>`] - 版权信息。
- * @usage
- */
- var TiledVectorLayer = VectorGrid.extend({
- options: {
- crs: null,
- //客户端cartocss样式
- cartoCSS: null,
- // 指定图层的名称列表。支持的类型为矢量图层
- layerNames: null,
- //获取进行切片的地图图层 ID
- layersID: null,
- //是否服务端CartoCSS样式,默认使用
- serverCartoCSSStyle: true,
- //设置客户端CartoCSS样式时是否进行特定字符转换
- processCharacters: false,
- returnAttributes: false,
- /*各图层扩展的像素值。
- *例如:
- * 0_15:0_5,1_10:表示顶级0图层的0、1子图层扩展的像素分别为5、10像素;顶级0图层下,除0、1图层外的子图层的扩展像素都为15像素。
- * 0:0_5,1_10:表示顶级0图层的0、1子图层扩展的像素分别为5、10像素;顶级0图层下,其他除0、1图层外的子图层的扩展像素为根据该图层默认样式计算得出的默认值。
- */
- expands: null,
- cacheEnabled: false,
- //瓦片模板,如果设置了此参数,则按此模板出图,url无效(对接第三方瓦片)
- tileTemplate: null,
- subdomains: 'abc',
- timeout: 10000,
- attribution: core_Attributions.Common.attribution
- },
- initialize: function (url, options) {
- options = options || {};
- options.noWrap = (options.noWrap == null) ? true : options.noWrap;
- external_L_default().setOptions(this, options);
- VectorGrid.prototype.initialize.call(this, options);
- external_L_default().stamp(this);
- var me = this;
- if (!url || url.indexOf("http") < 0) {
- url = "";
- return this;
- }
- me.url = url;
- if (url.indexOf("/") === (url.length - 1)) {
- url = url.substr(0, url.length - 1);
- me.url = url;
- }
- this.cartoCSSToLeaflet = new CartoCSSToLeaflet(me.url);
- me.initLayersInfo();
- if (!me.options.serverCartoCSSStyle && me.options.cartoCSS) {
- me.setClientCartoCSS(me.options.cartoCSS);
- }
- },
- /**
- * @private
- * @function TiledVectorLayer.prototype.onAdd
- * @description 添加地图。
- * @param {L.Map} map - Leaflet Map 对象。
- */
- onAdd: function (map) {
- this._crs = this.options.crs || map.options.crs;
- this._map = map;
- this._initLayerUrl();
- if (this.options.tileTemplate || !this.options.serverCartoCSSStyle) {
- this._initGrid();
- }
- },
- /**
- * @private
- * @function TiledVectorLayer.prototype.initLayersInfo
- * @description 获取服务器图层资源下的风格信息(当 CartoCSS 中不存在相应图层渲染信息时使用)。
- */
- initLayersInfo: function () {
- var me = this;
- var layersUrl = Util.urlPathAppend(me.url, "layers");
- FetchRequest.get(SecurityManager.appendCredential(layersUrl), null, {
- timeout: me.options.timeout
- }).then(function (response) {
- return response.json();
- }).then(function (json) {
- me.layersInfoInitialized = true;
- me.layersInfo = json;
- if (!me.layersInfo) {
- return;
- }
- var layersInfo = {};
- for (var i = 0, len = me.layersInfo.length; i < len; i++) {
- var layers = me.layersInfo[i].subLayers.layers;
- for (var j = 0, len1 = layers.length; j < len1; j++) {
- layers[j].layerIndex = len1 - j;
- layersInfo[layers[j].name] = layers[j];
- }
- }
- me.layersInfo = layersInfo;
- me.cartoCSSToLeaflet.layersInfo = layersInfo;
- if (me.options.serverCartoCSSStyle) {
- me.getVectorStylesFromServer();
- }
- }).catch(function (ex) {
- console.error('error', ex)
- });
- },
- /**
- * @function TiledVectorLayer.prototype.getLayerStyleInfo
- * @description 获取图层样式信息。
- * @param {string} layerName - 图层名称。
- */
- getLayerStyleInfo: function (layerName) {
- var me = this,
- layerInfo_simple;
- me.layersStyles = me.layersStyles || {};
- layerInfo_simple = me.layersStyles[layerName];
- if (layerInfo_simple) {
- return layerInfo_simple;
- }
- if (!me.layersInfo) {
- return {};
- }
- var layerInfo = me.layersInfo[layerName];
- if (!layerInfo) {
- return null;
- }
- layerInfo_simple = {
- layerIndex: layerInfo.layerIndex,
- ugcLayerType: layerInfo.ugcLayerType
- };
- switch (layerInfo.ugcLayerType) {
- case "VECTOR":
- layerInfo_simple.layerStyle = layerInfo.style ? layerInfo.style : null;
- break;
- case "THEME":
- var theme = layerInfo.theme;
- //标注图层特别标明
- layerInfo_simple.layerStyle = theme ? theme.defaultStyle : null;
- if (theme && theme.type === "LABEL") {
- layerInfo_simple.type = theme.type;
- layerInfo_simple.textField = theme.labelExpression;
- }
- break;
- default:
- //SVTile发布出来的地图没有ugcLayerType属性
- if (layerInfo.style) {
- layerInfo_simple.layerStyle = layerInfo.style;
- }
- break;
- }
- me.layersStyles[layerName] = layerInfo_simple;
- return layerInfo_simple;
- },
- /*
- * @function TiledVectorLayer.prototype.getVectorStylesFromServer
- * @description 等待服务器的 carto 返回之后拼接本地配置的 cartoCSS, 并调用 onAdd 出图。
- */
- getVectorStylesFromServer: function () {
- var me = this;
- var vectorStyleUrl = Util.urlPathAppend(me.url, "tileFeature/vectorstyles");
- FetchRequest.get(SecurityManager.appendCredential(vectorStyleUrl), null, {
- timeout: me.options.timeout
- }).then(function (response) {
- return response.json()
- }).then(function (styles) {
- if (!styles || !styles.style) {
- return null;
- }
- if (styles.style && styles.type === 'cartoCSS') {
- me.setServerCartoCSS(styles.style);
- }
- if (me.options) {
- me.setClientCartoCSS(me.options.cartoCSS);
- }
- me._initGrid();
- }).catch(function (ex) {
- console.error('error', ex)
- });
- },
- /**
- * @private
- * @function TiledVectorLayer.prototype.setServerCartoCSS
- * @description 设置服务端获取到的 cartoCSS 样式, cartoCSS 请求回来之后自动调用。
- */
- setServerCartoCSS: function (cartoCSSStr) {
- this.cartoCSSToLeaflet.pretreatedCartoCSS(cartoCSSStr, true);
- },
- /**
- * @function TiledVectorLayer.prototype.setClientCartoCSS
- * @description 客户端设置 cartoCSS 样式。
- */
- setClientCartoCSS: function (cartoCSSStr) {
- let processCharacters = false;
- if (this.options.processCharacters) {
- processCharacters = this.options.processCharacters;
- }
- this.cartoCSSToLeaflet.pretreatedCartoCSS(cartoCSSStr, processCharacters);
- },
- /**
- * @private
- * @function TiledVectorLayer.prototype.getVectorTileLayerStyle
- * @description 获取图层风格信息,当 CartoCSS 中包含有对该图层的渲染信息时,优先获取,否则获取图层资源下图层样式的渲染信息。
- * @param {Object} coords - 图层坐标参数对象。
- * @param {Object} feature - 需要获取的要素。
- */
- getVectorTileLayerStyle: function (coords, feature) {
- if (!feature) {
- return null;
- }
- var me = this,
- layerName = feature.layerName,
- layerStyleInfo = me.getLayerStyleInfo(layerName);
- //处理标签图层
- if (layerStyleInfo && layerStyleInfo.textField) {
- var textField = layerStyleInfo.textField;
- if (textField && textField.indexOf('.')) {
- var arr = textField.split('.');
- textField = arr && arr.length > 0 && arr[arr.length - 1];
- }
- feature.properties.textField = textField;
- }
- me.vectorTileLayerStyles = me.vectorTileLayerStyles || {};
- var style = me.vectorTileLayerStyles[layerName];
- if (style) {
- feature = this._mergeFeatureTextField(feature, style);
- return style;
- }
- // CartoCSSToLeaflet内部做了客户端配置的cartoCSS和服务端cartoCSS的拼接处理
- // 客户端配置的cartoCSS会覆盖相应图层的服务端cartoCSS
- var scale = this.getScaleFromCoords(coords);
- var shaders = this.cartoCSSToLeaflet.pickShader(layerName) || [];
- style = [];
- for (var itemKey in shaders) {
- var shader = shaders[itemKey];
- for (var j = 0; j < shader.length; j++) {
- var serverStyle = this.cartoCSSToLeaflet.getValidStyleFromCarto(coords.z, scale, shader[j], feature,this.options.serverCartoCSSStyle);
- if (serverStyle) {
- style.push(serverStyle);
- }
- }
- }
- feature = this._mergeFeatureTextField(feature, style);
- //次优先级是layers资源的默认的样式,最低优先级是CartoDefaultStyle的样式
- if (feature.type === "TEXT" || style.length === 0) {
- style = this.cartoCSSToLeaflet.getValidStyleFromLayerInfo(feature, layerStyleInfo);
- if (feature.type === "TEXT") {
- style.textName = "[" + feature.properties.textField + "]";
- }
- }
- me.vectorTileLayerStyles[layerName] = style;
- return style;
- },
- /**
- * @function TiledVectorLayer.prototype.getScale
- * @description 通过缩放级别获取比例尺。
- * @param {number} zoom - 缩放级别。
- * @returns {number} 比例尺。
- */
- getScale: function (zoom) {
- var me = this;
- //返回当前比例尺
- var z = zoom || me._map.getZoom();
- return me.scales[z];
- },
- /**
- * @function TiledVectorLayer.prototype.getScaleFromCoords
- * @description 通过行列号获取比例尺。
- * @param {Object} coords - 行列号。
- * @returns {number} 比例尺。
- */
- getScaleFromCoords: function (coords) {
- var me = this,
- scale;
- if (me.scales && me.scales[coords.z]) {
- return me.scales[coords.z];
- }
- me.scales = me.scales || {};
- scale = me.getDefaultScale(coords);
- me.scales[coords.z] = scale;
- return scale;
- },
- /**
- * @private
- * @function TiledVectorLayer.prototype.getDefaultScale
- * @description 根据行列号获取默认比例尺。
- * @param {Object} coords - 行列号。
- * @returns {number} 默认比例尺。
- */
- getDefaultScale: function (coords) {
- var me = this,
- crs = me._crs;
- if (crs.scales) {
- return crs.scales[coords.z];
- } else {
- var tileBounds = me._tileCoordsToBounds(coords);
- var ne = crs.project(tileBounds.getNorthEast());
- var sw = crs.project(tileBounds.getSouthWest());
- var tileSize = me.options.tileSize;
- var resolution = Math.max(
- Math.abs(ne.x - sw.x) / tileSize,
- Math.abs(ne.y - sw.y) / tileSize
- );
- var mapUnit = Unit.METER;
- if (crs.code) {
- var array = crs.code.split(':');
- if (array && array.length > 1) {
- var code = parseInt(array[1]);
- mapUnit = code && code >= 4000 && code <= 5000 ? Unit.DEGREE : Unit.METER;
- }
- }
- return resolutionToScale(resolution, 96, mapUnit);
- }
- },
- _mergeFeatureTextField: function (feature, style) {
- //如果设置了使用服务端cartocss样式,则文本专题图图层优先从carto中读取文本字段的key
- if (!this.options.serverCartoCSSStyle || !style || feature.type !== "TEXT") {
- return feature;
- }
- var tempStyle = style;
- if (!external_L_default().Util.isArray(style)) {
- tempStyle = [style];
- }
- for (var i = 0; i < tempStyle.length; i++) {
- var textName = tempStyle[i].textName;
- if (textName && feature.properties) {
- feature.properties.textField = textName.substring(1, textName.length - 1);
- }
- }
- return feature;
- },
- _getTileUrl: function (coords) {
- var me = this,
- tileTemplate = me.options.tileTemplate;
- if (!tileTemplate) {
- return me._getDefaultTileUrl(coords);
- }
- return me._getTileTemplateUrl(coords)
- },
- _getTileTemplateUrl: function (coords) {
- var me = this,
- tileTemplate = me.options.tileTemplate;
- var data = {
- s: me._getSubdomain(coords),
- x: coords.x,
- y: coords.y,
- z: coords.z
- };
- if (me._map && !me._map.options.crs.infinite) {
- var invertedY = me._globalTileRange.max.y - coords.y;
- if (me.options.tms) {
- data['y'] = invertedY;
- }
- data['-y'] = invertedY;
- }
- var tileUrl = external_L_default().Util.template(tileTemplate, external_L_default().extend(data, me.options));
- return tileUrl;
- },
- _initGrid: function () {
- VectorGrid.prototype.onAdd.call(this, this._map);
- },
- _getSubdomain: (external_L_default()).TileLayer.prototype._getSubdomain,
- _getDefaultTileUrl: function (coords) {
- var x = coords.x,
- y = coords.y;
- var tileUrl = this._tileUrl + "&x=" + x + "&y=" + y;
- var scale = this.getScaleFromCoords(coords);
- tileUrl += "&scale=" + scale;
- return tileUrl;
- },
- _initLayerUrl: function () {
- var options = this.options;
- if (!this.url) {
- return;
- }
- var format = options.format.toString().toLowerCase();
- this._tileUrl = Util.urlPathAppend(this.url, "tileFeature." + format );
- this._tileUrl = Util.urlAppend(this._tileUrl, encodeURI(this._createURLParam(options)));
- },
- _createURLParam: function (options) {
- var params = [];
- //添加安全认证信息
- var credential = this._getCredential(this._tileUrl);
- if (credential) {
- params.push(credential);
- }
- if (options.layersID) {
- params.push("layersID=" + options.layersID);
- }
- if (options.layerNames) {
- if (!external_L_default().Util.isArray(options.layerNames)) {
- options.layerNames = [options.layerNames];
- }
- var layerNamesString = '[' + options.layerNames.join(',') + ']';
- params.push("layerNames=" + layerNamesString);
- }
- //切片的起始参考点,默认为地图范围的左上角。
- var crs = this._crs;
- if (crs.options && crs.options.origin) {
- params.push("origin=" + JSON.stringify({
- x: crs.options.origin[0],
- y: crs.options.origin[1]
- }));
- } else if (crs.projection && crs.projection.bounds) {
- var bounds = crs.projection.bounds;
- var tileOrigin = external_L_default().point(bounds.min.x, bounds.max.y);
- params.push("origin=" + JSON.stringify({
- x: tileOrigin.x,
- y: tileOrigin.y
- }));
- }
- if (options.expands) {
- params.push("expands=" + options.expands);
- }
- params.push("returnAttributes=" + options.returnAttributes);
- params.push("cacheEnabled=" + options.cacheEnabled);
- var tileSize = this.options.tileSize;
- params.push("width=" + tileSize);
- params.push("height=" + tileSize);
- return params.join("&");
- },
- //获取token或key表达式
- _getCredential: function (url) {
- var value = SecurityManager.getToken(url);
- var credential = value ? new Credential(value, 'token') || new Credential(value, 'key') : null;
- if (credential) {
- return credential.getUrlParameters();
- }
- return null;
- }
- });
- var tiledVectorLayer = function (url, options) {
- return new TiledVectorLayer(url, options);
- };
- ;// CONCATENATED MODULE: external "function(){try{return turf}catch(e){return {}}}()"
- const external_function_try_return_turf_catch_e_return_namespaceObject = function(){try{return turf}catch(e){return {}}}();
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/TurfLayer.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class TurfLayer
- * @deprecatedclassinstance L.supermap.turfLayer
- * @classdesc Turf 图层。
- * @category Visualization Turf
- * @extends {L.Layer}
- * @param {Object} options - 参数。
- * @param {string} [options.attribution='<span>© <a href='https://turfjs.org/' title='turfjs' target='_blank'>turfjs</a></span>'] - 版权信息。
- * @usage
- */
- var TurfLayer = external_L_default().GeoJSON.extend({
- turfMap: {
- "Measurement.along": ["line", "distance", "units"],
- "Measurement.area": ["geojson"],
- "Measurement.bbox": ["geojson"],
- "Measurement.bboxPolygon": ["bbox"],
- "Measurement.bearing": ["start", "end", "final"],
- "Measurement.center": ["geojson", "properties"],
- "Measurement.centerOfMass": ["geojson", "properties"],
- "Measurement.centroid": ["geojson", "properties"],
- "Measurement.destination": ["origin", "distance", "bearing", "units"],
- "Measurement.distance": ["from", "to", "units"],
- "Measurement.envelope": ["geojson"],
- "Measurement.length": ["geojson", "units"],
- "Measurement.midpoint": ["point1", "point2"],
- "Measurement.pointOnFeature": ["geojson"],
- "Measurement.polygonTangents": ["point", "polygon"],
- "Measurement.rhumbBearing": ["start", "end", "final"],
- "Measurement.rhumbDestination": ["origin", "distance", "bearing", "units"],
- "Measurement.rhumbDistance": ["from", "to", "units"],
- "Measurement.square": ["bbox"],
- "Measurement.greatCircle": ["start", "end", "properties", "npoints", "offset"],
- "CoordinateMutation.cleanCoords": ["geojson", "mutate"],
- "CoordinateMutation.flip": ["geojson", "mutate"],
- "CoordinateMutation.rewind": ["geojson", "reverse", "mutate"],
- "CoordinateMutation.round": ["num", "precision"],
- "CoordinateMutation.truncate": ["geojson", "precision", "coordinates", "mutate"],
- "Transformation.bboxClip": ["feature", "bbox"],
- "Transformation.bezierSpline": ["line", "resolution", "sharpness"],
- "Transformation.buffer": ["geojson", "radius", "units", "steps"],
- "Transformation.circle": ["center", "radius", "steps", "units", "properties"],
- "Transformation.clone": ["geojson"],
- "Transformation.concave": ["points", "maxEdge", "units"],
- "Transformation.convex": ["geojson", "concavity"],
- "Transformation.difference": ["polygon1", "polygon2"],
- "Transformation.dissolve": ["featureCollection", "propertyName"],
- "Transformation.intersect": ["poly1", "poly2"],
- "Transformation.lineOffset": ["geojson", "distance", "units"],
- "Transformation.simplify": ["feature", "tolerance", "highQuality"],
- "Transformation.tesselate": ["poly"],
- "Transformation.transformRotate": ["geojson", "angle", "pivot", "mutate"],
- "Transformation.transformTranslate": ["geojson", "distance", "direction", "units", "zTranslation", "mutate"],
- "Transformation.transformScale": ["geojson", "factor", "origin", "mutate"],
- "Transformation.union": ["A"],
- "Transformation.voronoi": ["points", "bbox"],
- "featureConversion.combine": ["fc"],
- "featureConversion.explode": ["geojson"],
- "featureConversion.flatten": ["geojson"],
- "featureConversion.lineStringToPolygon": ["lines", "properties", "autoComplete", "orderCoords"],
- "featureConversion.polygonize": ["geojson"],
- "featureConversion.polygonToLineString": ["polygon", "properties"],
- "Misc.kinks": ["featureIn"],
- "Misc.lineArc": ["center", "radius", "bearing1", "bearing2", "steps", "units"],
- "Misc.lineChunk": ["geojson", "segmentLength", "units", "reverse"],
- "Misc.lineIntersect": ["line1", "line2"],
- "Misc.lineOverlap": ["line1", "line2"],
- "Misc.lineSegment": ["geojson"],
- "Misc.lineSlice": ["startPt", "stopPt", "line"],
- "Misc.lineSliceAlong": ["line", "startDist", "stopDist", "units"],
- "Misc.lineSplit": ["line", "splitter"],
- "Misc.mask": ["polygon", "mask"],
- "Misc.pointOnLine": ["lines", "pt", "units"],
- "Misc.sector": ["center", "radius", "bearing1", "bearing2", "steps", "units"],
- "Misc.shortestPath": ["start", "end", "obstacles", "units", "resolution"],
- "Misc.unkinkPolygon": ["geojson"],
- "Helper.featureCollection": ["features", "bbox", "id"],
- "Helper.feature": ["geometry", "properties", "bbox", "id"],
- "Helper.geometryCollection": ["geometries", "properties", "bbox", "id"],
- "Helper.lineString": ["coordinates", "properties", "bbox", "id"],
- "Helper.multiLineString": ["coordinates", "properties", "bbox", "id"],
- "Helper.multiPoint": ["coordinates", "properties", "bbox", "id"],
- "Helper.multiPolygon": ["coordinates", "properties", "bbox", "id"],
- "Helper.point": ["coordinates", "properties", "bbox", "id"],
- "Helper.polygon": ["coordinates", "properties", "bbox", "id"],
- "Data.sample": ["featurecollection", "num"],
- "Interpolation.interpolate": ["points", "cellSize", "gridType", "property", "units", "weight"],
- "Interpolation.isobands": ["pointGrid", "breaks", "zProperty", "commonProperties", "breaksProperties"],
- "Interpolation.isolines": ["pointGrid", "breaks", "zProperty", "commonProperties", "breaksProperties"],
- "Interpolation.planepoint": ["point", "triangle"],
- "Interpolation.tin": ["points", "z"],
- "Joins.pointsWithinPolygon": ["points", "polygons"],
- "Joins.tag": ["points", "polygons", "field", "outField", "mask", "properties"],
- "Grids.hexGrid": ["bbox", "cellSide", "units", "triangles"],
- "Grids.pointGrid": ["bbox", "cellSide", "units", "mask", "properties"],
- "Grids.squareGrid": ["bbox", "cellSide", "units", "mask", "properties"],
- "Grids.triangleGrid": ["bbox", "cellSide", "units", "mask", "properties"],
- "Classification.nearestPoint": ["targetPoint", "points"],
- "Aggregation.collect": ["polygons", "points", "inProperty", "outProperty"],
- "Aggregation.clustersDbscan": ["points", "maxDistance", "units", "minPoints", "mutate"],
- "Aggregation.clustersKmeans": ["points", "numberOfClusters", "mutate"],
- "Meta.coordAll": ["geojson"],
- "Meta.coordEach": ["geojson", "callback", "excludeWrapCoord"],
- "Meta.coordReduce": ["geojson", "callback", "initialValue", "excludeWrapCoord"],
- "Meta.featureEach": ["geojson", "callback"],
- "Meta.featureReduce": ["geojson", "callback", "initialValue"],
- "Meta.flattenEach": ["geojson", "callback"],
- "Meta.flattenReduce": ["geojson", "callback", "initialValue"],
- "Meta.getCoord": ["coord"],
- "Meta.getCoords": ["coords"],
- "Meta.getGeom": ["geojson"],
- "Meta.getGeomType": ["geojson", "name"],
- "Meta.geomEach": ["geojson", "callback"],
- "Meta.geomReduce": ["geojson", "callback", "initialValue"],
- "Meta.propEach": ["geojson", "callback"],
- "Meta.propReduce": ["geojson", "callback", "initialValue"],
- "Meta.segmentEach": ["geojson", "callback"],
- "Meta.segmentReduce": ["geojson", "callback", "initialValue"],
- "Meta.getCluster": ["geojson", "filter"],
- "Meta.clusterEach": ["geojson", "property", "callback"],
- "Meta.clusterReduce": ["geojson", "property", "callback", "initialValue"],
- "Assertions.collectionOf": ["featureCollection", "type", "name"],
- "Assertions.containsNumber": ["coordinates"],
- "Assertions.geojsonType": ["value", "type", "name"],
- "Assertions.featureOf": ["feature", "type", "name"],
- "Booleans.booleanClockwise": ["line"],
- "Booleans.booleanContains": ["feature1", "feature2"],
- "Booleans.booleanCrosses": ["feature1", "feature2"],
- "Booleans.booleanDisjoint": ["feature1", "feature2"],
- "Booleans.booleanEqual": ["feature1", "feature2"],
- "Booleans.booleanOverlap": ["feature1", "feature2"],
- "Booleans.booleanParallel": ["feature1", "feature2"],
- "Booleans.booleanPointInPolygon": ["point", "polygon", "ignoreBoundary"],
- "Booleans.booleanPointOnLine": ["point", "linestring", "ignoreEndVertices"],
- "UnitConversion.bearingToAngle": ["bearing"],
- "UnitConversion.convertArea": ["area", "originalUnit", "finalUnit"],
- "UnitConversion.convertLength": ["length", "originalUnit", "finalUnit"],
- "UnitConversion.degreesToradians": ["degrees"],
- "UnitConversion.lengthToRadians": ["distance", "units"],
- "UnitConversion.lengthToDegrees": ["distance", "units"],
- "UnitConversion.radiansToLength": ["radians", "units"],
- "UnitConversion.radiansToDegrees": ["radians"],
- "UnitConversion.toMercator": ["geojson", "mutate"],
- "UnitConversion.toWgs84": ["geojson", "mutate"]
- },
- options: {
- attribution: core_Attributions.Turf.attribution
- },
- initialize: function (options) {
- options = options || {};
- external_L_default().Util.setOptions(this, options);
- external_L_default().stamp(this);
- this._layers = {};
- },
- // 5.0.0 及以上版本参数配置
- turfOptionMap: {
- "Measurement.along": ["line", "distance", {units: ""}],
- "Measurement.bboxPolygon": ["bbox", {properties: "", id: ""}],
- "Measurement.bearing": ["start", "end", {final: ""}],
- "Measurement.center": ["geojson", {properties: ""}],
- "Measurement.destination": ["origin", "distance", "bearing", {units: "", properties: ""}],
- "Measurement.distance": ["from", "to", {units: ""}],
- "Measurement.length": ["geojson", {units: ""}],
- "Measurement.rhumbBearing": ["start", "end", {final: ""}],
- "Measurement.rhumbDestination": ["origin", "distance", "bearing", {units: "", properties: ""}],
- "Measurement.rhumbDistance": ["from", "to", {units: ""}],
- "Measurement.greatCircle": ["start", "end", {properties: "", npoints: "", offset: ""}],
- "CoordinateMutation.cleanCoords": ["geojson", {mutate: ""}],
- "CoordinateMutation.flip": ["geojson", {mutate: ""}],
- "CoordinateMutation.rewind": ["geojson", {mutate: "", reverse: ""}],
- "CoordinateMutation.truncate": ["geojson", {precision: "", coordinates: "", mutate: ""}],
- "Transformation.bezierSpline": ["line", {resolution: "", sharpness: ""}],
- "Transformation.buffer": ["geojson", "radius", {units: "", steps: ""}],
- "Transformation.circle": ["center", "radius", {units: "", steps: "", properties: ""}],
- "Transformation.concave": ["points", {maxEdge: "", units: ""}],
- "Transformation.convex": ["geojson", {concavity: ""}],
- "Transformation.dissolve": ["featureCollection", {propertyName: ""}],
- "Transformation.lineOffset": ["geojson", "distance", {units: ""}],
- "Transformation.simplify": ["geojson", {tolerance: "", highQuality: ""}],
- "Transformation.transformRotate": ["geojson", "angle", {pivot: "", mutate: ""}],
- "Transformation.transformTranslate": ["geojson", "distance", "direction", {
- units: "",
- zTranslation: "",
- mutate: ""
- }],
- "Transformation.transformScale": ["geojson", "factor", {origin: "", mutate: ""}],
- "Transformation.voronoi": ["points", {bbox: ""}],
- "featureConversion.lineStringToPolygon": ["lines", {properties: "", autoComplete: "", orderCoords: ""}],
- "featureConversion.polygonToLineString": ["polygon", {properties: ""}],
- "Misc.lineArc": ["center", "radius", "bearing1", "bearing2", {steps: "", units: ""}],
- "Misc.lineChunk": ["geojson", "segmentLength", {units: "", reverse: ""}],
- "Misc.lineOverlap": ["line1", "line2", {tolerance: ""}],
- "Misc.lineSliceAlong": ["line", "startDist", "stopDist", {units: ""}],
- "Misc.pointOnLine": ["lines", "pt", {units: ""}],
- "Misc.sector": ["center", "radius", "bearing1", "bearing2", {units: "", steps: "", properties: ""}],
- "Misc.shortestPath": ["start", "end", {obstacles: "", units: "", resolution: ""}],
- "Helper.feature": ["geometry", "properties", {bbox: "", id: ""}],
- "Helper.geometryCollection": ["geometries", "properties", {bbox: "", id: ""}],
- "Helper.lineString": ["coordinates", "properties", {bbox: "", id: ""}],
- "Helper.multiLineString": ["coordinates", "properties", {bbox: "", id: ""}],
- "Helper.multiPoint": ["coordinates", "properties", {bbox: "", id: ""}],
- "Helper.multiPolygon": ["coordinates", "properties", {bbox: "", id: ""}],
- "Helper.point": ["coordinates", "properties", {bbox: "", id: ""}],
- "Helper.polygon": ["coordinates", "properties", {bbox: "", id: ""}],
- "Interpolation.interpolate": ["points", "cellSize", {gridType: "", property: "", units: "", weight: ""}],
- "Interpolation.isobands": ["pointGrid", "breaks", {zProperty: "", commonProperties: "", breaksProperties: ""}],
- "Interpolation.isolines": ["pointGrid", "breaks", {zProperty: "", commonProperties: "", breaksProperties: ""}],
- "Grids.hexGrid": ["bbox", "cellSide", {units: "", triangles: "", properties: "", mask: ""}],
- "Grids.pointGrid": ["bbox", "cellSide", {units: "", mask: "", properties: ""}],
- "Grids.squareGrid": ["bbox", "cellSide", {units: "", mask: "", properties: ""}],
- "Grids.triangleGrid": ["bbox", "cellSide", {units: "", mask: "", properties: ""}],
- "Aggregation.clustersDbscan": ["points", "maxDistance", {units: "", minPoints: "", mutate: ""}],
- "Aggregation.clustersKmeans": ["points", {numberOfClusters: "", mutate: ""}],
- "Booleans.booleanPointInPolygon": ["point", "polygon", {ignoreBoundary: ""}],
- "Booleans.booleanPointOnLine": ["point", "linestring", {ignoreEndVertices: ""}],
- "UnitConversion.toMercator": ["geojson", {mutate: ""}],
- "UnitConversion.toWgs84": ["geojson", {mutate: ""}]
- },
- /**
- * @function TurfLayer.prototype.process
- * @description 执行 Turf.js 提供的相关空间分析方法。
- * @param {string} type - Turf.js 提供的空间分析方法名。
- * @param {Object} args - Turf.js 提供的空间分析方法对应的参数对象。
- * @param {function} callback - 空间分析完成执行的回调函数,返回执行的结果。
- * @param {boolean} [addFeaturesToMap=true] - 是否添加到地图。
- */
- process: function (type, args, callback, addFeaturesToMap) {
- // 兼容版本4到5
- var result;
- try {
- result = external_function_try_return_turf_catch_e_return_namespaceObject[type.split('.')[1]].apply(this, this.parse(type, args));
- } catch (e) {
- result = external_function_try_return_turf_catch_e_return_namespaceObject[type.split('.')[1]].apply(this, this.parseOption(type, args));
- }
- addFeaturesToMap = addFeaturesToMap == null ? true : addFeaturesToMap;
- if (addFeaturesToMap) {
- this.addData([result]);
- }
- if (callback) {
- callback(result);
- }
- },
- parse: function (type, args) {
- if (type === 'Transformation.union') {
- return args['A'];
- }
- var result = [];
- var tempArgs = this.turfMap[type];
- if (tempArgs) {
- tempArgs.map(function (key) {
- result.push(args[key]);
- return args[key];
- });
- }
- return result;
- },
- parseOption(type, args) {
- var result = [];
- var tempArgs = this.turfOptionMap[type];
- tempArgs.map(function (key) {
- if (key instanceof Object) {
- var options = key;
- Object.keys(options).forEach(function (k) {
- options[k] = args[k]
- })
- result.push(options);
- } else {
- result.push(args[key])
- }
- return args;
- })
- return result;
- }
- });
- var turfLayer = function (options) {
- return new TurfLayer(options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/HeatMapLayer.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
-
-
-
-
-
-
-
-
-
- /**
- * @class HeatMapFeature
- * @deprecatedclassinstance L.supermap.heatMapFeature
- * @category Visualization HeatMap
- * @classdesc 客户端专题图要素类。
- * 支持的 geometry 参数类型为 {@link L.Point}、{@link L.LatLng}、{@link L.CircleMarker}。
- * @extends {L.Class}
- * @param {(L.Point|L.LatLng|L.CircleMarker)} geometry - 要素图形。
- * @param {Object} attributes - 要素属性。
- * @usage
- */
- var HeatMapFeature = external_L_default().Class.extend({
- initialize: function (geometry, attributes) {
- this.geometry = geometry;
- this.attributes = attributes;
- },
- /**
- * @function HeatMapFeature.prototype.toFeature
- * @description 转为内部矢量要素。
- * @returns {FeatureVector} 内部矢量要素。
- */
- toFeature: function () {
- var geometry = this.geometry;
- var points = [];
- if (geometry instanceof (external_L_default()).LatLng) {
- points = [geometry.lng, geometry.lat];
- } else if (geometry instanceof (external_L_default()).Point) {
- points = [geometry.x, geometry.y];
- } else if (geometry instanceof (external_L_default()).CircleMarker) {
- var latLng = geometry.getLatLng();
- points = [latLng.lng, latLng.lat];
- } else {
- points = geometry;
- }
- if (points.length === 2) {
- geometry = new Point(points[0], points[1]);
- }
- return new Vector(geometry, this.attributes);
- }
- });
- var heatMapFeature = function (geometry, attributes) {
- return new HeatMapFeature(geometry, attributes);
- };
- /**
- * @class HeatMapLayer
- * @classdesc 热力图层类。
- * @category Visualization HeatMap
- * @param {string} name - 图层名称。
- * @param {boolean} [loadWhileAnimating=true] - 是否实时重绘。(当绘制大数据量要素的情况下会出现卡顿,建议把该参数设为 false)。
- * @param {Array.<string>} [colors=['blue', 'cyan', 'lime', 'yellow', 'red']] - 颜色线性渐变数组,颜色值必须为 canvas 所支持的。
- * @param {Object} options - 构造参数。
- * @param {L.Map} options.map - Leaflet Map 对象。
- * @param {string} [options.id] - 专题图层 ID,默认使用 CommonUtil.createUniqueID("heatMapLayer_") 创建专题图层 ID。
- * @param {boolean} [options.alwaysMapCRS=false] - 要素坐标是否和地图坐标系一致,要素默认是经纬度坐标。
- * @param {string} [options.featureWeight] - 对应 feature 属性中的热点权重字段名称,权重值类型为 number。
- * @param {number} [options.radius=50] - 热点渲染的最大半径(热点像素半径),单位为 px,当 useGeoUnit 参数 为 true 时,单位使用当前图层地理坐标单位。热点显示的时候以精确点为中心点开始往四周辐射衰减,其衰减半径和权重值成比列。
- * @param {number} [options.opacity=1] - 图层透明度。
- * @param {boolean} [options.useGeoUnit=false] - 使用地理单位,即默认热点半径默认使用像素单位。 当设置为 true 时,热点半径和图层地理坐标保持一致。
- * @param {number} [options.blur] - 模糊量,单位为 px。默认值为半径的二分之一。
- * @param {string} [options.attribution='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>'] - 版权信息。
- *
- * @extends {L.Layer}
- * @fires HeatMapLayer#featuresremoved
- * @fires HeatMapLayer#changelayer
- * @usage
- */
- var HeatMapLayer = external_L_default().Layer.extend({
- options: {
- //要素坐标是否和地图坐标系一致,默认为false,要素默认是经纬度坐标。
- alwaysMapCRS: false,
- //热力图默认参数:
- id: Util.createUniqueID("heatMapLayer_"),
- featureWeight: null,
- opacity: 1,
- colors: ['blue', 'cyan', 'lime', 'yellow', 'red'],
- useGeoUnit: false,
- radius: 50,
- attribution: core_Attributions.Common.attribution
- },
- initialize: function (name, options) {
- external_L_default().Util.setOptions(this, options);
- this.name = name;
- this.features = [];
- this.maxWeight = null;
- this.minWeight = null;
- this.rootCanvas = null;
- this.canvasContext = null;
- this.maxWidth = null;
- this.maxHeight = null;
- //热力图参数:
- this.id = this.options.id;
- /*
- * options.featureWeight对应 feature 属性中的热点权重字段名称,权重值类型为float
- * //例如:
- * //feature.attributes中表示权重的字段为height,则在HeatMapLayer的featureWeight参数赋值为"height"
- * feature1.attributes.height = 7.0;
- * feature2.attributes.height = 6.0;
- * var heatMapLayer = new HeatMapLayer("heatmaplayer",{"featureWeight":"height"});
- * heatMapLayer.addFeatures([feature1,feature2]);
- * @type {null}
- */
- this.featureWeight = this.options.featureWeight;
- this.colors = this.options.colors;
- this.useGeoUnit = this.options.useGeoUnit;
- this.opacity = this.options.opacity;
- this.radius = this.options.radius;
- this.blur = this.options.blur;
- this.movingOffset = [0, 0];
- },
- /**
- * @function HeatMapLayer.prototype.onRemove
- * @description 删除某个地图。
- * @param {L.Map} map - Leaflet Map 对象。
- * @private
- */
- onRemove: function (map) {
- var me = this;
- external_L_default().DomUtil.remove(me.rootCanvas);
- map.off("mousemove", me.mouseMoveHandler);
- },
- /**
- * @function HeatMapLayer.prototype.onAdd
- * @description 添加专题图。
- * @param {L.Map} map - Leaflet Map 对象。
- * @private
- */
- onAdd: function (map) {
- var me = this;
- me._map = map;
- me._createCanvasContainer();
- if (!me.rootCanvas) {
- map.removeLayer(me);
- return;
- }
- //初始化渲染器
- var size = map.getSize();
- me.rootCanvas.width = me.maxWidth = size.x;
- me.rootCanvas.height = me.maxHeight = size.y;
- me._updateOpacity();
- me.mouseMoveHandler = function (e) {
- var xy = e.layerPoint;
- me.currentMousePosition = external_L_default().point(xy.x + me.movingOffset[0], xy.y + me.movingOffset[1]);
- };
- map.on("mousemove", me.mouseMoveHandler);
- me.update();
- },
- /**
- * @function HeatMapLayer.prototype.addFeatures
- * @description 添加热点信息。
- * @param {(GeoJSONObject|HeatMapFeature)} features - 待添加的要素数组。
- *
- * @example
- * var geojson = {
- * "type": "FeatureCollection",
- * "features": [
- * {
- * "type": "feature",
- * "geometry": {
- * "type": "Point", //只支持point类型
- * "coordinates": [0, 0]
- * },
- * "properties": {
- * "height": Math.random()*9,
- * "geoRadius": useGeoRadius?radius:null
- * }
- * }
- * ]
- * };
- * var heatMapLayer = new HeatMapLayer("heatmaplayer",{"id":"heatmap"});
- * heatMapLayer.addFeatures(geojson);
- */
- addFeatures: function (features) {
- this.features = this.toiClientFeature(features);
- this.refresh();
- },
- /**
- * @function HeatMapLayer.prototype.refresh
- * @description 强制刷新当前热点显示,在图层热点数组发生变化后调用,更新显示。
- */
- refresh: function () {
- if (this.features.length === 0) {
- return;
- }
- if (this._map) {
- var extent = this._map.getBounds();
- this.updateHeatPoints(extent);
- }
- },
- /**
- * @function HeatMapLayer.prototype.updateHeatPoints
- * @description 刷新热点图显示。
- * @param {L.LatLngBounds} bounds - 当前显示范围。
- */
- updateHeatPoints: function (bounds) {
- if (this.features && this.features.length > 0) {
- this.convertFastToPixelPoints(bounds);
- } else {
- this.canvasContext.clearRect(0, 0, this.maxWidth, this.maxWidth);
- }
- },
- /**
- * @function HeatMapLayer.prototype.convertFastToPixelPoints
- * @description 过滤位于当前显示范围内的热点,并转换其为当前分辨率下的像素坐标。
- * @param {L.LatLngBounds} bounds - 当前显示范围。
- * @private
- */
- convertFastToPixelPoints: function (bounds) {
- var data = [], x, y, k, resolution, maxTemp, minTemp, maxWeightTemp;
- //获取当前像素下的地理范围
- var dw = bounds.getEast() - bounds.getWest();
- var dh = bounds.getNorth() - bounds.getSouth();
- var mapCanvas = this._map.getSize();
- if (dw / mapCanvas.x > dh / mapCanvas.y) {
- resolution = dw / mapCanvas.x;
- } else {
- resolution = dh / mapCanvas.y;
- }
- //热点半径
- this.useRadius = this.useGeoUnit ? parseInt(this.radius / resolution) : this.radius;
- for (var i = 0; i < this.features.length; i++) {
- var feature = this.features[i];
- var point = feature.geometry;
- var pixelPoint = this.getLocalXY(new LonLat(point.x, point.y));
- if (this.featureWeight) {
- pixelPoint.weight = feature.attributes[this.featureWeight];//point.value;
- if (!this.maxWeight) {
- //找出最大最小权重值
- maxTemp = maxTemp ? maxTemp : pixelPoint.weight;
- minTemp = minTemp ? minTemp : pixelPoint.weight;
- maxTemp = Math.max(maxTemp, pixelPoint.weight);
- minTemp = Math.min(minTemp, pixelPoint.weight);
- }
- } else {
- pixelPoint.weight = 1;
- }
- x = Math.floor(pixelPoint[0]);
- y = Math.floor(pixelPoint[1]);
- k = pixelPoint.weight;
- data.push([x, y, k]);
- }
- //无最大权重设置
- if (!this.maxWeight) {
- if (maxTemp && minTemp) {
- maxWeightTemp = (maxTemp + minTemp) / 2;
- } else {
- maxWeightTemp = 1;
- }
- this.draw(data, maxWeightTemp);
- } else {
- this.draw(data, this.maxWeight);
- }
- },
- /**
- * @function HeatMapLayer.prototype.draw
- * @description 绘制热点图。
- * @param {Array} data - convertToPixelPoints 方法计算出的点。
- * @param {number} maxWeight - 最大权重。
- * @private
- */
- draw: function (data, maxWeight) {
- if (this.maxHeight > 0 && this.maxWidth > 0) {
- var ctx = this.canvasContext;
- //清空
- this.canvasContext.clearRect(0, 0, this.maxWidth, this.maxHeight);
- this.drawCircle(this.useRadius);
- this.createGradient();
- for (var i = 0; i < data.length; i++) {
- var p = data[i];
- this.canvasContext.globalAlpha = Math.max(p[2] / maxWeight, 0.05);
- this.canvasContext.drawImage(this.circle, p[0] - this.useRadius, p[1] - this.useRadius);
- }
- var colored = ctx.getImageData(0, 0, this.maxWidth, this.maxHeight);
- this.colorize(colored.data, this.grad);
- ctx.putImageData(colored, 0, 0);
- } else {
- return false;
- }
- },
- /**
- * @function HeatMapLayer.prototype.colorize
- * @description 根据渐变色重置热点图 rgb 值。
- * @param {Array} pixels 像素 RGBA 值。
- * @param {Array} gradient 渐变 canvas.getImageData.data。
- * @private
- */
- colorize: function (pixels, gradient) {
- for (var i = 0, j; i < pixels.length; i += 4) {
- j = pixels[i + 3] * 4;
- if (j) {
- pixels[i] = gradient[j];
- pixels[i + 1] = gradient[j + 1];
- pixels[i + 2] = gradient[j + 2];
- }
- }
- },
- /**
- * @function HeatMapLayer.drawCircle
- * @description 绘制热点半径圆。
- * @param {number} r - 热点半径。
- * @private
- */
- drawCircle: function (r) {
- var blur = this.blur || r / 2;
- var circle = this.circle = document.createElement('canvas'),
- ctx = circle.getContext("2d");
- circle.height = 2 * r;
- circle.width = 2 * r;
- ctx.shadowOffsetX = ctx.shadowOffsetY = 2 * r;
- ctx.shadowBlur = blur;
- ctx.shadowColor = "#000000";
- ctx.beginPath();
- ctx.arc(-r, -r, r / 2, 0, Math.PI * 2, true);
- ctx.closePath();
- ctx.fill();
- },
- /**
- * @function HeatMapLayer.createGradient
- * @description 根据 this.canvasColors 设置渐变并 getImageData。
- * @private
- */
- createGradient: function () {
- var colors = this.colors;
- var canvas = document.createElement('canvas'),
- ctx = canvas.getContext("2d"),
- gradient = ctx.createLinearGradient(0, 0, 0, 256);
- canvas.height = 256;
- canvas.width = 1;
- var index = 1;
- for (var i = 0, len = colors.length; i < len; i++) {
- gradient.addColorStop(index / len, colors[i]);
- index++;
- }
- ctx.fillStyle = gradient;
- ctx.fillRect(0, 0, 1, 256);
- this.grad = ctx.getImageData(0, 0, 1, 256).data;
- },
- /**
- * @function HeatMapLayer.prototype.update
- * @description 更新图层。
- */
- update: function () {
- var mapOffset = this._map.containerPointToLayerPoint([0, 0]);
- external_L_default().DomUtil.setPosition(this.rootCanvas, mapOffset);
- var me = this;
- me.refresh();
- if (me.currentMousePosition) {
- me.currentMousePosition = external_L_default().point(
- me.currentMousePosition.x - me.movingOffset[0],
- me.currentMousePosition.y - me.movingOffset[1]);
- }
- me.movingOffset = [0, 0];
- me._zoom = me._map.getZoom();
- me._center = me._map.getCenter();
- },
- /**
- * @function HeatMapLayer.prototype.getLocalXY
- * @description 地理坐标转为像素坐标。
- * @param {Array} coordinate - 地理坐标。
- */
- getLocalXY: function (coordinate) {
- if (!this._map) {
- return coordinate;
- }
- var coor = coordinate;
- if (external_L_default().Util.isArray(coordinate)) {
- coor = external_L_default().point(coordinate[0], coordinate[1]);
- }
- if (!(coordinate instanceof (external_L_default()).Point)) {
- if (coordinate instanceof Point || coordinate instanceof GeoText) {
- coor = external_L_default().point(coordinate.x, coordinate.y);
- } else {
- coor = external_L_default().point(coordinate.lon, coordinate.lat);
- }
- }
- var point = this._map.latLngToContainerPoint(!this.options.alwaysMapCRS ? external_L_default().latLng(coor.y, coor.x) : this._map.options.crs.unproject(coor));
- return [point.x, point.y];
- },
- /**
- * @function HeatMapLayer.prototype.setOpacity
- * @description 设置图层的不透明度,取值 [0-1] 之间。
- * @param {number} opacity - 不透明度。
- */
- setOpacity: function (opacity) {
- var me = this;
- if (opacity === me.options.opacity) {
- return;
- }
- if (opacity) {
- me.options.opacity = opacity;
- }
- me._updateOpacity();
- },
- /**
- * @function HeatMapLayer.prototype.removeFeatures
- * @description 移除指定的热点信息。
- * @param {Array.<FeatureVector>} features - 热点信息数组。
- */
- removeFeatures: function (features) {
- if (!features || features.length === 0 || !this.features || this.features.length === 0) {
- return;
- }
- if (features === this.features) {
- return this.removeAllFeatures();
- }
- if (!(Util.isArray(features))) {
- features = [features];
- }
- var heatPoint, index, heatPointsFailedRemoved = [];
- for (var i = 0, len = features.length; i < len; i++) {
- heatPoint = features[i];
- index = Util.indexOf(this.features, heatPoint);
- //找不到视为删除失败
- if (index === -1) {
- heatPointsFailedRemoved.push(heatPoint);
- continue;
- }
- //删除热点
- this.features.splice(index, 1);
- }
- var succeed = heatPointsFailedRemoved.length == 0 ? true : false;
- //派发删除features成功的事件
- /**
- * @event HeatMapLayer#featuresremoved
- * @description 删除features成功后触发。
- * @property {Array.<FeatureVector>} features - 事件对象。
- * @property {boolean} succeed - 删除是否成功,false 为失败,true 为成功。
- */
- this._map.fire("featuresremoved", {features: heatPointsFailedRemoved, succeed: succeed});
- this.refresh();
- },
- /**
- * @function HeatMapLayer.prototype.removeAllFeatures
- * @description 移除全部的热点信息。
- */
- removeAllFeatures: function () {
- this.features = [];
- this.refresh();
- },
- /**
- * @function HeatMapLayer.prototype._createCanvasContainer
- * @description 创建热力图绘制容器。
- * @private
- */
- _createCanvasContainer: function () {
- //构建绘图面板
- var parentContainer = this.getPane();
- var animated = this._map.options.zoomAnimation && (external_L_default()).Browser.any3d;
- var className = 'heatMapLayer leaflet-layer leaflet-zoom-' + (animated ? 'animated' : 'hide');
- this.rootCanvas = external_L_default().DomUtil.create("canvas", className, parentContainer);
- var originProp = external_L_default().DomUtil.testProp(['transformOrigin', 'WebkitTransformOrigin', 'msTransformOrigin']);
- this.rootCanvas.id = this.id;
- this.rootCanvas.style[originProp] = '50% 50%';
- this.rootCanvas.style.position = "absolute";
- this.rootCanvas.style.zIndex = 200;
- Util.modifyDOMElement(this.rootCanvas, null, null, null,
- null, null, null, this.opacity);
- this.canvasContext = this.rootCanvas.getContext('2d');
- },
- _updateOpacity: function () {
- var me = this;
- Util.modifyDOMElement(me.rootCanvas, null, null, null, null, null, null, me.options.opacity);
- if (me._map !== null) {
- /**
- * @event HeatMapLayer#changelayer
- * @description 图层透明度更新成功之后触发。
- * @property {HeatMapLayer} layer - 图层。
- * @property {string} property - 改变的图层属性。
- */
- me._map.fire("changelayer", {layer: me, property: "opacity"});
- }
- },
- /**
- * @function HeatMapLayer.prototype.getEvents
- * @description 获取图层事件。
- * @returns {Object} 返回图层支持的事件。
- * @private
- */
- getEvents: function () {
- var me = this;
- var events = {
- zoomend: me._reset,
- moveend: me._reset,
- resize: me._resize
- };
- if (this._map._zoomAnimated) {
- events.zoomanim = me._zoomAnim;
- }
- return events;
- },
- /**
- * @function HeatMapLayer.prototype.toiClientFeature
- * @description 转为 iClient 要素。
- * @param {(GeoJSONObject|HeatMapFeature)} features - 待添加的要素数组。
- * @returns {FeatureVector} 转换后的 iClient 要素。
- */
- toiClientFeature: function (features) {
- if (!external_L_default().Util.isArray(features)) {
- features = [features];
- }
- let featuresTemp = [];
- for (let i = 0, len = features.length; i < len; i++) {
- //支持ThemeFeature类型的feature
- //支持传入ThemeFeature类型,ThemeFeature.geometry instanceof L.LatLng | ThemeFeature.geometry instanceof L.Point
- if (features[i] instanceof HeatMapFeature) {
- featuresTemp.push(features[i].toFeature());
- } else if (["FeatureCollection", "Feature", "Geometry"].indexOf(features[i].type) != -1) {
- const format = new GeoJSON();
- featuresTemp = featuresTemp.concat(format.read(features[i]));
- } else if (features[i].geometry && features[i].geometry.parts) {
- //iServer服务器返回数据格式 todo 暂未找到更好的参数判断,暂用 geometry.parts 试用
- featuresTemp.push(ServerFeature.fromJson(features[i]).toFeature());
- } else {
- throw new Error("Features's type does not match, please check.");
- }
- }
- return featuresTemp;
- },
- _zoomAnim: function (e) {
- var scale = this._map.getZoomScale(e.zoom),
- offset = this._map._getCenterOffset(e.center)._multiplyBy(-scale).subtract(this._map._getMapPanePos());
- if ((external_L_default()).DomUtil.setTransform) {
- external_L_default().DomUtil.setTransform(this.rootCanvas, offset, scale);
- } else {
- this.rootCanvas.style[(external_L_default()).DomUtil.TRANSFORM] = external_L_default().DomUtil.getTranslateString(offset) + ' scale(' + scale + ')';
- }
- },
- //缩放移动重绘
- _reset: function () {
- var me = this;
- me.update();
- var size = me._map.getSize();
- var mapOffset = this._map.containerPointToLayerPoint([0, 0]);
- external_L_default().DomUtil.setPosition(this.rootCanvas, mapOffset);
- if (parseFloat(me.rootCanvas.width) !== parseFloat(size.x)) {
- me.rootCanvas.width = size.x;
- }
- if (parseFloat(me.rootCanvas.height) !== parseFloat(size.y)) {
- me.rootCanvas.height = size.y;
- }
- me.refresh();
- },
- //通知渲染器的尺寸变化
- _resize: function () {
- var me = this;
- var newSize = me._map.getSize();
- me.maxWidth = newSize.x;
- me.maxHeight = newSize.y;
- }
- });
- var heatMapLayer = function (name, options) {
- return new HeatMapLayer(name, options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/carto/index.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/mapv/index.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/theme/index.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/vectortile/index.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- ;// CONCATENATED MODULE: ./src/leaflet/overlay/index.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- ;// CONCATENATED MODULE: ./src/leaflet/services/AddressMatchService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class AddressMatchService
- * @deprecatedclassinstance L.supermap.addressMatchService
- * @constructs AddressMatchService
- * @classdesc 地址匹配服务。
- * @category iServer AddressMatch
- * @extends {ServiceBase}
- * @example
- * new AddressMatchService(url,options)
- * .code(function(result){
- * //doSomething
- * })
- * @param {string} url - 服务地址。
- * @param {Object} options - 参数。
- * @param {string} [options.proxy] - 服务代理地址。
- * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- var AddressMatchService_AddressMatchService = ServiceBase.extend({
- initialize: function (url, options) {
- ServiceBase.prototype.initialize.call(this, url, options);
- },
- /**
- * @function AddressMatchService.prototype.code
- * @description 获取正向地址匹配结果。
- * @param {GeoCodingParameter} params - 正向匹配参数。
- * @param {RequestCallback} callback - 回调函数。
- */
- code: function (params, callback) {
- var me = this;
- var addressMatchService = new AddressMatchService(this.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- }
- });
- addressMatchService.code(Util.urlPathAppend(me.url, 'geocoding'), params);
- },
- /**
- * @function AddressMatchService.prototype.decode
- * @description 获取反向地址匹配结果。
- * @param {GeoDecodingParameter} params - 反向匹配参数。
- * @param {RequestCallback} callback - 回调函数。
- */
- decode: function (params, callback) {
- var me = this;
- var addressMatchService = new AddressMatchService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- }
- });
- addressMatchService.decode(Util.urlPathAppend(me.url, 'geodecoding'), params);
- }
- });
- var addressMatchService = function (url, options) {
- return new AddressMatchService_AddressMatchService(url, options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/services/ChartService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
-
-
-
-
-
-
-
-
- /**
- * @class ChartService
- * @deprecatedclassinstance L.supermap.chartService
- * @classdesc 海图服务。
- * @category iServer Map Chart
- * @extends {ServiceBase}
- * @example
- * new ChartService(url)
- * .queryChart(param,function(result){
- * //doSomething
- * })
- * @param {string} url - 服务地址。
- * @param {Object} options - 参数。
- * @param {string} [options.proxy] - 服务代理地址。
- * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- var ChartService = ServiceBase.extend({
- initialize: function (url, options) {
- ServiceBase.prototype.initialize.call(this, url, options);
- },
- /**
- * @function ChartService.prototype.queryChart
- * @description 查询海图服务。
- * @param {ChartQueryParameters} params - 海图查询参数类。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- queryChart: function (params, callback, resultFormat) {
- var me = this,
- param = me._processParams(params),
- format = me._processFormat(resultFormat);
- var chartQueryService = new ChartQueryService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin:me.options.crossOrigin,
- headers:me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: format
- });
- chartQueryService.processAsync(param);
- },
- /**
- * @function ChartService.prototype.getChartFeatureInfo
- * @description 获取海图物标信息。
- * @param {RequestCallback} callback - 回调函数。
- */
- getChartFeatureInfo: function (callback) {
- var me = this, url = me.url.concat();
- url = Util.urlPathAppend(url, 'chartFeatureInfoSpecs');
- var chartFeatureInfoSpecsService = new ChartFeatureInfoSpecsService(url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin:me.options.crossOrigin,
- headers:me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- }
- });
- chartFeatureInfoSpecsService.processAsync();
- },
- _processParams: function (params) {
- if (!params) {
- return {};
- }
- params.returnContent = (params.returnContent == null) ? true : params.returnContent;
- if (params.chartQueryFilterParameters && !external_L_default().Util.isArray(params.chartQueryFilterParameters)) {
- params.chartQueryFilterParameters = [params.chartQueryFilterParameters];
- }
- if (params.bounds) {
- params.bounds = CommontypesConversion.toSuperMapBounds(params.bounds);
- }
- },
- _processFormat: function (resultFormat) {
- return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
- }
- });
- var chartService = function (url, options) {
- return new ChartService(url, options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/services/DatasetService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
-
-
-
-
-
-
-
- /**
- * @class DatasetService
- * @deprecatedclassinstance L.supermap.datasetService
- * @classdesc 数据集信息服务类。
- * @category iServer Data Dataset
- * @extends {ServiceBase}
- * @param {string} url - 服务地址。
- * @param {Object} options - 参数。
- * @param {string} [options.proxy] - 服务代理地址。
- * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- var DatasetService_DatasetService = ServiceBase.extend({
- initialize: function (url,options) {
- ServiceBase.prototype.initialize.call(this, url,options);
- },
-
- /**
- * @function DatasetService.prototype.getDatasets
- * @description 数据集查询服务。
- * @example
- * new DatasetService(url).getDatasets(datasourceName,function(result){
- * //doSomething
- * });
- * @param {string} datasourceName - 数据源名称。
- * @param {RequestCallback} callback - 回调函数。
- */
- getDatasets: function (datasourceName, callback) {
- if (!datasourceName) {
- return;
- }
- const me = this;
- const datasetService = new DatasetService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- }
- });
- datasetService.getDatasetsService(datasourceName);
- },
- /**
- * @function DatasetService.prototype.getDataset
- * @description 数据集信息查询服务。
- * @example
- * new DatasetService(url).getDataset(datasourceName, datasetName, function(result){
- * //doSomething
- * });
- * @param {string} datasourceName - 数据源名称。
- * @param {string} datasetName - 数据集名称。
- * @param {RequestCallback} callback - 回调函数。
- */
- getDataset: function (datasourceName, datasetName, callback) {
- if (!datasourceName || !datasetName) {
- return;
- }
- const me = this;
- const datasetService = new DatasetService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- }
- });
- datasetService.getDatasetService(datasourceName, datasetName);
- },
- /**
- * @function DatasetService.prototype.setDataset
- * @description 数据集信息设置服务。可实现修改已存在数据集,新增不存在数据集。
- * @example
- * new DatasetService(url).setDataset(params, function(result){
- * //doSomething
- * });
- * @param {CreateDatasetParameters | UpdateDatasetParameters } params - 数据集创建参数类(当前数据源下的数据集不存在时,新建数据集) || 数据集信息更改参数类(当前数据源下的数据集存在时,更改数据集信息)
- * @param {RequestCallback} callback - 回调函数。
- */
- setDataset(params, callback) {
- if(!(params instanceof CreateDatasetParameters) && !(params instanceof UpdateDatasetParameters)){
- return;
- }else if (params instanceof CreateDatasetParameters) {
- var datasetParams = {
- "datasetType": params.datasetType,
- "datasetName": params.datasetName
- }
- }else if(params instanceof UpdateDatasetParameters){
- datasetParams = {
- "datasetName": params.datasetName,
- "isFileCache": params.isFileCache,
- "description": params.description,
- "prjCoordSys": params.prjCoordSys,
- "charset": params.charset
- }
- }
- const me = this;
- const url = Util.urlPathAppend(me.url, `datasources/name/${params.datasourceName}/datasets/name/${params.datasetName}`);
- const datasetService = new DatasetService(url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- processCompleted: callback,
- processFailed: callback
- }
- });
- datasetService.setDatasetService(datasetParams);
- },
- /**
- * @function DatasetService.prototype.deleteDataset
- * @description 指定数据源下的数据集删除服务。
- * @example
- * new DatasetService(url).deleteDataset(datasourceName, datasetName, function(result){
- * //doSomething
- * });
- * @param {string} datasourceName - 数据源名称。
- * @param {string} datasetName - 数据集名称。
- * @param {RequestCallback} callback - 回调函数。
- */
- deleteDataset: function (datasourceName, datasetName, callback) {
- const me = this;
- const url = Util.urlPathAppend(me.url, `datasources/name/${datasourceName}/datasets/name/${datasetName}`);
- const datasetService = new DatasetService(url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- processCompleted: callback,
- processFailed: callback
- }
- });
- datasetService.deleteDatasetService();
- }
- });
- var datasetService = function (url, options) {
- return new DatasetService_DatasetService(url, options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/services/DatasourceService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
-
-
-
-
-
- /**
- * @class DatasourceService
- * @deprecatedclassinstance L.supermap.datasourceService
- * @classdesc 数据源服务类。
- * @category iServer Data Datasource
- * @extends {ServiceBase}
- * @param {string} url - 服务地址。
- * @param {Object} options - 参数。
- * @param {string} [options.proxy] - 服务代理地址。
- * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- var DatasourceService_DatasourceService = ServiceBase.extend({
- initialize: function (url,options) {
- ServiceBase.prototype.initialize.call(this, url, options);
- },
- /**
- * @function DatasourceService.prototype.getDatasources
- * @description 数据源集查询服务。
- * @example
- * new DatasourceService(url).getDatasources(function(result){
- * //doSomething
- * });
- * @param {RequestCallback} callback - 回调函数。
- */
- getDatasources: function (callback) {
- const me = this;
- const datasourceService = new DatasourceService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- }
- });
- datasourceService.getDatasourcesService();
- },
- /**
- * @function DatasourceService.prototype.getDatasource
- * @description 数据源信息查询服务。
- * @example
- * new DatasourceService(url).getDatasource(datasourceName,function(result){
- * //doSomething
- * });
- * @param datasourceName - 数据源名称。
- * @param {RequestCallback} callback - 回调函数。
- */
- getDatasource: function (datasourceName, callback) {
- if (!datasourceName) {
- return;
- }
- const me = this;
- const datasourceService = new DatasourceService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin:me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- }
- });
- datasourceService.getDatasourceService(datasourceName);
- },
- /**
- * @function DatasourceService.prototype.setDatasource
- * @description 数据源信息设置服务。可实现更改当前数据源信息。
- * @example
- * new DatasourceService(url).setDatasource(params, function(result){
- * //doSomething
- * });
- * @param {SetDatasourceParameters} params - 数据源信息设置参数类。
- * @param {RequestCallback} callback - 回调函数。
- */
- setDatasource: function(params, callback) {
- if (!(params instanceof SetDatasourceParameters)) {
- return;
- }
- const datasourceParams = {
- description: params.description ,
- coordUnit: params.coordUnit,
- distanceUnit: params.distanceUnit
- };
- const me = this;
- const url = Util.urlPathAppend(me.url,`datasources/name/${params.datasourceName}`);
- const datasourceService = new DatasourceService(url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- processCompleted: callback,
- processFailed: callback
- }
- });
- datasourceService.setDatasourceService(datasourceParams);
- }
- });
- var datasourceService = function (url, options) {
- return new DatasourceService_DatasourceService(url, options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/services/FieldService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class FieldService
- * @deprecatedclassinstance L.supermap.fieldService
- * @classdesc 字段服务类。
- * @category iServer Data Field
- * @extends {ServiceBase}
- * @example
- * new FieldService(url).getFields(function(result){
- * //doSomething
- * });
- * @param {string} url - 服务地址。
- * @param {Object} options - 参数。
- * @param {string} [options.proxy] - 服务代理地址。
- * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- var FieldService = ServiceBase.extend({
- initialize: function (url,options) {
- ServiceBase.prototype.initialize.call(this, url,options);
- },
- /**
- * @function FieldService.prototype.getFields
- * @description 字段查询服务。
- * @param {FieldParameters} params - 字段信息查询参数类。
- * @param {RequestCallback} callback - 回调函数。
- */
- getFields: function (params, callback) {
- var me = this;
- var getFieldsService = new GetFieldsService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin:me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- datasource: params.datasource,
- dataset: params.dataset
- });
- getFieldsService.processAsync();
- },
- /**
- * @function FieldService.prototype.getFieldStatisticsInfo
- * @description 字段统计服务。
- * @param {FieldStatisticsParameters} params - 字段统计信息查询参数类。
- * @param {RequestCallback} callback - 回调函数。
- */
- getFieldStatisticsInfo: function (params, callback) {
- if (!(params instanceof FieldStatisticsParameters)) {
- return;
- }
- var me = this,
- fieldName = params.fieldName,
- modes = params.statisticMode;
- if (modes && !external_L_default().Util.isArray(modes)) {
- modes = [modes];
- }
- me.currentStatisticResult = {fieldName: fieldName};
- me._statisticsCallback = callback;
- //针对每种统计方式分别进行请求
- modes.forEach(mode => {
- me.currentStatisticResult[mode] = null;
- me._fieldStatisticRequest(params.datasource, params.dataset, fieldName, mode);
- });
- },
- _fieldStatisticRequest: function (dataSourceName, dataSetName, fieldName, statisticMode) {
- var me = this;
- var statisticService = new FieldStatisticService(me.url, {
- eventListeners: {
- scope: me,
- processCompleted: me._processCompleted,
- processFailed: me._statisticsCallback
- },
- datasource: dataSourceName,
- dataset: dataSetName,
- field: fieldName,
- statisticMode: statisticMode,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers
- });
- statisticService.processAsync();
- },
- _processCompleted: function (fieldStatisticResult) {
- var me = this;
- var getAll = true,
- result = fieldStatisticResult.result;
- if (this.currentStatisticResult) {
- if (null == me.currentStatisticResult[result.mode]) {
- this.currentStatisticResult[result.mode] = result.result;
- }
- }
- for (var mode in me.currentStatisticResult) {
- if (null == me.currentStatisticResult[mode]) {
- getAll = false;
- break;
- }
- }
- if (getAll) {
- me._statisticsCallback({result: me.currentStatisticResult});
- }
- }
- });
- var fieldService = function (url, options) {
- return new FieldService(url, options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/services/GridCellInfosService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GridCellInfosService
- * @deprecatedclassinstance L.supermap.gridCellInfosService
- * @classdesc 数据栅格查询服务。
- * @category iServer Data Grid
- * @extends {ServiceBase}
- * @example
- * new GridCellInfosService(url)
- * .getGridCellInfos(param,function(result){
- * //doSomething
- * })
- * @param {string} url - 服务地址。
- * @param {Object} options - 参数。
- * @param {string} [options.proxy] - 服务代理地址。
- * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- var GridCellInfosService = ServiceBase.extend({
- initialize: function (url, options) {
- ServiceBase.prototype.initialize.call(this, url, options);
- },
- /**
- * @function GridCellInfosService.prototype.getGridCellInfos
- * @param {GetGridCellInfosParameters} params - 数据服务栅格查询参数类。
- * @param {RequestCallback} callback - 回调函数。
- */
- getGridCellInfos: function (params, callback) {
- if (!(params instanceof GetGridCellInfosParameters)) {
- return;
- }
- var me = this;
- var gridCellQueryService = new GetGridCellInfosService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers:me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- }
- });
- gridCellQueryService.processAsync(params);
- }
- });
- var gridCellInfosService = function (url, options) {
- return new GridCellInfosService(url, options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/services/GeoprocessingService.js
- /**
- * @class GeoprocessingService
- * @deprecatedclassinstance L.supermap.geoprocessingService
- * @classdesc 处理自动化服务接口类。
- * @version 10.1.0
- * @category iServer ProcessingAutomationService
- * @extends ServiceBase
- * @example
- * //为了安全访问受保护的处理自动化服务,必须通过传递 iserver 令牌( token ),才能正确访问相关资源。
- * SecurityManager.registerToken(serviceUrl, token);
- * var geoprocessingService = new GeoprocessingService("http://localhost:8090/iserver/services/geoprocessing/restjsr/gp/v2")
- geoprocessingService.submitJob(identifier,params, environments, function(serverResult) {
- console.log(serverResult.result);
- var jobID = serverResult.result.jobID;
- var options = {
- interval: 5000,
- statusCallback: function(state) {
- console.log("Job Status: ", state);
- }
- };
- geoprocessingService.waitForJobCompletion(jobID, identifier, options, function(serverResult) {
- console.log(serverResult);
- })
- })
- *
- * @param {string} url - 服务地址。
- * @param {Object} options - 参数。
- * @usage
- */
- const GeoprocessingService_GeoprocessingService = ServiceBase.extend({
- initialize: function (url, options) {
- options = options || {};
- external_L_default().setOptions(this, options);
- ServiceBase.prototype.initialize.call(this, url, options);
- this.headers = {};
- this.crossOrigin = true;
- this.withCredentials = true;
- this.proxy = true;
- },
- /**
- * @function GeoprocessingService.prototype.getTools
- * @description 获取处理自动化工具列表。
- * @param {RequestCallback} callback - 回调函数。
- */
- getTools: function (callback) {
- const geoprocessingJobsService = new GeoprocessingService(this.url, {
- proxy: this.options.proxy,
- withCredentials: this.options.withCredentials,
- crossOrigin: this.options.crossOrigin,
- headers: this.options.headers,
- eventListeners: {
- scope: this,
- processCompleted: callback,
- processFailed: callback
- }
- });
- geoprocessingJobsService.getTools();
- },
- /**
- * @function GeoprocessingService.prototype.getTool
- * @description 获取工具的ID、名称、描述、输入参数、环境参数和输出结果等相关参数。
- * @param {string} identifier - 处理自动化工具ID。
- * @param {RequestCallback} callback - 回调函数。
- */
- getTool: function (identifier, callback) {
- const geoprocessingJobsService = new GeoprocessingService(this.url, {
- proxy: this.options.proxy,
- withCredentials: this.options.withCredentials,
- crossOrigin: this.options.crossOrigin,
- headers: this.options.headers,
- eventListeners: {
- scope: this,
- processCompleted: callback,
- processFailed: callback
- }
- });
- geoprocessingJobsService.getTool(identifier);
- },
- /**
- * @function GeoprocessingService.prototype.execute
- * @description 同步执行处理自动化工具。
- * @param {string} identifier - 处理自动化工具 ID。
- * @param {Object} parameter - 处理自动化工具的输入参数。
- * @param {Object} environment - 处理自动化工具的环境参数。
- * @param {RequestCallback} callback - 回调函数。
- */
- execute: function (identifier, parameter, environment, callback) {
- const geoprocessingJobsService = new GeoprocessingService(this.url, {
- proxy: this.options.proxy,
- withCredentials: this.options.withCredentials,
- crossOrigin: this.options.crossOrigin,
- headers: this.options.headers,
- eventListeners: {
- scope: this,
- processCompleted: callback,
- processFailed: callback
- }
- });
- geoprocessingJobsService.execute(identifier, parameter, environment);
- },
- /**
- * @function GeoprocessingService.prototype.submitJob
- * @description 异步执行处理自动化工具。
- * @param {string} identifier - 处理自动化工具ID。
- * @param {Object} parameter - 处理自动化工具的输入参数。
- * @param {Object} environment - 处理自动化工具的环境参数。
- * @param {RequestCallback} callback - 回调函数。
- */
- submitJob: function (identifier, parameter, environment, callback) {
- const geoprocessingJobsService = new GeoprocessingService(this.url, {
- proxy: this.options.proxy,
- withCredentials: this.options.withCredentials,
- crossOrigin: this.options.crossOrigin,
- headers: this.options.headers,
- eventListeners: {
- scope: this,
- processCompleted: callback,
- processFailed: callback
- }
- });
- geoprocessingJobsService.submitJob(identifier, parameter, environment);
- },
- /**
- * @function GeoprocessingService.prototype.waitForJobCompletion
- * @description 获取处理自动化异步执行状态信息。
- * @param {string} jobId - 处理自动化任务ID。
- * @param {string} identifier - 处理自动化工具ID。
- * @param {Object} options - 参数。
- * @param {number} options.interval - 定时器时间间隔。
- * @param {RequestCallback} options.statusCallback - 任务状态的回调函数。
- * @param {function} callback 回调函数。
- */
- waitForJobCompletion: function (jobId, identifier, options, callback) {
- const geoprocessingJobsService = new GeoprocessingService(this.url, {
- proxy: this.options.proxy,
- withCredentials: this.options.withCredentials,
- crossOrigin: this.options.crossOrigin,
- headers: this.options.headers,
- eventListeners: {
- scope: this,
- processCompleted: callback,
- processFailed: callback
- }
- });
- geoprocessingJobsService.waitForJobCompletion(jobId, identifier, options);
- },
- /**
- * @function GeoprocessingService.prototype.getJobInfo
- * @description 获取处理自动化任务的执行信息。
- * @param {string} identifier - 处理自动化工具 ID。
- * @param {string} jobId - 处理自动化任务 ID。
- * @param {RequestCallback} callback - 回调函数。
- */
- getJobInfo: function (identifier, jobId, callback) {
- const geoprocessingJobsService = new GeoprocessingService(this.url, {
- proxy: this.options.proxy,
- withCredentials: this.options.withCredentials,
- crossOrigin: this.options.crossOrigin,
- headers: this.options.headers,
- eventListeners: {
- scope: this,
- processCompleted: callback,
- processFailed: callback
- }
- });
- geoprocessingJobsService.getJobInfo(identifier, jobId);
- },
- /**
- * @function GeoprocessingService.prototype.cancelJob
- * @description 取消处理自动化任务的异步执行。
- * @param {string} identifier - 处理自动化工具 ID。
- * @param {string} jobId - 处理自动化任务 ID。
- * @param {RequestCallback} callback - 回调函数。
- */
- cancelJob: function (identifier, jobId, callback) {
- const geoprocessingJobsService = new GeoprocessingService(this.url, {
- proxy: this.options.proxy,
- withCredentials: this.options.withCredentials,
- crossOrigin: this.options.crossOrigin,
- headers: this.options.headers,
- eventListeners: {
- scope: this,
- processCompleted: callback,
- processFailed: callback
- }
- });
- geoprocessingJobsService.cancelJob(identifier, jobId);
- },
- /**
- * @function GeoprocessingService.prototype.getJobs
- * @description 获取处理自动化服务任务列表。
- * @param {string} identifier - 处理自动化工具 ID。(传参代表 identifier 算子的任务列表,不传参代表所有任务的列表)
- * @param {RequestCallback} callback - 回调函数。
- */
- getJobs: function (identifier, callback) {
- const geoprocessingJobsService = new GeoprocessingService(this.url, {
- proxy: this.options.proxy,
- withCredentials: this.options.withCredentials,
- crossOrigin: this.options.crossOrigin,
- headers: this.options.headers,
- eventListeners: {
- scope: this,
- processCompleted: callback,
- processFailed: callback
- }
- });
- geoprocessingJobsService.getJobs(identifier);
- },
- /**
- * @function GeoprocessingService.prototype.getResults
- * @description 处理自动化工具异步执行的结果,支持结果过滤。
- * @param {string} identifier - 处理自动化工具 ID。
- * @param {string} jobId - 处理自动化任务 ID。
- * @param {string} filter - 输出异步结果的 ID。(可选,传入 filter 参数时对该处理自动化工具执行的结果进行过滤获取,不填参时显示所有的执行结果)
- * @param {RequestCallback} callback - 回调函数。
- */
- getResults: function (identifier, jobId, filter, callback) {
- const geoprocessingJobsService = new GeoprocessingService(this.url, {
- proxy: this.options.proxy,
- withCredentials: this.options.withCredentials,
- crossOrigin: this.options.crossOrigin,
- headers: this.options.headers,
- eventListeners: {
- scope: this,
- processCompleted: callback,
- processFailed: callback
- }
- });
- geoprocessingJobsService.getResults(identifier, jobId, filter);
- }
- });
- const geoprocessingService = function (url, options) {
- return new GeoprocessingService_GeoprocessingService(url, options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/services/LayerInfoService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class LayerInfoService
- * @deprecatedclassinstance L.supermap.layerInfoService
- * @classdesc 图层信息类。
- * @category iServer Map Layer
- * @extends {ServiceBase}
- * @example
- * new LayerInfoService(url).getLayersInfo(function(result){
- * //doSomething
- * })
- * @param {string} url - 服务地址。
- * @param {Object} options - 参数。
- * @param {string} [options.proxy] - 服务代理地址。
- * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- var LayerInfoService = ServiceBase.extend({
- initialize: function (url, options) {
- ServiceBase.prototype.initialize.call(this, url, options);
- },
- /**
- * @function LayerInfoService.prototype.getLayersInfo
- * @description 获取图层信息。
- * @param {RequestCallback} callback - 回调函数。
- */
- getLayersInfo: function (callback) {
- var me = this;
- var getLayersInfoService = new GetLayersInfoService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- processCompleted: callback,
- processFailed: callback
- }
- });
- getLayersInfoService.processAsync();
- },
- /**
- * @function LayerInfoService.prototype.setLayerInfo
- * @description 设置图层信息服务。可以实现临时图层中子图层的修改。
- * @param {SetLayerInfoParameters} params - 设置图层信息参数类。
- * @param {RequestCallback} callback - 回调函数。
- */
- setLayerInfo: function (params, callback) {
- if (!(params instanceof SetLayerInfoParameters)) {
- return;
- }
- var me = this,
- resourceID = params.resourceID,
- tempLayerName = params.tempLayerName,
- layerInfoParams = params.layerInfo;
- if (!resourceID || !tempLayerName) {
- return;
- }
- var url = Util.urlPathAppend(me.url,`tempLayersSet/${resourceID}/${tempLayerName}`);
- var setLayerInfoService = new SetLayerInfoService(url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- processCompleted: callback,
- processFailed: callback
- }
- });
- setLayerInfoService.processAsync(layerInfoParams);
- },
- /**
- * @function LayerInfoService.prototype.setLayersInfo
- * @description 设置图层信息。可以实现创建新的临时图层和修改现有的临时图层。
- * @param {SetLayersInfoParameters} params - 设置图层信息参数类。
- * @param {RequestCallback} callback - 回调函数。
- */
- setLayersInfo: function (params, callback) {
- if (!(params instanceof SetLayersInfoParameters)) {
- return;
- }
- var me = this,
- resourceID = params.resourceID,
- isTempLayers = params.isTempLayers ? params.isTempLayers : false,
- layersInfo = params.layersInfo;
- if ((isTempLayers && !resourceID) || !layersInfo) {
- return;
- }
- var setLayersInfoService = new SetLayersInfoService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- processCompleted: callback,
- processFailed: callback
- },
- resourceID: resourceID,
- isTempLayers: isTempLayers
- });
- setLayersInfoService.processAsync(layersInfo);
- },
- /**
- * @function LayerInfoService.prototype.setLayerStatus
- * @description 负责将子图层显示控制参数传递到服务端,并获取服务端返回的图层显示状态。
- * @param {SetLayerStatusParameters} params - 子图层显示控制参数类。
- * @param {RequestCallback} callback - 回调函数。
- */
- setLayerStatus: function (params, callback) {
- if (!(params instanceof SetLayerStatusParameters)) {
- return;
- }
- var me = this;
- var setLayerStatusService = new SetLayerStatusService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- processCompleted: callback,
- processFailed: callback
- }
- });
- setLayerStatusService.processAsync(params);
- }
- });
- var layerInfoService = function (url, options) {
- return new LayerInfoService(url, options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/services/MeasureService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class MeasureService
- * @deprecatedclassinstance L.supermap.measureService
- * @classdesc 量算服务类。
- * @category iServer Map Measure
- * @example
- * 用法:
- * new MeasureService(url).measureDistance({
- * geometry:xxx
- * },function(result){
- * //doSomething
- * })
- * @param {string} url - 服务地址。
- * @param {Object} options - 参数。
- * @param {string} [options.proxy] - 服务代理地址。
- * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @extends {ServiceBase}
- * @usage
- */
- var MeasureService_MeasureService = ServiceBase.extend({
- initialize: function (url, options) {
- ServiceBase.prototype.initialize.call(this, url, options);
- },
- /**
- * @function MeasureService.prototype.measureDistance
- * @description 测距。
- * @param {MeasureParameters} params - 量算参数类。
- * @param {RequestCallback} callback - 回调函数。
- */
- measureDistance: function (params, callback) {
- this.measure(MeasureMode.DISTANCE, params, callback);
- return this;
- },
- /**
- * @function MeasureService.prototype.measureArea
- * @description 测面积。
- * @param {MeasureParameters} params - 量算参数类。
- * @param {RequestCallback} callback - 回调函数。
- */
- measureArea: function (params, callback) {
- this.measure(MeasureMode.AREA, params, callback);
- return this;
- },
- /**
- * @function MeasureService.measure
- * @param {MeasureMode} [type=MeasureMode.DISTANCE] - 量算模式。
- * @param {MeasureParameters} params - 量算参数类。
- * @param {RequestCallback} callback - 回调函数。
- */
- measure: function (type, params, callback) {
- if (!(params instanceof MeasureParameters)) {
- return;
- }
- var me = this;
- if (params.geometry) {
- params.geometry = toSuperMapGeometry(params.geometry);
- }
- var measureService = new MeasureService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- measureMode: type,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- }
- });
- measureService.processAsync(params);
- }
- });
- var measureService = function (url, options) {
- return new MeasureService_MeasureService(url, options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/services/NetworkAnalyst3DService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
-
-
-
-
-
-
-
-
- /**
- * @class NetworkAnalyst3DService
- * @deprecatedclassinstance L.supermap.networkAnalyst3DService
- * @classdesc 3D 网络分析服务类。
- * @category iServer FacilityAnalyst3D
- * @extends {ServiceBase}
- * @example
- * new NetworkAnalyst3DService(url)
- * .sinksFacilityAnalyst(params,function(result){
- * //doSomething
- * })
- * @param {string} url - 服务地址。请求网络分析服务,URL应为:
- * "http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
- * @param {Object} options - 参数。
- * @param {string} [options.proxy] - 服务代理地址。
- * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- var NetworkAnalyst3DService = ServiceBase.extend({
- initialize: function (url, options) {
- ServiceBase.prototype.initialize.call(this, url, options);
- },
- /**
- * @function NetworkAnalyst3DService.prototype.sinksFacilityAnalyst
- * @description 汇查找服务。
- * @param {FacilityAnalystSinks3DParameters} params - 最近设施分析参数类(汇查找资源)。
- * @param {RequestCallback} callback - 回调函数。
- */
- sinksFacilityAnalyst: function (params, callback) {
- var me = this;
- var facilityAnalystSinks3DService = new FacilityAnalystSinks3DService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- }
- });
- facilityAnalystSinks3DService.processAsync(params);
- },
- /**
- * @function NetworkAnalyst3DService.prototype.sourcesFacilityAnalyst
- * @description 源查找服务。
- * @param {FacilityAnalystSources3DParameters} params - 最近设施分析参数类(源查找资源)。
- * @param {RequestCallback} callback - 回调函数。
- * @returns {NetworkAnalyst3DService} NetworkAnalyst3DService的实例对象。
- */
- sourcesFacilityAnalyst: function (params, callback) {
- var me = this;
- var facilityAnalystSources3DService = new FacilityAnalystSources3DService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- }
- });
- facilityAnalystSources3DService.processAsync(params);
- },
- /**
- * @function NetworkAnalyst3DService.prototype.traceUpFacilityAnalyst
- * @description 上游追踪资源服务。
- * @param {FacilityAnalystTraceup3DParameters} params - 上游追踪资源参数类。
- * @param {RequestCallback} callback - 回调函数。
- * @returns {NetworkAnalyst3DService} NetworkAnalyst3DService的实例对象。
- */
- traceUpFacilityAnalyst: function (params, callback) {
- var me = this;
- var facilityAnalystTraceup3DService = new FacilityAnalystTraceup3DService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- }
- });
- facilityAnalystTraceup3DService.processAsync(params);
- },
- /**
- * @function NetworkAnalyst3DService.prototype.traceDownFacilityAnalyst
- * @description 下游追踪资源服务。
- * @param {FacilityAnalystTracedown3DParameters} params - 下游追踪资源参数类。
- * @param {RequestCallback} callback - 回调函数。
- */
- traceDownFacilityAnalyst: function (params, callback) {
- var me = this;
- var facilityAnalystTracedown3DService = new FacilityAnalystTracedown3DService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- }
- });
- facilityAnalystTracedown3DService.processAsync(params);
- },
- /**
- * @function NetworkAnalyst3DService.prototype.upstreamFacilityAnalyst
- * @description 上游关键设施查找服务。
- * @param {FacilityAnalystUpstream3DParameters} params - 上游关键设施查找资源参数类。
- * @param {RequestCallback} callback - 回调函数。
- */
- upstreamFacilityAnalyst: function (params, callback) {
- var me = this;
- var facilityAnalystUpstream3DService = new FacilityAnalystUpstream3DService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- }
- });
- facilityAnalystUpstream3DService.processAsync(params);
- }
- });
- var networkAnalyst3DService = function (url, options) {
- return new NetworkAnalyst3DService(url, options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/services/NetworkAnalystService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class NetworkAnalystService
- * @deprecatedclassinstance L.supermap.networkAnalystService
- * @classdesc 网络分析服务类。
- * @category iServer NetworkAnalyst
- * @example
- * new NetworkAnalystService(url)
- * .findPath(params,function(result){
- * //doSomething
- * })
- * @param {string} url - 服务地址。请求网络分析服务,URL应为:
- * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源}。<br>
- * 例如: "http://localhost:8090/iserver/services/test/rest/networkanalyst/WaterNet@FacilityNet"。
- * @param {Object} options - 参数。
- * @param {string} [options.proxy] - 服务代理地址。
- * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @extends {ServiceBase}
- * @usage
- */
- var NetworkAnalystService = ServiceBase.extend({
- initialize: function (url, options) {
- ServiceBase.prototype.initialize.call(this, url, options);
- },
- /**
- * @function NetworkAnalystService.prototype.burstPipelineAnalyst
- * @description 爆管分析服务:即将给定弧段或节点作为爆管点来进行分析,返回关键结点 ID 数组,普通结点 ID 数组及其上下游弧段 ID 数组。
- * @param {BurstPipelineAnalystParameters} params - 爆管分析参数类。
- * @param {RequestCallback} callback - 回调函数。
- */
- burstPipelineAnalyst: function (params, callback) {
- var me = this;
- var burstPipelineAnalystService = new BurstPipelineAnalystService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- }
- });
- burstPipelineAnalystService.processAsync(me._processParams(params));
- },
- /**
- * @function NetworkAnalystService.prototype.computeWeightMatrix
- * @description 耗费矩阵分析服务:根据交通网络分析参数中的耗费字段返回一个耗费矩阵。该矩阵是一个二维数组,用来存储任意两点间的资源消耗。
- * @param {ComputeWeightMatrixParameters} params - 耗费矩阵分析参数类。
- * @param {RequestCallback} callback - 回调函数。
- */
- computeWeightMatrix: function (params, callback) {
- var me = this;
- var computeWeightMatrixService = new ComputeWeightMatrixService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- }
- });
- computeWeightMatrixService.processAsync(me._processParams(params));
- },
- /**
- * @function NetworkAnalystService.prototype.findClosestFacilities
- * @description 最近设施分析服务:指在网络上给定一个事件点和一组设施点,查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
- * @param {FindClosestFacilitiesParameters} params - 最近设施分析参数类。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- findClosestFacilities: function (params, callback, resultFormat) {
- var me = this;
- var findClosestFacilitiesService = new FindClosestFacilitiesService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: me._processFormat(resultFormat)
- });
- findClosestFacilitiesService.processAsync(me._processParams(params));
- },
- /**
- * @function NetworkAnalystService.prototype.streamFacilityAnalyst
- * @description 上游/下游关键设施查找资源服务:查找给定弧段或节点的上游/下游中的关键设施结点,返回关键结点 ID 数组及其下游弧段 ID 数组。
- * @param {FacilityAnalystStreamParameters} params - 上游/下游关键设施查找资源参数类。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- streamFacilityAnalyst: function (params, callback, resultFormat) {
- var me = this;
- var facilityAnalystStreamService = new FacilityAnalystStreamService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: me._processFormat(resultFormat)
- });
- facilityAnalystStreamService.processAsync(me._processParams(params));
- },
- /**
- * @function NetworkAnalystService.prototype.findLocation
- * @description 选址分区分析服务:确定一个或多个待建设施的最佳或最优位置。
- * @param {FindLocationParameters} params - 选址分区分析参数类。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- findLocation: function (params, callback, resultFormat) {
- var me = this;
- var findLocationService = new FindLocationService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: me._processFormat(resultFormat)
- });
- findLocationService.processAsync(me._processParams(params));
- },
- /**
- * @function NetworkAnalystService.prototype.findPath
- * @description 最佳路径分析服务:在网络数据集中指定一些节点,按照节点的选择顺序,顺序访问这些节点从而求解起止点之间阻抗最小的路经。
- * @param {FindPathParameters} params - 最佳路径分析服务参数类。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- findPath: function (params, callback, resultFormat) {
- var me = this;
- var findPathService = new FindPathService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: me._processFormat(resultFormat)
- });
- findPathService.processAsync(me._processParams(params));
- },
- /**
- * @function NetworkAnalystService.prototype.findTSPPaths
- * @description 旅行商分析服务:路径分析的一种,它从起点开始(默认为用户指定的第一点)查找能够遍历所有途经点且花费最小的路径。
- * @param {FindTSPPathsParameters} params - 旅行商分析服务参数类。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- findTSPPaths: function (params, callback, resultFormat) {
- var me = this;
- var findTSPPathsService = new FindTSPPathsService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: me._processFormat(resultFormat)
- });
- findTSPPathsService.processAsync(me._processParams(params));
- },
- /**
- * @function NetworkAnalystService.prototype.findMTSPPaths
- * @description 多旅行商分析服务:也称为物流配送,是指在网络数据集中,给定 M 个配送中心点和 N 个配送目的地(M,N 为大于零的整数)。查找经济有效的配送路径,并给出相应的行走路线。
- * @param {FindMTSPPathsParameters} params - 多旅行商分析服务参数类。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- findMTSPPaths: function (params, callback, resultFormat) {
- var me = this;
- var findMTSPPathsService = new FindMTSPPathsService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: me._processFormat(resultFormat)
- });
- findMTSPPathsService.processAsync(me._processParams(params));
- },
- /**
- * @function NetworkAnalystService.prototype.findServiceAreas
- * @description 服务区分析服务:以指定服务站点为中心,在一定服务范围内查找网络上服务站点能够提供服务的区域范围。
- * @param {FindServiceAreasParameters} params - 服务区分析服务参数类。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- findServiceAreas: function (params, callback, resultFormat) {
- var me = this;
- var findServiceAreasService = new FindServiceAreasService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: me._processFormat(resultFormat)
- });
- findServiceAreasService.processAsync(me._processParams(params));
- },
- /**
- * @function NetworkAnalystService.prototype.updateEdgeWeight
- * @description 更新边的耗费权重服务。
- * @param {UpdateEdgeWeightParameters} params - 更新边的耗费权重服务参数类。
- * @param {RequestCallback} callback -回调函数。
- */
- updateEdgeWeight: function (params, callback) {
- var me = this;
- var updateEdgeWeightService = new UpdateEdgeWeightService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- }
- });
- updateEdgeWeightService.processAsync(params);
- },
- /**
- * @function NetworkAnalystService.prototype.updateTurnNodeWeight
- * @description 转向耗费权重更新服务。
- * @param {UpdateTurnNodeWeightParameters} params - 转向耗费权重更新服务参数类。
- * @param {RequestCallback} callback - 回调函数。
- */
- updateTurnNodeWeight: function (params, callback) {
- var me = this;
- var updateTurnNodeWeightService = new UpdateTurnNodeWeightService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- }
- });
- updateTurnNodeWeightService.processAsync(params);
- },
- _processParams: function (params) {
- if (!params) {
- return {};
- }
- if (params.centers && external_L_default().Util.isArray(params.centers)) {
- params.centers.map(function (point, key) {
- params.centers[key] = (point instanceof (external_L_default()).LatLng) ? {x: point.lng, y: point.lat} : point;
- return params.centers[key];
- });
- }
- if (params.nodes && external_L_default().Util.isArray(params.nodes)) {
- params.nodes.map(function (point, key) {
- params.nodes[key] = (point instanceof (external_L_default()).LatLng) ? {x: point.lng, y: point.lat} : point;
- return params.nodes[key];
- });
- }
- if (params.event && params.event instanceof (external_L_default()).LatLng) {
- params.event = {x: params.event.lng, y: params.event.lat};
- }
- if (params.facilities && external_L_default().Util.isArray(params.facilities)) {
- params.facilities.map(function (point, key) {
- params.facilities[key] = (point instanceof (external_L_default()).LatLng) ? {x: point.lng, y: point.lat} : point;
- return params.facilities[key];
- });
- }
- if (params.parameter && params.parameter.barrierPoints) {
- var barrierPoints = params.parameter.barrierPoints;
- if (external_L_default().Util.isArray(barrierPoints)) {
- barrierPoints.map(function (point, key) {
- params.parameter.barrierPoints[key] = (point instanceof (external_L_default()).LatLng) ? {
- x: point.lng,
- y: point.lat
- } : point;
- return params.parameter.barrierPoints[key];
- });
- } else {
- params.parameter.barrierPoints = [(barrierPoints instanceof (external_L_default()).LatLng) ? {
- x: barrierPoints.lng,
- y: barrierPoints.lat
- } : barrierPoints];
- }
- }
- return params;
- },
- _processFormat: function (resultFormat) {
- return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
- }
- });
- var networkAnalystService = function (url, options) {
- return new NetworkAnalystService(url, options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/services/ProcessingService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ProcessingService
- * @deprecatedclassinstance L.supermap.processingService
- * @classdesc 分布式分析服务类。
- * @category iServer ProcessingService
- * @extends ServiceBase
- * @example
- * new ProcessingService(url)
- * .getKernelDensityJobs(function(result){
- * //doSomething
- * })
- * @param {string} url - 服务地址。
- * @param {Object} options - 参数。
- * @param {string} [options.proxy] - 服务代理地址。
- * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- var ProcessingService = ServiceBase.extend({
- initialize: function(url, options) {
- options = options || {};
- external_L_default().setOptions(this, options);
- ServiceBase.prototype.initialize.call(this, url, options);
- this.kernelDensityJobs = {};
- this.summaryMeshJobs = {};
- this.queryJobs = {};
- this.summaryRegionJobs = {};
- this.vectorClipJobs = {};
- this.overlayGeoJobs = {};
- this.buffersJobs = {};
- this.topologyValidatorJobs = {};
- this.summaryAttributesJobs = {};
- },
- /**
- * @function ProcessingService.prototype.getKernelDensityJobs
- * @description 获取密度分析的列表。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- getKernelDensityJobs: function(callback, resultFormat) {
- var me = this,
- format = me._processFormat(resultFormat);
- var kernelDensityJobsService = new KernelDensityJobsService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: format
- });
- kernelDensityJobsService.getKernelDensityJobs();
- },
- /**
- * @function ProcessingService.prototype.getKernelDensityJob
- * @description 获取指定 ID 的密度分析。
- * @param {string} id - 空间分析的 ID。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- getKernelDensityJob: function(id, callback, resultFormat) {
- var me = this,
- format = me._processFormat(resultFormat);
- var kernelDensityJobsService = new KernelDensityJobsService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: format
- });
- kernelDensityJobsService.getKernelDensityJob(id);
- },
- /**
- * @function ProcessingService.prototype.addKernelDensityJob
- * @description 新建密度分析。
- * @param {KernelDensityJobParameter} params - 密度分析任务参数类。
- * @param {RequestCallback} callback - 回调函数。
- * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- addKernelDensityJob: function(params, callback, seconds, resultFormat) {
- var me = this,
- param = me._processParams(params),
- format = me._processFormat(resultFormat);
- var kernelDensityJobsService = new KernelDensityJobsService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback,
- processRunning: function(job) {
- me.kernelDensityJobs[job.id] = job.state;
- }
- },
- format: format
- });
- kernelDensityJobsService.addKernelDensityJob(param, seconds);
- },
- /**
- * @function ProcessingService.prototype.getKernelDensityJobState
- * @description 获取密度分析的状态。
- * @param {string} id - 密度分析 ID。
- * @returns {Object} 密度分析的状态。
- */
- getKernelDensityJobState: function(id) {
- return this.kernelDensityJobs[id];
- },
- /**
- * @function ProcessingService.prototype.getSummaryMeshJobs
- * @description 获取点聚合分析的列表。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- getSummaryMeshJobs: function(callback, resultFormat) {
- var me = this,
- format = me._processFormat(resultFormat);
- var summaryMeshJobsService = new SummaryMeshJobsService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: format
- });
- summaryMeshJobsService.getSummaryMeshJobs();
- },
- /**
- * @function ProcessingService.prototype.getSummaryMeshJob
- * @description 获取指定 ID 的点聚合分析。
- * @param {string} id - 空间分析的 ID。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- getSummaryMeshJob: function(id, callback, resultFormat) {
- var me = this,
- format = me._processFormat(resultFormat);
- var summaryMeshJobsService = new SummaryMeshJobsService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: format
- });
- summaryMeshJobsService.getSummaryMeshJob(id);
- },
- /**
- * @function ProcessingService.prototype.addSummaryMeshJob
- * @description 新建点聚合分析。
- * @param {SummaryMeshJobParameter} params - 点聚合分析任务参数类。
- * @param {RequestCallback} callback - 回调函数。
- * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- addSummaryMeshJob: function(params, callback, seconds, resultFormat) {
- var me = this,
- param = me._processParams(params),
- format = me._processFormat(resultFormat);
- var summaryMeshJobsService = new SummaryMeshJobsService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback,
- processRunning: function(job) {
- me.summaryMeshJobs[job.id] = job.state;
- }
- },
- format: format
- });
- summaryMeshJobsService.addSummaryMeshJob(param, seconds);
- },
- /**
- * @function ProcessingService.prototype.getSummaryMeshJobState
- * @description 获取点聚合分析的状态。
- * @param {string} id - 点聚合分析的 ID。
- * @returns {Object} 点聚合分析的状态。
- */
- getSummaryMeshJobState: function(id) {
- return this.summaryMeshJobs[id];
- },
- /**
- * @function ProcessingService.prototype.getQueryJobs
- * @description 获取单对象查询分析的列表。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- getQueryJobs: function(callback, resultFormat) {
- var me = this,
- format = me._processFormat(resultFormat);
- var singleObjectQueryJobsService = new SingleObjectQueryJobsService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: format
- });
- singleObjectQueryJobsService.getQueryJobs();
- },
- /**
- * @function ProcessingService.prototype.getQueryJob
- * @description 获取指定 ID 的单对象查询分析。
- * @param {string} id - 空间分析的 ID。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- getQueryJob: function(id, callback, resultFormat) {
- var me = this,
- format = me._processFormat(resultFormat);
- var singleObjectQueryJobsService = new SingleObjectQueryJobsService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: format
- });
- singleObjectQueryJobsService.getQueryJob(id);
- },
- /**
- * @function ProcessingService.prototype.addQueryJob
- * @description 新建单对象查询分析。
- * @param {SingleObjectQueryJobsParameter} params - 单对象空间查询分析任务参数类。
- * @param {RequestCallback} callback - 回调函数。
- * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- addQueryJob: function(params, callback, seconds, resultFormat) {
- var me = this,
- param = me._processParams(params),
- format = me._processFormat(resultFormat);
- var singleObjectQueryJobsService = new SingleObjectQueryJobsService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback,
- processRunning: function(job) {
- me.queryJobs[job.id] = job.state;
- }
- },
- format: format
- });
- singleObjectQueryJobsService.addQueryJob(param, seconds);
- },
- /**
- * @function ProcessingService.prototype.getQueryJobState
- * @description 获取单对象查询分析的状态。
- * @param {string} id - 单对象查询分析的 ID。
- * @returns {Object} 单对象查询分析的状态。
- */
- getQueryJobState: function(id) {
- return this.queryJobs[id];
- },
- /**
- * @function ProcessingService.prototype.getSummaryRegionJobs
- * @description 获取区域汇总分析的列表。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- getSummaryRegionJobs: function(callback, resultFormat) {
- var me = this,
- format = me._processFormat(resultFormat);
- var summaryRegionJobsService = new SummaryRegionJobsService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: format
- });
- summaryRegionJobsService.getSummaryRegionJobs();
- },
- /**
- * @function ProcessingService.prototype.getSummaryRegionJob
- * @description 获取指定 ID 的区域汇总分析。
- * @param {string} id - 区域汇总分析的 ID。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- getSummaryRegionJob: function(id, callback, resultFormat) {
- var me = this,
- format = me._processFormat(resultFormat);
- var summaryRegionJobsService = new SummaryRegionJobsService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: format
- });
- summaryRegionJobsService.getSummaryRegionJob(id);
- },
- /**
- * @function ProcessingService.prototype.addSummaryRegionJob
- * @description 新建区域汇总分析。
- * @param {SummaryRegionJobParameter} params - 区域汇总分析任务参数类。
- * @param {RequestCallback} callback - 回调函数。
- * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- addSummaryRegionJob: function(params, callback, seconds, resultFormat) {
- var me = this,
- param = me._processParams(params),
- format = me._processFormat(resultFormat);
- var summaryRegionJobsService = new SummaryRegionJobsService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback,
- processRunning: function(job) {
- me.summaryRegionJobs[job.id] = job.state;
- }
- },
- format: format
- });
- summaryRegionJobsService.addSummaryRegionJob(param, seconds);
- },
- /**
- * @function ProcessingService.prototype.getSummaryRegionJobState
- * @description 获取区域汇总分析的状态。
- * @param {string} id - 区域汇总分析的 ID。
- * @returns {Object} 区域汇总分析的状态。
- */
- getSummaryRegionJobState: function(id) {
- return this.summaryRegionJobs[id];
- },
- /**
- * @function ProcessingService.prototype.getVectorClipJobs
- * @description 获取矢量裁剪分析的列表。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- getVectorClipJobs: function(callback, resultFormat) {
- var me = this,
- format = me._processFormat(resultFormat);
- var vectorClipJobsService = new VectorClipJobsService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: format
- });
- vectorClipJobsService.getVectorClipJobs();
- },
- /**
- * @function ProcessingService.prototype.getVectorClipJob
- * @description 获取指定 ID 的矢量裁剪分析。
- * @param {string} id - 空间分析的 ID。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- getVectorClipJob: function(id, callback, resultFormat) {
- var me = this,
- format = me._processFormat(resultFormat);
- var vectorClipJobsService = new VectorClipJobsService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: format
- });
- vectorClipJobsService.getVectorClipJob(id);
- },
- /**
- * @function ProcessingService.prototype.addVectorClipJob
- * @description 新建矢量裁剪分析。
- * @param {VectorClipJobsParameter} params - 矢量裁剪分析任务参数类。
- * @param {RequestCallback} callback - 回调函数。
- * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- addVectorClipJob: function(params, callback, seconds, resultFormat) {
- var me = this,
- param = me._processParams(params),
- format = me._processFormat(resultFormat);
- var vectorClipJobsService = new VectorClipJobsService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback,
- processRunning: function(job) {
- me.vectorClipJobs[job.id] = job.state;
- }
- },
- format: format
- });
- vectorClipJobsService.addVectorClipJob(param, seconds);
- },
- /**
- * @function ProcessingService.prototype.getVectorClipJobState
- * @description 获取矢量裁剪分析的状态。
- * @param {string} id - 矢量裁剪分析的 ID。
- * @returns {Object} 矢量裁剪分析的状态。
- */
- getVectorClipJobState: function(id) {
- return this.vectorClipJobs[id];
- },
- /**
- * @function ProcessingService.prototype.getOverlayGeoJobs
- * @description 获取叠加分析的列表。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- getOverlayGeoJobs: function(callback, resultFormat) {
- var me = this,
- format = me._processFormat(resultFormat);
- var overlayGeoJobsService = new OverlayGeoJobsService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: format
- });
- overlayGeoJobsService.getOverlayGeoJobs();
- },
- /**
- * @function ProcessingService.prototype.getOverlayGeoJob
- * @description 获取指定 ID 的叠加分析。
- * @param {string} id - 空间分析的 ID。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- getOverlayGeoJob: function(id, callback, resultFormat) {
- var me = this,
- format = me._processFormat(resultFormat);
- var overlayGeoJobsService = new OverlayGeoJobsService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: format
- });
- overlayGeoJobsService.getOverlayGeoJob(id);
- },
- /**
- * @function ProcessingService.prototype.addOverlayGeoJob
- * @description 新建叠加分析。
- * @param {OverlayGeoJobParameter} params - 叠加分析任务参数类。
- * @param {RequestCallback} callback - 回调函数。
- * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- addOverlayGeoJob: function(params, callback, seconds, resultFormat) {
- var me = this,
- param = me._processParams(params),
- format = me._processFormat(resultFormat);
- var overlayGeoJobsService = new OverlayGeoJobsService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback,
- processRunning: function(job) {
- me.overlayGeoJobs[job.id] = job.state;
- }
- },
- format: format
- });
- overlayGeoJobsService.addOverlayGeoJob(param, seconds);
- },
- /**
- * @function ProcessingService.prototype.getoverlayGeoJobState
- * @description 获取叠加分析的状态。
- * @param {string} id - 叠加分析的 ID。
- * @returns {Object} 叠加分析的状态
- */
- getoverlayGeoJobState: function(id) {
- return this.overlayGeoJobs[id];
- },
- /**
- * @function ProcessingService.prototype.getBuffersJobs
- * @description 获取缓冲区分析的列表。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- getBuffersJobs: function(callback, resultFormat) {
- var me = this,
- format = me._processFormat(resultFormat);
- var buffersAnalystJobsService = new BuffersAnalystJobsService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: format
- });
- buffersAnalystJobsService.getBuffersJobs();
- },
- /**
- * @function ProcessingService.prototype.getBuffersJob
- * @description 获取指定 ID 的缓冲区分析。
- * @param {string} id - 空间分析的 ID。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- getBuffersJob: function(id, callback, resultFormat) {
- var me = this,
- format = me._processFormat(resultFormat);
- var buffersAnalystJobsService = new BuffersAnalystJobsService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: format
- });
- buffersAnalystJobsService.getBuffersJob(id);
- },
- /**
- * @function ProcessingService.prototype.addBuffersJob
- * @description 新建缓冲区分析。
- * @param {BuffersAnalystJobsParameter} params - 缓冲区分析任务参数类。
- * @param {RequestCallback} callback - 回调函数。
- * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- addBuffersJob: function(params, callback, seconds, resultFormat) {
- var me = this,
- param = me._processParams(params),
- format = me._processFormat(resultFormat);
- var buffersAnalystJobsService = new BuffersAnalystJobsService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback,
- processRunning: function(job) {
- me.buffersJobs[job.id] = job.state;
- }
- },
- format: format
- });
- buffersAnalystJobsService.addBuffersJob(param, seconds);
- },
- /**
- * @function ProcessingService.prototype.getBuffersJobState
- * @description 获取缓冲区分析的状态。
- * @param {string} id - 缓冲区分析的 ID。
- * @returns {Object} 缓冲区分析的状态
- */
- getBuffersJobState: function(id) {
- return this.buffersJobs[id];
- },
- /**
- * @function ProcessingService.prototype.getTopologyValidatorJobs
- * @description 获取拓扑检查分析的列表。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- getTopologyValidatorJobs: function(callback, resultFormat) {
- var me = this,
- format = me._processFormat(resultFormat);
- var topologyValidatorJobsService = new TopologyValidatorJobsService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: format
- });
- topologyValidatorJobsService.getTopologyValidatorJobs();
- },
- /**
- * @function ProcessingService.prototype.getTopologyValidatorJob
- * @description 获取指定 ID 的拓扑检查分析。
- * @param {string} id - 空间分析的 ID。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- getTopologyValidatorJob: function(id, callback, resultFormat) {
- var me = this,
- format = me._processFormat(resultFormat);
- var topologyValidatorJobsService = new TopologyValidatorJobsService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: format
- });
- topologyValidatorJobsService.getTopologyValidatorJob(id);
- },
- /**
- * @function ProcessingService.prototype.addTopologyValidatorJob
- * @description 新建拓扑检查分析。
- * @param {TopologyValidatorJobsParameter} params - 拓扑检查分析任务参数类。
- * @param {RequestCallback} callback - 回调函数。
- * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- addTopologyValidatorJob: function(params, callback, seconds, resultFormat) {
- var me = this,
- param = me._processParams(params),
- format = me._processFormat(resultFormat);
- var topologyValidatorJobsService = new TopologyValidatorJobsService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback,
- processRunning: function(job) {
- me.topologyValidatorJobs[job.id] = job.state;
- }
- },
- format: format
- });
- topologyValidatorJobsService.addTopologyValidatorJob(param, seconds);
- },
- /**
- * @function ProcessingService.prototype.getTopologyValidatorJobState
- * @description 获取拓扑检查分析的状态。
- * @param {string} id - 拓扑检查分析的 ID。
- * @returns {Object} 拓扑检查分析的状态。
- */
- getTopologyValidatorJobState: function(id) {
- return this.topologyValidatorJobs[id];
- },
- /**
- * @function ProcessingService.prototype.getSummaryAttributesJobs
- * @description 获取属性汇总分析的列表。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- getSummaryAttributesJobs: function(callback, resultFormat) {
- var me = this,
- format = me._processFormat(resultFormat);
- var summaryAttributesJobsService = new SummaryAttributesJobsService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: format
- });
- summaryAttributesJobsService.getSummaryAttributesJobs();
- },
- /**
- * @function ProcessingService.prototype.getSummaryAttributesJob
- * @description 获取指定 ID 的属性汇总分析。
- * @param {string} id - 空间分析的 ID。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- getSummaryAttributesJob: function(id, callback, resultFormat) {
- var me = this,
- format = me._processFormat(resultFormat);
- var summaryAttributesJobsService = new SummaryAttributesJobsService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: format
- });
- summaryAttributesJobsService.getSummaryAttributesJob(id);
- },
- /**
- * @function ProcessingService.prototype.addSummaryAttributesJob
- * @description 新建属性汇总分析。
- * @param {SummaryAttributesJobsParameter} params - 属性汇总分析任务参数类。
- * @param {RequestCallback} callback - 回调函数。
- * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- addSummaryAttributesJob: function(params, callback, seconds, resultFormat) {
- var me = this,
- param = me._processParams(params),
- format = me._processFormat(resultFormat);
- var summaryAttributesJobsService = new SummaryAttributesJobsService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback,
- processRunning: function(job) {
- me.summaryAttributesJobs[job.id] = job.state;
- }
- },
- format: format
- });
- summaryAttributesJobsService.addSummaryAttributesJob(param, seconds);
- },
- /**
- * @function ProcessingService.prototype.getSummaryAttributesJobState
- * @description 获取属性汇总分析的状态。
- * @param {string} id - 属性汇总分析的 ID。
- * @returns {Object} 属性汇总分析的状态。
- */
- getSummaryAttributesJobState: function(id) {
- return this.summaryAttributesJobs[id];
- },
- _processFormat: function(resultFormat) {
- return resultFormat ? resultFormat : DataFormat.GEOJSON;
- },
- _processParams: function(params) {
- if (!params) {
- return {};
- }
- if (params.bounds) {
- params.bounds = CommontypesConversion.toSuperMapBounds(params.bounds);
- }
- if (params.query) {
- params.query = CommontypesConversion.toSuperMapBounds(params.query);
- }
- if (params.geometryQuery) {
- params.geometryQuery = CommontypesConversion.toProcessingParam(params.geometryQuery);
- }
- if (params.geometryClip) {
- params.geometryClip = CommontypesConversion.toProcessingParam(params.geometryClip);
- }
- return params;
- }
- });
- var processingService = function(url, options) {
- return new ProcessingService(url, options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/services/QueryService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class QueryService
- * @deprecatedclassinstance L.supermap.queryService
- * @classdesc 地图查询服务类。
- * @category iServer Map QueryResults
- * @extends {ServiceBase}
- * @param {string} url - 服务地址。
- * @param {Object} options - 参数。
- * @param {string} [options.proxy] - 服务代理地址。
- * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @example
- * new QueryService(url).queryByBounds(param,function(result){
- * //doSomething
- * })
- * @usage
- */
- var QueryService_QueryService = ServiceBase.extend({
- initialize: function(url, options) {
- ServiceBase.prototype.initialize.call(this, url, options);
- },
- /**
- * @function QueryService.prototype.queryByBounds
- * @description bounds 查询地图服务。
- * @param {QueryByBoundsParameters} params - Bounds 查询参数类。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- queryByBounds: function(params, callback, resultFormat) {
- var me = this;
- var queryService = new QueryByBoundsService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: me._processFormat(resultFormat)
- });
- queryService.processAsync(me._processParams(params));
- },
- /**
- * @function QueryService.prototype.queryByDistance
- * @description 地图距离查询服务。
- * @param {QueryByDistanceParameters} params - Distance 查询参数类。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- queryByDistance: function(params, callback, resultFormat) {
- var me = this;
- var queryByDistanceService = new QueryByDistanceService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: me._processFormat(resultFormat)
- });
- queryByDistanceService.processAsync(me._processParams(params));
- },
- /**
- * @function QueryService.prototype.queryBySQL
- * @description 地图 SQL 查询服务。
- * @param {QueryBySQLParameters} params - SQL 查询参数类。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- queryBySQL: function(params, callback, resultFormat) {
- var me = this;
- var queryBySQLService = new QueryBySQLService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: me._processFormat(resultFormat)
- });
- queryBySQLService.processAsync(me._processParams(params));
- },
- /**
- * @function QueryService.prototype.queryByGeometry
- * @description 地图几何查询服务。
- * @param {QueryByGeometryParameters} params - Geometry 查询相关参数类。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- queryByGeometry: function(params, callback, resultFormat) {
- var me = this;
- var queryByGeometryService = new QueryByGeometryService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: me._processFormat(resultFormat)
- });
- queryByGeometryService.processAsync(me._processParams(params));
- },
- _processParams: function(params) {
- if (!params) {
- return {};
- }
- params.returnContent = params.returnContent == null ? true : params.returnContent;
- if (params.queryParams && !external_L_default().Util.isArray(params.queryParams)) {
- params.queryParams = [params.queryParams];
- }
- if (params.bounds) {
- params.bounds = CommontypesConversion.toSuperMapBounds(params.bounds);
- }
- if (params.geometry) {
- if (params.geometry instanceof (external_L_default()).Point) {
- params.geometry = new Point(params.geometry.x, params.geometry.y);
- } else {
- params.geometry = toSuperMapGeometry(params.geometry);
- }
- }
- return params;
- },
- _processFormat: function(resultFormat) {
- return resultFormat ? resultFormat : DataFormat.GEOJSON;
- }
- });
- var queryService = function(url, options) {
- return new QueryService_QueryService(url, options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/services/SpatialAnalystService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class SpatialAnalystService
- * @deprecatedclassinstance L.supermap.spatialAnalystService
- * @classdesc 空间分析服务类。提供:地区太阳辐射、缓冲区分析、点密度分析、动态分段分析、空间关系分析、插值分析、栅格代数运算、叠加分析、路由定位、路由测量计算、表面分析、地形曲率计算、泰森多边形分析。
- * @category iServer SpatialAnalyst
- * @example
- * new SpatialAnalystService(url)
- * .bufferAnalysis(params,function(result){
- * //doSomething
- * })
- * @param {string} url - 服务地址。
- * @param {Object} options - 参数。
- * @param {string} [options.proxy] - 服务代理地址。
- * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @extends {ServiceBase}
- * @usage
- */
- var SpatialAnalystService = ServiceBase.extend({
- initialize: function(url, options) {
- ServiceBase.prototype.initialize.call(this, url, options);
- },
- /**
- * @function SpatialAnalystService.prototype.getAreaSolarRadiationResult
- * @description 地区太阳辐射。
- * @param {AreaSolarRadiationParameters} params - 地区太阳辐射参数类。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- getAreaSolarRadiationResult: function(params, callback, resultFormat) {
- var me = this;
- var areaSolarRadiationService = new AreaSolarRadiationService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: me._processFormat(resultFormat)
- });
- areaSolarRadiationService.processAsync(params);
- },
- /**
- * @function SpatialAnalystService.prototype.bufferAnalysis
- * @description 缓冲区分析。
- * @param {DatasetBufferAnalystParameters} params - 数据集缓冲区分析参数类。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- bufferAnalysis: function(params, callback, resultFormat) {
- var me = this;
- var bufferAnalystService = new BufferAnalystService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: me._processFormat(resultFormat)
- });
- bufferAnalystService.processAsync(me._processParams(params));
- },
- /**
- * @function SpatialAnalystService.prototype.densityAnalysis
- * @description 点密度分析。
- * @param {DensityKernelAnalystParameters} params - 核密度分析参数类。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- densityAnalysis: function(params, callback, resultFormat) {
- var me = this;
- var densityAnalystService = new DensityAnalystService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: me._processFormat(resultFormat)
- });
- densityAnalystService.processAsync(me._processParams(params));
- },
- /**
- * @function SpatialAnalystService.prototype.generateSpatialData
- * @description 动态分段分析。
- * @param {GenerateSpatialDataParameters} params - 动态分段操作参数类。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- generateSpatialData: function(params, callback, resultFormat) {
- var me = this;
- var generateSpatialDataService = new GenerateSpatialDataService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: me._processFormat(resultFormat)
- });
- generateSpatialDataService.processAsync(params);
- },
- /**
- * @function SpatialAnalystService.prototype.geoRelationAnalysis
- * @description 空间关系分析。
- * @param {GeoRelationAnalystParameters} params - 空间关系分析服务参数类。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- geoRelationAnalysis: function(params, callback, resultFormat) {
- var me = this;
- var geoRelationAnalystService = new GeoRelationAnalystService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: me._processFormat(resultFormat)
- });
- geoRelationAnalystService.processAsync(params);
- },
- /**
- * @function SpatialAnalystService.prototype.interpolationAnalysis
- * @description 插值分析。
- * @param {InterpolationDensityAnalystParameters|InterpolationIDWAnalystParameters|InterpolationRBFAnalystParameters|InterpolationKrigingAnalystParameters} params - 样条插值(径向基函数插值法)分析参数类。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- interpolationAnalysis: function(params, callback, resultFormat) {
- var me = this;
- var interpolationAnalystService = new InterpolationAnalystService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: me._processFormat(resultFormat)
- });
- interpolationAnalystService.processAsync(me._processParams(params));
- },
- /**
- * @function SpatialAnalystService.prototype.mathExpressionAnalysis
- * @description 栅格代数运算。
- * @param {MathExpressionAnalysisParameters} params - 栅格代数运算参数类。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- mathExpressionAnalysis: function(params, callback, resultFormat) {
- var me = this;
- var mathExpressionAnalysisService = new MathExpressionAnalysisService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: me._processFormat(resultFormat)
- });
- mathExpressionAnalysisService.processAsync(me._processParams(params));
- },
- /**
- * @function SpatialAnalystService.prototype.overlayAnalysis
- * @description 叠加分析。
- * @param {DatasetOverlayAnalystParameters|GeometryOverlayAnalystParameters} params - 数据集叠加分析参数类。|| 几何对象叠加分析参数类。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- overlayAnalysis: function(params, callback, resultFormat) {
- var me = this;
- var overlayAnalystService = new OverlayAnalystService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: me._processFormat(resultFormat)
- });
- overlayAnalystService.processAsync(me._processParams(params));
- },
- /**
- * @function SpatialAnalystService.prototype.routeCalculateMeasure
- * @description 路由测量计算。
- * @param {RouteCalculateMeasureParameters} params - 基于路由对象计算指定点 M 值操作的参数类。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- routeCalculateMeasure: function(params, callback, resultFormat) {
- var me = this;
- var routeCalculateMeasureService = new RouteCalculateMeasureService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: me._processFormat(resultFormat)
- });
- routeCalculateMeasureService.processAsync(me._processParams(params));
- },
- /**
- * @function SpatialAnalystService.prototype.routeLocate
- * @description 路由定位。
- * @param {RouteLocatorParameters} params - 路由对象定位空间对象的参数类。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- routeLocate: function(params, callback, resultFormat) {
- var me = this;
- var routeLocatorService = new RouteLocatorService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: me._processFormat(resultFormat)
- });
- routeLocatorService.processAsync(me._processParams(params));
- },
- /**
- * @function SpatialAnalystService.prototype.surfaceAnalysis
- * @description 表面分析。
- * @param {SurfaceAnalystParameters} params - 表面分析提取操作参数类。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- surfaceAnalysis: function(params, callback, resultFormat) {
- var me = this;
- var surfaceAnalystService = new SurfaceAnalystService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: me._processFormat(resultFormat)
- });
- surfaceAnalystService.processAsync(me._processParams(params));
- },
- /**
- * @function SpatialAnalystService.prototype.terrainCurvatureCalculate
- * @description 地形曲率计算。
- * @param {TerrainCurvatureCalculationParameters} params - 地形曲率计算参数类。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- terrainCurvatureCalculate: function(params, callback, resultFormat) {
- var me = this;
- var terrainCurvatureCalculationService = new TerrainCurvatureCalculationService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: me._processFormat(resultFormat)
- });
- terrainCurvatureCalculationService.processAsync(params);
- },
- /**
- * @function SpatialAnalystService.prototype.thiessenAnalysis
- * @description 泰森多边形分析。
- * @param {DatasetThiessenAnalystParameters|GeometryThiessenAnalystParameters} params - 数据集泰森多边形分析参数类。
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- thiessenAnalysis: function(params, callback, resultFormat) {
- var me = this;
- var thiessenAnalystService = new ThiessenAnalystService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: me._processFormat(resultFormat)
- });
- thiessenAnalystService.processAsync(me._processParams(params));
- },
- /**
- * @function SpatialAnalystService.prototype.geometrybatchAnalysis
- * @description 批量空间分析。
- * @param {Array.<Object>} params -批量分析参数对象数组;包括:</br>
- * @param {string} params.analystName - 空间分析方法的名称。包括:</br>
- * "buffer","overlay","interpolationDensity","interpolationidw","interpolationRBF","interpolationKriging","isoregion","isoline"
- * @param {Object} param - 空间分析类型对应的请求参数,包括:</br>
- * {@link GeometryBufferAnalystParameters} 缓冲区分析参数类。</br>
- * {@link GeometryOverlayAnalystParameters} 叠加分析参数类。</br>
- * {@link InterpolationAnalystParameters} 插值分析参数类。</br>
- * {@link SurfaceAnalystParameters} 表面分析参数类。</br>
- * @param {RequestCallback} callback - 回调函数。
- * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
- */
- geometrybatchAnalysis: function(params, callback, resultFormat) {
- var me = this;
- var geometryBatchAnalystService = new GeometryBatchAnalystService(me.url, {
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- },
- format: me._processFormat(resultFormat)
- });
- //处理批量分析中各个分类类型的参数:
- var analystParameters = [];
- for (var i = 0; i < params.length; i++) {
- var tempParameter = params[i];
- analystParameters.push({
- analystName: tempParameter.analystName,
- param: me._processParams(tempParameter.param)
- });
- }
- geometryBatchAnalystService.processAsync(analystParameters);
- },
- _processParams: function(params) {
- if (!params) {
- return {};
- }
- if (params.bounds) {
- params.bounds = CommontypesConversion.toSuperMapBounds(params.bounds);
- }
- if (params.inputPoints) {
- for (let i = 0; i < params.inputPoints.length; i++) {
- let inputPoint = params.inputPoints[i];
- if (external_L_default().Util.isArray(inputPoint)) {
- params.inputPoints[i] = { x: inputPoint[0], y: inputPoint[1], tag: inputPoint[2] };
- }
- }
- }
- if (params.points) {
- for (let i = 0; i < params.points.length; i++) {
- let point = params.points[i];
- if (external_L_default().Util.isArray(point)) {
- params.points[i] = { x: point[0], y: point[1] };
- } else if (point instanceof (external_L_default()).LatLng) {
- params.points[i] = { x: point.lng, y: point.lat };
- } else {
- params.points[i] = { x: point.x, y: point.y };
- }
- }
- }
- if (params.point) {
- if (external_L_default().Util.isArray(params.point)) {
- params.point = { x: params.point[0], y: params.point[1] };
- } else if (params.point instanceof (external_L_default()).LatLng) {
- params.point = { x: params.point.lng, y: params.point.lat };
- } else {
- params.point = { x: params.point.x, y: params.point.y };
- }
- }
- if (params.extractRegion) {
- params.extractRegion = toSuperMapGeometry(params.extractRegion);
- }
- if (params.extractParameter && params.extractParameter.clipRegion) {
- params.extractParameter.clipRegion = toSuperMapGeometry(params.extractParameter.clipRegion);
- }
- if (params.clipParam && params.clipParam.clipRegion) {
- params.clipParam.clipRegion = toSuperMapGeometry(params.clipParam.clipRegion);
- }
- //支持格式:Vector Layers; GeoJson
- if (params.sourceGeometry) {
- var SRID = null;
- if (params.sourceGeometrySRID) {
- SRID = params.sourceGeometrySRID;
- }
- params.sourceGeometry = toSuperMapGeometry(params.sourceGeometry);
- if (SRID) {
- params.sourceGeometry.SRID = SRID;
- }
- delete params.sourceGeometry.sourceGeometrySRID;
- }
- if (params.operateGeometry) {
- params.operateGeometry = toSuperMapGeometry(params.operateGeometry);
- }
- //支持传入多个几何要素进行叠加分析:
- if (params.sourceGeometries) {
- var sourceGeometries = [];
- for (var k = 0; k < params.sourceGeometries.length; k++) {
- sourceGeometries.push(toSuperMapGeometry(params.sourceGeometries[k]));
- }
- params.sourceGeometries = sourceGeometries;
- }
- //支持传入多个几何要素进行叠加分析:
- if (params.operateGeometries) {
- var operateGeometries = [];
- for (var j = 0; j < params.operateGeometries.length; j++) {
- operateGeometries.push(toSuperMapGeometry(params.operateGeometries[j]));
- }
- params.operateGeometries = operateGeometries;
- }
- if (params.sourceRoute) {
- if (params.sourceRoute instanceof (external_L_default()).Polyline) {
- var target = {};
- target.type = 'LINEM';
- target.parts = [params.sourceRoute.getLatLngs().length];
- target.points = [];
- for (let i = 0; i < params.sourceRoute.getLatLngs().length; i++) {
- let point = params.sourceRoute.getLatLngs()[i];
- target.points = target.points.concat({ x: point.lng, y: point.lat, measure: point.alt });
- }
- params.sourceRoute = target;
- }
- }
- if (params.operateRegions && external_L_default().Util.isArray(params.operateRegions)) {
- params.operateRegions.map(function(geometry, key) {
- params.operateRegions[key] = toSuperMapGeometry(geometry);
- return params.operateRegions[key];
- });
- }
- // if (params.sourceRoute && params.sourceRoute.components && L.Util.isArray(params.sourceRoute.components)) {
- // params.sourceRoute.components.map(function (geometry, key) {
- // params.sourceRoute.components[key] = Util.toSuperMapGeometry(geometry);
- // });
- // }
- return params;
- },
- _processFormat: function(resultFormat) {
- return resultFormat ? resultFormat : DataFormat.GEOJSON;
- }
- });
- var spatialAnalystService = function(url, options) {
- return new SpatialAnalystService(url, options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/services/ThemeService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ThemeService
- * @deprecatedclassinstance L.supermap.themeService
- * @classdesc 专题图服务类。
- * @category iServer Map Theme
- * @extends {ServiceBase}
- * @example
- * new ThemeService(url,{
- * projection:projection
- * }).getThemeInfo(params,function(result){
- * //doSomething
- * });
- * @param {string} url - 服务地址。
- * @param {Object} options - 参数。
- * @param {string} [options.proxy] - 服务代理地址。
- * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- var ThemeService_ThemeService = ServiceBase.extend({
- initialize: function (url, options) {
- ServiceBase.prototype.initialize.call(this, url, options);
- },
- /**
- * @function ThemeService.prototype.getThemeInfo
- * @description 获取专题图信息。
- * @param {ThemeParameters} params - 专题图参数类。
- * @param {RequestCallback} callback - 回调函数。
- */
- getThemeInfo: function (params, callback) {
- var me = this;
- var themeService = new ThemeService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers:me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- }
- });
- themeService.processAsync(params);
- }
- });
- var themeService = function (url, options) {
- return new ThemeService_ThemeService(url, options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/services/TrafficTransferAnalystService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class TrafficTransferAnalystService
- * @deprecatedclassinstance L.supermap.trafficTransferAnalystService
- * @classdesc 交通换乘分析服务类。
- * @category iServer TrafficTransferAnalyst
- * @example
- * new TrafficTransferAnalystService(url).queryStop(params,function(result){
- * //doSomething
- * })
- * @extends {ServiceBase}
- * @param {string} url - 服务地址。
- * @param {Object} options - 参数。
- * @param {string} [options.proxy] - 服务代理地址。
- * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- var TrafficTransferAnalystService = ServiceBase.extend({
- initialize: function(url, options) {
- ServiceBase.prototype.initialize.call(this, url, options);
- },
- /**
- * @function TrafficTransferAnalystService.prototype.queryStop
- * @description 站点查询服务。
- * @param {StopQueryParameters} params - 站点查询参数类。
- * @param {RequestCallback} callback - 回调函数。
- */
- queryStop: function(params, callback) {
- var me = this;
- var stopQueryService = new StopQueryService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- }
- });
- stopQueryService.processAsync(params);
- },
- /**
- * @function TrafficTransferAnalystService.prototype.analysisTransferPath
- * @description 交通换乘线路查询服务。
- * @param {TransferPathParameters} params - 交通换乘线路查询参数类。
- * @param {RequestCallback} callback - 回调函数。
- */
- analysisTransferPath: function(params, callback) {
- var me = this;
- var transferPathService = new TransferPathService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- }
- });
- transferPathService.processAsync(me._processParams(params));
- },
- /**
- * @function TrafficTransferAnalystService.prototype.analysisTransferSolution
- * @description 交通换乘方案查询服务。
- * @param {TransferSolutionParameters} params - 交通换乘方案查询参数类。
- * @param {RequestCallback} callback - 回调函数。
- */
- analysisTransferSolution: function(params, callback) {
- var me = this;
- var transferSolutionService = new TransferSolutionService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- }
- });
- transferSolutionService.processAsync(me._processParams(params));
- },
- _processParams: function(params) {
- if (!params) {
- return {};
- }
- if (params.points && external_L_default().Util.isArray(params.points)) {
- params.points.map(function(point, key) {
- params.points[key] = point instanceof (external_L_default()).LatLng ? { x: point.lng, y: point.lat } : point;
- return params.points[key];
- });
- }
- return params;
- }
- });
- var trafficTransferAnalystService = function(url, options) {
- return new TrafficTransferAnalystService(url, options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/services/WebPrintingJobService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
-
-
-
-
-
- /**
- * @class WebPrintingJobService
- * @deprecatedclassinstance L.supermap.webPrintingJobService
- * @classdesc Web 打印服务类。
- * 提供:创建 Web 打印任务,获取 Web 打印任务内容,获取 Web 打印输出文档流,获取 Web 打印服务的布局模板信息。
- * @category iServer WebPrintingJob
- * @example
- * new WebPrintingJobService(url)
- * .createWebPrintingJob(param,function(result){
- * //doSomething
- * })
- * @extends {ServiceBase}
- * @version 10.1.0
- * @param {string} url - 服务地址。
- * @param {Object} options - 参数。
- * @param {string} [options.proxy] - 服务代理地址。
- * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- var WebPrintingJobService = ServiceBase.extend({
- initialize: function(url, options) {
- ServiceBase.prototype.initialize.call(this, url, options);
- },
- /**
- * @function WebPrintingJobService.prototype.createWebPrintingJob
- * @description 创建 Web 打印任务。
- * @param {WebPrintingJobParameters} params - Web 打印参数类。
- * @param {RequestCallback} callback - 回调函数。
- */
- createWebPrintingJob(params, callback) {
- if (!params) {
- return;
- }
- var me = this;
- var webPrintingService = new WebPrintingService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- }
- });
- webPrintingService.createWebPrintingJob(me._processParams(params));
- },
- /**
- * @function WebPrintingJobService.prototype.getPrintingJob
- * @description 获取 Web 打印输出文档任务。
- * @param {string} jobId - Web 打印输入文档任务 Id。
- * @param {RequestCallback} callback - 回调函数。
- */
- getPrintingJob: function(jobId, callback) {
- var me = this;
- var webPrintingService = new WebPrintingService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- }
- });
- webPrintingService.getPrintingJob(jobId);
- },
- /**
- * @function WebPrintingJobService.prototype.getPrintingJobResult
- * @description 获取 Web 打印任务的输出文档。
- * @param {string} jobId - Web 打印输入文档任务 Id。
- * @param {RequestCallback} callback - 回调函数。
- */
- getPrintingJobResult: function(jobId, callback) {
- var me = this;
- var webPrintingService = new WebPrintingService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- }
- });
- webPrintingService.getPrintingJobResult(jobId);
- },
- /**
- * @function WebPrintingJobService.prototype.getLayoutTemplates
- * @description 查询 Web 打印服务所有可用的模板信息。
- * @param {RequestCallback} callback - 回调函数。
- */
- getLayoutTemplates: function(callback) {
- var me = this;
- var webPrintingService = new WebPrintingService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- }
- });
- webPrintingService.getLayoutTemplates();
- },
- _processParams(params) {
- if (params.layoutOptions && params.layoutOptions.littleMapOptions) {
- params.layoutOptions.littleMapOptions.center = this._toPointObject(
- params.layoutOptions.littleMapOptions.center
- );
- }
- if (params.exportOptions) {
- params.exportOptions.center = this._toPointObject(params.exportOptions.center);
- }
- return params;
- },
- _toPointObject(point) {
- if (external_L_default().Util.isArray(point)) {
- return {
- x: point[0],
- y: point[1]
- };
- } else if (point instanceof Point || point instanceof (external_L_default()).Point) {
- return {
- x: point.x,
- y: point.y
- };
- } else if (point instanceof (external_L_default()).LatLng) {
- return {
- x: point.lng,
- y: point.lat
- };
- }
- return point;
- }
- });
- var webPrintingJobService = function(url, options) {
- return new WebPrintingJobService(url, options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/services/ImageService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ImageService
- * @deprecatedclassinstance L.supermap.imageService
- * @version 10.2.0
- * @constructs ImageService
- * @classdesc 影像服务类
- * @category iServer Image
- * @extends {ServiceBase}
- * @example
- * new ImageService(url,options)
- * .getCollections(function(result){
- * //doSomething
- * })
- * @param {string} url - 服务地址。
- * @param {Object} options - 参数。
- * @param {string} [options.proxy] - 服务代理地址。
- * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- var ImageService = ServiceBase.extend({
- initialize: function (url, options) {
- ServiceBase.prototype.initialize.call(this, url, options);
- },
- /**
- * @function ImageService.prototype.getCollections
- * @description 返回影像集合列表(Collections)。
- * @param {RequestCallback} callback - 回调函数。
- */
- getCollections: function (callback) {
- var me = this;
- var ImageService = new ImageService_ImageService(this.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- }
- });
- ImageService.getCollections();
- },
- /**
- * @function ImageService.prototype.getCollectionByID
- * @description ID值等于`collectionId`参数值的影像集合(Collection)。 ID值用于在服务中唯一标识该影像集合。
- * @param {string} collectionId 影像集合( Collection )的 ID ,在一个影像服务中唯一标识影像集合。
- * @param {RequestCallback} callback - 回调函数。
- */
- getCollectionByID: function (collectionId, callback) {
- var me = this;
- var ImageService = new ImageService_ImageService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- }
- });
- ImageService.getCollectionByID(collectionId);
- },
- /**
- * @function ImageService.prototype.search
- * @description 查询与过滤条件匹配的影像数据。
- * @param {ImageSearchParameter} [itemSearch] 查询参数
- * @param {RequestCallback} callback - 回调函数。
- */
- search: function (itemSearch, callback) {
- var me = this;
- var ImageService = new ImageService_ImageService(me.url, {
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- }
- });
- ImageService.search(itemSearch);
- }
- });
- var imageService = function (url, options) {
- return new ImageService(url, options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/services/ImageCollectionService.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ImageCollectionService
- * @deprecatedclassinstance L.supermap.imageCollectionService
- * @version 10.2.0
- * @constructs ImageCollectionService
- * @classdesc 影像集合服务类
- * @category iServer Image
- * @extends {ServiceBase}
- * @example
- * new ImageCollectionService(url,options)
- * .getLegend(queryParams, function(result){
- * //doSomething
- * })
- * @param {string} url - 服务地址。
- * @param {Object} options - 参数。
- * @param {string} options.collectionId 影像集合(Collection)的ID,在一个影像服务中唯一标识影像集合。
- * @param {string} [options.proxy] - 服务代理地址。
- * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
- * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
- * @param {Object} [options.headers] - 请求头。
- * @usage
- */
- var ImageCollectionService = ServiceBase.extend({
- initialize: function (url, options) {
- ServiceBase.prototype.initialize.call(this, url, options);
- },
- /**
- * @function ImageCollectionService.prototype.getLegend
- * @param {Object} queryParams query 参数。
- * @param {ImageRenderingRule} [queryParams.renderingRule] 指定影像显示的风格,包含拉伸显示方式、颜色表、波段组合以及应用栅格函数进行快速处理等。默认使用发布服务时所配置的风格。
- * @param {RequestCallback} callback - 回调函数。
- */
- getLegend: function (queryParams, callback) {
- var me = this;
- var ImageCollectionService = new ImageCollectionService_ImageCollectionService(this.url, {
- collectionId: me.options.collectionId,
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- }
- });
- ImageCollectionService.getLegend(queryParams);
- },
- /**
- * @function ImageCollectionService.prototype.getStatistics
- * @description 返回当前影像集合的统计信息。包括文件数量,文件大小等信息。
- * @param {RequestCallback} callback - 回调函数。
- */
- getStatistics: function (callback) {
- var me = this;
- var ImageCollectionService = new ImageCollectionService_ImageCollectionService(me.url, {
- collectionId: me.options.collectionId,
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- }
- });
- ImageCollectionService.getStatistics();
- },
- /**
- * @function ImageCollectionService.prototype.getTileInfo
- * @description 返回影像集合所提供的服务瓦片的信息,包括:每层瓦片的分辨率,比例尺等信息,方便前端进行图层叠加。
- * @param {RequestCallback} callback - 回调函数。
- */
- getTileInfo: function (callback) {
- var me = this;
- var ImageCollectionService = new ImageCollectionService_ImageCollectionService(me.url, {
- collectionId: me.options.collectionId,
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- }
- });
- ImageCollectionService.getTileInfo();
- },
- /**
- * @function ImageCollectionService.prototype.deleteItemByID
- * @description 删除影像集合中指定ID (`featureId`)的Item对象,即从影像集合中删除指定的影像。
- * @param {string} featureId Feature 的本地标识符。
- * @param {RequestCallback} callback - 回调函数。
- */
- deleteItemByID(featureId, callback) {
- var me = this;
- var ImageCollectionService = new ImageCollectionService_ImageCollectionService(this.url, {
- collectionId: me.options.collectionId,
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- }
- });
- ImageCollectionService.deleteItemByID(featureId);
- },
- /**
- * @function ImageCollectionService.prototype.getItemByID
- * @description 返回影像集合中指定ID (`featureId`)的Item对象,即返回影像集合中指定的影像。
- * @param {string} featureId Feature 的本地标识符。
- * @param {RequestCallback} callback - 回调函数。
- */
- getItemByID(featureId, callback) {
- var me = this;
- var ImageCollectionService = new ImageCollectionService_ImageCollectionService(me.url, {
- collectionId: me.options.collectionId,
- proxy: me.options.proxy,
- withCredentials: me.options.withCredentials,
- crossOrigin: me.options.crossOrigin,
- headers: me.options.headers,
- eventListeners: {
- scope: me,
- processCompleted: callback,
- processFailed: callback
- }
- });
- ImageCollectionService.getItemByID(featureId);
- }
- });
- var imageCollectionService = function (url, options) {
- return new ImageCollectionService(url, options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/services/index.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- ;// CONCATENATED MODULE: ./src/leaflet/components/ComponentsViewBase.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ComponentsViewBase
- * @aliasclass Components.ComponentsViewBase
- * @deprecatedclassinstance L.supermap.components.componentsViewBase
- * @classdesc Lealfet 组件基类。
- * @category Components Common
- * @version 9.1.1
- * @param {Object} options - 参数。
- * @param {string} [options.position='topright'] - 组件在地图中显示的位置( 'topleft'|'topright'|'bottomleft'|'bottomright' )。
- * @param {function} [options.style] - 默认图层样式。返回类型:点样式( maker|circleMaker);线和面样式( L.path )。
- * @param {function} [options.onEachFeature] - 给该元素绑定事件和弹窗。
- * @extends {L.Control}
- * @usage
- */
- var ComponentsViewBase = external_L_default().Control.extend({
- options: {
- //控件位置 继承自leaflet control
- position: 'topright',
- //默认样式,以支持组件设置图层基本样式
- style: (feature, latLng) => {
- if (latLng /*&& feature instanceof L.latLng || feature.geometry.type.toLowerCase() === "point"*/) {
- return external_L_default().circleMarker(latLng, {
- fillColor: 'blue',
- weight: 1,
- opacity: 1,
- color: 'blue',
- fillOpacity: 0.6
- });
- } else {
- return {
- fillColor: 'blue',
- weight: 1,
- opacity: 1,
- color: 'blue',
- fillOpacity: 0.6
- }
- }
- },
- onEachFeature: null
- },
- initialize(options) {
- external_L_default().setOptions(this, options);
- //组件事件处理对象://todo 确认一些公开或私有的成员变量
- this._event = new (external_L_default()).Evented();
- //组件根 dom 元素:
- this.rootContainer = null;
- //图层参数,主要配置组件返回数据图层的样式和事件等
- },
- /**
- * @function ComponentsViewBase.prototype.onAdd
- * @description 向地图添加组件。
- */
- onAdd(map) {
- //子类实现此方法
- this.map = map;
- this.rootContainer = this._initView();
- return this.rootContainer;
- },
- /**
- * @function ComponentsViewBase.prototype.on
- * @param {string} eventType - 监听的事件类型。
- * @param {function} callback - 监听事件的回调函数。
- */
- on(eventType, callback) {
- this._event.on(eventType, callback);
- },
- /**
- * @function ComponentsViewBase.prototype.off
- * @description 事件关闭。
- * @param {string} eventType - 监听的事件名。
- * @param {function} callback - 监听事件的回调函数。
- */
- off(eventType, callback) {
- this._event.off(eventType, callback);
- },
- /**
- * @function ComponentsViewBase.prototype._initView
- * @description 初始化组件 UI。
- * @private
- */
- _initView() {
- //子类实现此方法
- },
- /**
- * @function ComponentsViewBase.prototype._preventMapEvent
- * @description 阻止 map 默认事件。
- * @private
- */
- _preventMapEvent(div, map) {
- if (!div || !map) {
- return;
- }
- div.addEventListener('mouseover', function () {
- map.dragging.disable();
- map.scrollWheelZoom.disable();
- map.doubleClickZoom.disable();
- });
- div.addEventListener('mouseout', function () {
- map.dragging.enable();
- map.scrollWheelZoom.enable();
- map.doubleClickZoom.enable();
- });
- }
- });
- var componentsViewBase = function (options) {
- return new ComponentsViewBase(options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/components/openfile/OpenFileViewModel.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
-
-
-
-
-
-
- /**
- * @class OpenFileViewModel
- * @aliasclass Components.OpenFileViewModel
- * @deprecatedclassinstance L.supermap.components.openFileViewModel
- * @classdesc 打开本地文件组件功能类,目前只支持 WGS84 经纬度坐标。
- * @version 9.1.1
- * @category Components OpenFile
- * @param {L.Map} map - Leaflet Map 对象。
- * @fires OpenFileViewModel#filesizeexceed
- * @fires OpenFileViewModel#errorfileformat
- * @fires OpenFileViewModel#openfilesucceeded
- * @fires OpenFileViewModel#openfilefailed
- * @extends {L.Evented}
- * @usage
- */
- var OpenFileViewModel = external_L_default().Evented.extend({
- initialize() {
- this.fileModel = new FileModel();
- },
- /**
- * @function OpenFileViewModel.prototype.readFile
- * @description 打开文件并加载到地图。
- * @param {Object} fileEventObject - 本地文件对象。
- */
- readFile(fileEventObject) {
- let inputDom = fileEventObject.target;
- let file = inputDom.files[0];
- //文件大小限制
- if (file.size > this.fileModel.FileConfig.fileMaxSize) {
- // document.alert("File supports up to 10M.");
- /**
- * @event OpenFileViewModel#filesizeexceed
- * @description 超出文件大小限制后触发。
- * @property {string} messageType - 警告类型。
- * @property {string} message - 警告内容。
- */
- this.fire("filesizeexceed", {messageType: "warring", message: Lang.i18n('msg_fileSizeExceeded')});
- return false;
- }
- let filePath = inputDom.value;
- let fileName = file.name;
- let fileType = ComponentsUtil.getFileType(fileName);
- //文件格式不支持
- if (!fileType) {
- // document.alert("Unsupported data type.");
- /**
- * @event OpenFileViewModel#errorfileformat
- * @description 文件格式不支持时触发。
- * @property {string} messageType - 警告类型。
- * @property {string} message - 警告内容。
- */
- this.fire("errorfileformat", {messageType: "failure", message: Lang.i18n('msg_fileTypeUnsupported')});
- return false;
- }
- //文件类型限制
- if (fileName !== "") {
- //给control 一份数据
- //todo MVVM模式 应该是数据变化触发数据变化的事件
- this.fileModel.set(
- "loadFileObject", {
- file: file,
- filePath: filePath,
- fileName: fileName,
- fileType: fileType
- });
- //响应选中文件添加到地图
- this._readData();
- }
- },
- /**
- * @function OpenFileViewModel.prototype._readData
- * @description 数据文件中的数据。
- * @private
- */
- _readData() {
- //todo 需要测试另外两个
- const me = this;
- const type = this.fileModel.loadFileObject.fileType;
- FileReaderUtil.readFile(type, {
- file: this.fileModel.loadFileObject.file,
- path: this.fileModel.loadFileObject.filePath
- }, (data) => {
- //将数据统一转换为 geoJson 格式加载到底图
- FileReaderUtil.processDataToGeoJson(type, data, (geojson) => {
- if (geojson) {
- /**
- * @event OpenFileViewModel#openfilesucceeded
- * @description 打开文件成功。
- * @property {GeoJSONObject} result - GeoJSON 格式数据。
- * @property {string} layerName - 图层名。
- */
- this.fire("openfilesucceeded", {
- result: geojson,
- layerName: this.fileModel.loadFileObject.fileName.split('.')[0]
- });
- }
- }, (e) => {
- me.fire("openfilefailed", {messageType: "failure", message: e});
- }, this);
- }, () => {
- /**
- * @event OpenFileViewModel#openfilefailed
- * @description 打开文件失败。
- * @property {string} messageType - 警告类型。
- * @property {string} message - 警告内容。
- */
- me.fire("openfilefailed", {messageType: "failure", message: Lang.i18n('msg_openFileFail')});
- }, this);
- }
- });
- var openFileViewModel = function (options) {
- return new OpenFileViewModel(options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/components/openfile/OpenFileView.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
-
-
-
-
-
- /**
- * @class OpenFileView
- * @aliasclass Components.OpenFileView
- * @deprecatedclassinstance L.supermap.components.openFile
- * @classdesc 打开文件组件,用于打开本地数据文件并加载到地图,目前支持打开.csv|.xls|.xlsx|.geojson|.json 格式,只支持 WGS84 经纬度坐标。
- * @version 9.1.1
- * @param {Object} options - 参数。
- * @param {string} [options.position='topright'] - 组件在地图中显示的位置( 'topleft'|'topright'|'bottomleft'|'bottomright' )。
- * @param {function} [options.style] - 默认图层样式。返回类型:点样式( maker|circleMaker);线和面样式( L.path )。
- * @param {function} [options.onEachFeature] - 给该元素绑定事件和弹窗。
- * @fires OpenFileView#openfilesucceeded
- * @fires OpenFileView#openfilefailed
- * @extends {ComponentsViewBase}
- * @category Components OpenFile
- * @usage
- */
- var OpenFileView = ComponentsViewBase.extend({
- options: {
- //绑定的底图图层
- layer: null
- },
- initialize(options) {
- ComponentsViewBase.prototype.initialize.apply(this, [options]);
- //初始化 ViewModel:
- this.viewModel = new OpenFileViewModel();
- },
- /**
- * @function OpenFileView.prototype.setViewStyle
- * @description 设置组件样式。
- * @param {string} styleName - css 样式名称。
- * @param {string} value - css 样式值。
- */
- setViewStyle(styleName, value) {
- this.rootContainer.style[styleName] = value;
- },
- /**
- * @function OpenFileView.prototype._initView
- * @description 创建打开文件组件。
- * @returns {HTMLElement}
- * @private
- * @override
- */
- _initView() {
- //初始化 view
- const uploadContent = external_L_default().DomUtil.create('div', 'component-openfile');
- uploadContent.id = 'openFile';
- this.fileSelect = external_L_default().DomUtil.create('div', '', uploadContent);
- this.label = external_L_default().DomUtil.create('label', 'component-openfile__span--select', this.fileSelect);
- this.label.htmlFor = "input_file";
- external_L_default().DomUtil.create('div', 'supermapol-icons-upload', this.label);
- const fileSpan = external_L_default().DomUtil.create('span', 'component-openfile__span', this.label);
- fileSpan.appendChild(document.createTextNode(Lang.i18n('text_chooseFile')));
- this.fileInput = external_L_default().DomUtil.create('input', 'component-openfile__input', this.fileSelect);
- this.fileInput.id = "input_file";
- this.fileInput.type = "file";
- this.fileInput.accept = ".json,.geojson,.csv,.xls,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
- this.fileInput.onchange = (fileEventObject) => {
- this.messageBox.closeView();
- this.viewModel.readFile(fileEventObject);
- };
- //增加提示框:
- this.messageBox = new MessageBox();
- //添加监听
- this.viewModel.on("filesizeexceed", (e) => {
- this.messageBox.showView(e.message, e.messageType);
- });
- this.viewModel.on("errorfileformat", (e) => {
- this.messageBox.showView(e.message, e.messageType);
- });
- this.viewModel.on("openfilefailed", (e) => {
- this.messageBox.showView(e.message, e.messageType);
- /**
- * @event OpenFileView#openfilefailed
- * @description 打开文件失败。
- * @property {Object} e - 事件对象。
- */
- this._event.fire("openfilefailed", e);
- });
- this.viewModel.on("readdatafail", (e) => {
- this.messageBox.showView(e.message, e.messageType);
- });
- this.viewModel.on("openfilesucceeded", (e) => {
- /**
- * @event OpenFileView#openfilesucceeded
- * @description 打开文件成功。
- * @property {Object} e - 事件对象。
- */
- this._event.fire("openfilesucceeded", e);
- });
- // 阻止 map 默认事件
- this._preventMapEvent(uploadContent, this.map);
- return uploadContent;
- }
- });
- var openFileView = function (options) {
- return new OpenFileView(options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/components/search/CityConfig.js
- const config = {
- HOT: {
- HOT: ["北京市", "上海市", "广州市", "深圳市", "南京市", "杭州市", "天津市", "重庆市", "成都市", "青岛市", "苏州市", "无锡市", "常州市", "温州市", "武汉市", "长沙市", "南昌市", "三亚市", "合肥市", "石家庄市"]
- },
- AB: {
- A: ["阿拉善盟", "鞍山市", "安庆市", "安阳市", "阿坝藏族羌族自治州", "安顺市", "阿里地区", "安康市", "阿克苏地区", "阿勒泰地区", "阿拉尔市"],
- B: ["北京市", "保定市", "包头市", "巴彦淖尔市", "本溪市", "白山市", "白城市", "蚌埠市", "亳州市", "滨州市", "北海市", "百色市", "白沙黎族自治县", "保亭黎族苗族自治县", "巴中市", "毕节地区", "保山市", "宝鸡市", "白银市", "博尔塔拉蒙古自治州", "巴音郭楞蒙古自治州", "北区"]
- },
- CD: {
- C: ["重庆市", "成都市", "常州市", "长沙市", "承德市", "沧州市", "长治市", "赤峰市", "朝阳市", "长春市", "滁州市", "巢湖市", "池州市", "常德市", "郴州市", "潮州市", "崇左市", "澄迈县", "昌江黎族自治县", "楚雄彝族自治州", "昌都地区", "昌吉回族自治州"],
- D: ["大同市", "大连市", "丹东市", "大庆市", "大兴安岭地区", "东营市", "德州市", "东莞市", "儋州市", "东方市", "定安县", "德阳市", "达州市", "大理白族自治州", "德宏傣族景颇族自治州", "迪庆藏族自治州", "定西市", "东区", "大埔区", "大堂区"]
- },
- EFG: {
- E: ["鄂尔多斯市", "鄂州市", "恩施土家族苗族自治州"],
- F: ["抚顺市", "阜新市", "阜阳市", "福州市", "抚州市", "佛山市", "防城港市"],
- G: ["广州市", "赣州市", "桂林市", "贵港市", "广元市", "广安市", "贵阳市", "固原市", "高雄市", "高雄县", "甘南藏族自治州", "甘孜藏族自治州"]
- },
- H: {
- H: ["杭州市", "合肥市", "邯郸市", "衡水市", "呼和浩特市", "呼伦贝尔市", "葫芦岛市", "哈尔滨市", "鹤岗市", "黑河市", "淮安市", "湖州市", "淮南市", "淮北市", "黄山市", "菏泽市", "鹤壁市", "黄石市", "黄冈市", "衡阳市", "怀化市", "惠州市", "河源市", "贺州市", "河池市", "海口市", "红河哈尼族彝族自治州", "汉中市", "海东地区", "海北藏族自治州", "黄南藏族自治州", "海南藏族自治州", "果洛藏族自治州", "海西蒙古族藏族自治州", "哈密地区", "和田地区", "花莲县", "黄大仙区", "花地玛堂区"]
- },
- J: {
- J: ["晋城市", "晋中市", "锦州市", "吉林市", "鸡西市", "佳木斯市", "嘉兴市", "金华市", "景德镇市", "九江市", "吉安市", "济南市", "济宁市", "焦作市", "济源市", "荆门市", "荆州市", "江门市", "湛江市", "揭阳市", "嘉峪关市", "金昌市", "酒泉市", "基隆市", "嘉义市", "嘉义县", "九龙城区", "嘉模堂区"]
- },
- KL: {
- K: ["开封市", "昆明市", "克拉玛依市", "克孜勒苏柯尔克孜自治州", "喀什地区"],
- L: ["廊坊市", "临汾市", "吕梁市", "辽阳市", "辽源市", "连云港市", "丽水市", "六安市", "龙岩市", "莱芜市", "临沂市", "聊城市", "洛阳市", "漯河市", "娄底市", "柳州市", "来宾市", "临高县", "乐东黎族自治县", "陵水黎族自治县", "泸州市", "乐山市", "凉山彝族自治州", "六盘水市", "丽江市", "临沧市", "拉萨市", "林芝地区", "兰州市", "陇南市", "临夏回族自治州"]
- },
- MNP: {
- M: ["牡丹江市", "马鞍山市", "茂名市", "梅州市", "绵阳市", "眉山市", "苗栗县"],
- N: ["南京市", "南昌市", "南通市", "宁波市", "南平市", "宁德市", "南阳市", "南宁市", "南沙群岛", "内江市", "南充市", "怒江傈傈族自治州", "那曲地区", "南投县"],
- P: ["盘锦市", "莆田市", "萍乡市", "平顶山市", "濮阳市", "攀枝花市", "平凉市", "屏东县", "澎湖县"]
- },
- QR: {
- Q: ["青岛市", "秦皇岛市", "齐齐哈尔市", "黔西南布依族苗族自治州", "七台河市", "衢州市", "泉州市", "潜江市", "清远市", "钦州市", "琼海市", "曲靖市", "庆阳市", "荃湾区", "黔东南苗族侗族自治州", "黔南布依族苗族自治州", "琼中黎族苗族自治县"],
- R: ["日照市", "日喀则地区"]
- },
- S: {
- S: ["上海市", "深圳市", "苏州市", "石家庄市", "三亚市", "朔州市", "沈阳市", "四平市", "松原市", "双鸭山市", "绥化市", "宿迁市", "绍兴市", "宿州市", "三明市", "上饶市", "三门峡市", "商丘市", "十堰市", "随州市", "邵阳市", "韶关市", "汕头市", "汕尾市", "三亚市", "遂宁市", "思茅市", "山南地区", "商洛市", "石嘴山市", "石河子市", "深水埗区", "沙田区", "神农架林区", "圣安多尼堂区", "圣方济各堂区"]
- },
- T: {
- T: ["天津市", "唐山市", "太原市", "通辽市", "铁岭市", "通化市", "泰州市", "台州市", "铜陵市", "泰安市", "天门市", "屯昌县", "铜仁地区", "铜川市", "天水市", "吐鲁番地区", "塔城地区", "图木舒克市", "台北市", "台中市", "台南市", "台北县", "桃园县", "台中县", "台南县", "台东县", "屯门区"]
- },
- W: {
- W: ["无锡市", "温州市", "武汉市", "乌海市", "乌兰察布市", "芜湖市", "潍坊市", "威海市", "梧州市", "五指山市", "文昌市", "万宁市", "文山壮族苗族自治州", "渭南市", "武威市", "吴忠市", "乌鲁木齐市", "五家渠市", "湾仔区", "望德堂区"]
- },
- X: {
- X: ["邢台市", "忻州市", "兴安盟", "徐州市", "宣城市", "厦门市", "新余市", "新乡市", "许昌市", "信阳市", "襄樊市", "孝感市", "咸宁市", "仙桃市", "湘潭市", "西安市", "咸阳市", "西宁市", "新竹市", "新竹县", "西贡区", "锡林郭勒盟", "西沙群岛", "湘西土家族苗族自治州", "西双版纳傣族自治州"]
- },
- Y: {
- Y: ["阳泉市", "运城市", "营口市", "延边朝鲜族自治州", "伊春市", "盐城市", "扬州市", "鹰潭市", "宜春市", "烟台市", "宜昌市", "岳阳市", "益阳市", "永州市", "阳江市", "云浮市", "玉林市", "宜宾市", "雅安市", "玉溪市", "延安市", "榆林市", "玉树藏族自治州", "银川市", "伊犁哈萨克自治州", "宜兰县", "云林县", "油尖旺区", "元朗区"]
- },
- Z: {
- Z: ["郑州市", "张家口市", "镇江市", "舟山市", "漳州市", "淄博市", "枣庄市", "周口市", "驻马店市", "株洲市", "张家界市", "珠海市", "肇庆市", "中山市", "自贡市", "资阳市", "遵义市", "昭通市", "张掖市", "中卫市", "彰化县", "中西区", "中沙群岛的岛礁及其海域"]
- }
- };
- ;// CONCATENATED MODULE: ./src/leaflet/components/commonmodels/GeoJsonLayersModel.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GeoJsonLayersDataModel
- * @aliasclass Components.GeoJsonLayersDataModel
- * @deprecatedclassinstance L.supermap.components.GeoJsonLayersDataModel
- * @description 多图层数据模型。
- * @category Components Common
- * @private
- * @param {Array.<Object>} layers - 图层数组。
- * @param {GeoJSONLayerWithName} layers.layerObject - 含有 layerName 与 GeoJSON 图层的对象。
- * @fires GeoJsonLayersDataModel#newlayeradded
- * @usage
- */
- // todo 看看如何完善
- class GeoJsonLayersDataModel {
- constructor(layers) {
- this.layers = [];
- if (layers && layers.length > 0) {
- this.addLayers(layers);
- }
- this.currentLayerDataModel = null;
- }
- addLayers(layers, success, failed, context) {
- for (let i = 0; i < layers.length; i++) {
- let layerName = layers[i].layerName;
- if (layers[i].layer instanceof (external_L_default()).GeoJSON) {
- let geoJsonLayerDataModel = new GeoJsonLayerDataModel(layers[i].layer);
- //赋给 GeoJsonLayersDataModel 对象 layerName 属性,每个图层名对应一个 layerDataModel 对象
- this.layers[layerName] = geoJsonLayerDataModel;
- success && success.call(context, {layerName: layerName, layer: geoJsonLayerDataModel});
- } else {
- failed && failed.call(context, "")
- }
- }
- }
- /**
- * @function GeoJsonLayersDataModel.prototype.setCurrentLayerDataModel
- * @description 设置当前选中的图层。
- * @param {string} layerName - 选中的图层名称。
- */
- setCurrentLayerDataModel(layerName) {
- if (this.layers[layerName]) {
- this.currentLayerDataModel = this.layers[layerName];
- }
- }
- }
- /**
- * @class GeoJsonLayerDataModel
- * @classdesc 图层数据模型,可用于图层要素数据、属性管理等。
- * @category Components Common
- * @param {L.GeoJSON} layer - GeoJSON 图层。
- * 注:leaflet 没有 feature 的概念
- * @usage
- */
- class GeoJsonLayerDataModel {
- constructor(layer) {
- //图层对象
- this.layer = layer;
- //要素图层数组
- this.features = layer.getLayers();
- //图层属性字段
- this.attributeNames = [];
- //这里一个图层默认共用一套属性字段
- if (this.features[0].feature.properties) {
- for (let field in this.features[0].feature.properties) {
- this.attributeNames.push(field);
- }
- }
- //指定图层操作属性字段
- this.operatingAttributeNames = [];
- //图层属性对象
- this.attributes = {};
- }
- /**
- * @function GeoJsonLayerDataModel.prototype.setOperatingAttributeNames
- * @description 指定操作字段。
- * @param {Array.<string>} operatingAttr - 查询属性字段数组,该数组为 this.attributeNames 的子集。
- */
- setOperatingAttributeNames(operatingAttr) {
- this.operatingAttributeNames = operatingAttr;
- }
- /**
- * @function GeoJsonLayerDataModel.prototype.getAllAttributeNames
- * @description 获取图层所有属性名称。
- * @returns {Array.<string>} 返回图层所有属性名称。
- */
- getAllAttributeNames() {
- return this.attributeNames;
- }
- /**
- * @function GeoJsonLayerDataModel.prototype.getAttributeNamesByType
- * @description 获取指定类型的图层属性字段。
- * @param {string} [type] - 类型参数。默认返回所有字段,可选 'Num'。
- * @returns {Array.<string>} 返回指定类型的图层属性字段。
- */
- getAttributeNamesByType(type) {
- //图层属性字段
- if (this.features[0].feature.properties) {
- let properties = this.features[0].feature.properties;
- let attributeNames = [];
- if (type === 'Num') {
- for (let field in properties) {
- if (!isNaN(properties[field])) {
- attributeNames.push(field);
- }
- }
- } else {
- attributeNames = this.attributeNames;
- }
- return attributeNames;
- }
- }
- /**
- * @function GeoJsonLayerDataModel.prototype.getAllFeatures
- * @description 获取图层所有要素。
- * @returns {Array.<Object>} 返回图层所有要素。
- */
- getAllFeatures() {
- return this.features;
- }
- /**
- * @function GeoJsonLayerDataModel.prototype.getAttributeValueByAttributeName
- * @description 获取属性值。
- * @param {string} attributeName - 属性名称。
- * @returns {Object} 返回属性值对象。
- */
- getAttributeValueByAttributeName(attributeName) {
- //如果图层属性对象中已存在该属性,则直接返回
- if (this.attributes[attributeName]) {
- return this.attributes[attributeName];
- }
- //若图层属性对象还未存储该属性,则遍历每个feature 读取其属性值,并存储到图层属性对象中
- this.attributes[attributeName] = [];
- for (let i = 0; i < this.features.length; i++) {
- this.attributes[attributeName].push([this.features[i].feature.properties[attributeName]]);
- }
- return this.attributes[attributeName];
- }
- //getAttributeValueByAttributeName(feature,attributeName)
- //getAllFeatures()
- //todo getFeatureByID()
- //getFeaturesByKeywords(keyword,searchAttributeNames)
- //getAllAttributeValues(attributeName) ??
- //getAllAttributeNames()
- /**
- * @function GeoJsonLayerDataModel.prototype.getFeaturesByKeyWord
- * @description 查询要素对象。
- * @param {string} keyWord - 查询关键字。
- * @returns {Array.<Object>} 返回要素对象数组。
- */
- getFeaturesByKeyWord(keyWord) {
- let features = [], keyReg = new RegExp(keyWord.toLowerCase());
- const self = this;
- this.features.forEach(function (feature) {
- if (!feature.feature.properties) {
- return null;
- }
- let fAttr = feature.feature.properties;
- let operatingAttributeNames;
- //若设置了过滤字段,则按过滤字段查询
- if (self.operatingAttributeNames.length > 0) {
- operatingAttributeNames = self.operatingAttributeNames;
- } else {
- //若未设置了过滤字段,则按图层字段查询
- operatingAttributeNames = self.attributeNames;
- }
- //遍历要素,查询符合条件的要素
- for (let i = 0, len = operatingAttributeNames.length; i < len; i++) {
- if (fAttr[operatingAttributeNames[i]] && keyReg.test(fAttr[operatingAttributeNames[i]].toString().toLowerCase())) {
- let filterAttributeName = operatingAttributeNames[i];
- let filterAttributeValue = fAttr[operatingAttributeNames[i]];
- //将查询出的属性字段及属性值赋给 feature 并返回
- feature.filterAttribute = {
- filterAttributeName: filterAttributeName,
- filterAttributeValue: filterAttributeValue
- };
- features.push(feature);
- break;
- }
- }
- });
- return features;
- }
- }
- ;// CONCATENATED MODULE: ./src/leaflet/components/search/SearchViewModel.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
-
-
-
-
- /**
- * @class SearchViewModel
- * @aliasclass Components.SearchViewModel
- * @deprecatedclassinstance L.supermap.components.searchViewModel
- * @classdesc 图层查询组件功能类。
- * @version 9.1.1
- * @category Components Search
- * @param {L.Map} map - Leaflet Map 对象。
- * @param {Object} options - 参数。
- * @param {Object} [options.cityGeoCodingConfig] - 城市地址匹配服务配置,包括:{addressUrl:"",key:""},默认为 online 本地搜索服务。
- * @fires SearchViewModel#newlayeradded
- * @fires SearchViewModel#searchlayersucceeded
- * @fires SearchViewModel#searchfailed
- * @fires SearchViewModel#geocodesucceeded
- * @extends {L.Evented}
- * @usage
- */
- var SearchViewModel = external_L_default().Evented.extend({
- options: {
- cityGeoCodingConfig: {
- addressUrl: "https://www.supermapol.com/iserver/services/localsearch/rest/searchdatas/China/poiinfos",
- key: "fvV2osxwuZWlY0wJb8FEb2i5"
- }
- },
- initialize(map, options) {
- if (map) {
- /**
- * @member {L.Map} SearchViewModel.prototype.map
- * @description 当前组件所在的地图。
- */
- this.map = map;
- } else {
- return new Error(`Cannot find map, fileModel.map cannot be null.`);
- }
- external_L_default().Util.setOptions(this, options);
- //初始化Model
- this.dataModel = new GeoJsonLayersDataModel();
- //初始话地址匹配服务
- this.geoCodeParam = {
- keyWords: '北京市',
- city: "北京市",
- pageSize: this.options.pageSize,
- pageNum: this.options.pageNum
- };
- //查询缓存
- this.searchCache = {};
- },
- /**
- * @function SearchViewModel.prototype.search
- * @description 查询。
- * @param {string} keyWords - 查询的关键字。
- * @param {string} [searchLayerName] - 执行的查询类型,支执行矢量图层属性查询,当为 "geocode" 则执行地址匹配。
- */
- search(keyWord, searchLayerName) {
- if (!searchLayerName) {
- this.searchFromCityLocalSearchService(keyWord);
- } else {
- this.searchFromLayer(keyWord, searchLayerName);
- }
- },
- /**
- * @function SearchViewModel.prototype.searchFromLayer
- * @description 图层属性查询。
- * @param {string} searchLayerName - 查询的图层名。
- * @param {string} keyWord - 图层属性搜索关键字。
- */
- searchFromLayer(keyWord, searchLayerName) {
- if (this.dataModel.layers[searchLayerName]) {
- let resultFeatures = this.dataModel.layers[searchLayerName].getFeaturesByKeyWord(keyWord);
- if (resultFeatures && resultFeatures.length > 0) {
- /**
- * @event SearchViewModel#searchlayersucceeded
- * @description 图层属性查询成功后触发。
- * @property {Object} result - 图层数据。
- */
- this.fire("searchlayersucceeded", {
- result: resultFeatures
- });
- } else {
- /**
- * @event SearchViewModel#searchfailed
- * @description 图层属性查询失败后触发。
- * @property {string} searchType - 图层属性查询状态。
- */
- this.fire("searchfailed", {
- searchType: "searchLayersField"
- });
- }
- }
- },
- /**
- * @function SearchViewModel.prototype.searchFromCityLocalSearchService
- * @description 城市地址匹配查询。
- * @param {string} keyWords - 城市地址匹配查询关键字。
- */
- searchFromCityLocalSearchService(keyWords) {
- //todo 是否保留缓存?请求过的数据保留一份缓存?
- if (this.searchCache[keyWords]) {
- /**
- * @event SearchViewModel#geocodesucceeded
- * @description 城市地址匹配成功后触发。
- * @property {Object} result - 城市匹配成功后返回的数据。
- */
- this.fire("geocodesucceeded", {
- result: this.searchCache[keyWords]
- });
- } else {
- this.geoCodeParam.keyWords = keyWords || this.geoCodeParam.city;
- const self = this;
- let url = this._getSearchUrl(this.geoCodeParam);
- FetchRequest.get(url).then((response) => {
- return response.json();
- }).then((geocodingResult) => {
- if (geocodingResult.error || geocodingResult.poiInfos.length === 0) {
- self.fire("searchfailed", {
- searchType: "searchGeocodeField"
- });
- return;
- }
- if (geocodingResult.poiInfos) {
- const geoJsonResult = self._dataToGeoJson(geocodingResult.poiInfos, self.geoCodeParam);
- self.fire("geocodesucceeded", {
- result: geoJsonResult
- });
- }
- })
- }
- },
- /**
- * @function SearchViewModel.prototype.addSearchLayers
- * @description 添加新的可查询图层。
- * @param {Array.<L.GeoJSON>} layers - 新添加的图层对象。
- */
- addSearchLayers(layers) {
- this.dataModel.addLayers(layers, (e) => {
- /**
- * @event SearchViewModel#newlayeradded
- * @description 添加查询图层事件。
- * @property {Object} result - 事件返回的新的查询图层对象。
- * @property {string} layerName - 事件返回的新的查询图层对象名。
- */
- this.fire("newlayeradded", {
- layerName: e.layerName
- });
- }, null, this);
- },
- /**
- * @function SearchViewModel.prototype.panToLayer
- * @description 缩放到指定图层。
- * @param {string} layerName - 指定缩放的图层名。
- */
- panToLayer(layerName) {
- if (this.dataModel.layers[layerName]) {
- this.map.flyToBounds(this.dataModel.layers[layerName].layer.getBounds());
- }
- },
- /**
- * @function SearchViewModel.prototype.panToCity
- * @description 缩放到指定城市。
- * @param {string} city - 指定缩放的城市名。
- */
- panToCity(city) {
- this.geoCodeParam.keyWords = city;
- this.geoCodeParam.city = city;
- const self = this;
- let url = this._getSearchUrl(this.geoCodeParam);
- FetchRequest.get(url).then((response) => {
- return response.json();
- }).then((geocodingResult) => {
- if (geocodingResult.poiInfos.length > 0) {
- //缩放至城市
- const center = external_L_default().latLng(geocodingResult.poiInfos[0].location.y, geocodingResult.poiInfos[0].location.x);
- self.map.setView(center, 8);
- } else {
- self.fire("searchfailed", {
- searchType: "cityGeocodeField"
- });
- }
- })
- },
- /**
- * @description 将地址匹配返回的数据转为 GeoJSON 格式数据。
- * @param data
- * @private
- */
- _dataToGeoJson(data, geoCodeParam) {
- let features = [];
- for (let i = 0; i < data.length; i++) {
- let feature = {
- type: "Feature",
- geometry: {
- type: "Point",
- coordinates: [data[i].location.x, data[i].location.y]
- },
- properties: {
- name: data[i].name || geoCodeParam.keyWords,
- address: data[i].formatedAddress || data[i].address
- }
- };
- features.push(feature);
- }
- return features;
- },
- /**
- * @function SearchViewModel.prototype._getSearchUrl
- * @description 获取地理编码查询地址。
- * @param {Object} geoCodeParam - 地理编码查询参数。
- * @private
- */
- _getSearchUrl(geoCodeParam) {
- let url = this.options.cityGeoCodingConfig.addressUrl + `.json?keywords=${geoCodeParam.keyWords}&city=${geoCodeParam.city}&pageSize=${geoCodeParam.pageSize}&pageNum=${geoCodeParam.pageNum}&key=${this.options.cityGeoCodingConfig.key}`;
- return url;
- }
- });
- var searchViewModel = function (options) {
- return new SearchViewModel(options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/components/search/SearchView.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
-
-
-
-
-
-
-
-
-
-
- /**
- * @class SearchView
- * @aliasclass Components.Search
- * @deprecatedclassinstance L.supermap.components.search
- * @classdesc 图层查询组件。
- * @category Components Search
- * @version 9.1.1
- * @param {Object} options - 参数。
- * @param {Object|Array.<string>} [options.cityConfig] - 城市地址匹配配置,默认为全国城市,与 options.cityGeoCodingConfig 支持匹配的服务对应;
- * 配置两种格式:{key1:{A:[],B:[]}, key2:{C:[],D:[]}} 或 ["成都市","北京市"],用户可根据自己的项目需求进行配置。
- * @param {Object} [options.cityGeoCodingConfig] - 城市地址匹配服务配置,包括:{addressUrl:"",key:""} 默认为 online 地址匹配服务,与 options.cityConfig 对应。
- * @param {boolean} [options.isGeoCoding=true] - 是否支持城市地址匹配功能。
- * @param {number} [options.pageSize=10] - 地址匹配查询返回记录结果数,最大设置为 20。
- * @param {number} [options.pageNum=1] - 地址匹配查询分页页码,默认 1 代表第一页。
- * @param {number} [options.perPageDataNum=8] - 每页显示个数,最大值为 8。
- * @param {string} [options.position='topright'] - 组件在地图中显示的位置( 'topleft'|'topright'|'bottomleft'|'bottomright' )。
- * @param {function} [options.style] - 默认图层样式。点样式( maker|circleMaker);线和面样式( L.path )。
- * @param {function} [options.onEachFeature] - 给该元素绑定事件和弹窗。
- * @extends {ComponentsViewBase}
- * @fires SearchView#searchlayersucceeded
- * @fires SearchView#searchfailed
- * @fires SearchView#geocodesucceeded
- * @usage
- */
- var SearchView = ComponentsViewBase.extend({
- options: {
- cityConfig: config,
- cityGeoCodingConfig: {
- addressUrl: "https://www.supermapol.com/iserver/services/localsearch/rest/searchdatas/China/poiinfos",
- key: "fvV2osxwuZWlY0wJb8FEb2i5"
- },
- isGeoCoding: true,
- pageSize: 10,
- pageNum: 1,
- perPageDataNum: 8
- },
- initialize(options) {
- ComponentsViewBase.prototype.initialize.apply(this, [options]);
- //当前选中查询的图层名:
- this.currentSearchLayerName = "";
- this.isSearchLayer = false;
- this.perPageDataNum = this.options.perPageDataNum;
- },
- /*------以下是一些接口-----*/
- /**
- * @function SearchView.prototype.onAdd
- * @description 向底图添加组件。
- * @private
- * @override
- */
- onAdd: function (map) {
- //初始化组件业务逻辑执行对象 viewModel
- this.viewModel = new SearchViewModel(map, this.options);
- return ComponentsViewBase.prototype.onAdd.apply(this, [map]);
- },
- /**
- * @function SearchView.prototype.addSearchLayer
- * @description 添加可查询的图层。
- * @param {Array.<L.GeoJSON>|L.GeoJSON} layers - 可查询的图层。
- */
- addSearchLayer(layers) {
- //将可查询图层数据传入vm处理
- this.viewModel.addSearchLayers(layers);
- },
- /*----------以下是创建 dom 元素的方法---------*/
- /**
- * @function SearchView.prototype._initView
- * @description 创建地址匹配或图层要素查询组件。
- * @override
- * @returns {HTMLElement}
- * @private
- */
- _initView() {
- // self 便于 this 对象的使用
- const self = this;
- const div = document.createElement("div");
- div.setAttribute("class", "component-search-container");
- //外框
- const poiContainer = document.createElement("div");
- poiContainer.setAttribute("class", "component-search");
- //主体
- //---------下拉框:
- const poiSettings = document.createElement("div");
- poiSettings.setAttribute("class", "component-search__settings");
- //下拉框
- const poiSearchName = document.createElement("div");
- //由View 维护,进行交互操作
- poiSearchName.setAttribute("class", "component-search__settings__name");
- //poiSettings.innerHTML 通过下拉框选项改变
- poiSettings.appendChild(poiSearchName);
- //下拉标记
- const triangleIcon = document.createElement("span");
- triangleIcon.setAttribute("class", "supermapol-icons-solid-down-triangle");
- poiSettings.appendChild(triangleIcon);
- //城市地址匹配页面, 以及图层查询页面
- //城市地址匹配页面:
- let citySelect = null;
- if (this.options.isGeoCoding) {
- const cityTabsPageObj = new CityTabsPage({
- config: this.options.cityConfig
- });
- citySelect = cityTabsPageObj.getElement();
- //点选城市名,修改显示,并执行定位城市查询【城市列表列表点击事件】
- cityTabsPageObj.content.onclick = (e) => {
- if (e.target.nodeName === "SPAN" && e.target.innerText) {
- this.viewModel.panToCity(e.target.innerHTML);
- this.messageBox.closeView();
- poiSearchName.removeChild(poiSearchName.firstChild);
- poiSearchName.insertBefore(document.createTextNode(e.target.innerHTML), poiSearchName.firstChild);
- this.isSearchLayer = false;
- }
- };
- //支持城市地址匹配,则初始化显示配置的第一个城市名:
- poiSearchName.appendChild(document.createTextNode(cityTabsPageObj.content.getElementsByTagName("span")[0].innerText));
- }
- //图层查询页面:写法是为了为了代码可读性
- const layersSelect = function () {
- const layersSelect = document.createElement("div");
- layersSelect.setAttribute("class", "component-search__layers");
- const layersContent = document.createElement("div");
- layersContent.setAttribute("class", "component-search-layers-content");
- layersSelect.appendChild(layersContent);
- //header todo 两个选项的功能暂没用到,先关闭,后续用到再打开
- const layersHeader = document.createElement("div");
- layersHeader.setAttribute("class", "component-search__layers__header");
- //加载搜索条件
- const loadBtn = document.createElement("div");
- loadBtn.setAttribute("class", "load-btn");
- layersHeader.appendChild(loadBtn);
- const loadIcon = document.createElement("span");
- loadIcon.setAttribute("class", "supermapol-icons-poi-load");
- loadBtn.appendChild(loadIcon);
- const loadBtnText = document.createElement("span");
- loadBtnText.appendChild(document.createTextNode(Lang.i18n("text_loadSearchCriteria")));
- loadBtn.appendChild(loadBtnText);
- //保存搜索条件
- const saveBtn = document.createElement("div");
- saveBtn.setAttribute("class", "save-btn");
- layersHeader.appendChild(saveBtn);
- const icon = document.createElement("span");
- icon.setAttribute("class", "supermapol-icons-poi-save");
- saveBtn.appendChild(icon);
- const saveBtnText = document.createElement("span");
- saveBtnText.appendChild(document.createTextNode(Lang.i18n("text_saveSearchCriteria")));
- saveBtn.appendChild(saveBtnText);
- //body
- const layerSelectOptions = document.createElement("div");
- layerSelectOptions.setAttribute("class", "component-search__layers__body");
- //选中查询图层监听
- //选择查询图层【图层列表点击事件】
- layerSelectOptions.onclick = (e) => {
- //先进行清除操作
- self.clearSearchResult();
- let selectLayerOption = null;
- if (e.target.classList[0] === "component-search__layers__itme__singleselect") {
- selectLayerOption = e.target;
- } else if (e.target.classList[0] === "component-single-default-img" || e.target.classList[0] === "single-label") {
- selectLayerOption = e.target.parentNode;
- } else {
- return;
- }
- if (document.getElementsByClassName("component-single-checked-img").length > 0) {
- document.getElementsByClassName("component-single-checked-img")[0].setAttribute("class", "component-single-default-img");
- }
- selectLayerOption.firstChild.setAttribute("class", "component-single-checked-img");
- self.currentSearchLayerName = selectLayerOption.lastChild.innerText;
- self.isSearchLayer = true;
- poiSearchName.removeChild(poiSearchName.firstChild);
- poiSearchName.insertBefore(document.createTextNode(self.currentSearchLayerName), poiSearchName.firstChild);
- self.viewModel.panToLayer(self.currentSearchLayerName);
- self.messageBox.closeView();
- };
- layersContent.appendChild(layerSelectOptions);
- //读取当前图层数据,并展现
- //只有调用添加查询图层接口才能添加图层选项
- return layersSelect;
- }();
- //配置开启 城市匹配功能则添加
- let navTabs = [];
- if (citySelect) {
- navTabs.push({
- title: Lang.i18n("title_searchCity"),
- content: citySelect
- })
- }
- navTabs.push({
- title: Lang.i18n("title_searchLayer"),
- content: layersSelect
- });
- const navTabsPageObject = new NavTabsPage({
- tabs: navTabs
- });
- const navTabsPage = navTabsPageObject.getElement();
- navTabsPageObject.closeView();
- poiContainer.appendChild(navTabsPage);
- poiSettings.onclick = () => {
- if (navTabsPage.hidden) {
- navTabsPageObject.showView();
- } else {
- navTabsPageObject.closeView();
- }
- };
- poiContainer.appendChild(poiSettings);
- //初始时,下拉框若没赋值显示信息,则再次赋值:
- if (!poiSearchName.innerText) {
- poiSearchName.appendChild(document.createTextNode(Lang.i18n("text_label_chooseSearchLayers")));
- }
- //---------下拉框 END
- //---------搜索输入框:
- const poiInputContainer = document.createElement("div");
- poiInputContainer.setAttribute("class", "component-search__input");
- const poiInput = document.createElement("input");
- poiInput.type = "text";
- poiInput.placeholder = Lang.i18n("text_label_searchTips");
- poiInputContainer.appendChild(poiInput);
- //由View 维护,进行交互操作
- this.poiInput = poiInput;
- //清除输入内容按钮:
- const poiInputClose = document.createElement("span");
- poiInputClose.setAttribute("class", "supermapol-icons-close");
- poiInputClose.hidden = true;
- poiInputContainer.appendChild(poiInputClose);
- poiContainer.appendChild(poiInputContainer);
- //---------搜索输入框 END
- //--------搜索按钮:
- const searchBtn = document.createElement("div");
- searchBtn.setAttribute("class", "component-search-icon supermapol-icons-search");
- //查询结果页面
- const resultDomObj = new PaginationContainer();
- this._resultDomObj = resultDomObj;
- //查询要素或匹配要素【搜索按钮点击事件】
- searchBtn.onclick = () => {
- //若是遮挡结果显示,则关闭
- resultDomObj.closeView();
- this.clearSearchResult();
- this.messageBox.closeView();
- navTabsPageObject.closeView();
- const keyWord = this.poiInput.value.trim();
- if (keyWord === "") {
- this.messageBox.showView(Lang.i18n('msg_searchKeywords'));
- return;
- }
- if (this.isSearchLayer) {
- this.viewModel.search(keyWord, this.currentSearchLayerName);
- } else {
- this.viewModel.search(keyWord);
- }
- };
- //【输入框输入内容回车事件】
- poiInput.onkeypress = (e) => {
- //.which属性判断按下的是哪个键,回车键的键位序号为13
- if (e.which == 13) {
- //手动触发 searchBtn 得点击事件,执行查询操作
- var evt = document.createEvent("HTMLEvents");
- evt.initEvent("click", false, true);
- searchBtn.dispatchEvent(evt);
- }
- };
- poiContainer.appendChild(searchBtn);
- //--------搜索按钮 END
- const resultContainer = function createResultPage() {
- const resultContainer = resultDomObj.getElement();
- resultContainer.style.position = "absolute";
- resultContainer.style.top = "44px";
- resultContainer.style.right = "0";
- //先关闭结果界面,当有数据时再打开
- resultDomObj.closeView();
- //【结果列表点击事件】,以支持联动map上对应要素:
- resultDomObj.content.onclick = (e) => {
- let selectFeatureOption = null;
- if (e.target.parentNode.className === "component-search-result-info") {
- selectFeatureOption = e.target.parentNode.parentNode;
- } else if (e.target.parentNode.className === "component-search__resultitme") {
- selectFeatureOption = e.target.parentNode;
- } else if (e.target.className === "component-search__resultitme") {
- selectFeatureOption = e.target;
- } else {
- return;
- }
- //修改
- if (document.getElementsByClassName("component-search__resultitme-selected").length > 0) {
- document.getElementsByClassName("component-search__resultitme-selected")[0].classList.remove("component-search__resultitme-selected");
- }
- selectFeatureOption.firstChild.classList.add("component-search__resultitme-selected");
- let filter = selectFeatureOption.children[1].firstChild.innerText;
- //联动地图上要素响应
- self._linkageFeature(filter);
- };
- return resultContainer;
- }();
- poiContainer.appendChild(resultContainer);
- //清除输入框内容【输入框删除按钮点击事件】
- poiInputClose.onclick = (e) => {
- this.clearSearchResult();
- poiInput.value = "";
- e.target.hidden = true;
- resultDomObj.closeView();
- };
- //【输入框输入内容事件】
- poiInput.oninput = () => {
- poiInputClose.hidden = false;
- };
- //添加提示框
- this.messageBox = new MessageBox();
- //绑定 VM 的监听
- this._addViewModelListener();
- div.appendChild(poiContainer);
- //阻止 map 默认事件
- this._preventMapEvent(div, this.map);
- return div;
- },
- /**
- * @function SearchView.prototype._createSearchLayerItem
- * @description 创建查询图层选项。
- * @private
- */
- _createSearchLayerItem(layerName) {
- const layerOption = document.createElement("div");
- layerOption.setAttribute("class", "component-search__layers__itme");
- // 创建圆形单选框
- const singleSelect = document.createElement("div");
- singleSelect.setAttribute("class", "component-search__layers__itme__singleselect");
- const singleIcon = document.createElement("div");
- singleIcon.setAttribute("class", "component-single-default-img");
- singleSelect.appendChild(singleIcon);
- const singleLabel = document.createElement("span");
- singleLabel.setAttribute("class", "single-label");
- singleLabel.innerHTML = layerName;
- singleSelect.appendChild(singleLabel);
- layerOption.appendChild(singleSelect);
- //attributes-select todo 暂不支持该功能
- // const attributesSelect = (new ComponentSelect(layer.layer.attributeNames)).getElement();
- //选择查询的字段 todo 限制图层查找属性功能待属性选择框优化后完善
- /*attributesSelect.onchange = (e) => {
- this.searchAttributes = e.target.value;
- };*/
- // layerOption.appendChild(attributesSelect);
- document.getElementsByClassName("component-search__layers__body")[0].appendChild(layerOption);
- },
- /**
- * @function SearchView.prototype._createResultItem
- * @description 创建查询结果列表。
- * @private
- */
- _createResultItem(featureType, properties) {
- const item = document.createElement("div");
- item.setAttribute("class", "component-search__resultitme");
- let icon = document.createElement("div");
- if (featureType === "Point" || featureType === "MultiPoint") {
- icon.setAttribute("class", "supermapol-icons-marker-layer component-search-result-icon");
- } else if (featureType === "LineString" || featureType === "MultiLineString ") {
- icon.setAttribute("class", "supermapol-icons-line-layer component-search-result-icon");
- } else if (featureType === "Polygon" || featureType === "MultiPolygon") {
- icon.setAttribute("class", "supermapol-icons-polygon-layer component-search-result-icon");
- } else {
- icon.setAttribute("class", "supermapol-icons-point-layer component-search-result-icon");
- }
- item.appendChild(icon);
- const info = document.createElement("div");
- info.setAttribute("class", "component-search-result-info");
- const info1 = document.createElement("div");
- info.appendChild(info1);
- const info2 = document.createElement("div");
- //分地址匹配和图层搜索的两种数据展现形式:
- if (properties.name) {
- info1.innerHTML = properties.name;
- info2.innerHTML = properties.address;
- info.appendChild(info2);
- } else {
- info1.innerHTML = properties.filterAttributeName + ": " + properties.filterAttributeValue;
- }
- item.appendChild(info);
- //暂时删除复选框UI
- const check = document.createElement("div");
- check.setAttribute("class", "component-checkbox component-checkbox-default-img");
- // item.appendChild(check);
- return item;
- },
- /*----------对 VM 的一些事件监听 ----------*/
- /**
- * @function SearchView.prototype._addViewModelListener
- * @description 绑定对 VM 的事件监听。
- * @private
- */
- _addViewModelListener() {
- //----可查询图层变化监听
- this.viewModel.on("searchlayerschanged", (layers) => {
- for (let i = 0; i < layers.length; i++) {
- this._createSearchLayerItem(layers[i]);
- }
- });
- //----可查询图层变化监听
- this.viewModel.on("newlayeradded", (e) => {
- this._createSearchLayerItem(e.layerName);
- });
- //----图层查询结果监听
- this.viewModel.on("searchlayersucceeded", (e) => {
- const data = e.result;
- this.clearSearchResult();
- this.searchResultLayer = external_L_default().featureGroup(data, {
- pointToLayer: this.options.style,
- style: this.options.style
- }).bindPopup(function (layer) {
- if (layer.feature.properties) {
- return (new AttributesPopContainer({
- attributes: layer.feature.properties
- })).getElement();
- }
- }).addTo(this.map);
- this.searchResultLayer.eachLayer((layer) => {
- this.options.onEachFeature ? this.options.onEachFeature(layer.toGeoJSON(), layer) :
- this._featureOnclickEvent.bind(this)(layer.toGeoJSON(), layer);
- });
- this.searchLayersData = data;
- //查询结果列表:
- this._prepareResultData(data);
- /**
- * @event SearchView#searchlayersucceeded
- * @description 图层查询成功后触发。
- * @property {Object} result - 事件返回的 GeoJSON 格式数据对象。
- */
- this._event.fire("searchlayersucceeded", {
- result: this.searchResultLayer.toGeoJSON()
- });
- });
- //----地址匹配服务监听
- this.viewModel.on("geocodesucceeded", (e) => {
- const data = e.result;
- //先清空当前有的地址匹配图层
- this.clearSearchResult();
- this.searchResultLayer = external_L_default().geoJSON(data, {
- pointToLayer: this.options.style,
- style: this.options.style,
- onEachFeature: this.options.onEachFeature || this._featureOnclickEvent.bind(this)
- }).bindPopup(function (layer) {
- if (layer.feature.properties) {
- return (new AttributesPopContainer({
- attributes: layer.feature.properties
- })).getElement();
- }
- }).addTo(this.map);
- this.searchLayersData = data
- //查询结果列表:
- this._prepareResultData(data);
- /**
- * @event SearchView#geocodesucceeded
- * @description 地址匹配服务成功后触发。
- * @property {Object} result - 事件返回的 GeoJSON 格式数据对象。
- */
- this._event.fire("geocodesucceeded", {
- result: data
- });
- });
- //----地址匹配或图层查询失败监听
- this.viewModel.on("searchfailed", (e) => {
- let message = "";
- if (e.searchType === "searchGeocodeField") {
- message = Lang.i18n("msg_searchGeocodeField");
- } else if (e.searchType === "cityGeocodeField") {
- message = Lang.i18n("msg_cityGeocodeField");
- } else {
- message = Lang.i18n("msg_getFeatureField");
- }
- this.messageBox.showView(message)
- /**
- * @event SearchView#searchfailed
- * @description 图层属性查询失败后触发。
- * @property {string} message - 失败原因。
- */
- this._event.fire("searchfailed", {
- message: message
- });
- });
- },
- /*-------以下是一些辅助性功能函数 -------*/
- /**
- * @function SearchView.prototype._prepareResultData
- * @description 展示数据。
- * @param {Array.<Feature>} data - 图层查询或地址匹配返回的要素数据数组。
- * @private
- */
- _prepareResultData(data) {
- this.currentResult = data;
- //向下取舍,这只页码
- let pageCounts = Math.ceil(data.length / this.perPageDataNum);
- this._resultDomObj.setPageLink(pageCounts);
- //初始结果页面内容:
- this._createResultListByPageNum(1, data);
- this._resultDomObj.showView();
- //给页面模板设置联动事件
- this._resultDomObj.setLinkageEvent(_linkageEvent);
- const self = this;
- function _linkageEvent(page) {
- self._createResultListByPageNum(page, self.currentResult);
- }
- },
- /**
- * @function SearchView.prototype._createResultListByPageNum
- * @description 填充内容。
- * @param {number} page - 页数。
- * @param {Array.<Feature>} data - 图层查询或地址匹配返回的要素数据数组。
- * @private
- */
- _createResultListByPageNum(page, data) {
- let start = 0,
- end;
- if (page === 1 && data.length < this.perPageDataNum) {
- //data数据不满8个时:
- end = data.length - 1;
- } else if (page * this.perPageDataNum > data.length) {
- //最后一页且数据不满8个时
- start = this.perPageDataNum * (page - 1);
- end = data.length - 1
- } else {
- //中间页面的情况
- start = this.perPageDataNum * (page - 1);
- end = page * this.perPageDataNum - 1
- }
- const content = document.createElement("div");
- for (let i = start; i <= end; i++) {
- let properties, featureType = "Point";
- if (data[i].filterAttribute) {
- featureType = data[i].feature.geometry.type;
- properties = data[i].filterAttribute;
- } else {
- properties = data[i].properties;
- }
- content.appendChild(this._createResultItem(featureType, properties))
- }
- this._resultDomObj.setContent(content);
- this._resultDomObj.showView();
- //查询完成默认选中第一个结果:
- content.firstChild.getElementsByClassName("component-search-result-icon")[0].classList.add("component-search__resultitme-selected");
- const filter = content.firstChild.getElementsByClassName("component-search-result-info")[0].firstChild.innerText;
- !this._selectMarkerFeature && this._linkageFeature(filter);
- },
- /**
- * @function SearchView.prototype._flyToBounds
- * @param {L.Bounds} bounds - 当前图层范围。
- * @description 移动到该范围。
- * @private
- */
- _flyToBounds(bounds) {
- const sw = bounds.getSouthWest();
- const ne = bounds.getNorthEast();
- if (sw.lat === ne.lat && sw.lng === ne.lng) {
- this.map.flyTo(sw);
- } else {
- // this.map.fitBounds(this.searchResultLayer.getBounds());
- this.map.fitBounds(bounds);
- }
- },
- /**
- * @function SearchView.prototype._linkageFeature
- * @description 点击结果列表联动地图上要素响应。
- * @private
- */
- _linkageFeature(filter) {
- let filterValue = "";
- if (this.isSearchLayer) {
- filterValue = filter.split(":")[1].trim();
- } else {
- filterValue = filter;
- }
- this._selectFeature && this._selectFeature.addTo(this.map);
- this.searchResultLayer.eachLayer((layer) => {
- // this._resetLayerStyleToDefault(layer);
- if (!filterValue || layer.filterAttribute && layer.filterAttribute.filterAttributeValue === filterValue ||
- layer.feature.properties && layer.feature.properties.name === filterValue) {
- layer.remove();
- this._setSelectedLayerStyle(layer);
- /*layer.bindPopup(function () {
- return (new AttributesPopContainer(layer.feature.properties)).getElement()
- }, {closeOnClick: false}).openPopup().addTo(this.map);*/
- //若这个图层只有一个点的话,则直接 flyTo 到点:
- }
- });
- },
- /**
- * @function SearchView.prototype.clearSearchResult
- * @description 清空查询结果。
- */
- clearSearchResult() {
- if (this.searchResultLayer) {
- this.map.closePopup();
- //若当前是查询图层的结果,则不删除图层,只修改样式
- !this.isSearchLayer && this.map.removeLayer(this.searchResultLayer);
- this._selectMarkerFeature && this.map.removeLayer(this._selectMarkerFeature);
- this._selectFeaturethis && this.map.removeLayer(this._selectFeature);
- this._selectMarkerFeature = null;
- this._selectFeature = null;
- this.searchResultLayer = null;
- this.currentResult = null;
- }
- },
- /**
- * @function SearchView.prototype._featureOnclickEvent
- * @description 要素点击事件
- * @param {L.layer} layer - Leaflet Layer 对象。
- * @private
- */
- _featureOnclickEvent(feature, layer) {
- layer.on('click', () => {
- let pageEles1 = document.getElementsByClassName('component-pagination__link')[0];
- this._resultDomObj._changePageEvent({
- target: pageEles1.children[0].children[0]
- });
- this._selectFeature && this._selectFeature.addTo(this.map);
- layer.remove();
- let page, dataIndex;
- for (let i = 0; i < this.searchLayersData.length; i++) {
- let item = this.searchLayersData[i]
- if ((item.properties && (item.properties.name === feature.properties.name)) || (item.filterAttribute && (item.filterAttribute.filterAttributeName + ": " + item.filterAttribute.filterAttributeValue) === (layer.filterAttribute.filterAttributeName + ": " + layer.filterAttribute.filterAttributeValue))) {
- dataIndex = i % this.perPageDataNum;
- page = parseInt(i / this.perPageDataNum) + 1;
- break;
- }
- }
- if (page > 1) {
- for (let i = 1; i < page; i++) {
- let pageEles;
- pageEles = document.getElementsByClassName('component-pagination__link')[0];
- this._resultDomObj._changePageEvent({
- target: pageEles.children[pageEles.children.length - 2].children[0]
- });
- }
- }
- let pageList = document.getElementsByClassName('component-search-result-info')
- let target = pageList[dataIndex].children[0];
- if (target.innerHTML === feature.properties.name || target.innerHTML === (layer.filterAttribute.filterAttributeName + ": " + layer.filterAttribute.filterAttributeValue)) {
- let selectFeatureOption = pageList[dataIndex].parentNode;
- //修改
- if (document.getElementsByClassName("component-search__resultitme-selected").length > 0) {
- document.getElementsByClassName("component-search__resultitme-selected")[0].classList.remove("component-search__resultitme-selected");
- }
- selectFeatureOption.firstChild.classList.add("component-search__resultitme-selected");
- this._setSelectedLayerStyle(layer);
- }
- }, this)
- },
- /**
- * @function SearchView.prototype._setSelectedLayerStyle
- * @description 设置图层选中样式。
- * @param {L.layer} layer - Leaflet Layer 对象。
- * @private
- */
- _setSelectedLayerStyle(layer) {
- this._selectMarkerFeature && this._selectMarkerFeature.remove();
- this._selectMarkerFeature = null;
- this._selectFeature = layer;
- //circleMarker 需要变成 marker 的样式:
- this._selectMarkerFeature = external_L_default().geoJSON(layer.toGeoJSON(), {
- //点选中样式, todo marker 显示位置需要调整
- pointToLayer: (geoJsonPoint, latlng) => {
- return external_L_default().marker(latlng, {
- icon: external_L_default().divIcon({
- className: 'component-select-marker-icon',
- iconAnchor: [15, 0]
- })
- })
- },
- //线和面选中样式:
- style: {
- fillColor: 'red',
- weight: 1,
- opacity: 1,
- color: 'red',
- fillOpacity: 0.2
- }
- }).addTo(this.map);
- this._selectMarkerFeature.bindPopup(function () {
- return (new AttributesPopContainer({
- attributes: layer.feature.properties
- })).getElement()
- }, {
- closeOnClick: false
- }).openPopup().addTo(this.map);
- this._flyToBounds(this.searchResultLayer.getBounds());
- let center;
- if (layer.getLatLng) {
- center = layer.getLatLng();
- } else if (layer.getCenter) {
- center = layer.getCenter();
- }
- this.map.setView(center);
- }
- });
- var searchView = function (options) {
- return new SearchView(options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/components/dataflow/DataFlowViewModel.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class DataFlowViewModel
- * @aliasclass Components.DataFlowViewModel
- * @deprecatedclassinstance L.supermap.components.dataFlowViewModel
- * @classdesc 数据流组件功能类。
- * @version 9.1.1
- * @category Components DataFlow
- * @param {L.Map} map - Leaflet Map 对象。
- * @param {Object} [dataFlowLayerOptions] - 数据流服务返回数据数据展示样式,默认采用 ViewModel 默认样式。
- * @param {Object} options - 参数。
- * @param {function} [options.style] - 定义点、线、面要素样式。参数为{@link L.Path-option}。</br>
- `function (feature) {
- return {
- fillColor: "red",
- fillOpacity: 1,
- radius: 6,
- weight: 0
- };
- }`
- * @param {function} [options.onEachFeature] - 给该元素绑定事件和弹窗,默认对新创建的图层不执行任何操作。
- * @fires DataFlowViewModel#dataflowservicesubscribed
- * @fires DataFlowViewModel#subscribesucceeded
- * @fires DataFlowViewModel#subscribefailed
- * @fires DataFlowViewModel#dataupdated
- * @extends {L.Evented}
- * @usage
- */
- var DataFlowViewModel = external_L_default().Evented.extend({
- options: {
- _defaultLayerOptions: {
- //style 返回 marker样式或者 L.path 样式
- style: null,
- onEachFeature: function (feature, layer) {
- let content = "属性信息如下:<br>";
- for (let key in feature.properties) {
- content += key + ": " + feature.properties[key] + "<br>"
- }
- layer.bindPopup(content);
- }
- }
- },
- initialize(map, dataFlowLayerOptions = null) {
- if (map) {
- /**
- * @member {L.Map} DataFlowViewModel.prototype.map
- * @description Leaflet Map 对象。
- */
- this.map = map;
- } else {
- return new Error(`Cannot find map, fileModel.map cannot be null.`);
- }
- //合并用户的 dataFlowLayerOptions
- external_L_default().Util.extend(this.options._defaultLayerOptions, dataFlowLayerOptions);
- //点样式也存储在style里
- this.options._defaultLayerOptions.pointToLayer = this.options._defaultLayerOptions.style;
- /**
- * @member {boolean} [DataFlowViewModel.prototype.popupsStatus=true]
- * @description 图层 popup 打开 "true" 或关闭 "false" 的状态。
- */
- this.popupsStatus = true;
- /**
- * @member {boolean} [DataFlowViewModel.prototype.dataFlowStatus=false]
- * @description 数据流服务当前状态,订阅 "true" 或未订阅 "false" 的状态。
- */
- this.dataFlowStatus = false;
- /**
- * @member {string} [DataFlowViewModel.prototype.dataFlowUrl=""]
- * @description 数据流地址。
- */
- this.dataFlowUrl = "";
- /**
- * @member {Array.<Object>} [DataFlowViewModel.prototype.currentFeatures]
- * @description 当前订阅数据流返回的要素数组。
- */
- this.currentFeatures = [];
- /**
- * @member {DataFlowLayer} [DataFlowViewModel.prototype.dataFlowLayer=null]
- * @description 当前 dataFlowLayer 图层对象。
- */
- this.dataFlowLayer = null;
- },
- /**
- * @function DataFlowViewModel.prototype.subscribe
- * @description 订阅数据流。
- * @param {string} dataFlowUrl - 数据流服务地址。
- */
- subscribe(dataFlowUrl) {
- //若当前数据流服务没变,则不进行重新订阅 todo 或者没点击暂停
- if (this.dataFlowUrl === dataFlowUrl) {
- if (this.dataFlowStatus) {
- /**
- * @event DataFlowViewModel#dataflowservicesubscribed
- * @description 数据流订阅成功后触发。
- */
- this.fire("dataflowservicesubscribed");
- return;
- }
- } else {
- this.dataFlowUrl = dataFlowUrl
- }
- this.dataFlowStatus = true;
- //移除已有图层
- if (this.dataFlowLayer) {
- this.dataFlowLayer.remove();
- this.dataFlowLayer = null;
- }
- //创建DataFlowLayer,创建DataFlowLayer订阅iServer dataflow服务并将结果加载到地图上
- const dataFlowLayer = new DataFlowLayer(dataFlowUrl, this.options._defaultLayerOptions);
- dataFlowLayer.on('subscribesucceeded', (result) => {
- /**
- * @event DataFlowViewModel#subscribesucceeded
- * @description 数据流订阅成功后触发。
- * @property {Object} result - 返回的数据。
- */
- this.fire("subscribesucceeded", {result: result});
- });
- dataFlowLayer.on('subscribefailed', (result) => {
- /**
- * @event DataFlowViewModel#subscribefailed
- * @description 数据流订阅失败后触发。
- * @property {Object} result - 返回的数据。
- */
- this.fire("subscribefailed", {result: result});
- });
- dataFlowLayer.on('dataupdated', (result) => {
- //派发出订阅返回的数据:
- /**
- * @event DataFlowViewModel#dataupdated
- * @description 数据返回成功后触发。
- * @property {Object} result - 返回的数据。
- */
- this.fire("dataupdated", {result: result});
- //若数据超出当前视图范围,则移动到数据所在视图范围:
- let layerBounds = result.layer.getBounds(),
- mapBounds = CommontypesConversion.toSuperMapBounds(this.map.getBounds()),
- layerBoundsSuperMap = CommontypesConversion.toSuperMapBounds(layerBounds);
- if (!mapBounds.intersectsBounds(layerBoundsSuperMap)) {
- if (layerBoundsSuperMap.left === layerBoundsSuperMap.right && layerBoundsSuperMap.top === layerBoundsSuperMap.bottom) {
- this.map.setView(layerBounds.getCenter())
- } else {
- this.map.flyToBounds(layerBounds);
- }
- }
- if (this.popupsStatus) {
- this.openPopups();
- }
- });
- dataFlowLayer.addTo(this.map);
- this.dataFlowLayer = dataFlowLayer;
- },
- /**
- * @function DataFlowViewModel.prototype.cancelSubscribe
- * @description 取消订阅的数据流。
- */
- cancelSubscribe() {
- if (this.dataFlowLayer) {
- this.dataFlowStatus = false;
- this.dataFlowLayer.dataService.unSubscribe();
- this.dataFlowLayer.remove();
- this.dataFlowLayer = null;
- }
- },
- /**
- * @function DataFlowViewModel.prototype.openPopups
- * @description 打开图层要素弹窗。
- */
- openPopups() {
- this.popupsStatus = true;
- if (this.dataFlowLayer) {
- const layers = this.dataFlowLayer.getLayers();
- for (let i = 0; i < layers.length; i++) {
- for (let j = 0; j < layers[i].getLayers().length; j++) {
- layers[i].getLayers()[j].openPopup();
- }
- }
- }
- },
- /**
- * @function DataFlowViewModel.prototype.closePopups
- * @description 关闭图层要素弹窗。
- */
- closePopups() {
- this.popupsStatus = false;
- if (this.dataFlowLayer) {
- const layers = this.dataFlowLayer.getLayers();
- for (let i = 0; i < layers.length; i++) {
- for (let j = 0; j < layers[i].getLayers().length; j++) {
- layers[i].getLayers()[j].closePopup();
- }
- }
- }
- }
- });
- var dataFlowViewModel = function (options) {
- return new DataFlowViewModel(options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/components/dataflow/DataFlowView.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
-
-
-
-
-
- /**
- * @class DataFlowView
- * @aliasclass Components.DataFlowView
- * @deprecatedclassinstance L.supermap.components.dataFlow
- * @classdesc 数据流组件。
- * @version 9.1.1
- * @category Components DataFlow
- * @param {Object} options - 参数。
- * @param {string} [options.position='topright'] - 组件在地图中显示的位置( 'topleft'|'topright'|'bottomleft'|'bottomright' )。
- * @param {function} [options.style] - 默认图层样式。返回类型:点样式( maker|circleMaker);线和面样式( L.path )。<br>
- `function (feature) {
- return {
- fillColor: "red",
- fillOpacity: 1,
- radius: 6,
- weight: 0
- };
- }`
- * @param {function} [options.onEachFeature] - 给该元素绑定事件和弹窗。
- * @fires DataFlowView#dataupdated
- * @extends {ComponentsViewBase}
- * @usage
- */
- var DataFlowView = ComponentsViewBase.extend({
- initialize(options) {
- ComponentsViewBase.prototype.initialize.apply(this, [options]);
- },
- /**
- * @function DataFlowView.prototype.onAdd
- * @description 给地图添加组件。
- * @override
- * @private
- */
- onAdd(map) {
- //为了避免空对象为复写默认配置的现象,先判断参数是否为空
- let options = {};
- if (this.options.style) {
- options.style = this.options.style;
- }
- if (this.options.onEachFeature) {
- options.style = this.options.onEachFeature;
- }
- this.viewModel = new DataFlowViewModel(map, options);
- return ComponentsViewBase.prototype.onAdd.apply(this, [map]);
- },
- /**
- * @function DataFlowView.prototype._initView
- * @description 创建数据组件,用于打开本地文件。
- * @returns {HTMLElement}
- * @private
- * @override
- */
- _initView() {
- const containerObj = new CommonContainer({title: Lang.i18n("title_dataFlowService")});
- const container = containerObj.getElement();
- const componentContent = containerObj.getContentElement();
- componentContent.style.padding = "10px 18px";
- const dataFlowContainer1 = document.createElement("div");
- dataFlowContainer1.setAttribute("class", "component-dataflow__container");
- //输入框
- const dataFlowInputContainer = document.createElement("div");
- dataFlowInputContainer.setAttribute("class", "component-input-default");
- const dataFlowInput = document.createElement("input");
- dataFlowInput.setAttribute("class", "component-input-default");
- dataFlowInput.type = "text";
- dataFlowInput.placeholder = Lang.i18n('text_input_value_inputDataFlowUrl');
- dataFlowInput.title = Lang.i18n('text_input_value_inputDataFlowUrl');
- dataFlowInputContainer.appendChild(dataFlowInput);
- //删除输入值按钮:
- const inputClearBtn = document.createElement("span");
- inputClearBtn.setAttribute("class", "supermapol-icons-close");
- inputClearBtn.hidden = true;
- //---清除输入值【清除按钮点击事件】
- inputClearBtn.onclick = (e) => {
- dataFlowInput.value = "";
- e.target.hidden = true;
- };
- //---输入框值改变,打开清除按钮【输入框内容改变事件】
- dataFlowInput.oninput = () => {
- inputClearBtn.hidden = false;
- };
- dataFlowInputContainer.appendChild(inputClearBtn);
- dataFlowContainer1.appendChild(dataFlowInputContainer);
- componentContent.appendChild(dataFlowContainer1);
- //复选框条件
- const dataFlowContainer2 = document.createElement("div");
- dataFlowContainer2.setAttribute("class", "component-dataflow__container");
- const checkboxContainer = document.createElement("div");
- checkboxContainer.setAttribute("class", "component-checkbox-container");
- const attributesCheckbox = document.createElement("div");
- attributesCheckbox.setAttribute("class", "component-checkbox-default component-checkbox-selected-img");
- attributesCheckbox.checked = true;
- checkboxContainer.appendChild(attributesCheckbox);
- const checkboxLabel = document.createElement("div");
- checkboxLabel.setAttribute("class", "component-label component-label-selected");
- checkboxLabel.innerHTML = Lang.i18n('text_displayFeaturesInfo');
- checkboxContainer.appendChild(checkboxLabel);
- //----是否显示属性框【属性框复选框点击事件】
- attributesCheckbox.onclick = (e) => {
- e.target.checked = !e.target.checked;
- if (e.target.checked) {
- checkboxLabel.setAttribute("class", "component-label component-label-selected");
- e.target.setAttribute("class", "component-checkbox-default component-checkbox-selected-img");
- this.viewModel.openPopups();
- } else {
- checkboxLabel.setAttribute("class", "component-label");
- e.target.setAttribute("class", "component-checkbox-default component-checkbox-default-img");
- this.viewModel.closePopups();
- }
- };
- dataFlowContainer2.appendChild(checkboxContainer);
- componentContent.appendChild(dataFlowContainer2);
- //订阅按钮,取消按钮:
- const dataFlowContainer3 = document.createElement("div");
- dataFlowContainer3.setAttribute("class", "component-dataflow__container component-init-center");
- const subscribe = document.createElement("button");
- subscribe.setAttribute("class", "component-button-default");
- subscribe.innerHTML = Lang.i18n('text_subscribe');
- //----订阅服务【订阅按钮点击事件】
- subscribe.onclick = () => {
- const urlDataFlow = dataFlowInput.value;
- if (urlDataFlow === "") {
- this.messageBox.showView(Lang.i18n('msg_inputDataFlowUrlFirst'));
- return;
- }
- this.viewModel.subscribe(urlDataFlow);
- };
- dataFlowContainer3.appendChild(subscribe);
- const cancelSubscribe = document.createElement("button");
- cancelSubscribe.setAttribute("class", "component-button-default");
- cancelSubscribe.innerHTML = Lang.i18n('text_cancelSubscribe');
- //----取消订阅服务【取消订阅按钮点击事件】
- cancelSubscribe.onclick = () => {
- this.viewModel.cancelSubscribe();
- };
- dataFlowContainer3.appendChild(cancelSubscribe);
- componentContent.appendChild(dataFlowContainer3);
- //增加提示框:
- this.messageBox = new MessageBox();
- this.viewModel.on("dataflowservicesubscribed", () => {
- this.messageBox.showView(Lang.i18n("msg_dataflowservicesubscribed"));
- });
- this.viewModel.on("subscribesucceeded", () => {
- this.messageBox.showView(Lang.i18n("msg_subscribesucceeded"));
- });
- /**
- * @event DataFlowView#dataupdated
- * @description 数据流服务成功返回数据后触发。
- * @property {Object} result - 事件返回的数据对象。
- */
- this.viewModel.on("dataupdated", (result) => {
- this.messageBox.closeView();
- this._event.fire("dataupdated", result);
- });
- //关闭在控件上触发地图的事件响应:
- //阻止 map 默认事件
- this._preventMapEvent(container, this.map);
- return container;
- }
- });
- var dataFlowView = function (options) {
- return new DataFlowView(options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/components/commonmodels/GeoJSONLayerWithName.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class GeoJSONLayerWithName
- * @aliasclass Components.GeoJSONLayerWithName
- * @deprecatedclassinstance L.supermap.components.geoJSONLayerWithName
- * @classdesc 含有 layerName 与 GeoJSON 图层的对象。
- * @param {Object} layerObject - 图层对象。
- * @param {string} layerName - 图层名称。
- * @param {L.GeoJSON} layer - 图层。
- * @category Components Common
- * @usage
- */
- class GeoJSONLayerWithName {
- constructor(layerName, layer) {
- this.layerName = layerName;
- this.layer = layer;
- }
- }
- var geoJSONLayerWithName = function (layerName, layer) {
- return new GeoJSONLayerWithName(layerName, layer);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/components/clientcomputation/ClientComputationViewModel.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
-
-
-
-
-
-
- /**
- * @class ClientComputationViewModel
- * @aliasclass Components.ClientComputationViewModel
- * @deprecatedclassinstance L.supermap.components.clientComputationViewModel
- * @classdesc 客户端计算组件功能类。
- * @version 9.1.1
- * @category Components ClientComputation
- * @param {string} workerUrl - worker 地址,原始位置为 dist/leaflet/workers/TurfWorker.js。
- * @fires ClientComputationViewModel#analysisfailed
- * @fires ClientComputationViewModel#analysissucceeded
- * @fires ClientComputationViewModel#layerloaded
- * @fires ClientComputationViewModel#layersremoved
- * @extends {L.Evented}
- * @usage
- */
- class ClientComputationViewModel extends (external_L_default()).Evented {
- initialize(workerUrl) {
- this.workerUrl = workerUrl;
- this.turfLayers = [];
- }
- /**
- * @function ClientComputationViewModel.prototype.getLayersData
- * @description 获取填充到 view 的数据。
- * @param {Array.<L.GeoJSON>} layersArr - 图层数组。
- * @returns {Object} layers 数据。
- */
- getLayersData(layersArr) {
- let result = {};
- let pointData = {}, lineData = {}, polygonData = {};
- for (let i = 0; i < layersArr; i++) {
- layersArr[i] = new GeoJSONLayerWithName(layersArr[i].layerName, layersArr[i].layer)
- }
- this.geoJsonLayersDataModel = new GeoJsonLayersDataModel(layersArr);
- // 把 layersArr 转成 key = layername 对象,方便获取 fields 时遍历
- let dataObj = [];
- for (let i = 0; i < layersArr.length; i++) {
- dataObj[layersArr[i].layerName] = {
- fields: layersArr[i].fields,
- layer: layersArr[i].layer.toGeoJSON()
- }
- }
- for (let key in this.geoJsonLayersDataModel.layers) {
- let fields;
- if (dataObj[key].fields) {
- fields = dataObj[key].fields;
- } else {
- fields = this.geoJsonLayersDataModel.layers[key].getAttributeNamesByType("Num");
- }
- let fieldsValue = [];
- for (let i = 0; i < fields.length; i++) {
- fieldsValue[fields[i]] = this.geoJsonLayersDataModel.layers[key].getAttributeValueByAttributeName(fields[i]);
- // 去空 & 去重 & 转 number
- let arr = fieldsValue[fields[i]];
- for (var j = 0; j < arr.length; j++) {
- if (arr[j] == "" || typeof (arr[j]) == "undefined") {
- arr.splice(j, 1);
- j = j - 1;
- }
- arr[j] = parseFloat(arr[j])
- }
- fieldsValue[fields[i]] = Array.from(new Set(arr.sort(function (a, b) {
- return a - b;
- })));
- }
- let obj = {
- layerName: key,
- fields: fields,
- fieldsValue: fieldsValue,
- features: dataObj[key].layer
- }
- let layersType = dataObj[key].layer.features[0].geometry.type;
- if (layersType === "Point") {
- pointData[key] = obj;
- } else if (layersType === "LineString") {
- lineData[key] = obj;
- } else if (layersType === "Polygon") {
- polygonData[key] = obj;
- }
- }
- result['point'] = pointData;
- result['lineString'] = lineData;
- result['polygon'] = polygonData;
- return result;
- }
- /**
- * @function ClientComputationViewModel.prototype.analysis
- * @description 客户端计算。
- * @param {Object} params - 客户端计算参数。
- * @param {L.Map} map - Leaflet Map 对象。
- */
- analysis(params, map) {
- this.geoJsonLayersDataModel.setCurrentLayerDataModel(params.analysisLayers);
- this.worker = new Worker(this.workerUrl);
- let resultData = this.geoJsonLayersDataModel.currentLayerDataModel.layer.toGeoJSON();
- if (params.analysisMethod === "isolines") {
- let fieldsValue = params.analysisFieldsValue.split(",");
- let pointGrid = resultData;
- for (let j = 0; j < fieldsValue.length; j++) {
- fieldsValue[j] = parseFloat(fieldsValue[j])
- }
- let me = this;
- let analysisParams = {
- "pointGrid": pointGrid,
- "analysisMethod": params.analysisMethod,
- "breaks": fieldsValue,
- "zProperty": params.analysisFields,
- "analysisCellSize": params.analysisCellSize,
- "options": {gridType: "point", property: params.analysisFields, weight: Number(params.analysisBreaks)}
- };
- this.worker.postMessage(analysisParams);
- this.worker.onmessage = (e) => {
- if (e.data.features.length === 0) {
- /**
- * @event ClientComputationViewModel#analysisfailed
- * @description 事件分析失败后触发,返回结果为空。
- */
- me.fire('analysisfailed');
- } else {
- /**
- * @event ClientComputationViewModel#analysissucceeded
- * @description 事件分析成功后触发。
- * @property {Object} data - 分析成功后的数据。
- */
- me.fire('analysissucceeded', {'data': e.data});
- let turfLayer = external_L_default().geoJSON(e.data, {
- style: {
- color: '#1060C2', weight: 3
- },
- onEachFeature: function (feature, layer) {
- if (feature.properties) {
- layer.bindPopup((new AttributesPopContainer(feature.properties)).getElement())
- }
- layer.on({
- 'mouseover': function () {
- layer.setStyle({color: "#ffffff", weight: 5})
- },
- 'mouseout': function () {
- layer.setStyle({color: '#1060C2', weight: 3})
- },
- "click": function () {
- layer.setStyle({color: "#ffffff", weight: 5})
- }
- });
- }
- }).addTo(map);
- me.turfLayers.push(turfLayer);
- /**
- * @event ClientComputationViewModel#layerloaded
- * @description 结果图层加载完成后触发。
- * @property {L.GeoJSON} layer - 加载完成后的结果图层。
- * @property {string} name - 加载完成后的结果图层名称。
- */
- me.fire('layerloaded', {"layer": turfLayer, "name": params.resultLayersName});
- me.worker.terminate();
- }
- };
- } else if (params.analysisMethod === "buffer") {
- let me = this;
- let analysisParams = {
- "analysisMethod": "buffer",
- "radius": params.radius,
- "unit": params.unit,
- "isSave": params.isSaveStatus,
- "isUnion": params.isUnion,
- 'geoJson': resultData
- };
- this.worker.postMessage(analysisParams);
- this.worker.onmessage = (e) => {
- let turfLayer = external_L_default().geoJSON(e.data, {
- style: {
- color: "#ffffff", fillColor: '#1060C2', fillOpacity: .5, weight: 1.5
- },
- onEachFeature: function (feature, layer) {
- if (feature.properties) {
- layer.bindPopup((new AttributesPopContainer(feature.properties)).getElement())
- }
- layer.on({
- 'mouseover': function () {
- layer.setStyle({
- color: "#ffffff",
- fillColor: "rgb(46,40,79)",
- fillOpacity: .5,
- weight: 5
- })
- },
- 'mouseout': function () {
- layer.setStyle({color: "#ffffff", fillColor: '#1060C2', fillOpacity: .5, weight: 1.5})
- },
- "click": function () {
- layer.setStyle({
- color: "#ffffff",
- fillColor: "rgb(46,40,79)",
- fillOpacity: .5,
- weight: 2
- })
- }
- });
- }
- }).addTo(map);
- me.turfLayers.push(turfLayer);
- me.fire('layerloaded', {"layer": turfLayer, "name": params.resultLayersName});
- me.worker.terminate();
- };
- }
- }
- /**
- * @function ClientComputationViewModel.prototype.clearLayers
- * @description 清空分析图层。
- */
- clearLayers() {
- for (let i in this.turfLayers) {
- this.turfLayers[i].clearLayers()
- }
- /**
- * @event ClientComputationViewModel#layersremoved
- * @description 图层删除之后触发。
- * @property {Array.<L.GeoJSON>} layer - 需要删除的图层数组。
- */
- this.fire('layersremoved', {layers: this.turfLayers});
- }
- /**
- * @function ClientComputationViewModel.prototype.cancelAnalysis
- * @description 取消分析。
- */
- cancelAnalysis() {
- this.worker.terminate();
- }
- }
- var clientComputationViewModel = function (options) {
- return new ClientComputationViewModel(options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/components/clientcomputation/ClientComputationView.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
-
-
-
-
-
-
-
-
- /**
- * @class ClientComputationView
- * @aliasclass Components.ClientComputationView
- * @deprecatedclassinstance L.supermap.components.clientComputation
- * @classdesc 叠加图层的客户端计算。
- * @version 9.1.1
- * @param {string} workerUrl - worker 地址,原始位置为 dist/leaflet/workers/TurfWorker.js。
- * @param {Object} options - 参数。
- * @param {string} [options.position='topright'] - 组件在地图中显示的位置( 'topleft'|'topright'|'bottomleft'|'bottomright' )。
- * @param {function} [options.style] - 默认图层样式。返回类型:点样式( maker|circleMaker);线和面样式( L.path )。
- * @param {function} [options.onEachFeature] - 给该元素绑定事件和弹窗。
- * @fires ClientComputationView#analysissucceeded
- * @fires ClientComputationView#analysisfailed
- * @fires ClientComputationView#layersremoved
- * @category Components ClientComputation
- * @extends {ComponentsViewBase}
- * @usage
- */
- var ClientComputationView = ComponentsViewBase.extend({
- initialize: function (workerUrl, options) {
- if (!workerUrl) {
- throw new Error('workerUrl is required');
- }
- this.workerUrl = workerUrl;
- ComponentsViewBase.prototype.initialize.apply(this, [options]);
- },
- /**
- * @function ClientComputationView.prototype.onAdd
- * @description 添加控件。
- * @private
- * @override
- */
- onAdd: function (map) {
- this.map = map;
- return ComponentsViewBase.prototype.onAdd.apply(this, [map]);
- },
- /**
- * @function ClientComputationView.prototype.addLayer
- * @description 添加叠加图层。
- */
- addLayer: function (layer) {
- this.layers = this.layers || [];
- this.layers.push(layer);
- let fillData = this.viewModel.getLayersData(this.layers);
- this.fillDataToView(fillData);
- },
- /**
- * @function ClientComputationView.prototype.fillDataToView
- * @private
- * @description 填充数据到 view。
- * @param {Object} fillData - 待填充的数据。
- */
- fillDataToView: function (fillData) {
- if (!fillData) {
- return;
- }
- this.fillData = fillData;
- let analysisMethod = document.getElementById('dropDownTop').getAttribute('data-value');
- let currentFillData = {};
- switch (analysisMethod) {
- case 'isolines':
- currentFillData = fillData['point'];
- break;
- case 'buffer':
- currentFillData = fillData['point'];
- break;
- }
- if (JSON.stringify(currentFillData) == '{}') {
- return;
- }
- // 填充分析图层下拉框
- let layserArr = [];
- for (let layerName in currentFillData) {
- layserArr.push(layerName);
- }
- let layersSelect = document.getElementById('layersSelect');
- let layerSelectName = document.getElementById('layerSelectName');
- // 清空 layersSelect;
- layersSelect.innerHTML = '';
- layerSelectName.title = layserArr[0];
- layerSelectName.innerHTML = layserArr[0];
- this._createOptions(layersSelect, layserArr);
- // 设置 layer select option 点击事件
- this.layerSelectObj.optionClickEvent(layersSelect, layerSelectName, this.layersSelectOnchange);
- // 当前选中图层数据
- let currentData = currentFillData[layerSelectName.title];
- let fieldsArr = currentData.fields;
- let textAreaData = currentData.fieldsValue;
- // 设置当前数据
- this.currentData = currentData;
- this.currentFillData = currentFillData;
- // 填充字段下拉框
- let fieldsSelect = document.getElementById('fieldsSelect');
- // 清空 fieldsSelect
- fieldsSelect.innerHTML = '';
- let fieldsSelectNameDiv = document.getElementById('fieldsSelectName');
- fieldsSelectNameDiv.innerHTML = fieldsArr[0];
- fieldsSelectNameDiv.title = fieldsArr[0];
- this._createOptions(fieldsSelect, fieldsArr);
- this.fieldsSelectObj.optionClickEvent(fieldsSelect, fieldsSelectNameDiv, this.fieldsSelectOnchange);
- // 当前选中字段
- let fieldsSelectName = fieldsSelectNameDiv.title;
- // 通过当前选中字段 填充 TextArea 初始值
- let getValueTextArea = document.getElementById('getValueTextArea');
- getValueTextArea.value = textAreaData[fieldsSelectName].toString().replace(/,/g, ",\r\n");
- getValueTextArea.setAttribute('data-value', textAreaData[fieldsSelectName]);
- // 结果图层
- let resultLayersName = document.getElementById('resultLayersName');
- let analysisType = document.getElementById('dropDownTop').getAttribute('data-value');
- switch (analysisType) {
- case 'isolines':
- resultLayersName.value = Lang.i18n('text_label_isolines') + layerSelectName.title;
- break;
- case 'buffer':
- resultLayersName.value = Lang.i18n('text_label_buffer') + layerSelectName.title;
- break;
- }
- },
- /**
- * @function ClientComputationView.prototype._initView
- * @description 创建客户端计算组件。
- * @returns {HTMLElement}
- * @private
- */
- _initView: function () {
- //初始化 ViewModel
- this.workerUrl && (this.viewModel = new ClientComputationViewModel(this.workerUrl));
- //初始化 view
- // Container
- let container = (new CommonContainer({ title: Lang.i18n('title_clientComputing') })).getElement();
- container.classList.add('component-analysis');
- container.children[0].style.fontSize = '12px';
- let analysisOptionsArr = [{
- 'title': Lang.i18n('text_isoline'),
- 'dataValue': 'isolines',
- 'remark': Lang.i18n('text_extractDiscreteValue'),
- 'icon': {
- 'className': 'component-analyst-isoline-img'
- }
- }, {
- 'title': Lang.i18n('text_buffer'),
- 'dataValue': 'buffer',
- 'remark': Lang.i18n('text_specifyTheDistance'),
- 'icon': {
- 'className': 'component-analyst-buffer-img'
- }
- }];
- let componentContentContainer = container.children[1];
- componentContentContainer.classList.add('component-content--scroll');
- componentContentContainer.classList.add('component-content--analysis');
- // 下拉框
- let dropDownBox = (new DropDownBox(analysisOptionsArr)).getElement();
- componentContentContainer.appendChild(dropDownBox);
- let dropDownTopContainer = dropDownBox.children[0].children[0];
- let dropDownItems = dropDownBox.children[0].children[2].children[0];
- dropDownTopContainer.children[0].id = 'dropDownTop';
- // analysisContainer
- let analysisTypeContainer = external_L_default().DomUtil.create('div', 'component-analysis__container', componentContentContainer);
- // 分析图层
- let analysisLayer = external_L_default().DomUtil.create('div', 'component-analysis__container__analysisLayer', analysisTypeContainer);
- let layerSelectControl = external_L_default().DomUtil.create('div', 'component-analysis__selecttool', analysisLayer);
- layerSelectControl.id = 'layerSelectControl';
- let layerOptions = {
- 'optionsArr': [''],
- 'labelName': Lang.i18n('text_label_analysisLayer')
- };
- let layerSelectObj = new Select(layerOptions);
- let layerSelectTool = layerSelectObj.getElement();
- this.layerSelectObj = layerSelectObj;
- layerSelectControl.appendChild(layerSelectTool);
- // 图层选中div
- let layerSelectName = layerSelectTool.children[1].children[0];
- layerSelectName.id = 'layerSelectName';
- // 图层下拉框select
- let layersSelect = layerSelectTool.children[1].children[2].children[0].children[0];
- layersSelect.id = 'layersSelect';
- // ISOLINE
- // 提取字段
- let div = external_L_default().DomUtil.create('div', 'component-analysis__container__analysistype', analysisTypeContainer);
- let isolineDiv = external_L_default().DomUtil.create('div', 'component-clientcomputation__isoline', div);
- let fieldsOptions = {
- 'optionsArr': [''],
- 'labelName': Lang.i18n('text_label_extractField'),
- 'optionsClickCb': this.fieldsSelectOnchange
- };
- let fieldsSelectControl = external_L_default().DomUtil.create('div', 'component-analysis__selecttool', isolineDiv);
- let fieldsSelectObj = new Select(fieldsOptions);
- let fieldsSelectTool = fieldsSelectObj.getElement();
- this.fieldsSelectObj = fieldsSelectObj;
- let fieldsSelectName = fieldsSelectTool.children[1].children[0];
- fieldsSelectName.id = 'fieldsSelectName';
- let fieldsSelect = fieldsSelectTool.children[1].children[2].children[0].children[0];
- fieldsSelect.id = 'fieldsSelect';
- fieldsSelectControl.appendChild(fieldsSelectTool);
- // 提取值
- let textareaContainer = external_L_default().DomUtil.create('div', 'component-analysis__container', isolineDiv);
- let textareaSpan = external_L_default().DomUtil.create('span', 'component-textarea__name', textareaContainer);
- textareaSpan.innerHTML = Lang.i18n('text_label_extractedValue');
- let textareaControl = external_L_default().DomUtil.create('div', 'component-textarea', textareaContainer);
- textareaControl.id = 'getValueText';
- let scrollarea = external_L_default().DomUtil.create('div', '', textareaControl);
- let scrollareaContent = external_L_default().DomUtil.create('div', 'component-scrollarea-content', scrollarea);
- scrollareaContent.setAttribute('tabindex', '1');
- let getValueTextArea = external_L_default().DomUtil.create('textarea', 'component-textarea__content', scrollareaContent);
- getValueTextArea.id = 'getValueTextArea';
- getValueTextArea.setAttribute('rows', '20');
- // 距离衰减
- let breaksDiv = external_L_default().DomUtil.create('div', '', isolineDiv);
- let breaksSpan = external_L_default().DomUtil.create('span', '', breaksDiv);
- breaksSpan.innerHTML = Lang.i18n('text_label_distanceAttenuation');
- let breaks = external_L_default().DomUtil.create('input', '', breaksDiv);
- breaks.value = '3';
- // 栅格大小
- let cellSizeDiv = external_L_default().DomUtil.create('div', '', isolineDiv);
- let cellSizeSpan = external_L_default().DomUtil.create('span', '', cellSizeDiv);
- cellSizeSpan.innerHTML = Lang.i18n('text_label_gridSize');
- let cellSize = external_L_default().DomUtil.create('input', '', cellSizeDiv);
- cellSize.value = '30';
- // BUFFER
- // 缓冲半径
- let bufferDiv = external_L_default().DomUtil.create('div', 'component-clientcomputation__buffer hidden', div);
- let bufferRadius = external_L_default().DomUtil.create('div', 'component-clientcomputation__buffer--radius', bufferDiv);
- let bufferRadiusSpan = external_L_default().DomUtil.create('span', '', bufferRadius);
- bufferRadiusSpan.innerHTML = Lang.i18n('text_label_bufferRadius');
- let bufferRadiusDiv = external_L_default().DomUtil.create('div', '', bufferRadius);
- let bufferRadiusInput = external_L_default().DomUtil.create('input', 'buffer-radius-input', bufferRadiusDiv);
- bufferRadiusInput.id = 'bufferRadiusInput';
- bufferRadiusInput.value = '10';
- bufferRadiusInput.setAttribute('placeholder', Lang.i18n('text_label_defaultkilometers'));
- let bufferUnit = external_L_default().DomUtil.create('div', 'component-clientcomputation__buffer--unit', bufferRadiusDiv);
- bufferUnit.id = 'bufferUnit';
- // 半径单位选择下拉框
- let bufferUnitOptions = {
- 'optionsArr': [Lang.i18n('text_option_kilometer')],
- 'labelName': Lang.i18n('text_label_unit')
- };
- let bufferUnitSelectTool = (new Select(bufferUnitOptions)).getElement();
- let bufferUnitSelectName = bufferUnitSelectTool.children[1].children[0];
- bufferUnitSelectName.id = 'bufferUnitSelectName';
- let bufferUnitSelect = bufferUnitSelectTool.children[1].children[2].children[0].children[0];
- bufferUnitSelect.id = 'bufferUnitSelect';
- bufferUnitSelectTool.children[0].style.display = 'none';
- bufferUnit.appendChild(bufferUnitSelectTool);
- // 保留原对象字段属性
- let saveFieldDiv = external_L_default().DomUtil.create('div', '', bufferRadius);
- let saveAttrsContainer = external_L_default().DomUtil.create('div', 'component-clientcomputation__buffer--issaveattrs', saveFieldDiv);
- saveAttrsContainer.id = 'saveAttrsContainer';
- let saveAttrsCheckbox = external_L_default().DomUtil.create('div', 'checkbox checkbox-fault', saveAttrsContainer);
- saveAttrsCheckbox.id = 'saveAttrsCheckbox';
- let saveAttrsLabel = external_L_default().DomUtil.create('div', 'lable', saveAttrsContainer);
- saveAttrsLabel.id = 'saveAttrsLabel';
- saveAttrsLabel.innerHTML = Lang.i18n('text_retainOriginal');
- // 合并缓冲区
- let isUnionContainer = external_L_default().DomUtil.create('div', 'component-clientcomputation__buffer--isunion', saveFieldDiv);
- isUnionContainer.id = 'isUnionContainer';
- let isUnionCheckbox = external_L_default().DomUtil.create('div', 'checkbox checkbox-fault', isUnionContainer);
- isUnionCheckbox.id = 'isUnionCheckbox';
- let isUnionLabel = external_L_default().DomUtil.create('div', 'lable', isUnionContainer);
- isUnionLabel.innerHTML = Lang.i18n('text_mergeBuffer');
- isUnionLabel.id = 'isUnionLabel';
- // 结果图层
- let resultLayerDiv = external_L_default().DomUtil.create('div', 'component-analysis__container__resultLayersName', analysisTypeContainer);
- let resultLayerSpan = external_L_default().DomUtil.create('span', '', resultLayerDiv);
- resultLayerSpan.innerHTML = Lang.i18n('text_label_resultLayerName');
- let resultLayersName = external_L_default().DomUtil.create('input', '', resultLayerDiv);
- resultLayersName.id = 'resultLayersName';
- // 分析按钮
- let runBtnContainer = external_L_default().DomUtil.create('div', 'component-analysis__container__analysisbtn', analysisTypeContainer);
- let runBtn = external_L_default().DomUtil.create('div', 'component-analysis__analysisbtn', runBtnContainer);
- let analysisBtn = external_L_default().DomUtil.create('button', 'component-analysis__analysisbtn--analysis', runBtn);
- analysisBtn.innerHTML = Lang.i18n('btn_analyze');
- let analysingContainer = external_L_default().DomUtil.create('div', 'component-analysis__analysisbtn--analysing-container hidden', runBtn);
- let analysisingBtn = external_L_default().DomUtil.create('div', 'component-analysis__analysisbtn--analysising', analysingContainer);
- let svgContainer = external_L_default().DomUtil.create('div', 'component-analysis__svg-container', analysisingBtn);
- svgContainer.id = 'analyse_background';
- svgContainer.innerHTML = `<svg class="component-analysis__svg-rotate" width="16px" height="16px" version="1.1" xmlns="http://www.w3.org/2000/svg">
- <path id="ring" fill="#FFF" transform="translate(8,8)" d="M 0 0 v -8 A 8 8 0 1 1 -8.00 0 z"></path>
- <circle cx="8" cy="8" r="6" fill="#38ADF5"></circle>
- <rect class="svg-top" x="8" y="0" rx="2" ry="2" width="2" height="2" style="fill: rgb(255, 255, 255); stroke-width: 0;"></rect>
- <rect class="svg-left" x="0" y="8" rx="2" ry="2" width="2" height="2" style="fill: rgb(255, 255, 255); stroke-width: 0;"></rect>
- </svg>`;
- external_L_default().DomUtil.create('span', '', analysisingBtn).innerHTML = Lang.i18n('btn_analyzing');
- let analysisCancelBtn = external_L_default().DomUtil.create('button', 'component-analysis__analysisbtn--cancel', analysingContainer);
- analysisCancelBtn.innerHTML = Lang.i18n('btn_cancelAnalysis');
- let deleteLayersBtn = external_L_default().DomUtil.create('button', 'component-analysis__analysisbtn--analysis component-analysis__analysisbtn--deletelayers', runBtn);
- deleteLayersBtn.innerHTML = Lang.i18n('btn_emptyTheAnalysisLayer');
- for (let i = 0; i < dropDownItems.children.length; i++) {
- // 点击何种分析类型 判断使用图层数据
- dropDownItems.children[i].onclick = () => {
- dropDownTopContainer.innerHTML = dropDownItems.children[i].outerHTML;
- dropDownTopContainer.children[0].id = 'dropDownTop';
- let layersSelect = document.getElementById('layersSelect');
- let layerSelectName = document.getElementById('layerSelectName');
- let analysisMethod = dropDownItems.children[i].getAttribute('data-value');
- let currentFillData = {};
- switch (analysisMethod) {
- case 'buffer':
- isolineDiv.classList.add('hidden');
- bufferDiv.classList.remove('hidden');
- componentContentContainer.style.height = '422px';
- resultLayersName.value = Lang.i18n('text_label_buffer') + layerSelectName.title;
- currentFillData = this.fillData['point'];
- break;
- case 'isolines':
- isolineDiv.classList.remove('hidden');
- bufferDiv.classList.add('hidden');
- componentContentContainer.style.height = '712px';
- resultLayersName.value = Lang.i18n('text_label_isolines') + layerSelectName.title;
- currentFillData = this.fillData['point'];
- break;
- }
- // 清空 layersSelect;
- // 清空 layersSelect;
- if (this.currentFillData === currentFillData) {
- return;
- }
- layersSelect.innerHTML = '';
- if (JSON.stringify(currentFillData) == '{}') {
- resultLayersName.value = '';
- layerSelectName.title = '';
- layerSelectName.innerHTML = '';
- return;
- }
- let layserArr = [];
- for (let layerName in currentFillData) {
- layserArr.push(layerName);
- }
- layerSelectName.title = layserArr[0];
- layerSelectName.innerHTML = layserArr[0];
- this._createOptions(layersSelect, layserArr);
- // 设置 layer select option 点击事件
- this.layerSelectObj.optionClickEvent(layersSelect, layerSelectName, this.layersSelectOnchange);
- if (analysisMethod === 'buffer') {
- resultLayersName.value = Lang.i18n('text_label_buffer') + layserArr[0];
- } else if (analysisMethod === 'isolines') {
- resultLayersName.value = Lang.i18n('text_label_isolines') + layserArr[0];
- }
- // 当前选中图层数据
- this.currentData = currentFillData[layerSelectName.title];
- this.currentFillData = currentFillData;
- }
- }
- // 字段下拉框 onchange 事件
- this.fieldsSelectOnchange = fieldsSelectOnchange.bind(this);
- function fieldsSelectOnchange(option) {
- if (this.currentData) {
- let displayData = this.currentData;
- let fieldsSelectName = option.title;
- getValueTextArea.value = displayData.fieldsValue[fieldsSelectName].toString().replace(/,/g, ",\r\n");
- getValueTextArea.setAttribute('data-value', displayData.fieldsValue[fieldsSelectName]);
- }
- }
- // 选中图层实时改变事件
- this.layersSelectOnchange = layersSelectOnchange.bind(this);
- function layersSelectOnchange(option) {
- if (this.currentData) {
- let layerSelectName = option.title;
- let displayData = this.currentFillData[layerSelectName];
- this.currentData = displayData;
- fieldsSelect.innerHTML = '';
- this._createOptions(fieldsSelect, displayData.fields);
- let fieldsSelectNameDiv = document.getElementById('fieldsSelectName');
- let field = displayData.fields[0];
- fieldsSelectNameDiv.title = field;
- fieldsSelectNameDiv.innerHTML = field;
- let fieldsSelectName = field;
- this.fieldsSelectObj.optionClickEvent(fieldsSelect, fieldsSelectNameDiv, this.fieldsSelectOnchange);
- getValueTextArea.value = displayData.fieldsValue[fieldsSelectName].toString().replace(/,/g, ",\r\n");
- getValueTextArea.setAttribute('data-value', displayData.fieldsValue[fieldsSelectName]);
- let analysisMethod = document.getElementById('dropDownTop').getAttribute('data-value');
- switch (analysisMethod) {
- case 'buffer':
- resultLayersName.value = Lang.i18n('text_label_buffer') + layerSelectName;
- break;
- case 'isolines':
- resultLayersName.value = Lang.i18n('text_label_isolines') + layerSelectName;
- break;
- }
- }
- }
- //复选框事件
- let isSaveStatus = true;
- //合并缓冲区
- //合并缓冲区,默认不选中,即为false
- let isUnion = false;
- //选中select
- saveAttrsLabel.classList.add("selected");
- saveAttrsCheckbox.classList.add("checkbox-active");
- saveAttrsContainer.onclick = () => {
- if (isSaveStatus) {
- //将当前状态和样式->不选中的样式和状态
- saveAttrsCheckbox.classList.add("checkbox-fault");
- saveAttrsCheckbox.classList.remove("checkbox-active");
- saveAttrsLabel.classList.remove("selected");
- isSaveStatus = false;
- } else {
- //将当前样式和状态改为选中
- saveAttrsCheckbox.classList.add("checkbox-active");
- saveAttrsCheckbox.classList.remove("checkbox-fault");
- saveAttrsLabel.classList.add("selected");
- isSaveStatus = true;
- //如果当前状态为选中的状态,则将上一个复选框的样式和状态由选中-不选中
- if (isUnion) {
- //移除dom样式和复选框的状态改变
- isUnionCheckbox.classList.add("checkbox-fault");
- isUnionCheckbox.classList.remove("checkbox-active");
- isUnion = false;
- }
- }
- }
- isUnionContainer.onclick = () => {
- if (isUnion) {
- //将选中状态 由选中->不选中,修改其样式和状态
- isUnionCheckbox.classList.add("checkbox-fault");
- isUnionCheckbox.classList.remove("checkbox-active");
- isUnionLabel.classList.remove("selected");
- isUnion = false;
- } else {
- //将状态由不选中->选中,修改其样式和状态
- isUnionCheckbox.classList.add("checkbox-active");
- isUnionCheckbox.classList.remove("checkbox-fault");
- isUnionLabel.classList.add("selected");
- isUnion = true;
- //如果当前状态为选中的,将上一个复选框改为不选中的状态
- if (isSaveStatus) {
- //修改当前样式和状态
- saveAttrsCheckbox.classList.add("checkbox-fault");
- saveAttrsCheckbox.classList.remove("checkbox-active");
- isSaveStatus = false;
- }
- }
- }
- // 提示框
- this.messageBox = new MessageBox();
- // 分析按钮点击事件
- analysisBtn.onclick = () => {
- analysingContainer.style.display = 'block';
- analysisBtn.style.display = 'none';
- let dropDownTop = document.getElementById('dropDownTop');
- let analysisMethod = dropDownTop.getAttribute('data-value');
- let params;
- switch (analysisMethod) {
- case 'isolines':
- params = getIsolinesAnalysisParams();
- break;
- case 'buffer':
- params = getBufferAnalysisParams();
- break;
- }
- this.viewModel.analysis(params, this.map);
- this.viewModel.on('layerloaded', (e)=> {
- analysingContainer.style.display = 'none';
- analysisBtn.style.display = 'block';
- /**
- * @event ClientComputationView#analysissucceeded
- * @description 分析完成之后触发。
- * @property {L.GeoJSON} layer - 加载完成后的结果图层。
- * @property {string} name - 加载完成后的结果图层名称。
- */
- this._event.fire('analysissucceeded', { "layer": e.layer, "name": e.name })
- });
- // 若分析的结果为空
- this.viewModel.on('analysisfailed', ()=> {
- analysingContainer.style.display = 'none';
- analysisBtn.style.display = 'block';
- this.messageBox.showView(Lang.i18n('msg_resultIsEmpty'), "failure");
- /**
- * @event ClientComputationView#analysisfailed
- * @description 分析失败之后触发。
- */
- this._event.fire('analysisfailed')
- })
- }
- // 取消按钮点击事件
- analysisCancelBtn.onclick = () => {
- analysingContainer.style.display = 'none';
- analysisBtn.style.display = 'block';
- this.viewModel.cancelAnalysis()
- }
- // 删除按钮点击事件
- deleteLayersBtn.onclick = () => {
- /**
- * @event ClientComputationView#layersremoved
- * @description 结果图层删除后触发。
- * @property {Array.<L.GeoJSON>} layers - 被删除的结果图层。
- */
- this.viewModel.on('layersremoved', (e) => {
- this._event.fire('layersremoved', { 'layers': e.layers });
- })
- this.viewModel.clearLayers();
- }
- // 获取分析数据
- function getIsolinesAnalysisParams() {
- let dropDownTop = document.getElementById('dropDownTop');
- let analysisMethod = dropDownTop.getAttribute('data-value');
- let resultLayersName = document.getElementById('resultLayersName').value;
- let analysisLayers = layerSelectName.title;
- let analysisFields = fieldsSelectName.title;
- let analysisFieldsValue = getValueTextArea.value.replace(/[\r\n]/g, "").split(',').toString();
- let analysisBreaks = breaks.value;
- let analysisCellSize = cellSize.value;
- let param = {
- 'analysisMethod': analysisMethod,
- 'analysisLayers': analysisLayers,
- 'analysisFields': analysisFields,
- 'analysisFieldsValue': analysisFieldsValue,
- 'analysisBreaks': analysisBreaks,
- 'analysisCellSize': analysisCellSize,
- 'resultLayersName': resultLayersName
- }
- return param;
- }
- function getBufferAnalysisParams() {
- let dropDownTop = document.getElementById('dropDownTop');
- let resultLayersName = document.getElementById('resultLayersName').value;
- let analysisLayers = layerSelectName.title;
- let analysisMethod = dropDownTop.getAttribute('data-value');
- let radius = bufferRadiusInput.value;
- let unit = bufferUnitSelectName.title;
- let param = {
- 'analysisMethod': analysisMethod,
- 'analysisLayers': analysisLayers,
- 'radius': radius,
- 'unit': unit,
- 'resultLayersName': resultLayersName,
- 'isSaveStatus': isSaveStatus,
- 'isUnion': isUnion
- };
- return param;
- }
- // 阻止 map 默认事件
- this._preventMapEvent(container, this.map);
- return container;
- },
- /**
- * @function ClientComputationView.prototype._createOptions
- * @description 创建 select 下拉框的 options。
- * @private
- */
- _createOptions(container, optionsArr) {
- for (let i in optionsArr) {
- let option = document.createElement('div');
- let optData = optionsArr[i];
- option.className = 'component-selecttool__option';
- option.title = optData;
- option.innerHTML = optData;
- option.setAttribute('data-value', optData);
- container.appendChild(option);
- }
- }
- });
- var clientComputationView = function (options) {
- return new ClientComputationView(options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/components/clientcomputation/ClientComputationLayer.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class ClientComputationLayer
- * @aliasclass Components.ClientComputationLayer
- * @deprecatedclassinstance L.supermap.components.clientComputationLayer
- * @classdesc 客户端计算图层对象。
- * @version 9.1.1
- * @param {Object} layerObject - 图层对象。
- * @param {string} layerObject.layerName - 图层名称。
- * @param {L.GeoJSON} layerObject.layer - 图层。
- * @param {Array.<string>} [layerObject.fields] - 字段数组。
- * @category Components ClientComputation
- * @usage
- */
- class ClientComputationLayer{
- constructor(layerObject){
- this.layerName = layerObject.layerName;
- this.layer = layerObject.layer;
- this.fields = layerObject.fields || null;
- }
- }
- var clientComputationLayer = function(layerObject){
- return new ClientComputationLayer(layerObject)
- }
- ;// CONCATENATED MODULE: ./src/leaflet/components/distributedanalysis/DistributedAnalysisModel.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
-
-
-
- /**
- * @class DistributedAnalysisModel
- * @aliasclass Components.DistributedAnalysisModel
- * @deprecatedclassinstance L.supermap.components.DistributedAnalysisModel
- * @classdesc 分布式分析组件数据模型。
- * @private
- * @category Components DistributedAnalysis
- * @param {string} processingUrl - 分布式分析地址。
- * @fires DistributedAnalysisModel#datasetsloaded
- * @fires DistributedAnalysisModel#datasetinfoloaded
- * @extends {L.Evented}
- */
- class DistributedAnalysisModel extends (external_L_default()).Evented {
-
- initialize(processingUrl) {
- this.processingUrl = processingUrl
- }
- /**
- * @function DistributedAnalysisModel.prototype.getDatasetsName
- * @description 获取所有可进行分布式分析的数据集名称。
- * @param {string} url - 服务地址。
- */
- getDatasetsName() {
- let url = this.processingUrl;
- this.dataset = [];
- this.dataset['datasetNames'] = [];
- this.dataset['childUrl'] = [];
- let host = 'http://' + url.split('/')[2];
- let sharefileUrl = host + '/iserver/services/datacatalog/rest/datacatalog/sharefile.json';
- let datasetsUrl = host + '/iserver/services/datacatalog/rest/datacatalog/relationship/datasets.json';
- let me = this;
- FetchRequest.get(sharefileUrl).then(function (response) {
- return response.json();
- }).then(function (result) {
- me.dataset['datasetNames'] = me.dataset['datasetNames'].concat(result.datasetNames);
- me.dataset['childUrl'] = me.dataset['childUrl'].concat(result.childUriList);
- let _me = me;
- FetchRequest.get(datasetsUrl).then(function (response) {
- return response.json();
- }).then(function (result) {
- _me.dataset['datasetNames'] = _me.dataset['datasetNames'].concat(result.datasetNames);
- _me.dataset['childUrl'] = _me.dataset['childUrl'].concat(result.childUriList);
- let datasetHash = [];
- for (let i in _me.dataset['datasetNames']) {
- datasetHash[_me.dataset.datasetNames[i]] = _me.dataset.childUrl[i]
- }
- /**
- * @event DistributedAnalysisModel#datasetsloaded
- * @description 数据集获取完成之后触发。
- * @property {Object} result - 数据集数据。
- * @property {Array.<string>} result.dataset - 数据集名称数组。
- * @property {Object} result.datasetHash - 数据集名称数组与数据集 URL 一一对应的对象。
- */
- _me.fire('datasetsloaded', { 'result': { 'dataset': _me.dataset, 'datasetHash': datasetHash } });
- });
- });
- }
- /**
- * @function DistributedAnalysisModel.prototype.getDatasetInfo
- * @description 获取数据集类型和字段。
- * @param {string} datasetUrl - 数据集资源地址。
- */
- getDatasetInfo(datasetUrl) {
- let type;
- let me = this;
- FetchRequest.get(datasetUrl).then(function (response) {
- return response.json();
- }).then(function (data) {
- let datasetInfo = data.datasetInfo
- if (datasetInfo.datasetType === 'LINE' || datasetInfo.type === 'LINE') {
- type = 'LINE';
- } else if (datasetInfo.datasetType === 'POINT' || datasetInfo.type === 'POINT' || datasetInfo.type === 'CSV') {
- type = 'POINT';
- } else if (datasetInfo.datasetType === 'REGION' || datasetInfo.type === 'REGION') {
- type = 'REGION';
- }
- let fields = [];
- let fieldInfos = datasetInfo.fieldInfos || datasetInfo.fieldInfo || null;
- if (fieldInfos) {
- for (let i in fieldInfos) {
- fields.push(fieldInfos[i].name)
- }
- /**
- * @event DistributedAnalysisModel#datasetinfoloaded
- * @description 数据集查询完成之后触发。
- * @property {Object} result - 数据集数据。
- * @property {string} result.type - 数据集类型。
- * @property {Array.<string>} result.fields - 数据集字段。
- */
- me.fire('datasetinfoloaded', { 'result': { 'type': type, 'fields': fields } })
- } else {
- let fieldsUrl = data.childUriList[0].replace('//fields', '/fields');
- FetchRequest.get(fieldsUrl).then(function (response) {
- return response.json();
- }).then(function (data) {
- let fieldNames = data.fieldNames;
- let fields = [];
- for (let i in fieldNames) {
- fields.push(fieldNames[i])
- }
- me.fire('datasetinfoloaded', { 'result': { 'type': type, 'fields': fields } })
- })
- }
- })
- }
- }
- ;// CONCATENATED MODULE: ./src/leaflet/components/distributedanalysis/DistributedAnalysisViewModel.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class DistributedAnalysisViewModel
- * @aliasclass Components.DistributedAnalysisViewModel
- * @deprecatedclassinstance L.supermap.components.distributedAnalysisViewModel
- * @classdesc 分布式分析组件功能类。
- * @version 9.1.1
- * @category Components DistributedAnalysis
- * @param {string} processingUrl - 分布式分析地址。
- * @fires DistributedAnalysisViewModel#datasetsloaded
- * @fires DistributedAnalysisViewModel#datasetinfoloaded
- * @fires DistributedAnalysisViewModel#analysisfailed
- * @fires DistributedAnalysisViewModel#analysissucceeded
- * @fires DistributedAnalysisViewModel#layerloaded
- * @fires DistributedAnalysisViewModel#layersremoved
- * @extends {L.Evented}
- * @usage
- */
- class DistributedAnalysisViewModel extends (external_L_default()).Evented {
- initialize(processingUrl) {
- this.processingUrl = processingUrl
- }
- /**
- * @function DistributedAnalysisViewModel.prototype.getDatasetsName
- * @description 获取所有数据集名称。
- * @param {string} url - 服务地址。
- */
- getDatasetsName() {
- let processingUrl = this.processingUrl;
- this.resultLayers = [];
- this.datasetNames = [];
- this.distributedAnalysisModel = new DistributedAnalysisModel(processingUrl);
- this.distributedAnalysisModel.getDatasetsName();
- let me = this;
- this.distributedAnalysisModel.on('datasetsloaded', function (e) {
- /**
- * @event DistributedAnalysisViewModel#datasetsloaded
- * @description 数据集获取完成之后触发。
- * @property {Object} result - 数据集数据。
- */
- me.fire('datasetsloaded', { 'result': e.result });
- })
- }
- /**
- * @function DistributedAnalysisViewModel.prototype.getDatasetInfo
- * @description 获取数据集类型和字段。
- * @param {string} datasetUrl - 数据集资源地址。
- */
- getDatasetInfo(datasetUrl) {
- // 判断数据集类型
- this.distributedAnalysisModel.getDatasetInfo(datasetUrl);
- let me = this;
- this.distributedAnalysisModel.on('datasetinfoloaded', function (e) {
- let type = e.result.type;
- let fields = e.result.fields;
- /**
- * @event DistributedAnalysisViewModel#datasetinfoloaded
- * @description 数据集类型与字段获取完成之后触发。
- * @property {Object} result - 数据集数据。
- * @property {string} result.type - 数据集类型。
- * @property {Array.<string>} result.fields - 数据集所含有的字段。
- */
- me.fire('datasetinfoloaded', { 'result': { 'type': type, 'fields': fields } })
- })
- }
- /**
- * @function DistributedAnalysisViewModel.prototype.analysis
- * @description 分布式分析。
- * @param {Object.<KernelDensityJobParameter|string>} params - 参数。
- * @param {KernelDensityJobParameter} params.analysisParam - 密度分析任务参数类。
- * @param {string} [params.resultLayerName] - 结果图层名称。
- * @param {L.Map} map - Leaflet Map 对象。
- */
- analysis(params, map) {
- let processingService = new ProcessingService(this.processingUrl);
- if (params.analysisParam instanceof KernelDensityJobParameter) {
- let kernelDensityJobParameter = params.analysisParam
- let me = this;
- processingService.addKernelDensityJob(kernelDensityJobParameter, function (serviceResult) {
- if (serviceResult.error) {
- /**
- * @event DistributedAnalysisViewModel#analysisfailed
- * @description 分析失败后触发。
- */
- me.fire('analysisfailed', { 'error': serviceResult.error });
- return;
- }
- serviceResult.result.setting.serviceInfo.targetServiceInfos.map(function (info) {
- if (info.serviceType === 'RESTMAP') {
- FetchRequest.get(info.serviceAddress + '/maps').then(function (response) {
- return response.json();
- }).then(function (result) {
- let mapUrl = result[0].path;
- /**
- * @event DistributedAnalysisViewModel#analysissucceeded
- * @description 分析成功后服务器返回的数据。
- */
- me.fire('analysissucceed', { 'result': result });
- let layer = tiledMapLayer(mapUrl, { noWrap: true, transparent: true });
- me.resultLayers.push(layer);
- layer.addTo(map);
- /**
- * @event DistributedAnalysisViewModel#layerloaded
- * @description 分析结果图层加载完成后触发。
- * @property {L.GeoJSON} layer - 结果图层。
- * @property {string} name - 结果图层名称。
- */
- let date = new Date();
- let resultLayerName = params.resultLayerName || date.getTime();
- me.fire('layerloaded', { 'layer': layer, 'name': resultLayerName })
- });
- }
- return info;
- });
- })
- }
- }
- /**
- * @function DistributedAnalysisViewModel.prototype.clearLayers
- * @description 清空分析图层。
- */
- clearLayers() {
- for (let i in this.resultLayers) {
- this.resultLayers[i].remove();
- }
- /**
- * @event DistributedAnalysisViewModel#layersremoved
- * @description 图层删除后触发。
- * @property {Array.<L.GeoJSON>} layers - 结果图层数组。
- */
- this.fire('layersremoved', { 'layers': this.resultLayers });
- this.resultLayers = [];
- }
- }
- var distributedAnalysisViewModel = function (options) {
- return new DistributedAnalysisViewModel(options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/components/distributedanalysis/DistributedAnalysisView.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
-
-
-
-
-
-
-
-
-
-
- /**
- * @class DistributedAnalysisView
- * @aliasclass Components.DistributedAnalysisView
- * @deprecatedclassinstance L.supermap.components.distributedAnalysis
- * @classdesc 分布式分析组件。
- * @version 9.1.1
- * @param {string} processingUrl - 分布式分析服务地址。
- * @param {Object} options - 参数。
- * @param {string} [options.position='topright'] - 组件在地图中显示的位置( 'topleft'|'topright'|'bottomleft'|'bottomright' )。
- * @param {function} [options.style] - 默认图层样式。返回类型:点样式( maker|circleMaker);线和面样式( L.path )。
- * @param {function} [options.onEachFeature] - 给该元素绑定事件和弹窗。
- * @fires DistributedAnalysisView#analysissucceeded
- * @fires DistributedAnalysisView#analysisfailed
- * @fires DistributedAnalysisView#layersremoved
- * @extends {ComponentsViewBase}
- * @category Components DistributedAnalysis
- * @usage
- */
- var DistributedAnalysisView = ComponentsViewBase.extend({
- initialize: function (processingUrl, options) {
- ComponentsViewBase.prototype.initialize.apply(this, [options]);
- //初始化 ViewModel:
- this.viewModel = new DistributedAnalysisViewModel(processingUrl);
- },
- /**
- * @function DistributedAnalysisView.prototype.onAdd
- * @description 添加控件。
- * @private
- * @override
- */
- onAdd: function (map) {
- this._fillDataToView();
- return ComponentsViewBase.prototype.onAdd.apply(this, [map]);
- },
- /**
- * @function DistributedAnalysisView.prototype._fillDataToView
- * @description 添加数据。
- * @private
- */
- _fillDataToView: function () {
-
- // 获取数据集
- this.viewModel.on('datasetsloaded', (e) => {
- let datasetOptionsArr = e.result.dataset.datasetNames;
- this.datasetSelect.innerHTML = '';
- this._createOptions(this.datasetSelect, datasetOptionsArr);
- this.datasetSelectObj.optionClickEvent(this.datasetSelect, this.datasetSelectName, this.datasetSelectOnchange);
- this.dataHash = e.result.datasetHash;
- });
- this.viewModel.getDatasetsName();
- },
- /**
- * @function DistributedAnalysisView.prototype._initView
- * @description 创建分布式分析组件。
- * @returns {HTMLElement}
- * @private
- * @override
- */
- _initView: function () {
- // 组件 container
- let container = (new CommonContainer({title: Lang.i18n('title_distributedAnalysis')})).getElement();
- container.classList.add('component-analysis');
- container.children[0].style.fontSize = '12px';
- // 组件内容 container
- let componentContentContainer = external_L_default().DomUtil.create('div', 'component-content component-content--scroll component-content--analysis', container);
- // 分析方式下拉框
- let analysisOptionsArr = [{
- 'title': Lang.i18n('text_densityAnalysis'),
- 'dataValue': 'density',
- 'remark': Lang.i18n('text_CalculateTheValuePerUnitArea'),
- 'icon': {
- 'className': 'component-analyst-density-img'
- }
- }];
- let dropDownBox = (new DropDownBox(analysisOptionsArr)).getElement();
- componentContentContainer.appendChild(dropDownBox);
- // 选中的 dropDownItem
- let dropDownTop = dropDownBox.children[0].children[0].children[0];
- // 各分析参数 container
- let analysisTypeContainer = external_L_default().DomUtil.create('div', 'component-analysis__container', componentContentContainer);
- let analysisType = external_L_default().DomUtil.create('div', 'analysistype', analysisTypeContainer);
- let analysisLayer = external_L_default().DomUtil.create('div', 'component-analysis__container__analysisLayer', analysisType);
- // 数据集下拉框
- let datasetSelectControl = external_L_default().DomUtil.create('div', 'component-analysis__selecttool', analysisLayer);
- let datasetOptions = {
- 'optionsArr': [Lang.i18n('text_option_selectDataset')],
- 'labelName': Lang.i18n('text_label_dataset'),
- "optionsClickCb": datasetSelectOnchange.bind(this)
- };
- let datasetSelectObj = new Select(datasetOptions);
- let datasetSelectTool = datasetSelectObj.getElement();
- this.datasetSelectObj = datasetSelectObj;
- datasetSelectControl.appendChild(datasetSelectTool);
- // 选中的 dataset
- let datasetSelectName = datasetSelectTool.children[1].children[0];
- this.datasetSelectName = datasetSelectName;
- // dataset select container
- let datasetSelect = datasetSelectTool.children[1].children[2].children[0].children[0];
- datasetSelect.children[0].style.display = 'none';
- this.datasetSelect = datasetSelect;
- // 分析方法下拉框 & 网格面类型下拉框
- let analyseIDW = external_L_default().DomUtil.create('div', 'component-analysis__idw', analysisLayer);
- let analysisOptions = [{
- 'optionsArr': [Lang.i18n('text_option_simplePointDensityAnalysis'), Lang.i18n('text_option_nuclearDensityAnalysis')],
- 'labelName': Lang.i18n('text_label_analyticalMethod')
- // 'optionsClickCb': analysisMethodSelectOnchange.bind(this)
- }, {
- 'optionsArr': [Lang.i18n('text_option_quadrilateral'), Lang.i18n('text_option_hexagon')],
- 'labelName': Lang.i18n('text_label_meshType')
- }];
- // 分析参数 select control
- let analysisSelectControl = external_L_default().DomUtil.create('div', 'component-analysis__idw__selecttool', analyseIDW);
- for (let i in analysisOptions) {
- let selectTool = (new Select(analysisOptions[i])).getElement();
- analysisSelectControl.appendChild(selectTool);
- }
- // 权重选择下拉框
- let weightFieldsSelectOptions = {
- 'optionsArr': [Lang.i18n('text_option_notSet')],
- 'labelName': Lang.i18n('text_label_weightField')
- };
- let weightFieldsSelectObj = new Select(weightFieldsSelectOptions);
- let weightFieldsSelectTool = weightFieldsSelectObj.getElement();
- analysisSelectControl.appendChild(weightFieldsSelectTool);
- this.weightFieldsSelectObj = weightFieldsSelectObj;
- // 分析方法选中值 & option attr设置
- let analysisMethodSelectName = analysisSelectControl.children[0].children[1].children[0];
- analysisMethodSelectName.setAttribute('data-value', '0');
- let analysisMethodSelect = analysisSelectControl.children[0].children[1].children[2].children[0].children[0];
- let analysisMethodDV = ['0', '1'];
- this._setEleAtribute(analysisMethodDV, 'data-value', analysisMethodSelect.children);
- // 网格面类型选中值 & option attr设置
- let gridTypeSelectName = analysisSelectControl.children[1].children[1].children[0];
- gridTypeSelectName.setAttribute('data-value', '0');
- let gridTypeSelect = analysisSelectControl.children[1].children[1].children[2].children[0].children[0];
- let gridTypeDV = ['0', '1'];
- this._setEleAtribute(gridTypeDV, 'data-value', gridTypeSelect.children);
- // 权重值选中值
- let weightFieldsSelectName = analysisSelectControl.children[2].children[1].children[0];
- let weightFieldsSelect = analysisSelectControl.children[2].children[1].children[2].children[0].children[0];
- // 分析范围 & 网格大小 & 搜索半径 & 面积单位
- // 分析范围
- let inputOptions = [{
- 'spanName': Lang.i18n('text_label_queryRange'),
- 'value': ''
- }];
- for (let i in inputOptions) {
- this._creatInputBox(inputOptions[i], analysisSelectControl)
- }
- let queryRangeInput = analysisSelectControl.children[3].children[1];
- queryRangeInput.setAttribute('placeholder', Lang.i18n('text_label_queryRangeTips'));
- queryRangeInput.title = Lang.i18n('text_label_queryRangeTips');
- // 网格大小
- let gridSizeUnitSelectOptions = {
- 'optionsArr': ['Meter', 'Kilometer', 'Yard', 'Foot', 'Mile']
- };
- let gridSizeOptions = {
- 'labelName': Lang.i18n('text_label_gridSizeInMeters'),
- 'selectOptions': gridSizeUnitSelectOptions
- };
- let gridSizeContainer = this._creatUnitSelectBox(gridSizeOptions, analysisSelectControl);
- let gridSizeInput = gridSizeContainer.children[1].children[0];
- gridSizeInput.value = '1000';
- let gridSizeUnitSelectName = gridSizeContainer.children[1].children[1].children[0].children[0].children[0];
- // 搜索半径
- let searchRadiusUnitSelectOptions = {
- 'optionsArr': ['Meter', 'Kilometer', 'Yard', 'Foot', 'Mile']
- };
- let searchRadiusOptions = {
- 'labelName': Lang.i18n('text_label_searchRadius'),
- 'selectOptions': searchRadiusUnitSelectOptions
- };
- let searchRadiusContainer = this._creatUnitSelectBox(searchRadiusOptions, analysisSelectControl);
- let searchRadiusInput = searchRadiusContainer.children[1].children[0];
- searchRadiusInput.value = '300';
- let searchRadiusSelectName = searchRadiusContainer.children[1].children[1].children[0].children[0].children[0];
- // 面积单位
- let areaUnitSelectOptions = {
- 'labelName': Lang.i18n('text_label_areaUnit'),
- 'optionsArr': ['SquareMile', 'SquareMeter', 'Hectare', 'Acre', 'SquareFoot', 'SquareYard']
- };
- let areaUnitSelectTool = (new Select(areaUnitSelectOptions)).getElement();
- analysisSelectControl.appendChild(areaUnitSelectTool);
- let areaUnitSelectName = areaUnitSelectTool.children[1].children[0];
- // 专题图分段
- let rangeContent = external_L_default().DomUtil.create('div', 'range-content', analysisType);
- let rangeContentOptions = {
- 'optionsArr': [Lang.i18n('text_option_notSet'), Lang.i18n('text_option_equidistantSegmentation'), Lang.i18n('text_option_logarithm'), Lang.i18n('text_option_equalCountingSegment'), Lang.i18n('text_option_squareRootSegmentation')],
- 'labelName': Lang.i18n('text_label_thematicMapSegmentationMode'),
- "optionsClickCb": themeModelSelectOnchange
- };
- rangeContent.appendChild((new Select(rangeContentOptions)).getElement());
- let themeModelSelectName = rangeContent.children[0].children[1].children[0];
- themeModelSelectName.setAttribute('data-value', 'NOTSET');
- let themeModelSelect = rangeContent.children[0].children[1].children[2].children[0].children[0];
- let themeModelDataValue = ['NOTSET', 'EQUALINTERVAL', 'LOGARITHM', 'QUANTILE', 'SQUAREROOT'];
- this._setEleAtribute(themeModelDataValue, 'data-value', themeModelSelect.children);
- let rangeContentParamInput = this._creatInputBox({
- 'spanName': Lang.i18n('text_label_thematicMapSegmentationParameters'),
- 'value': '20'
- }, rangeContent);
- rangeContentParamInput.classList.add('hidden');
- let rangeContentModelSelectTool = (new Select({
- 'optionsArr': [
- Lang.i18n('text_option_greenOrangePurpleGradient'),
- Lang.i18n('text_option_greenOrangeRedGradient'),
- Lang.i18n('text_option_rainbowGradient'),
- Lang.i18n('text_option_spectralGradient'),
- Lang.i18n('text_option_terrainGradient')],
- 'labelName': Lang.i18n('text_label_thematicMapColorGradientMode')
- })).getElement();
- rangeContent.appendChild(rangeContentModelSelectTool);
- rangeContentModelSelectTool.classList.add('hidden');
- let rangeContentModelSelect = rangeContentModelSelectTool.children[1].children[2].children[0].children[0];
- let rangeContentModelSelectName = rangeContentModelSelectTool.children[1].children[0];
- rangeContentModelSelectName.setAttribute('data-value', 'GREENORANGEVIOLET');
- let rangeContentModelDV = ['GREENORANGEVIOLET', 'GREENORANGERED', 'RAINBOW', 'SPECTRUM', 'TERRAIN'];
- this._setEleAtribute(rangeContentModelDV, 'data-value', rangeContentModelSelect.children);
- // 专题图分段模式下拉框 onchange 事件
- function themeModelSelectOnchange(option) {
- if (option.getAttribute('data-value') !== 'NOTSET') {
- rangeContentParamInput.classList.remove('hidden');
- rangeContentModelSelectTool.classList.remove('hidden');
- } else {
- rangeContentParamInput.classList.add('hidden');
- rangeContentModelSelectTool.classList.add('hidden');
- }
- }
- // 结果图层
- let resultLayerContainer = external_L_default().DomUtil.create('div', '', analysisType);
- let resultLayerSpan = external_L_default().DomUtil.create('span', '', resultLayerContainer);
- resultLayerSpan.innerHTML = Lang.i18n('text_label_resultLayerName');
- let resultLayerInput = external_L_default().DomUtil.create('input', 'component-distributeanalysis__input', resultLayerContainer);
- // 分析 & 分析中 & 取消 按钮
- let runBtnContainer = external_L_default().DomUtil.create('div', 'component-analysis__container__analysisbtn', analysisTypeContainer);
- let runBtn = external_L_default().DomUtil.create('div', 'component-analysis__analysisbtn', runBtnContainer);
- let analysisBtn = external_L_default().DomUtil.create('button', 'component-analysis__analysisbtn--analysis', runBtn);
- analysisBtn.innerHTML = Lang.i18n('btn_analyze');
- let analysingContainer = external_L_default().DomUtil.create('div', 'component-analysis__analysisbtn--analysing-container hidden', runBtn);
- let analysisingBtn = external_L_default().DomUtil.create('div', 'component-analysis__analysisbtn--analysising', analysingContainer);
- analysisingBtn.style.width = '200px';
- let svgContainer = external_L_default().DomUtil.create('div', 'component-analysis__svg-container', analysisingBtn);
- svgContainer.innerHTML = `<svg class="component-analysis__svg-rotate" width="16px" height="16px" version="1.1" xmlns="http://www.w3.org/2000/svg">
- <path id="ring" fill="#FFF" transform="translate(8,8)" d="M 0 0 v -8 A 8 8 0 1 1 -8.00 0 z"></path>
- <circle cx="8" cy="8" r="6" fill="#38ADF5"></circle>
- <rect class="svg-top" x="8" y="0" rx="2" ry="2" width="2" height="2" style="fill: rgb(255, 255, 255); stroke-width: 0;"></rect>
- <rect class="svg-left" x="0" y="8" rx="2" ry="2" width="2" height="2" style="fill: rgb(255, 255, 255); stroke-width: 0;"></rect>
- </svg>`;
- external_L_default().DomUtil.create('span', '', analysisingBtn).innerHTML = Lang.i18n('btn_analyzing');
- // 删除按钮
- let deleteLayersBtn = external_L_default().DomUtil.create('button', 'component-analysis__analysisbtn--analysis component-analysis__analysisbtn--deletelayers', runBtn);
- deleteLayersBtn.id = 'deleteLayersBtn';
- deleteLayersBtn.innerHTML = Lang.i18n('btn_emptyTheAnalysisLayer');
- // 交互
- // 弹框
- this.messageBox = new MessageBox();
- // 数据集下拉框 onchange 事件
- this.datasetSelectOnchange = datasetSelectOnchange.bind(this);
- function datasetSelectOnchange(option) {
- this.messageBox.closeView();
- if (this.dataHash) {
- weightFieldsSelect.innerHTML = '';
- // 获取当前选中数据集类型
- let datasetUrl = this.dataHash[option.title];
- // 判断当前选中数据集是否支持该选中分析类,并填充分析权重字段
- let _me = this;
- this.viewModel.on('datasetinfoloaded', function (e) {
- weightFieldsSelectName.title = Lang.i18n('text_option_notSet');
- weightFieldsSelectName.innerHTML = Lang.i18n('text_option_notSet');
- weightFieldsSelect.innerHTML = '';
- let analyseType = dropDownTop.getAttribute('data-value');
- let type = e.result.type;
- let fields = e.result.fields;
- if (analyseType === 'density') {
- if (type === 'REGION' || type === 'LINE') {
- _me.messageBox.showView(Lang.i18n('msg_datasetOrMethodUnsupport'), "failure");
- } else {
- _me.messageBox.closeView();
- _me._createOptions(weightFieldsSelect, fields);
- _me.weightFieldsSelectObj.optionClickEvent(weightFieldsSelect, weightFieldsSelectName);
- }
- }
- });
- this.viewModel.getDatasetInfo(datasetUrl);
- }
- }
- // 分析按钮点击事件
- analysisBtn.onclick = () => {
- this.messageBox.closeView();
- let params = getAnalysisParam();
- if (datasetSelectName.title === Lang.i18n('text_option_selectDataset')) {
- this.messageBox.showView(Lang.i18n('msg_selectDataset'), "failure");
- } else if ( weightFieldsSelectName.title === Lang.i18n('text_option_notSet')) {
- this.messageBox.showView(Lang.i18n('msg_setTheWeightField'), "failure");
- } else {
- this.messageBox.closeView();
- analysingContainer.style.display = 'block';
- analysisBtn.style.display = 'none';
- this.viewModel.on('layerloaded', (e) => {
- analysingContainer.style.display = 'none';
- analysisBtn.style.display = 'block';
- /**
- * @event DistributedAnalysisView#analysissucceeded
- * @description 分析完成后触发。
- * @property {L.GeoJSON} layer - 结果图层。
- * @property {string} name - 结果图层名称。
- */
- this._event.fire('analysissucceeded', {'layer': e.layer, 'name': e.name})
- });
-
- this.viewModel.on('analysisfailed', (e) => {
- this.messageBox.showView(Lang.i18n('msg_theFieldNotSupportAnalysis'), "failure");
- analysingContainer.style.display = 'none';
- analysisBtn.style.display = 'block';
- /**
- * @event DistributedAnalysisView#analysisfailed
- * @description 分析失败后触发。
- * @property {string} error - 服务器返回的错误。
- */
- this._event.fire('analysisfailed', {'error': e.error})
- });
- this.viewModel.analysis(params, this.map);
- }
- };
- // 删除按钮点击事件
- deleteLayersBtn.onclick = () => {
- /**
- * @event DistributedAnalysisView#layersremoved
- * @description 结果图层删除后触发。
- * @property {Array.<L.GeoJSON>} layers - 被删除的结果图层。
- */
- this.viewModel.on('layersremoved', (e) => {
- this._event.fire('layersremoved', { 'layers': e.layers });
- });
- this.viewModel.clearLayers();
- };
- // 获取分析参数
- function getAnalysisParam() {
- let analysisType = dropDownTop.getAttribute('data-value');
- let analysisMethod = analysisMethodSelectName.getAttribute('data-value');
- let gridType = gridTypeSelectName.getAttribute('data-value');
- let queryRange = queryRangeInput.value;
- let gridSizeUnit = gridSizeUnitSelectName.title;
- let searchRadiusUnit = searchRadiusSelectName.title;
- let areaUnit = areaUnitSelectName.title;
- let colorGradientType = rangeContentModelSelectName.getAttribute('data-value');
- let themeModel = themeModelSelectName.getAttribute('data-value');
- let date = new Date();
- let resultLayerName = resultLayerInput.value || date.getTime();
- let mappingParameter;
- if (themeModel === 'NOTSET') {
- mappingParameter = '';
- } else {
- mappingParameter = {
- 'rangeMode': themeModel,
- 'rangeCount': rangeContentParamInput.value,
- 'colorGradientType': colorGradientType
- }
- }
- let analysisParam;
- if (analysisType === 'density') {
- analysisParam = new KernelDensityJobParameter({
- 'datasetName': datasetSelectName.title,
- 'method': analysisMethod,
- 'meshType': gridType,
- 'resolution': gridSizeInput.value,
- 'fields': weightFieldsSelectName.title,
- 'radius': searchRadiusInput.value,
- 'meshSizeUnit': gridSizeUnit,
- 'radiusUnit': searchRadiusUnit,
- 'areaUnit': areaUnit,
- 'query': queryRange,
- 'mappingParameters': new MappingParameters({
- 'rangeMode': mappingParameter.rangeMode,
- 'rangeCount': mappingParameter.rangeCount,
- 'colorGradientType': mappingParameter.colorGradientType
- })
- })
- }
- let params = {
- 'analysisParam': analysisParam,
- 'resultLayerName': resultLayerName
- };
- return params;
- }
- //阻止 map 默认事件
- this._preventMapEvent(container, this.map);
- return container;
- },
- /**
- * @function DistributedAnalysisView.prototype._createOptions
- * @description 创建下拉框。
- * @private
- */
- _createOptions(container, optionsArr) {
- for (let i in optionsArr) {
- let option = document.createElement('div');
- option.className = 'component-selecttool__option';
- option.title = optionsArr[i];
- option.innerHTML = optionsArr[i];
- option.setAttribute('data-value', optionsArr[i]);
- container.appendChild(option);
- }
- },
- /**
- * @function DistributedAnalysisView.prototype._creatInputBox
- * @description 创建输入框。
- * @private
- */
- _creatInputBox(inputOptions, parentEle) {
- let div = external_L_default().DomUtil.create('div', '', parentEle);
- let span = external_L_default().DomUtil.create('span', '', div);
- span.innerHTML = inputOptions.spanName;
- let input = external_L_default().DomUtil.create('input', '', div);
- input.value = inputOptions.value;
- input.className = 'component-distributeanalysis__input';
- return div;
- },
- /**
- * @function DistributedAnalysisView.prototype._creatUnitSelectBox
- * @description 创建选择框。
- * @private
- */
- _creatUnitSelectBox(options, parentEle) {
- let unitSelectBoxContainer = external_L_default().DomUtil.create('div', 'component-clientcomputation__buffer--radius', parentEle);
- let unitSelectSpan = external_L_default().DomUtil.create('span', '', unitSelectBoxContainer);
- unitSelectSpan.innerHTML = options.labelName;
- let unitSelectInputContainer = external_L_default().DomUtil.create('div', '', unitSelectBoxContainer);
- external_L_default().DomUtil.create('input', 'buffer-radius-input', unitSelectInputContainer);
- let unitSelectUnitContainer = external_L_default().DomUtil.create('div', 'component-clientcomputation__buffer--unit', unitSelectInputContainer);
- let unitSelectOptions = options.selectOptions;
- let unitSelectTool = (new Select(unitSelectOptions)).getElement();
- unitSelectUnitContainer.appendChild(unitSelectTool);
- return unitSelectBoxContainer;
- },
- /**
- * @function DistributedAnalysisView.prototype._setEleAtribute
- * @description 设置元素的属性名和属性值。
- * @private
- */
- _setEleAtribute(daraValueArr, attributeName, eleArr) {
- for (let i = 0; i < eleArr.length; i++) {
- eleArr[i].setAttribute(attributeName, daraValueArr[i])
- }
- }
- });
- var distributedAnalysisView = function (options) {
- return new DistributedAnalysisView(options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/components/dataservicequery/DataServiceQueryViewModel.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- /**
- * @class DataServiceQueryViewModel
- * @aliasclass Components.DataServiceQueryViewModel
- * @deprecatedclassinstance L.supermap.components.dataServiceQueryViewModel
- * @classdesc 数据服务查询组件功能类。
- * @version 9.1.1
- * @category Components DataServiceQuery
- * @param {string} dataserviceUrl - 数据服务地址。
- * @fires DataServiceQueryViewModel#getfeaturessucceeded
- * @fires DataServiceQueryViewModel#getfeaturesfailed
- * @extends {L.Evented}
- * @usage
- */
- class DataServiceQueryViewModel extends (external_L_default()).Evented {
- initialize(dataserviceUrl) {
- this.dataserviceUrl = dataserviceUrl;
- this.resultLayers = [];
- }
- /**
- * @function DataServiceQueryViewModel.prototype.getFeatures
- * @description 获取 features。
- * @param {(GetFeaturesByIDsParameters|GetFeaturesByBufferParameters|GetFeaturesByBoundsParameters|GetFeaturesBySQLParameters|GetFeaturesByGeometryParameters)} queryParam - 查询参数。
- * @param {L.Map} map - Leaflet Map 对象。
- */
- getFeatures(queryParam, map) {
- let dataserviceUrl = this.dataserviceUrl;
- let me = this;
- let featureService = FeatureService_featureService(dataserviceUrl);
- if (queryParam instanceof GetFeaturesByIDsParameters) {
- featureService.getFeaturesByIDs(queryParam, function (serviceResult) {
- me._getQureyResult(serviceResult, map);
- });
- } else if (queryParam instanceof GetFeaturesBySQLParameters) {
- featureService.getFeaturesBySQL(queryParam, function (serviceResult) {
- me._getQureyResult(serviceResult, map);
- });
- } else if (queryParam instanceof GetFeaturesByBoundsParameters) {
- featureService.getFeaturesByBounds(queryParam, function (serviceResult) {
- me._getQureyResult(serviceResult, map);
- });
- } else if (queryParam instanceof GetFeaturesByBufferParameters) {
- featureService.getFeaturesByBuffer(queryParam, function (serviceResult) {
- me._getQureyResult(serviceResult, map);
- });
- } else if (queryParam instanceof GetFeaturesByGeometryParameters) {
- featureService.getFeaturesByGeometry(queryParam, function (serviceResult) {
- me._getQureyResult(serviceResult, map);
- });
- }
- }
- /**
- * @function DataServiceQueryViewModel.prototype._getQureyResult
- * @description 获取查询结果。
- * @private
- * @param {Object} serviceResult - 返回查询结果。
- * @param {L.Map} map - Leaflet Map 对象。
- */
- _getQureyResult(serviceResult, map) {
- if (serviceResult.error) {
- /**
- * @event DataServiceQueryViewModel#getfeaturesfailed
- * @description features 获取失败时触发。
- * @property {string} error - 服务器返回的错误。
- */
- this.fire('getfeaturesfailed', { 'error': serviceResult.error });
- return;
- }
- let resultLayer = external_L_default().geoJSON(serviceResult.result.features, {
- onEachFeature: function (feature, layer) {
- layer.bindPopup("ID: " + feature.properties.SMID);
- },
- pointToLayer: function (geoJsonPoint, latLng) {
- return external_L_default().circleMarker(latLng, { radius: 6})
- }
- }).addTo(map);
- this.resultLayers.push(resultLayer);
- /**
- * @event DataServiceQueryViewModel#getfeaturessucceeded
- * @description features 获取成功时触发。
- * @property {Object} result - 服务器返回的结果。
- */
- this.fire('getfeaturessucceeded', { 'result': serviceResult.result.features })
- }
- /**
- * @function DataServiceQueryViewModel.prototype.clearLayers
- * @description 清除所有结果图层。
- */
- clearLayers() {
- for (let i in this.resultLayers) {
- this.resultLayers[i].remove();
- }
- this.resultLayers = [];
- }
- }
- var dataServiceQueryViewModel = function (dataserviceUrl) {
- return new dataServiceQueryViewModel(dataserviceUrl);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/components/dataservicequery/DataServiceQueryView.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
-
-
-
-
-
-
-
-
-
-
-
-
- /**
- * @class DataServiceQueryView
- * @aliasclass Components.DataServiceQueryView
- * @deprecatedclassinstance L.supermap.components.dataServiceQuery
- * @classdesc 数据服务查询组件。
- * @version 9.1.1
- * @param {string} dataServiceUrl - 数据服务地址。
- * @param {(Array.<string>|string)} dataSetNames - 配置查询方式和查询的数据集数组。格式:" 数据源名:数据集名 ",例:"World: Countries"。
- * @param {Object} options - 参数。
- * @param {(Array.<GetFeatureMode>|GetFeatureMode)} [options.getFeatureMode] - 查询方式。
- * @param {string} [options.position='topright'] - 组件在地图中显示的位置( 'topleft'|'topright'|'bottomleft'|'bottomright' )。
- * @param {function} [options.style] - 默认图层样式。返回类型:点样式( maker|circleMaker);线和面样式( L.path )。
- * @param {function} [options.onEachFeature] - 给该元素绑定事件和弹窗。
- * @fires DataServiceQueryView#getfeaturessucceeded
- * @fires DataServiceQueryView#getfeaturesfailed
- * @category Components DataServiceQuery
- * @extends {ComponentsViewBase}
- * @usage
- */
- var DataServiceQueryView = ComponentsViewBase.extend({
- initialize: function (dataServiceUrl, dataSetNames, options) {
- ComponentsViewBase.prototype.initialize.apply(this, [options]);
- this.dataServiceUrl = dataServiceUrl;
- if (!dataSetNames || dataSetNames.length === 0) {
- throw new Error('Please configure the dataset of the query!')
- }
- if (dataSetNames instanceof Array) {
- this.dataSetNames = dataSetNames;
- } else {
- this.dataSetNames = dataSetNames.split(" ");
- }
- },
- /**
- * @function DataServiceQueryView.prototype.onAdd
- * @description 添加控件。
- * @private
- * @override
- */
- onAdd: function (map) {
- return ComponentsViewBase.prototype.onAdd.apply(this, [map]);
- },
- /**
- * @function DataServiceQueryView.prototype.onRemove
- * @description 移除控件。
- * @private
- */
- onRemove: function () {
- this.map.off('pm:create');
- },
- /**
- * @function DataServiceQueryView.prototype.setDataSetNames
- * @description 设置查询的数据集名称。
- * @param {(Array.<string>|string)} dataSetNames - 配置查询方式和查询的数据集数组。格式:" 数据源名:数据集名 ",例:"World: Countries";
- */
- setDataSetNames(dataSetNames) {
- if (dataSetNames instanceof Array) {
- this.dataSetNames = dataSetNames;
- } else {
- this.dataSetNames = dataSetNames.split(" ");
- }
- },
- /**
- * @function DataServiceQueryView.prototype.setGetFeatureMode
- * @description 设置查询方式。
- * @param {(Array.<GetFeatureMode>|GetFeatureMode)} getFeatureMode - 查询方式。
- */
- setGetFeatureMode(getFeatureMode) {
- this.getFeatureMode = getFeatureMode;
- this._getFeatureModeOnchange(this.getFeatureMode);
- },
- /**
- * @function DataServiceQueryView.prototype.setDataServiceUrl
- * @description 设置查询的数据服务地址。
- * @param {string} dataServiceUrl - 数据服务地址。
- */
- setDataServiceUrl(dataServiceUrl) {
- this.dataServiceUrl = dataServiceUrl;
- this.viewModel = new DataServiceQueryViewModel(this.dataServiceUrl);
- },
- /**
- * @function DataServiceQueryView.prototype._getFeatureModeOnchange
- * @private
- * @description 改变查询方式时改变 UI。
- * @param {string} getFeatureMode - 查询方式。
- */
- _getFeatureModeOnchange(getFeatureMode) {
- let queryModelOptionsArr;
- if (!getFeatureMode || JSON.stringify(getFeatureMode) == '{}') {
- queryModelOptionsArr = ['ID', 'SQL', 'BOUNDS', 'BUFFER', 'SPATIAL'];
- } else {
- queryModelOptionsArr = getFeatureMode;
- }
- let queryModelControl = document.getElementById('queryModelControl');
- queryModelControl.innerHTML = '';
- this.creatQueryModeSelect(queryModelOptionsArr, queryModelControl)
- },
- /**
- * @function DataServiceQueryView.prototype._initView
- * @description 创建数据服务查询组件。
- * @returns {HTMLElement}
- * @private
- */
- _initView: function () {
- // 初始化 ViewModel:
- this.viewModel = new DataServiceQueryViewModel(this.dataServiceUrl);
- this.messageBox = new MessageBox();
- // 组件 container
- let container = (new CommonContainer({title: Lang.i18n('title_dataServiceQuery')})).getElement();
- container.classList.add('component-servicequery__container');
- container.children[0].classList.add('component-servicequery__title');
- let componentContentContainer = container.children[1];
- componentContentContainer.classList.add('component-content--scroll');
- componentContentContainer.classList.add('data-services');
- // 组件内容 container
- let analyusisTypeContainer = external_L_default().DomUtil.create('div', 'component-analysis__container', componentContentContainer);
- let analysisType = external_L_default().DomUtil.create('div', 'component-servicequery__analysistype', analyusisTypeContainer);
- let analysisLayer = external_L_default().DomUtil.create('div', 'component-analysis__container__analysisLayer', analysisType);
- let queryModelOptionsArr, getFeatureModeArr = this.options.getFeatureMode;
- // 获取查询模式
- if (!getFeatureModeArr || JSON.stringify(getFeatureModeArr) == '{}') {
- queryModelOptionsArr = ['ID', 'SQL', 'BOUNDS', 'BUFFER', 'SPATIAL'];
- } else {
- queryModelOptionsArr = getFeatureModeArr;
- }
- // 查询模式
- let queryModelContainer = external_L_default().DomUtil.create('div', '', analysisLayer);
- queryModelContainer.id = 'queryModelContainer';
- let queryModelControl = external_L_default().DomUtil.create('div', 'component-analysis__selecttool', queryModelContainer);
- queryModelControl.id = 'queryModelControl';
- this.creatQueryModeSelect = creatQueryModeSelect.bind(this);
- this.queryModeltOnchange = queryModeltOnchange.bind(this);
- this.creatQueryModeSelect(queryModelOptionsArr, queryModelControl);
- // 要素 ID 数组
- let featuresIdArrContainer = external_L_default().DomUtil.create('div', 'component-analysis__container component-textarea--dataservice__container', analysisLayer);
- let textareaSpan = external_L_default().DomUtil.create('span', 'textarea-name', featuresIdArrContainer);
- textareaSpan.innerHTML = Lang.i18n('text_label_IDArrayOfFeatures');
- let textareaControl = external_L_default().DomUtil.create('div', 'component-textarea component-textarea--dataservice', featuresIdArrContainer);
- textareaControl.id = 'getfeaturesIdArr';
- let scrollarea = external_L_default().DomUtil.create('div', 'scrollarea', textareaControl);
- let scrollareaContent = external_L_default().DomUtil.create('div', 'component-scrollarea-content', scrollarea);
- scrollareaContent.setAttribute('tabindex', '1');
- let getValueTextArea = external_L_default().DomUtil.create('textarea', 'component-textarea__content', scrollareaContent);
- getValueTextArea.value = '[1,2,3]';
- getValueTextArea.id = 'getValueTextArea';
- // SQL 最多可返回的要素数量
- let maxFeaturesContainer = external_L_default().DomUtil.create('div', 'component-servicequery__maxfeatures-container hidden', analysisLayer);
- let maxFeaturesOtions = {
- 'spanName': Lang.i18n('text_label_maxFeatures'),
- 'value': '1000'
- };
- let maxFeaturesInputBox = this._creatInputBox(maxFeaturesOtions, maxFeaturesContainer);
- let maxFeaturesInput = maxFeaturesInputBox.children[1];
- maxFeaturesInput.classList.add('max-features-input');
- // Buffer 缓冲区距离
- let bufferDistanceContainer = external_L_default().DomUtil.create('div', 'component-servicequery__distance-container hidden', analysisLayer);
- let bufferDistanceOtions = {
- 'spanName': Lang.i18n('text_label_bufferDistance'),
- 'value': '10'
- };
- let bufferDistanceInputBox = this._creatInputBox(bufferDistanceOtions, bufferDistanceContainer);
- let bufferDistanceInput = bufferDistanceInputBox.children[1];
- // Bounds 查询范围;
- let queryRangeContainer = external_L_default().DomUtil.create('div', 'component-analysis__container component-textarea--dataservice__container hidden', analysisLayer);
- let queryRangetextareaSpan = external_L_default().DomUtil.create('span', 'textarea-name', queryRangeContainer);
- let queryRangeMainContent = external_L_default().DomUtil.create('div', '', queryRangeContainer);
- let queryRangeIconContainer = external_L_default().DomUtil.create('div', 'component-servicequery__rangeicon-container', queryRangeMainContent);
- queryRangetextareaSpan.innerHTML = Lang.i18n('text_label_queryRange1');
- let queryRangeRecIcon = external_L_default().DomUtil.create('div', 'component-servicequery__rangeicon supermapol-icons-polygon-layer bounds', queryRangeIconContainer);
- let queryRangeLineIcon = external_L_default().DomUtil.create('div', 'component-servicequery__rangeicon supermapol-icons-line-layer hidden', queryRangeIconContainer);
- let queryRangePointIcon = external_L_default().DomUtil.create('div', 'component-servicequery__rangeicon supermapol-icons-point-layer hidden', queryRangeIconContainer);
- let queryRangetextareaControl = external_L_default().DomUtil.create('div', 'component-textarea component-textarea--rangequery', queryRangeMainContent);
- queryRangetextareaControl.id = 'getfeaturesIdArr';
- let queryRangescrollarea = external_L_default().DomUtil.create('div', '', queryRangetextareaControl);
- let queryRangescrollareaContent = external_L_default().DomUtil.create('div', 'component-scrollarea-content', queryRangescrollarea);
- queryRangescrollareaContent.setAttribute('tabindex', '1');
- let queryRangeTextArea = external_L_default().DomUtil.create('textarea', 'component-textarea__content component-textarea--rangequery__content', queryRangescrollareaContent);
- queryRangeTextArea.value = '{"leftBottom":{"x":-5,"y":-5},"rightTop":{"x":5,"y":5}}';
- // geometry 空间查询模式
- let spatialQueryModeContainer = external_L_default().DomUtil.create('div', 'component-servicequery__spatialquerymode-container hidden', analysisLayer);
- let spatialQueryModeOptions = {
- 'optionsArr': ['CONTAIN', 'CROSS', 'DISJOINT', 'IDENTITY', 'INTERSECT', 'NONE', 'OVERLAP', 'TOUCH', 'WITHIN'],
- 'labelName': Lang.i18n('text_label_spatialQueryMode')
- };
- let spatialQueryModeControl = external_L_default().DomUtil.create('div', 'component-analysis__selecttool', spatialQueryModeContainer);
- let spatialQueryModeSelectTool = (new Select(spatialQueryModeOptions)).getElement();
- spatialQueryModeSelectTool.children[1].classList.add('dataservice-select');
- spatialQueryModeControl.appendChild(spatialQueryModeSelectTool);
- let spatialQueryModeSelectName = spatialQueryModeSelectTool.children[1].children[0];
- spatialQueryModeSelectName.id = 'spatialQueryModeSelectName';
- let spatialQueryModeSelectContent = spatialQueryModeSelectTool.children[1].children[2];
- spatialQueryModeSelectContent.classList.add('component-servicequery__spatialquerymode__selectcontent');
- // 分析按钮
- let runBtnContainer = external_L_default().DomUtil.create('div', 'component-analysis__container__analysisbtn', analysisLayer);
- let runBtn = external_L_default().DomUtil.create('div', 'component-analysis__analysisbtn', runBtnContainer);
- let analysisBtn = external_L_default().DomUtil.create('button', 'component-analysis__analysisbtn--analysis', runBtn);
- analysisBtn.innerHTML = Lang.i18n('btn_query');
- let analysingContainer = external_L_default().DomUtil.create('div', 'component-analysis__analysisbtn--analysing-container hidden', runBtn);
- let analysisingBtn = external_L_default().DomUtil.create('div', 'component-analysis__analysisbtn--analysising component-servicequery__querybtn--querying', analysingContainer);
- let svgContainer = external_L_default().DomUtil.create('div', 'component-analysis__svg-container', analysisingBtn);
- svgContainer.innerHTML = `<svg class="component-analysis__svg-rotate" width="16px" height="16px" version="1.1" xmlns="http://www.w3.org/2000/svg">
- <path id="ring" fill="#FFF" transform="translate(8,8)" d="M 0 0 v -8 A 8 8 0 1 1 -8.00 0 z"></path>
- <circle cx="8" cy="8" r="6" fill="#38ADF5"></circle>
- <rect class="svg-top" x="8" y="0" rx="2" ry="2" width="2" height="2" style="fill: rgb(255, 255, 255); stroke-width: 0;"></rect>
- <rect class="svg-left" x="0" y="8" rx="2" ry="2" width="2" height="2" style="fill: rgb(255, 255, 255); stroke-width: 0;"></rect>
- </svg>`;
- external_L_default().DomUtil.create('span', '', analysisingBtn).innerHTML = Lang.i18n('btn_querying');
- // 删除按钮
- let deleteLayersBtn = external_L_default().DomUtil.create('button', 'component-analysis__analysisbtn--analysis component-analysis__analysisbtn--deletelayers', runBtn);
- deleteLayersBtn.innerHTML = Lang.i18n('btn_emptyTheRresultLayer');
- // 设置当前显示参数
- queryModeltOnchange(queryModelOptionsArr[0]);
- // 分析按钮点击事件
- let me = this;
- analysisBtn.onclick = () => {
- this.messageBox.closeView();
- analysingContainer.style.display = 'block';
- analysisBtn.style.display = 'none';
- let queryParams = getQueryParams();
- this.viewModel.on('getfeaturessucceeded', (e) => {
- analysingContainer.style.display = 'none';
- analysisBtn.style.display = 'block';
- if (e.result.features.length === 0) {
- this.messageBox.showView(Lang.i18n('msg_dataReturnedIsEmpty'), "success");
- }
- /**
- * @event DataServiceQueryView#getfeaturessucceeded
- * @description features 获取成功时触发。
- * @property {Object} result - 服务器返回的结果。
- */
- this._event.fire('getfeaturessucceeded', {'result': e.result})
- });
- this.viewModel.on('getfeaturesfailed', (e) => {
- analysingContainer.style.display = 'none';
- analysisBtn.style.display = 'block';
- this.messageBox.showView(e.error.errorMsg, "failure");
- /**
- * @event DataServiceQueryView#getfeaturesfailed
- * @description features 获取失败时触发。
- * @property {string} error - 服务器返回的错误。
- */
- this._event.fire('getfeaturesfailed', {'error': e.error})
- });
- this.viewModel.getFeatures(queryParams, this.map);
- };
- let bounds, resultLayer;
- // 矩形 & 多边形绘制
- queryRangeRecIcon.onclick = (e) => {
- let queryModelSelectName = document.getElementById('queryModelSelectName');
- let getFeatureMode = queryModelSelectName.title;
- if (resultLayer) {
- resultLayer.remove();
- }
- // 矩形
- if (getFeatureMode === 'BOUNDS') {
- this.map.pm.enableDraw('Rectangle');
- // 多边形
- } else {
- this.map.pm.enableDraw('Poly');
- }
- e.stopPropagation();
- e.preventDefault();
- };
- // 线绘制
- queryRangeLineIcon.onclick = (e) => {
- if (resultLayer) {
- resultLayer.remove();
- }
- this.map.pm.enableDraw('Line');
- e.stopPropagation();
- e.preventDefault();
- };
- // 点绘制
- queryRangePointIcon.onclick = (e) => {
- if (resultLayer) {
- resultLayer.remove();
- }
- this.map.pm.enableDraw('Marker');
- e.stopPropagation();
- e.preventDefault();
- };
- this.map.on('pm:create', (e) => {
- if (e.shape === 'Rectangle') {
- resultLayer = e.layer;
- let boundsT = resultLayer.getBounds();
- bounds = external_L_default().bounds([boundsT._southWest.lng, boundsT._southWest.lat], [boundsT._northEast.lng, boundsT._northEast.lat]);
- let geo = {
- 'leftBottom': {'x': boundsT._southWest.lng, 'y': boundsT._southWest.lat},
- 'rightTop': {'x': boundsT._northEast.lng, 'y': boundsT._northEast.lat}
- };
- queryRangeTextArea.value = JSON.stringify(geo);
- }
- if (e.shape === 'Marker') {
- resultLayer = e.layer;
- queryRangeTextArea.value = JSON.stringify(e.layer.toGeoJSON());
- this.map.pm.disableDraw("Marker");
- }
- if (e.shape === 'Line') {
- resultLayer = e.layer;
- queryRangeTextArea.value = JSON.stringify(e.layer.toGeoJSON());
- }
- if (e.shape === 'Polygon') {
- resultLayer = e.layer;
- queryRangeTextArea.value = JSON.stringify(e.layer.toGeoJSON());
- }
- });
- // 删除按钮点击事件
- deleteLayersBtn.onclick = () => {
- this.viewModel.clearLayers();
- };
- function creatQueryModeSelect(queryModelOptionsArr, queryModelControl) {
- // 查询模式
- let queryModelSelectName;
- if (queryModelOptionsArr instanceof Array && queryModelOptionsArr.length > 1) {
- let queryModelOptions = {
- 'optionsArr': queryModelOptionsArr,
- 'labelName': Lang.i18n('text_label_queryMode'),
- 'optionsClickCb': this.queryModeltOnchange
- };
- let queryModelSelectTool = (new Select(queryModelOptions)).getElement();
- queryModelControl.appendChild(queryModelSelectTool);
- queryModelSelectName = queryModelSelectTool.children[1].children[0];
- queryModelSelectTool.children[1].classList.add('dataservice-select');
- let queryModelSelect = queryModelSelectTool.children[1];
- queryModelSelect.classList.add('dataservice-select');
- queryModelSelect.classList.add('querymodel-select');
- } else {
- let span = external_L_default().DomUtil.create('span', '', queryModelContainer);
- span.innerHTML = Lang.i18n('text_label_queryMode');
- queryModelSelectName = external_L_default().DomUtil.create('div', 'component-servicequery__querymode-selectname', queryModelContainer);
- let text = external_L_default().DomUtil.create('span', '', queryModelSelectName);
- if (queryModelOptionsArr instanceof Array) {
- text.innerHTML = queryModelOptionsArr[0];
- } else {
- text.innerHTML = queryModelOptionsArr;
- }
- queryModelSelectName.title = text.innerHTML;
- this.queryModeltOnchange(queryModelSelectName);
- }
- queryModelSelectName.id = 'queryModelSelectName';
- return queryModelSelectName;
- }
- // 查询模式下拉框 onchange 事件
- function queryModeltOnchange(option) {
- // 获取当前选中查询模式
- let queryModelSelectName;
- if (option.title) {
- queryModelSelectName = option.title;
- } else {
- queryModelSelectName = option;
- }
- // 控制部分查询参数元素隐藏和显示
- maxFeaturesContainer.classList.add('hidden');
- queryRangeContainer.classList.add('hidden');
- bufferDistanceContainer.classList.add('hidden');
- queryRangeLineIcon.classList.add('hidden');
- queryRangePointIcon.classList.add('hidden');
- queryRangeRecIcon.classList.remove('bounds');
- spatialQueryModeContainer.classList.add('hidden');
- textareaSpan.innerHTML = Lang.i18n('text_label_featureFilter');
- getValueTextArea.value = 'SMID<10';
- if (queryModelSelectName === 'BUFFER' || queryModelSelectName === 'SPATIAL') {
- queryRangeContainer.classList.remove('hidden');
- queryRangetextareaSpan.innerHTML = Lang.i18n('text_label_geometricObject');
- queryRangeTextArea.value = '{"type":"Feature","properties":{},"geometry":{"type":"Point","coordinates":[84.90234375,40.25390625]}}';
- queryRangeLineIcon.classList.remove('hidden');
- queryRangePointIcon.classList.remove('hidden');
- }
- switch (queryModelSelectName) {
- case 'ID':
- textareaSpan.innerHTML = Lang.i18n('text_label_IDArrayOfFeatures');
- getValueTextArea.value = '[1,2,3]';
- break;
- case 'SQL':
- maxFeaturesContainer.classList.remove('hidden');
- break;
- case 'BOUNDS':
- queryRangeContainer.classList.remove('hidden');
- queryRangetextareaSpan.innerHTML = Lang.i18n('text_label_queryRange');
- queryRangeTextArea.value = '{"leftBottom":{"x":-5,"y":-5},"rightTop":{"x":5,"y":5}}';
- queryRangeRecIcon.classList.add('bounds');
- break;
- case 'BUFFER':
- bufferDistanceContainer.classList.remove('hidden');
- break;
- case 'SPATIAL':
- spatialQueryModeContainer.classList.remove('hidden');
- break;
- }
- }
- // 获取查询参数
- function getQueryParams() {
- // 数据集数组
- let datasetArr = me.dataSetNames;
- let queryModelSelectName = document.getElementById('queryModelSelectName');
- let getFeatureMode = queryModelSelectName.title;
- // 过滤条件
- let attributeFilter = getValueTextArea.value;
- let queryParam;
- if (getFeatureMode === 'ID') {
- let value = getValueTextArea.value;
- let ids = value.substring(1, value.length - 1).split(',');
- queryParam = new GetFeaturesByIDsParameters({
- IDs: ids,
- datasetNames: datasetArr
- });
- } else if (getFeatureMode === 'SQL') {
- let maxFeatures = maxFeaturesInput.value;
- queryParam = new GetFeaturesBySQLParameters({
- queryParameter: {
- attributeFilter: attributeFilter
- },
- datasetNames: datasetArr,
- maxFeatures: maxFeatures
- });
- } else if (getFeatureMode === 'BOUNDS') {
- if (!bounds) {
- let value = JSON.parse(queryRangeTextArea.value);
- bounds = external_L_default().bounds([value.leftBottom.x, value.leftBottom.y], [value.rightTop.x, value.rightTop.y])
- }
- queryParam = new GetFeaturesByBoundsParameters({
- attributeFilter: attributeFilter,
- datasetNames: datasetArr,
- bounds: bounds
- });
- } else if (getFeatureMode === 'BUFFER') {
- let bufferDistance = bufferDistanceInput.value;
- let defaultGeometryValue = JSON.parse(queryRangeTextArea.value);
- let geometryLayer = resultLayer || defaultGeometryValue;
- queryParam = new GetFeaturesByBufferParameters({
- attributeFilter: attributeFilter,
- datasetNames: datasetArr,
- bufferDistance: bufferDistance,
- geometry: geometryLayer
- });
- } else if (getFeatureMode === 'SPATIAL') {
- let spatialQueryMode = spatialQueryModeSelectName.title;
- let defaultGeometryValue = JSON.parse(queryRangeTextArea.value);
- let geometryLayer = resultLayer || defaultGeometryValue;
- queryParam = new GetFeaturesByGeometryParameters({
- attributeFilter: attributeFilter,
- datasetNames: datasetArr,
- spatialQueryMode: spatialQueryMode,
- geometry: geometryLayer
- });
- }
- return queryParam;
- }
- //阻止 map 默认事件
- this._preventMapEvent(container, this.map);
- return container;
- },
- /**
- * @function DataServiceQueryView.prototype._creatInputBox
- * @description 创建含有 span 的 input 框。
- * @private
- */
- _creatInputBox(inputOptions, parentEle) {
- let div = external_L_default().DomUtil.create('div', '', parentEle);
- let span = external_L_default().DomUtil.create('span', '', div);
- span.innerHTML = inputOptions.spanName;
- let input = external_L_default().DomUtil.create('input', '', div);
- input.value = inputOptions.value;
- // input.className = 'distributeInput'
- return div;
- }
- });
- var dataServiceQueryView = function (dataServiceUrl, dataSetNames, options) {
- return new DataServiceQueryView(dataServiceUrl, dataSetNames, options);
- };
- ;// CONCATENATED MODULE: ./src/leaflet/components/index.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- ;// CONCATENATED MODULE: ./src/leaflet/index.js
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- ;// CONCATENATED MODULE: ./src/leaflet/namespace.js
- /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- // 注:命名空间重复,内容会被覆盖
- // 例如SuperMap.Components=>L.supermap.Componets,再写L.supermap.Componets = {}, SuprMap的Components就不会挂在L.supermap上了
- // L.supermap.d3Layer是在别的地方挂上的
- (external_L_default()).supermap = { ...SuperMap, Components: { ...SuperMap.Components }, ...(external_L_default()).supermap };
- (external_L_default()).supermap.components = (external_L_default()).supermap.components || {};
- (external_L_default()).supermap.Components = (external_L_default()).supermap.Components || {};
- (external_L_default()).supermap.control = (external_L_default()).supermap.control || {};
- (external_L_default()).supermap.Util = {};
- // ./core
- // L.Util.supermap_callbacks = coreUtil.supermap_callbacks;
- (external_L_default()).Util.toGeoJSON = toGeoJSON;
- (external_L_default()).supermap.Util.toGeoJSON = toGeoJSON;
- (external_L_default()).Util.toSuperMapGeometry = toSuperMapGeometry;
- (external_L_default()).supermap.Util.toSuperMapGeometry = toSuperMapGeometry;
- (external_L_default()).Util.resolutionToScale = resolutionToScale;
- (external_L_default()).supermap.Util.resolutionToScale = resolutionToScale;
- (external_L_default()).Util.scaleToResolution = Util_scaleToResolution;
- (external_L_default()).supermap.Util.scaleToResolution = Util_scaleToResolution;
- (external_L_default()).Util.getMeterPerMapUnit = Util_getMeterPerMapUnit;
- (external_L_default()).supermap.Util.getMeterPerMapUnit = Util_getMeterPerMapUnit;
- (external_L_default()).Util.GetResolutionFromScaleDpi = getResolutionFromScaleDpi;
- (external_L_default()).supermap.Util.getResolutionFromScaleDpi = getResolutionFromScaleDpi;
- (external_L_default()).supermap.Util.GetResolutionFromScaleDpi = getResolutionFromScaleDpi;
- (external_L_default()).Util.NormalizeScale = normalizeScale;
- (external_L_default()).supermap.Util.normalizeScale = normalizeScale;
- (external_L_default()).supermap.Util.NormalizeScale = normalizeScale;
- (external_L_default()).Util.transform = Transform_transform;
- (external_L_default()).supermap.Util.transform = Transform_transform;
- // L.Proj4Leaflet
- (external_L_default()).Proj = (external_L_default()).Proj || {};
- (external_L_default()).supermap.Proj = (external_L_default()).supermap.Proj || {};
- (external_L_default()).Proj.CRS = crs;
- (external_L_default()).supermap.Proj.crs = crs;
- (external_L_default()).supermap.Proj.CRS = CRS;
- // core/NonEarthCRS
- (external_L_default()).Projection = {};
- (external_L_default()).supermap.Projection = (external_L_default()).supermap.Projection || {};
- (external_L_default()).Projection.NonProjection = nonProjection;
- (external_L_default()).supermap.Projection.nonProjection = nonProjection;
- (external_L_default()).supermap.Projection.NonProjection = NonProjection;
- (external_L_default()).supermap.CRS = (external_L_default()).supermap.CRS || {};
- (external_L_default()).CRS.NonEarthCRS = nonEarthCRS;
- (external_L_default()).supermap.CRS.NonEarthCRS = NonEarthCRS;
- (external_L_default()).supermap.CRS.nonEarthCRS = nonEarthCRS;
- // core/ExtendsCRS
- (external_L_default()).CRS.BaiduCRS = BaiduCRS;
- (external_L_default()).supermap.CRS.BaiduCRS = BaiduCRS;
- (external_L_default()).CRS.TianDiTu_WGS84CRS = TianDiTu_WGS84CRS;
- (external_L_default()).supermap.CRS.TianDiTu_WGS84CRS = TianDiTu_WGS84CRS;
- (external_L_default()).CRS.TianDiTu_MercatorCRS = TianDiTu_MercatorCRS;
- (external_L_default()).supermap.CRS.TianDiTu_MercatorCRS = TianDiTu_MercatorCRS;
- (external_L_default()).CRS.TianDiTu_Mercator = TianDiTu_MercatorCRS;
- (external_L_default()).supermap.CRS.TianDiTu_Mercator = TianDiTu_MercatorCRS;
- (external_L_default()).CRS.TianDiTu_WGS84 = TianDiTu_WGS84CRS;
- (external_L_default()).supermap.CRS.TianDiTu_WGS84 = TianDiTu_WGS84CRS;
- (external_L_default()).CRS.Baidu = BaiduCRS;
- (external_L_default()).supermap.CRS.Baidu = BaiduCRS;
- (external_L_default()).supermap.CommontypesConversion = CommontypesConversion;
- // components
- (external_L_default()).supermap.components.clientComputationLayer = clientComputationLayer;
- (external_L_default()).supermap.Components.ClientComputationLayer = ClientComputationLayer;
- (external_L_default()).supermap.components.clientComputation = clientComputationView;
- (external_L_default()).supermap.Components.ClientComputation = ClientComputationView;
- (external_L_default()).supermap.components.clientComputationViewModel = clientComputationViewModel;
- (external_L_default()).supermap.Components.ClientComputationViewModel = ClientComputationViewModel;
- (external_L_default()).supermap.components.geoJSONLayerWithName = geoJSONLayerWithName;
- (external_L_default()).supermap.Components.GeoJSONLayerWithName = GeoJSONLayerWithName;
- (external_L_default()).supermap.components.GeoJsonLayersDataModel = GeoJsonLayersDataModel;
- (external_L_default()).supermap.Components.GeoJsonLayersDataModel = GeoJsonLayersDataModel;
- (external_L_default()).supermap.components.dataFlow = dataFlowView;
- (external_L_default()).supermap.Components.DataFlow = DataFlowView;
- (external_L_default()).supermap.components.dataFlowViewModel = dataFlowViewModel;
- (external_L_default()).supermap.Components.DataFlowViewModel = DataFlowViewModel;
- (external_L_default()).supermap.components.dataServiceQuery = dataServiceQueryView;
- (external_L_default()).supermap.Components.DataServiceQuery = DataServiceQueryView;
- (external_L_default()).supermap.components.dataServiceQueryViewModel = dataServiceQueryViewModel;
- (external_L_default()).supermap.Components.DataServiceQueryViewModel = DataServiceQueryViewModel;
- (external_L_default()).supermap.components.DistributedAnalysisModel = DistributedAnalysisModel;
- (external_L_default()).supermap.Components.DistributedAnalysisModel = DistributedAnalysisModel;
- (external_L_default()).supermap.components.distributedAnalysis = distributedAnalysisView;
- (external_L_default()).supermap.Components.DistributedAnalysis = DistributedAnalysisView;
- (external_L_default()).supermap.components.distributedAnalysisViewModel = distributedAnalysisViewModel;
- (external_L_default()).supermap.Components.DistributedAnalysisViewModel = DistributedAnalysisViewModel;
- (external_L_default()).supermap.components.openFile = openFileView;
- (external_L_default()).supermap.Components.OpenFile = OpenFileView;
- (external_L_default()).supermap.components.openFileViewModel = openFileViewModel;
- (external_L_default()).supermap.Components.OpenFileViewModel = OpenFileViewModel;
- (external_L_default()).supermap.components.search = searchView;
- (external_L_default()).supermap.Components.Search = SearchView;
- (external_L_default()).supermap.components.searchViewModel = searchViewModel;
- (external_L_default()).supermap.Components.SearchViewModel = SearchViewModel;
- (external_L_default()).supermap.components.componentsViewBase = componentsViewBase;
- (external_L_default()).supermap.Components.ComponentsViewBase = ComponentsViewBase;
- // control
- (external_L_default()).supermap.control.changeTileVersion = changeTileVersion;
- (external_L_default()).supermap.control.ChangeTileVersion = ChangeTileVersion;
- (external_L_default()).supermap.control.logo = logo;
- (external_L_default()).supermap.control.Logo = Logo;
- // mapping
- (external_L_default()).supermap.baiduTileLayer = baiduTileLayer;
- (external_L_default()).supermap.BaiduTileLayer = BaiduTileLayer;
- (external_L_default()).supermap.cloudTileLayer = cloudTileLayer;
- (external_L_default()).supermap.CloudTileLayer = CloudTileLayer;
- (external_L_default()).supermap.imageMapLayer = imageMapLayer;
- (external_L_default()).supermap.ImageMapLayer = ImageMapLayer;
- (external_L_default()).supermap.imageTileLayer = imageTileLayer;
- (external_L_default()).supermap.ImageTileLayer = ImageTileLayer;
- (external_L_default()).supermap.tiandituTileLayer = tiandituTileLayer;
- (external_L_default()).supermap.TiandituTileLayer = TiandituTileLayer;
- (external_L_default()).supermap.tiledMapLayer = tiledMapLayer;
- (external_L_default()).supermap.TiledMapLayer = TiledMapLayer;
- (external_L_default()).supermap.wmtsLayer = wmtsLayer;
- (external_L_default()).supermap.WMTSLayer = WMTSLayer;
- (external_L_default()).supermap.webmap = webMap;
- (external_L_default()).supermap.WebMap = WebMap;
- (external_L_default()).supermap.initMap = initMap;
- (external_L_default()).supermap.crsFromMapJSON = crsFromMapJSON;
- // overlay
- (external_L_default()).supermap.CartoCSSToLeaflet = CartoCSSToLeaflet;
- (external_L_default()).supermap.DefaultStyle = DefaultStyle;
- (external_L_default()).supermap.CartoStyleMap = CartoStyleMap;
- (external_L_default()).supermap.ServerStyleMap = ServerStyleMap;
- (external_L_default()).supermap.CompOpMap = CompOpMap;
- (external_L_default()).supermap.circleStyle = circleStyle;
- (external_L_default()).supermap.CircleStyle = CircleStyle;
- (external_L_default()).supermap.cloverStyle = cloverStyle;
- (external_L_default()).supermap.CloverStyle = CloverStyle;
- (external_L_default()).supermap.graphic = graphic;
- (external_L_default()).supermap.Graphic = Graphic;
- (external_L_default()).supermap.imageStyle = imageStyle;
- (external_L_default()).supermap.ImageStyle = ImageStyle;
- (external_L_default()).supermap.themeFeature = themeFeature;
- (external_L_default()).supermap.ThemeFeature = ThemeFeature;
- (external_L_default()).supermap.dataFlowLayer = dataFlowLayer;
- (external_L_default()).supermap.DataFlowLayer = DataFlowLayer;
- (external_L_default()).supermap.echartsLayer = echartsLayer;
- (external_L_default()).supermap.EchartsLayer = EchartsLayer;
- (external_L_default()).supermap.graphicLayer = graphicLayer;
- (external_L_default()).supermap.GraphicLayer = GraphicLayer;
- (external_L_default()).supermap.graphThemeLayer = graphThemeLayer;
- (external_L_default()).supermap.GraphThemeLayer = GraphThemeLayer;
- (external_L_default()).supermap.heatMapFeature = heatMapFeature;
- (external_L_default()).supermap.HeatMapFeature = HeatMapFeature;
- (external_L_default()).supermap.heatMapLayer = heatMapLayer;
- (external_L_default()).supermap.HeatMapLayer = HeatMapLayer;
- (external_L_default()).supermap.labelThemeLayer = labelThemeLayer;
- (external_L_default()).supermap.LabelThemeLayer = LabelThemeLayer;
- (external_L_default()).supermap.mapVLayer = mapVLayer;
- (external_L_default()).supermap.MapVLayer = MapVLayer;
- (external_L_default()).supermap.rangeThemeLayer = rangeThemeLayer;
- (external_L_default()).supermap.RangeThemeLayer = RangeThemeLayer;
- (external_L_default()).supermap.rankSymbolThemeLayer = rankSymbolThemeLayer;
- (external_L_default()).supermap.RankSymbolThemeLayer = RankSymbolThemeLayer;
- (external_L_default()).supermap.tiledVectorLayer = tiledVectorLayer;
- (external_L_default()).supermap.TileVectorLayer = TiledVectorLayer;
- (external_L_default()).supermap.TiledVectorLayer = TiledVectorLayer;
- (external_L_default()).supermap.turfLayer = turfLayer;
- (external_L_default()).supermap.TurfLayer = TurfLayer;
- (external_L_default()).supermap.unicodeMarker = unicodeMarker;
- (external_L_default()).supermap.UnicodeMarker = UnicodeMarker;
- (external_L_default()).supermap.uniqueThemeLayer = uniqueThemeLayer;
- (external_L_default()).supermap.UniqueThemeLayer = UniqueThemeLayer;
- (external_L_default()).supermap.VectorTileFormat = VectorTileFormat;
- (external_L_default()).supermap.addressMatchService = addressMatchService;
- (external_L_default()).supermap.AddressMatchService = AddressMatchService_AddressMatchService;
- (external_L_default()).supermap.chartService = chartService;
- (external_L_default()).supermap.ChartService = ChartService;
- (external_L_default()).supermap.dataFlowService = dataFlowService;
- (external_L_default()).supermap.DataFlowService = DataFlowService_DataFlowService;
- (external_L_default()).supermap.datasetService = datasetService;
- (external_L_default()).supermap.DatasetService = DatasetService_DatasetService;
- (external_L_default()).supermap.datasourceService = datasourceService;
- (external_L_default()).supermap.DatasourceService = DatasourceService_DatasourceService;
- (external_L_default()).supermap.featureService = FeatureService_featureService;
- (external_L_default()).supermap.FeatureService = FeatureService;
- (external_L_default()).supermap.fieldService = fieldService;
- (external_L_default()).supermap.FieldService = FieldService;
- (external_L_default()).supermap.geoprocessingService = geoprocessingService;
- (external_L_default()).supermap.GeoprocessingService = GeoprocessingService_GeoprocessingService;
- (external_L_default()).supermap.gridCellInfosService = gridCellInfosService;
- (external_L_default()).supermap.GridCellInfosService = GridCellInfosService;
- (external_L_default()).supermap.imageCollectionService = imageCollectionService;
- (external_L_default()).supermap.ImageCollectionService = ImageCollectionService;
- (external_L_default()).supermap.imageService = imageService;
- (external_L_default()).supermap.ImageService = ImageService;
- (external_L_default()).supermap.layerInfoService = layerInfoService;
- (external_L_default()).supermap.LayerInfoService = LayerInfoService;
- (external_L_default()).supermap.mapService = mapService;
- (external_L_default()).supermap.MapService = MapService_MapService;
- (external_L_default()).supermap.measureService = measureService;
- (external_L_default()).supermap.MeasureService = MeasureService_MeasureService;
- (external_L_default()).supermap.networkAnalyst3DService = networkAnalyst3DService;
- (external_L_default()).supermap.NetworkAnalyst3DService = NetworkAnalyst3DService;
- (external_L_default()).supermap.networkAnalystService = networkAnalystService;
- (external_L_default()).supermap.NetworkAnalystService = NetworkAnalystService;
- (external_L_default()).supermap.processingService = processingService;
- (external_L_default()).supermap.ProcessingService = ProcessingService;
- (external_L_default()).supermap.queryService = queryService;
- (external_L_default()).supermap.QueryService = QueryService_QueryService;
- (external_L_default()).supermap.ServiceBase = ServiceBase;
- (external_L_default()).supermap.spatialAnalystService = spatialAnalystService;
- (external_L_default()).supermap.SpatialAnalystService = SpatialAnalystService;
- (external_L_default()).supermap.themeService = themeService;
- (external_L_default()).supermap.ThemeService = ThemeService_ThemeService;
- (external_L_default()).supermap.trafficTransferAnalystService = trafficTransferAnalystService;
- (external_L_default()).supermap.TrafficTransferAnalystService = TrafficTransferAnalystService;
- (external_L_default()).supermap.webPrintingJobService = webPrintingJobService;
- (external_L_default()).supermap.WebPrintingJobService = WebPrintingJobService;
- // 处理命名空间重名
- (external_L_default()).supermap.CommonUtil = Util;
- })();
- // This entry need to be wrapped in an IIFE because it need to be in strict mode.
- (() => {
- "use strict";
- /* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
- * This program are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
- })();
- /******/ })()
- ;
|