devlin@ctech.com

Problem with Refresh/Redraw of GroupLayers in ArcScene

Discussion created by devlin@ctech.com on Oct 24, 2011
Latest reply on Oct 25, 2011 by devlin@ctech.com
The functionality I am seeking is to add a FeatureLayer (containing some data from a file selected for import) inside of a GroupLayer collecting all of the data from that particular source. When data is first added from a particular source, a new group layer is created, and the subject FeatureLayer is created and subsequently added to the group with the group.Add() method. The following refresh method is then called to force the featurelayer to redraw in the viewer,

    public void RefreshLayerInDocument(ILayer layer)
    {
                var sxdoc = this.Application.Document as ISxDocument;
                sxdoc.Scene.SceneGraph.Invalidate(layer, true, true);
                sxdoc.Scene.SceneGraph.Invalidate(sxdoc.Scene.SceneGraph.ActiveViewer, true, false);
                sxdoc.Scene.SceneGraph.RefreshViewers();
                sxdoc.UpdateContents();
    }

The issue arises when trying to add another FeatureLayer to the existing group. If another FeatureLayer is added to the group and the RefreshLayerInDocument() method above called, the new layer does not display. If the GroupLayer is manually refreshed in the TOC, it will draw however (so the data is there/not broken).

Similarly, invalidating each layer in the group as well as the group has the same effect:

                    var sxdoc = this.Application.Document as ISxDocument;
                    sxdoc.Scene.SceneGraph.Invalidate(group as ICompositeLayer, true, true);

                    for (int i = 0; i < group.Count; i++)
                    {
                        sxdoc.Scene.SceneGraph.Invalidate(group.Layer[i], true, true);
                    }

                    sxdoc.Scene.SceneGraph.Invalidate(sxdoc.Scene.SceneGraph.ActiveViewer, true, false);
                    sxdoc.UpdateContents();
                    sxdoc.Scene.SceneGraph.RefreshViewers();

I'm quite stuck. Is there a step for invalidation/refreshing of grouplayers that I'm missing?

Outcomes