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_areaNameLayer; 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; //2020 2 hm 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 m_resizetime = null; var isInLightArea = "";//判断区域高亮移出移入 var isInDrawLayer = "";//判断DrawLayer移出移入 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"], 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.50"); 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, x:0, y:0, z: 258000, spatialReference: m_view.spatialReference }); setCameraBypoint(0, centerPoint, 0, 0, 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.remove('zoom'); //m_view.ui.add("info", "top-right"); if (currentExtent != null) { m_view.extent = currentExtent; setCameraBypoint(1, currentExtent.center, 0, 0, currentScale) } setTimeout("onMapLoadInfo()",1000); }); m_view.on("pointer-move", function (event) { m_view.hitTest(event, GraphicsLayer).then(getGraphics); function getGraphics(response) { if (response.results.length) { var result = response.results[0]; if (result.graphic) { m_view.whenLayerView(result.graphic.layer).then(function (layerView) { /*if (highlightSelect) { highlightSelect.remove(); } try{ highlightSelect = layerView.highlight(result.graphic); }catch (e){ }*/ if (result.graphic.attributes && result.graphic.layer.id == "myGLayer") { if (isInDrawLayer != "") { postToParentPageMethed("moveOutDrawLayerReturn", [isInDrawLayer]); isInDrawLayer = ""; } if (isInLightArea == "") { isInLightArea = result.graphic.attributes; postToParentPageMethed("moveInLightAreaReturn", [isInLightArea]); } else { if (isInLightArea.OBJECTID != result.graphic.attributes.OBJECTID) { postToParentPageMethed("moveOutLightAreaReturn", [isInLightArea]); isInLightArea = result.graphic.attributes; postToParentPageMethed("moveInLightAreaReturn", [isInLightArea]); } } } else if (result.graphic.attributes && result.graphic.layer.id == "myDrawGLayer") { if (isInDrawLayer == "") { isInDrawLayer = result.graphic.attributes; postToParentPageMethed("moveInDrawLayerReturn", [isInDrawLayer]); } else { if (isInDrawLayer != result.graphic.attributes) { postToParentPageMethed("moveOutDrawLayerReturn", [isInDrawLayer]); isInDrawLayer = result.graphic.attributes; postToParentPageMethed("moveInDrawLayerReturn", [isInDrawLayer]); } } } else { if (isInLightArea != "") { postToParentPageMethed("moveOutLightAreaReturn", [isInLightArea]); isInLightArea = ""; } if (isInDrawLayer != "") { postToParentPageMethed("moveOutDrawLayerReturn", [isInDrawLayer]); isInDrawLayer = ""; } } }); } } else { // if(highlightSelect){ // highlightSelect.remove(); // } if (isInLightArea != "") { postToParentPageMethed("moveOutLightAreaReturn", [isInLightArea]); isInLightArea = ""; } if (isInDrawLayer != "") { postToParentPageMethed("moveOutDrawLayerReturn", [isInDrawLayer]); isInDrawLayer = ""; } } } }); m_view.on("click", function (event) { popupCloseAll("viewClick"); m_view.hitTest(event).then(function (response) { if (response.results.length) { var result = response.results[0]; if (result.graphic) { m_view.whenLayerView(result.graphic.layer).then(function (layerView) { if (highlightSelect) { try{ highlightSelect.remove(); }catch (e){ } } try{ highlightSelect = layerView.highlight(result.graphic); }catch (e){ } }) switch (result.graphic.layer.id) { case "WZXYFeature":{ var jsonStr=result.graphic.attributes; jsonStr.x=result.graphic.geometry.extent.center.x; jsonStr.y=result.graphic.geometry.extent.center.y; postToParentPageMethed("clickWZXYFeatureReturn", [jsonStr]); break; } case "水箱": { queryWaterTank(result.graphic.attributes.OBJECTID); break; } case "myDrawGLayer": var returnList = [] var graphicList = GraphicsLayer_DrawLayer.graphics.items; for (var i = 0; i < graphicList.length; i++) { if (result.graphic.geometry.x == graphicList[i].geometry.x && result.graphic.geometry.y == graphicList[i].geometry.y) { if (graphicList[i].attributes) { returnList.push(graphicList[i].attributes); } } } postToParentPageMethed("clickDrawLayerReturn", [returnList]); break; case "myGLayer": { // m_view.goTo(result.graphic) postToParentPageMethed("clickLightAreaReturn", [result.graphic.attributes]); 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.geometry = option.geometry || null; 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; } } } } }); }); 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" && currentMapMode == "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" && currentMapMode == "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 "density": { dyLayer = new MapImageLayer({ url: serverUrl, id: serverLabel }); dyLayer.visible = serverVisible; m_map.add(dyLayer); dyLayer.on("layerview-create", function(event){ createWZXYFeature(); }); break; } case "featurelayer": { m_map.add(layer); break; } case "scene": { m_sceneLayer = new SceneLayer({ url: serverUrl, id: serverLabel, popupEnabled: false }); m_sceneLayer.visible=serverVisible; var color=[120,120,120,0.6]; var color1=[27, 68, 130, 0.6]; if(serverLabel=="水箱"){ color=[15,154,224,0.6]; color1=[27, 68, 130, 0.6]; } if(serverLabel=="建筑物"){ color=[0,224,247,0.6]; color1=[0,224,247,0.6]; } var locationRenderer = { type: "simple", symbol: { type: "mesh-3d", symbolLayers: [{ type: "fill", material: { color: color, colorMixMode: "replace" }, edges: { type: "solid", color: color1, 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({id: "myGLayer"}); GraphicsLayer_myLayer.listMode = "hide"; GraphicsLayer_areaNameLayer = new GraphicsLayer; GraphicsLayer_areaNameLayer.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_areaNameLayer); 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 = "
"; 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].id == layerID) { return m_map.layers.items[i] } } } function getSubLayerIdbyName(layer, name) { var items = layer.allSublayers.items; for (var j = 0; j < items.length; j++) { var currnetLayer = items[j]; if (currnetLayer.title == name) { return currnetLayer.id } } return -1 } 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", "esri/config", "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, esriConfig, on) { esriConfig.fontsUrl = "http://10.101.35.50/fonts"; 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 // Disables map rotation }; m_zoom = new Zoom({ view: m_view }); // m_view.ui.add(m_zoom, { // position: "top-right" // }); layerList = new LayerList({ view: m_view }); AddSceneViewWidget(); m_view.when(function (evt) { //createInfoDiv(); // m_view.ui.add("info", "top-right"); //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 }); // m_view.ui.add(m_zoom, { // position: "top-right" // }); var m_compass = new Compass({ view: m_view }); // m_view.ui.add(m_compass, { // position: "top-left" // }); 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.on("resize",function (event) { // // }); m_view.watch("animation", function (response) { if (response && response.state === "running") { // console.log("Animation in progress"); // window.parent.postMessage( // { // method: "mapAnimationInProgressCallback" // }, // '*' // ); } // else{ // console.log("No animation"); // } }); m_view.on("drag", function (event) { if (event.action == 'end') { // event.startPropagation(); } else { // console.log("drag in progress"); sjDraging = true; window.parent.postMessage( { method: "mapDragingCallback" }, '*' ); } }); m_view.on("pointer-move", function (event) { m_view.hitTest(event, GraphicsLayer).then(getGraphics); function getGraphics(response) { if (response.results.length) { var result = response.results[0]; if (result.graphic) { m_view.whenLayerView(result.graphic.layer).then(function (layerView) { if (highlightSelect) { try{ highlightSelect.remove(); }catch (e){ } } try{ highlightSelect = layerView.highlight(result.graphic); }catch (e){ } if (result.graphic.attributes && result.graphic.layer.id == "myGLayer") { if (isInDrawLayer != "") { postToParentPageMethed("moveOutDrawLayerReturn", [isInDrawLayer]); isInDrawLayer = ""; } if (isInLightArea == "") { isInLightArea = result.graphic.attributes; postToParentPageMethed("moveInLightAreaReturn", [isInLightArea]); } else { if (isInLightArea.OBJECTID != result.graphic.attributes.OBJECTID) { postToParentPageMethed("moveOutLightAreaReturn", [isInLightArea]); isInLightArea = result.graphic.attributes; postToParentPageMethed("moveInLightAreaReturn", [isInLightArea]); } } } else if (result.graphic.attributes && result.graphic.layer.id == "myDrawGLayer") { if (isInDrawLayer == "") { isInDrawLayer = result.graphic.attributes; postToParentPageMethed("moveInDrawLayerReturn", [isInDrawLayer]); } else { if (isInDrawLayer != result.graphic.attributes) { postToParentPageMethed("moveOutDrawLayerReturn", [isInDrawLayer]); isInDrawLayer = result.graphic.attributes; postToParentPageMethed("moveInDrawLayerReturn", [isInDrawLayer]); } } } else { if (isInLightArea != "") { postToParentPageMethed("moveOutLightAreaReturn", [isInLightArea]); isInLightArea = ""; } if (isInDrawLayer != "") { postToParentPageMethed("moveOutDrawLayerReturn", [isInDrawLayer]); isInDrawLayer = ""; } } }); } } else { // if(highlightSelect){ // highlightSelect.remove(); // } if (isInLightArea != "") { postToParentPageMethed("moveOutLightAreaReturn", [isInLightArea]); isInLightArea = ""; } if (isInDrawLayer != "") { postToParentPageMethed("moveOutDrawLayerReturn", [isInDrawLayer]); isInDrawLayer = ""; } } } }); m_view.on("click", function (event) { popupCloseAll("viewClick"); // 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); // GetAddressByXY(hitPoint.x,hitPoint.y,50); // 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) { m_view.whenLayerView(result.graphic.layer).then(function (layerView) { if (highlightSelect) { try{ highlightSelect.remove(); }catch (e){ } } try{ highlightSelect = layerView.highlight(result.graphic); }catch (e){ } }) switch (result.graphic.layer.id) { case "WZXYFeature":{ var jsonStr=result.graphic.attributes; jsonStr.x=result.graphic.geometry.extent.center.x; jsonStr.y=result.graphic.geometry.extent.center.y; postToParentPageMethed("clickWZXYFeatureReturn", [jsonStr]); break; } case "myDrawGLayer": var returnList = [] var graphicList = GraphicsLayer_DrawLayer.graphics.items; for (var i = 0; i < graphicList.length; i++) { if (result.graphic.geometry.x == graphicList[i].geometry.x && result.graphic.geometry.y == graphicList[i].geometry.y) { if (graphicList[i].attributes) { returnList.push(graphicList[i].attributes); } } } postToParentPageMethed("clickDrawLayerReturn", [returnList]); break; case "myGLayer": { // m_view.goTo(result.graphic) postToParentPageMethed("clickLightAreaReturn", [result.graphic.attributes]); 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.geometry = option.geometry || null; 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; } } } } }); }); m_view.watch("scale", function (event) { if (m_view.zoom % 1 === 0) { //整数 //chartLayer点放大缩小 if (chartLayer) { var imgsize = chartLayerSize - (chartLayerSize * (12 - m_view.zoom) * 0.05);//zoom每级差5% var list = chartLayer.chartOption.series; for (var i = 0; i < list.length; i++) { list[i].effect.symbolSize = imgsize } var option = { series: list }; chartLayer.setChartOption(option); } //GraphicsLayer_DrawLayer点放大缩小 var DrawLayerGraphics = GraphicsLayer_DrawLayer.graphics; if (DrawLayerGraphics.length > 0) { if (imgSizeList == []) { return; } for (var i = 0; i < DrawLayerGraphics.length; i++) { if (DrawLayerGraphics.items[i].symbol.type == "picture-marker") { if(DrawLayerGraphics.items[i].attributes.newImgWidth){ var width=DrawLayerGraphics.items[i].attributes.newImgWidth; var height=DrawLayerGraphics.items[i].attributes.newImgHeight; var newImgWidth = width - (width * (14 - m_view.zoom) * 0.05);//zoom每级差5% var newImgHeight = height - (height * (14 - m_view.zoom) * 0.05) var symbol = { type: "picture-marker", url: DrawLayerGraphics.items[i].symbol.url, width: newImgWidth + "px", height: newImgHeight + "px" } DrawLayerGraphics.items[i].symbol = symbol } } } } } }); setTimeout("onMapLoadInfo()",1000); // dyAddMapLayerByConfig(); // AddMapGraphicLayers(); }); var scaleBar = new ScaleBar({ view: m_view }); // m_view.ui.add(scaleBar, { // position: "bottom-left" // }); 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": { AddMapGraphicLayers() 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 "density": { dyLayer = new MapImageLayer({ url: serverUrl, id: serverLabel }); dyLayer.visible = serverVisible; m_map.add(dyLayer); dyLayer.on("layerview-create", function(event){ createWZXYFeature(); }); 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) { // for (var i = 0; i < layers.length; i++) { // if (layers[i].subLayerIds == null) { // var layerId = layers[i].id; // var layername = layers[i].name; // if(layername) // var dyLayer = new FeatureLayer({ // url: serverUrl+"/"+layerId, // id: layerId // }); // dyLayer.visible = serverVisible; // // if(layername == "上水井盖") // // dyLayer.visible = true; // m_map.add(dyLayer); // } // } } } } } 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() { // debugger; GraphicsLayer_labelLayer = new GraphicsLayer; GraphicsLayer_labelLayer.listMode = "hide"; GraphicsLayer_myLayer = new GraphicsLayer({id: "myGLayer"}); GraphicsLayer_myLayer.listMode = "hide"; GraphicsLayer_areaNameLayer = new GraphicsLayer(); GraphicsLayer_areaNameLayer.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_myLayer); m_map.add(GraphicsLayer_areaNameLayer); m_map.add(GraphicsLayer_labelLayer); m_map.add(GraphicsLayer_identityLayer); m_map.add(GraphicsLayer_extendLayer); m_map.add(GraphicsLayer_flyTipLayer); m_map.add(GraphicsLayer_fickerLayer); m_map.add(GraphicsLayer_DrawLayer); } function AddSceneViewWidget() { // var viewTest = document.getElementById("viewTest"); // m_view.ui.add(viewTest, "bottom-right") } watchUtils.whenTrue(m_view, "stationary", function () { // if (!m_view.center){ // console.log("move in progress"); // } if (m_view.center) { // if(isNewDragHandle){ // var test = myNewDragHandle(); // } // return; 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 = 5000;//可以忽略超出的精度 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; //如果调整过后最大值超出,则调整回来,并把对应的y值也调整,否则会死循环 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; //如果调整过后最大值超出,则调整回来,并把对应的x值也调整,否则会死循环 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; //如果调整过后最小值超出,则调整回来,并把对应的y值也调整,否则会死循环 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; //如果调整过后最小值超出,则调整回来,并把对应的x值也调整,否则会死循环 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" }, '*' ); if (sjDraging) { sjDraging = false; if (m_resizetime) { clearTimeout(m_resizetime); } m_resizetime = setTimeout(function () { // 执行地图中心点查询地址 or 地图中心点查询查询部件 // sj_type 0 关闭 1 地址 2 部件 3 地址和部件 sj_mapResize(); }, 300); } // 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; }); //监听 touchmove 事件 手指 移动时 做的事情 document.addEventListener("touchmove", function (e) { e.preventDefault(); // 2 根 手指执行 目标元素放大操作 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 url = GetConfigDataByName("EditLayer")+"/0"; // var featurelayer = new FeatureLayer({ // url:url, // title:"房屋" // }); // m_map.add(featurelayer); // var url1 = GetConfigDataByName("EditLayer")+"/1"; // var featurelayer1 = new FeatureLayer({ // url:url1, // title:"土地" // }); // featurelayer1.visible = true; // m_map.add(featurelayer); 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 } } }); // var editor = new Editor({view: m_view}); 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" && BaseLayer.id == "动态数据") { 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(); if (chartLayer) { chartLayer.removeLayer(); chartLayer = null; } if (chartLayer2) { chartLayer2.removeLayer(); chartLayer2 = null; } if (chartLayer3) { chartLayer3.removeLayer(); chartLayer3 = null; } } 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 closeMapImageLayerByName() { var layer = getLayerByLayerId("density_1"); var items = layer.allSublayers.items; for (var i = 0; i < items.length; i++) { if (items[i].sublayers == null) { items[i].visible = false; } } } // 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 == "动态数据") { // // layer.allSublayers.items[3].visible = true; // // break; // var arr = layer.allSublayers.items; // for(var j=0;j图层 | 名 称 |
" + result.layerName + " | " + // "" + namevalue + " | " + "
" + result.layerName + " | " + namevalue + " |