Skip to content

Instantly share code, notes, and snippets.

@springmeyer
Created July 29, 2010 03:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save springmeyer/497172 to your computer and use it in GitHub Desktop.
Save springmeyer/497172 to your computer and use it in GitHub Desktop.
// pull layers from query string
boost::optional<std::string> layer_string = get_layer_string():
if (layer_string)
{
std::clog << "filtering layers...\n";
// convert comma separated layers to vector
std::vector<std::string> layer_names = parse_layer_string(*layer_string);
// for each map layer object
BOOST_FOREACH ( layer const& lyr, map_.layers() )
{
bool requested = false;
// figure out if it was requested and either
// set active (status = on) or disable
BOOST_FOREACH ( std::string & lyr_name, layer_names )
{
if (lyr.name() == lyr_name)
{
requested = true;
}
}
lyr.setActive(requested);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment