Mapwingis 5.0.1 tkCursorMode.cmEditShape


#1

private Sub ToolStripButtonZoomIn_Click(sender As System.Object, e As System.EventArgs) Handles ToolStripButtonZoomIn.Click
AxMap1.CursorMode = MapWinGIS.tkCursorMode.cmEditshape
{can not modify polygon shapefile]


#2

Can you show some code so we can try to reproduce?


#3
Private Sub AddLayer()
    Dim shpfile As MapWinGIS.Shapefile
    Dim openDlg As OpenFileDialog = New OpenFileDialog()
    Dim handle As Integer
    Dim ext As String = ""

    'initialize dialog
    openDlg.Filter = "Supported Formats|*.shp|Shapefile (*.shp)|*.shp"
    openDlg.CheckFileExists = True

    If (openDlg.ShowDialog(Me) = DialogResult.OK) Then

        'get the extension of the file
        ext = System.IO.Path.GetExtension(openDlg.FileName)

        If ext = ".shp" Then
            ' shpfile is polygon
            shpfile = New MapWinGIS.ShapefileClass()

            'open the shapefile
            Dim blmCheck As Boolean = shpfile.Open(openDlg.FileName)

            'add the shapefile to the map
            handle = AxMap1.AddLayer(shpfile, True)

            AxMap1.Redraw()



Private Sub ToolStripButtonZoomIn_Click(sender As System.Object, e As System.EventArgs) Handles ToolStripButtonZoomIn.Click
    AxMap1.CursorMode = MapWinGIS.tkCursorMode.cmEditshape
{can not modify polygon shapefile]

End Sub

#4

Is this still an issue with the latest version of MapWinGIS? The previous version had a bug with selection.


#6

Hello @pmeems

Installing the most recent release (v5.4.1), I do not get the exception on the ‘selection’ click or rectangle drag.


#7

Hello
i still have the problem with edit.shape mapwingis 5.0.1 mapwingis.tkCursorMode.cmEditShape (the shapefile case is polygon type impossible to modify form) and i thank you


#8

Hello @salah

I did a quick review, and modified your code slightly. I think the only real issue may have been setting the Shapefile.InteractiveEditing property = True. I also added a button called ButtonEdit with the code you can see below. With the code below, I was able to

  1. load a Point-based shapefile
  2. click the Edit button
  3. click on one of the point-shapes in the map
  4. drag the point to another position, then, as described in the documentation,
  5. click anywhere else on the map to effectively save the new point position.

Here’s the updated code:

Private _shpfile As Shapefile

Private Sub ButtonAddLayer_Click(sender As Object, e As EventArgs) Handles ButtonAddLayer.Click
    Dim openDlg As OpenFileDialog = New OpenFileDialog()
    Dim handle As Integer
    Dim ext As String = ""

    'initialize dialog
    openDlg.Filter = "Supported Formats|*.shp|Shapefile (*.shp)|*.shp"
    openDlg.CheckFileExists = True

    If (openDlg.ShowDialog(Me) = DialogResult.OK) Then

        'get the extension of the file
        ext = System.IO.Path.GetExtension(openDlg.FileName)

        If ext = ".shp" Then
            ' shpfile is polygon
            _shpfile = New MapWinGIS.ShapefileClass()

            'open the shapefile
            Dim blmCheck As Boolean = _shpfile.Open(openDlg.FileName)

            'add the shapefile to the map
            handle = AxMap1.AddLayer(_shpfile, True)

            AxMap1.Redraw()
        End If
    End If
End Sub

Private Sub ButtonEdit_Click(sender As Object, e As EventArgs) Handles ButtonEdit.Click
    _shpfile.InteractiveEditing = True
    AxMap1.CursorMode = tkCursorMode.cmEditShape
    AxMap1.MapCursor = tkCursor.crsrMapDefault
End Sub

#9

good day jerryfaust

Private Sub ButtonEdit_Click (sender As Object, e As EventArgs) ButtonEdit.Click Handles

 _shpfile.InteractiveEditing = True

 AxMap1.CursorMode = tkCursorMode.cmEditShape

 AxMap1.MapCursor = tkCursor.crsrMapDefault
End Sub

I load a point.shp type point, I manage to edit, edit, move … it’s good
I load a line.shp type polylin, I can add, edit, move … it’s good
I load a polygon .shp type polygon. I can add, move, but I can not edit the form, the cursor crashes.
I hope my question is clear …
I thank you


#10

Do you have this problem with all polygon shapefiles or with just one?
Can you share your polygon shapefile? Or check if it’s valid: Shapefile.HasInvalidShapes()

And you are using MapWinGIS v5.0.1?