|
GPS ToolKit.NET
AddRoute Method
Adds a route to the GPS
Syntax
[Visual Basic]
object.AddRoute(Route)
[C#]
object.AddRoute(Route)
[C++]
object->AddRoute(Route)
Parameters
object
An object expression that evaluates to a GPSToolKit object.
Route
A Route object.
Return Value
None
Remarks
- This method adds a route to the GPS. If a route with the same name exists on the GPS, most GPS units will replace the existing route with the new route.
- Some GPS units may not support full route names and therefore may modify the supplied route name.
- This method is only supported when using the Garmin protocol.
- It is not possible to delete a route programmatically; deleting a route can only be done from the GPS unit. Sometimes, however, adding a route with 0 waypoints and the name of an existing route will "partially" delete the route on the GPS (that is, the route still exists but the GPS will not transfer it during a GetRoutes() call)
- If GPS memory is full, the route will not be added and this method will return without error.
Errors
If using the NMEA 0183 protocol, this method will return a NotSupportedException exception.
Example
[Visual Basic]
' Create new route
Dim NewRoute As New Route
NewRoute.Name = "My New Route"
' Create waypoints for the route
Dim wpt1, wpt2 As Waypoint
wpt1 = New Waypoint("wpt1", New Position(42.12, -75.41))
wpt2 = New Waypoint("wpt2", New Position(42.11, -75.4))
' Add the waypoints to the new route
NewRoute.Waypoints.Add(wpt1)
NewRoute.Waypoints.Add(wpt2)
' Add the route to the GPS
myGPSToolKit.AddRoute(NewRoute)
[C#]
// Create new route
Route NewRoute = new Route();
NewRoute.Name = "My New Route";
// Create waypoints for the route
Waypoint wpt1, wpt2;
wpt1 = new Waypoint("wpt1", new Position(42.12, -75.41));
wpt2 = new Waypoint("wpt2", new Position(42.11, -75.4));
// Add the waypoints to the new route
NewRoute.Waypoints.Add(wpt1);
NewRoute.Waypoints.Add(wpt2);
// Add the route to the GPS
myGPSToolKit.AddRoute(NewRoute);
[C++]
// Create new route
Route *NewRoute = new Route();
NewRoute->Name = "My New Route";
// Create waypoints for the route
Waypoint *wpt1, *wpt2;
wpt1 = new Waypoint("wpt1", new Position(42.12, -75.41));
wpt2 = new Waypoint("wpt2", new Position(42.11, -75.4));
// Add the waypoints to the new route
NewRoute->Waypoints->Add(wpt1);
NewRoute->Waypoints->Add(wpt2);
// Add the route to the GPS
myGPSToolKit->AddRoute(NewRoute);
See Also
GPSToolKit.GetRoutes method | GPSToolKit.AddWaypoint method |
GPSToolKit.AddTrack method | Route class
|