示例#1
0
 public override void Begin()
 {
     TempPrims.Clear();
     Temp = new GraphArrow();
     TempPrims.Add(Temp);
     Step = 0;
 }
示例#2
0
        public Reconnect(Diagram diagram, GraphLayer diagramLayer, GraphLayer tempLayer, Point initialPoint)
        {
            this.diagram            = diagram;
            this.diagramLayer       = diagramLayer;
            this.tempLayer          = tempLayer;
            this.graphArrowToDelete = (GraphArrow)this.tempLayer.Elements[0];

            this.initialConnector = this.graphArrowToDelete.GetConnector(initialPoint);
            if (this.initialConnector == this.graphArrowToDelete.InitConnector)
            {
                this.fixedConnector = this.graphArrowToDelete.FinalConnector;
                this.nextEnable     = true;
            }
            else
            {
                this.fixedConnector = this.graphArrowToDelete.InitConnector;
                this.nextEnable     = false;
            }

            this.graphArrowToDelete.DisableModifiers();
            this.tempLayer.Clear();

            this.tempLayer.Add(this.tempGraphArrow);
            this.tempLayer.Visible = true;
            this.tempLayer.UpdateSurface();

            //You get the obstacles to avoid by the arrow of the diagram layer
            this.gridStatus = this.diagramLayer.GetGridPoints();
        }
        public ModifyArrow(GraphLayer diagramLayer, GraphLayer tempLayer, Point initialLocation)
        {
            this.diagramLayer = diagramLayer;
            this.tempLayer    = tempLayer;
            this.graphArrow   = (GraphArrow)this.tempLayer.Elements[0];
            this.segment      = (LineSegment)this.graphArrow.GetSegment(initialLocation);
            this.graphArrow.DisableModifiers();
            this.gridStatus = this.diagramLayer.GetGridPoints();

            if (this.segment.Modifier is VerticalModifier)
            {
                this.movement = Movement.Vertical;
                this.cursor   = Cursors.VSplit;
            }
            else
            {
                this.movement = Movement.Horizontal;
                this.cursor   = Cursors.HSplit;
            }

            this.tempLayer.Clear();
            this.tempLayer.Add(this.tempGraphArrow);
            this.tempLayer.Visible = true;
            this.tempLayer.UpdateSurface();
        }
示例#4
0
 public void Do()
 {
     //If you are modifying the next of an item...
     if (this.nextEnable)
     {
         if (this.presentConnector.Parent is GraphConditional)
         {
             this.conditionalOut = ((GraphConditional)this.presentConnector.Parent).GetPredefOut(this.presentConnector);
             if ((conditionalOut == ConditionalOut.True) && (((GraphConditional)this.presentConnector.Parent).NextTrue != null))
             {
                 if (DialogResult.Yes != MowayMessageBox.Show(InsertArrowMessages.REPLACE_TRUE + "\r\n" + InsertArrowMessages.CONTINUE, InsertArrowMessages.INSERT_ARROW, MessageBoxButtons.YesNo, MessageBoxIcon.Warning))
                 {
                     this.Cancel();
                     return;
                 }
                 else if ((conditionalOut == ConditionalOut.False) && (((GraphConditional)this.presentConnector.Parent).NextFalse != null))
                 {
                     if (DialogResult.Yes != MowayMessageBox.Show(InsertArrowMessages.REPLACE_FALSE + "\r\n" + InsertArrowMessages.CONTINUE, InsertArrowMessages.INSERT_ARROW, MessageBoxButtons.YesNo, MessageBoxIcon.Warning))
                     {
                         this.Cancel();
                         return;
                     }
                 }
             }
         }
         GraphDiagram.DeleteElement(diagramLayer, diagram, this.graphArrowToDelete);
         this.graphArrow = GraphDiagram.InsertArrow(this.diagram, this.diagramLayer, this.presentConnector, this.fixedConnector, this.conditionalOut, this.gridStatus);
     }
     else        //If you are modifying an item's prev
     {
         if (fixedConnector.Parent is GraphConditional)
         {
             if (((GraphConditional)fixedConnector.Parent).NextTrue == this.graphArrowToDelete)
             {
                 this.conditionalOut = ConditionalOut.True;
             }
             else
             {
                 this.conditionalOut = ConditionalOut.False;
             }
         }
         GraphDiagram.DeleteElement(this.diagramLayer, this.diagram, this.graphArrowToDelete);
         this.graphArrow = GraphDiagram.InsertArrow(this.diagram, this.diagramLayer, this.fixedConnector, this.presentConnector, this.conditionalOut, this.gridStatus);
     }
     foreach (GraphElement element in this.tempLayer.Elements)
     {
         element.DisableConnectors();
     }
     this.tempLayer.ClearAndHide();
     this.diagramLayer.UpdateSurface();
     if (this.OperationFinished != null)
     {
         this.OperationFinished(this, new OperationEventArgs(Operation.Reconnect));
     }
 }
示例#5
0
 private bool IsIntermediateArrow(GraphArrow arrow)
 {
     if ((arrow != null) && (arrow.Next != null) && (arrow.Next.Selected == true))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
示例#6
0
        public override void End()
        {
            var p = Temp.EndPoint;

            Temp.Effective = true;
            Primitive.CurrentGraphics.Add(Temp);
            TempPrims.Clear();
            Temp = new GraphArrow();
            TempPrims.Add(Temp);
            Temp.StartPoint.X = p.X;
            Temp.StartPoint.Y = p.Y;
            Step = 1;
        }
示例#7
0
        public GraphArrow AddArrow(GraphNode start, GraphNode end)
        {
            var element = new GraphArrow
            {
                HeadHeight = 10,
                HeadWidth  = 5
            };

            element.SetStartNode(start);
            // Set arrow position manually until we dont have ending box.
            element.SetEndNode(end);

            Children.Add(element);
            return(element);
        }
示例#8
0
        public GraphArrow AddArrow(GraphNode node, Point curPos)
        {
            var element = new GraphArrow
            {
                HeadHeight = 10,
                HeadWidth  = 5
            };

            element.SetStartNode(node);
            // Set arrow position manually until we dont have ending box.
            element.SetEndPoint(curPos);

            Children.Add(element);
            return(element);
        }
示例#9
0
        /// <summary>
        /// Execution of the operation
        /// </summary>
        public void Do()
        {
            GraphElement initialElement = this.initialConnector.Parent;
            GraphElement finalElement   = this.finalConnector.Parent;

            graphArrow = new GraphArrow(initialConnector, finalConnector, this.diagramLayer.GetGridPoints());
            if (initialElement is GraphConditional)
            {
                if ((this.conditionalOut == ConditionalOut.True) && (((GraphConditional)initialElement).NextTrue != null))
                {
                    if (DialogResult.Yes == MowayMessageBox.Show(InsertArrowMessages.REPLACE_TRUE + InsertArrowMessages.CONTINUE, InsertArrowMessages.INSERT_ARROW, MessageBoxButtons.YesNo, MessageBoxIcon.Warning))
                    {
                        this.graphArrowToDelete = (GraphArrow)((GraphConditional)initialElement).NextTrue;
                        GraphDiagram.DeleteElement(this.diagramLayer, this.diagram, this.graphArrowToDelete);
                    }
                    else
                    {
                        this.Cancel();
                        return;
                    }
                }
                else if ((this.conditionalOut == ConditionalOut.False) && (((GraphConditional)initialElement).NextFalse != null))
                {
                    if (DialogResult.Yes == MowayMessageBox.Show(InsertArrowMessages.REPLACE_FALSE + InsertArrowMessages.CONTINUE, InsertArrowMessages.INSERT_ARROW, MessageBoxButtons.YesNo, MessageBoxIcon.Warning))
                    {
                        this.graphArrowToDelete = (GraphArrow)((GraphConditional)initialElement).NextFalse;
                        GraphDiagram.DeleteElement(this.diagramLayer, this.diagram, this.graphArrowToDelete);
                    }
                    else
                    {
                        this.Cancel();
                        return;
                    }
                }
                ((GraphConditional)initialElement).AddNext(initialConnector, graphArrow, this.conditionalOut);
            }
            else
            {
                if (initialElement.Next != null)
                {
                    if (DialogResult.Yes == MowayMessageBox.Show(InsertArrowMessages.REPLACE_OUT + InsertArrowMessages.CONTINUE, InsertArrowMessages.INSERT_ARROW, MessageBoxButtons.YesNo, MessageBoxIcon.Warning))
                    {
                        this.graphArrowToDelete = (GraphArrow)initialElement.Next;
                        GraphDiagram.DeleteElement(this.diagramLayer, this.diagram, this.graphArrowToDelete);
                    }
                    else
                    {
                        this.Cancel();
                        return;
                    }
                }
                initialElement.AddNext(initialConnector, graphArrow);
            }
            finalElement.AddPrevious(finalConnector, graphArrow);
            this.diagramLayer.AddElement(graphArrow);
            //Elements in the context of the operation are deleted
            foreach (GraphElement element in this.tempLayer.Elements)
            {
                element.DisableConnectors();
            }
            this.tempLayer.ClearAndHide();
            this.diagramLayer.UpdateSurface();
            if (this.DiagramChanged != null)
            {
                this.DiagramChanged(this, new EventArgs());
            }
            if (this.OperationFinished != null)
            {
                this.OperationFinished(this, new OperationEventArgs(Operation.Connect));
            }
        }
示例#10
0
        public void Do()
        {
            GraphElement initialElement = initialConnector.Parent;
            GraphElement finalElement   = finalConnector.Parent;

            this.graphArrow = new GraphArrow(initialConnector, finalConnector, gridStatus);
            if (initialElement is GraphConditional)
            {
                if ((conditionalOut == ConditionalOut.True) && (((GraphConditional)initialElement).NextTrue != null))
                {
                    if (DialogResult.Yes == MowayMessageBox.Show(InsertArrowMessages.REPLACE_TRUE + "\r\n" + InsertArrowMessages.CONTINUE, InsertArrowMessages.INSERT_ARROW, MessageBoxButtons.YesNo, MessageBoxIcon.Warning))
                    {
                        this.graphArrowToDelete = (GraphArrow)((GraphConditional)initialElement).NextTrue;
                        GraphDiagram.DeleteElement(diagramLayer, diagram, this.graphArrowToDelete);
                    }
                    else
                    {
                        this.Cancel();
                        return;
                    }
                }
                else if ((conditionalOut == ConditionalOut.False) && (((GraphConditional)initialElement).NextFalse != null))
                {
                    if (DialogResult.Yes == MowayMessageBox.Show(InsertArrowMessages.REPLACE_FALSE + "\r\n" + InsertArrowMessages.CONTINUE, InsertArrowMessages.INSERT_ARROW, MessageBoxButtons.YesNo, MessageBoxIcon.Warning))
                    {
                        this.graphArrowToDelete = (GraphArrow)((GraphConditional)initialElement).NextFalse;
                        GraphDiagram.DeleteElement(diagramLayer, diagram, this.graphArrowToDelete);
                    }
                    else
                    {
                        this.Cancel();
                        return;
                    }
                }
                ((GraphConditional)initialElement).AddNext(initialConnector, this.graphArrow, conditionalOut);
            }
            else
            {
                if (initialElement.Next != null)
                {
                    if (DialogResult.Yes == MowayMessageBox.Show(InsertArrowMessages.REPLACE_OUT + "\r\n" + InsertArrowMessages.CONTINUE, InsertArrowMessages.INSERT_ARROW, MessageBoxButtons.YesNo, MessageBoxIcon.Warning))
                    {
                        this.graphArrowToDelete = (GraphArrow)initialElement.Next;
                        GraphDiagram.DeleteElement(diagramLayer, diagram, this.graphArrowToDelete);
                    }
                    else
                    {
                        this.Cancel();
                        return;
                    }
                }
                initialElement.AddNext(initialConnector, this.graphArrow);
            }
            finalElement.AddPrevious(finalConnector, this.graphArrow);
            diagramLayer.AddElement(this.graphArrow);
            this.diagram.AddElement(this.graphArrow.Element);
            //Elements in the context of the operation are deleted
            this.PreCancel();
            this.diagramLayer.UpdateSurface();
            if (this.DiagramChanged != null)
            {
                this.DiagramChanged(this, new EventArgs());
            }
            if (this.OperationFinished != null)
            {
                this.OperationFinished(this, new OperationEventArgs(Operation.InsertArrow));
            }
        }