<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Duplicate Leader Line Annotation tool in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/duplicate-leader-line-annotation-tool/m-p/1385200#M11138</link>
    <description>&lt;P&gt;Hi Dave,&amp;nbsp;&lt;/P&gt;&lt;P&gt;One way of having a sketch tool allow multiple clicks without using the Line sketch is to use the Multipoint geometry type.&amp;nbsp; &amp;nbsp;You can then override the OnSketchModifiedAsync callback to force the sketch to finish after your required number of clicks (in this case 2).&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's a small snippet that sounds like what you're looking for.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;internal class LeaderLineTool : MapTool
{
  public LeaderLineTool()
  {
    IsSketchTool = true;
    SketchType = SketchGeometryType.Multipoint;
    SketchOutputMode = SketchOutputMode.Map;
  }

  protected override Task OnToolActivateAsync(bool active)
  {
    return base.OnToolActivateAsync(active);
  }

  protected override async Task&amp;lt;bool&amp;gt; OnSketchModifiedAsync()
  {
    var sketchGeom = await GetCurrentSketchAsync();
    if (sketchGeom is Multipoint multiPoint)
    {
      var ptCount = multiPoint.Points.Count;
      // force the sketch to finish if there are more than 2 points
      if (ptCount &amp;gt;= 2)
        FinishSketchAsync();
    }

    return true;
  }
  protected override Task&amp;lt;bool&amp;gt; OnSketchCompleteAsync(Geometry geometry)
  {
    if (geometry is Multipoint multiPoint)
    {
      // check the point count
      //   user could have finished the sketch with less than the 
      //   required 2 points
      var ptCount = multiPoint.Points.Count;
      if (ptCount &amp;lt; 2)
      {
        return Task.FromResult(true);
      }

      var firstPoint = multiPoint.Points[0];
      var secondPoint = multiPoint.Points[1];

      // first point for leader line location
      // second point for callout location
    }

    return base.OnSketchCompleteAsync(geometry);
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Narelle&lt;/P&gt;</description>
    <pubDate>Thu, 22 Feb 2024 00:10:06 GMT</pubDate>
    <dc:creator>NarelleChedzey</dc:creator>
    <dc:date>2024-02-22T00:10:06Z</dc:date>
    <item>
      <title>Duplicate Leader Line Annotation tool</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/duplicate-leader-line-annotation-tool/m-p/1382498#M11104</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I am building an edit tool with an embedded combo box control to select text from an approved list. The template symbol for the annotation feature class is set to a balloon callout. My current tool uses a point sketch to drop callout boxes. I would like the first click of the tool to establish the leader-line location and then the second click to position the box (similar to the built-in Leader Line Anno Tool). When I switch to a line sketch, it uses the second click to create a line that the text is placed on. I'm guessing there is something basic I'm missing, but I haven't found it yet. If anyone can point me in the right direction, I would be very grateful!&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;- Dave&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2024 20:49:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/duplicate-leader-line-annotation-tool/m-p/1382498#M11104</guid>
      <dc:creator>DaveWilcox</dc:creator>
      <dc:date>2024-02-14T20:49:55Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate Leader Line Annotation tool</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/duplicate-leader-line-annotation-tool/m-p/1385200#M11138</link>
      <description>&lt;P&gt;Hi Dave,&amp;nbsp;&lt;/P&gt;&lt;P&gt;One way of having a sketch tool allow multiple clicks without using the Line sketch is to use the Multipoint geometry type.&amp;nbsp; &amp;nbsp;You can then override the OnSketchModifiedAsync callback to force the sketch to finish after your required number of clicks (in this case 2).&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's a small snippet that sounds like what you're looking for.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;internal class LeaderLineTool : MapTool
{
  public LeaderLineTool()
  {
    IsSketchTool = true;
    SketchType = SketchGeometryType.Multipoint;
    SketchOutputMode = SketchOutputMode.Map;
  }

  protected override Task OnToolActivateAsync(bool active)
  {
    return base.OnToolActivateAsync(active);
  }

  protected override async Task&amp;lt;bool&amp;gt; OnSketchModifiedAsync()
  {
    var sketchGeom = await GetCurrentSketchAsync();
    if (sketchGeom is Multipoint multiPoint)
    {
      var ptCount = multiPoint.Points.Count;
      // force the sketch to finish if there are more than 2 points
      if (ptCount &amp;gt;= 2)
        FinishSketchAsync();
    }

    return true;
  }
  protected override Task&amp;lt;bool&amp;gt; OnSketchCompleteAsync(Geometry geometry)
  {
    if (geometry is Multipoint multiPoint)
    {
      // check the point count
      //   user could have finished the sketch with less than the 
      //   required 2 points
      var ptCount = multiPoint.Points.Count;
      if (ptCount &amp;lt; 2)
      {
        return Task.FromResult(true);
      }

      var firstPoint = multiPoint.Points[0];
      var secondPoint = multiPoint.Points[1];

      // first point for leader line location
      // second point for callout location
    }

    return base.OnSketchCompleteAsync(geometry);
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Narelle&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2024 00:10:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/duplicate-leader-line-annotation-tool/m-p/1385200#M11138</guid>
      <dc:creator>NarelleChedzey</dc:creator>
      <dc:date>2024-02-22T00:10:06Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate Leader Line Annotation tool</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/duplicate-leader-line-annotation-tool/m-p/1385539#M11139</link>
      <description>&lt;P&gt;Thanks. That is helpful. Any tips on how to visually drop the leader line on the first click so that the text can be accurately placed relative to the leader line, rather than be placed on the line defined by the two points?&lt;/P&gt;&lt;P&gt;- Dave&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2024 16:46:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/duplicate-leader-line-annotation-tool/m-p/1385539#M11139</guid>
      <dc:creator>DaveWilcox</dc:creator>
      <dc:date>2024-02-22T16:46:36Z</dc:date>
    </item>
  </channel>
</rss>

