【发布时间】:2015-10-09 18:12:02
【问题描述】:
这是我一段时间以来一直试图解决的问题,并决定寻求帮助。我正在创建一个 ESRI ArcGIS Desktop 加载项,它允许用户绘制一个多边形,然后将其添加到地图中。我能够捕获多边形并将其添加到地图中,问题是透明度。当前和默认情况下,它是 100% 不透明度和实心的。我想让它的不透明度约为 50%,以便用户可以看到它背后的数据。
这是我目前的代码:
public static void AddPolygonToMap(IActiveView ActiveViewInstance, IGeometry NewGeo)
{
//Local Variable Declaration
var fillShapeElement = default(IFillShapeElement);
var element = default(IElement);
var graphicsContainer = default(IGraphicsContainer);
var simpleFilleSymbol = default(ISimpleFillSymbol);
var newRgbColor = default(IRgbColor);
var lineSymbol = default(ILineSymbol);
//Use the IElement interface to set the Envelope Element's geo
element = new PolygonElement();
element.Geometry = NewGeo;
//QI for the IFillShapeElement interface so that the symbol property can be set
fillShapeElement = element as IFillShapeElement;
//Create a new fill symbol
simpleFilleSymbol = new SimpleFillSymbol();
//Create a new color marker symbol of the color black;
newRgbColor = new RgbColor();
newRgbColor.Red = 0;
newRgbColor.Green = 0;
newRgbColor.Blue = 0;
//Create a new line symbol so that we can set the width outline
lineSymbol = new SimpleLineSymbol();
lineSymbol.Color = newRgbColor;
lineSymbol.Width = 2;
//Setup the Simple Fill Symbol
simpleFilleSymbol.Color = newRgbColor;
simpleFilleSymbol.Style = esriSimpleFillStyle.esriSFSHollow;
simpleFilleSymbol.Outline = lineSymbol;
fillShapeElement.Symbol = simpleFilleSymbol;
//QI for the graphics container from the active view allows access to basic graphics layer
graphicsContainer = ActiveViewInstance as IGraphicsContainer;
//Add the new element at Z order 0
graphicsContainer.AddElement((IElement)fillShapeElement, 0);
//Show the new graphic
ActiveViewInstance.Refresh();
}
我知道这在某种程度上是可能的,我确信它只是缺少一两行,但任何帮助将不胜感激。
V/r,
乔什
【问题讨论】:
-
我认为这是 GIS.StackExchange 的问题
-
@HimBromBeere 感谢您的建议。我已将此问题移至gis.stackexchange.com/questions/155091/…
-
OP 已将其移至 GIS StackExchange,请参阅 gis.stackexchange.com/questions/155091/…
标签: c# .net arcgis esri arcobjects