[mapguide-users] Trying to add another class definition to a SDF

Jamo adam.jamison at portbris.com.au
Thu May 21 23:44:39 EDT 2009


Thanks Jackie.

I'm now trying to create a layer for my feature source, however I would like
to add it to group of a group....

I'm using the following but it is crashing the server :(

      MgLayerGroup myLayerGroup;
      if (DoesLayerGroupExist("Markup", map) == false)
      {
        myLayerGroup = new MgLayerGroup("Markup");
        myLayerGroup.SetLegendLabel("Markup");
        myLayerGroup.SetDisplayInLegend(true);
        myLayerGroup.SetVisible(true);
        myLayerGroup.SetDisplayInLegend(true);
        map.GetLayerGroups().Insert(0, myLayerGroup);
      }
      else
      {
        myLayerGroup = map.GetLayerGroups().GetItem("Markup");
      }

      map.Save(ResourceService);

      MgLayerGroup myLayerGroup1;
      if (DoesLayerGroupExist("userid", map) == false)
      {
        myLayerGroup1 = new MgLayerGroup("userid");
        myLayerGroup1.SetLegendLabel("userid");
        myLayerGroup1.SetDisplayInLegend(true);
        myLayerGroup1.SetVisible(true);
        myLayerGroup1.SetDisplayInLegend(true);
        myLayerGroup1.SetGroup(myLayerGroup);
        map.GetLayerGroups().Insert(0, myLayerGroup1);        
      }

      myLayer.ForceRefresh();
      map.Save(ResourceService);

      myLayer.SetGroup(myLayerGroup1);
      map.GetLayers().Insert(0, myLayer);

I am able to write a layergroup to the map but when i try and write a
layergroup to another layergroup it crashes the server ... perhaps there is
something wrong with the code above?

Cheers

-- 
View this message in context: http://n2.nabble.com/Trying-to-add-another-class-definition-to-a-SDF-tp2950536p2955563.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list