Infrastructure Map Server Developer

Infrastructure Map Server Developer

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

toggling layers in mg2008

119 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 (119 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 (119 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);
}
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.