Turn On Tracing for MapTool

554
2
Jump to solution
05-07-2018 11:37 AM
MKa
by
Occasional Contributor III

I would like my drawing tool to default to Snapping to Vertices and to Enable Tracing mode on Activate.  I have easily figure out how to enable Snapping, but i am not able to enable Tracing mode.  In arcobjects I was able to do this with the TraceConstructor/ShapeConstructor.  How can i do this in the new version so that the tool defaults to the trace mode.  Here is what I want to do so far.  I create a polylie that snaps, but i also want it to trace using the standard trace option.

        protected async override Task OnToolActivateAsync(bool hasMapViewChanged)
        {
            if (_lineSymbol == null)
            {
                _lineSymbol = await CreateLineSymbolAsync();
            }

            SketchSymbol = _lineSymbol.MakeSymbolReference();
            
            //General Snapping
            Snapping.IsEnabled = true;
            Snapping.SetSnapMode(SnapMode.Edge, true);
            Snapping.SetSnapMode(SnapMode.End, true);
            Snapping.SetSnapMode(SnapMode.Intersection, true);

            //TURN ON TRACING TOOL
            //TURN ON TRACING TOOL
        }
Tags (1)
0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable

Yes, executing the constructor command is the best way to do this.

    protected override Task OnToolActivateAsync(bool hasMapViewChanged)
    {
      var command = FrameworkApplication.GetPlugInWrapper("esri_editing_TraceConstructor") as ICommand;
      if ((command != null) && command.CanExecute(null))
        command.Execute(null);

      return base.OnToolActivateAsync(hasMapViewChanged);
    }

View solution in original post

0 Kudos
2 Replies
MKa
by
Occasional Contributor III

I think I just simply turn on the Tracing like below, it appears to be much more simple in Pro.  If this is the best way to handle this, or if a better way exists to use ICommand, then please let me know.

protected async override Task OnToolActivateAsync(bool hasMapViewChanged)
        {
            if (_lineSymbol == null)
            {
                _lineSymbol = await CreateLineSymbolAsync();
            }

            SketchSymbol = _lineSymbol.MakeSymbolReference();
            
            //General Snapping
            Snapping.IsEnabled = true;
            Snapping.SetSnapMode(SnapMode.Edge, true);
            Snapping.SetSnapMode(SnapMode.End, true);
            Snapping.SetSnapMode(SnapMode.Intersection, true);

            //Set the command to Rotate
            ICommand _trace = FrameworkApplication.GetPlugInWrapper("esri_editing_TraceConstructor") as ICommand;
            _trace.Execute(null);
        }
0 Kudos
by Anonymous User
Not applicable

Yes, executing the constructor command is the best way to do this.

    protected override Task OnToolActivateAsync(bool hasMapViewChanged)
    {
      var command = FrameworkApplication.GetPlugInWrapper("esri_editing_TraceConstructor") as ICommand;
      if ((command != null) && command.CanExecute(null))
        command.Execute(null);

      return base.OnToolActivateAsync(hasMapViewChanged);
    }
0 Kudos