Whenever a selection is changed by the Viewer, the selection information is sent to the Web server so the map can be re-generated.
To retrieve and manipulate the active selection for a map:
- Create an MgSelection object for the map. Initialize it to the active selection.
- Retrieve selected layers from the MgSelection object.
- For each layer, retrieve selected feature classes. There will normally be one feature class for the layer, so you can use the MgSelection::GetClass() method instead of the MgSelection::GetClasses() method.
- Call MgSelection::GenerateFilter() to create a selection filter that contains the selected features in the class.
- Call MgFeatureService::SelectFeatures() to create an MgFeatureReader object for the selected features.
- Process the MgFeatureReader object, retrieving each selected feature.