Skip to main content

PCMSMatrixCalculate

Syntax

int PCMSMatrixCalculate(TripMatrixCallBackProc *cb)

Parameters

TripMatrixCallBackProc *cb – An optional callback function pointer when calculating a trip matrix. During calculation, PC*Miler Connect will send periodic update messages back to this callback indicating its progress in calculating the entire matrix.

Description

Initiates the calculation of the trip matrix with all of its current stop information.

Return Values

An integer return code. Negative one (-1) indicates that the product is not licensed for RouteMatrix.

Sample Code

// Set up the Matrix Routing options
PCMSSetCalcType(matTrip, CALC_PRACTICAL);
PCMSMatrixSetOptions(matTrip);

// Set the number of threads to be used internally
PCMSMatrixSetThreadCount(2);

// Add the stops onto the matrix
for (int i = 0; i < NUM_STOPS; i++)
{
  PCMSMatrixAddStop(latLongs[i]);
}

// Error check to see if the stops are loaded to the matrix correctly
long lStopCount = PCMSMatrixGetStopCount();
if (lStopCount <= 0)
{
  printf("ERROR: Could not load stops!\n");
}
else
{
  // Calculate the routes
  PCMSMatrixCalculate(NULL);
}

Supported Since: PC*Miler Connect 26

Category: Matrix Functions

Last updated July 8, 2025.