GMarker with 2 PointLatLng

Topics: Windows Forms
Oct 31, 2012 at 10:27 AM

Hello radioman,

is it possible to give 2 Geopoints to a marker?

 I want to draw 2 Icons on the map, but they should work as one Marker. First Position is no problem, but the second position is far away...


do you have some idea?


Imports GMap.NET
Imports GMap.NET.WindowsForms
Imports GMap.NET.WindowsForms.Markers
Public Class Test_Marker
    Inherits GMapMarker

    Public Property Point2 As PointLatLng

    Public Sub New(ByVal p1 As PointLatLng, ByVal p2 As PointLatLng)
        Point2 = p2

        Size = New System.Drawing.Size(My.Resources.Network_icon_32.Width, My.Resources.Network_icon_32.Height)
        Offset = New Point(-My.Resources.Network_icon_32.Width / 2, -My.Resources.Network_icon_32.Height / 2)

    End Sub

    Public Overrides Sub OnRender(ByVal g As Graphics)

        g.DrawImageUnscaled(My.Resources.Network_icon_32, LocalPosition.X, LocalPosition.Y)
        Dim LocalPosition2 As New Point()
        LocalPosition2.X = Form_Main.MainMap.MapProvider.Projection.FromLatLngToPixel(Point2, Form_Main.MainMap.Zoom).X
        LocalPosition2.Y = Form_Main.MainMap.MapProvider.Projection.FromLatLngToPixel(Point2, Form_Main.MainMap.Zoom).Y

        g.DrawImageUnscaled(My.Resources.Network_icon_32, px.X, px.Y)

    End Sub

End Class


bye EDE

Oct 31, 2012 at 1:05 PM
Edited Oct 31, 2012 at 1:06 PM

FromLatLngToPixel gives pixel position, but not really local position for rendering, ...anyway why do you need to render two markers in the same place, why not just add two markers?

Nov 5, 2012 at 8:58 AM

ohh sorry for 2nd help-post, i thought there went sth wrong with adding this topic.

My wish is to draw a line between this 2 points, if i use route, the form gets very slow. I need up to 10.000 routes. Until v1.5 i used this code and worked very well. with the new one, it is not possible any more.

Nov 5, 2012 at 12:10 PM

why so many routes?

Nov 5, 2012 at 1:01 PM

this are measurement points and i need lines to the center of the measurement...if i make only one route (center-p1-center-p2-center-p3...) is slower than many single lines...

Nov 5, 2012 at 1:15 PM