コード例 #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");
            }
        }