About GPS ToolKit.NET Mobile
Introduction
Purchasing GPS ToolKit.NET
Redistributing GPS ToolKit.NET
License Agreement
Support
Getting Started
Getting Started
Setting up the GPS
Basic Concepts
GPS ToolKit Sample Projects
About GPS ToolKit Errors
Reference
GPSToolKit Class
Properties
BaudRate
ExtendedFixData
IsGPSConnected
IsPortOpen
LastPositionUpdateTime
NavigationData
PortName
Protocol
Position
Satellites
Speed
TrueCourse
Methods
AddRoute
AddTrack
AddWaypoint
AutoDetectGPS
Close
GetAvailableSystemPorts
GetGPSInfo
GetRoutes
GetSystemPorts
GetTracks
GetWaypoints
Open
ShutOffGPS
WriteRawBinaryToGPS
WriteRawToGPS
Events
GPSConnected
GPSDisconnected
NavigationUpdate
PositionUpdate
RawDataReceived
SatelliteUpdate
Supporting Classes
Altitude
Angle
Distance
ExtendedFixData
Properties
DGPSRefStationID
EstimatedHorizontalError
EstimatedPositionError
EstimatedVerticalError
FixMode
GeoidHeightAboveWGS84
HDOP
MagneticVariation
NumSatellitesInView
PDOP
TimeSinceLastDGPSUpdate
VDOP
GPSInfo
Latitude
Methods
ToDecimalDegreesString
ToDegreesMinutesString
ToDegreesMinutesSecondsString
Longitude
Methods
ToDecimalDegreesString
ToDegreesMinutesString
ToDegreesMinutesSecondsString
NavData
Properties
ActiveRoute
ArrivedAtDest
CrossTrackError
DestWptName
DestWptPosition
IsValid
MagBearingFromOriginToDest
OriginWptName
TrueBearingFromOriginToDest
TrueBearingToDestWpt
VelocityTowardDestWpt
Position
Methods
BearingFrom
BearingTo
DistanceTo
Route
Properties
Name
Waypoints
Satellite
Speed
Track
Properties
Color
DisplayTrack
Name
TrackPoints
TrackPoint
Waypoint
Collections
RouteCollection
SatelliteCollection
TrackCollection
TrackPointCollection
WaypointCollection

AddTrack Method

Adds a track to the GPS

Syntax

[Visual Basic]
object.AddTrack(Track)

[C#]
object.AddTrack(Track)

[C++]
object->AddTrack(Track)

Parameters

object

An object expression that evaluates to a GPSToolKit object.

Track

A Track object.

Return Value

None

Remarks

  • This method adds a track to the GPS. Many GPS units will add the track as new even if it has the same name as an existing track.
  • Some GPS units may not support track names and therefore may ignore the supplied track name.
  • This method is only supported when using the Garmin protocol.
  • It is not possible to delete a track programmatically; deleting a track can only be done from the GPS unit.
  • If GPS memory is full, the track 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 track
Dim NewTrack As New Track
NewTrack.Name = "My New Track"

' Create trackpoints for the route
Dim trkpt1, trkpt2 As Waypoint
trkpt1 = New TrackPoint(42.12, -75.41, false)
trkpt2 = New TrackPoint(42.11, -75.4, false)

' Add the waypoints to the new track
NewTrack.TrackPoints.Add(trkpt1)
NewTrack.TrackPoints.Add(trkpt2)

' Add the track to the GPS
myGPSToolKit.AddTrack(NewTrack)

[C#]
// Create new track
Track NewTrack = new Track();
NewTrack.Name = "My New Track";

// Create trackpoints for the route
TrackPoint trkpt1, trkpt2;
trkpt1 = new TrackPoint(42.12, -75.41, false);
trkpt2 = new TrackPoint(42.11, -75.4, false);

// Add the waypoints to the new route
NewTrack.TrackPoints.Add(trkpt1);
NewTrack.TrackPoints.Add(trkpt2);

// Add the track to the GPS
myGPSToolKit.AddTrack(NewTrack);


[C++]
// Create new track
Track *NewTrack = new Track();
NewTrack->Name = "My New Track";

// Create trackpoints for the route
TrackPoint *trkpt1, *trkpt2;
trkpt1 = new TrackPoint(42.12, -75.41, false);
trkpt2 = new TrackPoint(42.11, -75.4, false);

// Add the waypoints to the new route
NewTrack->TrackPoints->Add(trkpt1);
NewTrack->TrackPoints->Add(trkpt2);

// Add the track to the GPS
myGPSToolKit->AddTrack(NewTrack);

See Also

GPSToolKit.GetTracks method | GPSToolKit.AddWaypoint method | GPSToolKit.AddRoute method | Track class