예제 #1
0
 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);
     }
 }
예제 #2
0
 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");
 }
예제 #3
0
 private static void ifTwoDotkoncaLine(CFigure cFigure, LineNY lineNY)
 {
     if (lineNY.SposobOtrisovki == null)
     {
         perenosKoncaLineNeRhombus(lineNY, cFigure);
     }
 }
예제 #4
0
 private static void ifFourDotNachLine(CFigure cFigure, LineNY lineNY, CFigure figure)
 {
     if (lineNY.SposobOtrisovki == true)
     {
         PositionLineFourDot(cFigure, lineNY, figure);
     }
 }
예제 #5
0
 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;
 }
예제 #6
0
 private static void ifFourDotkoncaLine(CFigure cFigure, LineNY lineNY, CFigure figureNachalaLine)
 {
     if (lineNY.SposobOtrisovki == true)
     {
         PositionLineFourDot(figureNachalaLine, lineNY, cFigure);
     }
 }
예제 #7
0
 private static void ifFourDotNachLine(CFigure cFigure, LineNY lineNY, CFigure figure)
 {
     if (lineNY.SposobOtrisovki == true)
     {
         PositionLineFourDot(cFigure, lineNY, figure);
     }
 }
예제 #8
0
 private static void ifThreeDotNachLine(CFigure cFigure, LineNY lineNY, CFigure figure)
 {
     if (lineNY.SposobOtrisovki == false)
     {
         positionLineThreeDot(cFigure, lineNY, figure);
     }
 }
예제 #9
0
 private static void ifTwoDotNachLine(CFigure cFigure, LineNY lineNY)
 {
     if (lineNY.SposobOtrisovki == null)
     {
         PerenosNachalaLineNeRhombus(lineNY, cFigure);
     }
 }
예제 #10
0
 private static void pereborLinePerenosNachLine(CFigure cFigure)
 {
     foreach (Line line in CCanvas.CLineList.Where(o => o.IdFigureNachalo == cFigure.Id))
     {
         PerenosNachalaLineNeRhombus(line, cFigure);
     }
 }
예제 #11
0
 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");
 }
예제 #12
0
 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");
 }
예제 #13
0
 private static void ifFourDotkoncaLine(CFigure cFigure, LineNY lineNY, CFigure figureNachalaLine)
 {
     if (lineNY.SposobOtrisovki == true)
     {
         PositionLineFourDot(figureNachalaLine, lineNY, cFigure);
     }
 }
예제 #14
0
 private static void ifThreeDotkoncaLine(CFigure cFigure, LineNY lineNY, CFigure figureNachalaLine)
 {
     if (lineNY.SposobOtrisovki == false)//линия из 3 точек
     {
         lineNY.PositionLineKonec = cFigure.SoedineniePoint("top");
         positionLineThreeDot(figureNachalaLine, lineNY, cFigure);
     }
 }
예제 #15
0
 private void ifRadFigureChecked(CFigure cFigure, MouseEventArgs e)
 {
     if (rad_Figure.Checked)
     {
         pCanvas.DragStart(e.X, e.Y, cFigure);
         flag = true;
     }
 }
예제 #16
0
 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();
 }
예제 #17
0
 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();
     }
 }
예제 #18
0
 private static void ifThreeDotkoncaLine(CFigure cFigure, LineNY lineNY, CFigure figureNachalaLine)
 {
     if (lineNY.SposobOtrisovki == false)//линия из 3 точек
     {
         lineNY.PositionLineKonec = cFigure.SoedineniePoint("top");
         positionLineThreeDot(figureNachalaLine, lineNY, cFigure);
     }
 }
예제 #19
0
        private static void VihodOneLine(CFigure cfigure)
        {
            Line line = CCanvas.CLineList.Where(o => o.IdFigureNachalo == cfigure.Id).FirstOrDefault();

            if (line != null)
            {
                figurePosleNeRhombus(cfigure, line);
            }
        }
예제 #20
0
        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);
        }
예제 #21
0
        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;
            }
        }
예제 #22
0
        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);
            }
        }
예제 #23
0
        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);
            }
        }
예제 #24
0
        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;
            }
        }
예제 #25
0
 private static void PerenosNachalaLine(CFigure cFigure)
 {
     if (cFigure is Rhombus)
     {
         pereborLineNYperenosNachLine(cFigure);
     }
     else
     {
         pereborLinePerenosNachLine(cFigure);
     }
 }
예제 #26
0
        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);
            }
        }
예제 #27
0
 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;
     }
 }
예제 #28
0
        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);
            }
        }
예제 #29
0
        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);
        }
예제 #30
0
        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);
            }
        }
예제 #31
0
        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);
        }
예제 #32
0
        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;
            }
        }
예제 #33
0
        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();
            }
        }
예제 #34
0
 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();
         }
     }
 }
예제 #35
0
 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);
     }
 }
예제 #36
0
 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);
     }
 }
예제 #37
0
        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;
        }
예제 #38
0
 private static void pereborLinePerenosNachLine(CFigure cFigure)
 {
     foreach (Line line in CCanvas.CLineList.Where(o => o.IdFigureNachalo == cFigure.Id))
     {
         PerenosNachalaLineNeRhombus(line, cFigure);
     }
 }
예제 #39
0
 public static void PerenosLine(CFigure cFigure)
 {
     PerenosNachalaLine(cFigure);
     PerenosKoncaLine(cFigure);
 }
예제 #40
0
 private static void PerenosKoncaLine(CFigure cFigure)
 {
     pereborLineNYkoncaLine(cFigure);
     pereborLineKoncaLine(cFigure);
 }
예제 #41
0
 public void DragStart(int X, int Y, CFigure cFigure)
 {
     cFigure.Perenos = true;
     cFigure.Delta = new Point(X - cFigure.Position.X, Y - cFigure.Position.Y);
 }
예제 #42
0
 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");
 }
예제 #43
0
 private static void VihodOneLine(CFigure cfigure)
 {
     Line line = CCanvas.CLineList.Where(o => o.IdFigureNachalo == cfigure.Id).FirstOrDefault();
     if (line != null)
     {
         figurePosleNeRhombus(cfigure, line);
     }
 }
예제 #44
0
 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;
     }
 }
예제 #45
0
        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;
            }
        }
예제 #46
0
 public void Add(CFigure figure)
 {
     CFigureList.Add(figure);
 }
예제 #47
0
 private static void ifTwoDotkoncaLine(CFigure cFigure, LineNY lineNY)
 {
     if (lineNY.SposobOtrisovki == null)
     {
         perenosKoncaLineNeRhombus(lineNY, cFigure);
     }
 }
예제 #48
0
 private static void ifThreeDotNachLine(CFigure cFigure, LineNY lineNY, CFigure figure)
 {
     if (lineNY.SposobOtrisovki == false)
     {
         positionLineThreeDot(cFigure, lineNY, figure);
     }
 }
예제 #49
0
 private void ifRadFigureChecked(CFigure cFigure, MouseEventArgs e)
 {
     if (rad_Figure.Checked)
     {
         pCanvas.DragStart(e.X, e.Y, cFigure);
         flag = true;
     }
 }
예제 #50
0
 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();
 }
예제 #51
0
        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;
            }
        }
예제 #52
0
        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);
        }
예제 #53
0
        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();
        }
예제 #54
0
 private static void PerenosNachalaLine(CFigure cFigure)
 {
     if (cFigure is Rhombus)
     {
         pereborLineNYperenosNachLine(cFigure);
     }
     else
     {
         pereborLinePerenosNachLine(cFigure);
     }
 }
예제 #55
0
 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();
     }
 }
예제 #56
0
        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);
            }
        }
예제 #57
0
 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);
     }
 }
예제 #58
0
        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);
            }
        }
예제 #59
0
 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);
     }
 }
예제 #60
0
 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;
 }