1 |
- function toFullExtent(){m_view.zoom=0}function btFullExtent_Click(){toFullExtent()}function ZoomIn(e){e?m_view.goTo({zoom:e}):0==e?m_view.goTo({zoom:0}):m_zoom.zoomIn()}function btZoomIn_Click(){ZoomIn()}function btZoomOut_Click(){ZoomOut()}function ZoomOut(e){e?m_view.goTo({zoom:e}):0==e?m_view.goTo({zoom:0}):m_zoom.zoomOut()}function btDrawPolygon_Click(){measureSquare()}function measureSquare(){measurePolygon(m_drawtool,m_view)}function measureLength(){if("2D"==currentMapMode)measurePolyline(m_drawtool,m_view);else{if(lengthMeasureWidget&&!lengthMeasureWidget.destroyed)return void lengthMeasureWidget.destroy();createLengthMeasureWidget()}}function btDrawPolyline_Click(){measureLength()}function createLengthMeasureWidget(){require(["esri/widgets/DirectLineMeasurement3D","dojo/domReady!"],function(e){lengthMeasureWidget=new e({view:m_view}),m_view.ui.add(lengthMeasureWidget,"top-right")})}function measurePolylineByPoint(f,h,b,w){var v;return 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(e,t,r,a,o,i,s,n,l,y,u,c,m,p,d){var g=new p({paths:[[f,h],[b,w]],spatialReference:2379});v=d.planarLength(g,"kilometers")}),v}function measurePolyline(h,b){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(e,t,r,a,o,i,s,n,l,y,u,c,m,p,d){var g=h.create("polyline");function f(e){var t=e.vertices;btClear_Click();var r=new p({paths:t,spatialReference:m_view.spatialReference}),a=(graphic=new c({geometry:r,symbol:{type:"simple-line",color:[178,102,234,.8],width:2}}),graphic);GraphicsLayer_DrawLayer.add(a);var o,i,s=d.planarLength(r,"kilometers");if(s<0){var n=d.simplify(r);n&&(s="2D"==currentMapMode?d.planarLength(n,"kilometers"):d.geodesicLength(n,"kilometers"))}o=s,i=new c({geometry:r.extent.center,symbol:{type:"text",color:"black",haloColor:"black",haloSize:"1px",text:o.toFixed(2)+" km",xoffset:3,yoffset:3,font:{size:14,family:"sans-serif"}}}),GraphicsLayer_DrawLayer.add(i)}b.focus(),g.on("vertex-add",f),g.on("cursor-update",f),g.on("vertex-remove",f),g.on("draw-complete",f)})}function measurePolygon(h,b){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(e,t,r,a,o,i,s,n,l,y,u,c,m,p,d){var g=h.create("polygon");function f(e){var t=e.vertices;btClear_Click();var r=new p({rings:t,spatialReference:m_view.spatialReference}),a=(graphic=new c({geometry:r,symbol:{type:"simple-fill",color:[178,102,234,.8],style:"solid",outline:{color:[255,255,255],width:2}}}),graphic);GraphicsLayer_DrawLayer.add(a);var o,i,s=d.planarArea(r,"square-kilometers");if(s<0){var n=d.simplify(r);n&&(s="2D"==currentMapMode?d.planarArea(n,"square-kilometers"):d.geodesicArea(n,"square-kilometers"))}o=s,i=new c({geometry:r.centroid,symbol:{type:"text",color:"black",haloColor:"black",haloSize:"1px",text:o.toFixed(2)+" 平方千米",xoffset:3,yoffset:3,font:{size:14,family:"sans-serif"}}}),GraphicsLayer_DrawLayer.add(i)}b.focus(),g.on("vertex-add",f),g.on("cursor-update",f),g.on("vertex-remove",f),g.on("draw-complete",f)})}function btPrintPicture_Click(){downLoadPicture()}function downLoadPicture(){!m_printTool||m_printTool.destroyed?require(["esri/widgets/Print"],function(e){m_printTool=new e({view:m_view,printServiceUrl:GetConfigDataByName("PrintTaskURL")}),m_view.ui.add(m_printTool,"top-right")}):m_printTool.destroy()}function btPrintPicture_Click2(){require(["esri/tasks/PrintTask","esri/tasks/support/PrintParameters","esri/tasks/support/PrintTemplate"],function(e,t,r){var a=new e(GetConfigDataByName("PrintTaskURL")),o=new r;o.exportOptions={width:1200,height:700,dpi:96},o.format="JPG",o.layout="MAP_ONLY",o.preserveScale=!0;var i=new t;i.view=m_view,i.template=o,a.execute(i).then(function(e){window.open(e.url,"_blank")})})}function btGetGraphicByJson(){doGetGraphicByJson('{"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"}]}]}}')}function jsontagUndefined(e){return null!=e?e:null}function attributesToHTMLStr(e){var t="";for(var r in e)t+=r+":"+e[r]+"<br>";return t}function polygonxmlToArray(e){for(var t=[],r=e.split("|"),a=0;a<r.length;a++){var o=r[a].split(",");if("2D"==currentMapMode){var i=[parseFloat(o[0]),parseFloat(o[1])];t.push(i)}else{i=[parseFloat(o[0]),parseFloat(o[1]),parseFloat(o[2])];t.push(i)}t.push(i)}return t.push([parseFloat(r[0].split(",")[0]),parseFloat(r[0].split(",")[1])]),t}function polylinexmlToArray(e){for(var t=[],r=e.split("|"),a=0;a<r.length;a++){var o=r[a].split(",");if("2D"==currentMapMode){var i=[parseFloat(o[0]),parseFloat(o[1])];t[a]=i}else{i=[parseFloat(o[0]),parseFloat(o[1]),parseFloat(o[2])];t[a]=i}}return t}function doGetGraphicByJson(jsons,isGoTo){var jsonStr=eval("("+jsons+")");btClear_Click();var features=jsonStr.ExChangeRoot.Features;features.length<1&&alert("无查询结果");for(var k=0;k<features.length;k++)switch(features[k].type){case"polygon":for(var polygonFeature=features[k].Feature,i=0;i<polygonFeature.length;i++)for(var rings=polygonFeature[i].Geometry.Rings,j=0;j<rings.length;j++){var ring=rings[j].Ring,polygonAttribute=polygonFeature[i].Attribute,polygonToolTip=jsontagUndefined(polygonFeature[i].ToolTip),polygonColor=jsontagUndefined(polygonFeature[i].Color),polygonSize=jsontagUndefined(polygonFeature[i].Size),polygonStyle=jsontagUndefined(polygonFeature[i].Style);xmlAddPolygon(ring,polygonToolTip,polygonColor,polygonSize,polygonStyle,polygonAttribute)}break;case"polyline":for(var polylineFeature=features[k].Feature,i=0;i<polylineFeature.length;i++)for(var paths=polylineFeature[i].Geometry.Paths,j=0;j<paths.length;j++){var path=paths[j].Path,polylineAttribute=polylineFeature[i].Attribute,polylineToolTip=jsontagUndefined(polylineFeature[i].ToolTip),polylineColor=jsontagUndefined(polylineFeature[i].Color),polylineSize=jsontagUndefined(polylineFeature[i].Size),polylineStyle=jsontagUndefined(polylineFeature[i].Style);xmlAddPolyline(path,polylineToolTip,polylineColor,polylineSize,polylineStyle,polylineAttribute)}break;case"point":for(var pointFeature=features[k].Feature,i=0;i<pointFeature.length;i++)for(var points=pointFeature[i].Geometry.Points,j=0;j<points.length;j++){var point=points[j].Point,pointAttribute=pointFeature[i].Attribute,pointToolTip=jsontagUndefined(pointFeature[i].ToolTip),imgUrl=jsontagUndefined(pointFeature[i].ImgUrl),imgWidth=jsontagUndefined(pointFeature[i].ImgWidth),imgHeight=jsontagUndefined(pointFeature[i].ImgHeight),color=jsontagUndefined(pointFeature[i].Color),size=jsontagUndefined(pointFeature[i].Size),style=jsontagUndefined(pointFeature[i].Style);xmlAddPoint(point,pointToolTip,imgUrl,imgWidth,imgHeight,color,size,style,pointAttribute)}}null!=isGoTo&&null!=isGoTo||(isGoTo=!0),isGoTo&&m_view.goTo(xmlQueryExtend.expand(2))}function xmlAddPolygon(o,e,i,s,n,l){require(["esri/Graphic","esri/geometry/SpatialReference"],function(e,t){switch(i=i||[227,139,79,.8],s=s||2,n){case"backwarddiagonal":n="backward-diagonal";break;case"cross":n="cross";break;case"diagonalcross":n="diagonal-cross";break;case"forwarddiagonal":n="forward-diagonal";break;case"horizontal":n="horizontal";break;case"vertical":n="vertical";break;case"solid":n="solid";break;default:n="none"}var r=new e({geometry:{type:"polygon",rings:polygonxmlToArray(o),spatialReference:m_view.spatialReference},symbol:{type:"simple-fill",color:i,style:n,outline:{color:[255,255,255],width:s}},attributes:l});GraphicsLayer_DrawLayer.add(r);attributesToHTMLStr(l);var a=r.geometry.extent;a.spatialReference=m_view.spatialReference,xmlQueryExtend=xmlQueryExtend?xmlQueryExtend.union(a):a})}function xmlAddPolyline(a,e,o,i,s,n){require(["esri/Graphic"],function(e){switch(null==i&&(i=1),null==o&&(o=[226,119,40]),s){case"dash":s="dash";break;case"dashdot":s="dash-dot";break;case"none":s="none";break;case"dot":s="dot";break;default:s="solid"}var t=new e({geometry:{type:"polyline",paths:polylinexmlToArray(a),spatialReference:m_view.spatialReference},symbol:{type:"simple-line",color:o,style:s,width:i},attributes:n});GraphicsLayer_DrawLayer.add(t);attributesToHTMLStr(n);var r=t.geometry.extent;r.spatialReference=m_view.spatialReference,xmlQueryExtend=xmlQueryExtend?xmlQueryExtend.union(r):r})}function xmlAddPoint(n,e,l,y,u,c,m,p,d){require(["esri/geometry/Extent","esri/Graphic"],function(e,t){var r,a,o=n.split(",");if(r="2D"==currentMapMode?{type:"point",x:o[0],y:o[1],spatialReference:m_view.spatialReference}:{type:"point",x:o[0],y:o[1],z:o[2],spatialReference:m_view.spatialReference},null!=l)a={type:"picture-marker",url:l,width:y,height:u};else{switch(null==c&&(c=[226,119,40]),null==m&&(m=2),p){case"x":p="x";break;case"diamond":p="diamond";break;case"cross":p="cross";break;case"square":p="square";break;default:p="circle"}a={type:"simple-marker",color:c,style:p,size:m}}var i=new t({geometry:r,symbol:a,attributes:d});GraphicsLayer_DrawLayer.add(i);attributesToHTMLStr(d);var s=new e({xmax:i.geometry.x-0+250,ymax:i.geometry.y-0+250,xmin:i.geometry.x-250,ymin:i.geometry.y-250,spatialReference:m_view.spatialReference});xmlQueryExtend=xmlQueryExtend?xmlQueryExtend.union(s):s})}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(e,t,r,a,o,i,s,n,l,y,u,c,m,p,d){var g=m_drawtool.create("polygon");function f(e){var t=e.vertices;btClear_Click();var r=new p({rings:t,spatialReference:m_view.spatialReference}),a=(graphic=new c({geometry:r,symbol:{type:"simple-fill",color:[178,102,234,.8],style:"solid",outline:{color:[255,255,255],width:2}}}),graphic);GraphicsLayer_DrawLayer.add(a),queryExtent=r}m_view.focus(),g.on("vertex-add",f),g.on("cursor-update",f),g.on("vertex-remove",f),g.on("draw-complete",f)})}function btQuery_Click(){query(document.getElementById("txtQueryStr").value,document.getElementById("txtQueryLayerName").value)}function query(e,t){queryGraphicByDylayer();var r="";if(""==e)r=" 1=1 ";else{r=" 1=2 ";for(var a=xmlUtil.loadXmlFromFile("config/layerQueryName.xml").getElementsByTagName(t)[0].childNodes,o=0;o<a.length;o++)"name"==xmlUtil.getNodeTagName(a[o])&&(r+=" or "+xmlUtil.getNodeValue(a[o])+" like '%"+e+"%' ")}var i=GetLayerIdbyName(t);-1==i?alert("没有此图层"):queryGraphicByDylayer(i,r)}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,qTask=new QueryTask({url:urlI}),params=new Query({geometry:queryExtent,returnGeometry:!0,outFields:["*"]});function getResults(response){var peakResults=arrayUtils.map(response.features,function(feature){var obj=eval("("+symble[layerId]+")"),symbolJson=obj.drawingInfo.renderer.symbol;if("2D"==currentMapMode)symbolJson?"esriSFS"==symbolJson.type?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}}:"esriPMS"==symbolJson.type?feature.symbol={type:"picture-marker",url:"data:image/png;base64,"+symbolJson.imageData,width:symbolJson.width,height:symbolJson.height}:"esriSMS"==symbolJson.type&&(feature.symbol={type:"simple-marker",size:symbolJson.size,color:symbolJson.color,outline:symbolJson.outline}):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};"esriSFS"==symbolJson.type?feature.symbol={type:"polygon-3d",symbolLayers:[{type:"fill",material:{color:symbolJson.color}}],outline:{color:symbolJson.outline.color,size:symbolJson.outline.size}}:"esriPMS"==symbolJson.type?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"}}}:"esriSMSCircle"==symbolJson.style&&(feature.symbol={type:"point-3d",symbolLayers:[{type:"icon",resource:{primitive:"circle"},size:2*symbolJson.size,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)};return feature.popupTemplate=popupTemplate,feature});GraphicsLayer_myLayer.addMany(peakResults),m_view.goTo(peakResults)}function promiseRejected(e){console.error("错误信息: ",e.message)}params.geometry=geo||null,params.where=whereStr,qTask.execute(params).then(getResults).otherwise(promiseRejected)})}function changeStyle(e){switch(e){case"esriSFSBackwardDiagonal":e="backward-diagonal";break;case"esriSFSCross":e="cross";break;case"esriSFSDiagonalCross":e="diagonal-cross";break;case"esriSFSForwardDiagonal":e="forward-diagonal";break;case"esriSFSHorizontal":e="horizontal";break;case"esriSFSNull":e="none";break;case"esriSFSSolid":e="solid";break;case"esriSFSVertical":e="vertical";break;case"esriSLSDash":e="dash";break;case"esriSLSDashDotDot":e="short-dash-dot-dot";break;case"esriSLSDot":e="dot";break;case"esriSLSNull":e="none";break;case"esriSLSDashDot":e="dash-dot";break;case"esriSLSSolid":e="solid"}return e}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 e=GetLayerIdbyName("特色街区"),t=GetLayerIdbyName("街道乡镇");queryOption(e,"areaName"),queryOption(t,"streetName")}function queryOption(n,l){require(["esri/tasks/QueryTask","esri/tasks/support/Query","esri/layers/FeatureLayer","dojo/_base/array","dojo/dom"],function(e,t,r,o,a){var i=new e({url:dyLayer.url+"/"+n}),s=new t({geometry:queryExtent,returnGeometry:!0,outFields:["*"]});s.where="1=1",i.execute(s).then(function(e){for(var t=o.map(e.features,function(e){return e.attributes["名称"]}),r="<option value='-1'>全部</option>",a=0;a<t.length;a++)r+="<option value='"+t[a]+"'>"+t[a]+"</option>";document.getElementById(l).innerHTML=r}).otherwise(function(e){console.error("错误信息: ",e.message)})})}function changeAreaNameSelect(){var e=areaName.value;-1==e?(GraphicsLayer_DrawLayer.removeAll(),queryExtent=null):queryGraphicBySelect(GetLayerIdbyName("特色街区"),e)}function changeStreetNameSelect(){var e=streetName.value;-1==e?(GraphicsLayer_DrawLayer.removeAll(),queryExtent=null):queryGraphicBySelect(GetLayerIdbyName("街道乡镇"),e)}function queryGraphicBySelect(l,y){require(["esri/tasks/QueryTask","esri/tasks/support/Query","esri/layers/FeatureLayer","dojo/_base/array","esri/Graphic","dojo/dom"],function(e,t,r,a,o,i){GraphicsLayer_DrawLayer.removeAll(),queryExtent=null;var s=new e({url:dyLayer.url+"/"+l}),n=new t({geometry:queryExtent,returnGeometry:!0,outFields:["*"]});n.where="名称 = '"+y+"'",s.execute(n).then(function(e){var t=a.map(e.features,function(e){if("2D"==currentMapMode)return e.symbol={type:"simple-fill",style:"none",color:null,outline:{style:"solid",color:"red",width:2}},e.geometry.spatialReference=m_view.spatialReference,queryExtent=e.geometry,e.geometry.spatialReference=m_view.spatialReference,e;for(var t=0;t<e.geometry.rings[0].length;t++)e.geometry.rings[0][t].push(1);var r={type:"polygon",rings:e.geometry.rings},a=new o({geometry:r});return a.symbol={type:"polygon-3d",symbolLayers:[{type:"fill",material:{color:[0,0,0,0]},outline:{color:"red",size:"4px"}}]},queryExtent=e.geometry,a.geometry.spatialReference=m_view.spatialReference,a});GraphicsLayer_DrawLayer.addMany(t),m_view.goTo(t[0].geometry.extent.expand(2))}).otherwise(function(e){console.error("错误信息: ",e.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(e,t,r,a,o,i,s,n,l,y,u,c,m,p,d){var g=m_drawtool.create("polygon");function f(e){var t=e.vertices;GraphicsLayer_DrawLayer.removeAll();var r=new p({rings:t,spatialReference:m_view.spatialReference}),a=(graphic=new c({geometry:r,symbol:{type:"simple-fill",style:"none",color:null,outline:{style:"solid",color:"red",width:2}}}),graphic);GraphicsLayer_DrawLayer.add(a),queryExtent=r}m_view.focus(),g.on("vertex-add",f),g.on("cursor-update",f),g.on("vertex-remove",f),g.on("draw-complete",f)})}function btnQuickQuery(){queryList.splice(0,queryList.length);var e=select_zylx.value,t=txt_zymc.value,r=txt_keyStr.value;dynamicLayerURL=GetConfigDataByName("QueryLayer");var a=GetLayerIdbyName(e),o=" 1=1 ";if(select_zylx.options[select_zylx.selectedIndex].parentNode.attributes.label){if(t)switch(e){case"ETPS":o+=" and ETPS_NAME like '%"+t+"%' ";break;case"PE":o+=" and NAME like '%"+t+"%' ";break;case"CORP":o+=" and CORP_NAME like '%"+t+"%' "}r&&(o+="and ADDRESS like '%"+r+"%'")}else"YDYZ"==e?(t&&(o+="and MDNAME like '%"+t+"%'"),r&&(o+="and ADDRESS like '%"+r+"%'")):(t&&(o+="and 载体名称 like '%"+t+"%'"),r&&(o+="and 载体地址 like '%"+r+"%'"));doQuickQuery(a,o)}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="",layerName=select_zylx.value,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"}else layerStr="YDYZ"==layerName?"MDNAME":"载体名称";GraphicsLayer_fickerLayer.removeAll(),GraphicsLayer_myLayer.removeAll(),dynamicLayerURL=dynamicLayerURL||GetConfigDataByName("QueryLayer");var urlI=dynamicLayerURL+"/"+layerId,qTask=new QueryTask({url:urlI}),params=new Query({geometry:queryExtent,returnGeometry:!0,outFields:["*"]});function getResults(response){var peakResults=arrayUtils.map(response.features,function(feature){if("2D"==currentMapMode){var obj=eval("("+symble[layerId]+")"),symbolJson=obj.drawingInfo.renderer.symbol;"esriSFS"==symbolJson.type?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}}:"esriPMS"==symbolJson.type?feature.symbol={type:"picture-marker",url:"data:image/png;base64,"+symbolJson.imageData,width:symbolJson.width,height:symbolJson.height}:"esriSMSCircle"==symbolJson.style&&(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},obj=eval("("+symble[layerId]+")"),symbolJson=obj.drawingInfo.renderer.symbol;"esriSFS"==symbolJson.type||("esriPMS"==symbolJson.type?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"}}}:"esriSMSCircle"==symbolJson.style&&(feature.symbol={type:"point-3d",symbolLayers:[{type:"icon",resource:{primitive:"circle"},size:2*symbolJson.size,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};return queryList.push(list),feature});GraphicsLayer_myLayer.addMany(peakResults),m_view.goTo(peakResults),dom.byId("printResults").innerHTML="资产数:<a onclick='openResultTable()'> "+peakResults.length+"</a>"}function promiseRejected(e){console.error("错误信息: ",e.message)}params.where=whereStr,qTask.execute(params).then(getResults).otherwise(promiseRejected)})}function openResultTable(){document.getElementById("resultList").style.display="",dyCretateTableByArray("resultListTable",queryList,["名称"],["名称"],!1)}function closeResultList(){document.getElementById("resultList").style.display="none"}function openInfoWin(e){var t="";switch(select_zylx.value){case"CORP":case"ETPS":case"PE":t=quickQueryAttributesToHTMLStr(e);break;case"PARK":case"BUILDING":t=quickQueryIFrameToHTMLStr(e);break;case"YDYZ":t=quickQueryAttributesToHTMLStr(e)}return t}function quickQueryAttributesToHTMLStr(e){var t=[],r="";switch(select_zylx.value){case"CORP":t=[{cname:"CORP_NAME",showname:"组织名称"},{cname:"ADDRESS",showname:"地址"}],r="http://10.214.3.195:8001/coop/syn/detail_register_view_out?ifEncrypt=0&userName="+"wdzc"+"&passWord="+"68cf63c62bc68d71fc41c028375e2f6e"+"&entyId="+String(e.CORP_INFO_ID)+"&type=06";break;case"ETPS":t=[{cname:"UNISC_ID",showname:"统一社会信用代码"},{cname:"REG_NO",showname:"注册号"},{cname:"ETPS_NAME",showname:"企业名称"},{cname:"ADDRESS",showname:"住所"}],r="http://10.214.3.195:8001/coop/syn/detail_register_view_out?ifEncrypt=0&userName="+"wdzc"+"&passWord="+"68cf63c62bc68d71fc41c028375e2f6e"+"&entyId="+String(e.ETPS_ID)+"&type=02";break;case"PE":t=[{cname:"UNISC_ID",showname:"统一社会信用代码"},{cname:"REG_NO",showname:"注册号"},{cname:"NAME",showname:"个体名称"},{cname:"ADDRESS",showname:"地址"}],r="http://10.214.3.195:8001/coop/syn/detail_register_view_out?ifEncrypt=0&userName="+"wdzc"+"&passWord="+"68cf63c62bc68d71fc41c028375e2f6e"+"&entyId="+String(e.PE_ID)+"&type=05";break;case"YDYZ":t=[{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"}],r="http://10.214.3.195:8001/coop/syn/detail_register_view_out?ifEncrypt=0&userName="+"wdzc"+"&passWord="+"68cf63c62bc68d71fc41c028375e2f6e"+"&entyId="+String(e.ROWGUID)+"&type=05"}var a="";for(var o in e)for(var i=0;i<t.length;i++)o==t[i].cname&&(a+=t[i].showname+":"+e[o]+"<br>");return a+="<br><a href='"+r+"' target='blank'>[点击详情信息]</a>"}function quickQueryIFrameToHTMLStr(e){var t=String(e.主键),r="";switch(select_zylx.value){case"PARK":r="http://10.214.4.162:8080/parkms/tj/parksysSuperviseCD_SSLDL.action?systemsign=408080a758f26bb00158f26f13f30001&is_Park=1&buildingInfosId="+t;break;case"BUILDING":r="http://10.214.4.162:8080/parkms/tj/parksysSuperviseCD_SSLDL.action?systemsign=408080a758f26bb00158f26f13f30001&is_Park=2&buildingInfosId="+t}return" <div style='width:600px;height:500px;'><iframe src='"+r+"' width='100%' height='100%' frameborder='1' scrolling='yes'></iframe></div>"}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",""!=document.getElementById("name").value?(queryExtent=null,btClear_Click(),queryAll()):alert("请输入查询内容")}function newOpenLayer(l,e,t,y,u){if(1==e)e="街道乡镇";else{if(2!=e)return;e="区县边界"}var c=GetFeatureLayerIdbyName(e),m="",p="",d="";d="街道乡镇"==e?(m="街道名称 = '"+t+"'",p="街道代码"):(m="区县名称 = '"+t+"'",p="区县代码","区代码"),-1==c?window.parent.postMessage({method:"newOpenLayer",data:["参数type填写错误"]},"*"):require(["esri/tasks/QueryTask","esri/tasks/support/Query","esri/layers/FeatureLayer","dojo/_base/array","dojo/dom"],function(a,o,e,t,r){var i=dyLayer.url+"/"+c,s=i+"?f=pjson",n=GetXmlHttpObject();n.open("GET",s,!0),n.send(),n.onreadystatechange=function(){if(4==n.readyState){var e=n.responseText,t=(JSON.parse(e),new a({url:i})),r=new o({geometry:queryExtent,returnGeometry:!0,outFields:["*"]});r.where=m,t.execute(r).then(function(e){if(0==e.features.length)return void window.parent.postMessage({method:"newOpenLayer",data:["参数name填写错误"]},"*");var t=e.features[0],r=e.features[0].attributes[p];newOpenLayerbyWhere(l,u,d,r),y&&m_view.goTo(t.geometry)}).otherwise(function(e){})}}})}function newOpenLayerbyWhere(r,m,p,d){if(m)require(["esri/layers/FeatureLayer","dojo/on"],function(y,e){var u=GetFeatureLayerIdbyName(r),t=dyLayer.url+"/"+u+"?f=pjson",c=GetXmlHttpObject();c.open("GET",t,!0),c.send(),c.onreadystatechange=function(){if(4==c.readyState){var e,t=c.responseText,r=JSON.parse(t),a=(r.drawingInfo.renderer,r.drawingInfo.renderer.symbol);r&&("esriSFS"==a.type?e={type:"simple-fill",style:changeStyle(a.style),color:a.color,outline:{style:changeStyle(a.outline.style),color:a.outline.color,width:a.outline.width}}:"esriPMS"==a.type?e={type:"picture-marker",url:"data:image/png;base64,"+a.imageData,width:a.width,height:a.height}:"esriSMS"==a.type&&(e={type:"simple-marker",size:a.size,color:a.color,outline:a.outline}));for(var o={type:"unique-value",field:p,uniqueValueInfos:[{value:d,symbol:e}]},i=GetConfigDataByName("MYFeatureLayerLayer"),s=!0,n=0;n<m_map.layers.length;n++){if("esri.layers.FeatureLayer"==m_map.layers.getItemAt(n).declaredClass)if(m_map.layers.getItemAt(n).id==u){m_map.layers.getItemAt(n).renderer=o,m_map.layers.getItemAt(n).visible=m,s=!1;break}}if(s){var l=new y({url:i+"/"+u,id:u,definitionExpression:p+"="+d});l.visible=m,l.outFields=["*"],m_map.add(l,1)}}}});else for(var e=GetFeatureLayerIdbyName(r),t=0;t<m_map.layers.length;t++){if("esri.layers.FeatureLayer"==m_map.layers.getItemAt(t).declaredClass)if(m_map.layers.getItemAt(t).id==e){m_map.layers.getItemAt(t).visible=m,m_map.remove(m_map.layers.getItemAt(t));break}}}function newQuerybyWhereStr(e,t,r,a,o,i){""==e&&(e="1=1"),null!=o&&null!=o||(o=!0),null!=i&&null!=i||(i=!0);var s=GetFeatureLayerIdbyName(t);-1==s?window.parent.postMessage({method:"queryByGeometryAndLayer",data:["没有此图层"]},"*"):newQueryGraphicByDylayer(s,e,r,a,o,i)}function newQueryGraphicByDylayer(i,y,e,u,c,m){require(["esri/tasks/QueryTask","esri/tasks/support/Query","esri/layers/FeatureLayer","dojo/_base/array","dojo/dom"],function(a,o,e,s,t){btClear_Click();var n=dyLayer.url+"/"+i,r=n+"?f=pjson",l=GetXmlHttpObject();l.open("GET",r,!0),l.send(),l.onreadystatechange=function(){var e=l.responseText;if(4==l.readyState){var i=JSON.parse(e),t=new a({url:n}),r=new o({geometry:queryExtent,returnGeometry:!0,outFields:["*"]});r.spatialRelationship="intersects",r.geometry=u||null,r.where=y,t.execute(r).then(function(e){if(0==e.features.length)return void window.parent.postMessage({method:"queryByGeometryAndLayer",data:[]},"*");var o=[],t=s.map(e.features,function(e){var t=i;o.push(e.attributes);var r=t.drawingInfo.renderer.symbol;if("2D"==currentMapMode)r?"esriSFS"==r.type?e.symbol={type:"simple-fill",style:changeStyle(r.style),color:r.color,outline:{style:changeStyle(r.outline.style),color:r.outline.color,width:r.outline.width}}:"esriPMS"==r.type?e.symbol={type:"picture-marker",url:"data:image/png;base64,"+r.imageData,width:r.width,height:r.height}:"esriSMS"==r.type&&(e.symbol={type:"simple-marker",size:r.size,color:r.color,outline:r.outline}):e.symbol={type:"simple-marker",color:rgba(255,0,0,1),outline:{color:[0,0,0,1],width:1}};else{var a={screenLength:40,maxWorldLength:200,minWorldLength:35};"esriSFS"==r.type?e.symbol={type:"polygon-3d",symbolLayers:[{type:"fill",material:{color:r.color}}],outline:{color:r.outline.color,size:r.outline.size}}:"esriPMS"==r.type?e.symbol={type:"point-3d",symbolLayers:[{type:"icon",resource:{href:"data:image/png;base64,"+r.imageData},size:20,outline:{color:"white",size:2}}],verticalOffset:a,callout:{type:"line",color:"white",size:2,border:{color:"#40C2B4"}}}:"esriSMSCircle"==r.style&&(e.symbol={type:"point-3d",symbolLayers:[{type:"icon",resource:{primitive:"circle"},size:2*r.size,material:{color:r.color},outline:{color:r.outline.color,size:r.outline.size}}],verticalOffset:a,callout:{type:"line",color:"white",size:2,border:{color:"#40C2B4"}}})}e.geometry.spatialReference=m_view.spatialReference;attributesToHTMLStr(e.attributes);return e});c&&(GraphicsLayer_myLayer.addMany(t),m&&m_view.goTo(t));window.parent.postMessage({method:"queryByGeometryAndLayer",data:[o]},"*")}).otherwise(function(e){console.error("错误信息: ",e.message)})}}})}function querybyWhereStr(e,t){""==e&&(e=" 1=1 ");var r=GetFeatureLayerIdbyName(t);-1==r?alert("没有此图层"):queryGraphicByDylayer(r,e,"http://10.101.35.46:6080/arcgis/rest/services/WJJBH/FeatureServer")}function GetFeatureLayerIdbyName(e){var t=-1;if(""!=extraLayerJsonData){var r=extraLayerJsonData.layers;if(0<r.length)for(var a=0;a<r.length;a++)if(r[a].name==e){t=null==r[a].subLayerIds?r[a].id:1==r[a].subLayerIds.length?r[a].subLayerIds[0]:r[a].subLayerIds[1];break}}return t}function queryAll(){(queryList.splice(0,queryList.length),"3D"==currentMapMode)?queryRecursive(document.getElementById("quertLayerSelect").value):(queryRecursive(0),progress("0%"))}function queryRecursive(j){var layerInfo=GetDynamicServiceLayer();"2D"==currentMapMode&&(j==Math.ceil(layerInfo.length/4)&&progress("30%"),j===Math.ceil(layerInfo.length/2)&&progress("60%"),j===Math.ceil(3*layerInfo.length/4)&&progress("90%"),j>=layerInfo.length&&progress("100%"));var name=document.getElementById("name").value;if(j==layerInfo.length)return 0==queryList.length?void alert("没有结果"):(m_view.goTo(GraphicsLayer_myLayer.graphics),dyCretateTableByArray("queryTable1",queryList,["名称","图层名"],["名称","图层名"],!1,!0),void goPage(1,"queryTable1"));for(var layerField="",xmlDoc1=xmlUtil.loadXmlFromFile("config/layerQueryName.xml"),layerXml=xmlDoc1.getElementsByTagName(GetLayerNamebyId(j)),mapNodes=layerXml[0].childNodes,i=0;i<mapNodes.length;i++)"name"==xmlUtil.getNodeTagName(mapNodes[i])&&(layerField=xmlUtil.getNodeValue(mapNodes[i]));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,qTask=new QueryTask({url:urlI}),params=new Query({geometry:queryExtent,returnGeometry:!0,outFields:["*"]}),where;function getResults(response){var peakResults=arrayUtils.map(response.features,function(feature){var obj=eval("("+symble[j]+")"),symbolJson=obj.drawingInfo.renderer.symbol;if("2D"==currentMapMode)"esriSFS"==symbolJson.type?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}}:"esriPMS"==symbolJson.type&&(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("esriSFS"==symbolJson.type){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},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"esriPMS"==symbolJson.type?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"}}}:"esriSMSCircle"==symbolJson.style&&(feature.symbol={type:"point-3d",symbolLayers:[{type:"icon",resource:{primitive:"circle"},size:2*symbolJson.size,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};return queryList.push(list),"3D"==currentMapMode&&"esriSFS"==symbolJson.type?(polygonGraphic.geometry.spatialReference=m_view.spatialReference,polygonGraphic.popupTemplate=popupTemplate,polygonGraphic):feature});if(GraphicsLayer_myLayer.addMany(peakResults),"3D"==currentMapMode){if(0==queryList.length)return void alert("没有结果");m_view.goTo(GraphicsLayer_myLayer.graphics),dyCretateTableByArray("queryTable1",queryList,["名称","图层名"],["名称","图层名"],!1,!0),goPage(1,"queryTable1")}else queryRecursive(j+1)}function promiseRejected(e){console.error("图层:"+j+"错误信息: ",e.message)}where=null==name||""==name?"1=1":layerField+" like '%"+name+"%' ",params.where=where,qTask.execute(params).then(getResults).otherwise(promiseRejected)})}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(e,t,r,a,o,i,s,n,l,y,u,c,m,p,d){var g=m_drawtool.create("polygon");function f(e){var t=e.vertices;btClear_Click();var r=new p({rings:t,spatialReference:m_view.spatialReference}),a=(graphic=new c({geometry:r,symbol:{type:"simple-fill",color:[178,102,234,.8],style:"solid",outline:{color:[255,255,255],width:2}}}),graphic);GraphicsLayer_DrawLayer.add(a),queryExtent=r}m_view.focus(),g.on("vertex-add",f),g.on("cursor-update",f),g.on("vertex-remove",f),g.on("draw-complete",function(e){f(e),queryAll()})})}function queryByStreet(){document.getElementById("name").value="",queryExtent=null,btClear_Click(),m_drawtool.create("point").on("draw-complete",function(e){createPointGraphic(e.coordinates,"街道乡镇")})}function queryByCommittees(){document.getElementById("name").value="",queryExtent=null,btClear_Click(),m_drawtool.create("point").on("draw-complete",function(e){createPointGraphic(e.coordinates,"村居委会")})}function createPointGraphic(r,a){require(["esri/geometry/Point"],function(e){m_view.graphics.removeAll();var t=new e({x:r[0],y:r[1],spatialReference:m_view.spatialReference});queryExtent=t,queryExtentByPoint(a)})}function queryExtentByPoint(n){var l=GetLayerIdbyName(n);require(["esri/tasks/QueryTask","esri/tasks/support/Query","esri/layers/FeatureLayer","dojo/_base/array","dojo/dom"],function(e,t,r,a,o){var i=new e({url:dyLayer.url+"/"+l}),s=new t({geometry:queryExtent,returnGeometry:!0,outFields:["*"]});s.where="1=1",i.execute(s).then(function(e){0==a.map(e.features,function(e){return e.geometry.spatialReference=m_view.spatialReference,queryExtent=null,queryExtent=e.geometry,e}).length?alert("无此范围"+n):queryAll()}).otherwise(function(e){console.error("错误信息: ",e.message)})})}function createLayerSelect(e){var t,r=document.getElementById(e);if(r.innerHTML="",null!=(t=GetDynamicServiceLayer()))for(var a=t.length;0<a;a--){var o=document.createElement("option"),i=t.getItemAt(a-1);o.innerHTML=i.title,o.value=i.id,r.append(o)}}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(u,s){require(["esri/tasks/QueryTask","esri/tasks/support/Query","esri/layers/FeatureLayer","dojo/_base/array","dojo/dom"],function(e,t,r,y,a){var o=new e({url:dyLayer.url+"/"+GetLayerIdbyName(s)}),i=new t({returnGeometry:!0,outFields:["*"]});i.where="1=1",o.execute(i).then(function(e){var t=y.map(e.features,function(e){return e}),r=document.getElementById(u);r.innerHTML="";for(var a=0;a<t.length;a++)if(a%2==1){var o=document.createElement("tr");(s=document.createElement("td")).setAttribute("style","width:230px;height:30px"),s.setAttribute("align","left"),(n=document.createElement("input")).setAttribute("type","checkbox"),n.setAttribute("name","statistics1CheckBox"),n.value=t[a-1].attributes.名称,s.append(n),s.append(t[a-1].attributes.名称),(l=document.createElement("td")).setAttribute("style","width:230px;height:30px"),l.setAttribute("align","left");var i=document.createElement("input");i.setAttribute("type","checkbox"),i.setAttribute("name","statistics1CheckBox"),i.value=t[a].attributes.名称,l.append(i),l.append(t[a].attributes.名称),o.append(s),o.append(l),r.append(o)}else if(a==t.length-1){var s,n;o=document.createElement("tr");(s=document.createElement("td")).setAttribute("style","width:230px;height:30px"),s.setAttribute("align","left"),(n=document.createElement("input")).setAttribute("type","checkbox"),n.setAttribute("name","statistics1CheckBox"),n.value=t[a-1].attributes.名称,s.append(n),s.append(t[a-1].attributes.名称);var l=document.createElement("td");o.append(s),o.append(l),r.append(o)}}).otherwise(function(e){console.error("错误信息: ",e.message)})})}function statistic(){var e=document.getElementsByName("statistics1CheckBox");statisticCheckBoxArray.splice(0,statisticCheckBoxArray.length);for(var t=0;t<e.length;t++)e[t].checked&&statisticCheckBoxArray.push(e[t].value);statisticCheckBoxArray.length<1?alert("请至少选择一个街道"):(statisticResultList.splice(0,statisticResultList.length),btClear_Click(),document.getElementById("statistics1").style.display="none",document.getElementById("statistics2").style.display="",recursive(0))}function recursive(e){if(e<statisticCheckBoxArray.length){var t=document.getElementById("statistics1LayerSelect").options;queryPolygonByStatistic(statisticCheckBoxArray[e],t[t.selectedIndex].value,e)}}function queryPolygonByStatistic(n,l,y){require(["esri/tasks/QueryTask","esri/tasks/support/Query","esri/layers/FeatureLayer","dojo/_base/array","dojo/dom"],function(e,t,r,a,o){var i=new e({url:dyLayer.url+"/"+GetLayerIdbyName("街道乡镇")}),s=new t({returnGeometry:!0,outFields:["*"]});s.where="名称='"+n+"'",i.execute(s).then(function(e){queryPointByStatistic(a.map(e.features,function(e){return e})[0].geometry,l,y)}).otherwise(function(e){console.error("错误信息: ",e.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,qTask=new QueryTask({url:url}),params=new Query({geometry:geometry,returnGeometry:!0,outFields:["*"]});function getResults(response){var peakResults=arrayUtils.map(response.features,function(feature){if("2D"==currentMapMode){var obj=eval("("+symble[urlid]+")"),symbolJson=obj.drawingInfo.renderer.symbol;"esriSFS"==symbolJson.type?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}}:"esriPMS"==symbolJson.type?feature.symbol={type:"picture-marker",url:"data:image/png;base64,"+symbolJson.imageData,width:symbolJson.width,height:symbolJson.height}:"esriSMSCircle"==symbolJson.style&&(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},obj=eval("("+symble[urlid]+")"),symbolJson=obj.drawingInfo.renderer.symbol;if("esriSFS"==symbolJson.type){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},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"esriPMS"==symbolJson.type?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"}}}:"esriSMSCircle"==symbolJson.style&&(feature.symbol={type:"point-3d",symbolLayers:[{type:"icon",resource:{primitive:"circle"},size:2*symbolJson.size,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)};return"3D"==currentMapMode&&"esriSFS"==symbolJson.type?(polygonGraphic.geometry.spatialReference=m_view.spatialReference,polygonGraphic.popupTemplate=popupTemplate,polygonGraphic):(feature.geometry.spatialReference=m_view.spatialReference,feature.popupTemplate=popupTemplate,feature)});statisticResultList.push({"名称":statisticCheckBoxArray[statisticResultList.length],"数量":peakResults.length,"图形集":peakResults}),GraphicsLayer_myLayer.addMany(peakResults),statisticResultList.length==statisticCheckBoxArray.length&&(m_view.goTo(GraphicsLayer_myLayer.graphics),dyCretateTableByArray("statistics2Table",statisticResultList,["名称","数量"],["名称","数量"],!1,!0),creatPie(statisticResultList,"statistics2Div2"),createBar(statisticResultList,"statistics2Div3")),recursive(value+1)}function promiseRejected(e){console.error("错误信息: ",e.message)}params.where="1=1",qTask.execute(params).then(getResults).otherwise(promiseRejected)})}function openRoadQuery(){document.getElementById("roadQuery").style.display=""}function closeRoadQuery(){document.getElementById("roadQuery").style.display="none"}function searchRoadByName(){var e=document.getElementById("addressName").value;""!=e?(openRoadQuery(),searchRoadName=e,searchRoadPage(1)):alert("请输入要检索的关键字!")}function showRoadPoint(o,i,s){require(["esri/Graphic"],function(e){var t,r={type:"point",x:o,y:i,spatialReference:m_view.spatialReference};if("2D"==currentMapMode)t={type:"picture-marker",url:"QPimage/top/layerPopup.png",width:"20px",height:"30px"};else{t={type:"point-3d",symbolLayers:[{type:"icon",resource:{href:"QPimage/top/layerPopup.png"},size:20}],verticalOffset:{screenLength:40,maxWorldLength:200,minWorldLength:35},callout:{type:"line",color:"white",size:2,border:{color:"#40C2B4"}}}}var a=new e({geometry:r,symbol:t});a.attributes={roadname:s},GraphicsLayer_myLayer.add(a)})}function showRoad(r,a){require(["esri/geometry/Point"],function(e){var t=new e({x:r,y:a,spatialReference:m_view.spatialReference});m_view.goTo(t)})}function doToolTip(){function t(e){if(e.results.length){var t=e.results.filter(function(e){return e.graphic.layer===GraphicsLayer_myLayer})[0].graphic.attributes.roadname;null!=t&&(document.getElementById("info").style.visibility="visible",document.getElementById("info").innerHTML=t)}}m_view.on("pointer-move",function(e){m_view.hitTest(e).then(t)})}function createInfoDiv(){var e=document.createElement("div");e.setAttribute("id","info"),e.setAttribute("style","background-color: black;opacity: 0.75;color: orange; font-size: 18pt; padding: 8px;visibility: hidden;"),document.body.appendChild(e)}function showLoadingDiv(e){var t=document.createElement("div");t.setAttribute("id","divLoading"),t.innerHTML=e;var r=(window.screen.height-30-50)/2,a=(window.screen.width-10-200)/2;t.setAttribute("style","position: absolute;height:50px;width:200px;top:"+r+"px;left:"+a+"px;"),document.body.appendChild(t)}function removeLoadingDiv(){var e=document.getElementById("divLoading");e&&document.body.removeChild(e)}
|