/// <summary> /// Method converts curb approach into esti Network Analyst Curb Approach type. /// </summary> /// <param name="ca">Curb Approach to convert.</param> /// <returns>esti Network Analyst Curb Approach.</returns> public static NACurbApproachType ToNACurbApproach(CurbApproach ca) { Debug.Assert(ca != null); NACurbApproachType naType = NACurbApproachType.esriNAEitherSideOfVehicle; switch (ca) { case CurbApproach.Left: naType = NACurbApproachType.esriNALeftSideOfVehicle; break; case CurbApproach.Right: naType = NACurbApproachType.esriNARightSideOfVehicle; break; case CurbApproach.Both: naType = NACurbApproachType.esriNAEitherSideOfVehicle; break; case CurbApproach.NoUTurns: naType = NACurbApproachType.esriNANoUTurn; break; default: // Not supported. Debug.Assert(false); break; } return naType; }
/////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Gets supported values by element. /// </summary> /// <param name="element">CurbApproach element.</param> /// <returns>Array of supported values.</returns> static private string _GetSupportedValues(CurbApproach element) { string supportedValues = null; switch (element) { case CurbApproach.Both: supportedValues = Properties.Resources.CurbApproachBothSupportedValues; break; case CurbApproach.Left: supportedValues = Properties.Resources.CurbApproachLeftSupportedValues; break; case CurbApproach.Right: supportedValues = Properties.Resources.CurbApproachRightSupportedValues; break; case CurbApproach.NoUTurns: supportedValues = Properties.Resources.CurbApproachNoUTurnsSupportedValues; break; default: Debug.Assert(false); // NOTE: not supported break; } return(supportedValues); }
/// <summary> /// Method set Left side or Right side Curb Approach /// depending on override setting or Country locale. /// </summary> /// <returns>Left or Right Side Curb Approach.</returns> private CurbApproach _GetLeftOrRightSideCurbApproach() { CurbApproach policy = CurbApproach.Right; if (DriveOnRightSideOfTheRoad == null) { // No need to override settings, // determine curb approach automatically. if (_IsRuleToDriveOnRightSideOfTheRoad()) { policy = CurbApproach.Right; } else { policy = CurbApproach.Left; } } else if (DriveOnRightSideOfTheRoad == true) { policy = CurbApproach.Right; } else if (DriveOnRightSideOfTheRoad == false) { policy = CurbApproach.Left; } else { Debug.Assert(false); } return(policy); }
/// <summary> /// Method gets Curb Approach for orders according to settings. /// </summary> /// <returns>Curb approach.</returns> public CurbApproach GetOrderCurbApproach() { CurbApproach policy = new CurbApproach(); if (UTurnAtStops && StopOnOrderSide) { policy = CurbApproach.Both; } else if (!UTurnAtStops && !StopOnOrderSide) { policy = CurbApproach.NoUTurns; } else if (!UTurnAtStops && StopOnOrderSide) { // Set Left side or Right side Curb Approach // depending on override setting or Country locale. policy = _GetLeftOrRightSideCurbApproach(); } else { // Not supported. Set default one. policy = CurbApproach.Both; } return(policy); }
/// <summary> /// Method converts curb approach into esti Network Analyst Curb Approach type. /// </summary> /// <param name="ca">Curb Approach to convert.</param> /// <returns>esti Network Analyst Curb Approach.</returns> public static NACurbApproachType ToNACurbApproach(CurbApproach ca) { Debug.Assert(ca != null); NACurbApproachType naType = NACurbApproachType.esriNAEitherSideOfVehicle; switch (ca) { case CurbApproach.Left: naType = NACurbApproachType.esriNALeftSideOfVehicle; break; case CurbApproach.Right: naType = NACurbApproachType.esriNARightSideOfVehicle; break; case CurbApproach.Both: naType = NACurbApproachType.esriNAEitherSideOfVehicle; break; case CurbApproach.NoUTurns: naType = NACurbApproachType.esriNANoUTurn; break; default: // Not supported. Debug.Assert(false); break; } return(naType); }
/// <summary> /// Method gets Curb Approach for depots according to settings. /// Depots doesn't support NoUTurns option as Orders. /// </summary> /// <returns>Curb approach.</returns> public CurbApproach GetDepotCurbApproach() { CurbApproach policy = new CurbApproach(); if (UTurnAtStops && StopOnOrderSide) { policy = CurbApproach.Both; } else if (UTurnAtStops && !StopOnOrderSide) { policy = CurbApproach.Both; } else { // Set Left side or Right side Curb Approach // depending on override setting or Country locale. policy = _GetLeftOrRightSideCurbApproach(); } return(policy); }
/////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Gets supported values by element. /// </summary> /// <param name="element">CurbApproach element.</param> /// <returns>Array of supported values.</returns> private static string _GetSupportedValues(CurbApproach element) { string supportedValues = null; switch (element) { case CurbApproach.Both: supportedValues = Properties.Resources.CurbApproachBothSupportedValues; break; case CurbApproach.Left: supportedValues = Properties.Resources.CurbApproachLeftSupportedValues; break; case CurbApproach.Right: supportedValues = Properties.Resources.CurbApproachRightSupportedValues; break; case CurbApproach.NoUTurns: supportedValues = Properties.Resources.CurbApproachNoUTurnsSupportedValues; break; default: Debug.Assert(false); // NOTE: not supported break; } return supportedValues; }
/// <summary> /// Method gets Curb Approach for orders according to settings. /// </summary> /// <returns>Curb approach.</returns> public CurbApproach GetOrderCurbApproach() { CurbApproach policy = new CurbApproach(); if (UTurnAtStops && StopOnOrderSide) { policy = CurbApproach.Both; } else if (!UTurnAtStops && !StopOnOrderSide) { policy = CurbApproach.NoUTurns; } else if (!UTurnAtStops && StopOnOrderSide) { // Set Left side or Right side Curb Approach // depending on override setting or Country locale. policy = _GetLeftOrRightSideCurbApproach(); } else { // Not supported. Set default one. policy = CurbApproach.Both; } return policy; }
/// <summary> /// Method gets Curb Approach for depots according to settings. /// Depots doesn't support NoUTurns option as Orders. /// </summary> /// <returns>Curb approach.</returns> public CurbApproach GetDepotCurbApproach() { CurbApproach policy = new CurbApproach(); if (UTurnAtStops && StopOnOrderSide) { policy = CurbApproach.Both; } else if (UTurnAtStops && !StopOnOrderSide) { policy = CurbApproach.Both; } else { // Set Left side or Right side Curb Approach // depending on override setting or Country locale. policy = _GetLeftOrRightSideCurbApproach(); } return policy; }