Telogis.GeoBase.Routing.RoutingProfile |
A class used to determine the speed profile (the permitted speed of travel), based on either speed category or a custom speed profile generated using an array of 48 speed values (one for each functional class and speed combination). This array is constructed using six consecutive blocks of eight elements. Each block represents a functional class (1-6), the first block represents functional class 1, the second block functional class 2, etc. The first element in the each block corresponds to speed category 1, the second element speed category 2, etc. These profiles are used when routing, and applied as a Routing.RoutingStrategy.
var speed = Telogis.GeoBase.SpeedUnit.MilesPerHour; var strategy = new Telogis.GeoBase.Routing.RoutingStrategyFastest(); var profile = new Telogis.GeoBase.Routing.RoutingProfile(); // For every speed category (1-8) for (speedCat = 1; speedCat <9; ++speedCat) { // And every functional class (1-6) for (var funcClass = 1; funcClass < 7; ++funcClass) { // Set the profile speed to 10mph profile.setSpeed(speedCat, funcClass, 10, speed); } } // Apply the routing profile to the strategy in the UK strategy.setProfile("UK", profile);
Name | Description |
---|---|
getIndex (Number speedCat, Number funcClass) | Gets the index of the Routing.RoutingProfile. Arguments
Number - The index of the Routing.RoutingProfile. |
getSpeed (Number speedCat, Number funcClass, String unit) | Gets the travel speed, permitted for a given speed category and functional class. JavaScript var speed = Telogis.GeoBase.SpeedUnit.MilesPerHour; var myProfile = new Telogis.GeoBase.Routing.RoutingProfile(); // Set speed category 1 and functional class 1 speed limit to 50 mph myProfile.setSpeed(1, 1, 50, speed); // Get the speed profile. var speedVal = myProfile.getSpeed(1, 1, speed); alert ("Profile speed for speedCat 1 and FuncClass 1 is: " + speedVal + " mph");
Number - The speed in the SpeedUnit specified. |
setSpeed (Number speedCat, Number funcClass, Number speed, String unit) | Sets the travel speed permitted for a given speed category and functional class. JavaScript var speed = Telogis.GeoBase.SpeedUnit.MilesPerHour; var strategy = new Telogis.GeoBase.Routing.RoutingStrategyFastest(); var myProfile = new Telogis.GeoBase.Routing.RoutingProfile(); // Set speed category 1 and functional class speed limit to 40 mph myProfile.setSpeed(1, 1, 40, speed); // Apply the routing profile to the routing strategy in the UK strategy.setProfile("UK", myProfile);
|