Exemple #1
0
        public void AddConstraint(AbstractTransformConstraint newConstraint)
        {
            if (ActiveConstrains.Count == 0)
            {
                ActiveConstrains.Add(newConstraint);
                maxConstrainPriority = newConstraint.ConstrainOrder;
                minConstrainPriority = newConstraint.ConstrainOrder;
                return;
            }

            if (newConstraint.ConstrainOrder >= maxConstrainPriority)
            {
                ActiveConstrains.Add(newConstraint);
                maxConstrainPriority = newConstraint.ConstrainOrder;
                return;
            }

            if (newConstraint.ConstrainOrder <= minConstrainPriority)
            {
                ActiveConstrains.Insert(0, newConstraint);
                minConstrainPriority = newConstraint.ConstrainOrder;
                return;
            }

            int i = 0;

            foreach (var constr in ActiveConstrains)
            {
                if (constr.ConstrainOrder >= newConstraint.ConstrainOrder)
                {
                    break;
                }

                i++;
            }

            ActiveConstrains.Insert(i, newConstraint);
        }
Exemple #2
0
 public void RemoveConstraint(AbstractTransformConstraint constraint)
 {
     ActiveConstrains.Remove(constraint);
 }