Exemple #1
0
 // метод, добавляющий связанные с окном стрелки в массив
 public void addLinkingArrowsInList(MyArrow line)
 {
     if (Math.Abs(line.getPoint2().X - (this.border.Margin.Left + this.border.Width / 2)) < Config.getRadius() && Math.Abs(line.getPoint2().Y - this.border.Margin.Top) < Config.getRadius())
     {
         linkArrows.Add(new LinkArrow(false, line, 'T'));
     }
     else if (Math.Abs(line.getPoint2().X - (border.Margin.Left + border.Width / 2)) < Config.getRadius() && Math.Abs(line.getPoint2().Y - (border.Margin.Top + border.Height)) < Config.getRadius())
     {
         linkArrows.Add(new LinkArrow(false, line, 'B'));
     }
     else if (Math.Abs(line.getPoint1().X - (border.Margin.Left + border.Width / 2)) < Config.getRadius() && Math.Abs(line.getPoint1().Y - border.Margin.Top) < Config.getRadius())
     {
         linkArrows.Add(new LinkArrow(true, line, 'T'));
     }
     else if (Math.Abs(line.getPoint1().X - (border.Margin.Left + border.Width / 2)) < Config.getRadius() && Math.Abs(line.getPoint1().Y - (border.Margin.Top + border.Height)) < Config.getRadius())
     {
         linkArrows.Add(new LinkArrow(true, line, 'B'));
     }
     else if (Math.Abs(line.getPoint1().X - border.Margin.Left) < Config.getRadius() && Math.Abs(line.getPoint1().Y - (border.Margin.Top + border.Height / 2)) < Config.getRadius())
     {
         linkArrows.Add(new LinkArrow(true, line, 'L'));
     }
     else if (Math.Abs(line.getPoint1().X - (border.Margin.Left + border.Width)) < Config.getRadius() && Math.Abs(line.getPoint1().Y - (border.Margin.Top + border.Height / 2)) < Config.getRadius())
     {
         linkArrows.Add(new LinkArrow(true, line, 'R'));
     }
     else if (Math.Abs(line.getPoint2().X - border.Margin.Left) < Config.getRadius() && Math.Abs(line.getPoint2().Y - (border.Margin.Top + border.Height / 2)) < Config.getRadius())
     {
         linkArrows.Add(new LinkArrow(false, line, 'L'));
     }
     else if (Math.Abs(line.getPoint2().X - (border.Margin.Left + border.Width)) < Config.getRadius() && Math.Abs(line.getPoint2().Y - (border.Margin.Top + border.Height / 2)) < Config.getRadius())
     {
         linkArrows.Add(new LinkArrow(false, line, 'R'));
     }
 }
Exemple #2
0
        // статический метод, соединяющий две стрелки
        public static bool concateLines(MyArrow firstLine, MyArrow secondLine)
        {
            bool result = false;

            if (Math.Abs(firstLine.getPoint2().X - secondLine.getPoint2().X) < Config.getRadius() && Math.Abs(firstLine.getPoint2().Y - secondLine.getPoint2().Y) < Config.getRadius())
            {
                firstLine.setPoint2(secondLine.getPoint2().X + Config.getMarginLeftPanel(), secondLine.getPoint2().Y + Config.getMarginTopPanel());
                result = true;
            }
            else if (Math.Abs(firstLine.getPoint2().X - secondLine.getPoint1().X) < Config.getRadius() && Math.Abs(firstLine.getPoint2().Y - secondLine.getPoint1().Y) < Config.getRadius())
            {
                firstLine.setPoint2(secondLine.getPoint1().X + Config.getMarginLeftPanel(), secondLine.getPoint1().Y + Config.getMarginTopPanel());
                result = true;
            }
            else if (Math.Abs(firstLine.getPoint1().X - secondLine.getPoint1().X) < Config.getRadius() && Math.Abs(firstLine.getPoint1().Y - secondLine.getPoint1().Y) < Config.getRadius())
            {
                firstLine.setPoint1(secondLine.getPoint1().X + Config.getMarginLeftPanel(), secondLine.getPoint1().Y + Config.getMarginTopPanel());
                result = true;
            }
            else if (Math.Abs(firstLine.getPoint1().X - secondLine.getPoint2().X) < Config.getRadius() && Math.Abs(firstLine.getPoint1().Y - secondLine.getPoint2().Y) < Config.getRadius())
            {
                firstLine.setPoint1(secondLine.getPoint2().X + Config.getMarginLeftPanel(), secondLine.getPoint2().Y + Config.getMarginTopPanel());
                result = true;
            }
            return(result);
        }
Exemple #3
0
        // метод, соединяющий окно с линией
        public bool concateWindowWithLine(MyArrow line)
        {
            bool result = false;

            if (Math.Abs(line.getPoint2().X - (this.border.Margin.Left + this.border.Width / 2)) < Config.getRadius() && Math.Abs(line.getPoint2().Y - this.border.Margin.Top) < Config.getRadius())
            {
                line.setPoint2(this.border.Margin.Left + this.border.Width / 2 + Config.getMarginLeftPanel(), this.border.Margin.Top + Config.getMarginTopPanel());
                result = true;
            }
            else if (Math.Abs(line.getPoint2().X - (border.Margin.Left + border.Width / 2)) < Config.getRadius() && Math.Abs(line.getPoint2().Y - (border.Margin.Top + border.Height)) < Config.getRadius())
            {
                line.setPoint2(this.border.Margin.Left + this.border.Width / 2 + Config.getMarginLeftPanel(), this.border.Margin.Top + this.border.Height + Config.getMarginTopPanel());
                result = true;
            }
            else if (Math.Abs(line.getPoint1().X - (border.Margin.Left + border.Width / 2)) < Config.getRadius() && Math.Abs(line.getPoint1().Y - border.Margin.Top) < Config.getRadius())
            {
                line.setPoint1(this.border.Margin.Left + this.border.Width / 2 + Config.getMarginLeftPanel(), this.border.Margin.Top + Config.getMarginTopPanel());
                result = true;
            }
            else if (Math.Abs(line.getPoint1().X - (border.Margin.Left + border.Width / 2)) < Config.getRadius() && Math.Abs(line.getPoint1().Y - (border.Margin.Top + border.Height)) < Config.getRadius())
            {
                line.setPoint1(this.border.Margin.Left + border.Width / 2 + Config.getMarginLeftPanel(), this.border.Margin.Top + border.Height + Config.getMarginTopPanel());
                result = true;
            }
            else if (Math.Abs(line.getPoint1().X - border.Margin.Left) < Config.getRadius() && Math.Abs(line.getPoint1().Y - (border.Margin.Top + border.Height / 2)) < Config.getRadius())
            {
                line.setPoint1(this.border.Margin.Left + Config.getMarginLeftPanel(), this.border.Margin.Top + border.Height / 2 + Config.getMarginTopPanel());
                result = true;
            }
            else if (Math.Abs(line.getPoint1().X - (border.Margin.Left + border.Width)) < Config.getRadius() && Math.Abs(line.getPoint1().Y - (border.Margin.Top + border.Height / 2)) < Config.getRadius())
            {
                line.setPoint1(this.border.Margin.Left + border.Width + Config.getMarginLeftPanel(), this.border.Margin.Top + border.Height / 2 + Config.getMarginTopPanel());
                result = true;
            }
            else if (Math.Abs(line.getPoint2().X - border.Margin.Left) < Config.getRadius() && Math.Abs(line.getPoint2().Y - (border.Margin.Top + border.Height / 2)) < Config.getRadius())
            {
                line.setPoint2(this.border.Margin.Left + Config.getMarginLeftPanel(), this.border.Margin.Top + border.Height / 2 + Config.getMarginTopPanel());
                result = true;
            }
            else if (Math.Abs(line.getPoint2().X - (border.Margin.Left + border.Width)) < Config.getRadius() && Math.Abs(line.getPoint2().Y - (border.Margin.Top + border.Height / 2)) < Config.getRadius())
            {
                line.setPoint2(this.border.Margin.Left + border.Width + Config.getMarginLeftPanel(), this.border.Margin.Top + border.Height / 2 + Config.getMarginTopPanel());
                result = true;
            }

            return(result);
        }