Syntax
int PCMSSetRoadSpeed(Trip trip, long speed, const char *state, long type, bool urban)
Parameters
Trip trip – Handle to a trip.
long speed – A speed value above 0 for the selected road type.
const char *state – The state/province/country abbreviation of the desired jurisdiction. Examples in North America are “NY” for New York or “QC” for Quebec. If PC*MILER|Worldwide or DTOD data is installed, country abbreviations for areas outside of North America can be used.
long type – A new set of defined constants that begin with ROADTYPE. Below are the valid road types, identical to the road types in the PC*MILER user interface:
#define |
ROADTYPE_INTERSTATE |
1 |
#define |
ROADTYPE_MAJORHIGHWAY |
2 |
#define |
ROADTYPE_PRIMARY |
3 |
#define |
ROADTYPE_FERRY |
4 |
#define |
ROADTYPE_SECONDARY |
5 |
#define |
ROADTYPE_RAMP |
6 |
#define |
ROADTYPE_LOCAL |
7 |
bool urban – Indicates if the roads are urban or not.
Description
Sets the road speed for the given jurisdiction and road type.
Return Values
Returns non-negative on success.
Returns a -1 and an INVALID ARGUMENT error code if any supplied parameters are out of range, or if an invalid state is passed in.
Sample Code
int _CALLCONV PCMSGetRoadSpeed(Trip trip, const char *state, long type, bool urban) { LOG_PROLOG4(PCMSSetRoadSpeed, trip, state, type, urban); if (type < ROADTYPE_INTERSTATE || type > ROADTYPE_LOCAL) { SetError(PCMS_INVALIDINPUT); LOG_RETURN1(-1); } GET_RT_ENGINE(); GET_ROUTE(trip); GET_OPTIONS(); int roadSpeed = pRt->GetRoadSpeed(state, type, urban); if (roadSpeed < 0) { SetError(PCMS_INVALIDINPUT); LOG_RETURN1(-1); } LOG_RETURN1(roadSpeed); }
Support Since: PC*MILER|Connect 29
Category: Trip Management