Infrastructure Map Server Developer

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

toggling layers in mg2008

110 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
Posts: 6
Registered: ‎12-04-2007
Message 2 of 3 (110 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
Posts: 6
Registered: ‎12-04-2007
Message 3 of 3 (110 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);
}

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you interested in helping shape the Autodesk Community?
We’re looking at a few different ways to improve the “All Forums” landing page and need your feedback! If interested, please take a few minutes to fill out the following Usability Study. Thank you for your time!

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community