Problem with Refresh/Redraw of GroupLayers in ArcScene

681
2
10-24-2011 10:05 AM
DevlinBaker1
New Contributor
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, 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?
0 Kudos
2 Replies
NeilClemmons
Regular Contributor III
Here's how I do it:

m_scene.SceneGraph.Invalidate(m_sceneLayer, True, False)
m_scene.SceneGraph.ActiveViewer.Redraw(False)
0 Kudos
DevlinBaker1
New Contributor
Here's how I do it:

m_scene.SceneGraph.Invalidate(m_sceneLayer, True, False)
m_scene.SceneGraph.ActiveViewer.Redraw(False)


Yes, that's what usually (for non-group layers) works for me. I didn't explicitly use the Redraw() call before, but adding it in had no effect.

If it matters, the FeatureClasses are being created by a custom Plugin datasource and FeatureCursor. I had discounted this as the cause because the data is correctly fetched-- the data table is populated and the symbology (breaks renderer) is generated correctly with the properly low and high values, so the data must be making it in.
0 Kudos