public Dictionary<MapMember,List<long>> ToDictionary()
Public Overloads Function ToDictionary() As Dictionary(Of MapMember,List(Of Long))
Return Value
Dictionary of mapMembers and their corresponding objectIDs.
public Dictionary<MapMember,List<long>> ToDictionary()
Public Overloads Function ToDictionary() As Dictionary(Of MapMember,List(Of Long))
{
// Loads the selected features into an Inspector instance.
// get the first layer and its corresponding selected feature OIDs
var firstSelectionSet = selectedFeatures.ToDictionary().First();
// create an instance of the inspector class
var inspector = new Inspector();
// load the selected features into the inspector using a list of object IDs
await inspector.LoadAsync(firstSelectionSet.Key, firstSelectionSet.Value);
}
// Retrieves the value of a specific attribute and the geometry of the first selected feature from the provided selection set. await QueuedTask.Run(() => { // get the first layer and its corresponding selected feature OIDs var firstSelectionSet = selectedFeatures.ToDictionary().First(); // create an instance of the inspector class var inspector = new Inspector(); // load the selected features into the inspector using a list of object IDs inspector.Load(firstSelectionSet.Key, firstSelectionSet.Value); //get the value of var pscode = inspector["STATE_NAME"]; var myGeometry = inspector.Shape; });
{
var rootNodesMapView = MapView.Active;
if (rootNodesMapView == null)
return;
await QueuedTask.Run(() =>
{
MapMemberIDSet rootNodes = rootNodesMapView.GetRootNodes();
var rootNodeDict = rootNodes.ToDictionary();
// rootNodeDict is a Dictionary<MapMember, List<long>>
// access a particular mapMember in the Dictionary
if (rootNodeDict.ContainsKey(mapMember))
{
var oids = rootNodeDict[mapMember];
}
// OR iterate through the dictionary
foreach (var (mm, oids) in rootNodeDict)
{
// do something
}
});
}
{
MapMember us_zips_layer = map.GetLayersAsFlattenedList().OfType<FeatureLayer>().First(s => s.Name == "USA zips layer");
var addToSelection = new Dictionary<MapMember, List<long>>();
addToSelection.Add(us_zips_layer, new List<long> { 1506, 2696, 2246, 1647, 948 });
//Create a SelectionSet object
var selSet = ArcGIS.Desktop.Mapping.SelectionSet.FromDictionary(addToSelection);
var selSetDict = selSet.ToDictionary();
// convert to the dictionary and only include those that are of type FeatureLayer
var selSetDictFeatureLayer = selSet.ToDictionary<FeatureLayer>();
}
{
MapMember us_zips_layer = map.GetLayersAsFlattenedList().OfType<FeatureLayer>().First(s => s.Name == "USA zips layer");
var addToSelection = new Dictionary<MapMember, List<long>>();
addToSelection.Add(us_zips_layer, new List<long> { 1506, 2696, 2246, 1647, 948 });
//Create a SelectionSet object
var selSet = ArcGIS.Desktop.Mapping.SelectionSet.FromDictionary(addToSelection);
var kvp = selSet.ToDictionary().Where(kvp => kvp.Key.Name == "LayerName").FirstOrDefault();
var oidList = kvp.Value;
}
{
var sname = featSceneLayer.Name;
var mapView = MapView.Active;
if (mapView == null)
return;
await QueuedTask.Run(() =>
{
//Select all features within the current map view
var sz = mapView.GetViewSize();
var c_ll = new Coordinate2D(0, 0);
var c_ur = new Coordinate2D(sz.Width, sz.Height);
//Use screen coordinates for 3D selection on MapView
var env = EnvelopeBuilderEx.CreateEnvelope(c_ll, c_ur);
//HasAssociatedFeatureService does not matter for SelectFeaturesEx
//or GetFeaturesEx
var result = mapView.SelectFeaturesEx(env);
//var result = mapView.GetFeaturesEx(env);
//The list of object ids from SelectFeaturesEx
var oids1 = result.ToDictionary().Where(kvp => kvp.Key.Name == sname).First().Value;
//TODO - use the object ids
mapView.Map.ClearSelection();
});
}
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)