Exemplo n.º 1
0
        protected virtual void LayoutMidLabel(Dot.Utility.Media.Diagram.Shapes.DiagramShape childchanged)
        {
            DiagramShape obj1 = this.MidLabel;

            if (obj1 != null)
            {
                Shapes.LineGraph link1 = this.RealLink;
                int num1 = link1.PointsCount;
                if (num1 >= 2)
                {
                    if ((link1.Style == StrokeGraphStyle.Bezier) && (num1 < 7))
                    {
                        PointF tf5;
                        PointF tf6;
                        PointF tf1 = link1.GetPoint(0);
                        PointF tf2 = link1.GetPoint(1);
                        PointF tf3 = link1.GetPoint(num1 - 2);
                        PointF tf4 = link1.GetPoint(num1 - 1);
                        StrokeGraph.BezierMidPoint(tf1, tf2, tf3, tf4, out tf5, out tf6);
                        this.PositionMidLabel(obj1, tf5, tf6);
                    }
                    else
                    {
                        int num2 = num1 / 2;
                        if ((num1 % 2) == 0)
                        {
                            PointF tf7 = link1.GetPoint(num2 - 1);
                            PointF tf8 = link1.GetPoint(num2);
                            this.PositionMidLabel(obj1, tf7, tf8);
                        }
                        else
                        {
                            PointF tf9     = link1.GetPoint(num2 - 1);
                            PointF tf10    = link1.GetPoint(num2);
                            PointF tf11    = link1.GetPoint(num2 + 1);
                            float  single1 = tf10.X - tf9.X;
                            float  single2 = tf10.Y - tf9.Y;
                            float  single3 = tf11.X - tf10.X;
                            float  single4 = tf11.Y - tf10.Y;
                            if (((single1 * single1) + (single2 * single2)) >= ((single3 * single3) + (single4 * single4)))
                            {
                                this.PositionMidLabel(obj1, tf9, tf10);
                            }
                            else
                            {
                                this.PositionMidLabel(obj1, tf10, tf11);
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
 public override void LayoutChildren(Dot.Utility.Media.Diagram.Shapes.DiagramShape childchanged)
 {
     if (!base.Initializing)
     {
         Shapes.LineGraph link1 = this.RealLink;
         if (link1 != null)
         {
             int num1 = link1.PointsCount;
             if (num1 >= 2)
             {
                 DiagramShape obj1 = this.FromLabel;
                 if (obj1 != null)
                 {
                     PointF tf1 = link1.GetPoint(0);
                     PointF tf2 = link1.GetPoint(1);
                     if (num1 == 2)
                     {
                         this.PositionEndLabel(obj1, false, tf1, tf1, tf2);
                     }
                     else
                     {
                         this.PositionEndLabel(obj1, false, tf1, tf2, link1.GetPoint(2));
                     }
                 }
                 this.LayoutMidLabel(childchanged);
                 obj1 = this.ToLabel;
                 if (obj1 != null)
                 {
                     PointF tf3 = link1.GetPoint(num1 - 1);
                     PointF tf4 = link1.GetPoint(num1 - 2);
                     if (num1 == 2)
                     {
                         this.PositionEndLabel(obj1, true, tf3, tf3, tf4);
                     }
                     else
                     {
                         this.PositionEndLabel(obj1, true, tf3, tf4, link1.GetPoint(num1 - 3));
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 3
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);
     }
 }
Exemplo n.º 4
0
 public override void AddSelectionHandles(DiagramSelection sel, Dot.Utility.Media.Diagram.Shapes.DiagramShape selectedObj)
 {
 }
Exemplo n.º 5
0
 public SelectionEventArgs(Dot.Utility.Media.Diagram.Shapes.DiagramShape DiagramShape)
 {
     this._DiagramShape = DiagramShape;
 }
Exemplo n.º 6
0
 public DiagramShapeEventArgs(Dot.Utility.Media.Diagram.Shapes.DiagramShape obj, InputEventArgs evt)
     : base(evt)
 {
     this.myObject = obj;
 }