laptop and a wrench

漏洞

ElementGraphicsLayer cannot be turned off/on using Visible property.

上次发布: August 25, 2014 No Product Found
漏洞 ID 编号 NIM012801
已提交November 2, 2007
上次修改时间April 7, 2025
适用范围No Product Found
找到的版本9.2
编程语言C#
状态Will Not Be Addressed

附加信息

No Public Explanation

解决办法

Rex suggested the following workaroundsThis is appears to be a bug with ElementGraphicsLayer… I would log it when you get the chance. There are three workarounds at the moment.. all are listed below with some example code. 1) If you need to use an ElementGraphicsLayer, set the SelectedRenderer on each GeometryElement to use a transparent symbol. Then change the value in the IS_SELECTED column to true (not visible) or false (visible). ESRI.ArcGIS.ADF.Web.Display.Symbol.SimpleFillSymbol simpleFillSymbol1 = new ESRI.ArcGIS.ADF.Web.Display.Symbol.SimpleFillSymbol(); simpleFillSymbol1.Color = System.Drawing.Color.Transparent; simpleFillSymbol1.BoundaryWidth = 0; graphicElement.SelectedSymbol = simpleFillSymbol1; DataRow dataRow = elementGraphicsLayer.Add(graphicElement); dataRow["IS_SELECTED"] = false;2) Set the visibility for the map resource item associated with the graphics map resource Map1.MapResourceManagerInstance.ResourceItems.Find(adfGraphicsMapFunctionality.Resource).DisplaySettings.Visible = false;3) Create a FeatureGraphicsLayer and change its visibility via the Visible property. public void AddGraphicData() { ESRI.ArcGIS.ADF.Web.DataSources.Graphics.MapFunctionality adfGraphicsMapFunctionality = null; foreach (ESRI.ArcGIS.ADF.Web.DataSources.IMapFunctionality mapFunctionality in Map1.GetFunctionalities()) { // If multiple graphics resources are available, use the resource name to distinguish if (mapFunctionality.Resource.Name == "ADFGraphicsResource") { adfGraphicsMapFunctionality = mapFunctionality as ESRI.ArcGIS.ADF.Web.DataSources.Graphics.MapFunctionality; break; } } if (adfGraphicsMapFunctionality == null) return; // Add a new ElementGraphicsLayer ESRI.ArcGIS.ADF.Web.Display.Graphics.ElementGraphicsLayer elementGraphicsLayer = new ESRI.ArcGIS.ADF.Web.Display.Graphics.ElementGraphicsLayer(); elementGraphicsLayer.TableName = "Element Graphics - Extent Rectangle"; // Add graphics layer to map functionality graphics dataset ESRI.ArcGIS.ADF.Web.Display.Graphics.GraphicsDataSet graphicsDataSet = adfGraphicsMapFunctionality.GraphicsDataSet; graphicsDataSet.Tables.Add(elementGraphicsLayer); ESRI.ArcGIS.ADF.Web.Geometry.Polygon adfPolygon = new ESRI.ArcGIS.ADF.Web.Geometry.Polygon(); adfPolygon.Rings.Add(new ESRI.ArcGIS.ADF.Web.Geometry.Ring (new ESRI.ArcGIS.ADF.Web.Geometry.Envelope(-100, 20, -80, 40))); ESRI.ArcGIS.ADF.Web.Display.Symbol.SimpleFillSymbol simpleFillSymbol = new ESRI.ArcGIS.ADF.Web.Display.Symbol.SimpleFillSymbol(); simpleFillSymbol.Transparency = 0; simpleFillSymbol.FillType = ESRI.ArcGIS.ADF.Web.Display.Symbol.PolygonFillType.FDiagonal; simpleFillSymbol.BoundaryColor = System.Drawing.Color.Red; ESRI.ArcGIS.ADF.Web.Display.Graphics.GraphicElement graphicElement = new ESRI.ArcGIS.ADF.Web.Display.Graphics.GraphicElement(adfPolygon, simpleFillSymbol); elementGraphicsLayer.Add(graphicElement); elementGraphicsLayer.Visible = false; // Add a new FeatureGraphicsLayer ESRI.ArcGIS.ADF.Web.Display.Graphics.FeatureGraphicsLayer featureGraphicsLayer = new ESRI.ArcGIS.ADF.Web.Display.Graphics.FeatureGraphicsLayer(); featureGraphicsLayer.TableName = "Feature Graphics - Extent Rectangle"; // Add graphics layer to map functionality graphics dataset graphicsDataSet.Tables.Add(featureGraphicsLayer); ESRI.ArcGIS.ADF.Web.Geometry.Polygon adfPolygon2 = new ESRI.ArcGIS.ADF.Web.Geometry.Polygon(); adfPolygon2.Rings.Add(new ESRI.ArcGIS.ADF.Web.Geometry.Ring (new ESRI.ArcGIS.ADF.Web.Geometry.Envelope(-70, 20, -50, 40))); ESRI.ArcGIS.ADF.Web.Display.Renderer.SimpleRenderer simpleRenderer = new ESRI.ArcGIS.ADF.Web.Display.Renderer.SimpleRenderer(); simpleRenderer.Symbol = simpleFillSymbol; featureGraphicsLayer.Renderer = simpleRenderer; featureGraphicsLayer.Add(adfPolygon2); }

重现步骤

漏洞 ID: NIM012801

软件:

  • No Product Found

当漏洞状态发生变化时获得通知

下载 Esri 支持应用程序

发现关于本主题的更多内容

获取来自 ArcGIS 专家的帮助

联系技术支持部门

下载 Esri 支持应用程序

转至下载选项