2015-07-20 61 views
0

這是我一直試圖解決的一個問題,並決定尋求幫助。我創建了一個ESRI ArcGIS Desktop加載項,允許用戶繪製多邊形,然後將其添加到地圖中。我能夠捕獲多邊形並將其添加到地圖,問題是透明度。目前和默認情況下,它是100%不透明和堅實。我想使它大約有50%的不透明度,以便用戶可以看到它背後的數據。ArcObjects 10.3向地圖添加透明多邊形

這裏是我到目前爲止的代碼:

 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,

喬希

+0

我認爲這是GIS.StackExchange – HimBromBeere

+0

的問題@HimBromBeere感謝您的建議。我已將此問題移至http://gis.stackexchange.com/questions/155091/arcobjects-10-3-add-transparent-polygon-to-map – Josh

+2

OP已將其移至GIS StackExchange,請參閱http:// gis .stackexchange.com /問題/ 155091 /添加透明多邊形到地圖使用-的ArcObjects – OzrenTkalcecKrznaric

回答