When you select a FDO feature in Map 3D, you want to know the corresponding layer name as shown in Map 3D display Manager. How to do this using Map 3D Geospatial Platform API ?
We can use the MgSelectionBase.GetLayers() API to get the layers name for the selected FDO features in Map 3D. Here is a C#.NET code snippet for the same:
// Get the Map Object
AcMapMap currentMap = AcMapMap.GetCurrentMap();
MgLayerCollection layers = currentMap.GetLayers();
//select feature on Map
PromptSelectionResult selResult = ed.GetSelection();
if (selResult.Status == PromptStatus.OK)
{
SelectionSet selSet = selResult.Value;
MgSelectionBase selectionBase = AcMapFeatureEntityService.GetSelection(selSet);
foreach (MgLayerBase layer in selectionBase.GetLayers())
{
ed.WriteMessage("nFeature selected from Layer :" + layer.Name.ToString());
}
}


Leave a Reply