draw a line inside the map

Topics: Windows Forms
Nov 25, 2012 at 5:31 PM

Hey everybody

i'm trying to draw a line inside the map , but i don't know how to do it , i already tryied to read the demos but i couldn't understand

i managed to draw a line on the form , but not in the map

Private Sub mymap_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles mymap.MouseClick
        If m1x = 0 Then
            m1x = e.X
            m1y = e.Y
        Else
            m2x = e.X
            m2y = e.Y
            Dim p As New Pen(Brushes.AliceBlue, 7)
            Dim g As Graphics = Me.CreateGraphics()
            g.DrawLine(p, m1x, m1y, m2x, m2y)
            m1x = 0
            m1y = 0
            m2x = 0
            m2y = 0
        End If
can anyone please help me

Nov 25, 2012 at 5:41 PM

add the route with two points, man...

Nov 27, 2012 at 1:07 PM
Edited Nov 27, 2012 at 1:08 PM

i've tried this but it didn't work

 

Dim rp As RoutingProvider = CType(MainMap.MapProvider,RoutingProvider)
        Dim start As PointLatLng = New PointLatLng(35.736056, -5.895035)
        Dim endd As PointLatLng = New PointLatLng(35.736056, -4.895035)
        Dim route As MapRoute = rp.GetRouteBetweenPoints(start, endd, False, False, CType(ais.Zoom, Integer))
        Dim r As GMapRoute = New GMapRoute(route.Points, route.Name)
        routes.Routes.Add(r)

it gives me this

Unable to cast an object of type 'GMap.NET.MapProviders.YahooSatelliteMapProvider' in type 'GMap.NET.RoutingProvider'.

Nov 27, 2012 at 1:21 PM

using your demo software i've just got that i'm looking in the wrong direction , i don't want to draw a routing line , i want just a line between points in the sea ,

i want something like this

http://img4.hostingpics.net/pics/677245see.jpg

Nov 27, 2012 at 1:22 PM

add the route with two points, man...

Nov 27, 2012 at 1:47 PM
radioman wrote:

add the route with two points, man...

even in your demo , when points are in the sea , there is no routing line in the map

Nov 27, 2012 at 1:50 PM
Edited Nov 27, 2012 at 1:51 PM

what a surprise ;} why do you even use the routing provider, do you you really think that google/etc has sea routes?

since when highways are build in the sea...

Nov 27, 2012 at 11:38 PM
radioman wrote:

what a surprise ;} why do you even use the routing provider, do you you really think that google/etc has sea routes?

since when highways are build in the sea...

:p sorry i didn't think about that , then any ideas how can i draw a line in the sea ?

Nov 28, 2012 at 12:58 PM
Edited Nov 28, 2012 at 1:01 PM

As this can last a lot longer:

A route in GMaps ist simply a list of points and the simplest route is a list of two points.

  • Create new Overlay in Constructor
  • Create a new route
  • Create two points
  • Add points to route
  • Add route to Overlay
  • Finish

hth

 

Michael

Nov 28, 2012 at 4:52 PM
MBDTeam wrote:

As this can last a lot longer:

A route in GMaps ist simply a list of points and the simplest route is a list of two points.

  • Create new Overlay in Constructor
  • Create a new route
  • Create two points
  • Add points to route
  • Add route to Overlay
  • Finish

hth

 

Michael

thnx , now i can draw a line between points , but how can i change the color and the wight of the line

Nov 28, 2012 at 5:05 PM

check route properties

Nov 28, 2012 at 5:29 PM

Is here everybody working without intellisense? ;-)

Nov 28, 2012 at 6:24 PM
radioman wrote:

check route properties

i couldn't find it , can you please help me

Nov 28, 2012 at 6:24 PM
MBDTeam wrote:

Is here everybody working without intellisense? ;-)

sorry but i'm not an expert

Nov 28, 2012 at 6:40 PM

you don't need to be an expert to write route. and chose whatever you want ;}

Nov 30, 2012 at 12:45 PM
radioman wrote:

you don't need to be an expert to write route. and chose whatever you want ;}

i'm so sorry guys , i found it :) 

thank you so much for your support