Turn On Tracing for MapTool

114
2
Jump to solution
05-07-2018 11:37 AM
Highlighted
by
Occasional Contributor II

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)
Reply
0 Kudos
1 Solution

Accepted Solutions
Highlighted
Esri Regular Contributor

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

Reply
0 Kudos
2 Replies
Highlighted
by
Occasional Contributor II

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);
        }
Reply
0 Kudos
Highlighted
Esri Regular Contributor

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

Reply
0 Kudos