Add Stops to Create a Route
Contents
PC*Miler Connect can calculate routes with as many stops as your system resources allow. When you add stops to a trip, PC*Miler Connect tries to geocode stop names to matching locations in the PC*Miler highway database.
The following functions are used to manage a trip’s list of stops:
- PCMSAddStop adds a stop to the trip’s stop list. It geocodes the given location by returning the default match in the PC*Miler database at a confidence level of 1 or 2.
- PCMSDeleteStop deletes a specified stop from this trip.
- PCMSGetStop will put a stop name into the supplied buffer.
- PCMSNumStops returns the total number of stops currently in the trip’s stop list, including origin and destination.
- PCMSClearStops removes all stops from the stop list.
The following sample code shows how to add stops and how to check a partial match after adding a stop:
void AddStop(Trip trip)
{
int matches;
int bytes;
char buffer[40];
/* Clear out all the stops */
PCMSClearStops();
/* Add one stop and error check it carefully */
matches = PCMSAddStop(trip, "Princeton, NJ");
if (1 < matches)
printf("Found %d matching cities!\n", matches);
else if (1 == matches)
printf("Found only one\n");
else if (0 == matches)
printf("Couldn't find anything\n");
else
printf("Oops! Caused an error\n");
/* Add some more stops simply */
PCMSAddStop(trip, "Chicago, IL");
PCMSAddStop(trip, "San Diego, CA");
/* Show the trip’s stops as geocoded */
for (i = 0; i < PCMSNumStops(trip); i++)
{
bytes = PCMSGetRptLine(trip, RPT_MILEAGE, i, buffer, 40);
if (0 < bytes)
printf("%s\n", buffer);
else
printf("Stop %d is invalid\n", i);
}
}
Waypoints
In PC*Miler Connect, waypoints are used to customize a route to travel on specific, user-designated roads. A route will travel through a waypoint, but the waypoint is not treated as a stop. Waypoints are listed as “Via” in the Detailed Route and State/Country reports, but they do not appear in driving directions in the Driver’s Report.
The function PCMSSetStopAsWaypoint can be used to add waypoints to a route.