Infrastructure Map Server Developer

Infrastructure Map Server Developer

Reply
Active Member
6 Posts
0 Kudos
Registered: ‎12-04-2007
Post 1 of 3

toggling layers in mg2008

127 Views, 2 Replies
12-04-2007 04:41 PM
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.
Active Member
6 Posts
0 Kudos
Registered: ‎12-04-2007
Post 2 of 3

Re: toggling layers in mg2008

12-06-2007 01:44 PM 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);
}
Active Member
6 Posts
0 Kudos
Registered: ‎12-04-2007
Post 3 of 3

Re: toggling layers in mg2008

12-06-2007 01:50 PM 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);
}
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!