PC*MILER Rail-Connect has two basic components: trips and mapping.
The trip portion of the server is the engine that handles trip management, mileage calculation, and report generation. A server trip is used by opening a connection to the server and requesting a new trip. You must close the server before your application exits or Windows won’t free the resources used by the DLL, nor will it unlock the current license. But do not repeatedly open and close the server. Open the server on startup and close the server on exit. Remember, you won't be able to rerun your application if you don’t close down the server when your application exits.
Trips are collections of stops, options and reports. A trip is created by asking the server for a new trip ID, then the trip is set up with a list of stops and new options. You can then calculate the trip’s route and mileage, and extract any of the trip’s PC*MILER Rail reports.
Mapping is handled similarly; a connection to the server is initialized and a map window is requested. Users can subsequently calculate trips and tell the server to draw calculated trips in the map window. The map window can also draw icons (“pins”) and lines at given points (as identified by a station and state). Mapping is discussed in more detail later in this manual.
Simple Distance Calculation
The DLL also includes a set of simplified functions for calculating distances between an origin and a destination without any stops. These functions make it easy to calculate miles without managing trips from your application. An example of this, the simplest use of the PCRSRV32.DLL, is:
- Start the server.
- Calculate the miles from point A to point B.
- Repeat with as many origin-destination pairs as you want.
- Shut down the server.
Managing Multiple Trips
The DLL can also be used to manage multiple trips and different options for each trip. The following scenario illustrates how a user might obtain Practical and Shortest miles for a trip with four stops:
- Open a connection to the server.
- Create a new trip.
- Modify the trip’s options to use the SHORTEST routing calculation.
- Add four stops to the trip’s route.
- Calculate the trip’s route and mileage.
- Extract the report and display it in your own application.
- Modify the trip’s options again to use PRACTICAL miles.
- Recalculate the trip’s route with the new options.
- Delete the trip.
- Close the server down when your application exits. Do not repeatedly open and close the connection within your application.