Share via


IsOptimized property

Returns whether the waypoints of a route have been optimized into the best order. True if the waypoints have been optimized. Read-only Boolean.

Applies to

Collections:  Waypoints

Syntax

object.IsOptimized

Parameters

Part Description
object Required. An expression that returns a Waypoints collection.

Remarks

To optimize stops on a route, use the Optimize method on the Waypoints collection.

Example

    Sub OptimizeIfNotOptimizedAlready()

  Dim objApp As New MapPoint.Application   Dim objMap As MapPoint.Map   Dim objRoute As MapPoint.Route
  'Set up the application   Set objMap = objApp.ActiveMap   Set objRoute = objMap.ActiveRoute   objApp.Visible = True   objApp.UserControl = True
  'Add route stops and calculate route   With objRoute.Waypoints     .Add objMap.FindResults("Seattle, WA").Item(1)     .Add objMap.FindResults("Redmond, WA").Item(1)     .Add objMap.FindResults("Tacoma, WA").Item(1)     .Add objMap.FindResults("Bellevue, WA").Item(1)   End With   objRoute.Calculate
  'Optimize the stops   If Not (objRoute.Waypoints.IsOptimized) Then objRoute.Waypoints.Optimize
  End Sub

Note  This sample code is specific for use in MapPoint North America; it is for illustration purposes only.