AnsweredAssumed Answered

Problems making polygon line color solid when fill color is semi-transparent

Question asked by peterlen on Aug 6, 2014

Hello - I am using Java ArcObjects and ArcGIS 10 to create some layers and add them to a map document.  After I create my feature layer, I use the layer's SimpleRenderer to set the symbology (fill color, fill opacity, line color) like:

-----------------------------------------------

SimpleRenderer sr = (SimpleRenderer) featurelayer.getRenderer();

ISymbol sym = sr.getSymbol();

SimpleFillSymbol sfs = (SimpleFillsymbol) sym;

 

IRgbColor rgb = new RGBColor();

rgb.setRed(RR);

rgb.setGrenn(GG);

rgb.setBlue(BB);

rgb.setTransparency((byte)128)

 

sfs.setColor(rgb);

ILineSymbol ls = new SimpleLineSymbol();

ls.setWidth(1);

ls.setColor(blackColor);

sfs.setOutline(ls);

--------------------------------------------

 

In the above code I though that if I set the transparency of the polygon's fill color, that the n the map with a semi-transparent fill.  That did not happend.  The color is displayed correctly but the fill is fully opaque.  In order to get the semi-transparency, I had to add the following to the feature layer:

 

featurelayer.setTransparency((short)80);

 

The problem with this is that by setting the transparency on the layer, it also gives a transparency to the polygon border color, which I don't want.  Setting the transparency on the color requires a byte whereas setting the transparency on the layer requires a short.  Not sure what the difference is there but for some reason I can't seem to get the transparency recognized when I just apply it to the fill color.  Any thoughts on what I may be missing?

 

Thanks - Peter

Outcomes