We are creating a custom Map Tool. Two sketches should be drawn one after another.
- First sketch should be drawn by a user;
- Second sketch should be drawn programmatically and should start at the position of the first sketch centre
When user does the first sketch mouse up, we have OnToolMouseUp method. We get a sketch geometry and coordinates for the second sketch, then change the sketchType (from Rectangle to Circle) , create a circle geometry and set geometry.
Question: how to make the second sketch visible?
ArcGIS Pro 3.4, .NET 8
protected async override void OnToolMouseUp(MapViewMouseButtonEventArgs args)
{
await QueuedTask.Run(() =>
{
FireSketchEvents = true;
ArcGIS.Core.Geometry.Geometry currentSketchGeometry = null;
currentSketchGeometry = this.GetCurrentSketchAsync().Result;
if (currentSketchGeometry.PointCount < 5)
{ clsShare.MessageBoxShow("Cannot proceed without rectangle selection"); }
Coordinate2D secondSketchCentrePoint = // here the point calculated
EllipticArcSegment segment = new ArcGIS.Core.Geometry.EllipticArcBuilderEx(secondSketchCentrePoint,1,ArcOrientation.ArcCounterClockwise).ToSegment();
ArcGIS.Core.Geometry.Polygon polylineNewSketchGeometry = PolygonBuilderEx.CreatePolygon([segment]);
//this.ClearSketchAsync();
//base.OnToolMouseUp(args);
this.SketchType = SketchGeometryType.Circle;
this.SetCurrentSketchAsync(polylineNewSketchGeometry);
this.StartSketchAsync();
args.Handled = true;
});