Infrastructure Map Server Developer

Infrastructure Map Server Developer

Reply
Active Member
joshk
Posts: 6
Registered: ‎12-04-2007
Message 1 of 3 (126 Views)

toggling layers in mg2008

126 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
joshk
Posts: 6
Registered: ‎12-04-2007
Message 2 of 3 (126 Views)

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
joshk
Posts: 6
Registered: ‎12-04-2007
Message 3 of 3 (126 Views)

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 Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!