Example #1
0
 protected virtual void PositionEndLabel(Dot.Utility.Media.Diagram.Shapes.DiagramShape lab, bool atEnd, PointF a, PointF b, PointF c)
 {
     if ((!atEnd && this.FromLabelCentered) || (atEnd && this.ToLabelCentered))
     {
         if (base.IsApprox(a.X, b.X))
         {
             if (a.Y < b.Y)
             {
                 lab.SetSpotLocation(0x20, a);
             }
             else
             {
                 lab.SetSpotLocation(0x80, a);
             }
         }
         else if (base.IsApprox(a.Y, b.Y))
         {
             if (a.X < b.X)
             {
                 lab.SetSpotLocation(0x100, a);
             }
             else
             {
                 lab.SetSpotLocation(0x40, a);
             }
         }
         else if (a.X < b.X)
         {
             if (a.Y < b.Y)
             {
                 lab.SetSpotLocation(2, a);
             }
             else
             {
                 lab.SetSpotLocation(0x10, a);
             }
         }
         else if (a.Y < b.Y)
         {
             lab.SetSpotLocation(8, a);
         }
         else
         {
             lab.SetSpotLocation(4, a);
         }
     }
     else if (a.X < b.X)
     {
         if (b.Y <= c.Y)
         {
             lab.SetSpotLocation(0x10, a);
         }
         else
         {
             lab.SetSpotLocation(2, a);
         }
     }
     else if (a.X > b.X)
     {
         if (b.Y <= c.Y)
         {
             lab.SetSpotLocation(8, a);
         }
         else
         {
             lab.SetSpotLocation(4, a);
         }
     }
     else if (a.Y < b.Y)
     {
         if (b.X <= c.X)
         {
             lab.SetSpotLocation(4, a);
         }
         else
         {
             lab.SetSpotLocation(2, a);
         }
     }
     else if (a.Y > b.Y)
     {
         if (b.X <= c.X)
         {
             lab.SetSpotLocation(8, a);
         }
         else
         {
             lab.SetSpotLocation(0x10, a);
         }
     }
     else if (b.X <= c.X)
     {
         if (b.Y <= c.Y)
         {
             lab.SetSpotLocation(0x10, b);
         }
         else
         {
             lab.SetSpotLocation(2, b);
         }
     }
     else if (b.Y <= c.Y)
     {
         lab.SetSpotLocation(8, b);
     }
     else
     {
         lab.SetSpotLocation(4, b);
     }
 }