Exemple #1
0
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////

        protected override void SetOrderAssignment(AttrDictionary attrs,
                                                   AssignedOrder assignedOrder)
        {
            if (assignedOrder.Route.IsLocked)
            {
                // order is assigned to a locked route
                attrs.Set(NAAttribute.ASSIGNMENT_RULE,
                          (int)NAOrderAssignmentRule.esriNAOrderExcludeFromSolve);
            }
            else if (assignedOrder.Stop.IsLocked)
            {
                // order is locked itself
                attrs.Set(NAAttribute.ROUTE_NAME, assignedOrder.Route.Id.ToString());
                attrs.Set(NAAttribute.SEQUENCE, assignedOrder.SequenceNumber);
                attrs.Set(NAAttribute.ASSIGNMENT_RULE,
                          (int)NAOrderAssignmentRule.esriNAOrderPreserveRouteAndRelativeSequence);
            }
            else
            {
                attrs.Set(NAAttribute.ROUTE_NAME, "");
                attrs.Set(NAAttribute.SEQUENCE, null);
                attrs.Set(NAAttribute.ASSIGNMENT_RULE,
                          (int)NAOrderAssignmentRule.esriNAOrderOverride);
            }
        }
        /// <summary>
        /// Sets time window attributes with specified names in the specified attributes dictionary.
        /// </summary>
        /// <param name="dictionary">The dictionary to set attributes for.</param>
        /// <param name="window">The time window to get attribute values from.</param>
        /// <param name="plannedDate">The date/time when time window should be applied.</param>
        /// <param name="timeWindowStartAttribute">The name of the time window start
        /// attribute.</param>
        /// <param name="timeWindowEndAttribute">The name of the time window end
        /// attribute.</param>
        public static void SetTimeWindow(
            this AttrDictionary dictionary,
            TimeWindow window,
            DateTime plannedDate,
            string timeWindowStartAttribute,
            string timeWindowEndAttribute)
        {
            Debug.Assert(dictionary != null);
            Debug.Assert(window != null);
            Debug.Assert(!string.IsNullOrEmpty(timeWindowStartAttribute));
            Debug.Assert(!string.IsNullOrEmpty(timeWindowEndAttribute));

            if (window.IsWideOpen)
            {
                dictionary.Set(timeWindowStartAttribute, null);
                dictionary.Set(timeWindowEndAttribute, null);

                return;
            }

            // Time window is not wide-open so we apply it to the specified planned date and
            // attribute values in the dictionary.
            var dates = window.ToDateTime(plannedDate);

            var from = dates.Item1.Value;

            dictionary.Add(
                timeWindowStartAttribute,
                GPObjectHelper.DateTimeToGPDateTime(from));

            var to = dates.Item2.Value;

            dictionary.Add(
                timeWindowEndAttribute,
                GPObjectHelper.DateTimeToGPDateTime(to));
        }
Exemple #3
0
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////

        protected override void SetOrderAssignment(AttrDictionary attrs,
                                                   AssignedOrder assignedOrder)
        {
            if (!_unlockedOrdersToAssign.Contains(assignedOrder.Order))
            {
                attrs.Set(NAAttribute.ROUTE_NAME, assignedOrder.Route.Id.ToString());
                attrs.Set(NAAttribute.SEQUENCE, assignedOrder.SequenceNumber);
                attrs.Set(NAAttribute.ASSIGNMENT_RULE,
                          (int)NAOrderAssignmentRule.esriNAOrderPreserveRouteAndRelativeSequence);
            }
            else
            {
                attrs.Set(NAAttribute.ROUTE_NAME, "");
                attrs.Set(NAAttribute.SEQUENCE, null);
                attrs.Set(NAAttribute.ASSIGNMENT_RULE,
                          (int)NAOrderAssignmentRule.esriNAOrderOverride);
            }
        }
Exemple #4
0
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////

        protected override void SetOrderAssignment(AttrDictionary attrs,
                                                   AssignedOrder assignedOrder)
        {
            if (assignedOrder.Route.IsLocked ||
                assignedOrder.Stop.IsLocked)
            {
                attrs.Set(NAAttribute.ROUTE_NAME, assignedOrder.Route.Id.ToString());
                attrs.Set(NAAttribute.SEQUENCE, assignedOrder.SequenceNumber);
                attrs.Set(NAAttribute.ASSIGNMENT_RULE,
                          (int)NAOrderAssignmentRule.esriNAOrderPreserveRouteAndRelativeSequence);
            }
            else
            {
                attrs.Set(NAAttribute.ROUTE_NAME, assignedOrder.Route.Id.ToString());
                attrs.Set(NAAttribute.SEQUENCE, assignedOrder.SequenceNumber);
                attrs.Set(NAAttribute.ASSIGNMENT_RULE,
                          (int)NAOrderAssignmentRule.esriNAOrderPreserveRoute);
            }
        }