Graphic Element Order

2235
10
06-22-2011 12:01 AM
LakshmananVenkatesan
Occasional Contributor
Hi,

I am adding graphic element to my graphic container on top of active view for Print functionality. Graphic element added successfully but it hides the layer below. For example I add polygon element with Line Fill symbol it hides the below layer label. I tried with different Z order values but nothing seems work. Please help me on this issue.

All I want is to add transparent element on graphics container so that user can see the both element and layer beneath with labels.

SR
0 Kudos
10 Replies
LakshmananVenkatesan
Occasional Contributor
Can anyone help me on this?
0 Kudos
LeoDonahue
Regular Contributor
What type of graphic element are you adding?

Are you adding it to a page layout?

Did you notice that the zorder parameter of addElement() doesn't work with all types of graphic containers?
http://help.arcgis.com/en/sdk/10.0/java_ao_adf/api/arcobjects/com/esri/arcgis/carto/PageLayout.html#...

(which would be these: CompositeGraphicsLayer, FDOGraphicsLayer, GlobeGraphicsLayer, GraphicsLayer3D, GraphicsSubLayer, IGraphicsContainerProxy, Map, PageLayout )
http://help.arcgis.com/en/sdk/10.0/java_ao_adf/api/arcobjects/com/esri/arcgis/carto/IGraphicsContain...
0 Kudos
LakshmananVenkatesan
Occasional Contributor
Hi Leo

Thanks for help.

Below is code path for adding graphic element. I use FillShapeElement

ESRI.ArcGIS.Carto.IFillShapeElement FillShpElement = null;
                        FillShpElement = new ESRI.ArcGIS.Carto.PolygonElementClass();

                        if (isLineFill)
                        {
                            FillShpElement.Symbol = (ILineFillSymbol)gensymb;
                        }
                        else
                        {
                            FillShpElement.Symbol = (ISimpleFillSymbol)gensymb;
                        }

                        element = (ESRI.ArcGIS.Carto.IElement)FillShpElement;
                        element.Geometry = (IPolygon)geo;
                        graphicsCont.AddElement(element, 0);

Please help.
0 Kudos
JeffreyHamblin
New Contributor III
You can use this to set an ISimpleFillSymbol transparent:

ISimpleFillSymbol fillSymbol = new SimpleFillSymbolClass();

IRgbColor rgbColor = new RgbColorClass();
rgbColor.Red = 255;
rgbColor.Green = 255;
rgbColor.Blue = 255;
rgbColor.UseWindowsDithering = true;
rgbColor.Transparency = 0;

fillSymbol.Color = rgbColor;


Then you need to set the background of your element to that fillSymbol.
0 Kudos
LakshmananVenkatesan
Occasional Contributor
Jeff

if I set rgb color transparency to zero am not seeing the graphic element at all. What is wrong with that?
0 Kudos
JeffreyHamblin
New Contributor III
From your original post:
"All I want is to add transparent element on graphics container so that user can see the both element and layer beneath with labels."

It is not clear to me exactly what needs to be transparent. As I mentioned, you probably need some sort of element that has a background and set that transparent.

It might help if you create the effect manually in ArcMap and post a screenshot.
0 Kudos
LakshmananVenkatesan
Occasional Contributor
See the attached image, I have drawn a polygon as element on top of my layer. The layer has labels in all the polygons (ie.'ALAM') but labels behind the  graphic polygon (blue color ) is not appearing.

Hope this is clear now.
0 Kudos
JeffreyHamblin
New Contributor III
You need to add your polygon outline to the layout in order for labels to be visible through it. If the graphic element is instead added to an active dataframe, the labels are moved or hidden as your screenshot shows.

In ArcMap, ensure that no data frame has focus before drawing the polygon (click outside the map page).

If you are making an Add-In, then set the graphics container to the PageLayout:

IGraphicsContainer graphicsContainer = ArcMap.Document.PageLayout as IGraphicsContainer;
0 Kudos
LakshmananVenkatesan
Occasional Contributor
Here are below steps which am doing..

1) IActiveView av = pMapDocument.ActiveView;
2) av = (IActiveView)pMapDocument.ActiveView.FocusMap;
  
  //stores coordinates minX, minY, maxX, maxY
3)  env.PutCoords(minX, minY, maxX, maxY);
4) graphicsContainer = (ESRI.ArcGIS.Carto.IGraphicsContainer)pMap; // Explicit Cast
5) Adding all graphics - here
6)  IPageLayout docPageLayout = pMapDocument.PageLayout;
       av.Extent = env;
      av.Extent.CenterAt(midPt);
      av.Refresh();
7) ExportActiveView((IActiveView)docPageLayout, 300, 1, imgType, "D:\\", true);

Please let me know where am going wrong
0 Kudos