LinkCostaddCost Method (Int32) |
Namespace: Telogis.GeoBase.Routing
// suppose lc is some LinkCost given to us... Console.WriteLine(lc.Cost); // outputs 60 -- so our link has a cost of 60 if ( /* we decide to reduce cost by 100, arbitrarily */ ) { lc.addCost(-100); Console.WriteLine("Decreased by 100, new cost:" + lc.Cost); // ^^ outputs 1 -- GeoBase has forced the cost to remain >= 1 } else { /* we decide to increase cost */ lc.addCost(300); Console.WriteLine("Increased by 300, new cost:" + lc.Cost); // ^^ outputs 360 }
Because negative link costs are nonsensical GeoBase will never let the cost for a link drop below 1.
If you'd like to strongly discourage GeoBase from routing along a particular link use the UndesirableLink property. Use of this property is preferable to setting a high link cost using the addCost(int cost) method.
If you'd like to prevent GeoBase from routing along a particular link use the ProhibitedLink property.