1 |
- var m_map;var m_view;var m_sceneLayer;var m_zoom;var dyLayer;var m_drawtool;var m_printTool;var queryExtent;var xmlQueryExtend;var layerList;var symble=[];var initExtent;var FullExtent;var geometryService;var GraphicsLayer_labelLayer;var GraphicsLayer_myLayer;var GraphicsLayer_identityLayer;var GraphicsLayer_extendLayer;var GraphicsLayer_fickerLayer;var GraphicsLayer_DrawLayer;var GraphicsLayer_flyTipLayer;var lengthMeasureWidget;var groundColor=[0,0,0];var currentMapMode;var currentExtent;var currentScale;var highlightSelect;var highlightSelectExtra;var m_mapClickdraw=false;var m_mapAttribute='{ "ID": "1","名称": "测试点1" }';var m_mapToolTip="测试点1";var m_mapImgUrl="https://static.arcgis.com/images/Symbols/Shapes/BlackStarLargeB.png";var m_mapImgWidth="32px";var m_mapImgHeight="32px";var m_mapAddress;var m_maphitPoint;var spatialReferenceJson={wkt:'PROJCS["shanghaicity_chy",GEOGCS["GCS_Beijing_1954",DATUM["D_Beijing_1954",SPHEROID["Krasovsky_1940",6378245.0,298.3]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",-3457147.81],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",121.2751921],PARAMETER["Scale_Factor",1.0],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]'};var isMapLoaded=false;var fe0;var fe1;var fe2;var fe3;var fe4;var fe5;var fe6;var fe7;var fe8;var fe9;var fe10;function init3DScene(){currentMapMode="3D";require(["esri/Map","esri/Graphic","esri/geometry/Extent","esri/geometry/Polygon","esri/geometry/Point","esri/views/MapView","esri/views/SceneView","esri/layers/MapImageLayer","esri/layers/TileLayer","esri/layers/VectorTileLayer","esri/layers/GraphicsLayer","esri/tasks/GeometryService","esri/portal/Portal","esri/WebScene","esri/widgets/LayerList","esri/config","esri/widgets/ScaleBar","esri/layers/FeatureLayer","esri/layers/SceneLayer","esri/layers/support/LabelClass","esri/widgets/NavigationToggle","esri/widgets/Zoom","esri/widgets/Compass","esri/Color","esri/core/watchUtils","esri/symbols/TextSymbol","esri/Camera","dojo/domReady!"],function(Map,Graphic,Extent,Polygon,Point,MapView,SceneView,MapImageLayer,TileLayer,VectorTileLayer,GraphicsLayer,GeometryService,Portal,WebScene,LayerList,esriConfig,ScaleBar,FeatureLayer,SceneLayer,LabelClass,NavigationToggle,Zoom,Compass,Color,watchUtils,TextSymbol,Camera){esriConfig.request.corsEnabledServers.push("http://10.101.35.46");m_map=new Map({ground:{surfaceColor:groundColor}});dyAddMapLayerByConfig();AddMapGraphicLayers();m_view=new SceneView({container:"mapDiv",constraints:{collision:{enabled:false},tilt:{max:179.99,min:0}},map:m_map,viewingMode:"local",alphaCompositingEnabled:true,environment:{background:{type:"color",color:[0,0,0,1]},starsEnabled:false,atmosphereEnabled:false},ui:{components:["attribution"]}});AddSceneViewWidget();m_view.when(function(){var centerPoint=new Point({x:43184,y:-37270,z:2e3,spatialReference:m_view.spatialReference});setCameraBypoint(0,centerPoint,45,45,currentScale);var displaynoneDiv1=document.getElementsByClassName("esri-attribution__powered-by");for(var i=0;i<displaynoneDiv1.length;i++){displaynoneDiv1[i].style.display="none"}var displaynoneDiv2=document.getElementsByClassName("esri-widget-button");for(var i=0;i<displaynoneDiv2.length;i++){displaynoneDiv2[i].style.display="none"}m_view.watch("camera",updateIndicator);watchUtils.when(m_view,"animation",watchAnimation);m_zoom=new Zoom({view:m_view});m_view.ui.add(m_zoom,{position:"top-right"});var m_navigateToggle=new NavigationToggle({view:m_view});m_view.ui.add(m_navigateToggle,{position:"top-right"});var m_compass=new Compass({view:m_view});m_view.ui.add(m_compass,{position:"top-right"});m_view.ui.add("info","top-right");if(currentExtent!=null){m_view.extent=currentExtent;setCameraBypoint(1,currentExtent.center,0,45,currentScale)}});m_view.on("click",function(event){var screenPoint={x:event.x,y:event.y};var hitPoint=m_view.toMap(screenPoint);console.log("hitPoint:",hitPoint);m_view.hitTest(screenPoint).then(function(response){var result=response.results[0];if(result){var x=result.mapPoint.x;var y=result.mapPoint.y;if(result.graphic){m_view.whenLayerView(result.graphic.layer).then(function(lyrView){if(highlightSelect){highlightSelect.remove()}highlightSelect=lyrView.highlight(result.graphic);lyrView.goTo({target:result.graphic})})}console.log("Hit surface at ("+x+", "+y+"), graphic:",result.graphic||"none")}})});function setContentInfo(center,scale,floorNumber){var popupDiv=document.createElement("div");popupDiv.setAttribute("style","height: 400px;width:600px;border: 1px solid #A8A8A8;");var layerFloor=new MapImageLayer({url:"http://120.55.160.15:6080/arcgis/rest/services/HKLZM/MapServer",id:"楼层"});var popupView=new MapView({container:popupDiv,map:new Map({layers:[layerFloor]}),center:new Point({x:589.976,y:4146.679}),constraints:{rotationEnabled:false},ui:{components:[]}});popupView.when(function(){popupView.extent=new Extent({xmin:480,ymin:4050,xmax:680,ymax:4250,spatialReference:popupView.spatialReference});if(floorNumber){if(floorNumber.length>0){var number=parseInt(floorNumber.substr(0,floorNumber.length-1));if(number>7){number=Math.ceil(number/2)}openLayer(popupView.map,"F"+number)}}});return popupView.container}function openLayer(openMap,layerName){var layers=openMap.layers.items[0].allSublayers;if(layers.length>0){for(var i=0;i<layers.length;i++){var layer=layers.items[i];if(layer.title==layerName){layer.visible=true;if(layer.sublayers){for(var j=0;j<layer.sublayers.length;j++){layer.sublayers.items[j].visible=true}}}else{if(layer.sublayers){layer.visible=false}}}}}function updateIndicator(camera){}function watchAnimation(animation){console.log("animation.state:",animation.state);animation.when(function(animation){console.log("animation:",animation)}).catch(function(animation){console.log(animation.state)})}function watchCircle(pointX,pointY,pointZ,headingValue,tiltValue){require(["esri/Camera","esri/geometry/Point"],function(Camera,Point){currentCircle=0;var pt=new Point({x:pointX,y:pointY,z:pointZ,spatialReference:m_view.spatialReference});var cam=new Camera({heading:headingValue,tilt:tiltValue,position:pt});m_view.camera=cam;beginCircle(pointX,pointY,pointZ,currentCircle,tiltValue)})}var currentCircle=0;isCircle=false;function beginCircle(pointX,pointY,pointZ,headingValue,tiltValue){var duringTime=1e3;var R=pointZ*Math.tan(tiltValue*Math.PI/180);var viewX=pointX-R*Math.cos((90-headingValue)*Math.PI/180);var viewY=pointY-R*Math.sin((90-headingValue)*Math.PI/180);m_view.goTo({center:[viewX,viewY,pointZ,m_view.spatialReference],heading:headingValue,tilt:tiltValue},{easing:"linear",duration:duringTime}).then(function(){if(isCircle){if(currentCircle>360){currentCircle=0}if(currentCircle<0){currentCircle=360}currentCircle-=1;console.log(currentCircle);beginCircle(pointX,pointY,pointZ,currentCircle,tiltValue)}})}function AddSceneViewWidget(){var viewTest=document.getElementById("viewTest");m_view.ui.add(viewTest,"bottom-right")}function dyAddMapLayerByConfig(){var serverUrl;var serverType;var serverLabel;var serverVisible;GetConfigData();var mapXml=xmlDoc.getElementsByTagName("map");var mapNodes=mapXml[0].childNodes;for(var i=0;i<mapNodes.length;i++){var nodeObj=mapNodes[i];if(nodeObj.nodeType==1){var tagName=xmlUtil.getNodeTagName(nodeObj);var value=xmlUtil.getNodeValue(nodeObj);if(tagName=="geometryservice"){serverType="geometryservice";serverUrl=value;dyAddMapLayer(serverUrl,serverType,serverLabel,serverVisible)}else if(tagName=="fullextent"){var extentArray=value.split(",");fullExtent=new Extent(parseFloat(extentArray[0]),parseFloat(extentArray[1]),parseFloat(extentArray[2]),parseFloat(extentArray[3]))}else{if(tagName=="basemaps"&¤tMapMode=="2D"){var childNodes=nodeObj.childNodes;for(var j=0;j<childNodes.length;j++){var childNode=childNodes[j];if(childNode.nodeType==1){for(var k=0;k<childNode.attributes.length;k++){var attribute=childNode.attributes[k];var attributeName=attribute.name;if(attributeName=="label"){serverLabel=attribute.value}if(attributeName=="type"){serverType=attribute.value}if(attributeName=="visible"){if(attribute.value=="false")serverVisible=false;else serverVisible=true}}serverUrl=xmlUtil.getNodeValue(childNode);dyAddMapLayer(serverUrl,serverType,serverLabel,serverVisible)}}}if(tagName=="basemaps3D"&¤tMapMode=="3D"){var childNodes=nodeObj.childNodes;for(var j=0;j<childNodes.length;j++){var childNode=childNodes[j];if(childNode.nodeType==1){for(var k=0;k<childNode.attributes.length;k++){var attribute=childNode.attributes[k];var attributeName=attribute.name;if(attributeName=="label"){serverLabel=attribute.value}if(attributeName=="type"){serverType=attribute.value}if(attributeName=="visible"){if(attribute.value=="false")serverVisible=false;else serverVisible=true}}serverUrl=xmlUtil.getNodeValue(childNode);dyAddMapLayer(serverUrl,serverType,serverLabel,serverVisible)}}}}}}}function dyAddMapLayer(serverUrl,serverType,serverLabel,serverVisible){var layer;switch(serverType){case"geometryservice":{geometryService=new GeometryService(serverUrl);break}case"tiled":{if(currentMapMode=="2D"){layer=new TileLayer({url:serverUrl,id:serverLabel});layer.visible=serverVisible;m_map.add(layer)}break}case"dynamic":{dyLayer=new MapImageLayer({url:serverUrl,id:serverLabel});dyLayer.visible=serverVisible;var currentElevationInfo={mode:"relative-to-ground",offset:-1,unit:"meters"};dyLayer.elevationInfo=currentElevationInfo;m_map.add(dyLayer);break}case"featurelayer":{m_map.add(layer);break}case"scene":{m_sceneLayer=new SceneLayer({url:serverUrl,id:serverLabel,popupEnabled:true});var locationRenderer={type:"simple",symbol:{type:"mesh-3d",symbolLayers:[{type:"fill",material:{color:nightBuildingColor,colorMixMode:"replace"},edges:{type:"solid",color:[27,68,130,.6],size:1.5}}]}};m_sceneLayer.renderer=locationRenderer;m_map.add(m_sceneLayer);break}case"vector":{var vlayer=new VectorTileLayer({url:serverUrl,id:serverLabel});m_map.add(vlayer);break}}}function AddMapGraphicLayers(){GraphicsLayer_labelLayer=new GraphicsLayer;GraphicsLayer_labelLayer.listMode="hide";GraphicsLayer_myLayer=new GraphicsLayer;GraphicsLayer_myLayer.listMode="hide";GraphicsLayer_identityLayer=new GraphicsLayer;GraphicsLayer_identityLayer.listMode="hide";GraphicsLayer_extendLayer=new GraphicsLayer;GraphicsLayer_extendLayer.listMode="hide";GraphicsLayer_fickerLayer=new GraphicsLayer;GraphicsLayer_fickerLayer.listMode="hide";GraphicsLayer_DrawLayer=new GraphicsLayer;GraphicsLayer_DrawLayer.listMode="hide";GraphicsLayer_flyTipLayer=new GraphicsLayer;GraphicsLayer_flyTipLayer.listMode="hide";m_map.add(GraphicsLayer_labelLayer);m_map.add(GraphicsLayer_identityLayer);m_map.add(GraphicsLayer_extendLayer);m_map.add(GraphicsLayer_DrawLayer);m_map.add(GraphicsLayer_myLayer);m_map.add(GraphicsLayer_flyTipLayer);m_map.add(GraphicsLayer_fickerLayer)}})}function GetIFrameInfoWinContent(type,url){var str=" <div style='width:600px;height:500px;'><iframe src='"+url+"' width='100%' height='100%' frameborder='0' scrolling='yes'></iframe></div>";return str}function setCamera(isAnimation,pointX,pointY,pointZ,headingValue,tiltValue,scaleValue){require(["esri/Camera","esri/geometry/Point"],function(Camera,Point){var pt=new Point({x:pointX,y:pointY,z:pointZ,spatialReference:m_view.spatialReference});if(isAnimation){m_view.goTo({target:pt,heading:headingValue,tilt:tiltValue,scale:scaleValue})}else{var cam=new Camera({heading:headingValue,tilt:tiltValue,position:pt});m_view.camera=cam}})}function setCameraBypoint(isAnimation,centerPoint,headingValue,tiltValue,scaleValue){require(["esri/Camera","esri/geometry/Point"],function(Camera,Point){var R=centerPoint.z*Math.tan(tiltValue*Math.PI/180);var viewX=centerPoint.x-R*Math.cos((90-headingValue)*Math.PI/180);var viewY=centerPoint.y-R*Math.sin((90-headingValue)*Math.PI/180);var viewZ=centerPoint.z;console.log("viewX:"+viewX+",viewY:"+viewY+",viewZ:"+viewZ);if(isAnimation){m_view.goTo({center:[viewX,viewY,viewZ,m_view.spatialReference],heading:headingValue,tilt:tiltValue})}else{var point=new Point({x:viewX,y:viewY,z:viewZ,spatialReference:m_view.spatialReference});var cam=new Camera({heading:headingValue,tilt:tiltValue,position:point});m_view.camera=cam}})}function switchTo2DMap(){currentExtent=m_view.extent;currentScale=m_view.scale;currentExtent.spatialReference=m_view.spatialReference;initMap()}function switchTo3DMap(){currentExtent=m_view.extent;currentScale=m_view.scale;currentExtent.spatialReference=m_view.spatialReference;init3DScene()}function getLayerByLayerId(layerID){for(var i=0;i<m_map.layers.items.length;i++){if(m_map.layers.items[i].layerId==layerID){return m_map.layers.items[i]}}}function highLightByObjectIDs(objIDArray){m_view.whenLayerView(m_sceneLayer).when(function(lyrView){if(highlightSelect){highlightSelect.remove()}highlightSelect=lyrView.highlight(objIDArray)})}function highLightByGeomtry(geometry){require(["esri/tasks/support/Query","esri/tasks/QueryTask","esri/core/watchUtils","esri/geometry/Geometry"],function(Query,QueryTask,watchUtils,Geometry){var query=new Query;query.geometry=geometry.extent;query.spatialRelationship="intersects";query.outFields=["OBJECTID"];m_view.whenLayerView(m_sceneLayer).when(function(lyrView){if(highlightSelect){highlightSelect.remove()}var objids=[];watchUtils.whenNotOnce(lyrView,"updating").when(function(){lyrView.queryObjectIds(query).when(function(ids){console.log(ids);objids=ids},function(error){objids=ids})});highlightSelect=lyrView.highlight(objids)})})}function hitTest(geomtry){m_view.hitTest(geomtry).when(function(response){var result=response.results[0];if(result){var x=result.mapPoint.x;var y=result.mapPoint.y;if(result.graphic){m_view.whenLayerView(result.graphic.layer).when(function(lyrView){if(highlightSelect){highlightSelect.remove()}highlightSelect=lyrView.highlight(result.graphic);m_view.popup.open({title:"Reverse geocode",features:result.graphic,content:"This is a point of interest"})})}}})}var viewxmax;var viewxmin;var viewymax;var viewymin;var x;var y;function initMap(){currentMapMode="2D";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/layers/FeatureLayer","esri/widgets/ScaleBar","esri/WebMap","esri/geometry/SpatialReference","esri/Graphic","esri/views/2d/draw/Draw","esri/geometry/Polygon","esri/widgets/Zoom","esri/widgets/Compass","esri/widgets/LayerList","esri/geometry/geometryEngine","esri/tasks/QueryTask","esri/tasks/support/Query","esri/geometry/Point","esri/core/watchUtils","dojo/on"],function(Map,MapView,MapImageLayer,TileLayer,Geometry,Extent,GeometryService,GraphicsLayer,FeatureLayer,ScaleBar,WebMap,SpatialReference,Graphic,Draw,Polygon,Zoom,Compass,LayerList,geometryEngine,QueryTask,Query,Point,watchUtils,on){m_map=new Map({logo:false,slider:false});dyAddMapLayerByConfig();AddMapGraphicLayers();viewxmax=xmlDoc.getElementsByTagName("viewxmax")[0].innerHTML;viewxmin=xmlDoc.getElementsByTagName("viewxmin")[0].innerHTML;viewymax=xmlDoc.getElementsByTagName("viewymax")[0].innerHTML;viewymin=xmlDoc.getElementsByTagName("viewymin")[0].innerHTML;m_view=new MapView({container:"mapDiv",map:m_map,popup:{dockEnabled:false,dockOptions:{position:"top-right",breakpoint:false}}});m_view.constraints={rotationEnabled:false};m_zoom=new Zoom({view:m_view});layerList=new LayerList({view:m_view});AddSceneViewWidget();m_view.when(function(evt){createInfoDiv();doToolTip();var displaynoneDiv1=document.getElementsByClassName("esri-attribution__powered-by");for(var i=0;i<displaynoneDiv1.length;i++){displaynoneDiv1[i].style.display="none"}var displaynoneDiv2=document.getElementsByClassName("esri-widget-button");for(var i=0;i<displaynoneDiv2.length;i++){displaynoneDiv2[i].style.display="none"}m_zoom=new Zoom({view:m_view});var m_compass=new Compass({view:m_view});m_view.ui.remove("zoom");m_view.ui.remove("attribution");m_drawtool=new Draw({view:m_view});var centerx=m_view.center.x;var centery=m_view.center.y;m_view.watch("animation",function(response){if(response&&response.state==="running"){window.parent.postMessage({method:"mapAnimationInProgressCallback"},"*")}});m_view.on("drag",function(event){if(event.action=="end"){}else{window.parent.postMessage({method:"mapDragingCallback"},"*")}});m_view.on("click",function(event){if(m_mapClickdraw){var screenPoint={x:event.x,y:event.y};GraphicsLayer_DrawLayer.removeAll();var hitPoint=m_view.toMap(screenPoint);m_maphitPoint=hitPoint;var point=hitPoint.x+","+hitPoint.y;var jsonStr='{"ExChangeRoot": {"Features": ['+' { "type": "point", "featureName": "兴趣点", "Feature":[ { "Geometry": { "Points":[ { "Point": "'+point+'" } ]},'+'"Attribute": '+m_mapAttribute+', "ToolTip": "'+m_mapToolTip+'",'+'"ImgUrl":"'+m_mapImgUrl+'" ,"ImgWidth":"'+m_mapImgWidth+'","ImgHeight":"'+m_mapImgHeight+'" } ] } ]}}';doGetGraphicByJson(jsonStr,false);m_mapClickdraw=false;var url=GetConfigDataByName("WebServiceExtraURL");WsCommonClass("GetAddress",["x","y"],[hitPoint.x,hitPoint.y],mapClickdrawCallback,null,url);function mapClickdrawCallback(evt){if(evt[0]==null){window.parent.postMessage({method:"clicklocationcallbackfun",data:[]},"*");return}m_mapAddress=evt[0].textContent;var url=GetConfigDataByName("WebServiceConvertCoordinateURL");WsCommonClass("ConvertXYToLonLat",["lon","lat"],[m_maphitPoint.x,m_maphitPoint.y],mapClickdrawCallback1,null,url)}function mapClickdrawCallback1(evt){if(evt[0]==null){console.log("");return}var point=evt[0].textContent;window.parent.postMessage({method:"clicklocationcallbackfun",data:[point,m_mapAddress]},"*")}}m_view.hitTest(event).then(function(response){if(response.results.length){var result=response.results[0];if(result.graphic){switch(result.graphic.layer.id){case"myDrawGLayer":case"myGLayer":{var queryTask=new QueryTask({url:GetConfigDataByName("QueryLayer")+"/250"});var query=new Query;query.geometry=null;query.outFields=["*"];query.returnGeometry=true;query.spatialRelationship="intersects";query.where="1=1";query.geometry=result.graphic.geometry;queryTask.execute(query).then(function(results1){if(results1.features.length>0)window.parent.postMessage({method:"mapOnclickCallback",data:[JSON.stringify(result.graphic.attributes).replace(/\"/g,'"'),JSON.stringify(results1.features[0].attributes["网格编码"]).replace(/\"/g,'"')]},"*");else{window.parent.postMessage({method:"mapOnclickCallback",data:[JSON.stringify(result.graphic.attributes).replace(/\"/g,'"'),""]},"*")}});if(result.graphic.layer.id=="myGLayer"){var graphic;switch(result.graphic.geometry.type){case"point":{var point={type:"point",x:result.graphic.geometry.x,y:result.graphic.geometry.y,spatialReference:m_view.spatialReference};var markerSymbol={type:"simple-marker",color:[0,255,255,.5],style:"circle",size:26,outline:{width:.5,color:[0,255,255,.5]}};graphic=new Graphic({geometry:point,symbol:markerSymbol});break}}GraphicsLayer_flyTipLayer.removeAll()}break}default:{if(result.graphic.layer.declaredClass=="esri.layers.FeatureLayer"){var queryTask=new QueryTask({url:GetConfigDataByName("QueryLayer")+"/250"});var query=new Query;query.geometry=null;query.outFields=["*"];query.returnGeometry=true;query.spatialRelationship="intersects";query.where="1=1";query.geometry=result.graphic.geometry;queryTask.execute(query).then(function(results1){if(results1.features.length>0)window.parent.postMessage({method:"mapOnclickCallback",data:[JSON.stringify(result.graphic.attributes).replace(/\"/g,'"'),JSON.stringify(results1.features[0].attributes["网格编码"]).replace(/\"/g,'"')]},"*");else{window.parent.postMessage({method:"mapOnclickCallback",data:[JSON.stringify(result.graphic.attributes).replace(/\"/g,'"'),""]},"*")}})}break}}}}})})});var scaleBar=new ScaleBar({view:m_view});if(currentExtent!=null){m_view.extent=currentExtent}function dyAddMapLayerByConfig(){var serverUrl;var serverType;var serverLabel;var serverVisible;GetConfigData();var mapXml=xmlDoc.getElementsByTagName("map");var mapNodes=mapXml[0].childNodes;for(var i=0;i<mapNodes.length;i++){var nodeObj=mapNodes[i];if(nodeObj.nodeType==1){var tagName=xmlUtil.getNodeTagName(nodeObj);var value=xmlUtil.getNodeValue(nodeObj);if(tagName=="geometryservice"){serverType="geometryservice";serverUrl=value;dyAddMapLayer(serverUrl,serverType,serverLabel,serverVisible)}else if(tagName=="fullextent"){var extentArray=value.split(",");fullExtent=new Extent(parseFloat(extentArray[0]),parseFloat(extentArray[1]),parseFloat(extentArray[2]),parseFloat(extentArray[3]))}else if(tagName=="basemaps"){var childNodes=nodeObj.childNodes;for(var j=0;j<childNodes.length;j++){var childNode=childNodes[j];if(childNode.nodeType==1){for(var k=0;k<childNode.attributes.length;k++){var attribute=childNode.attributes[k];var attributeName=attribute.name;if(attributeName=="label"){serverLabel=attribute.value}if(attributeName=="type"){serverType=attribute.value}if(attributeName=="visible"){if(attribute.value=="false")serverVisible=false;else serverVisible=true}}serverUrl=xmlUtil.getNodeValue(childNode);dyAddMapLayer(serverUrl,serverType,serverLabel,serverVisible)}}}}}}function dyAddMapLayer(serverUrl,serverType,serverLabel,serverVisible){var layer;switch(serverType){case"geometryservice":{geometryService=new GeometryService(serverUrl);break}case"tiled":{layer=new TileLayer({url:serverUrl,id:serverLabel});layer.visible=serverVisible;m_map.add(layer);break}case"dynamic":{if(serverLabel=="卫监所动态数据"){layer=new MapImageLayer({url:serverUrl,sublayers:[{id:0,popupTemplate:{title:"{COUNTY}",content:"{POP2007} people lived in this county in 2007"}},{id:1,popupTemplate:{title:"{COUNTY}",content:"{POP2007} people lived in this county in 2007"}}]})}else{dyLayer=new MapImageLayer({url:serverUrl,id:serverLabel});dyLayer.visible=serverVisible}m_map.add(dyLayer);on(dyLayer,"load",function(evt){dynamicLayerLoaded(evt)});dyLayer.when(function(){var layerInfo=GetDynamicServiceLayer();for(var i=0;i<layerInfo.length;i++){GetLayerRestData(i)}});break}case"featurelayer":{var restUrl=serverUrl+"?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);if(LayerJsonData!=""){var layers=LayerJsonData.layers;if(layers.length>0){}}}};break}case"vector":{var vlayer=new VectorTileLayer({url:serverUrl,id:serverLabel});m_map.add(vlayer);break}}}function dynamicLayerLoaded(event){m_view.zoom=3}function AddMapGraphicLayers(){GraphicsLayer_labelLayer=new GraphicsLayer;GraphicsLayer_labelLayer.listMode="hide";GraphicsLayer_myLayer=new GraphicsLayer({id:"myGLayer"});GraphicsLayer_myLayer.listMode="hide";GraphicsLayer_identityLayer=new GraphicsLayer;GraphicsLayer_identityLayer.listMode="hide";GraphicsLayer_extendLayer=new GraphicsLayer;GraphicsLayer_extendLayer.listMode="hide";GraphicsLayer_fickerLayer=new GraphicsLayer;GraphicsLayer_fickerLayer.listMode="hide";GraphicsLayer_DrawLayer=new GraphicsLayer({id:"myDrawGLayer"});GraphicsLayer_DrawLayer.listMode="hide";GraphicsLayer_flyTipLayer=new GraphicsLayer;GraphicsLayer_flyTipLayer.listMode="hide";m_map.add(GraphicsLayer_labelLayer);m_map.add(GraphicsLayer_identityLayer);m_map.add(GraphicsLayer_extendLayer);m_map.add(GraphicsLayer_flyTipLayer);m_map.add(GraphicsLayer_myLayer);m_map.add(GraphicsLayer_fickerLayer);m_map.add(GraphicsLayer_DrawLayer)}function AddSceneViewWidget(){}watchUtils.whenTrue(m_view,"stationary",function(){if(m_view.center){var xmax=m_view.extent.xmax;var xmin=m_view.extent.xmin;var ymax=m_view.extent.ymax;var ymin=m_view.extent.ymin;var extent=m_view.extent;if(ecxtentChanged!==undefined&&ecxtentChanged.xmin===extent.xmin&&ecxtentChanged.ymin===extent.ymin&&ecxtentChanged.xmax===extent.xmax&&ecxtentChanged.ymax===extent.ymax)return;var precision=5e3;var diff=0;var hasChanged=false;if(isSetMapZoom){m_maxZoom=m_view.zoom;isSetMapZoom=false}if(viewxmin-xmin>precision){hasChanged=true;diff=viewxmin-xmin;xmin+=diff;xmax+=diff;if(xmax>viewxmax){diff=xmax-viewxmax;diff=(ymax-ymin)*diff/(xmax-xmin);xmax=viewxmax;ymin+=diff/2;ymax-=diff/2}}if(viewymin-ymin>precision){hasChanged=true;diff=viewymin-ymin;ymin+=diff;ymax+=diff;if(ymax>viewymax){diff=ymax-viewymax;diff=(xmax-xmin)*diff/(ymax-ymin);ymax=viewymax;xmin+=diff/2;xmax-=diff/2}}if(xmax-viewymax>precision){hasChanged=true;diff=xmax-viewymax;xmin-=diff;xmax-=diff;if(xmin<viewxmin){diff=viewxmin-xmin;diff=(ymax-ymin)*diff/(xmax-xmin);xmin=viewxmin;ymin+=diff/2;ymax-=diff/2}}if(ymax-viewymax>precision){hasChanged=true;diff=ymax-viewymax;ymin-=diff;ymax-=diff;if(ymin<viewymin){diff=viewymin-ymin;diff=(xmax-xmin)*diff/(ymax-ymin);ymin=viewymin;xmin+=diff/2;xmax-=diff/2}}if(hasChanged){ecxtentChanged=extent;m_view.extent=new Extent({xmin:xmin,ymin:ymin,xmax:xmax,ymax:ymax,spatialReference:m_view.spatialReference});return}window.parent.postMessage({method:"resizeCallback"},"*");x=m_view.center.x;y=m_view.center.y;document.addEventListener("touchstart",function(e){x=m_view.center.x;y=m_view.center.y;x=x-0;y=y-0});document.addEventListener("touchmove",function(e){e.preventDefault();if(e.touches.length>=2){x=x-0;y=y-0;m_view.center=new Point({x:x-0,y:y-0,spatialReference:m_view.spatialReference})}});document.addEventListener("touchend",function(e){})}})})}var ecxtentChanged;function initMapEdit(){require(["esri/Map","esri/views/MapView","esri/widgets/Editor","esri/layers/FeatureLayer"],function(Map,MapView,Editor,FeatureLayer){var editConfigCrimeLayer,editConfigPoliceLayer;m_map=new Map({logo:false});m_view=new MapView({container:"viewDiv",map:m_map});var serverUrl=GetConfigDataByName("EditLayer");var xmlHttpRest=GetXmlHttpObject();xmlHttpRest.open("GET",serverUrl+"?f=pjson",true);xmlHttpRest.send();xmlHttpRest.onreadystatechange=function(){var responseText=xmlHttpRest.responseText;if(xmlHttpRest.readyState==4){var LayerJsonData=JSON.parse(responseText);if(LayerJsonData!=""){var layers=LayerJsonData.layers;if(layers.length>0){for(var i=0;i<layers.length;i++){if(layers[i].subLayerIds==null){var layerId=layers[i].id;var layername=layers[i].name;var dyLayer=new FeatureLayer({url:serverUrl+"/"+layerId,id:layername,title:layername});dyLayer.visible=true;m_map.add(dyLayer)}}m_view.when(function(){function customGroup(grouping){var groupHeading="";switch(grouping.template.drawingTool){case"point":groupHeading="点";break;case"polyline":groupHeading="线";break;case"polygon":groupHeading="面";break}return groupHeading}var editor=new Editor({view:m_view,supportingWidgetDefaults:{featureTemplates:{groupBy:customGroup}}});m_view.ui.add(editor,"top-right")})}}}}})}function GetLayer(layerName){var layer;for(var i=0;i<m_map.layerIds.length;i++){var layeridName=m_map.layerIds[i];if(layeridName==layerName){layer=m_map._layers[layeridName];return layer}}}function QueryObjectByWhere(LayerName,where,returnFields,KeyValue){KeyValue=KeyValue?KeyValue:"Query";require(["esri/tasks/support/Query","esri/tasks/QueryTask"],function(Query,QueryTask){var query=new Query;if(GetConfigDataByName("QueryLayer")){dynamicLayerURL=GetConfigDataByName("QueryLayer")}var QueryLayerID=GetLayerIdbyName(LayerName);if(QueryLayerID==-1){return"无查询图层"}var queryTask=new QueryTask(dynamicLayerURL+"/"+QueryLayerID);queryTask.where=" 1=1 ";if(where!=""){query.where=where}query.outSpatialReference=m_map.spatialReference;query.returnGeometry=true;query.outFields=["*"];if(returnFields!=""){query.outFields=returnFields}queryTask.execute(query,function handleQueryResult(results){QueryObjectByWhereCompHandle(results,KeyValue)},function errorHandler(err){QueryObjectByWhereFaultHandle("查询不成功!",KeyValue)})})}function GetLayerIdbyName(name){var layerInfo;layerInfo=GetDynamicServiceLayer();if(layerInfo!=null){for(var j=0;j<layerInfo.length;j++){var currnetLayer=layerInfo.getItemAt(j);if(currnetLayer.title==name){return currnetLayer.id}}}return-1}function GetLayerNamebyId(id){var layerInfo;layerInfo=GetDynamicServiceLayer();if(layerInfo!=null){for(var j=0;j<layerInfo.length;j++){var currnetLayer=layerInfo.getItemAt(j);if(currnetLayer.id==id){return currnetLayer.title}}}return-1}function GetDynamicServiceLayer(){var layerInfo;for(var i=0;i<m_map.layers.length;i++){var BaseLayer=m_map.layers.getItemAt(i);if(BaseLayer.declaredClass=="esri.layers.MapImageLayer"){layerInfo=m_map.layers.getItemAt(i).sublayers;dynamicLayerURL=BaseLayer.url;return layerInfo}else{}}return null}function ClearMap(){GraphicsLayer_labelLayer.clear();GraphicsLayer_myLayer.clear();GraphicsLayer_identityLayer.clear();GraphicsLayer_extendLayer.clear();GraphicsLayer_fickerLayer.clear();GraphicsLayer_DrawLayer.clear();GraphicsLayer_flyTipLayer.clear()}function OpenLayer(layerName,layerVisible){require(["esri/Map","esri/views/MapView","esri/layers/MapImageLayer","dojo/on"],function(Map,MapView,MapImageLayer,on){var layer;var layerid=GetLayerIdbyName(layerName);for(var i=0;i<m_map.layers.length;i++){var BaseLayer=m_map.layers.getItemAt(i);if(BaseLayer.declaredClass=="esri.layers.MapImageLayer"){layer=m_map.layers.getItemAt(i);break}}var sublayer=layer.findSublayerById(parseInt(layerid));sublayer.visible=layerVisible})}function OpenFeatureLayerByID(layerid,layerVisible){var layer;for(var i=0;i<m_map.layers.length;i++){var BaseLayer=m_map.layers.getItemAt(i);if(BaseLayer.declaredClass=="esri.layers.FeatureLayer"){layer=m_map.layers.getItemAt(i);if(layer.layerId==layerid){layer.visible=layerVisible;break}}}}function OpenMapImageLayerByName(layerName,layerVisible){var layerId=GetFeatureLayerIdbyName(layerName);for(var i=0;i<m_view.allLayerViews.length;i++){var layer=m_view.allLayerViews.getItemAt(i).layer;if(layer.id=="动态数据"){var arr=layer.allSublayers.items;for(var j=0;j<arr.length;j++){if(arr[j].id==layerId){arr[j].visible=layerVisible;break}}}}}function OpenFeatureLayerByName(layerName,layerVisible){var layerid="";for(var i=0;i<m_map.layers.length;i++){var BaseLayer=m_map.layers.getItemAt(i);if(BaseLayer.declaredClass=="esri.layers.FeatureLayer"){layer=m_map.layers.getItemAt(i);if(layer.id==layerName){layer.visible=layerVisible}}}}function OpenFeatureLayerByID1(layerid,layerVisible){switch(parseInt(layerid)){case 0:fe0.visible=layerVisible;if(layerVisible){fe1.visible=false;fe2.visible=false;fe3.visible=false;fe4.visible=false;fe5.visible=false;fe6.visible=false;fe7.visible=false;fe8.visible=false;fe9.visible=false;fe10.visible=false}break;case 1:fe1.visible=layerVisible;if(layerVisible){fe0.visible=false;fe2.visible=false;fe3.visible=false;fe4.visible=false;fe5.visible=false;fe6.visible=false;fe7.visible=false;fe8.visible=false;fe9.visible=false;fe10.visible=false}break;case 2:fe2.visible=layerVisible;if(layerVisible){fe0.visible=false;fe1.visible=false;fe3.visible=false;fe4.visible=false;fe5.visible=false;fe6.visible=false;fe7.visible=false;fe8.visible=false;fe9.visible=false;fe10.visible=false}break;case 3:fe3.visible=layerVisible;if(layerVisible){fe0.visible=false;fe1.visible=false;fe2.visible=false;fe4.visible=false;fe5.visible=false;fe6.visible=false;fe7.visible=false;fe8.visible=false;fe9.visible=false;fe10.visible=false}break;case 4:fe4.visible=layerVisible;if(layerVisible){fe0.visible=false;fe1.visible=false;fe2.visible=false;fe3.visible=false;fe5.visible=false;fe6.visible=false;fe7.visible=false;fe8.visible=false;fe9.visible=false;fe10.visible=false}break;case 5:fe5.visible=layerVisible;if(layerVisible){fe0.visible=false;fe1.visible=false;fe2.visible=false;fe3.visible=false;fe4.visible=false;fe6.visible=false;fe7.visible=false;fe8.visible=false;fe9.visible=false;fe10.visible=false}break;case 6:fe6.visible=layerVisible;if(layerVisible){fe0.visible=false;fe1.visible=false;fe2.visible=false;fe3.visible=false;fe4.visible=false;fe5.visible=false;fe7.visible=false;fe8.visible=false;fe9.visible=false;fe10.visible=false}break;case 7:fe7.visible=layerVisible;if(layerVisible){fe0.visible=false;fe1.visible=false;fe2.visible=false;fe3.visible=false;fe4.visible=false;fe5.visible=false;fe6.visible=false;fe8.visible=false;fe9.visible=false;fe10.visible=false}break;case 8:fe8.visible=layerVisible;if(layerVisible){fe0.visible=false;fe1.visible=false;fe2.visible=false;fe3.visible=false;fe4.visible=false;fe5.visible=false;fe6.visible=false;fe7.visible=false;fe9.visible=false;fe10.visible=false}break;case 9:fe9.visible=layerVisible;if(layerVisible){fe0.visible=false;fe1.visible=false;fe2.visible=false;fe3.visible=false;fe4.visible=false;fe5.visible=false;fe6.visible=false;fe7.visible=false;fe8.visible=false;fe10.visible=false}break;case 10:fe10.visible=layerVisible;if(layerVisible){fe0.visible=false;fe1.visible=false;fe2.visible=false;fe3.visible=false;fe4.visible=false;fe5.visible=false;fe6.visible=false;fe7.visible=false;fe8.visible=false;fe9.visible=false}break}}function buffer(point){require(["esri/tasks/GeometryService","esri/tasks/support/BufferParameters"],function(GeometryService,BufferParameters){var webMerPoint=webMercatorUtils.geographicToWebMercator(point);var params=new BufferParameters;params.distances=[560];params.unit="kilometers";params.geodesic=true;params.bufferSpatialReference=new SpatialReference({wkid:3857});params.outSpatialReference=m_view.spatialReference;params.geometries=[webMerPoint];geometryService.buffer(params).when(function(results){bufferLayer.add(new Graphic({geometry:results[0]}))})})}function bufferPoint(point){if(!bufferEnabled){console.log("buffering not enabled. Hit the space bar key and click/drag to buffer.");return}clearGraphics();point.hasZ=false;point.z=undefined;pointLayer.add(new Graphic({geometry:point,symbol:pointSym}));var buffer=geometryEngine.geodesicBuffer(point,560,"kilometers");bufferLayer.add(new Graphic({geometry:buffer,symbol:polySym}))}function GetLayerRestData(layerID){var restUrl=dynamicLayerURL+"/"+layerID+"?f=pjson";var xmlHttpRest=GetXmlHttpObject();xmlHttpRest.open("GET",restUrl,true);xmlHttpRest.send();xmlHttpRest.onreadystatechange=function(){var responseText=xmlHttpRest.responseText;if(xmlHttpRest.readyState==4){symble.push(responseText);var layerInfo=GetDynamicServiceLayer();if(layerInfo.length-1==layerID){isMapLoaded=true;onMapLoaded()}}}}function GetXmlHttpObject(){var xmlHttpRest=null;try{xmlHttpRest=new XMLHttpRequest}catch(e){try{xmlHttpRest=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){xmlHttpRest=new ActiveXObject("Microsoft.XMLHTTP")}}if(xmlHttpRest==null){return}return xmlHttpRest}function ClearLightLayerStatus(){if(highlightSelect){highlightSelect.remove()}if(highlightSelectExtra){highlightSelectExtra.remove()}}function flashLayerStatus(featureLayer,statusFieldName,statusValue){require(["esri/tasks/support/Query","esri/tasks/QueryTask","esri/core/watchUtils","esri/geometry/Geometry","esri/geometry/Polygon"],function(Query,QueryTask,watchUtils,Geometry,Polygon){var query=new Query;query.where=statusFieldName+"="+statusValue;query.returnGeometry=true;query.outFields=["*"];featureLayer.queryFeatures(query).when(function(resultsObjectIDs){m_view.whenLayerView(featureLayer).when(function(lyrView){if(highlightSelectExtra){highlightSelectExtra.remove()}highlightSelectExtra=lyrView.highlight(resultsObjectIDs.features)});console.log("resultsObjectIDs:",resultsObjectIDs)})})}function setCenterExtent(x,y,radius){require(["esri/geometry/Extent"],function(Extent){var ext=new Extent({xmin:x-radius,ymin:y-radius,xmax:x+radius,ymax:y+radius,spatialReference:m_view.spatialReference});m_view.extent=ext})}function setExtent(xmin,ymin,xmax,ymax){require(["esri/geometry/Extent"],function(Extent){var ext=new Extent({xmin:xmin,ymin:ymin,xmax:xmax,ymax:ymax,spatialReference:m_view.spatialReference});m_view.extent=ext})}function goToPoint(point){if(currentMapMode=="3D"){var newCam=m_view.camera.clone();newCam.position=point;newCam.tilt=0;var ai=m_view.goTo(newCam).when(function(ani){tiltView(45)})}}function tiltView(){var tilt=m_view.camera.tilt+.001;if(tilt>=80){tilt=0}else if(tilt>=40){tilt=80}else{tilt=40}m_view.goTo({tilt:tilt})}function GetLayerMainRestInfo2(restURL){var restUrl=restURL+"?f=pjson";var xmlHttpRest=GetXmlHttpObject();xmlHttpRest.open("GET",restUrl,true);xmlHttpRest.send();xmlHttpRest.onreadystatechange=function(){var responseText=xmlHttpRest.responseText;if(xmlHttpRest.readyState==4){GetLayerMainRestInfo_Complete2(restURL,responseText)}}}function GetLayerMainRestInfo_Complete2(restURL,data){extraLayerJsonData=JSON.parse(data);onMapLoadInfo()}function GetLayerMainRestInfo1(restURL){var restUrl=restURL+"?f=pjson";$.ajax({type:"get",url:restUrl,crossDomain:true,dataType:"jsonp",success:GetLayerMainRestInfo_Complete(restURL,data)})}function GetLayerMainRestInfo(restURL){var restUrl=restURL+"?f=pjson";var xmlHttpRest=GetXmlHttpObject();xmlHttpRest.open("GET",restUrl,true);xmlHttpRest.send();xmlHttpRest.onreadystatechange=function(){var responseText=xmlHttpRest.responseText;if(xmlHttpRest.readyState==4){GetLayerMainRestInfo_Complete(restURL,responseText)}}}var extraLayerJsonData;function GetLayerMainRestInfo_Complete(restURL,data){extraLayerJsonData=JSON.parse(data);var layers=extraLayerJsonData.layers;require(["esri/layers/FeatureLayer"],function(FeatureLayer){if(layers.length>0){for(var i=0;i<layers.length;i++){var fl=new FeatureLayer({url:restURL+"/"+layers[i].id,id:layers[i].name,visible:false});var content="{*}";var url="";switch(layers[i].name){case"一级医疗机构":url="";content="机构名称:{COMP_NAME}<br>卫生许可:{HEALTH_LIC}<br>地址:{BUS_ADDR}<br>电话:{TELPHONE}<br><a onclick='showDetail(\""+layers[i].name+'","'+url+'"'+",1)'>详细信息</a>";fl.popupTemplate={title:"一级医疗机构",content:content};break;case"二级医疗机构":url="";content="机构名称:{COMP_NAME}<br>卫生许可:{HEALTH_LIC}<br>地址:{BUS_ADDR}<br>电话:{TELPHONE}<br><a onclick='showDetail(\""+layers[i].name+'","'+url+'"'+",1)'>详细信息</a>";fl.popupTemplate={title:"二级医疗机构",content:content};break;case"三级医疗机构":url="http://10.101.35.25:8080/wjsite/a/tWd3MedicalLicense/medicalDtails?id=cb885991548744a7aa02febd425d977d";content="机构名称:{COMP_NAME}<br>卫生许可:{HEALTH_LIC}<br>地址:{BUS_ADDR}<br>电话:{TELPHONE}<br><a onclick='showDetail(\""+layers[i].name+'","'+url+'"'+",1)'>档案信息</a>";fl.popupTemplate={title:"三级医疗机构",content:content};break;case"空调机房":url="";content="描述:{描述}";fl.popupTemplate={title:"空调机房",content:content};break;case"宾馆":url="";content="名称:{COMP_NAME}<br>地址:{BUS_ADDR}<br>卫生许可:{HEALTH_LIC}<br>联系方式:{TELPHONE}<br><a onclick='showDetail(\""+layers[i].name+'","'+url+'"'+",1)'>详细信息</a>";fl.popupTemplate={title:"宾馆",content:content};break;case"重大活动保障医疗机构":url="";content="单位名称:{单位名称}<br>地址:{一户一档地址}<br><a onclick='showDetail(\""+layers[i].name+'","'+url+'"'+",1)'>详细信息</a>";fl.popupTemplate={title:"重大活动保障医疗机构",content:content};break;case"监督机构":url="";content="名称:{区县名称}<br>地址:{地址}<br>电话:{电话}<br><a onclick='showDetail(\""+layers[i].name+'","'+url+'"'+",1)'>详细信息</a>";fl.popupTemplate={title:"监督机构",content:content};break;case"水箱":url="http://10.101.35.25:8088/#/?isMap=true&type=testResultsTable&id={ID}";var url2="http://10.101.35.25:8088/#/?isMap=true&type=gzzxPointInfoTable&id={ID}";content="描述:{描述}<br>"+"<a onclick='showDetail(\""+layers[i].name+'","'+url2+'"'+",1)'>监督员巡查</a>";fl.popupTemplate={title:"水箱",content:content};break;case"饮水机":url="http://10.101.35.25:8088/#/?isMap=true&type=testResultsTable&id={ID}";var url2="http://10.101.35.25:8088/#/?isMap=true&type=gzzxPointInfoTable&id={ID}";content="描述:{描述}<br>"+"<a onclick='showDetail(\""+layers[i].name+'","'+url2+'"'+",1)'>监督员巡查</a>";fl.popupTemplate={title:"饮水机",content:content};break;case"保障活动饮用水":url="";content="单位名称:{单位名称}<br>地址:{地址}<br>"+"<a onclick='showDetail(\""+layers[i].name+'","'+url+'"'+",1)'>详细信息</a>";fl.popupTemplate={title:"保障活动饮用水",content:content};break;case"管网水监测点":url="http://10.101.35.25:8088/#/?isMap=true&type=testResultsTable&id=60000000000";var url2="http://10.101.35.25:8088/#/?isMap=true&type=patrolRecordsTable&id=60000000000";content="监测点编号:{JCDCODE}<br>监测点位置:{JCDADDR}<br>"+"<a onclick='showDetail(\""+layers[i].name+'","'+url+'"'+",1)'>检验结果</a> "+"<a onclick='showDetail(\""+layers[i].name+'","'+url2+'"'+",1)'>监督员巡查</a>";fl.popupTemplate={title:"管网水监测点",content:content};break;case"水质在线点":url="http://10.101.35.25:8088/#/?isMap=true&type=monitoringDataTable&id=1";content="编号:{LOCATION_ID}<br>地址:{JCDADDR}<br><a onclick='showDetail(\""+layers[i].name+'","'+url+'"'+",1)'>历史监测数据</a>";fl.popupTemplate={title:"水质在线点",content:content};break;case"空气在线监测点":url="http://10.101.35.25:8088/#/?isMap=true&type=testResultsTable&id={ID}";var url2="http://10.101.35.25:8088/#/?isMap=true&type=gzzxPointInfoTable&id={ID}";content="描述 :{描述}<br>"+"<a onclick='showDetail(\""+layers[i].name+'","'+url2+'"'+",1)'>监督员巡查</a>";fl.popupTemplate={title:"空气在线监测点",content:content};break;case"主要接待场所":url="http://10.101.35.25:8080/wjsite/a/document/obj/publicPlaceDtails?id={ID}";var url2="http://10.101.35.25:8088/#/?isMap=true&type=ggcsWaterForm&id={ID}";var url3="http://10.101.35.25:8088/#/?isMap=true&type=ggcsSampingTable&id={ID}";var url4="http://10.101.35.25:8088/#/?isMap=true&type=waterSupplyCheckTable&code=00&id={ID}";content="名称:{COMP_NAME}<br>地址:{BUS_ADDR}<br>卫生许可:{HEALTH_LIC}<br>联系方式:{TELPHONE}<br>"+"<a onclick='showDetail(\""+layers[i].name+'","'+url+'"'+",1)'>档案信息</a> "+"<a onclick='showDetail(\""+layers[i].name+'","'+url2+'"'+",1)'>饮用水档案</a>";fl.popupTemplate={title:"主要接待场所",content:content};break;case"市级集中式供水":url="http://10.101.35.25:8080/wjsite/a/lic/tWd3CpSupply/supplyDtails?id=7d95c2bca36e43acaffba48bef4a535f";var url2="http://10.101.35.25:8088/#/?isMap=true&type=waterSupplyCheckTable&code=01&id=string";content="水厂名称:{水厂名称}<br>生产场所地址:{生产场所地址}<br>"+"<a onclick='showDetail(\""+layers[i].name+'","'+url+'"'+",1)'>档案信息</a> "+"<a onclick='showDetail(\""+layers[i].name+'","'+url2+'"'+",1)'>出厂水抽检</a>";fl.popupTemplate={title:"市级集中式供水",content:content};break;default:fl.popupTemplate={title:"详细信息",content:content};break}m_map.add(fl)}}})}function showDetail(type,url,id){if(!url){return}m_view.popup.close();var title="详细信息";switch(type){case"水箱":title="国家会展中心二次供水设施每日巡查录入表";break;case"空气在线监测点":title="国家会展中心空气在线监测每日巡查录入表";break;default:title="详细信息";break}var infoDiv=$("#infoDialog").dialog({width:620,height:550,modal:true,title:title});if(infoDiv.length>0){infoDiv.attr("style","width:600px;height:500px;");infoDiv.html(GetIFrameInfoWinContent(type,url));$(".ui-dialog-title").text(title)}else{alert("未发现详细信息")}}var isSetMapZoom=false;var m_maxZoom=1;function queryForExtent(Layername,where,precision){var layerId=GetFeatureLayerIdbyName(Layername);if(layerId==-1){alert("没有此图层");return}require(["esri/tasks/FindTask","esri/tasks/support/FindParameters","esri/tasks/IdentifyTask","esri/tasks/support/IdentifyParameters","esri/geometry/Point","esri/tasks/QueryTask","esri/tasks/support/Query","esri/geometry/Extent","esri/Graphic","esri/geometry/geometryEngine","dojo/on"],function(FindTask,FindParameters,IdentifyTask,IdentifyParameters,Point,QueryTask,Query,Extent,Graphic,geometryEngine,on){var queryTask=new QueryTask({url:GetConfigDataByName("QueryLayer")+"/"+layerId});var query=new Query;query.outFields=["*"];query.returnGeometry=true;query.where=where;queryTask.execute(query).then(function(results){if(results.features.length>0){viewxmax=results.features[0].geometry.extent.xmax+0;viewxmin=results.features[0].geometry.extent.xmin-0;viewymax=results.features[0].geometry.extent.ymax+0;viewymin=results.features[0].geometry.extent.ymin-0;var extent=new Extent({xmin:results.features[0].geometry.extent.xmin-0,ymin:results.features[0].geometry.extent.ymin-0,xmax:results.features[0].geometry.extent.xmax-0,ymax:results.features[0].geometry.extent.ymax-0,spatialReference:m_view.spatialReference});var point=new Point({x:results.features[0].geometry.extent.center.x-0,y:results.features[0].geometry.extent.center.y-0,spatialReference:m_view.spatialReference});m_view.goTo({target:point,zoom:8}).then(function(ani){});isSetMapZoom=true}})})}function getBufferByPoint(x,y,radius,layername,m_showGraphic,isGoTo){var buffer;require(["esri/geometry/Point","esri/geometry/geometryEngine","esri/geometry/Circle"],function(Point,geometryEngine,Circle){var point=new Point({x:x-0,y:y-0,spatialReference:m_view.spatialReference});buffer=new Circle({radius:radius,radiusUnit:"meters",center:{x:x-0,y:y-0,spatialReference:m_view.spatialReference}});newQuerybyWhereStr("",layername,GetConfigDataByName("MYQueryLayer"),buffer,m_showGraphic,isGoTo)})}function getGridGeometryByGridID(gridid,Layername){var gridgeo;require(["esri/tasks/FindTask","esri/tasks/support/FindParameters","esri/tasks/IdentifyTask","esri/tasks/support/IdentifyParameters","esri/geometry/Point","esri/tasks/QueryTask","esri/tasks/support/Query","esri/geometry/Extent","esri/Graphic","esri/geometry/geometryEngine","dojo/on"],function(FindTask,FindParameters,IdentifyTask,IdentifyParameters,Point,QueryTask,Query,Extent,Graphic,geometryEngine,on){var queryTask=new QueryTask({url:GetConfigDataByName("QueryLayer")+"/250"});var query=new Query;query.geometry=null;query.outFields=["*"];query.returnGeometry=true;query.spatialRelationship="intersects";query.where=" 网格编码='"+gridid+"'";queryTask.execute(query).then(function(results){if(results.features.length>0){gridgeo=results.features[0].geometry;newQuerybyWhereStr("",Layername,GetConfigDataByName("MYQueryLayer"),gridgeo)}})})}function identifyTask(point,callbackfun){require(["esri/tasks/FindTask","esri/tasks/support/FindParameters","esri/tasks/IdentifyTask","esri/tasks/support/IdentifyParameters","esri/geometry/Point","esri/tasks/QueryTask","esri/tasks/support/Query","esri/geometry/Extent","esri/Graphic","esri/geometry/geometryEngine","dojo/on"],function(FindTask,FindParameters,IdentifyTask,IdentifyParameters,Point,QueryTask,Query,Extent,Graphic,geometryEngine,on){var queryTask=new QueryTask({url:GetConfigDataByName("QueryLayer")+"/250"});var query=new Query;query.geometry=null;query.outFields=["*"];query.returnGeometry=true;query.spatialRelationship="intersects";query.where="1=1";query.geometry=new Point({x:point.split(",")[0]-0,y:point.split(",")[1]-0,spatialReference:m_view.spatialReference});queryTask.execute(query).then(function(results){if(results.features.length>0)callbackfun(results.features[0].attributes["网格编码"]);else{callbackfun("error")}})})}function showQueryResult(idResults){alert(2);if(idResults.length>0){var htmls='<table style="width: 100%">';htmls=htmls+'<tr bgcolor="#E0E0E0"><td> 图层 </td><td> 名 称</td></tr>';for(var i=0;i<idResults.length;i++){var result=idResults[i];var graphic=result.feature;var namevalue=result.feature.attributes.Name;console.log(namevalue);if(i%2==1){htmls=htmls+'<tr bgcolor="#E0E0E0"><td>'+result.layerName+"</td>"+"</tr>"}else{htmls=htmls+"<tr><td>"+result.layerName+"</td><td>"+namevalue+"</td></tr>"}map.graphics.add(graphic)}htmls=htmls+"</table>";document.getElementById("divShowResult").innerHTML=htmls;$("#divShowResult").show()}else{document.getElementById("divShowResult").innerHTML="";$("#divShowResult").show()}}var isNewDragHandle=false;function myNewDragHandle(){var draghandle;require(["esri/core/watchUtils"],function(watchUtils){draghandle=watchUtils.whenTrue(m_view,"drag",function(event){if(event.action=="end"){}else{var xmax=m_view.extent.xmax;var xmin=m_view.extent.xmin;var ymax=m_view.extent.ymax;var ymin=m_view.extent.ymin;var precision=70;var hasChanged=false;if(viewxmin-xmin>precision){hasChanged=true}if(viewymin-ymin>precision){hasChanged=true}if(xmax-viewymax>precision){hasChanged=true}if(ymax-viewymax>precision){hasChanged=true}if(hasChanged){event.stopPropagation();isNewDragHandle=true}}})});return draghandle}
|