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); } }