Select to view content in your preferred language

Set tolerance option for polygon streaming tool.

484
5
11-01-2023 07:42 AM
DaveWilcox
New Contributor III

I would like to set the tolerance option for the polygon streaming tool. Has anyone done that and can point me in the right direction? I'm looking at CIMEditingTemplateToolOptions, but struggling to use it.

Thanks!

- Dave WIlcox

 

0 Kudos
5 Replies
UmaHarano
Esri Regular Contributor

Hi Dave,

Is this the info you are looking for? 

//Set snapping options via get/set options
var snapOptions = Snapping.GetOptions(myMap);
snapOptions.IsSnapToSketchEnabled = true;
snapOptions.XYTolerance = 100;
snapOptions.IsZToleranceEnabled = true;
snapOptions.ZTolerance = 0.6;
Snapping.SetOptions(myMap,snapOptions);

https://github.com/Esri/arcgis-pro-sdk/wiki/ProConcepts-Editing#snapping

0 Kudos
DaveWilcox
New Contributor III

That's close, but this is a different setting related to the stream tool.

- Dave

0 Kudos
CharlesMacleod
Esri Regular Contributor

>> I'm looking at CIMEditingTemplateToolOptions, but struggling to use it.

hi Dave, so this is a v specialized "setting" in the template. Essentially, if u are authoring a construction tool and want to associate it with a custom UI for "configurable options" on the create features pane u implement something called a ToolOptionsEmbeddableControl. Any custom option settings u wld like to persist in the template go in the CIMEditingTemplateToolOptions (which is a dictionary fyi but is null by default).

we hv covered this in various Dev Summit sessions. Most recently this year:

https://esri.github.io/arcgis-pro-sdk/techsessions/2023/PalmSprings/Intermediate-Editing-2.zip

(u can find a complete listing of our sessions here: https://github.com/Esri/arcgis-pro-sdk/wiki/Tech-Sessions )

this shld help u get up to speed.

Look at the section "Construction Tool - Tool Options UI" in the ppt for how to implement  a ToolOptionsEmbeddableControl. This base class (u inherit from) provides a GetToolOption and SetToolOption that does the magic for u. LoadFromToolOptions, another override, gives your custom UI an opportunity to retrieve the custom options (if any) before your UI is initialized.

Editing_2_ConstructionTool.zip which is included in the download has the example code as described in the slides.

 

 

0 Kudos
DaveWilcox
New Contributor III
Thanks. I’ll check this out.
0 Kudos
UmaHarano
Esri Regular Contributor

Attached is an addin that creates a Polygon construction tool. This tool implements "ToolOptions". In the Options UI, I added a text box for Tolerance.

Then on the Tool activate callback, I used the tolerance provided in the options UI and to set the map's snapping environment's XY Tolerance like this:

        var snapOptions = Snapping.GetOptions(ActiveMapView.Map);
        snapOptions.XYTolerance = ToleranceToolOption;
        Snapping.SetOptions(ActiveMapView.Map, snapOptions);

 

UmaHarano_0-1698950854346.png