Пример #1
0
        public static void TightUp(List <Line> lines)
        {
            int          complexId   = complexes.Count + 1;
            ComplexLines complexLine = new ComplexLines(complexId);

            foreach (Line itemToTight in lines)
            {
                itemToTight.Complex   = true;
                itemToTight.LineType  = Line.Types.Complex;
                itemToTight.ComplexID = complexId;
                itemToTight.PenColor  = ComplexLines.COMPLEX_COLOR;

                complexLine.Lines.Add(itemToTight);
                if (!complexLine.Vertexes.Contains(itemToTight.StartPoint))
                {
                    complexLine.Vertexes.Add(itemToTight.StartPoint);
                }
                if (!complexLine.Vertexes.Contains(itemToTight.EndPoint))
                {
                    complexLine.Vertexes.Add(itemToTight.EndPoint);
                }

                TreeListControl.RemoveInfoLine(itemToTight);
            }
            complexes.Add(complexLine);
            TreeListControl.AddNewInfoComplex(complexLine);
            Form1.TreeSelectedLines.Clear();
        }
Пример #2
0
 public static void RemoveInfoComplex(ComplexLines complex)
 {
     if (Enabled)
     {
         ListViewItem item = _source.FindItemWithText(complex.Id.ToString());
         _source.Items.Remove(item);
     }
 }
Пример #3
0
 public static void AddNewInfoComplex(ComplexLines complex)
 {
     if (Enabled)
     {
         ListViewItem item = new ListViewItem(complex.Id.ToString());
         item.SubItems.Add(complex.ToString());
         _source.Items.Add(item);
     }
 }
Пример #4
0
        public static void DeleteComplex(Line lineInComplex)
        {
            ComplexLines cmplx = complexes.Find(x => x.Id == lineInComplex.ComplexID);

            foreach (Line ln in cmplx.Lines)
            {
                Form1._allLines.Remove(ln);
            }
            TreeListControl.RemoveInfoComplex(cmplx);
        }
Пример #5
0
        public static void SelectComplexes(Line oneOfLines)
        {
            ComplexLines cmplx = complexes.Find(x => x.Id == oneOfLines.ComplexID);

            foreach (Line ln in cmplx.Lines)
            {
                if (!Form1.TreeSelectedLines.Contains(ln))
                {
                    Form1.TreeSelectedLines.Add(ln);
                    ln.PenColor = Line.SELECTED_COLOR;
                }
            }
        }
Пример #6
0
        public static void ComplexTransfer(MouseEventArgs e, Line oneOfLines)
        {
            ComplexLines cmplx = complexes.Find(x => x.Id == oneOfLines.ComplexID);

            foreach (Line line in cmplx.Lines)
            {
                line.DeltaStart = new Point(line.StartPoint.X - e.Location.X,
                                            line.StartPoint.Y - e.Location.Y);

                line.DeltaEnd = new Point(line.EndPoint.X - e.Location.X,
                                          line.EndPoint.Y - e.Location.Y);
            }

            Form1.WrapperForComplexlines = cmplx;
        }
Пример #7
0
        /// <summary>
        /// Заверщающий этап какого либо {ВЫБРАННОГО} действия
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void drawingPanel_MouseUp(object sender, MouseEventArgs e)
        {
            /*Завершение перемещения линии*/
            if (CURRENT_ACTION == Action.Transfer)
            {
                if (WrapperForSelectedLines != null)
                {
                    if (!WrapperForSelectedLines.Fixed)
                    {
                        WrapperForSelectedLines.PenColor = Line.GENERAL_COLOR;
                        drawingPanel.Refresh();

                        MyLogger.LogIt(
                            "Line's been transfered "
                            + WrapperForSelectedLines.Id.ToString() +
                            " |" + System.Reflection.MethodBase.GetCurrentMethod().Name.ToString()
                            + "|", MyLogger.Importance.Info
                            );
                        WrapperForSelectedLines = null;
                    }
                }
                else if (WrapperForComplexlines != null)
                {
                    WrapperForComplexlines = null;
                }
            }
            /*Завершение создания линии*/
            if (CURRENT_ACTION == Action.Draw)
            {
                Line line = _allLines.Last();
                Line.FinishDrawingLine(e, line);
                InfoPanel.lineLenghtInfo.Text = line.Length.ToString();

                /*Пополнение информационных таблиц*/
                TreeListControl.AddNewInfoLine(line);
                MyLogger.LogIt(
                    "Line's been made "
                    + line.Id.ToString() +
                    " |" + System.Reflection.MethodBase.GetCurrentMethod().Name.ToString()
                    + "|", MyLogger.Importance.Info
                    );
            }
        }