Delete a marker

Sep 21, 2009 at 10:33 PM

ON a winforms application I want to be able to delete individual markers created with the GMapMarker_Custom class as below.

 

Any help is always appreciated

 

Ewan

 

Public Class GMapMarker_Custom

    Inherits GMapMarker

    Dim IconPath As String
    Dim myImage As Image

    Public Sub New(ByVal p As PointLatLng, ByVal Unit_Name As String)


        MyBase.New(p)
        IconPath = Get_GIS_Icon(Unit_Name)

        If System.IO.File.Exists(IconPath) = False Then
            IconPath = AppPath & "\icons\gis\base.png"
        End If

        myImage = Image.FromFile(IconPath)

    End Sub

    Public Overloads Overrides Sub OnRender(ByVal g As Graphics)

        g.DrawImageUnscaled(myImage, LocalPosition.X - 10, LocalPosition.Y - 20)

    End Sub

End Class

Coordinator
Sep 22, 2009 at 3:19 AM
objects = new GMapOverlay(MainMap, "objects");
               MainMap.Overlays.Add(objects);

 

 

GMapOverlay objects = new GMapOverlay(MainMap, "objects");

MainMap.Overlays.Add(objects);

// ...

GMapMarker_Custom m = new GMapMarker_Custom(new PointLatLng(25, 54));

objects.Markers.Add(m);

// ...

objects.Markers.Remove(m);

 

 

 

Sep 22, 2009 at 10:45 AM

Thanks for your help - this work great

 

Ewan

 

Private Sub Delete_Inet_Pushpin(ByVal Unit_Name As String)

        Dim C As Integer

        For C = 0 To objects.Markers.Count - 1
            If objects.Markers(C).Tag = Unit_Name Then
                Dim currentMarker As GMapMarker_Custom = objects.Markers(C)
                objects.Markers.Remove(currentMarker)
            End If
        Next

    End Sub