Esempio n. 1
0
 /// <summary>
 /// unlinks a target from a source. Either src or target has this shape as owner
 /// </summary>
 /// <param name="src">the link source</param>
 /// <param name="target">the link target</param>
 public override void OnUnlink(ShapeLink src, ShapeLink target)
 {
     base.OnUnlink(src, target);
     // perform the unlinking on the engine objects
     if (target.OwnerShape == this)
     {
         ConstraintShape constraint = src.OwnerShape as ConstraintShape;
         if (constraint != null && HasEngineInstance() && constraint.HasEngineInstance()) // at least the engine instance of the constraint can be null
         {
             EnginePGroup.RemoveConstraint(constraint._engineInstance as EngineInstanceConstraint);
         }
     }
 }
        /// <summary>
        /// Perform the actual linking. Either src or target has this shape as owner
        /// </summary>
        /// <param name="src">the link source</param>
        /// <param name="target">the link target</param>
        public override void OnLink(ShapeLink src, ShapeLink target)
        {
            base.OnLink(src, target); // adds to collections

            if (HasEngineInstance())
            {
                EnginePGroup.OnLinksChanged();
            }

            // perform the linking on the engine objects
            if (target.OwnerShape == this)
            {
                ConstraintShape constraint = src.OwnerShape as ConstraintShape;
                if (constraint != null && HasEngineInstance() && constraint.HasEngineInstance()) // at least the engine instance of the constraint can be null
                {
                    EnginePGroup.AddConstraint(constraint._engineInstance as EngineInstanceConstraint);
                }
            }
        }