How to enable two Map tools at same time using ArcGIS PRO SDK

829
6
05-24-2021 11:20 PM
sudhansuMishra
New Contributor II

We are working on a project using ArcGIS Pro SDK. The following is the problem statement.

User wishes to enable two map tools at same time, for example if user clicks on first tool, then another tool should be enabled as shown in the attached screenshot.

This is already implemented in ArcMap and it is working.

Your inputs/ideas are most appreciated.

sudhansuMishra_2-1621923176440.png

      Pic.1 ArcGISPro

User selected "Modify Annotation Tool”, now user wants to enable "Point Rotate Tool" automatically

sudhansuMishra_3-1621923543293.png

     Pic.2 ArcMap

Working functionality in ArcMap.

Tags (1)
0 Kudos
6 Replies
GintautasKmieliauskas
Regular Contributor
0 Kudos
sudhansuMishra
New Contributor II

Thank you for replying,

We tried your suggestion but it is not fulfill our requirement.

0 Kudos
SeanJones
Esri Regular Contributor

There's an example of a custom condition and the daml configuration at the bottom of the following thread:

https://community.esri.com/t5/arcgis-pro-sdk-questions/contextmenudatacontext-is-null-with-module-ca...

0 Kudos
DharmaRajan
Occasional Contributor

You can try to change the image of button to indicate that it is active/inactive based on the required condition(for Appearance purpose and in the backend you have to implement your logic to accomplish the functionality) .

Code snippet is given below for your reference.

 

 

internal class btnViewConfig : Button
    {
        protected override void OnClick()
        {
            this.SmallImage = new BitmapImage(new Uri("pack://application:,,,/YourAssemblyName;component/Resources/Activated.png"));
            this.LargeImage = new BitmapImage(new Uri("pack://application:,,,/YourAssemblyName;component/Resources/Activated.png"));
}
}

 

 

 

Wolf
by Esri Regular Contributor
Esri Regular Contributor

Neither ArcGIS Pro nor the Pro SDK support activating two tools at the same time.  If you write your own tools you can 're-use' a tool from OnSketchComplete of another tool.  I attached a sample project to demonstrate this pattern.  The attached add-in contains two tools: the 'Line Anno' tool which allows to draw a line and places an annotation feature and the 'Draw line' tool that creates line feature and then uses the 'Line Anno' tool code to create the annotation feature attached to the line.

When i use the 'Line Anno' tool the add-in places an annotation feature:

Wolf_0-1622065152009.png

then I use the 'Draw Line' tool to draw a line, which is used to create a new line feature, but once the line feature has been created the code of the 'Line Anno' is called with the same geometry:

Wolf_1-1622065275663.png

 

I attached the SampleAnno.ppkx to test the add-in and all source code.

 

sudhansuMishra
New Contributor II

Thank you for replying wolf

0 Kudos