Esempio n. 1
0
        internal VisualEdge(EdgeController edgeController, uint startSlotId, uint endSlotId, bool isImplicit)
        {
            this.edgeController = edgeController;
            if (isImplicit)
            {
                this.EdgeType = EdgeType.ImplicitConnection;
            }
            else
            {
                this.EdgeType = EdgeType.ExplicitConnection;
            }
            this.version     = VisualEdge.Version.Current;
            this.StartSlotId = startSlotId;
            this.EndSlotId   = endSlotId;

            // Generate new ID for this visual edge.
            GraphController graphController = edgeController.GetGraphController();
            IdGenerator     idGenerator     = graphController.GetIdGenerator();

            this.EdgeId = idGenerator.GetNextId(ComponentType.Edge);

            controlPoints.Add(new Point());
            controlPoints.Add(new Point());
            controlPoints.Add(new Point());
            controlPoints.Add(new Point());

            GraphController controller = edgeController.GetGraphController();
            Slot            startSlot  = controller.GetSlot(this.StartSlotId) as Slot;
            Slot            endSlot    = controller.GetSlot(this.EndSlotId) as Slot;

            if (startSlot != null && endSlot != null)
            {
                Point startPoint = startSlot.GetPosition();
                Point endPoint   = endSlot.GetPosition();
                UpdateControlPoint(startPoint, endPoint, startSlot.SlotType != SlotType.Output);
            }
            else
            {
                throw new ArgumentNullException("startSlot or endSlot");
            }
        }
Esempio n. 2
0
        public AuditStatus Audit()
        {
            GraphController controller = edgeController.GetGraphController();
            Slot            startSlot  = controller.GetSlot(this.StartSlotId) as Slot;
            Slot            endSlot    = controller.GetSlot(this.EndSlotId) as Slot;

            if (startSlot != null && endSlot != null)
            {
                Point startPoint      = startSlot.GetPosition();
                Point endPoint        = endSlot.GetPosition();
                bool  positionChanged = false;

                if (startSlot.SlotType == SlotType.Output)
                {
                    if (startPoint != controlPoints[0] || endPoint != controlPoints[3])
                    {
                        positionChanged = true;
                    }
                }
                else
                {
                    if (startPoint != controlPoints[3] || endPoint != controlPoints[0])
                    {
                        positionChanged = true;
                    }
                }

                if (positionChanged)
                {
                    UpdateControlPoint(startPoint, endPoint, startSlot.SlotType != SlotType.Output);
                    //this.Dirty = true;
                    //this.Compose();
                    return(AuditStatus.PersistentDataChanged);
                }
            }

            return(AuditStatus.NoChange);
        }