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 MouseDown(Point e) { StartPoint = e; foreach (IFigure figure in CoreUML.SelectedFigures) { CoreUML.Figures.Remove(figure); if (figure is AbstractArrow) { _tmpArrows.Remove((AbstractArrow)figure); } if (figure is AbstractBox) { foreach (DataCommon dataCommon in figure.DataCommon) { if (CoreUML.Figures.Remove(dataCommon.Arrow)) { _tmpArrows.Add((AbstractArrow)dataCommon.Arrow); } } } IsTapped = true; } if (IsTapped) { CoreUML.UpdPicture(); CoreUML.SwitchToDrawInTmp(); foreach (IFigure figure in CoreUML.SelectedFigures) { figure.Draw(CoreUML.Graphics); figure.Select(CoreUML.Graphics); } } }
public void MouseMove(Point e) { if (IsTapped) { CoreUML.SwitchToDrawInTmp(); _newArrow.HookEndPointToFigure(e); _newArrow.Draw(CoreUML.Graphics); if (!(_newArrow.DataCommon[0].LastBox is null)) { AbstractBox box = (AbstractBox)_newArrow.DataCommon[0].LastBox; AbstractBox.DrawConnectionPoint(CoreUML.Graphics, box.GetCordinatsOfConnectionPoint(_newArrow.DataCommon[0].LastPoint)); } CoreUML.PictureBox.Image = CoreUML.BitmapTmp; } else if (_newArrow is null) { foreach (IFigure figure in CoreUML.Figures) { if (figure is AbstractBox box && figure.CheckSelection(e, e, 7)) { CoreUML.DrawSelectionOfFigures(); AbstractBox.DrawConnectionPoint(CoreUML.Graphics, box.GetCordinatsOfConnectionPoint(box.GetConnectionPoint(e, e))); break; } } CoreUML.DrawSelectionOfFigures(); CoreUML.PictureBox.Image = CoreUML.BitmapTmp; } }
public void MouseUp(Point e) { CoreUML.SwitchToDrawInTmp(); CoreUML.DrawSelectionOfFigures(); CoreUML.PictureBox.Image = CoreUML.BitmapTmp; IsTapped = false; }
public void HookEndPointToFigure(Point e) { if (DataCommon.Count == 0) { DataCommon.Add(new DataCommon(this)); } if (!(DataCommon[0].LastBox is null)) { DataCommon[0].LastBox.DataCommon.Remove(DataCommon[0]); DataCommon[0].LastBox = null; DataCommon[0].LastPoint = null; } foreach (IFigure figure in CoreUML.GetCoreUML().Figures) { if (figure is AbstractBox abstractBox && figure != DataCommon[0].FirstBox) { if (figure.CheckSelection(e, e, 7)) { DataCommon[0].LastBox = abstractBox; DataCommon[0].LastPoint = abstractBox.GetConnectionPoint(e, Points[0]); EndDirectionAxis = DataCommon[0].LastPoint.Axis; GetPoints(Points[0], abstractBox.GetCordinatsOfConnectionPoint(DataCommon[0].LastPoint)); abstractBox.DataCommon.Add(DataCommon[0]); return; } } } GetPoints(Points[0], e); }
/// <summary> /// Сереализация ядра и объектов програмы /// </summary> public PreparationData() { CoreUML coreUML = CoreUML.GetCoreUML(); List <IFigure> Figures = coreUML.Figures; Base = new List <IBase>(); Base = CreateStructFigure(Figures); }
public StructDataCommon(DataCommon data) { CoreUML coreUML = CoreUML.GetCoreUML(); FirstBox = coreUML.Figures.IndexOf(data.FirstBox); LastBox = coreUML.Figures.IndexOf(data.LastBox); Arrow = coreUML.Figures.IndexOf(data.Arrow); FirstPoint = data.FirstPoint; LastPoint = data.LastPoint; }
public StructSettings() { CoreUML coreUML = CoreUML.GetCoreUML(); DefaultColor = coreUML.DefaultColor; DefaultFont = coreUML.DefaultFont; DefaultWidth = coreUML.DefaultWidth; //DefaultSize = coreUML.DefaultSize; DefaultStep = new Step(coreUML.DefaultStep); Path = coreUML.MyPath; }
public void MouseDown(Point e) { _newBox = (AbstractBox)FigureFactory.GetFigure(CoreUML.DefaultColor, (int)CoreUML.DefaultWidth); _newBox.AddPoints(e); CoreUML.Figures.Add(_newBox); CoreUML.SwitchToDrawInTmp(); _newBox.Draw(CoreUML.Graphics); CoreUML.BitmapMain = (Bitmap)CoreUML.BitmapTmp.Clone(); CoreUML.SelectedFigures.Clear(); CoreUML.SelectedFigures.Add(_newBox); CoreUML.DrawSelectionOfFigures(); CoreUML.PictureBox.Image = CoreUML.BitmapTmp; }
public void MouseUp(Point e) { if (IsTapped) { foreach (IFigure figure in CoreUML.SelectedFigures) { CoreUML.Figures.Add(figure); } CoreUML.UpdPicture(); CoreUML.DrawSelectionOfFigures(); CoreUML.PictureBox.Image = CoreUML.BitmapTmp; IsTapped = false; } }
public StructSettings ReadSettings() { StructSettings settings; using (FileStream fileStream = new FileStream(CoreUML.GetCoreUML().MyPathSettings, FileMode.Open, FileAccess.Read, FileShare.None)) { using (StreamReader streamReader = new StreamReader(fileStream)) { settings = _deserializer.DeserializerSetting(streamReader.ReadToEnd()); streamReader.Close(); } fileStream.Close(); } return(settings); }
public void MouseMove(Point e) { if (IsTapped) { CoreUML.SwitchToDrawInTmp(); foreach (IFigure figure in CoreUML.SelectedFigures) { figure.Move(e.X - StartPoint.X, e.Y - StartPoint.Y); figure.Draw(CoreUML.Graphics); figure.Select(CoreUML.Graphics); } foreach (AbstractArrow arrow in _tmpArrows) { arrow.Draw(CoreUML.Graphics); } StartPoint = e; CoreUML.PictureBox.Image = CoreUML.BitmapTmp; } }
public void MouseMove(Point e) { if (IsTapped) { int minX; int maxX; int minY; int maxY; if (StartPoint.X > e.X) { maxX = StartPoint.X; minX = e.X; } else { minX = StartPoint.X; maxX = e.X; } if (StartPoint.Y > e.Y) { maxY = StartPoint.Y; minY = e.Y; } else { minY = StartPoint.Y; maxY = e.Y; } CoreUML.SelectedFigures.Clear(); foreach (IFigure figure in CoreUML.Figures) { if (figure.CheckSelection(new Point(minX, minY), new Point(maxX, maxY))) { CoreUML.SelectedFigures.Add(figure); } } CoreUML.SwitchToDrawInTmp(); CoreUML.DrawSelectionOfFigures(); DrawRectangleOfSelection(e); CoreUML.PictureBox.Image = CoreUML.BitmapTmp; } }
public void MouseUp(Point e) { if (IsTapped) { CoreUML.SwitchToDrawInTmp(); foreach (IFigure figure in CoreUML.SelectedFigures) { CoreUML.Figures.Add(figure); figure.Draw(CoreUML.Graphics); } foreach (AbstractArrow arrow in _tmpArrows) { CoreUML.Figures.Add(arrow); arrow.Draw(CoreUML.Graphics); } CoreUML.BitmapMain = CoreUML.BitmapTmp; CoreUML.DrawSelectionOfFigures(); IsTapped = false; } }
public void MouseMove(Point e) { if (IsTapped) { CoreUML.SwitchToDrawInTmp(); foreach (IFigure figure in CoreUML.SelectedFigures) { figure.Transform(e); figure.Draw(CoreUML.Graphics); if (figure is AbstractArrow arrow) { if (arrow.SelectedZone.ZoneType == ZoneType.FirstPoint && !(arrow.DataCommon[0].FirstBox is null)) { AbstractBox.DrawConnectionPoint(CoreUML.Graphics, arrow.Points[0]); } else if (arrow.SelectedZone.ZoneType == ZoneType.LastPoint && !(arrow.DataCommon[0].LastBox is null)) { AbstractBox.DrawConnectionPoint(CoreUML.Graphics, arrow.Points[arrow.Points.Count - 1]); } } CoreUML.PictureBox.Image = CoreUML.BitmapTmp; } } }
public void MouseDown(Point e) { StartPoint = e; CoreUML.SelectedFigures.Clear(); for (int i = 0; i < CoreUML.Figures.Count; i++) { if (CoreUML.Figures[i].CheckSelection(e, e, 2)) { IsTapped = true; CoreUML.SelectedFigures.Add(CoreUML.Figures[i]); CoreUML.Figures.Remove(CoreUML.Figures[i]); break; } } if (IsTapped) { CoreUML.UpdPicture(); CoreUML.SwitchToDrawInTmp(); foreach (IFigure figure in CoreUML.SelectedFigures) { figure.Draw(CoreUML.Graphics); } } }
/// <summary> /// KeyCode управления нажатий клавиши /// </summary> /// <param name="sender"></param> /// <param name="e"></param> #region KeyCode private void KeyDown_Control(object sender, KeyEventArgs e) { if (e.Control) { switch (e.KeyCode) { case Keys.Delete: ButtonClear_Click(sender, e); return; case Keys.Oemplus: ScrollSizeUp(); return; case Keys.OemMinus: ScrollSizeDown(); return; case Keys.D0: ScrollSizeBase(); return; case Keys.Up: _coreUML.MoveByKey(e.KeyCode); return; case Keys.Down: _coreUML.MoveByKey(e.KeyCode); return; case Keys.Left: _coreUML.MoveByKey(e.KeyCode); return; case Keys.Right: _coreUML.MoveByKey(e.KeyCode); return; case Keys.A: Highlighting(); return; case Keys.C: _coreUML.SaveTmpFigure(); return; case Keys.V: _coreUML.LoadTmpFigure(); return; case Keys.Z: Press_Z(_coreUML.Logs); return; case Keys.R: _coreUML.ReverseArrow(); return; case Keys.S: CoreUML.SaveDate(); MessageBox.Show("Сохранено"); return; case Keys.L: Press_L(); return; case Keys.P: _coreUML.SaveImagePrepaire(); return; case Keys.T: Press_T(); return; } } if (e.Alt) { switch (e.KeyCode) { case Keys.Z: Press_Revert_Z(_coreUML.LogsBack); return; } } switch (e.KeyCode) { case Keys.ControlKey: _isControlKeyOn = true; return; case Keys.Escape: Press_Escape(); return; case Keys.F1: Press_F1(); return; case Keys.Q: Press_Q(); return; case Keys.W: Press_W(); return; case Keys.E: Press_E(); return; } }
private void Save_Click(object sender, EventArgs e) { CoreUML.SaveDate(); MessageBox.Show("Сохранено"); }
public bool CheckSelection(Point startPoint, Point endPoint, int inaccuracy = 0) { bool selected = false; int maxX; int minX; int maxY; int minY; CoreUML coreUML = CoreUML.GetCoreUML(); for (int i = 1; i < Points.Count; i++) { if (Points[i - 1].X > Points[i].X) { maxX = Points[i - 1].X + inaccuracy; minX = Points[i].X - inaccuracy; } else { minX = Points[i - 1].X - inaccuracy; maxX = Points[i].X + inaccuracy; } if (Points[i - 1].Y > Points[i].Y) { maxY = Points[i - 1].Y + inaccuracy; minY = Points[i].Y - inaccuracy; } else { minY = Points[i - 1].Y - inaccuracy; maxY = Points[i].Y + inaccuracy; } if (!(startPoint.X > maxX || startPoint.Y > maxY || endPoint.X < minX || endPoint.Y < minY )) { selected = true; Axis axis; if (Points[i - 1].X == Points[i].X) { axis = Axis.X; } else { axis = Axis.Y; } ZoneType linkType; if (i - 1 == 0) { linkType = ZoneType.FirstPoint; } else if (i == Points.Count - 1) { linkType = ZoneType.LastPoint; } else { linkType = ZoneType.MiddleLink; } SelectedZone = new ZoneOfArrow(i - 1, i, axis, linkType); return(selected); } } return(selected); }