예제 #1
0
        public bool CheckSelection(Point startPoint, Point endPoint, int inaccuracy)
        {
            bool selected = false;

            if (!(startPoint.X > Points[1].X + inaccuracy
                  ||
                  startPoint.Y > Points[1].Y + inaccuracy
                  ||
                  endPoint.X < Points[0].X - inaccuracy
                  ||
                  endPoint.Y < Points[0].Y - inaccuracy
                  ))
            {
                selected = true;
                if (!(startPoint.X > Points[1].X + inaccuracy
                      ||
                      startPoint.Y > Points[0].Y + inaccuracy
                      ||
                      endPoint.X < Points[0].X - inaccuracy
                      ||
                      endPoint.Y < Points[0].Y - inaccuracy
                      ))
                {
                    crntZone = BoxZones.Top;
                }
                else if (!(startPoint.X > Points[1].X + inaccuracy
                           ||
                           startPoint.Y > Points[1].Y + inaccuracy
                           ||
                           endPoint.X < Points[1].X - inaccuracy
                           ||
                           endPoint.Y < Points[0].Y - inaccuracy
                           ))
                {
                    crntZone = BoxZones.Right;
                }
                else if (!(startPoint.X > Points[1].X + inaccuracy
                           ||
                           startPoint.Y > Points[1].Y + inaccuracy
                           ||
                           endPoint.X < Points[0].X - inaccuracy
                           ||
                           endPoint.Y < Points[1].Y - inaccuracy
                           ))
                {
                    crntZone = BoxZones.Bottom;
                }
                else if (!(startPoint.X > Points[0].X + inaccuracy
                           ||
                           startPoint.Y > Points[1].Y + inaccuracy
                           ||
                           endPoint.X < Points[0].X - inaccuracy
                           ||
                           endPoint.Y < Points[0].Y - inaccuracy
                           ))
                {
                    crntZone = BoxZones.Left;
                }
                else
                {
                    crntZone = BoxZones.Center;
                }
            }

            return(selected);
        }
예제 #2
0
 public ConnectionPoint(Axis axis, BoxZones zone, int distanceInPercents)
 {
     Axis = axis;
     Zone = zone;
     DistanceInPercents = distanceInPercents;
 }