Hi,
In ArcObjects, there is a SearchTolerance property on IMxDocument.
Is there an equivalent to this in the ArcGIS Pro SDK? If so, where can I retrieve the value?
If not, what can I do to mimic what SearchTolerance does in ArcMap? We use it with the Envelope.Expand method when detecting if a click point is near any existing features.
In ArcMap, SearchTolerance changes depending on the zoom. The farther you zoom out, the larger the tolerance is and vice-versa.
TIA.
Kris
In Pro, you can use the SelectionEnvironment class.
SelectionTolerance
SetSelectionTolerance
Thanks!
Uma
Thanks Uma.
Followup - the value is 3 and appears to be in Device Units which I assume is pixels. How can I convert this value to the map linear unit so I can pass it into Envelope.Expand? Is there an easy way to do this? ArcObjects did this automatically with the SearchTolerance property (SearchTolerancePixels was the value in pixels).
TIA.
Kris
In the past ive calculated the pixel linear distance from a known point in the map, either the mouse location or the center of the map as a MapPoint.
private Polygon CreateSearchPolygon(MapPoint mapPoint, int pixels)
{
//get search radius
var screenPoint = MapView.Active.MapToScreen(mapPoint);
var radiusScreenPoint = new System.Windows.Point((screenPoint.X + pixels), screenPoint.Y);
var radiusMapPoint = MapView.Active.ScreenToMap(radiusScreenPoint);
var searchRadius = GeometryEngine.Instance.Distance(mapPoint, radiusMapPoint);
In the example above i was creating a search polygon around a mappoint by pixels.
The variable searchRadius is your linear distance.
Than you Sean. This is exactly what I need.
Much appreciated.
Kris
Hi Uma,
Is SelectionTolerance used by ArcGIS Pro itself (e.g. is it used by the native select tool)? If so, can the tolerance setting be controlled by the user (is there an option in the UI somewhere)?
Thanks,
Rob.
Hi Robert,
I don't see an UI setting for Search Tolerance either.
Uma
Thank you Uma.
Rob.