<?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: User drawn rectangle doesn't persist on map after mouse-up in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/user-drawn-rectangle-doesn-t-persist-on-map-after/m-p/1426287#M11505</link>
    <description>&lt;P&gt;Tyrone, I stand corrected - i did a bit of digging&amp;nbsp; and this &lt;U&gt;&lt;EM&gt;is&lt;/EM&gt;&lt;/U&gt; in the public api:&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic14160.html" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic14160.html&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic14152.html" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic14152.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;So, u shld be able to do SelectionEnvironment.SetShowSelectionGraphic(true | false). SelectionEnvironment.ShowSelectionGraphic will give u the current "show graphic" value. "SetShowSelectionGraphic" must be called on the MCT via QueuedTask.Run.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SelectionEnvironment is a static class within ArcGIS.Desktop.Mapping&lt;/P&gt;</description>
    <pubDate>Thu, 09 May 2024 23:45:11 GMT</pubDate>
    <dc:creator>CharlesMacleod</dc:creator>
    <dc:date>2024-05-09T23:45:11Z</dc:date>
    <item>
      <title>User drawn rectangle doesn't persist on map after mouse-up</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/user-drawn-rectangle-doesn-t-persist-on-map-after/m-p/1418926#M11464</link>
      <description>&lt;P&gt;I apologize in advance - the code is running on an intranet, and I can't copy/paste.&lt;/P&gt;&lt;P&gt;I have a dockpane with a button mapped to a rectangle tool. The user uses the tool to drag a rectangle on the map. When the user completes the rectangle via mouse-up, the rectangle disappears from the map.&lt;/P&gt;&lt;P&gt;Do I need to create a graphic from the geometry created by the tool and add it to the map's graphic layer?&lt;/P&gt;&lt;P&gt;In my map rectangle tool class, I initialize with:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;IsSketchTool = true;&lt;/LI&gt;&lt;LI&gt;CompleteSketchOnMouseUp = true;&lt;/LI&gt;&lt;LI&gt;SketchType = SketchGeometryType.Rectangle;&lt;/LI&gt;&lt;LI&gt;sketchOutputMode = SketchOutputMode.Map;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;The rectangle extent parameters are then used to open a web page via another button on the dockpane.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2024 20:16:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/user-drawn-rectangle-doesn-t-persist-on-map-after/m-p/1418926#M11464</guid>
      <dc:creator>TyroneLigon1</dc:creator>
      <dc:date>2024-05-03T20:16:10Z</dc:date>
    </item>
    <item>
      <title>Re: User drawn rectangle doesn't persist on map after mouse-up</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/user-drawn-rectangle-doesn-t-persist-on-map-after/m-p/1418977#M11465</link>
      <description>&lt;P&gt;EDIT: lol - well, after just finishing writing this reply it struck me that maybe it is _not_ the "show selection graphic behavior" that you are after! Somewhat presumptive on my part, apologies - that said, just in case, and/or if someone else _is_ (who reads this post) I will leave my reply...and we will still add this to the SelectionEnvironment at 3.4.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it looks like this was never exposed in the selection environment public api -&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic14140.html" target="_blank" rel="noopener"&gt;https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic14140.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;What you are looking for is the equivalent to the "Display the interactive selection graphic" checkbox on the Application selection settings UI.&lt;/P&gt;&lt;P&gt;I will pass this on to the dev team for 3.4.&lt;/P&gt;&lt;P&gt;In the meanwhile, this will work (but requires use of an internal namespace) - maybe do this in the tool activate and set it back to the previous setting when your tool is deactivated - your call.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;//fyi
using ArcGIS.Desktop.Internal.Mapping;
...

internal class MySelectionTool : .... {
 ...

  public void SetShowInteractiveSelectionGraphic(bool showGraphic) {
    var map_module_internal =
        FrameworkApplication.FindModule("esri_mapping") as 
              IInternalMappingModule;
    //Must be called on the QueuedTask! or will throw 
    //CalledOnWrongThreadException
    map_module_internal.SelectionSettings.
       SetShowInteractiveSelectionGraphic(showGraphic);
  }

  public bool GetShowInteractiveSelectionGraphic()
  {
    var map_module_internal =
        FrameworkApplication.FindModule("esri_mapping") as 
             IInternalMappingModule;
    //should be fine being called from the UI thread
    return map_module_internal.SelectionSettings.
                      ShowInteractiveSelectionGraphic;
  }
  ...


   //usage
   internal bool _keepShowSelectionGraphicSetting = false;

   //somewhere - perhaps tool activation
   QueuedTask.Run(() =&amp;gt; {
      _keepShowSelectionGraphicSetting = 
              this.GetShowInteractiveSelectionGraphic();
      if (!_keepShowSelectionGraphicSetting)
         this.SetShowInteractiveSelectionGraphic(true);
      ...
   });

   //somewhere - perhaps tool deactivation
   QueuedTask.Run(() =&amp;gt; {
      if (_keepShowSelectionGraphicSetting != 
              this.GetShowInteractiveSelectionGraphic())
         this.SetShowInteractiveSelectionGraphic(
                         _keepShowSelectionGraphicSetting);
      ...
   });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 04 May 2024 01:15:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/user-drawn-rectangle-doesn-t-persist-on-map-after/m-p/1418977#M11465</guid>
      <dc:creator>CharlesMacleod</dc:creator>
      <dc:date>2024-05-04T01:15:26Z</dc:date>
    </item>
    <item>
      <title>Re: User drawn rectangle doesn't persist on map after mouse-up</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/user-drawn-rectangle-doesn-t-persist-on-map-after/m-p/1420669#M11496</link>
      <description>&lt;P&gt;I am getting the result I was expecting - the user drags a rectangle on the map, and the rectangle remains after the user finishes the drag operation. I now have to extract the rectangle's extent, and provide an option to remove the rectangle from the map, which I will address in another post. Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2024 19:49:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/user-drawn-rectangle-doesn-t-persist-on-map-after/m-p/1420669#M11496</guid>
      <dc:creator>TyroneLigon1</dc:creator>
      <dc:date>2024-05-08T19:49:26Z</dc:date>
    </item>
    <item>
      <title>Re: User drawn rectangle doesn't persist on map after mouse-up</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/user-drawn-rectangle-doesn-t-persist-on-map-after/m-p/1426287#M11505</link>
      <description>&lt;P&gt;Tyrone, I stand corrected - i did a bit of digging&amp;nbsp; and this &lt;U&gt;&lt;EM&gt;is&lt;/EM&gt;&lt;/U&gt; in the public api:&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic14160.html" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic14160.html&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic14152.html" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic14152.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;So, u shld be able to do SelectionEnvironment.SetShowSelectionGraphic(true | false). SelectionEnvironment.ShowSelectionGraphic will give u the current "show graphic" value. "SetShowSelectionGraphic" must be called on the MCT via QueuedTask.Run.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SelectionEnvironment is a static class within ArcGIS.Desktop.Mapping&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2024 23:45:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/user-drawn-rectangle-doesn-t-persist-on-map-after/m-p/1426287#M11505</guid>
      <dc:creator>CharlesMacleod</dc:creator>
      <dc:date>2024-05-09T23:45:11Z</dc:date>
    </item>
  </channel>
</rss>

