public void MouseDown(object sender, MouseEventArgs e) { _painter.CurentFigure = _painter.Factory.GetFigure(); AbstractArrow curentArrow = (AbstractArrow)_painter.CurentFigure; foreach (IFigure a in _painter.Figures) { if (a is ClassRectangle) { ClassRectangle temp = (ClassRectangle)a; foreach (Port b in temp.Ports) { if (b.SelectedPort(e.Location) && (b.ArrowType == Painter.FigureType.NoDefine || b.ArrowType == _painter.CurentFigure.figureType) ) { curentArrow.StartPort = b; _painter.CurentFigure.StartPoint = b.ConnectingPoint; curentArrow.Links.Add(a); break; } } } } if (curentArrow.StartPort is null) { _painter.CurentFigure = null; } }
public void MouseUp(Point e) { if (IsTapped) { if (StartPoint.X != e.X || StartPoint.Y != e.Y) { if (!(_newArrow.DataCommon[0].FirstBox is null)) { _newArrow.DataCommon[0].FirstBox.DataCommon.Add(_newArrow.DataCommon[0]); } if (!(_newArrow.DataCommon[0].LastBox is null)) { _newArrow.DataCommon[0].LastBox.DataCommon.Add(_newArrow.DataCommon[0]); } CoreUML.BitmapMain = CoreUML.BitmapTmp; CoreUML.WriteLogs(null, false); CoreUML.Figures.Add(_newArrow); CoreUML.WriteLogs(_newArrow, true); CoreUML.SelectedFigures.Clear(); CoreUML.SelectedFigures.Add(_newArrow); CoreUML.DrawSelectionOfFigures(); IsTapped = false; CoreUML.PictureBox.Image = CoreUML.BitmapTmp; _newArrow = null; } } }
public void MouseMove(object sender, MouseEventArgs e) { AbstractArrow curentArrow = (AbstractArrow)_painter.CurentFigure; _painter.CurentFigure.FinishPoint = e.Location; _painter.UpdatePictureBox(); curentArrow.DrawDirect(); GC.Collect(); }
public void MouseDown(Point e) { if (!IsTapped) { StartPoint = new Point(e.X, e.Y); IsTapped = true; _newArrow = (AbstractArrow)FigureFactory.GetFigure(CoreUML.DefaultColor, CoreUML.DefaultWidth); _newArrow.GetPoints(e, e); _newArrow.HookStartPointToFigure(e); } }
public void Move(int deltaX, int deltaY) { List <Point> newPoints = new List <Point>(); foreach (Point point in Points) { Point currentPoint = point; currentPoint.X += deltaX; currentPoint.Y += deltaY; newPoints.Add(currentPoint); } Points = newPoints; foreach (DataCommon dataCommon in DataCommon) { AbstractArrow arrow = (AbstractArrow)dataCommon.Arrow; arrow.UpdArrow(); } }
public void MouseUp(object sender, MouseEventArgs e) { AbstractArrow curentArrow = (AbstractArrow)_painter.CurentFigure; _painter.UpdatePictureBox(); if (curentArrow != null) { foreach (IFigure a in _painter.Figures) { if (a is ClassRectangle) { ClassRectangle temp = (ClassRectangle)a; foreach (Port b in temp.Ports) { if (b.SelectedPort(e.Location) && (b.ArrowType == Painter.FigureType.NoDefine || b.ArrowType == _painter.CurentFigure.figureType) ) { curentArrow.FinishPort = b; _painter.CurentFigure.FinishPoint = b.ConnectingPoint; _painter.CurentFigure.Links.Add(a); break; } } } } if (curentArrow.FinishPort != null) { _painter.CurentFigure.Draw(); _painter.SetMainBitmap(); _painter.Figures.Add(_painter.CurentFigure); foreach (IFigure a in _painter.CurentFigure.Links) { a.Links.Add(_painter.CurentFigure); } curentArrow.FinishPort.ArrowType = curentArrow.figureType; curentArrow.StartPort.ArrowType = curentArrow.figureType; _painter.CurentFigure = null; _painter.UpdatePictureBox(); } } }
public StructArrow(IFigure figure) { AbstractArrow arrow = (AbstractArrow)figure; Type = arrow.GetType().FullName; Color = arrow.GetColor(); Width = arrow.GetWidth(); Points = new List <IPoint>(); for (int i = 0; i < arrow.Points.Count; i++) { StructPoints structPoints = new StructPoints(arrow.Points[i]); Points.Add(structPoints); } Data = new List <IDataCommon>(); for (int i = 0; i < arrow.DataCommon.Count; i++) { StructDataCommon structData = new StructDataCommon(arrow.DataCommon[i]); Data.Add(structData); } }
private void PictureBox1_MouseDown(object sender, MouseEventArgs e) { _point = new Point(e.X, e.Y); _isTapped = true; switch (_act) { case Act.Aggregation: _currentArrow = new AggregationArrow(); _currentArrow.ChangeWidth(_width); break; case Act.Composition: _currentArrow = new CompositionArrow(); _currentArrow.ChangeWidth(_width); break; case Act.Inheritance: _currentArrow = new InheritanceArrow(); _currentArrow.ChangeWidth(_width); break; case Act.Select: bool selected; foreach (AbstractArrow arrow in _arrows) { selected = arrow.CheckSelection(_point); if (selected) { _graphics.Clear(Color.White); arrow.Reverse(); foreach (AbstractArrow arrow2 in _arrows) { arrow2.Draw(_graphics); } pictureBox1.Invalidate(); break; } } break; } }
public void CheckSelection_WhenPointNotNull_ShouldReturnBool(AbstractArrow arrow, Point startpoint, Point endpoint, bool expected) { bool actual = arrow.CheckSelection(startpoint, endpoint); Assert.AreEqual(expected, actual); }
public DataCommon(AbstractArrow arrow) { Arrow = arrow; FirstBox = null; LastBox = null; }