ElementGraphicsLayer cannot be turned off/on using Visible property.
上次发布: August 25, 2014No 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); }