<?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: callout leader line in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/callout-leader-line/m-p/1192981#M8432</link>
    <description>&lt;P&gt;Thank you so much for that.&amp;nbsp; With just a few tweaks for my situation, it worked!&lt;/P&gt;&lt;P&gt;Seems like I had all these elements, but something wasn't quite right, apparently.&lt;/P&gt;&lt;P&gt;Andy&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 18 Jul 2022 16:04:02 GMT</pubDate>
    <dc:creator>AndrewAlexander1</dc:creator>
    <dc:date>2022-07-18T16:04:02Z</dc:date>
    <item>
      <title>callout leader line</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/callout-leader-line/m-p/1192786#M8428</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm trying to place a point, have a text "label" and a leader line going from the point, to the label.&lt;/P&gt;&lt;P&gt;I can get the point and the text, but no leader line shows.&amp;nbsp; I have looked everywhere, for a long time, tried every sample I can find, and I cannot get the leader line to show.&amp;nbsp; I have seen the community examples, and have tried everything that is even remotely pertinent.&amp;nbsp; And they definitely have balloons and/or callouts defined in the definitions.&lt;/P&gt;&lt;P&gt;I also don't even know what the "best practice" is for this sort of thing. CIMTextGraphic, CIMTextSymbol, labels?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone have a really basic, "put a dot here, label it with a callout and leader line and actually make it display" example?&amp;nbsp; One that doesn't have numerous other methods being called that are not in the example?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Andy&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jul 2022 00:29:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/callout-leader-line/m-p/1192786#M8428</guid>
      <dc:creator>AndrewAlexander1</dc:creator>
      <dc:date>2022-07-18T00:29:33Z</dc:date>
    </item>
    <item>
      <title>Re: callout leader line</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/callout-leader-line/m-p/1192887#M8430</link>
      <description>&lt;P&gt;Below is a sample snippet and the method you're looking for is:&amp;nbsp;CreateCIMCalloutTextGraphic(cityName, geometry) which takes a string followed by a geometry (where the leader line ends).&amp;nbsp; The sample is taken from a 2022 Palm Springs Dev Summit tech session, which you can get here:&amp;nbsp;&lt;A href="https://github.com/esri/arcgis-pro-sdk/wiki/tech-sessions" target="_self"&gt;https://github.com/esri/arcgis-pro-sdk/wiki/tech-sessions&lt;/A&gt;&amp;nbsp; and then click on "Using Graphic Elements with Maps and Layouts" under 2022 Palm Springs.&amp;nbsp; Note that this sample in 2.x so you would have to convert this to 3.0.&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;internal class AddCalloutText : Button
  {
    private List&amp;lt;IDisposable&amp;gt; _graphics = new List&amp;lt;IDisposable&amp;gt;();

    protected override void OnClick()
    {
      try
      {
        if (_graphics.Count() &amp;gt; 0)
        {
          // clear existing graphic
          foreach (var graphic in _graphics)
            graphic.Dispose();
          _graphics.Clear();
          return;
        }
        QueuedTask.Run(() =&amp;gt;
        {
          Envelope zoomExtent;

          var cityName = "Redlands";
          var geometry = Module1.GetGeometry("U.S. Cities", $@"city_name = '{cityName}'"); // USHighways, route_num = 'I10'  States, state_name = 'California'  
                  var cimGraphic = CreateCIMCalloutTextGraphic(cityName, geometry);
          var graphic = MapView.Active.AddOverlay(cimGraphic);
          _graphics.Add(graphic);
          zoomExtent = geometry.Extent;

          cityName = "Palm Springs";
          geometry = Module1.GetGeometry("U.S. Cities", $@"city_name = '{cityName}'");  
                  cimGraphic = CreateCIMCalloutTextGraphic(cityName, geometry);
          graphic = MapView.Active.AddOverlay(cimGraphic);
          _graphics.Add(graphic);
          zoomExtent = zoomExtent.Union(geometry.Extent);

          MapView.Active.ZoomTo(zoomExtent.Expand(1.5, 1.5, true), new TimeSpan(0, 0, 1));
        });
      }
      catch (Exception ex)
      {
        MessageBox.Show(ex.ToString());
      }
    }

    private static CIMTextGraphic CreateCIMCalloutTextGraphic(string text, Geometry geometry)
    {
      var textSymbolRef = SymbolFactory.Instance.ConstructTextSymbol(
          ColorFactory.Instance.BlackRGB, 10, "Tahoma", "Bold").MakeSymbolReference();

      //now set text and location for the CIMGraphic
      var textGraphic = new CIMTextGraphic
      {
        Symbol = textSymbolRef,
        Text = text,
        Shape = geometry
      };
      textGraphic.Placement = Anchor.BottomLeftCorner;

      //Create a call out
      var backgroundCalloutSymbol = new CIMBackgroundCallout();

      // set callout colors and leader line
      #region callout colors and leader line
      //colors used by bounding callout box
      CIMColor accentColor = CIMColor.CreateRGBColor(0, 255, 0);
      CIMColor backgroundColor = ColorFactory.Instance.CreateRGBColor(190, 255, 190, 50);

      //Leader line
      //Get a line symbol
      var lineSymbol = SymbolFactory.Instance.ConstructLineSymbol(accentColor, 2, SimpleLineStyle.Solid);
      //Create a solid fill polygon symbol for the callout.
      var polySymbol = SymbolFactory.Instance.ConstructPolygonSymbol(backgroundColor, SimpleFillStyle.Solid);
      //accent symbol
      var accentSymbol = SymbolFactory.Instance.ConstructLineSymbol(accentColor, 2, SimpleLineStyle.Solid);

      //assign the leader line to the callout
      backgroundCalloutSymbol.LeaderLineSymbol = lineSymbol;
      backgroundCalloutSymbol.LineStyle = LeaderLineStyle.Base;
      backgroundCalloutSymbol.LeaderOffset = 2;

      //Assign the polygon to the background callout
      backgroundCalloutSymbol.BackgroundSymbol = polySymbol;

      //Set margins for the callout to center the text
      backgroundCalloutSymbol.Margin = new CIMTextMargin
      {
        Left = 5,
        Right = 5,
        Top = 5,
        Bottom = 5
      };

      //define the Accent bar
      backgroundCalloutSymbol.AccentBarSymbol = accentSymbol;
      #endregion callout colors and leader line

      //change the Offset for the textbox ... move 20 right and 20 high
      var textSym = textGraphic.Symbol.Symbol as CIMTextSymbol;
      textSym.OffsetX = 20;
      textSym.OffsetY = -40;

      //assign the callout to the textSymbol
      textSym.Callout = backgroundCalloutSymbol;

      if (geometry.GeometryType == GeometryType.Point)
      {
        // create a leader point
        CIMLeaderPoint leaderPt = new CIMLeaderPoint
        {
          Point = geometry as MapPoint
        };
        // assign to the textGraphic
        textGraphic.Leaders = new List&amp;lt;CIMLeader&amp;gt;() { leaderPt }.ToArray();
      }

      return textGraphic;
    }
  }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jul 2022 13:34:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/callout-leader-line/m-p/1192887#M8430</guid>
      <dc:creator>Wolf</dc:creator>
      <dc:date>2022-07-18T13:34:42Z</dc:date>
    </item>
    <item>
      <title>Re: callout leader line</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/callout-leader-line/m-p/1192966#M8431</link>
      <description>&lt;P&gt;Please also refer to the following snippet in the &lt;A href="https://github.com/Esri/arcgis-pro-sdk/wiki" target="_self"&gt;ArcGIS Pro SDK wiki&lt;/A&gt;:&lt;/P&gt;&lt;P&gt;&lt;A title="Creates a background callout text symbol" href="https://github.com/Esri/arcgis-pro-sdk/wiki/ProSnippets-TextSymbols#creates-a-background-callout-text-symbol" target="_self"&gt;Creates a background callout text symbol&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jul 2022 15:41:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/callout-leader-line/m-p/1192966#M8431</guid>
      <dc:creator>UmaHarano</dc:creator>
      <dc:date>2022-07-18T15:41:24Z</dc:date>
    </item>
    <item>
      <title>Re: callout leader line</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/callout-leader-line/m-p/1192981#M8432</link>
      <description>&lt;P&gt;Thank you so much for that.&amp;nbsp; With just a few tweaks for my situation, it worked!&lt;/P&gt;&lt;P&gt;Seems like I had all these elements, but something wasn't quite right, apparently.&lt;/P&gt;&lt;P&gt;Andy&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jul 2022 16:04:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/callout-leader-line/m-p/1192981#M8432</guid>
      <dc:creator>AndrewAlexander1</dc:creator>
      <dc:date>2022-07-18T16:04:02Z</dc:date>
    </item>
    <item>
      <title>Re: callout leader line</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/callout-leader-line/m-p/1207901#M8671</link>
      <description>&lt;P&gt;A follow up question for these CIMgraphics.&amp;nbsp; Is it possible to have these (the callout boxes) where we can click and drag them around?&amp;nbsp; And have the leader still attached to the point?&lt;/P&gt;&lt;P&gt;Thanks&lt;BR /&gt;Andy&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2022 20:41:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/callout-leader-line/m-p/1207901#M8671</guid>
      <dc:creator>AndrewAlexander1</dc:creator>
      <dc:date>2022-08-30T20:41:49Z</dc:date>
    </item>
  </channel>
</rss>

