Infrastructure Map Server Forum
Welcome to Autodesk’s Infrastructure Map Server Forums. Share your knowledge, ask questions, and explore popular Infrastructure Map Server topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

toggling layers in mg2008

2 REPLIES 2
Reply
Message 1 of 3
joshk
297 Views, 2 Replies

toggling layers in mg2008

I have seen a great deal of info on toggling layers in mg6.x but finding it difficult to apply those to mg2008 studio. I am trying to invoke a script in my toolbar that will toggle a layer on or off. Any help for a newbie would be appreciated.
2 REPLIES 2
Message 2 of 3
joshk
in reply to: joshk

Figure it out by looking at web API rough example that worked:

MgLayer roadsLayer = mgLayers.GetItem("streets") as MgLayer;
if (roadsLayer.GetVisible() == true)
{
roadsLayer.SetVisible(false);
}
else
{
roadsLayer.SetVisible(true);
}
Message 3 of 3
joshk
in reply to: joshk

also if you are toggling groups:

MgLayerGroupCollection mgLayerGroup = Map.GetLayerGroups();

MgLayerGroup nameGroup = mgLayerGroup.GetItem("name") as MgLayerGroup;
if (nameGroup.GetVisible() == true)
{
nameGroup.SetVisible(false);
}
else
{
nameGroup.SetVisible(true);
}

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report