private static void pereborLineKoncaLine(CFigure cFigure) { foreach (Line line in CCanvas.CLineList.Where(o => o.IdFigureKonec == cFigure.Id && o is LineNY == false)) { perenosKoncaLineNeRhombus(line, cFigure); } }
private static void figureLeveeRhombus(LineNY lineNY, CFigure cfigure) { newCFigure.Position = new Point(cfigure.Position.X - newCFigure.Width - 40, cfigure.Position.Y + cfigure.Height + 20); cfigure.VihodLineLeft = true; lineNY.PositionLineNachalo = cfigure.SoedineniePoint("left"); }
private static void ifTwoDotkoncaLine(CFigure cFigure, LineNY lineNY) { if (lineNY.SposobOtrisovki == null) { perenosKoncaLineNeRhombus(lineNY, cFigure); } }
private static void ifFourDotNachLine(CFigure cFigure, LineNY lineNY, CFigure figure) { if (lineNY.SposobOtrisovki == true) { PositionLineFourDot(cFigure, lineNY, figure); } }
private static void nachZnachMin(CFigure cFigure, Point position) { kvX = Math.Pow(cFigure.SerediniStoron[0].X - position.X, 2); kvY = Math.Pow(cFigure.SerediniStoron[0].Y - position.Y, 2); numMin = 0; min = kvX + kvY; }
private static void ifFourDotkoncaLine(CFigure cFigure, LineNY lineNY, CFigure figureNachalaLine) { if (lineNY.SposobOtrisovki == true) { PositionLineFourDot(figureNachalaLine, lineNY, cFigure); } }
private static void ifThreeDotNachLine(CFigure cFigure, LineNY lineNY, CFigure figure) { if (lineNY.SposobOtrisovki == false) { positionLineThreeDot(cFigure, lineNY, figure); } }
private static void ifTwoDotNachLine(CFigure cFigure, LineNY lineNY) { if (lineNY.SposobOtrisovki == null) { PerenosNachalaLineNeRhombus(lineNY, cFigure); } }
private static void pereborLinePerenosNachLine(CFigure cFigure) { foreach (Line line in CCanvas.CLineList.Where(o => o.IdFigureNachalo == cFigure.Id)) { PerenosNachalaLineNeRhombus(line, cFigure); } }
private static void figurePraveeRhombus(LineNY lineNY, CFigure cfigure) { newCFigure.Position = new Point(cfigure.Position.X + cfigure.Width + 40, cfigure.Position.Y + cfigure.Height + 20); cfigure.VihodLineRight = true; lineNY.PositionLineNachalo = cfigure.SoedineniePoint("right"); }
private static void ifThreeDotkoncaLine(CFigure cFigure, LineNY lineNY, CFigure figureNachalaLine) { if (lineNY.SposobOtrisovki == false)//линия из 3 точек { lineNY.PositionLineKonec = cFigure.SoedineniePoint("top"); positionLineThreeDot(figureNachalaLine, lineNY, cFigure); } }
private void ifRadFigureChecked(CFigure cFigure, MouseEventArgs e) { if (rad_Figure.Checked) { pCanvas.DragStart(e.X, e.Y, cFigure); flag = true; } }
private static void positionLineThreeDot(CFigure cFigure, LineNY lineNY, CFigure figure) { lineNY.PositionLineNachalo = cFigure.SoedineniePoint(cFigure.SoedineniePoint("top").X <= figure.SoedineniePoint("top").X ? "right" : "left"); lineNY.LineThreePoints(); }
private static void pereborVihodLine(CFigure cfigure) { foreach (LineNY lineNY in CCanvas.CLineList.Where(o => o is LineNY && o.IdFigureNachalo == cfigure.Id)) { figurePosleRhombus(lineNY, cfigure); maxMinX(); } }
private static void VihodOneLine(CFigure cfigure) { Line line = CCanvas.CLineList.Where(o => o.IdFigureNachalo == cfigure.Id).FirstOrDefault(); if (line != null) { figurePosleNeRhombus(cfigure, line); } }
private static void perenosKoncaLineNeRhombus(Line line, CFigure cFigure) { numMin = OptimalPut(cFigure, line.PositionLineNachalo); line.PositionLineKonec = new Point(cFigure.SerediniStoron[numMin].X, cFigure.SerediniStoron[numMin].Y); CFigure figure = CCanvas.CFigureList.Where(o => o.Id == line.IdFigureNachalo).FirstOrDefault(); numMin = OptimalPut(figure, line.PositionLineKonec); line.PositionLineNachalo = new Point(figure.SerediniStoron[numMin].X, figure.SerediniStoron[numMin].Y); }
private void ifRadLineChecked(CFigure cFigure, MouseEventArgs e) { if (rad_Line.Checked && cFigure is Rhombus == false) { Line line = new Line(e.X, e.Y, cFigure.Id); pCanvas.Add(line); flag = true; } }
public void DragMove(int X, int Y) { CFigure cFigure = CFigureList.Where(o => o.Perenos).FirstOrDefault(); if (cFigure != null && CLineList != null) { cFigure.Position = new Point(X - cFigure.Delta.X, Y - cFigure.Delta.Y); PologenieLine.PerenosLine(cFigure); } }
private static void pereborLineNYperenosNachLine(CFigure cFigure) { foreach (LineNY lineNY in CCanvas.CLineList.Where(o => o.IdFigureNachalo == cFigure.Id)) { CFigure figure = CCanvas.CFigureList.Where(o => o.Id == lineNY.IdFigureKonec).FirstOrDefault(); ifThreeDotNachLine(cFigure, lineNY, figure); ifFourDotNachLine(cFigure, lineNY, figure); ifTwoDotNachLine(cFigure, lineNY); } }
private void ifRadLineYesChecked(CFigure cFigure, MouseEventArgs e) { if (rad_LineYes.Checked && cFigure is Rhombus) { LineNY lineny = new LineNY(e.X, e.Y, cFigure.Id); lineny.TextLine = "да"; pCanvas.Add(lineny); flag = true; } }
private static void PerenosNachalaLine(CFigure cFigure) { if (cFigure is Rhombus) { pereborLineNYperenosNachLine(cFigure); } else { pereborLinePerenosNachLine(cFigure); } }
private static void pereborLineNYkoncaLine(CFigure cFigure) { foreach (LineNY lineNY in CCanvas.CLineList.Where(o => o.IdFigureKonec == cFigure.Id && o is LineNY)) { CFigure figureNachalaLine = CCanvas.CFigureList.Where(o => o.Id == lineNY.IdFigureNachalo).FirstOrDefault(); ifThreeDotkoncaLine(cFigure, lineNY, figureNachalaLine); ifFourDotkoncaLine(cFigure, lineNY, figureNachalaLine); ifTwoDotkoncaLine(cFigure, lineNY); } }
private void vidCursoraPriNavedenii(CFigure cFigure) { if (rad_Line.Checked && cFigure is Rhombus == false || (rad_LineNo.Checked || rad_LineYes.Checked) && cFigure is Rhombus) { pictureBox1.Cursor = Cursors.Hand; } if (rad_Figure.Checked) { pictureBox1.Cursor = Cursors.SizeAll; } }
private static void firstFigure() { CFigure cFigure = CCanvas.CFigureList.Where(o => o is Circle).FirstOrDefault(); if (cFigure != null) { cFigure.Position = new Point(329, 10); cFigure.SerediniStoronMethPoints(); cfigureList.Add(cFigure); PologenieLine.PerenosLine(cFigure); } }
private static void figurePosleNeRhombus(CFigure cfigure, Line line) { newCFigure = CCanvas.CFigureList.Where(o => o.Id == line.IdFigureKonec).FirstOrDefault(); newCFigure.Position = new Point(cfigure.SerediniStoron[2].X - newCFigure.Width / 2, cfigure.Position.Y + cfigure.Height + 20); newCFigure.Perenos = true; newCFigure.SerediniStoronMethPoints(); maxMinX(); PologenieLine.PerenosLine(newCFigure); cnewfigureList.Add(newCFigure); }
public void DragMoveLine(int Xl, int Yl) { Line line = CLineList.Where(o => o.Otrisovka).FirstOrDefault(); if (line != null) { CFigure cFigure = CFigureList.Where(o => o.Id == line.IdFigureNachalo).FirstOrDefault(); line.PositionLineKonec = new Point(Xl, Yl); numMin = PologenieLine.OptimalPut(cFigure, line.PositionLineKonec); line.PositionLineNachalo = new Point(cFigure.SerediniStoron[numMin].X, cFigure.SerediniStoron[numMin].Y); } }
private void naveliNaFigureOrNet(MouseEventArgs e) { CFigure cFigure = CCanvas.CFigureList.FirstOrDefault(o => o.Vhod(e.X, e.Y)); if (cFigure != null) { vidCursoraPriNavedenii(cFigure); } else { pictureBox1.Cursor = Cursors.Arrow; } }
private void MouseDownPictureBox(object sender, MouseEventArgs e) { CFigure cFigure = CCanvas.CFigureList.Where(o => o.Vhod(e.X, e.Y)).FirstOrDefault(); if (cFigure != null) { ifRadLineChecked(cFigure, e); ifRadLineNoChecked(cFigure, e); ifRadLineYesChecked(cFigure, e); ifRadFigureChecked(cFigure, e); ReDrow(); } }
private void MouseButton_Click(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { CFigure cFigure = CCanvas.CFigureList.Where(o => o.Vhod(e.X, e.Y)).FirstOrDefault(); if (cFigure != null) { pokazatT(); textBox1.Text = cFigure.TextFigure; cFigure.ColorFigure = Color.Blue; ReDrow(); } } }
public static void PositionLineFourDot(CFigure cFigure, LineNY lineNY, CFigure figure) { if (cFigure.SoedineniePoint("top").X < figure.SoedineniePoint("top").X) { lineNY.PositionLineNachalo = cFigure.SoedineniePoint("left"); lineNY.PositionLineKonec = figure.SoedineniePoint("left"); lineNY.LineFourPoints(Viravnivanie.MinLeft - 35); } else { lineNY.PositionLineNachalo = cFigure.SoedineniePoint("right"); lineNY.PositionLineKonec = figure.SoedineniePoint("right"); lineNY.LineFourPoints(Viravnivanie.MaxRight + 35); } }
public static int OptimalPut(CFigure cFigure, Point position) { nachZnachMin(cFigure, position); for (int i = 1; i < 4; i++) { kvX = Math.Pow(cFigure.SerediniStoron[i].X - position.X, 2); kvY = Math.Pow(cFigure.SerediniStoron[i].Y - position.Y, 2); if (kvX + kvY < min) { min = kvX + kvY; numMin = i; } } return numMin; }
public static void PerenosLine(CFigure cFigure) { PerenosNachalaLine(cFigure); PerenosKoncaLine(cFigure); }
private static void PerenosKoncaLine(CFigure cFigure) { pereborLineNYkoncaLine(cFigure); pereborLineKoncaLine(cFigure); }
public void DragStart(int X, int Y, CFigure cFigure) { cFigure.Perenos = true; cFigure.Delta = new Point(X - cFigure.Position.X, Y - cFigure.Position.Y); }
public void Add(CFigure figure) { CFigureList.Add(figure); }
private static void PerenosNachalaLineNeRhombus(Line line, CFigure cFigure) { numMin = OptimalPut(cFigure, line.PositionLineKonec); line.PositionLineNachalo = new Point(cFigure.SerediniStoron[numMin].X, cFigure.SerediniStoron[numMin].Y); CFigure figure = CCanvas.CFigureList.Where(o => o.Id == line.IdFigureKonec).FirstOrDefault(); numMin = OptimalPut(figure, line.PositionLineNachalo); line.PositionLineKonec = new Point(figure.SerediniStoron[numMin].X, figure.SerediniStoron[numMin].Y); }
private static void figurePosleRhombusBezPerenosa(LineNY lineNY, CFigure cfigure) { //329-центр по X if (cfigure.SoedineniePoint("top").X >= 329 && cfigure.VihodLineLeft == false || cfigure.SoedineniePoint("top").X <= 329 && cfigure.VihodLineRight == true) { figureLeveeRhombus(lineNY, cfigure); } else { figurePraveeRhombus(lineNY, cfigure); } lineNY.PositionLineKonec = newCFigure.SoedineniePoint("top"); lineNY.LineThreePoints(); lineNY.SposobOtrisovki = false; newCFigure.Perenos = true; newCFigure.SerediniStoronMethPoints(); }
private static void figurePosleRhombus(LineNY lineNY, CFigure cfigure) { newCFigure = CCanvas.CFigureList.Where(o => o.Id == lineNY.IdFigureKonec).FirstOrDefault(); //линия из 3 точек if (newCFigure.Perenos == false) { figurePosleRhombusBezPerenosa(lineNY, cfigure); cnewfigureList.Add(newCFigure); } //линия из 4 точек else { PologenieLine.PositionLineFourDot(cfigure, lineNY, newCFigure); } }