Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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. The logic for creating the feature layer and adding it to the scene, and subsequently forcing it to refresh so that it draws, has been working for FeatureLayers some time. However, it doesn't work for GroupLayers. The refresh method is as such:

    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();
    }

Note that manually selecting Refresh on the TOC allows a proper refresh and everything works.

The code for creating the grouping and adding the feature layer to it takes the form;

            IGroupLayer newGroupLayer = new GroupLayer();
            newGroupLayer.Name = layerName;
            scenehook.Scene.AddLayer(newGroupLayer);
            newGroupLayer.Add(layer);
            RefreshLayerInDocument(group as ILayer);
            RefreshLayerInDocument(layer);

Altering the order of the Refresh calls on the group and the featurelayer has had no impact on the outcome, it still requires a manual refresh.

My thoughts are that there must be an invalidate call required for groups that I'm not aware of, but I haven't had any luck searching the documentation.

share|improve this question
    
Did you try assigning a spatial ref to ILayer.SpatialReference on the grouplayer? –  Kirk Kuykendall Jan 3 '12 at 15:14
    
Did you get this solved? –  Andy Mar 12 at 15:25
    
I tried assigning a spatial ref to the group layer; and it seemed to have no effect. –  Andy Mar 12 at 15:30
    
Never did find a solution for this, ended up going in a different direction. –  DBaker Apr 7 at 23:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.