Limits
Previous  Top  Next

These functions makes it possible to calculate routes, while taking certain limitations for the links into account. 2 types are available:

1.A scalar quantity such as a maximum weight, height, width etc. If the limit for a certain link in the network is 100 and you calculate a route for a vehicle with a value >100, that link will be avoided in the route. It is mandatory to scale your limits into the 1-255 interval.  
 
2.A bit pattern for defining special links such as ferries, toll roads etc. which you may want to avoid in your routing. If the limit for a link is 3 = 00000011 it may mean it is both a ferry and a toll "road" (most ferries are not free, so that seems logical). If your value has either bit 1 or 2 set, that link will be avoided in the route. It is possible to define 8 such bits within each limit.  

For both types, a link value of 0 means no limitations at all.

Use SetLimit to define a value for the route about to be calculated.

Example with maximum height expressed as decimeters:

rwcalc1.SetLimit(1,0)   // no limit (default)
cost1 = rwcalc1.Route(node1,node2)

rwcalc1.SetLimit(1,40)  // 40 dm = 4.0 meter
cost2 = rwcalc1.Route(node1,node2)

rwcalc1.SetLimit(1,42)  // 42 dm = 4.2 meter
cost3 = rwcalc1.Route(node1,node2)

With the proper sample data, this will result in 3 different routes. The first route is the shortest, the second is longer and the last one is the longest (most restrictive limitation).