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); } }
internal PointF GetSideLinkPoint(GoBoxPortLinkInfo info) { GoObject goObject = PortObject; if (goObject == null || goObject.Layer == null) { goObject = this; } PointF spotLocation; PointF spotLocation2; switch (info.Side) { case 128: spotLocation = goObject.GetSpotLocation(8); spotLocation2 = goObject.GetSpotLocation(16); break; case 256: spotLocation = goObject.GetSpotLocation(16); spotLocation2 = goObject.GetSpotLocation(2); break; case 32: spotLocation = goObject.GetSpotLocation(2); spotLocation2 = goObject.GetSpotLocation(4); break; default: spotLocation = goObject.GetSpotLocation(4); spotLocation2 = goObject.GetSpotLocation(8); break; } float num = spotLocation2.X - spotLocation.X; float num2 = spotLocation2.Y - spotLocation.Y; float num3 = ((float)info.IndexOnSide + 1f) / ((float)info.CountOnSide + 1f); return(new PointF(spotLocation.X + num * num3, spotLocation.Y + num2 * num3)); }
internal GoBoxPortLinkInfo[] GetLinkInfos() { bool flag = myReSort; myReSort = false; if (mySortedLinks == null || mySortedLinks.Length != LinksCount) { mySortedLinks = new GoBoxPortLinkInfo[LinksCount]; flag = true; } checked { if (flag && !myRespreading) { bool flag2 = myRespreading; myRespreading = true; int num = 0; foreach (IGoLink link in Links) { float direction = GetDirection(link); float num2 = GetAngle(link); int num3; if (direction != 0f) { num3 = ((direction == 90f) ? 128 : ((direction != 180f) ? 32 : 256)); } else { num3 = 64; if (num2 > 180f) { num2 -= 360f; } } GoBoxPortLinkInfo goBoxPortLinkInfo = mySortedLinks[num]; if (goBoxPortLinkInfo == null) { mySortedLinks[num] = new GoBoxPortLinkInfo(link, num2, num3); } else { goBoxPortLinkInfo.Link = link; goBoxPortLinkInfo.Angle = num2; goBoxPortLinkInfo.Side = num3; } num++; } SortLinkInfos(mySortedLinks); int num4 = mySortedLinks.Length; int num5 = -1; int num6 = 0; for (num = 0; num < num4; num++) { GoBoxPortLinkInfo goBoxPortLinkInfo2 = mySortedLinks[num]; if (goBoxPortLinkInfo2.Side != num5) { num5 = goBoxPortLinkInfo2.Side; num6 = 0; } goBoxPortLinkInfo2.IndexOnSide = num6; num6++; } num5 = -1; num6 = 0; for (num = num4 - 1; num >= 0; num--) { GoBoxPortLinkInfo goBoxPortLinkInfo3 = mySortedLinks[num]; if (goBoxPortLinkInfo3.Side != num5) { num5 = goBoxPortLinkInfo3.Side; num6 = goBoxPortLinkInfo3.IndexOnSide + 1; } goBoxPortLinkInfo3.CountOnSide = num6; } AssignLinkPoints(mySortedLinks); AssignEndSegmentLengths(mySortedLinks); myRespreading = flag2; } return(mySortedLinks); } }