Other Software and Data

 View Only

Need help trying to manually end the MapXtreme ADDPOLYGON tool without double-clicking the mouse

  • 1.  Need help trying to manually end the MapXtreme ADDPOLYGON tool without double-clicking the mouse

    Posted 08-29-2023 12:38

    All,

    I have a very simple VB.net MapXtreme application.  
    I have one tool, ADD POLYGON, and I want to force the tool to stop drawing after the sixth point.
    Therefore, the steps would be:
    Step 1: Click on Add Polygon tool (from the toolbar)
    Step 2: Single-click with the left mouse button six times
    Step 3: On the sixth point, I want the tool to stop accepting clicks, do some work, and finish
    The issue I am having is on the sixth point, my code never calls the "ToolAddedFeature()" function which seems to be what MapXtreme natively calls when a double-click occurs on a 3-point polygon, 4-point polygon, or 5-point polygon.
    Therefore, because I am NOT able to run the "ToolAddedFeature()", I am left with this grey line (the line the user sees as they are drawing points 1 thru 6)  I tried to show an example of the image attached.
    Can anyone help me out?  The goal again is to figure out how to stop the ADD POLYGON tool at the sixth point, and also make sure we clear out the native grey line too.  Here is my sample code below:
    ======================================
      Private Sub ToolUsed(ByRef map As map, ByVal e As MapInfo.Tools.ToolUsedEventArgs)
    Try
           tool.Name = e.ToolName.ToUpper.Trim
           tool.Status = e.ToolStatus
           If tool.Status = MapInfo.Tools.ToolStatus.Start Then
               '--nothing here when you first start using polygon tool
          ElseIf tool.Status = MapInfo.Tools.ToolStatus.InProgress Then
              '--here we would store each single point click
           ElseIf tool.Status = MapInfo.Tools.ToolStatus.End Then
           ElseIf tool.Status = MapInfo.Tools.ToolStatus.Cancel Then
                  '--anyway here to call ToolAddedFeature manually?
           Else
           End If
     Private Sub ToolAddedFeature(ByVal sender As Object, ByVal e As MapInfo.Tools.FeatureAddedEventArgs)
            LogMessage("ToolAddedFeature Called for ADD POLYGON tool")
        End Sub
    The grey line is located on the left and is there by default by MapXtreme while using the ADD POLYGON tool.  
    Screen shot of grey line that exists while drawing with the ADD POLYGON tool


    ------------------------------
    Nicholas Evanish
    ------------------------------