Click or drag to resize

LinkCostaddCost Method (Int32)

Verizon Connect Logo
Print this page
Learn more about Verizon Connect GeoBase.
Get information about the latest release
Increase the cost of this link by the specified amount.

Namespace:  Telogis.GeoBase.Routing
Assembly:  geobase.net (in geobase.net.dll) Version: 4.99.0.0
Syntax
public void addCost(
	int cost
)

Parameters

cost
Type: SystemInt32
The amount to increase or reduce the link cost by.
Remarks
Using this method you can also decrease the cost of traveling the link, for example:
// 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.

See Also