예제 #1
0
        internal float GetEndSegmentLength(GoBoxPortLinkInfo info)
        {
            float endSegmentLength = EndSegmentLength;
            int   num = info.IndexOnSide;

            if (num < 0)
            {
                return(endSegmentLength);
            }
            int countOnSide = info.CountOnSide;

            if (countOnSide <= 1)
            {
                return(endSegmentLength);
            }
            IGoLink link = info.Link;

            if (!GoLink.IsOrtho(link))
            {
                return(endSegmentLength);
            }
            IGoPort otherPort = link.GetOtherPort(this);

            if (otherPort == null)
            {
                return(endSegmentLength);
            }
            GoObject goObject = otherPort.GoObject;

            if (goObject == null)
            {
                return(endSegmentLength);
            }
            PointF center  = goObject.Center;
            PointF center2 = base.Center;

            checked
            {
                if (info.Side == 256 || info.Side == 128)
                {
                    num = countOnSide - 1 - num;
                }
                float num2 = 8f;
                bool  flag = info.Side == 256 || info.Side == 64;
                if (flag ? (center.Y < center2.Y) : (center.X < center2.X))
                {
                    return(endSegmentLength + (float)num * num2);
                }
                if (flag ? (center.Y == center2.Y) : (center.X == center2.X))
                {
                    return(endSegmentLength);
                }
                return(endSegmentLength + (float)(countOnSide - 1 - num) * num2);
            }
        }
예제 #2
0
 /// <summary>
 /// This convenience method decides if the given link is supposed to
 /// be drawn with all of its segments orthogonal.
 /// </summary>
 /// <param name="link"></param>
 /// <returns>true if the link is believed to be drawn with orthogonal segments</returns>
 public virtual bool IsOrthogonal(IGoLink link)
 {
     return(GoLink.IsOrtho(link));
 }