private static List <ArcmapPickCandidate> FindPickCandidates( IPoint mapPoint, List <IFeatureLayer> pickLayers, double mapScale, double searchTolerance) { List <ArcmapPickCandidate> result = new List <ArcmapPickCandidate>(); if (pickLayers.Count > 0) { IEnvelope searchEnvelope = mapPoint.Envelope; searchEnvelope.Expand(searchTolerance, searchTolerance, false); foreach (IFeatureLayer pickLayer in pickLayers) { if (ArcmapLayerUtils.LayerIsVisible(pickLayer, mapScale)) { IIdentify identifier = pickLayer as IIdentify; IArray elements = identifier.Identify(searchEnvelope); foreach (object element in elements.Enumerate()) { IFeature feature = (element as IRowIdentifyObject).Row as IFeature; double distance; IPoint footPoint; CalculateNearestDistanceToFeature(mapPoint, feature, out distance, out footPoint); ArcmapPickCandidate ranking = new ArcmapPickCandidate(element as IIdentifyObj, distance); result.Add(ranking); } } } } return(result); }
public void CreatePropertyChildNodes(TreeviewBranchViewModel parentNode, object comObj, Type typ) { IArray arr = comObj as IArray; int index = 0; foreach (object value in arr.Enumerate()) { if ((value != null) && (value.GetType().IsCOMObject)) { ComObjectViewModel child = new ComObjectViewModel(parentNode, value, typeof(object), "[" + index + "]"); parentNode.Children.Add(child); } index++; } }