123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741 |
- function toFullExtent() {
- goToZoom(0,0);
- m_view.zoom = 1
- }
- function btFullExtent_Click() {
- toFullExtent()
- }
- function ZoomIn(level) {
- if (level) {
- m_view.goTo({
- zoom: level
- });
- } else if (level == 0) {
- m_view.goTo({
- zoom: 0
- });
- } else {
- m_zoom.zoomIn();
- }
- }
- function btZoomIn_Click() {
- ZoomIn()
- }
- function btZoomOut_Click() {
- ZoomOut()
- }
- function ZoomOut(level) {
- if (level) {
- m_view.goTo({
- zoom: level
- });
- } else if (level == 0) {
- m_view.goTo({
- zoom: 0
- });
- } else {
- m_zoom.zoomOut();
- }
- }
- function btDrawPolygon_Click() {
- measureSquare()
- }
- function measureSquare() {
- measurePolygon(m_drawtool, m_view)
- }
- function measureLength() {
- if (currentMapMode == "2D") {
- measurePolyline(m_drawtool, m_view)
- } else {
- if (lengthMeasureWidget) {
- if (!lengthMeasureWidget.destroyed) {
- lengthMeasureWidget.destroy();
- return
- }
- }
- createLengthMeasureWidget()
- }
- }
- function goToCar(x,y) {
- require([
- "esri/geometry/Point"
- ], function ( Point ) {
- var point = new Point({
- x: x-0,
- y: y-0,
- spatialReference: m_view.spatialReference
- });
- m_view.goTo({
- target: point,
- zoom: 8
- })
- })
- }
- function btDrawPolyline_Click() {
- measureLength()
- }
- function createLengthMeasureWidget() {
- require(["esri/widgets/DirectLineMeasurement3D", "dojo/domReady!"],
- function (DirectLineMeasurement3D) {
- lengthMeasureWidget = new DirectLineMeasurement3D({
- view: m_view
- });
- m_view.ui.add(lengthMeasureWidget, "top-right");
- });
- }
- function measurePolylineByPoint(x, y, x1, y1) {
- var length;
- require(["esri/Map", "esri/views/MapView", "esri/layers/MapImageLayer", "esri/layers/TileLayer", "esri/geometry/Geometry", "esri/geometry/Extent", "esri/tasks/GeometryService", "esri/layers/GraphicsLayer", "esri/widgets/ScaleBar", "esri/WebMap", "esri/geometry/SpatialReference", "esri/Graphic", "esri/views/2d/draw/Draw", "esri/geometry/Polyline", "esri/geometry/geometryEngine"],
- function (Map, MapView, MapImageLayer, TileLayer, Geometry, Extent, GeometryService, GraphicsLayer, ScaleBar, WebMap, SpatialReference, Graphic, Draw, Polyline, geometryEngine) {
- var polyline = new Polyline({
- paths: [[x, y], [x1, y1]],
- spatialReference: 2379
- });
- length = geometryEngine.planarLength(polyline, "kilometers");
- });
- return length;
- }
- function measurePolyline(draw, view) {
- require(["esri/Map", "esri/views/MapView", "esri/layers/MapImageLayer", "esri/layers/TileLayer", "esri/geometry/Geometry", "esri/geometry/Extent", "esri/tasks/GeometryService", "esri/layers/GraphicsLayer", "esri/widgets/ScaleBar", "esri/WebMap", "esri/geometry/SpatialReference", "esri/Graphic", "esri/views/2d/draw/Draw", "esri/geometry/Polyline", "esri/geometry/geometryEngine"],
- function (Map, MapView, MapImageLayer, TileLayer, Geometry, Extent, GeometryService, GraphicsLayer, ScaleBar, WebMap, SpatialReference, Graphic, Draw, Polyline, geometryEngine) {
- var action = draw.create("polyline");
- view.focus();
- action.on("vertex-add", drawPolyline);
- action.on("cursor-update", drawPolyline);
- action.on("vertex-remove", drawPolyline);
- action.on("draw-complete", drawPolyline);
- function drawPolyline(evt) {
- var vertices = evt.vertices;
- btClear_Click();
- var polyline = createPolyline(vertices);
- var graphic = createGraphic(polyline);
- GraphicsLayer_DrawLayer.add(graphic);
- var length = geometryEngine.planarLength(polyline, "kilometers");
- if (length < 0) {
- var simplifiedPolyline = geometryEngine.simplify(polyline);
- if (simplifiedPolyline) {
- if (currentMapMode == "2D") {
- length = geometryEngine.planarLength(simplifiedPolyline, "kilometers")
- } else {
- length = geometryEngine.geodesicLength(simplifiedPolyline, "kilometers")
- }
- }
- }
- labelLength(polyline, length)
- }
- function createPolyline(vertices) {
- return new Polyline({
- paths: vertices,
- spatialReference: m_view.spatialReference
- })
- }
- function createGraphic(polyline) {
- graphic = new Graphic({
- geometry: polyline,
- symbol: {
- type: "simple-line",
- color: [178, 102, 234, .8],
- width: 2
- }
- });
- return graphic
- }
- function labelLength(geom, area) {
- var graphic = new Graphic({
- geometry: geom.extent.center,
- symbol: {
- type: "text",
- color: "black",
- haloColor: "black",
- haloSize: "1px",
- text: area.toFixed(2) + " km",
- xoffset: 3,
- yoffset: 3,
- font: {
- size: 14,
- family: "sans-serif"
- }
- }
- });
- GraphicsLayer_DrawLayer.add(graphic)
- }
- })
- }
- function measurePolygon(draw, view) {
- require(["esri/Map", "esri/views/MapView", "esri/layers/MapImageLayer", "esri/layers/TileLayer", "esri/geometry/Geometry", "esri/geometry/Extent", "esri/tasks/GeometryService", "esri/layers/GraphicsLayer", "esri/widgets/ScaleBar", "esri/WebMap", "esri/geometry/SpatialReference", "esri/Graphic", "esri/views/2d/draw/Draw", "esri/geometry/Polygon", "esri/geometry/geometryEngine"],
- function (Map, MapView, MapImageLayer, TileLayer, Geometry, Extent, GeometryService, GraphicsLayer, ScaleBar, WebMap, SpatialReference, Graphic, Draw, Polygon, geometryEngine) {
- var action = draw.create("polygon");
- view.focus();
- action.on("vertex-add", drawPolygon);
- action.on("cursor-update", drawPolygon);
- action.on("vertex-remove", drawPolygon);
- action.on("draw-complete", drawPolygon);
- function drawPolygon(evt) {
- var vertices = evt.vertices;
- btClear_Click();
- var polygon = createPolygon(vertices);
- var graphic = createGraphic(polygon);
- GraphicsLayer_DrawLayer.add(graphic);
- var area = geometryEngine.planarArea(polygon, "square-kilometers");
- if (area < 0) {
- var simplifiedPolygon = geometryEngine.simplify(polygon);
- if (simplifiedPolygon) {
- if (currentMapMode == "2D") {
- area = geometryEngine.planarArea(simplifiedPolygon, "square-kilometers")
- } else {
- area = geometryEngine.geodesicArea(simplifiedPolygon, "square-kilometers")
- }
- }
- }
- labelAreas(polygon, area)
- }
- function createPolygon(vertices) {
- return new Polygon({
- rings: vertices,
- spatialReference: m_view.spatialReference
- })
- }
- function createGraphic(polygon) {
- graphic = new Graphic({
- geometry: polygon,
- symbol: {
- type: "simple-fill",
- color: [178, 102, 234, .8],
- style: "solid",
- outline: {
- color: [255, 255, 255],
- width: 2
- }
- }
- });
- return graphic
- }
- function labelAreas(geom, area) {
- var graphic = new Graphic({
- geometry: geom.centroid,
- symbol: {
- type: "text",
- color: "black",
- haloColor: "black",
- haloSize: "1px",
- text: area.toFixed(2) + " 平方千米",
- xoffset: 3,
- yoffset: 3,
- font: {
- size: 14,
- family: "sans-serif"
- }
- }
- });
- GraphicsLayer_DrawLayer.add(graphic)
- }
- })
- }
- function btPrintPicture_Click() {
- downLoadPicture()
- }
- function downLoadPicture() {
- if (m_printTool) {
- if (!m_printTool.destroyed) {
- m_printTool.destroy();
- return
- }
- }
- require(["esri/widgets/Print"],
- function (Print) {
- m_printTool = new Print({
- view: m_view,
- printServiceUrl: GetConfigDataByName("PrintTaskURL")
- });
- m_view.ui.add(m_printTool, "top-right")
- })
- }
- function btPrintPicture_Click2() {
- require(["esri/tasks/PrintTask", "esri/tasks/support/PrintParameters", "esri/tasks/support/PrintTemplate"],
- function (PrintTask, PrintParameters, PrintTemplate) {
- var printTask = new PrintTask(GetConfigDataByName("PrintTaskURL"));
- var template = new PrintTemplate;
- template.exportOptions = {
- width: 1200,
- height: 700,
- dpi: 96
- };
- template.format = "JPG";
- template.layout = "MAP_ONLY";
- template.preserveScale = true;
- var params = new PrintParameters;
- params.view = m_view;
- params.template = template;
- printTask.execute(params).then(function (evt) {
- window.open(evt.url, "_blank")
- })
- })
- }
- function btGetGraphicByJson() {
- var jsonStr = '{"ExChangeRoot": {"Features": [' + ' { "type": "polygon", "featureName": "用地", "Feature":[ {"Geometry": { "Rings": [{ "Ring": "1000,-1000|0,-1500|-1000,-1000|-1000,1000|1000,1000|2000,0" } ]},"Attribute": { "ID": "1", "地块面积": "100", "建筑限高": "20" }, "ToolTip": "用地地块","Color": "yellow", "Style": "solid" } ] },' + '{ "type": "polyline", "featureName": "道路", "Feature": [{"ShowInfo":"yes", "Geometry": {"Paths": [{ "Path": "3778,-2008|2777,-2816|3777,-3021|3777,-3529|3772,-3928|3774,-4405|3777,-5206" }] }, "Attribute": {"ID": "2","道路名": "人民大道", "道路长度": "10000", "道路宽度": "25" }, "ToolTip": "人民大道", "Color": [225,0,0,0.5], "Size": "5" }] },' + '{ "type": "point", "featureName": "兴趣点", "Feature":[ { "Geometry": { "Points":[ { "Point": "2600,900" } ]},"Attribute": { "ID": "3","名称": "东方明珠" }, "ToolTip": "东方明珠","Color": "blue", "Size": "10", "Style": "square"}]}]}}';
- doGetGraphicByJson(jsonStr)
- }
- function jsontagUndefined(firstChild) {
- if (firstChild != undefined) {
- return firstChild
- }
- return null
- }
- function attributesToHTMLStr(att) {
- var str = "";
- for (var name in att) {
- str += name + ":" + att[name] + "<br>"
- }
- return str
- }
- function polygonxmlToArray(xmlStr) {
- var end = [];
- var strs = xmlStr.split("|");
- for (var i = 0; i < strs.length; i++) {
- var s = strs[i].split(",");
- if (currentMapMode == "2D") {
- var aa = [parseFloat(s[0]), parseFloat(s[1])];
- end.push(aa)
- } else {
- var aa = [parseFloat(s[0]), parseFloat(s[1]), parseFloat(s[2])];
- end.push(aa)
- }
- end.push(aa)
- }
- end.push([parseFloat(strs[0].split(",")[0]), parseFloat(strs[0].split(",")[1])]);
- return end
- }
- function polylinexmlToArray(xmlStr) {
- var end = [];
- var strs = xmlStr.split("|");
- for (var i = 0; i < strs.length; i++) {
- var s = strs[i].split(",");
- if (currentMapMode == "2D") {
- var aa = [parseFloat(s[0]), parseFloat(s[1])];
- end[i] = aa
- } else {
- var aa = [parseFloat(s[0]), parseFloat(s[1]), parseFloat(s[2])];
- end[i] = aa
- }
- }
- return end
- }
- var imgSizeList = [];
- function doGetGraphicByJson(jsons, isGoTo) {
- var jsonStr = eval("(" + jsons + ")");
- btClear_Click();
- var features = jsonStr.ExChangeRoot.Features;
- if (features.length < 1) {
- alert("无查询结果")
- }
- for (var k = 0; k < features.length; k++) {
- switch (features[k].type) {
- case "polygon":
- {
- var polygonFeature = features[k].Feature;
- for (var i = 0; i < polygonFeature.length; i++) {
- var rings = polygonFeature[i].Geometry.Rings;
- for (var j = 0; j < rings.length; j++) {
- var ring = rings[j].Ring;
- var polygonAttribute = polygonFeature[i].Attribute;
- var polygonToolTip = jsontagUndefined(polygonFeature[i].ToolTip);
- var polygonColor = jsontagUndefined(polygonFeature[i].Color);
- var polygonSize = jsontagUndefined(polygonFeature[i].Size);
- var polygonStyle = jsontagUndefined(polygonFeature[i].Style);
- xmlAddPolygon(ring, polygonToolTip, polygonColor, polygonSize, polygonStyle, polygonAttribute)
- }
- }
- break;
- }
- case "polyline":
- {
- var polylineFeature = features[k].Feature;
- for (var i = 0; i < polylineFeature.length; i++) {
- var paths = polylineFeature[i].Geometry.Paths;
- for (var j = 0; j < paths.length; j++) {
- var path = paths[j].Path;
- var polylineAttribute = polylineFeature[i].Attribute;
- var polylineToolTip = jsontagUndefined(polylineFeature[i].ToolTip);
- var polylineColor = jsontagUndefined(polylineFeature[i].Color);
- var polylineSize = jsontagUndefined(polylineFeature[i].Size);
- var polylineStyle = jsontagUndefined(polylineFeature[i].Style);
- xmlAddPolyline(path, polylineToolTip, polylineColor, polylineSize, polylineStyle, polylineAttribute)
- }
- }
- break;
- }
- case "point":
- {
- var pointFeature = features[k].Feature;
- for (var i = 0; i < pointFeature.length; i++) {
- var points = pointFeature[i].Geometry.Points;
- for (var j = 0; j < points.length; j++) {
- var point = points[j].Point;
- var pointAttribute = pointFeature[i].Attribute;
- var pointToolTip = jsontagUndefined(pointFeature[i].ToolTip);
- var imgUrl = jsontagUndefined(pointFeature[i].ImgUrl);
- var ImgWidth = jsontagUndefined(pointFeature[i].ImgWidth);
- var ImgHeight = jsontagUndefined(pointFeature[i].ImgHeight);
- var color = jsontagUndefined(pointFeature[i].Color);
- var size = jsontagUndefined(pointFeature[i].Size);
- var style = jsontagUndefined(pointFeature[i].Style);
- xmlAddPoint(point, pointToolTip, imgUrl, ImgWidth, ImgHeight, color, size, style, pointAttribute)
- }
- }
- break;
- }
- }
- }
- m_view.zoom=10;
- if (isGoTo == undefined || isGoTo == null)
- isGoTo = true;
- if (isGoTo) {
- m_view.goTo(xmlQueryExtend.expand(2))
- }
- }
- function doDeletePointById(id) {
- var list = GraphicsLayer_DrawLayer.graphics.items;
- for (var i = 0; i < list.length; i++) {
- if (list[i].attributes.id == id) {
- GraphicsLayer_DrawLayer.remove(list[i]);
- }
- }
- }
- function doShowAreaName(layerName, fieldName, bool, size, color) {
- if (!bool) {
- GraphicsLayer_areaNameLayer.removeAll();
- return;
- }
- if (!color) {
- color = "black";
- }
- if (!size) {
- size = 14;
- }
- var layerId = GetFeatureLayerIdbyName(layerName);
- var where = "1=1";
- if (layerId == -1)
- return;
- require(["esri/tasks/QueryTask", "esri/tasks/support/Query", "esri/layers/FeatureLayer", "dojo/_base/array", "dojo/dom", "esri/Graphic",
- "esri/geometry/Point"],
- function (QueryTask, Query, FeatureLayer, arrayUtils, dom, Graphic, Point) {
- var pointGraphicArray = [];
- var urlI = dyLayer.url + "/" + layerId;
- var qTask = new QueryTask({
- url: urlI
- });
- var params = new Query({
- returnGeometry: true,
- outFields: ["*"]
- });
- params.where = where;
- qTask.execute(params).then(getResults).catch(promiseRejected);
- function getResults(response) {
- $.each(response.features, function (index, feature) {
- var geometry = feature.geometry;
- var text = feature.attributes[fieldName];
- var point = {
- type: "point",
- x: geometry.extent.center.x,
- y: geometry.extent.center.y,
- spatialReference: m_view.spatialReference
- };
- var textSymbol = {
- type: "text", // autocasts as new TextSymbol()
- color: color,
- text: text,
- font: { // autocasts as new Font()
- size: size,
- weight: "bold"
- }
- };
- var pointGraphic = new Graphic({
- geometry: point,
- symbol: textSymbol
- });
- pointGraphicArray.push(pointGraphic);
- });
- GraphicsLayer_areaNameLayer.addMany(pointGraphicArray);
- }
- function promiseRejected(err) {
- console.error("错误信息: ", err.message);
- }
- });
- }
- function xmlAddPolygon(ring, polygonToolTip, polygonColor, polygonSize, polygonStyle, polygonAttribute) {
- require(["esri/Graphic", "esri/geometry/SpatialReference"],
- function (Graphic, SpatialReference) {
- if (!polygonColor) {
- polygonColor = [227, 139, 79, .8]
- }
- if (!polygonSize) {
- polygonSize = 2
- }
- switch (polygonStyle) {
- case "backwarddiagonal":
- polygonStyle = "backward-diagonal";
- break;
- case "cross":
- polygonStyle = "cross";
- break;
- case "diagonalcross":
- polygonStyle = "diagonal-cross";
- break;
- case "forwarddiagonal":
- polygonStyle = "forward-diagonal";
- break;
- case "horizontal":
- polygonStyle = "horizontal";
- break;
- case "vertical":
- polygonStyle = "vertical";
- break;
- case "solid":
- polygonStyle = "solid";
- break;
- default:
- polygonStyle = "none";
- break
- }
- var ringsarray = polygonxmlToArray(ring);
- var polygon = {
- type: "polygon",
- rings: ringsarray,
- spatialReference: m_view.spatialReference
- };
- var fillSymbol = {
- type: "simple-fill",
- color: polygonColor,
- style: polygonStyle,
- outline: {
- color: [255, 255, 255],
- width: polygonSize
- }
- };
- var polygonGraphic = new Graphic({
- geometry: polygon,
- symbol: fillSymbol,
- attributes: polygonAttribute
- });
- GraphicsLayer_DrawLayer.add(polygonGraphic);
- var popupTemplate = {
- title: polygonToolTip,
- content: attributesToHTMLStr(polygonAttribute)
- };
- // polygonGraphic.popupTemplate = popupTemplate;
- var extent = polygonGraphic.geometry.extent;
- extent.spatialReference = m_view.spatialReference;
- if (xmlQueryExtend) {
- xmlQueryExtend = xmlQueryExtend.union(extent)
- } else {
- xmlQueryExtend = extent
- }
- })
- }
- function xmlAddPolyline(path, polylineToolTip, polylineColor, polylineSize, polylineStyle, polylineAttribute) {
- require(["esri/Graphic"],
- function (Graphic) {
- if (polylineSize == null) {
- polylineSize = 1
- }
- if (polylineColor == null) {
- polylineColor = [226, 119, 40]
- }
- switch (polylineStyle) {
- case "dash":
- polylineStyle = "dash";
- break;
- case "dashdot":
- polylineStyle = "dash-dot";
- break;
- case "none":
- polylineStyle = "none";
- break;
- case "dot":
- polylineStyle = "dot";
- break;
- default:
- polylineStyle = "solid"
- }
- var polyline = {
- type: "polyline",
- paths: polylinexmlToArray(path),
- spatialReference: m_view.spatialReference
- };
- var lineSymbol = {
- type: "simple-line",
- color: polylineColor,
- style: polylineStyle,
- width: polylineSize
- };
- var polylineGraphic = new Graphic({
- geometry: polyline,
- symbol: lineSymbol,
- attributes: polylineAttribute
- });
- GraphicsLayer_DrawLayer.add(polylineGraphic);
- var popupTemplate = {
- title: polylineToolTip,
- content: attributesToHTMLStr(polylineAttribute)
- };
- // polylineGraphic.popupTemplate = popupTemplate;
- var extent = polylineGraphic.geometry.extent;
- extent.spatialReference = m_view.spatialReference;
- if (xmlQueryExtend) {
- xmlQueryExtend = xmlQueryExtend.union(extent)
- } else {
- xmlQueryExtend = extent
- }
- })
- }
- function xmlAddPoint(points, pointToolTip, imgUrl, imgWidth, imgHeight, color, size, style, pointAttribute) {
- require(["esri/geometry/Extent", "esri/Graphic"],
- function (Extent, Graphic) {
- var xy = points.split(",");
- var point;
- if (currentMapMode == "2D") {
- point = {
- type: "point",
- x: xy[0],
- y: xy[1],
- spatialReference: m_view.spatialReference
- }
- } else {
- var z=0;
- if(xy.length==3){
- z=xy[2];
- }else{
- z=10;
- }
- point = {
- type: "point",
- x: xy[0],
- y: xy[1],
- z: z,
- spatialReference: m_view.spatialReference
- }
- }
- var markerSymbol;
- if (imgUrl != null) {
- imgSizeList = [imgWidth.split("px")[0], imgHeight.split("px")[0]];
- pointAttribute.newImgWidth=imgSizeList[0];
- pointAttribute.newImgHeight=imgSizeList[1];
- var newImgWidth = imgSizeList[0] - (imgSizeList[0] * (14 - m_view.zoom) * 0.05);//zoom每级差5%
- var newImgHeight = imgSizeList[1] - (imgSizeList[1] * (14 - m_view.zoom) * 0.05)
- markerSymbol =
- {
- type: "point-3d", // autocasts as new PointSymbol3D()
- symbolLayers: [
- {
- type: "icon", // autocasts as new IconSymbol3DLayer()
- resource: {
- href: imgUrl
- },
- size: newImgWidth,
- outline: {
- color: "white",
- size: 2
- }
- }
- ],
- verticalOffset:{
- screenLength: 20,
- maxWorldLength: 200,
- minWorldLength: 10
- },
- callout: {
- type: "line", // autocasts as new LineCallout3D()
- color: "#36B1E8",
- size: 0,
- border: {
- color: "#36B1E8"
- }
- }
- }
- } else {
- if (color == null) {
- color = [226, 119, 40]
- }
- if (size == null) {
- size = 2
- }
- switch (style) {
- case "x":
- style = "x";
- break;
- case "diamond":
- style = "diamond";
- break;
- case "cross":
- style = "cross";
- break;
- case "square":
- style = "square";
- break;
- default:
- style = "circle"
- }
- markerSymbol = {
- type: "simple-marker",
- color: color,
- style: style,
- size: size
- }
- }
- // debugger;
- var pointGraphic = new Graphic({
- geometry: point,
- symbol: markerSymbol,
- attributes: pointAttribute
- });
- var textSymbol = {
- type: "text", // autocasts as new TextSymbol()
- color: [254, 238, 175],
- text: pointAttribute.名称,
- yoffset: "35px",
- font: { // autocasts as new Font()
- size: 14
- }
- };
- var textGraphic = new Graphic({
- geometry: point,
- symbol: textSymbol
- });
- GraphicsLayer_DrawLayer.add(textGraphic);
- GraphicsLayer_DrawLayer.add(pointGraphic);
- var popupTemplate = {
- title: pointToolTip,
- content: attributesToHTMLStr(pointAttribute)
- };
- // pointGraphic.popupTemplate = popupTemplate;
- var extent = new Extent({
- xmax: pointGraphic.geometry.x - 0 + 250,
- ymax: pointGraphic.geometry.y - 0 + 250,
- xmin: pointGraphic.geometry.x - 250,
- ymin: pointGraphic.geometry.y - 250,
- spatialReference: m_view.spatialReference
- });
- if (xmlQueryExtend) {
- xmlQueryExtend = xmlQueryExtend.union(extent)
- } else {
- xmlQueryExtend = extent
- }
- })
- }
- function xmlAddPointJCZ(x,y, pointToolTip, imgUrl, imgWidth, imgHeight, color, size, style, pointAttribute,radius) {
- require(["esri/geometry/Extent", "esri/Graphic","esri/geometry/Circle"],
- function (Extent, Graphic,Circle) {
- var point;
- point = {
- type: "point",
- x: x,
- y: y,
- spatialReference: m_view.spatialReference
- }
- var markerSymbol;
- if (color == null) {
- color = [0, 0, 0]
- }
- if (size == null) {
- size = 10
- }
- /*switch (style) {
- case "x":
- style = "x";
- break;
- case "diamond":
- style = "diamond";
- break;
- case "cross":
- style = "cross";
- break;
- case "square":
- style = "square";
- break;
- default:
- style = "circle"
- }*/
- markerSymbol = {
- type: "simple-marker",
- color: color,
- style: "circle",
- size: size
- };
- // debugger;
- var pointGraphic = new Graphic({
- geometry: point,
- symbol: markerSymbol,
- attributes: pointAttribute
- });
- var polygon =new Circle( {
- type: "circle",
- center:point,
- radius: radius,
- spatialReference: m_view.spatialReference
- });
- var fillSymbol = {
- type: "simple-fill",
- color:[255, 0, 0,0.3],
- style: "solid",
- outline: {
- color: [255, 255, 255,0.3],
- width: 1
- }
- };
- var circle = new Graphic({
- geometry: polygon,
- symbol: fillSymbol
- });
- //蓝[0,0,255] 绿[0,255,0] 黄[255,255,0]
- GraphicsLayer_DrawLayer.add(pointGraphic);
- GraphicsLayer_DrawLayer.add(circle);
- })
- }
- function btnCircle_Click() {
- drawSquare()
- }
- function drawSquare() {
- require(["esri/Map", "esri/views/MapView", "esri/layers/MapImageLayer", "esri/layers/TileLayer", "esri/geometry/Geometry", "esri/geometry/Extent", "esri/tasks/GeometryService", "esri/layers/GraphicsLayer", "esri/widgets/ScaleBar", "esri/WebMap", "esri/geometry/SpatialReference", "esri/Graphic", "esri/views/2d/draw/Draw", "esri/geometry/Polygon", "esri/geometry/geometryEngine"],
- function (Map, MapView, MapImageLayer, TileLayer, Geometry, Extent, GeometryService, GraphicsLayer, ScaleBar, WebMap, SpatialReference, Graphic, Draw, Polygon, geometryEngine) {
- var action = m_drawtool.create("polygon");
- m_view.focus();
- action.on("vertex-add", drawPolygon);
- action.on("cursor-update", drawPolygon);
- action.on("vertex-remove", drawPolygon);
- action.on("draw-complete", drawPolygon);
- function drawPolygon(evt) {
- var vertices = evt.vertices;
- btClear_Click();
- var polygon = createPolygon(vertices);
- var graphic = createGraphic(polygon);
- GraphicsLayer_DrawLayer.add(graphic);
- queryExtent = polygon
- }
- function createPolygon(vertices) {
- return new Polygon({
- rings: vertices,
- spatialReference: m_view.spatialReference
- })
- }
- function createGraphic(polygon) {
- graphic = new Graphic({
- geometry: polygon,
- symbol: {
- type: "simple-fill",
- color: [178, 102, 234, .8],
- style: "solid",
- outline: {
- color: [255, 255, 255],
- width: 2
- }
- }
- });
- return graphic
- }
- })
- }
- function btQuery_Click() {
- var Str = document.getElementById("txtQueryStr").value;
- var layerName = document.getElementById("txtQueryLayerName").value;
- query(Str, layerName)
- }
- function query(Str, layerName) {
- queryGraphicByDylayer();
- var whereStr = "";
- if (Str == "") {
- whereStr = " 1=1 "
- } else {
- whereStr = " 1=2 ";
- var xmlDoc1 = xmlUtil.loadXmlFromFile("config/layerQueryName.xml");
- var layerXml = xmlDoc1.getElementsByTagName(layerName);
- var mapNodes = layerXml[0].childNodes;
- for (var i = 0; i < mapNodes.length; i++) {
- if (xmlUtil.getNodeTagName(mapNodes[i]) == "name") {
- whereStr += " or " + xmlUtil.getNodeValue(mapNodes[i]) + " like '%" + Str + "%' "
- }
- }
- }
- var layerId = GetLayerIdbyName(layerName);
- if (layerId == -1) {
- alert("没有此图层")
- } else {
- queryGraphicByDylayer(layerId, whereStr)
- }
- }
- function queryGraphicByDylayer(layerId, whereStr, geo) {
- require(["esri/tasks/QueryTask", "esri/tasks/support/Query", "esri/layers/FeatureLayer", "dojo/_base/array", "dojo/dom"],
- function (QueryTask, Query, FeatureLayer, arrayUtils, dom) {
- btClear_Click();
- var urlI = dyLayer.url + "/" + layerId;
- var qTask = new QueryTask({
- url: urlI
- });
- var params = new Query({
- geometry: queryExtent,
- returnGeometry: true,
- outFields: ["*"]
- });
- params.geometry = geo || null;
- params.where = whereStr;
- qTask.execute(params).then(getResults).otherwise(promiseRejected);
- function getResults(response) {
- var peakResults = arrayUtils.map(response.features,
- function (feature) {
- var obj = eval("(" + symble[layerId] + ")");
- var symbolJson = obj.drawingInfo.renderer.symbol;
- if (currentMapMode == "2D") {
- if (symbolJson) {
- if (symbolJson.type == "esriSFS") {
- feature.symbol = {
- type: "simple-fill",
- style: changeStyle(symbolJson.style),
- color: symbolJson.color,
- outline: {
- style: changeStyle(symbolJson.outline.style),
- color: symbolJson.outline.color,
- width: symbolJson.outline.width
- }
- }
- } else if (symbolJson.type == "esriPMS") {
- feature.symbol = {
- type: "picture-marker",
- url: "data:image/png;base64," + symbolJson.imageData,
- width: symbolJson.width,
- height: symbolJson.height
- }
- } else if (symbolJson.type == "esriSMS") {
- feature.symbol = {
- type: "simple-marker",
- size: symbolJson.size,
- color: symbolJson.color,
- outline: symbolJson.outline
- }
- }
- } else {
- feature.symbol = {
- type: "simple-marker",
- color: rgba(255, 0, 0, 1),
- outline: {
- color: [0, 0, 0, 1],
- width: 1
- }
- }
- }
- } else {
- var verticalOffset = {
- screenLength: 40,
- maxWorldLength: 200,
- minWorldLength: 35
- };
- if (symbolJson.type == "esriSFS") {
- feature.symbol = {
- type: "polygon-3d",
- symbolLayers: [{
- type: "fill",
- material: {
- color: symbolJson.color
- }
- }],
- outline: {
- color: symbolJson.outline.color,
- size: symbolJson.outline.size
- }
- }
- } else if (symbolJson.type == "esriPMS") {
- feature.symbol = {
- type: "point-3d",
- symbolLayers: [{
- type: "icon",
- resource: {
- href: "data:image/png;base64," + symbolJson.imageData
- },
- size: 20,
- outline: {
- color: "white",
- size: 2
- }
- }],
- verticalOffset: verticalOffset,
- callout: {
- type: "line",
- color: "white",
- size: 2,
- border: {
- color: "#40C2B4"
- }
- }
- }
- } else if (symbolJson.style == "esriSMSCircle") {
- feature.symbol = {
- type: "point-3d",
- symbolLayers: [{
- type: "icon",
- resource: {
- primitive: "circle"
- },
- size: symbolJson.size * 2,
- material: {
- color: symbolJson.color
- },
- outline: {
- color: symbolJson.outline.color,
- size: symbolJson.outline.size
- }
- }],
- verticalOffset: verticalOffset,
- callout: {
- type: "line",
- color: "white",
- size: 2,
- border: {
- color: "#40C2B4"
- }
- }
- }
- }
- }
- feature.geometry.spatialReference = m_view.spatialReference;
- var popupTemplate = {
- title: "详细信息",
- content: attributesToHTMLStr(feature.attributes)
- };
- feature.popupTemplate = popupTemplate;
- return feature
- });
- GraphicsLayer_myLayer.addMany(peakResults);
- m_view.goTo(peakResults)
- }
- function promiseRejected(err) {
- console.error("错误信息: ", err.message)
- }
- })
- }
- function changeStyle(oldStyle) {
- switch (oldStyle) {
- case "esriSFSBackwardDiagonal":
- oldStyle = "backward-diagonal";
- break;
- case "esriSFSCross":
- oldStyle = "cross";
- break;
- case "esriSFSDiagonalCross":
- oldStyle = "diagonal-cross";
- break;
- case "esriSFSForwardDiagonal":
- oldStyle = "forward-diagonal";
- break;
- case "esriSFSHorizontal":
- oldStyle = "horizontal";
- break;
- case "esriSFSNull":
- oldStyle = "none";
- break;
- case "esriSFSSolid":
- oldStyle = "solid";
- break;
- case "esriSFSVertical":
- oldStyle = "vertical";
- break;
- case "esriSLSDash":
- oldStyle = "dash";
- break;
- case "esriSLSDashDotDot":
- oldStyle = "short-dash-dot-dot";
- break;
- case "esriSLSDot":
- oldStyle = "dot";
- break;
- case "esriSLSNull":
- oldStyle = "none";
- break;
- case "esriSLSDashDot":
- oldStyle = "dash-dot";
- break;
- case "esriSLSSolid":
- oldStyle = "solid";
- break
- }
- return oldStyle
- }
- function openQuickQueryClick() {
- document.getElementById("openQuickQuery").style.display = "none";
- document.getElementById("quickQuery").style.display = "";
- createSelect()
- }
- function closeQuickQueryClick() {
- document.getElementById("openQuickQuery").style.display = "";
- document.getElementById("quickQuery").style.display = "none"
- }
- function createSelect() {
- var areaId = GetLayerIdbyName("特色街区");
- var streetId = GetLayerIdbyName("街道乡镇");
- queryOption(areaId, "areaName");
- queryOption(streetId, "streetName")
- }
- function queryOption(layerId, selectId) {
- require(["esri/tasks/QueryTask", "esri/tasks/support/Query", "esri/layers/FeatureLayer", "dojo/_base/array", "dojo/dom"],
- function (QueryTask, Query, FeatureLayer, arrayUtils, dom) {
- var urlI = dyLayer.url + "/" + layerId;
- var qTask = new QueryTask({
- url: urlI
- });
- var params = new Query({
- geometry: queryExtent,
- returnGeometry: true,
- outFields: ["*"]
- });
- params.where = "1=1";
- qTask.execute(params).then(getResults).otherwise(promiseRejected);
- function getResults(response) {
- var peakResults = arrayUtils.map(response.features,
- function (feature) {
- return feature.attributes["名称"]
- });
- var option = "<option value='-1'>全部</option>";
- for (var i = 0; i < peakResults.length; i++) {
- option += "<option value='" + peakResults[i] + "'>" + peakResults[i] + "</option>"
- }
- document.getElementById(selectId).innerHTML = option
- }
- function promiseRejected(err) {
- console.error("错误信息: ", err.message)
- }
- })
- }
- function changeAreaNameSelect() {
- var optionValue = areaName.value;
- if (optionValue == -1) {
- GraphicsLayer_DrawLayer.removeAll();
- queryExtent = null
- } else {
- var areaId = GetLayerIdbyName("特色街区");
- queryGraphicBySelect(areaId, optionValue)
- }
- }
- function changeStreetNameSelect() {
- var optionValue = streetName.value;
- if (optionValue == -1) {
- GraphicsLayer_DrawLayer.removeAll();
- queryExtent = null
- } else {
- var streetId = GetLayerIdbyName("街道乡镇");
- queryGraphicBySelect(streetId, optionValue)
- }
- }
- function queryGraphicBySelect(layerId, name) {
- require(["esri/tasks/QueryTask", "esri/tasks/support/Query", "esri/layers/FeatureLayer", "dojo/_base/array", "esri/Graphic", "dojo/dom"],
- function (QueryTask, Query, FeatureLayer, arrayUtils, Graphic, dom) {
- GraphicsLayer_DrawLayer.removeAll();
- queryExtent = null;
- var urlI = dyLayer.url + "/" + layerId;
- var qTask = new QueryTask({
- url: urlI
- });
- var params = new Query({
- geometry: queryExtent,
- returnGeometry: true,
- outFields: ["*"]
- });
- params.where = "名称 = '" + name + "'";
- qTask.execute(params).then(getResults).otherwise(promiseRejected);
- function getResults(response) {
- var peakResults = arrayUtils.map(response.features,
- function (feature) {
- if (currentMapMode == "2D") {
- feature.symbol = {
- type: "simple-fill",
- style: "none",
- color: null,
- outline: {
- style: "solid",
- color: "red",
- width: 2
- }
- };
- feature.geometry.spatialReference = m_view.spatialReference;
- queryExtent = feature.geometry;
- feature.geometry.spatialReference = m_view.spatialReference;
- return feature
- } else {
- for (var i = 0; i < feature.geometry.rings[0].length; i++) {
- feature.geometry.rings[0][i].push(1)
- }
- var polygon = {
- type: "polygon",
- rings: feature.geometry.rings
- };
- var polygonGraphic = new Graphic({
- geometry: polygon
- });
- polygonGraphic.symbol = {
- type: "polygon-3d",
- symbolLayers: [{
- type: "fill",
- material: {
- color: [0, 0, 0, 0]
- },
- outline: {
- color: "red",
- size: "4px"
- }
- }]
- }
- }
- queryExtent = feature.geometry;
- polygonGraphic.geometry.spatialReference = m_view.spatialReference;
- return polygonGraphic
- });
- GraphicsLayer_DrawLayer.addMany(peakResults);
- m_view.goTo(peakResults[0].geometry.extent.expand(2))
- }
- function promiseRejected(err) {
- console.error("错误信息: ", err.message)
- }
- })
- }
- function Polygon_Click() {
- queryExtent = null;
- require(["esri/Map", "esri/views/MapView", "esri/layers/MapImageLayer", "esri/layers/TileLayer", "esri/geometry/Geometry", "esri/geometry/Extent", "esri/tasks/GeometryService", "esri/layers/GraphicsLayer", "esri/widgets/ScaleBar", "esri/WebMap", "esri/geometry/SpatialReference", "esri/Graphic", "esri/views/2d/draw/Draw", "esri/geometry/Polygon", "esri/geometry/geometryEngine"],
- function (Map, MapView, MapImageLayer, TileLayer, Geometry, Extent, GeometryService, GraphicsLayer, ScaleBar, WebMap, SpatialReference, Graphic, Draw, Polygon, geometryEngine) {
- var action = m_drawtool.create("polygon");
- m_view.focus();
- action.on("vertex-add", drawPolygon);
- action.on("cursor-update", drawPolygon);
- action.on("vertex-remove", drawPolygon);
- action.on("draw-complete", drawPolygon);
- function drawPolygon(evt) {
- var vertices = evt.vertices;
- GraphicsLayer_DrawLayer.removeAll();
- var polygon = createPolygon(vertices);
- var graphic = createGraphic(polygon);
- GraphicsLayer_DrawLayer.add(graphic);
- queryExtent = polygon
- }
- function createPolygon(vertices) {
- return new Polygon({
- rings: vertices,
- spatialReference: m_view.spatialReference
- })
- }
- function createGraphic(polygon) {
- graphic = new Graphic({
- geometry: polygon,
- symbol: {
- type: "simple-fill",
- style: "none",
- color: null,
- outline: {
- style: "solid",
- color: "red",
- width: 2
- }
- }
- });
- return graphic
- }
- })
- }
- function btnQuickQuery() {
- queryList.splice(0, queryList.length);
- var layerName = select_zylx.value;
- var zymc = txt_zymc.value;
- var keyStr = txt_keyStr.value;
- dynamicLayerURL = GetConfigDataByName("QueryLayer");
- var layerId = GetLayerIdbyName(layerName);
- var whereStr = " 1=1 ";
- var optgroup = select_zylx.options[select_zylx.selectedIndex].parentNode.attributes;
- if (optgroup["label"]) {
- if (zymc) {
- switch (layerName) {
- case "ETPS":
- whereStr += " and ETPS_NAME like '%" + zymc + "%' ";
- break;
- case "PE":
- whereStr += " and NAME like '%" + zymc + "%' ";
- break;
- case "CORP":
- whereStr += " and CORP_NAME like '%" + zymc + "%' ";
- break
- }
- }
- if (keyStr) {
- whereStr += "and ADDRESS like '%" + keyStr + "%'"
- }
- } else {
- if (layerName == "YDYZ") {
- if (zymc) {
- whereStr += "and MDNAME like '%" + zymc + "%'"
- }
- if (keyStr) {
- whereStr += "and ADDRESS like '%" + keyStr + "%'"
- }
- } else {
- if (zymc) {
- whereStr += "and 载体名称 like '%" + zymc + "%'"
- }
- if (keyStr) {
- whereStr += "and 载体地址 like '%" + keyStr + "%'"
- }
- }
- }
- doQuickQuery(layerId, whereStr)
- }
- function doQuickQuery(layerId, whereStr) {
- require(["esri/tasks/QueryTask", "esri/tasks/support/Query", "esri/layers/FeatureLayer", "dojo/_base/array", "dojo/dom"],
- function (QueryTask, Query, FeatureLayer, arrayUtils, dom) {
- var layerStr = "";
- var layerName = select_zylx.value;
- var optgroup = select_zylx.options[select_zylx.selectedIndex].parentNode.attributes;
- if (optgroup["label"]) {
- switch (layerName) {
- case "ETPS":
- layerStr = "ETPS_NAME";
- break;
- case "PE":
- layerStr = "NAME";
- break;
- case "CORP":
- layerStr = "CORP_NAME";
- break
- }
- } else {
- if (layerName == "YDYZ") {
- layerStr = "MDNAME"
- } else {
- layerStr = "载体名称"
- }
- }
- GraphicsLayer_fickerLayer.removeAll();
- GraphicsLayer_myLayer.removeAll();
- if (!dynamicLayerURL) {
- dynamicLayerURL = GetConfigDataByName("QueryLayer")
- }
- var urlI = dynamicLayerURL + "/" + layerId;
- var qTask = new QueryTask({
- url: urlI
- });
- var params = new Query({
- geometry: queryExtent,
- returnGeometry: true,
- outFields: ["*"]
- });
- params.where = whereStr;
- qTask.execute(params).then(getResults).otherwise(promiseRejected);
- function getResults(response) {
- var peakResults = arrayUtils.map(response.features,
- function (feature) {
- if (currentMapMode == "2D") {
- var obj = eval("(" + symble[layerId] + ")");
- var symbolJson = obj.drawingInfo.renderer.symbol;
- if (symbolJson.type == "esriSFS") {
- feature.symbol = {
- type: "simple-fill",
- style: changeStyle(symbolJson.style),
- color: symbolJson.color,
- outline: {
- style: changeStyle(symbolJson.outline.style),
- color: symbolJson.outline.color,
- width: symbolJson.outline.width
- }
- }
- } else if (symbolJson.type == "esriPMS") {
- feature.symbol = {
- type: "picture-marker",
- url: "data:image/png;base64," + symbolJson.imageData,
- width: symbolJson.width,
- height: symbolJson.height
- }
- } else if (symbolJson.style == "esriSMSCircle") {
- feature.symbol = {
- type: "simple-marker",
- style: "circle",
- color: symbolJson.color,
- size: symbolJson.size,
- outline: {
- color: symbolJson.outline.color,
- width: symbolJson.outline.width
- }
- }
- }
- } else {
- var verticalOffset = {
- screenLength: 40,
- maxWorldLength: 200,
- minWorldLength: 35
- };
- var obj = eval("(" + symble[layerId] + ")");
- var symbolJson = obj.drawingInfo.renderer.symbol;
- if (symbolJson.type == "esriSFS") {
- } else if (symbolJson.type == "esriPMS") {
- feature.symbol = {
- type: "point-3d",
- symbolLayers: [{
- type: "icon",
- resource: {
- href: "data:image/png;base64," + symbolJson.imageData
- },
- size: 20,
- outline: {
- color: "white",
- size: 2
- }
- }],
- verticalOffset: verticalOffset,
- callout: {
- type: "line",
- color: "white",
- size: 2,
- border: {
- color: "#40C2B4"
- }
- }
- }
- } else if (symbolJson.style == "esriSMSCircle") {
- feature.symbol = {
- type: "point-3d",
- symbolLayers: [{
- type: "icon",
- resource: {
- primitive: "circle"
- },
- size: symbolJson.size * 2,
- material: {
- color: symbolJson.color
- },
- outline: {
- color: symbolJson.outline.color,
- size: symbolJson.outline.size
- }
- }],
- verticalOffset: verticalOffset,
- callout: {
- type: "line",
- color: "white",
- size: 2,
- border: {
- color: "#40C2B4"
- }
- }
- }
- }
- }
- feature.geometry.spatialReference = m_view.spatialReference;
- var popupTemplate = {
- title: "资源信息",
- content: openInfoWin(feature.attributes)
- };
- feature.popupTemplate = popupTemplate;
- var list = {
- "名称": feature.attributes[layerStr],
- "几何": feature
- };
- queryList.push(list);
- return feature
- });
- GraphicsLayer_myLayer.addMany(peakResults);
- m_view.goTo(peakResults);
- dom.byId("printResults").innerHTML = "资产数:<a onclick='openResultTable()'> " + peakResults.length + "</a>"
- }
- function promiseRejected(err) {
- console.error("错误信息: ", err.message)
- }
- })
- }
- function openResultTable() {
- document.getElementById("resultList").style.display = "";
- dyCretateTableByArray("resultListTable", queryList, ["名称"], ["名称"], false)
- }
- function closeResultList() {
- document.getElementById("resultList").style.display = "none"
- }
- function openInfoWin(att) {
- var str = "";
- switch (select_zylx.value) {
- case "CORP":
- {
- str = quickQueryAttributesToHTMLStr(att);
- break
- }
- case "ETPS":
- {
- str = quickQueryAttributesToHTMLStr(att);
- break
- }
- case "PE":
- {
- str = quickQueryAttributesToHTMLStr(att);
- break
- }
- case "PARK":
- {
- str = quickQueryIFrameToHTMLStr(att);
- break
- }
- case "BUILDING":
- {
- str = quickQueryIFrameToHTMLStr(att);
- break
- }
- case "YDYZ":
- {
- str = quickQueryAttributesToHTMLStr(att);
- break
- }
- }
- return str
- }
- function quickQueryAttributesToHTMLStr(att) {
- var arList = [];
- var linkURL = "";
- var id;
- var username;
- var pwd;
- switch (select_zylx.value) {
- case "CORP":
- {
- arList = [{
- cname: "CORP_NAME",
- showname: "组织名称"
- },
- {
- cname: "ADDRESS",
- showname: "地址"
- }];
- id = String(att.CORP_INFO_ID);
- username = "wdzc";
- pwd = "68cf63c62bc68d71fc41c028375e2f6e";
- linkURL = "http://10.214.3.195:8001/coop/syn/detail_register_view_out?ifEncrypt=0&userName=" + username + "&passWord=" + pwd + "&entyId=" + id + "&type=06";
- break
- }
- case "ETPS":
- {
- arList = [{
- cname: "UNISC_ID",
- showname: "统一社会信用代码"
- },
- {
- cname: "REG_NO",
- showname: "注册号"
- },
- {
- cname: "ETPS_NAME",
- showname: "企业名称"
- },
- {
- cname: "ADDRESS",
- showname: "住所"
- }];
- id = String(att.ETPS_ID);
- username = "wdzc";
- pwd = "68cf63c62bc68d71fc41c028375e2f6e";
- linkURL = "http://10.214.3.195:8001/coop/syn/detail_register_view_out?ifEncrypt=0&userName=" + username + "&passWord=" + pwd + "&entyId=" + id + "&type=02";
- break
- }
- case "PE":
- {
- arList = [{
- cname: "UNISC_ID",
- showname: "统一社会信用代码"
- },
- {
- cname: "REG_NO",
- showname: "注册号"
- },
- {
- cname: "NAME",
- showname: "个体名称"
- },
- {
- cname: "ADDRESS",
- showname: "地址"
- }];
- id = String(att.PE_ID);
- username = "wdzc";
- pwd = "68cf63c62bc68d71fc41c028375e2f6e";
- linkURL = "http://10.214.3.195:8001/coop/syn/detail_register_view_out?ifEncrypt=0&userName=" + username + "&passWord=" + pwd + "&entyId=" + id + "&type=05";
- break
- }
- case "YDYZ":
- {
- arList = [{
- cname: "MDNAME",
- showname: "门店名称"
- },
- {
- cname: "ADDRESS",
- showname: "详细地址"
- },
- {
- cname: "STREET",
- showname: "街道"
- },
- {
- cname: "ROAD",
- showname: "道路"
- },
- {
- cname: "JYZLENUMITEM",
- showname: "经营种类"
- },
- {
- cname: "JYZL",
- showname: "经营种类(其他)"
- },
- {
- cname: "FW_SX",
- showname: "房屋属性"
- },
- {
- cname: "MZDW_BZ",
- showname: "备注(基本信息)"
- },
- {
- cname: "ZZ_QK",
- showname: "证照情况"
- },
- {
- cname: "JYZ",
- showname: "经营者"
- },
- {
- cname: "JYZ_IDCARD",
- showname: "身份证(经营者)"
- },
- {
- cname: "JYZ_LXDZ",
- showname: "联系地址(经营者)"
- },
- {
- cname: "JYZ_JG",
- showname: "籍贯(经营者)"
- },
- {
- cname: "JYZ_ZZDZ",
- showname: "暂住地址(经营者)"
- },
- {
- cname: "ZZ_BZ",
- showname: "备注(证照情况)"
- },
- {
- cname: "FD_NAME",
- showname: "房东姓名/单位"
- },
- {
- cname: "FD_JG",
- showname: "籍贯(房东)"
- },
- {
- cname: "FD_LXDZ",
- showname: "联系地址(房东)"
- },
- {
- cname: "FD_LXFS",
- showname: "联系方式(房东)"
- },
- {
- cname: "FD_BZ",
- showname: "备注(房东)"
- },
- {
- cname: "JYZ_LXFS",
- showname: "联系方式(经营者)"
- },
- {
- cname: "FW_BZ",
- showname: "备注(房屋)"
- },
- {
- cname: "JYMJ",
- showname: "经营面积"
- },
- {
- cname: "QT_ZRDY",
- showname: "责任队员"
- },
- {
- cname: "ORGAN",
- showname: "部门"
- },
- {
- cname: "QT_SSGD",
- showname: "所属岗段"
- },
- {
- cname: "JW_LD",
- showname: "居委领导"
- },
- {
- cname: "ROADTYPE",
- showname: "道路类型"
- },
- {
- cname: "NUM",
- showname: "门牌号"
- },
- {
- cname: "GRIDCENTER",
- showname: "网格中心"
- },
- {
- cname: "QT_WG",
- showname: "网格"
- },
- {
- cname: "ZZ_SX",
- showname: "证照属性"
- },
- {
- cname: "JW_NAME",
- showname: "居委名称"
- },
- {
- cname: "JW_LXDH",
- showname: "联系电话(居委)"
- },
- {
- cname: "ZXZTSJ",
- showname: "注销状态时间"
- },
- {
- cname: "CFAJH",
- showname: "曾经是否处罚过"
- },
- {
- cname: "JE",
- showname: "金额(处罚)"
- },
- {
- cname: "OPTIME",
- showname: "操作时间"
- },
- {
- cname: "ISZY",
- showname: "是否重要"
- },
- {
- cname: "QT_LXFS",
- showname: "联系方式"
- },
- {
- cname: "OPUSER",
- showname: "操作人"
- },
- {
- cname: "JYZ_BZ",
- showname: "备注"
- },
- {
- cname: "ZXZT",
- showname: "注销状态"
- },
- {
- cname: "BZ",
- showname: "备注"
- },
- {
- cname: "LONG1",
- showname: "经度gps"
- },
- {
- cname: "LAT",
- showname: "纬度gps"
- }];
- id = String(att.ROWGUID);
- username = "wdzc";
- pwd = "68cf63c62bc68d71fc41c028375e2f6e";
- linkURL = "http://10.214.3.195:8001/coop/syn/detail_register_view_out?ifEncrypt=0&userName=" + username + "&passWord=" + pwd + "&entyId=" + id + "&type=05";
- break
- }
- }
- var str = "";
- for (var name in att) {
- for (var i = 0; i < arList.length; i++) {
- if (name == arList[i].cname) {
- str += arList[i].showname + ":" + att[name] + "<br>"
- }
- }
- }
- str += "<br><a href='" + linkURL + "' target='blank'>[点击详情信息]</a>";
- return str
- }
- function quickQueryIFrameToHTMLStr(att) {
- var sourceid = String(att.主键);
- var url = "";
- switch (select_zylx.value) {
- case "PARK":
- {
- url = "http://10.214.4.162:8080/parkms/tj/parksysSuperviseCD_SSLDL.action?systemsign=408080a758f26bb00158f26f13f30001&is_Park=1&buildingInfosId=" + sourceid;
- break
- }
- case "BUILDING":
- {
- url = "http://10.214.4.162:8080/parkms/tj/parksysSuperviseCD_SSLDL.action?systemsign=408080a758f26bb00158f26f13f30001&is_Park=2&buildingInfosId=" + sourceid;
- break
- }
- }
- var str = " <div style='width:600px;height:500px;'><iframe src='" + url + "' width='100%' height='100%' frameborder='1' scrolling='yes'></iframe></div>";
- return str
- }
- function openQuery() {
- document.getElementById("query").style.display = "";
- document.getElementById("queryReult1").style.display = "";
- document.getElementById("queryReult2").style.display = "none";
- document.getElementById("return").style.display = "none";
- document.getElementById("barcon1").style.display = "";
- document.getElementById("barcon2").style.display = "none";
- document.getElementById("name").value = "";
- document.getElementById("queryTable1").innerHTML = "";
- document.getElementById("barcon1").innerHTML = "";
- createLayerSelect("quertLayerSelect")
- }
- function closeQuery() {
- document.getElementById("query").style.display = "none"
- }
- function returnQueryList() {
- document.getElementById("queryReult1").style.display = "";
- document.getElementById("queryReult2").style.display = "none";
- document.getElementById("return").style.display = "none";
- document.getElementById("barcon1").style.display = "";
- document.getElementById("barcon2").style.display = "none"
- }
- function queryByWhere() {
- document.getElementById("queryReult1").style.display = "";
- document.getElementById("queryReult2").style.display = "none";
- var name = document.getElementById("name").value;
- if (name == "") {
- alert("请输入查询内容");
- return
- }
- queryExtent = null;
- btClear_Click();
- queryAll()
- }
- function newOpenLayer(layerName, type, name, isGoTo, isOpen) {
- if (type == 1) {
- type = "街道乡镇";
- }
- else if (type == 2) {
- type = "区县边界";
- }
- else {
- return;
- }
- var layerId = GetFeatureLayerIdbyName(type);
- var where = "";
- var attributename = "";
- var layerCondition = "";
- if (type == "街道乡镇") {
- where = "街道名称 = '" + name + "'";
- attributename = "街道代码";
- layerCondition = "街道代码";
- }
- else {
- where = "区县名称 = '" + name + "'";
- attributename = "区县代码";
- layerCondition = "区代码";
- }
- if (layerId == -1) {
- window.parent.postMessage(
- {
- method: "newOpenLayer",
- data: ["参数type填写错误"]
- },
- '*'
- );
- }
- else {
- require(["esri/tasks/QueryTask", "esri/tasks/support/Query", "esri/layers/FeatureLayer", "dojo/_base/array", "dojo/dom"],
- function (QueryTask, Query, FeatureLayer, arrayUtils, dom) {
- var urlI = dyLayer.url + "/" + layerId;
- var restUrl = urlI + "?f=pjson";
- var xmlHttpRest = GetXmlHttpObject();
- xmlHttpRest.open("GET", restUrl, true);
- xmlHttpRest.send();
- xmlHttpRest.onreadystatechange = function () {
- if (xmlHttpRest.readyState == 4) {
- var responseText = xmlHttpRest.responseText;
- var LayerJsonData = JSON.parse(responseText);
- var qTask = new QueryTask({
- url: urlI
- });
- var params = new Query({
- geometry: queryExtent,
- returnGeometry: true,
- outFields: ["*"]
- });
- //params.spatialRelationship = "intersects";
- //params.geometry = geo || null;
- params.where = where;
- qTask.execute(params).then(getResults).otherwise(promiseRejected);
- function getResults(response) {
- if (response.features.length == 0) {
- window.parent.postMessage(
- {
- method: "newOpenLayer",
- data: ["参数name填写错误"]
- },
- '*'
- );
- return;
- }
- var feature = response.features[0];
- var attributewhere = response.features[0].attributes[attributename];
- var layerwhere = layerCondition + "='" + attributewhere + "'";
- // var symbolJson = LayerJsonData.drawingInfo.renderer;
- newOpenLayerbyWhere(layerName, isOpen, layerCondition, attributewhere);
- if (isGoTo) {
- m_view.goTo(feature.geometry);
- }
- }
- function promiseRejected(err) {
- //console.error("错误信息: ", err.message);
- }
- }
- };
- });
- }
- }
- function newOpenLayerbyWhere(layerName, layerVisible, layerCondition, attributewhere) {
- if (!layerVisible) {
- var layerId = GetFeatureLayerIdbyName(layerName);
- // var qxlayerId = GetQXFeatureLayerIdbyName(layerName);
- for (var i = 0; i < m_map.layers.length; i++) {
- var BaseLayer = m_map.layers.getItemAt(i);
- if (BaseLayer.declaredClass == "esri.layers.FeatureLayer") {
- var layer = m_map.layers.getItemAt(i);
- if (layer.id == layerId) {
- // m_map.layers.getItemAt(i).renderer = layerRenerer;
- m_map.layers.getItemAt(i).visible = layerVisible;
- m_map.remove(m_map.layers.getItemAt(i));
- }
- if (layer.id == layerId + "_qx") {
- // m_map.layers.getItemAt(i).renderer = layerRenerer;
- m_map.layers.getItemAt(i).visible = layerVisible;
- m_map.remove(m_map.layers.getItemAt(i));
- }
- }
- }
- return;
- }
- require(["esri/layers/FeatureLayer", "dojo/on"], function (FeatureLayer, on) {
- var serverUrl = GetConfigDataByName("MYFeatureLayerLayer");
- var layerId = GetFeatureLayerIdbyName(layerName);
- var qxserverUrl = GetConfigDataByName("MYQXFeatureLayer");
- var qxlayerId = GetQXFeatureLayerIdbyName(layerName);
- var isnewFeatureLayer = true;
- for (var i = 0; i < m_map.layers.length; i++) {
- var BaseLayer = m_map.layers.getItemAt(i);
- if (BaseLayer.declaredClass == "esri.layers.FeatureLayer") {
- var layer = m_map.layers.getItemAt(i);
- if (layer.id == layerId) {
- // m_map.layers.getItemAt(i).renderer = layerRenerer;
- m_map.layers.getItemAt(i).visible = layerVisible;
- isnewFeatureLayer = false;
- }
- if (layer.id == layerId + "_qx") {
- m_map.layers.getItemAt(i).visible = layerVisible;
- isnewFeatureLayer = false;
- }
- }
- }
- if (isnewFeatureLayer) {
- var dyLayer = new FeatureLayer({
- url: serverUrl + "/" + layerId,
- id: layerId,
- definitionExpression: layerCondition + "=" + attributewhere
- });
- var qxdyLayer;
- if (qxlayerId != -1) {
- qxdyLayer = new FeatureLayer({
- url: qxserverUrl + "/" + qxlayerId,
- id: layerId + "_qx",
- definitionExpression: layerCondition + "=" + attributewhere
- });
- qxdyLayer.visible = layerVisible;
- qxdyLayer.outFields = ["*"];
- m_map.add(qxdyLayer, 1);
- }
- var clusterConfig = {
- type: "cluster",
- clusterRadius: "50px"
- };
- // dyLayer.renderer = layerRenerer;
- // dyLayer.featureReduction = clusterConfig;
- dyLayer.visible = layerVisible;
- dyLayer.outFields = ["*"];
- m_map.add(dyLayer, 2);
- }
- });
- // require([
- // "esri/layers/FeatureLayer",
- // "dojo/on"
- // ], function ( FeatureLayer,on) {
- // var layerId = GetFeatureLayerIdbyName(layerName);
- // var urlI = dyLayer.url + "/" + layerId;
- // var restUrl = urlI + "?f=pjson";
- // var xmlHttpRest = GetXmlHttpObject();
- // xmlHttpRest.open("GET", restUrl, true);
- // xmlHttpRest.send();
- // xmlHttpRest.onreadystatechange = function() {
- // if (xmlHttpRest.readyState == 4) {
- // var responseText = xmlHttpRest.responseText;
- // var LayerJsonData = JSON.parse(responseText);
- // var renderer = LayerJsonData.drawingInfo.renderer;
- // var newsymbol;
- // var symbol = LayerJsonData.drawingInfo.renderer.symbol;
- // if (LayerJsonData) {
- // if (symbol.type == "esriSFS") {
- // newsymbol = {
- // type: "simple-fill",
- // style: changeStyle(symbol.style),
- // color: symbol.color,
- // outline: {
- // style: changeStyle(symbol.outline.style),
- // color: symbol.outline.color,
- // width: symbol.outline.width
- // }
- // }
- // } else if (symbol.type == "esriPMS") {
- // newsymbol = {
- // type: "picture-marker",
- // url: "data:image/png;base64," + symbol.imageData,
- // width: symbol.width,
- // height: symbol.height
- // }
- // } else if (symbol.type == "esriSMS") {
- // newsymbol = {
- // type: "simple-marker",
- // size: symbol.size,
- // color: symbol.color,
- // outline: symbol.outline
- // }
- // }
- // }
- //
- //
- // var layerRenerer = {
- // type: "unique-value",
- // field: layerCondition,
- // uniqueValueInfos: [{
- // value: attributewhere,
- // symbol: newsymbol
- // }]
- // };
- //
- //
- // var serverUrl = GetConfigDataByName("MYFeatureLayerLayer");
- //
- // var isnewFeatureLayer = true;
- // for (var i = 0; i < m_map.layers.length; i++) {
- // var BaseLayer = m_map.layers.getItemAt(i);
- // if (BaseLayer.declaredClass == "esri.layers.FeatureLayer") {
- // var layer = m_map.layers.getItemAt(i);
- // if (layer.id == layerId) {
- // m_map.layers.getItemAt(i).renderer = layerRenerer;
- // m_map.layers.getItemAt(i).visible = layerVisible;
- // isnewFeatureLayer = false;
- // break;
- // }
- // }
- // }
- // if(isnewFeatureLayer){
- // var dyLayer = new FeatureLayer({
- // url: serverUrl+"/"+layerId,
- // id: layerId,
- // definitionExpression: layerCondition+"="+attributewhere
- // });
- // var clusterConfig={
- // type: "cluster",
- // clusterRadius: "50px"
- // };
- // // dyLayer.renderer = layerRenerer;
- // dyLayer.visible = layerVisible;
- // dyLayer.outFields = ["*"];
- // m_map.add(dyLayer,1);
- // dyLayer.featureReduction = clusterConfig;
- // }
- // }
- // };
- // });
- }
- function setLayerCluster(layerName, iscluster) {
- var layerId = GetFeatureLayerIdbyName(layerName);
- for (var i = 0; i < m_map.layers.length; i++) {
- var BaseLayer = m_map.layers.getItemAt(i);
- if (BaseLayer.declaredClass == "esri.layers.FeatureLayer") {
- var layer = m_map.layers.getItemAt(i);
- if (layer.id == layerId) {
- // m_map.layers.getItemAt(i).visible = layerVisible;
- if (iscluster) {
- m_map.layers.getItemAt(i).featureReduction = {
- type: "cluster",
- clusterRadius: "50px"
- };
- }
- else {
- m_map.layers.getItemAt(i).featureReduction = null;
- }
- break;
- }
- }
- }
- }
- function newQuerybyWhereStr(whereStr, layerName, url, geo, isshow, isGoTo) {
- if (whereStr == "")
- whereStr = "1=1";
- if (isshow == undefined || isshow == null)
- isshow = true;
- if (isGoTo == undefined || isGoTo == null)
- isGoTo = true;
- var layerId = GetFeatureLayerIdbyName(layerName);
- if (layerId == -1) {
- // alert("没有此图层");
- window.parent.postMessage(
- {
- method: "queryByGeometryAndLayer",
- data: ["没有此图层"]
- },
- '*'
- );
- } else {
- newQueryGraphicByDylayer(layerId, whereStr, url, geo, isshow, isGoTo);
- }
- }
- function newQueryGraphicByDylayer(layerId, whereStr, url, geo, isshow, isGoTo) {
- require(["esri/tasks/QueryTask", "esri/tasks/support/Query", "esri/layers/FeatureLayer", "dojo/_base/array", "dojo/dom"],
- function (QueryTask, Query, FeatureLayer, arrayUtils, dom) {
- btClear_Click();
- var urlI = dyLayer.url + "/" + layerId;
- var restUrl = urlI + "?f=pjson";
- var xmlHttpRest = GetXmlHttpObject();
- xmlHttpRest.open("GET", restUrl, true);
- xmlHttpRest.send();
- xmlHttpRest.onreadystatechange = function () {
- var responseText = xmlHttpRest.responseText;
- if (xmlHttpRest.readyState == 4) {
- var LayerJsonData = JSON.parse(responseText);
- var qTask = new QueryTask({
- url: urlI
- });
- var params = new Query({
- geometry: queryExtent,
- returnGeometry: true,
- outFields: ["*"]
- });
- params.spatialRelationship = "intersects";
- params.geometry = geo || null;
- params.where = whereStr;
- qTask.execute(params).then(getResults).otherwise(promiseRejected);
- function getResults(response) {
- if (response.features.length == 0) {
- window.parent.postMessage(
- {
- method: "queryByGeometryAndLayer",
- data: []
- },
- '*'
- );
- return;
- }
- var attributesArr = [];
- var peakResults = arrayUtils.map(response.features,
- function (feature) {
- var obj = LayerJsonData;
- attributesArr.push(feature.attributes);
- var symbolJson = obj.drawingInfo.renderer.symbol;
- if (currentMapMode == "2D") {
- if (symbolJson) {
- if (symbolJson.type == "esriSFS") {
- feature.symbol = {
- type: "simple-fill",
- style: changeStyle(symbolJson.style),
- color: symbolJson.color,
- outline: {
- style: changeStyle(symbolJson.outline.style),
- color: symbolJson.outline.color,
- width: symbolJson.outline.width
- }
- }
- } else if (symbolJson.type == "esriPMS") {
- feature.symbol = {
- type: "picture-marker",
- url: "data:image/png;base64," + symbolJson.imageData,
- width: symbolJson.width,
- height: symbolJson.height
- }
- } else if (symbolJson.type == "esriSMS") {
- feature.symbol = {
- type: "simple-marker",
- size: symbolJson.size,
- color: symbolJson.color,
- outline: symbolJson.outline
- }
- }
- } else {
- feature.symbol = {
- type: "simple-marker",
- color: rgba(255, 0, 0, 1),
- outline: {
- color: [0, 0, 0, 1],
- width: 1
- }
- }
- }
- } else {
- var verticalOffset = {
- screenLength: 40,
- maxWorldLength: 200,
- minWorldLength: 35
- };
- if (symbolJson.type == "esriSFS") {
- feature.symbol = {
- type: "polygon-3d",
- symbolLayers: [{
- type: "fill",
- material: {
- color: symbolJson.color
- }
- }],
- outline: {
- color: symbolJson.outline.color,
- size: symbolJson.outline.size
- }
- }
- } else if (symbolJson.type == "esriPMS") {
- feature.symbol = {
- type: "point-3d",
- symbolLayers: [{
- type: "icon",
- resource: {
- href: "data:image/png;base64," + symbolJson.imageData
- },
- size: 20,
- outline: {
- color: "white",
- size: 2
- }
- }],
- verticalOffset: verticalOffset,
- callout: {
- type: "line",
- color: "white",
- size: 2,
- border: {
- color: "#40C2B4"
- }
- }
- }
- } else if (symbolJson.style == "esriSMSCircle") {
- feature.symbol = {
- type: "point-3d",
- symbolLayers: [{
- type: "icon",
- resource: {
- primitive: "circle"
- },
- size: symbolJson.size * 2,
- material: {
- color: symbolJson.color
- },
- outline: {
- color: symbolJson.outline.color,
- size: symbolJson.outline.size
- }
- }],
- verticalOffset: verticalOffset,
- callout: {
- type: "line",
- color: "white",
- size: 2,
- border: {
- color: "#40C2B4"
- }
- }
- }
- }
- }
- feature.geometry.spatialReference = m_view.spatialReference;
- var popupTemplate = {
- title: "详细信息",
- content: attributesToHTMLStr(feature.attributes)
- };
- // feature.popupTemplate = popupTemplate;
- return feature
- });
- if (isshow) {
- GraphicsLayer_myLayer.addMany(peakResults);
- if (isGoTo) {
- m_view.goTo(peakResults);
- }
- }
- window.parent.postMessage(
- {
- method: "queryByGeometryAndLayer",
- data: [attributesArr]
- },
- '*'
- );
- }
- function promiseRejected(err) {
- console.error("错误信息: ", err.message);
- }
- }
- }
- });
- }
- function querybyWhereStr(whereStr, layerName) {
- if (whereStr == "") {
- whereStr = " 1=1 "
- }
- var layerId = GetFeatureLayerIdbyName(layerName);
- if (layerId == -1) {
- alert("没有此图层")
- } else {
- queryGraphicByDylayer(layerId, whereStr, "http://10.101.35.46:6080/arcgis/rest/services/WJJBH/FeatureServer")
- }
- }
- function GetFeatureLayerIdbyName(layerName) {
- var layerId = -1;
- if (extraLayerJsonData != "") {
- var layers = extraLayerJsonData.layers;
- if (layers.length > 0) {
- for (var i = 0; i < layers.length; i++) {
- // if (layers[i].name == layerName && layers[i].subLayerIds == null) {
- // layerId = layers[i].id;
- // break;
- // }
- if (layers[i].name == layerName) {
- if (layers[i].subLayerIds == null) {
- layerId = layers[i].id;
- }
- else {
- if (layers[i].subLayerIds.length == 1)
- layerId = layers[i].subLayerIds[0];
- else
- layerId = layers[i].subLayerIds[1];
- }
- break;
- }
- }
- }
- }
- return layerId;
- }
- function GetQXFeatureLayerIdbyName(layerName) {
- var layerId = -1;
- if (qxLayerJsonData != "") {
- var layers = qxLayerJsonData.layers;
- if (layers.length > 0) {
- for (var i = 0; i < layers.length; i++) {
- // if (layers[i].name == layerName && layers[i].subLayerIds == null) {
- // layerId = layers[i].id;
- // break;
- // }
- if (layers[i].name == layerName) {
- if (layers[i].subLayerIds == null) {
- layerId = layers[i].id;
- }
- else {
- if (layers[i].subLayerIds.length == 1)
- layerId = layers[i].subLayerIds[0];
- else
- layerId = layers[i].subLayerIds[1];
- }
- break;
- }
- }
- }
- }
- return layerId;
- }
- function queryAll() {
- queryList.splice(0, queryList.length);
- if (currentMapMode == "3D") {
- var select = document.getElementById("quertLayerSelect");
- queryRecursive(select.value)
- } else {
- queryRecursive(0);
- progress("0%")
- }
- }
- function queryRecursive(j) {
- var layerInfo = GetDynamicServiceLayer();
- if (currentMapMode == "2D") {
- if (j == Math.ceil(layerInfo.length / 4)) {
- progress("30%")
- }
- if (j === Math.ceil(layerInfo.length / 2)) {
- progress("60%")
- }
- if (j === Math.ceil(layerInfo.length * 3 / 4)) {
- progress("90%")
- }
- if (j >= layerInfo.length) {
- progress("100%")
- }
- }
- var name = document.getElementById("name").value;
- if (j == layerInfo.length) {
- if (queryList.length == 0) {
- alert("没有结果");
- return
- }
- m_view.goTo(GraphicsLayer_myLayer.graphics);
- dyCretateTableByArray("queryTable1", queryList, ["名称", "图层名"], ["名称", "图层名"], false, true);
- goPage(1, "queryTable1");
- return
- }
- var layerField = "";
- var xmlDoc1 = xmlUtil.loadXmlFromFile("config/layerQueryName.xml");
- var layerXml = xmlDoc1.getElementsByTagName(GetLayerNamebyId(j));
- var mapNodes = layerXml[0].childNodes;
- for (var i = 0; i < mapNodes.length; i++) {
- if (xmlUtil.getNodeTagName(mapNodes[i]) == "name") {
- layerField = xmlUtil.getNodeValue(mapNodes[i])
- }
- }
- if (j < layerInfo.length) {
- require(["esri/tasks/QueryTask", "esri/tasks/support/Query", "esri/layers/FeatureLayer", "dojo/_base/array", "esri/Graphic", "dojo/dom"],
- function (QueryTask, Query, FeatureLayer, arrayUtils, Graphic, dom) {
- var urlI = dyLayer.url + "/" + j;
- var qTask = new QueryTask({
- url: urlI
- });
- var params = new Query({
- geometry: queryExtent,
- returnGeometry: true,
- outFields: ["*"]
- });
- var where;
- if (name == null || name == "") {
- where = "1=1"
- } else {
- where = layerField + " like '%" + name + "%' "
- }
- params.where = where;
- qTask.execute(params).then(getResults).otherwise(promiseRejected);
- function getResults(response) {
- var peakResults = arrayUtils.map(response.features,
- function (feature) {
- var obj = eval("(" + symble[j] + ")");
- var symbolJson = obj.drawingInfo.renderer.symbol;
- if (currentMapMode == "2D") {
- if (symbolJson.type == "esriSFS") {
- feature.symbol = {
- type: "simple-fill",
- style: changeStyle(symbolJson.style),
- color: symbolJson.color,
- outline: {
- style: changeStyle(symbolJson.outline.style),
- color: symbolJson.outline.color,
- width: symbolJson.outline.width
- }
- }
- } else if (symbolJson.type == "esriPMS") {
- feature.symbol = {
- type: "picture-marker",
- url: "data:image/png;base64," + symbolJson.imageData,
- width: symbolJson.width,
- height: symbolJson.height
- }
- }
- } else {
- var verticalOffset = {
- screenLength: 40,
- maxWorldLength: 200,
- minWorldLength: 35
- };
- if (symbolJson.type == "esriSFS") {
- for (var i = 0; i < feature.geometry.rings[0].length; i++) {
- feature.geometry.rings[0][i].push(20)
- }
- var polygon = {
- type: "polygon",
- rings: feature.geometry.rings
- };
- var polygonGraphic = new Graphic({
- geometry: polygon
- });
- polygonGraphic.symbol = {
- type: "polygon-3d",
- symbolLayers: [{
- type: "fill",
- material: {
- color: symbolJson.color
- },
- outline: {
- color: symbolJson.outline.color,
- size: symbolJson.outline.size
- }
- }]
- }
- } else if (symbolJson.type == "esriPMS") {
- feature.symbol = {
- type: "point-3d",
- symbolLayers: [{
- type: "icon",
- resource: {
- href: "data:image/png;base64," + symbolJson.imageData
- },
- size: 20,
- outline: {
- color: "white",
- size: 2
- }
- }],
- verticalOffset: verticalOffset,
- callout: {
- type: "line",
- color: "white",
- size: 2,
- border: {
- color: "#40C2B4"
- }
- }
- }
- } else if (symbolJson.style == "esriSMSCircle") {
- feature.symbol = {
- type: "point-3d",
- symbolLayers: [{
- type: "icon",
- resource: {
- primitive: "circle"
- },
- size: symbolJson.size * 2,
- material: {
- color: symbolJson.color
- },
- outline: {
- color: symbolJson.outline.color,
- size: symbolJson.outline.size
- }
- }],
- verticalOffset: verticalOffset,
- callout: {
- type: "line",
- color: "white",
- size: 2,
- border: {
- color: "#40C2B4"
- }
- }
- }
- }
- }
- feature.geometry.spatialReference = m_view.spatialReference;
- var popupTemplate = {
- title: "详细信息",
- content: "所在图层:" + GetLayerNamebyId(j) + "<br>" + attributesToHTMLStr(feature.attributes)
- };
- feature.popupTemplate = popupTemplate;
- var attInfo = [];
- for (var name in feature.attributes) {
- attInfo.push({
- "属性": name,
- "值": feature.attributes[name]
- })
- }
- var list = {
- "名称": feature.attributes[layerField],
- "图层名": GetLayerNamebyId(j),
- "详情": attInfo,
- "几何": feature
- };
- queryList.push(list);
- if (currentMapMode == "3D") {
- if (symbolJson.type == "esriSFS") {
- polygonGraphic.geometry.spatialReference = m_view.spatialReference;
- polygonGraphic.popupTemplate = popupTemplate;
- return polygonGraphic
- }
- }
- return feature
- });
- GraphicsLayer_myLayer.addMany(peakResults);
- if (currentMapMode == "3D") {
- if (queryList.length == 0) {
- alert("没有结果");
- return
- }
- m_view.goTo(GraphicsLayer_myLayer.graphics);
- dyCretateTableByArray("queryTable1", queryList, ["名称", "图层名"], ["名称", "图层名"], false, true);
- goPage(1, "queryTable1")
- } else {
- queryRecursive(j + 1)
- }
- }
- function promiseRejected(err) {
- console.error("图层:" + j + "错误信息: ", err.message)
- }
- })
- }
- }
- function queryBySquare() {
- queryExtent = null;
- require(["esri/Map", "esri/views/MapView", "esri/layers/MapImageLayer", "esri/layers/TileLayer", "esri/geometry/Geometry", "esri/geometry/Extent", "esri/tasks/GeometryService", "esri/layers/GraphicsLayer", "esri/widgets/ScaleBar", "esri/WebMap", "esri/geometry/SpatialReference", "esri/Graphic", "esri/views/2d/draw/Draw", "esri/geometry/Polygon", "esri/geometry/geometryEngine"],
- function (Map, MapView, MapImageLayer, TileLayer, Geometry, Extent, GeometryService, GraphicsLayer, ScaleBar, WebMap, SpatialReference, Graphic, Draw, Polygon, geometryEngine) {
- var action = m_drawtool.create("polygon");
- m_view.focus();
- action.on("vertex-add", drawPolygon);
- action.on("cursor-update", drawPolygon);
- action.on("vertex-remove", drawPolygon);
- action.on("draw-complete", drawPolygonEnd);
- function drawPolygon(evt) {
- var vertices = evt.vertices;
- btClear_Click();
- var polygon = createPolygon(vertices);
- var graphic = createGraphic(polygon);
- GraphicsLayer_DrawLayer.add(graphic);
- queryExtent = polygon
- }
- function drawPolygonEnd(evt) {
- drawPolygon(evt);
- queryAll()
- }
- function createPolygon(vertices) {
- return new Polygon({
- rings: vertices,
- spatialReference: m_view.spatialReference
- })
- }
- function createGraphic(polygon) {
- graphic = new Graphic({
- geometry: polygon,
- symbol: {
- type: "simple-fill",
- color: [178, 102, 234, .8],
- style: "solid",
- outline: {
- color: [255, 255, 255],
- width: 2
- }
- }
- });
- return graphic
- }
- })
- }
- function queryByStreet() {
- document.getElementById("name").value = "";
- queryExtent = null;
- btClear_Click();
- var action = m_drawtool.create("point");
- action.on("draw-complete",
- function (evt) {
- createPointGraphic(evt.coordinates, "街道乡镇")
- })
- }
- function queryByCommittees() {
- document.getElementById("name").value = "";
- queryExtent = null;
- btClear_Click();
- var action = m_drawtool.create("point");
- action.on("draw-complete",
- function (evt) {
- createPointGraphic(evt.coordinates, "村居委会")
- })
- }
- function createPointGraphic(coordinates, layerName) {
- require(["esri/geometry/Point"],
- function (Point) {
- m_view.graphics.removeAll();
- var point = new Point({
- x: coordinates[0],
- y: coordinates[1],
- spatialReference: m_view.spatialReference
- });
- queryExtent = point;
- queryExtentByPoint(layerName)
- })
- }
- function queryExtentByPoint(layerName) {
- var id = GetLayerIdbyName(layerName);
- require(["esri/tasks/QueryTask", "esri/tasks/support/Query", "esri/layers/FeatureLayer", "dojo/_base/array", "dojo/dom"],
- function (QueryTask, Query, FeatureLayer, arrayUtils, dom) {
- var urlI = dyLayer.url + "/" + id;
- var qTask = new QueryTask({
- url: urlI
- });
- var params = new Query({
- geometry: queryExtent,
- returnGeometry: true,
- outFields: ["*"]
- });
- params.where = "1=1";
- qTask.execute(params).then(getResults).otherwise(promiseRejected);
- function getResults(response) {
- var peakResults = arrayUtils.map(response.features,
- function (feature) {
- feature.geometry.spatialReference = m_view.spatialReference;
- queryExtent = null;
- queryExtent = feature.geometry;
- return feature
- });
- if (peakResults.length == 0) {
- alert("无此范围" + layerName)
- } else {
- queryAll()
- }
- }
- function promiseRejected(err) {
- console.error("错误信息: ", err.message)
- }
- })
- }
- function createLayerSelect(selectId) {
- var select = document.getElementById(selectId);
- select.innerHTML = "";
- var layerInfo;
- layerInfo = GetDynamicServiceLayer();
- if (layerInfo != null) {
- for (var j = layerInfo.length; j > 0; j--) {
- var option = document.createElement("option");
- var currnetLayer = layerInfo.getItemAt(j - 1);
- option.innerHTML = currnetLayer.title;
- option.value = currnetLayer.id;
- select.append(option)
- }
- }
- }
- function openStatistics() {
- document.getElementById("statistics").style.display = "";
- document.getElementById("statistics1").style.display = "";
- document.getElementById("statistics2").style.display = "none";
- document.getElementById("statistics3").style.display = "none";
- document.getElementById("statistics4").style.display = "none";
- createLayerSelect("statistics1LayerSelect");
- createStreetCheck("statistics1CheckTable", "街道乡镇")
- }
- function closeStatistics() {
- document.getElementById("statistics").style.display = "none"
- }
- function returnTostatistic1() {
- document.getElementById("statistics1").style.display = "";
- document.getElementById("statistics2").style.display = "none"
- }
- function returnTostatistic2() {
- document.getElementById("statistics2").style.display = "";
- document.getElementById("statistics3").style.display = "none"
- }
- function returnTostatistic3() {
- document.getElementById("statistics3").style.display = "";
- document.getElementById("statistics4").style.display = "none"
- }
- function createStreetCheck(tableId, layerName) {
- require(["esri/tasks/QueryTask", "esri/tasks/support/Query", "esri/layers/FeatureLayer", "dojo/_base/array", "dojo/dom"],
- function (QueryTask, Query, FeatureLayer, arrayUtils, dom) {
- var urlI = dyLayer.url + "/" + GetLayerIdbyName(layerName);
- var qTask = new QueryTask({
- url: urlI
- });
- var params = new Query({
- returnGeometry: true,
- outFields: ["*"]
- });
- params.where = "1=1";
- qTask.execute(params).then(getResults).otherwise(promiseRejected);
- function getResults(response) {
- var peakResults = arrayUtils.map(response.features,
- function (feature) {
- return feature
- });
- var tbody = document.getElementById(tableId);
- tbody.innerHTML = "";
- for (var j = 0; j < peakResults.length; j++) {
- if (j % 2 == 1) {
- var tr = document.createElement("tr");
- var td1 = document.createElement("td");
- td1.setAttribute("style", "width:230px;height:30px");
- td1.setAttribute("align", "left");
- var input1 = document.createElement("input");
- input1.setAttribute("type", "checkbox");
- input1.setAttribute("name", "statistics1CheckBox");
- input1.value = peakResults[j - 1].attributes.名称;
- td1.append(input1);
- td1.append(peakResults[j - 1].attributes.名称);
- var td2 = document.createElement("td");
- td2.setAttribute("style", "width:230px;height:30px");
- td2.setAttribute("align", "left");
- var input2 = document.createElement("input");
- input2.setAttribute("type", "checkbox");
- input2.setAttribute("name", "statistics1CheckBox");
- input2.value = peakResults[j].attributes.名称;
- td2.append(input2);
- td2.append(peakResults[j].attributes.名称);
- tr.append(td1);
- tr.append(td2);
- tbody.append(tr)
- } else if (j == peakResults.length - 1) {
- var tr = document.createElement("tr");
- var td1 = document.createElement("td");
- td1.setAttribute("style", "width:230px;height:30px");
- td1.setAttribute("align", "left");
- var input1 = document.createElement("input");
- input1.setAttribute("type", "checkbox");
- input1.setAttribute("name", "statistics1CheckBox");
- input1.value = peakResults[j - 1].attributes.名称;
- td1.append(input1);
- td1.append(peakResults[j - 1].attributes.名称);
- var td2 = document.createElement("td");
- tr.append(td1);
- tr.append(td2);
- tbody.append(tr)
- }
- }
- }
- function promiseRejected(err) {
- console.error("错误信息: ", err.message)
- }
- })
- }
- function statistic() {
- var checks = document.getElementsByName("statistics1CheckBox");
- statisticCheckBoxArray.splice(0, statisticCheckBoxArray.length);
- for (var i = 0; i < checks.length; i++) {
- if (checks[i].checked) {
- statisticCheckBoxArray.push(checks[i].value)
- }
- }
- if (statisticCheckBoxArray.length < 1) {
- alert("请至少选择一个街道");
- return
- }
- statisticResultList.splice(0, statisticResultList.length);
- btClear_Click();
- document.getElementById("statistics1").style.display = "none";
- document.getElementById("statistics2").style.display = "";
- recursive(0)
- }
- function recursive(value) {
- if (value < statisticCheckBoxArray.length) {
- var options = document.getElementById("statistics1LayerSelect").options;
- queryPolygonByStatistic(statisticCheckBoxArray[value], options[options.selectedIndex].value, value)
- }
- }
- function queryPolygonByStatistic(name, urlid, value) {
- require(["esri/tasks/QueryTask", "esri/tasks/support/Query", "esri/layers/FeatureLayer", "dojo/_base/array", "dojo/dom"],
- function (QueryTask, Query, FeatureLayer, arrayUtils, dom) {
- var url = dyLayer.url + "/" + GetLayerIdbyName("街道乡镇");
- var qTask = new QueryTask({
- url: url
- });
- var params = new Query({
- returnGeometry: true,
- outFields: ["*"]
- });
- params.where = "名称='" + name + "'";
- qTask.execute(params).then(getResults).otherwise(promiseRejected);
- function getResults(response) {
- var peakResults = arrayUtils.map(response.features,
- function (feature) {
- return feature
- });
- queryPointByStatistic(peakResults[0].geometry, urlid, value)
- }
- function promiseRejected(err) {
- console.error("错误信息: ", err.message)
- }
- })
- }
- function queryPointByStatistic(geometry, urlid, value) {
- require(["esri/tasks/QueryTask", "esri/tasks/support/Query", "esri/layers/FeatureLayer", "dojo/_base/array", "dojo/dom"],
- function (QueryTask, Query, FeatureLayer, arrayUtils, dom) {
- var url = dyLayer.url + "/" + urlid;
- var qTask = new QueryTask({
- url: url
- });
- var params = new Query({
- geometry: geometry,
- returnGeometry: true,
- outFields: ["*"]
- });
- params.where = "1=1";
- qTask.execute(params).then(getResults).otherwise(promiseRejected);
- function getResults(response) {
- var peakResults = arrayUtils.map(response.features,
- function (feature) {
- if (currentMapMode == "2D") {
- var obj = eval("(" + symble[urlid] + ")");
- var symbolJson = obj.drawingInfo.renderer.symbol;
- if (symbolJson.type == "esriSFS") {
- feature.symbol = {
- type: "simple-fill",
- style: changeStyle(symbolJson.style),
- color: symbolJson.color,
- outline: {
- style: changeStyle(symbolJson.outline.style),
- color: symbolJson.outline.color,
- width: symbolJson.outline.width
- }
- }
- } else if (symbolJson.type == "esriPMS") {
- feature.symbol = {
- type: "picture-marker",
- url: "data:image/png;base64," + symbolJson.imageData,
- width: symbolJson.width,
- height: symbolJson.height
- }
- } else if (symbolJson.style == "esriSMSCircle") {
- feature.symbol = {
- type: "simple-marker",
- style: "circle",
- color: symbolJson.color,
- size: symbolJson.size,
- outline: {
- color: symbolJson.outline.color,
- width: symbolJson.outline.width
- }
- }
- }
- } else {
- var verticalOffset = {
- screenLength: 40,
- maxWorldLength: 200,
- minWorldLength: 35
- };
- var obj = eval("(" + symble[urlid] + ")");
- var symbolJson = obj.drawingInfo.renderer.symbol;
- if (symbolJson.type == "esriSFS") {
- for (var i = 0; i < feature.geometry.rings[0].length; i++) {
- feature.geometry.rings[0][i].push(20)
- }
- var polygon = {
- type: "polygon",
- rings: feature.geometry.rings
- };
- var polygonGraphic = new Graphic({
- geometry: polygon
- });
- polygonGraphic.symbol = {
- type: "polygon-3d",
- symbolLayers: [{
- type: "fill",
- material: {
- color: symbolJson.color
- },
- outline: {
- color: symbolJson.outline.color,
- size: symbolJson.outline.size
- }
- }]
- }
- } else if (symbolJson.type == "esriPMS") {
- feature.symbol = {
- type: "point-3d",
- symbolLayers: [{
- type: "icon",
- resource: {
- href: "data:image/png;base64," + symbolJson.imageData
- },
- size: 20,
- outline: {
- color: "white",
- size: 2
- }
- }],
- verticalOffset: verticalOffset,
- callout: {
- type: "line",
- color: "white",
- size: 2,
- border: {
- color: "#40C2B4"
- }
- }
- }
- } else if (symbolJson.style == "esriSMSCircle") {
- feature.symbol = {
- type: "point-3d",
- symbolLayers: [{
- type: "icon",
- resource: {
- primitive: "circle"
- },
- size: symbolJson.size * 2,
- material: {
- color: symbolJson.color
- },
- outline: {
- color: symbolJson.outline.color,
- size: symbolJson.outline.size
- }
- }],
- verticalOffset: verticalOffset,
- callout: {
- type: "line",
- color: "white",
- size: 2,
- border: {
- color: "#40C2B4"
- }
- }
- }
- }
- }
- var popupTemplate = {
- title: "详细信息",
- content: attributesToHTMLStr(feature.attributes)
- };
- if (currentMapMode == "3D") {
- if (symbolJson.type == "esriSFS") {
- polygonGraphic.geometry.spatialReference = m_view.spatialReference;
- polygonGraphic.popupTemplate = popupTemplate;
- return polygonGraphic
- }
- }
- feature.geometry.spatialReference = m_view.spatialReference;
- feature.popupTemplate = popupTemplate;
- return feature
- });
- statisticResultList.push({
- "名称": statisticCheckBoxArray[statisticResultList.length],
- "数量": peakResults.length,
- "图形集": peakResults
- });
- GraphicsLayer_myLayer.addMany(peakResults);
- if (statisticResultList.length == statisticCheckBoxArray.length) {
- m_view.goTo(GraphicsLayer_myLayer.graphics);
- dyCretateTableByArray("statistics2Table", statisticResultList, ["名称", "数量"], ["名称", "数量"], false, true);
- creatPie(statisticResultList, "statistics2Div2");
- createBar(statisticResultList, "statistics2Div3")
- }
- recursive(value + 1)
- }
- function promiseRejected(err) {
- console.error("错误信息: ", err.message)
- }
- })
- }
- function openRoadQuery() {
- document.getElementById("roadQuery").style.display = ""
- }
- function closeRoadQuery() {
- document.getElementById("roadQuery").style.display = "none"
- }
- function searchRoadByName() {
- var address = document.getElementById("addressName").value;
- if (address == "") {
- alert("请输入要检索的关键字!");
- return
- }
- openRoadQuery();
- searchRoadName = address;
- searchRoadPage(1)
- }
- function showRoadPoint(x, y, name) {
- require(["esri/Graphic"],
- function (Graphic) {
- var point = {
- type: "point",
- x: x,
- y: y,
- spatialReference: m_view.spatialReference
- };
- var markerSymbol;
- if (currentMapMode == "2D") {
- markerSymbol = {
- type: "picture-marker",
- url: "QPimage/top/layerPopup.png",
- width: "20px",
- height: "30px"
- }
- } else {
- var verticalOffset = {
- screenLength: 40,
- maxWorldLength: 200,
- minWorldLength: 35
- };
- markerSymbol = {
- type: "point-3d",
- symbolLayers: [{
- type: "icon",
- resource: {
- href: "QPimage/top/layerPopup.png"
- },
- size: 20
- }],
- verticalOffset: verticalOffset,
- callout: {
- type: "line",
- color: "white",
- size: 2,
- border: {
- color: "#40C2B4"
- }
- }
- }
- }
- var pointGraphic = new Graphic({
- geometry: point,
- symbol: markerSymbol
- });
- pointGraphic.attributes = {
- roadname: name
- };
- GraphicsLayer_myLayer.add(pointGraphic)
- })
- }
- function showRoad(x, y) {
- require(["esri/geometry/Point"],
- function (Point) {
- var point = new Point({
- x: x,
- y: y,
- spatialReference: m_view.spatialReference
- });
- m_view.goTo(point)
- })
- }
- function doToolTip() {
- m_view.on("pointer-move", eventHandler);
- function eventHandler(event) {
- m_view.hitTest(event).then(getGraphics)
- }
- function getGraphics(response) {
- if (response.results.length) {
- var graphic = response.results.filter(function (result) {
- return result.graphic.layer === GraphicsLayer_myLayer
- })[0].graphic;
- var attributes = graphic.attributes;
- var roadname = attributes.roadname;
- if (roadname != null) {
- document.getElementById("info").style.visibility = "visible";
- document.getElementById("info").innerHTML = roadname
- }
- }
- }
- }
- function createInfoDiv() {
- var dom = document.createElement("div");
- dom.setAttribute("id", "info");
- dom.setAttribute("style", "background-color: black;opacity: 0.75;color: orange; font-size: 18pt; padding: 8px;visibility: hidden;");
- document.body.appendChild(dom)
- }
- function showLoadingDiv(message) {
- var loadingDiv = document.createElement("div");
- loadingDiv.setAttribute("id", "divLoading");
- loadingDiv.innerHTML = message;
- var iWidth = 200;
- var iHeight = 50;
- var iTop = (window.screen.height - 30 - iHeight) / 2;
- var iLeft = (window.screen.width - 10 - iWidth) / 2;
- loadingDiv.setAttribute("style", "position: absolute;height:" + iHeight + "px;width:" + iWidth + "px;top:" + iTop + "px;left:" + iLeft + "px;");
- document.body.appendChild(loadingDiv)
- }
- function removeLoadingDiv() {
- var loadingDiv = document.getElementById("divLoading");
- if (loadingDiv) {
- document.body.removeChild(loadingDiv)
- }
- }
- function postToParentPageMethed(methedName, data, backFun) {//传数据给父窗口
- window.parent.postMessage(JSON.stringify({method: methedName, data: data, backfun: backFun}), '*');
- }
- function OpenMapImageLayerByName(layerName, layerVisible, whereStr) {
- if (whereStr == null) {
- whereStr = "1=1"
- }
- if (whereStr == "") {
- whereStr = "1=1"
- }
- if (layerName == "非法行医") {
- var layer = getLayerByLayerId("动态数据");
- var layerId = GetLayerIdbyName("存量点");
- var symbol1 = {
- type: "picture-marker",
- url: "http://10.101.35.46/zhwj/assets/image/ffxyPoint.png",
- width: "20px",
- height: "20px"
- }
- var renderer1 = {
- type: "simple",
- symbol: symbol1
- };
- layer.findSublayerById(layerId).renderer = renderer1
- layer.findSublayerById(layerId).definitionExpression = whereStr;
- layer.findSublayerById(layerId).visible = layerVisible;
- } else if (layerName == "六月内存量零") {
- queryNoFFXYPointArea(6, layerVisible, whereStr)
- } else if (layerName == "十二月内存量零") {
- queryNoFFXYPointArea(12, layerVisible, whereStr)
- } else if (layerName == "街道乡镇") {
- var layer = getLayerByLayerId("动态数据");
- var id = getSubLayerIdbyName(layer, "街道乡镇");
-
- if (layer.findSublayerById(id).sublayers) {
- var subLayer = layer.findSublayerById(id).sublayers.items;
- for (var i = 0; i < subLayer.length; i++) {
- layer.findSublayerById(subLayer[i].id).definitionExpression = whereStr;
- }
- } else {
- layer.findSublayerById(id).definitionExpression = whereStr;
- }
- layer.findSublayerById(id).visible = layerVisible;
-
- layer.findSublayerById(id).renderer ={
- type: "simple", // autocasts as new PointSymbol3D()
- symbol:{
- type: "simple-fill",
- color: [0,0,0,0],
- style: "solid",
- outline: {
- color: [168, 168, 0, 255],
- width: 1
- }
- }
- }
- } else {
- var layer = getLayerByLayerId("density_1");
- var id = getSubLayerIdbyName(layer, layerName);
- if (layer.findSublayerById(id).sublayers) {
- var subLayer = layer.findSublayerById(id).sublayers.items;
- for (var i = 0; i < subLayer.length; i++) {
- layer.findSublayerById(subLayer[i].id).definitionExpression = whereStr;
- }
- } else {
- layer.findSublayerById(id).definitionExpression = whereStr;
- }
- layer.findSublayerById(id).visible = layerVisible;
- }
- }
- function addZero(num) {
- if (num < 10) {
- return "0" + num;
- } else {
- return num;
- }
- }
- function createWZXYFeature() {
- require(["esri/tasks/QueryTask", "esri/tasks/support/StatisticDefinition", "esri/tasks/support/Query", "esri/layers/FeatureLayer", "dojo/_base/array", "dojo/dom", "esri/Graphic",
- "esri/geometry/Point"],
- function (QueryTask, StatisticDefinition, Query, FeatureLayer, arrayUtils, dom, Graphic, Point) {
- var layer2 = getLayerByLayerId("density_1");
- var id = getSubLayerIdbyName(layer2, "街道乡镇");
- var qTask = new QueryTask({
- url:layer2.url+"/"+id
- });
- var query = new Query();
- query.returnGeometry = true;
- query.outFields = ["*"];
- query.where = "1=1";
- qTask.execute(query).then(getResults).catch(promiseRejected);
- function getResults(response) {
- const layer = new FeatureLayer({
- id:"WZXYFeature",
- source: response.features,
- fields: [{
- name: "ObjectID",
- alias: "ObjectID",
- type: "oid"
- }, {
- name: "街道名称",
- alias: "街道名称",
- type: "string"
- }],
- outFields : ["ObjectID","街道名称"],
- visible:false,
- objectIdField: "ObjectID",
- geometryType: "polygon"
- });
- layer.renderer={
- type: "simple", // autocasts as new PointSymbol3D()
- symbol:{
- type: "simple-fill", // autocasts as new SimpleFillSymbol()
- color: [168, 168, 0, 0.3],
- style: "solid",
- outline: { // autocasts as new SimpleLineSymbol()
- color: [168, 168, 0, 255],
- width: 2
- }
- }
- }
- m_map.add(layer)
- };
- function promiseRejected(e) {
- console.log(e)
- }
- })
- }
-
- function queryNoFFXYPointArea(month, layerVisible, whereStr) {// 零无证行医区域
- var layer2 = getLayerByLayerId("density_1");
- if (layerVisible == false) {
- var WZXYFeature = getLayerByLayerId("WZXYFeature");
- WZXYFeature.definitionExpression = "1=1";
- WZXYFeature.visible = false;
- return
- }
- var dt = new Date();
- dt.setMonth(dt.getMonth() - month);
- var where = " 创建日期1 >'" + dt.getFullYear() + "/" + addZero(dt.getMonth() + 1) + "/" + addZero(dt.getDate()) + "'";
- var layerId = GetLayerIdbyName("存量点");
- if (layerId == -1)
- return;
- require(["esri/tasks/QueryTask", "esri/tasks/support/StatisticDefinition", "esri/tasks/support/Query", "esri/layers/FeatureLayer", "dojo/_base/array", "dojo/dom", "esri/Graphic",
- "esri/geometry/Point"],
- function (QueryTask, StatisticDefinition, Query, FeatureLayer, arrayUtils, dom, Graphic, Point) {
-
- var layer = getLayerByLayerId("动态数据");
- var urlI = layer.url + "/" + layerId;
- var qTask = new QueryTask({
- url: urlI
- });
- var query = new Query();
- var levelCount = new StatisticDefinition({
- statisticType: "count",
- onStatisticField: "ID",
- outStatisticFieldName: "level_count"
- });
- query.outFields = ["*"];
- query.returnGeometry = false;
- query.groupByFieldsForStatistics = ["街道"];
- query.outStatistics = [levelCount];
- query.where = where;
- qTask.execute(query).then(getResults).catch(promiseRejected);
- function getResults(response) {
- var graphiics = response.features;
- var areaWhere = "街道名称 not in ('' ";
- for (var i = 0; i < graphiics.length; i++) {
- if (i % 10 == 0 && i != 0) {
- areaWhere += " ) and 街道名称 not in (''"
- } else {
- areaWhere += ",'" + graphiics[i].attributes.街道 + "'";
- }
- }
- areaWhere += ")";
- if (whereStr) {
- areaWhere += " and " + whereStr;
- }
- var WZXYFeature = getLayerByLayerId("WZXYFeature");
- WZXYFeature.definitionExpression = areaWhere;
- WZXYFeature.visible = layerVisible;
- // layer2.findSublayerById(id2).definitionExpression = areaWhere;
- // // layer2.findSublayerById(id3).definitionExpression = areaWhere;
- // layer2.findSublayerById(id4).definitionExpression = areaWhere;
- // // layer2.findSublayerById(id5).definitionExpression = areaWhere;
- // layer2.findSublayerById(id2).visible = layerVisible;
- // layer2.findSublayerById(id4).renderer={
- // type: "simple", // autocasts as new PointSymbol3D()
- // symbol:{
- // type: "simple-fill", // autocasts as new SimpleFillSymbol()
- // color: [168, 168, 0, 0.3],
- // style: "solid",
- // outline: { // autocasts as new SimpleLineSymbol()
- // color: [168, 168, 0, 255],
- // width: 2
- // }
- // }
- // }
- }
- function promiseRejected(err) {
- console.error("错误信息: ", err.message);
- }
- });
- }
- function queryNoFFXYPointJCZ(month, layerVisible, radius) {// 零无证行医区域
- var layerId = GetLayerIdbyName("固定监测站");
- if (layerId == -1)
- return;
- require(["esri/tasks/QueryTask", "esri/tasks/support/StatisticDefinition", "esri/tasks/support/Query", "esri/layers/FeatureLayer", "dojo/_base/array", "dojo/dom", "esri/Graphic",
- "esri/geometry/Point"],
- function (QueryTask, StatisticDefinition, Query, FeatureLayer, arrayUtils, dom, Graphic, Point) {
- var layer = getLayerByLayerId("动态数据");
- var urlI = layer.url + "/" + layerId;
- var qTask = new QueryTask({
- url: urlI
- });
- var query = new Query();
- query.returnGeometry = true;
- query.outFields=["*"];
- query.where = "1=1";
- qTask.execute(query).then(getResults).catch(promiseRejected);
- function getResults(response) {
- var graphiics = response.features;
- for (var i = 0; i < graphiics.length; i++) {
- var x = graphiics[i].geometry.x;
- var y = graphiics[i].geometry.y;
- xmlAddPointJCZ(x,y, null, null, null, null, null, null, null, null,radius)
- }
- }
- function promiseRejected(err) {
- console.error("错误信息: ", err.message);
- }
- });
- }
- function doCorrugatedPointByOid(idLlist) {
- var where = "ORGANIZATION_ID1 in ("
- for (var i = 0; i < idLlist.length; i++) {
- where += "'" + idLlist[i] + "', "
- }
- where += "'0')";
- var layerId = GetLayerIdbyName("医疗机构");
- m_map.remove(corrugatedPointlayer);
- if (layerId == -1)
- return;
- require(["esri/tasks/QueryTask", "esri/tasks/support/Query", "esri/layers/FeatureLayer", "dojo/_base/array", "dojo/dom", "esri/Graphic",
- "esri/geometry/Point"],
- function (QueryTask, Query, FeatureLayer, arrayUtils, dom, Graphic, Point) {
- var layer = getLayerByLayerId("动态数据");
- var urlI = layer.url + "/" + layerId;
- var qTask = new QueryTask({
- url: urlI
- });
- var params = new Query({
- returnGeometry: true,
- outFields: ["*"]
- });
- params.where = where;
- qTask.execute(params).then(getResults).catch(promiseRejected);
- function getResults(response) {
- var graphicArray = []
- if (response.features.length == 0) {
- return;
- }
- $.each(response.features, function (index, feature) {
- var point = {
- type: "point", // autocasts as new Point()
- x: parseFloat(x),
- y: parseFloat(y),
- spatialReference: m_view.spatialReference
- };
- var pointGraphic = new Graphic({
- geometry: feature.geometry,
- attributes: feature.attributes
- });
- graphicArray.push(pointGraphic);
- });
- createCorrugatedPoint(null, graphicArray, m_map);
- }
- function promiseRejected(err) {
- console.error("错误信息: ", err.message);
- }
- });
- }
- function doClearCorrugatedPoint() {
- m_map.remove(corrugatedPointlayer);
- }
- function goToGraphic(type,list) {
- require(["esri/tasks/QueryTask", "esri/tasks/support/Query", "esri/layers/FeatureLayer", "dojo/_base/array", "dojo/dom", "esri/Graphic",
- "esri/geometry/Point"],
- function (QueryTask, Query, FeatureLayer, arrayUtils, dom, Graphic, Point) {
- if(type=="点"){
- var pointList=[];
- for(var i=0;i<list.length;i++){
- var point = {
- type: "point",
- x: list[i][0],
- y:list[i][1],
- spatialReference: m_view.spatialReference
- };
- var markerSymbol = {
- type: "simple-marker", // autocasts as new SimpleMarkerSymbol()
- color: [226, 119, 40]
- };
- // Create a graphic and add the geometry and symbol to it
- const pointGraphic = new Graphic({
- geometry: point,
- symbol: markerSymbol
- });
- pointList.push(pointGraphic)
- }
- m_view.goTo(pointList)
- }else if(type=="街道乡镇"){
- var layer = getLayerByLayerId("动态数据");
- var layerId = getSubLayerIdbyName(layer, "街道乡镇");
- var urlI = layer.url + "/" + layerId;
- var qTask = new QueryTask({
- url: urlI
- });
- var params = new Query({
- returnGeometry: true,
- outFields: ["*"]
- });
- params.where = list;
- qTask.execute(params).then(getResults) ;
- function getResults(response) {
- m_view.goTo(response.features)
- }
- }else{
- var layer = getLayerByLayerId("density_1");
- var layerId = getSubLayerIdbyName(layer, type);
- var urlI = layer.url + "/" + layerId;
- var qTask = new QueryTask({
- url: urlI
- });
- var params = new Query({
- returnGeometry: true,
- outFields: ["*"]
- });
- params.where = list;
- qTask.execute(params).then(getResults) ;
- function getResults(response) {
- m_view.goTo(response.features)
- }
- }
- })
-
- }
- function doXyToStreetId(x, y) {
- var layer = getLayerByLayerId("density_1");
- var layerId = getSubLayerIdbyName(layer, "街道乡镇");
- if (layerId == -1) {
- return;
- }
- require(["esri/tasks/QueryTask", "esri/tasks/support/Query", "esri/layers/FeatureLayer", "dojo/_base/array", "dojo/dom", "esri/Graphic",
- "esri/geometry/Point"],
- function (QueryTask, Query, FeatureLayer, arrayUtils, dom, Graphic, Point) {
- var urlI = layer.url + "/" + layerId;
- var qTask = new QueryTask({
- url: urlI
- });
- var params = new Query({
- returnGeometry: true,
- outFields: ["*"]
- });
- var point = {
- type: "point",
- x: x,
- y: y,
- spatialReference: m_view.spatialReference
- };
- params.geometry = point;
- qTask.execute(params).then(getResults).catch(promiseRejected);
- function getResults(response) {
- postToParentPageMethed("doXyToStreetIdReturn", [response.features[0].attributes.街道代码]);
- }
- function promiseRejected(err) {
- console.error("错误信息: ", err.message);
- }
- });
- }
- function queryResetNumByType(whereStr) {
- var url = xmlUtil.getNodeValue(xmlDoc.getElementsByTagName("WebServiceURL")[0]);
- var sql = "select t.water_source_name,t.water_work_name,t.area_name," +
- "t.water_source_gps_x_cd x1,t.water_source_gps_y_cd y1," +
- "t.water_work_gps_x_cd x2,t.water_work_gps_y_cd y2" +
- ",t.area_gps_x_cd x3,t.area_gps_y_cd y3 from dwd_water_source_tracing t where " + whereStr;
- WsCommonClass("QueryDataBaseJson", ["sql"], [sql], sqlReturn, "queryResetNumByType", url);
- }
- function ShowBuildlayer(where){
- var layer=getLayerByLayerId("建筑物");
- layer.visible=where;
- }
- function ShowBuildlayerSX(where){
- var layer=getLayerByLayerId("水箱");
- layer.visible=where;
- }
- function ResettingMap() {
- require(["esri/geometry/Point"],
- function (Point) {
- var centerPoint = new Point({
- //x: 43184,
- //y: -37270,
- x:0,
- y:0,
- z: 258000,
- spatialReference: m_view.spatialReference
- });
- setCameraBypoint(0, centerPoint, 0, 0, currentScale);
- });
- }
- function consoleXYZ() {
- console.log(m_view.camera.position)
- }
- function queryWaterTank(id) {
- var url = xmlUtil.getNodeValue(xmlDoc.getElementsByTagName("WebServiceURL")[0]);
- var sql="select t.near_x,t.near_y,t.二次供水设,t.关联二次供 from sxd t where t.objectid="+id;
- WsCommonClass("QueryDataBaseJson", ["sql"], [sql], sqlReturnWater, "queryWaterTank", url);
- }
- function sqlReturnWater(evt, keyValue) {
- var allCount;
- var pageIndex;
- var jsonArray;
- if (evt[0] != null) {
- allCount = JSON.parse(evt[0].textContent)[0].AllCount;
- pageIndex = JSON.parse(evt[0].textContent)[0].pageIndex;
- jsonArray = JSON.parse(evt[0].textContent)[0].data;
- } else {
- jsonArray = []
- }
- switch (keyValue) {
- case "queryWaterTank":{
- var arr={"sbh":jsonArray[0].二次供水设,"x":jsonArray[0].near_x,"y":jsonArray[0].near_y,"xq":jsonArray[0].关联二次供};
- postToParentPageMethed("clickWaterTankReturn", [arr]);
- break;
- }
- }
- }
- function clusterByJson(list) {
- require(["esri/layers/FeatureLayer", "esri/Graphic","esri/widgets/Legend"], function(FeatureLayer, Graphic,Legend) {
- m_map.remove(m_map.findLayerById("clusterByJsonLayer"));
- var clusterConfig = {
- type: "cluster",
- clusterRadius: "50px",//多少范围聚合
- labelsVisible: true,
- labelingInfo: [
- {
- symbol: {
- type: "text",
- color:"yellow",//聚合字的颜色
- font: {
- size: "15px"
- }
- },
- labelPlacement: "center-center",
- labelExpressionInfo: {
- expression: "Text($feature.cluster_count, '#,### ')"
- },
- where: '1=1'
- }
- ]
- };
- var graphics=[];
- for(var i=0;i<list.length;i++){
- var point = { // 点坐标
- type: "point",
- x: parseFloat(list[i].x),
- y: parseFloat(list[i].y),
- spatialReference: m_view.spatialReference
- };
- var Graphics2 = new Graphic({
- geometry: point,
- // symbol: pointSymbol
- });
- graphics.push(Graphics2);
- }
- var clusterLayer = new FeatureLayer({
- id: "clusterByJsonLayer",
- fields: [{
- name: "code",
- alias: "code",
- type: "double"
- } ],
- visible: true,
- objectIdField: "code", // inferred from fields array if not specified
- geometryType: "point",
- spatialReference: m_view.spatialReference,
- source: graphics,
- featureReduction: clusterConfig,
- labelsVisible: true,
- renderer: {
- type: "simple",
- symbol:{
- type: "simple-marker",
- color: [123, 0, 0, 0.4],//聚合圈的颜色
- size: "10px"
- }
- }
- });
- m_map.add(clusterLayer);
- });
- }
|