Ejemplo n.º 1
0
        public static Point GetAnchorCoords(ClientLinkable end, AnchorPoint anchorPoint)
        {
            var border = end.GetBounds();

            border.Inflate(20, 20);
            switch (anchorPoint)
            {
            case AnchorPoint.TopLeft:
                return(border.TopLeft);

            case AnchorPoint.TopCenter:
                return(new Point(border.X + border.Width / 2, border.Y));

            case AnchorPoint.TopRight:
                return(border.TopRight);

            case AnchorPoint.LeftCenter:
                return(new Point(border.X, border.Y + border.Height / 2));

            case AnchorPoint.BottomLeft:
                return(border.BottomLeft);

            case AnchorPoint.BottomCenter:
                return(new Point(border.X + border.Width / 2, border.Y + border.Height));

            case AnchorPoint.BottomRight:
                return(border.BottomRight);

            case AnchorPoint.RightCenter:
                return(new Point(border.X + border.Width, border.Y + border.Height / 2));

            default:
                throw new NotSupportedException();
            }
        }
Ejemplo n.º 2
0
        public static void GetLinkPoints(ClientLinkable s, ClientLinkable t,
                                         out double x1, out double y1,
                                         out double x2, out double y2)
        {
            x1 = 0;
            y1 = 0;
            x2 = 0;
            y2 = 0;

            var sBounds = s.GetBounds();
            //  sBounds.Inflate(10,10);
            //  sBounds.X += 5;
            //  sBounds.Y += 15;

            var tBounds = t.GetBounds();
            // tBounds.Inflate(10,10);
            // tBounds.X += 5;
            //   tBounds.Y += 15;

            //c is point center of <s-t>, lambda is in [0,1]
            var xs = sBounds.X + sBounds.Width / 2;
            var ys = sBounds.Y + sBounds.Height / 2;

            var xt = tBounds.X + tBounds.Width / 2;
            var yt = tBounds.Y + tBounds.Height / 2;

            var xc = (xs + xt) * 0.5;
            var yc = (ys + yt) * 0.5;

            //s-anchor
            EdgeFinder((double x, double y) => sBounds.Contains(x, y),
                       xs, ys, xc, yc, 5, out x1, out y1);

            //t-anchor
            EdgeFinder((double x, double y) => tBounds.Contains(x, y),
                       xt, yt, xc, yc, 5, out x2, out y2);
        }
Ejemplo n.º 3
0
 public override Rect ReportingBoundsProvider()
 {
     return(Rect.Union(_end1.GetBounds(), _end2.GetBounds()));
 }
Ejemplo n.º 4
0
        public static void GetLinkPoints(ClientLinkable s, ClientLinkable t, 
                                         out double x1, out double y1, 
                                         out double x2, out double y2)
        {
            x1 = 0;
            y1 = 0;
            x2 = 0;
            y2 = 0;

            var sBounds = s.GetBounds();
          //  sBounds.Inflate(10,10);
          //  sBounds.X += 5;
          //  sBounds.Y += 15;

            var tBounds = t.GetBounds();
           // tBounds.Inflate(10,10); 
           // tBounds.X += 5;
         //   tBounds.Y += 15;
         
            //c is point center of <s-t>, lambda is in [0,1]
            var xs = sBounds.X + sBounds.Width/2;
            var ys = sBounds.Y + sBounds.Height/2;
            
            var xt = tBounds.X + tBounds.Width / 2;
            var yt = tBounds.Y + tBounds.Height / 2;

            var xc = (xs + xt) * 0.5;
            var yc = (ys + yt) * 0.5;

            //s-anchor
            EdgeFinder((double x, double y)=>sBounds.Contains(x, y),
                       xs, ys, xc, yc, 5, out x1, out y1);

            //t-anchor
            EdgeFinder((double x, double y) => tBounds.Contains(x, y),
                       xt, yt, xc, yc, 5, out x2, out y2);
        }
Ejemplo n.º 5
0
 public static Point GetAnchorCoords(ClientLinkable end, AnchorPoint anchorPoint)
 {
     var border = end.GetBounds();
     border.Inflate(20,20);
     switch (anchorPoint)
     {
         case AnchorPoint.TopLeft:
             return border.TopLeft;
         case AnchorPoint.TopCenter:
             return new Point(border.X + border.Width / 2, border.Y);
         case AnchorPoint.TopRight:
             return border.TopRight;
         case AnchorPoint.LeftCenter:
             return new Point(border.X, border.Y + border.Height / 2);
         case AnchorPoint.BottomLeft:
             return border.BottomLeft;
         case AnchorPoint.BottomCenter:
             return new Point(border.X + border.Width / 2, border.Y + border.Height);
         case AnchorPoint.BottomRight:
             return border.BottomRight;
         case AnchorPoint.RightCenter:
             return new Point(border.X + border.Width, border.Y + border.Height / 2);
         default:
             throw new NotSupportedException();
     }
 }