I want to read graphics elements (TextElements and RectangleElements) from a GroupElement object (IGroupElement3) and put them into another in the same order as they were added to the original. The original graphics were built and added to their GroupElement in an ArcMap ScreenDisplay context, so the first graphic added has the lowest z-order, the next has the next highest, etc. My idea is to use the Elements() property of the original GroupElement to get the set of elements as an EnumElement object (IEnumElement) and then to loop through the IEnumElement, adding each element to the new GroupElement. This technique, though, will only work for me, if the elements in IEnumElement are retrieved in the same z-order as they had in the original GroupElement, i.e. lowest first to highest last (FIFO). I saw this post and got a bit worried about the idiosyncrasies of IEnumElement operations. Does anyone know if IEnumElement will maintain the original z-order of the graphics?

As context and in response to Kirk's comment below, I will say that I am doing this to get around a bug in ArcGIS for Server 10.1, where an ESRI optimized Map Service cannot handle annotation that has nested grouped graphics (see this post). Each piece of our annotation contains a GroupElement that itself contains multiple Group Elements. Each of these Sub Group Elements contains a set of Rectangle Elements and Text Elements. The workaround for the bug is to put all of the graphic elements into the containing GroupElement of the annotation without their own grouping. Because the z-order of the graphic elements within a Sub Group Element is important to maintain and because there are multiple Sub Group Elements, I want to take each Sub Group Element in turn and read its graphic elements into the annotation's GroupElement. This will avoid the bug. Otherwise, the Map Service simply won't draw the annotation.

Code is being implemented in C# in a web app. I do not have access to the server and app, so I cannot test my idea. Nonetheless, I am being asked to come up with a solution. Others will just have to test it. Thanks for any help you can offer, folks.

  • 1
    Why not just IClone.Clone() the entire group element then add it to whatever you are wanting to add it to? Apr 8 '13 at 17:03
  • @Kirk - A fair and clever solution, but not what I am trying to do. To keep my question short, I chose not to give a more extensive context, and I have now confused matters. I will now edit my question to give a more specific explanation. Apr 8 '13 at 19:35
  • @celticflute Would you mind to share some example, how to extract element from group nested in group in Python?
    – Tomek
    Sep 16 '13 at 15:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.