Infrastructure Map Server Developer

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

toggling layers in mg2008

108 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 (108 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 (108 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
Welcome to the new Autodesk Community!
If this is your first visit, click here to get started and make the most of the Community. Let us know what you think of the new experience in the Community Feedback Forum.

Need installation help?

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

Ask the Community