private void considerLink <T>(IGoLink l, IGoPort p, Search s, List <T> items) { bool flag = (s & Search.NotSelf) == 0; if (l.FromPort == p && (flag || l.ToPort.GoObject == null || !l.ToPort.GoObject.IsChildOf(this))) { if ((s & Search.LinksOut) != 0) { addItem(items, (T)l); } if ((s & Search.NodesOut) != 0) { addItem(items, (T)l.ToNode); } } if (l.ToPort == p && (flag || l.FromPort.GoObject == null || !l.FromPort.GoObject.IsChildOf(this))) { if ((s & Search.LinksIn) != 0) { addItem(items, (T)l); } if ((s & Search.NodesIn) != 0) { addItem(items, (T)l.FromNode); } } }
public override IGoLink CreateLink(IGoPort from, IGoPort to) { IGoLink il = base.CreateLink(from, to); if (il != null) { GoLabeledLink l = il.GoObject as GoLabeledLink; if (l != null) { GraphNode fromNode = from.Node.GoObject as GraphNode; if (fromNode != null && fromNode.Kind == GraphNodeKind.Decision) { GoText t = new GoText(); t.Text = "yes"; t.Selectable = false; t.Editable = true; l.FromLabel = t; } l.Orthogonal = true; l.Style = GoStrokeStyle.RoundedLine; l.ToArrow = true; } } return(il); }
/// <summary> /// The user can relink if the view allows it and if the handle /// found at the input event point has an ID that indicates it /// is relinkable. /// </summary> /// <returns></returns> /// <remarks> /// This calls <see cref="M:Northwoods.Go.GoToolRelinking.PickRelinkHandle(System.Drawing.PointF)" /> to find a handle. /// The <see cref="P:Northwoods.Go.IGoHandle.HandleID" /> should be either /// <see cref="F:Northwoods.Go.GoLink.RelinkableFromHandle" /> or /// <see cref="F:Northwoods.Go.GoLink.RelinkableToHandle" />. The ID also /// determines which end of the link is disconnected. /// This sets <see cref="P:Northwoods.Go.GoToolLinking.Link" /> and <see cref="P:Northwoods.Go.GoToolLinking.Forwards" /> /// properties for initializing this tool before the call to <see cref="M:Northwoods.Go.GoToolRelinking.Start" />. /// </remarks> public override bool CanStart() { if (base.FirstInput.IsContextButton) { return(false); } if (!base.View.CanLinkObjects()) { return(false); } IGoHandle goHandle = PickRelinkHandle(base.FirstInput.DocPoint); if (goHandle == null) { return(false); } if (goHandle.HandleID == 1024) { base.CurrentObject = goHandle.HandledObject; IGoLink goLink = goHandle.SelectedObject as IGoLink; if (goLink is GoLink) { GoLink goLink2 = (GoLink)goLink; if (goLink2.AbstractLink != null) { goLink = goLink2.AbstractLink; } } if (goLink == null) { return(false); } base.Link = goLink; base.Forwards = false; return(true); } if (goHandle.HandleID == 1025) { base.CurrentObject = goHandle.HandledObject; IGoLink goLink3 = goHandle.SelectedObject as IGoLink; if (goLink3 is GoLink) { GoLink goLink4 = (GoLink)goLink3; if (goLink4.AbstractLink != null) { goLink3 = goLink4.AbstractLink; } } if (goLink3 == null) { return(false); } base.Link = goLink3; base.Forwards = true; return(true); } return(false); }
private void setLinkStyle(IGoLink Ilink, Color color, int width) { var link = Ilink as GoLink; if (link != null) { link.PenColor = color; link.Pen.Width = width; } }
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); } }
public override float GetToLinkDir(IGoLink link) { if (link.FromPort == null || link.FromPort.GoObject.Center.X > this.Center.X) { return(0); } else { return(180); } }
/// <summary> /// Determine the direction for a link at this port. /// </summary> /// <param name="link"></param> /// <returns>the angle in degrees</returns> public virtual float GetDirection(IGoLink link) { if (link == null) { return(0f); } if (link.FromPort == this) { return(GetFromLinkDir(link)); } return(GetToLinkDir(link)); }
// sorting links by angle shouldn't be confused by whether it's // inside or outside of the CustomSubGraph public override float GetDirection(IGoLink link) { if (link == null) { return(0); } if (link.FromPort == this) { return(base.GetFromLinkDir(link)); } else { return(base.GetToLinkDir(link)); } }
private JournalPageNode getParentNodeFromLink(IGoLink goLink) { if (goLink.FromPort == null || goLink.ToPort == null) { return(null); } // connecting to the child port of the other node (means the other node is the parent) if (goLink.FromPort is JournalChildPort) { return((JournalPageNode)goLink.FromPort.Node); } return((JournalPageNode)goLink.ToPort.Node); }
// links within the subgraph connect to the CustomSubGraphPort/GoBoxPort from the inside public override float GetToLinkDir(IGoLink link) { float result = base.GetToLinkDir(link); if (link.FromPort != null && link.FromPort.GoObject != null && link.FromPort.GoObject.IsChildOf(Parent)) { result += 180; if (result > 360) { result -= 360; } } return(result); }
/// <summary> /// Determine the angle the port at the other end makes with this port. /// </summary> /// <param name="link"></param> /// <returns>the angle in degrees</returns> public virtual float GetAngle(IGoLink link) { if (link == null) { return(0f); } IGoPort goPort = link.GetOtherPort(this); if (goPort == null) { if (link.FromPort != null && link.FromPort.GoObject != null && link.FromPort.GoObject.Bounds == Bounds) { goPort = link.ToPort; } else if (link.ToPort != null && link.ToPort.GoObject != null && link.ToPort.GoObject.Bounds == Bounds) { goPort = link.FromPort; } } if (goPort == null) { return(0f); } GoObject goObject = goPort.GoObject; if (goObject == null) { return(0f); } PointF pointF = goObject.Center; PointF center = base.Center; GoLink goLink = link as GoLink; if (goLink == null) { GoLabeledLink goLabeledLink = link as GoLabeledLink; if (goLabeledLink != null) { goLink = goLabeledLink.RealLink; } } if (goLink != null && goLink.PointsCount > 0) { pointF = ((goLink.FromPort != goPort) ? goLink.GetPoint(checked (goLink.PointsCount - 1)) : goLink.GetPoint(0)); } return(GoStroke.GetAngle(pointF.X - center.X, pointF.Y - center.Y)); }
/// <summary> /// Make sure each link, either directly in the given collection, or connected to the nodes in /// the given collection, belong to the appropriate <see cref="T:Northwoods.Go.GoSubGraphBase" />. /// </summary> /// <param name="coll"></param> /// <param name="behind">whether to add the <paramref name="coll" /> at the beginning of the list /// of the subgraph's children (thus behind all other subgraph children), or at the end of the list /// (thus appearing in front of all the other subgraph children)</param> /// <param name="layer">the <see cref="T:Northwoods.Go.GoLayer" /> for links whose ports do not both belong to a <see cref="T:Northwoods.Go.GoSubGraphBase" /></param> /// <remarks> /// This calls <see cref="M:Northwoods.Go.GoSubGraphBase.ReparentToCommonSubGraph(Northwoods.Go.GoObject,Northwoods.Go.GoObject,Northwoods.Go.GoObject,System.Boolean,Northwoods.Go.GoLayer)" /> for each <see cref="T:Northwoods.Go.IGoLink" /> in the /// <paramref name="coll" /> collection, or for each <see cref="T:Northwoods.Go.IGoLink" /> connected to each <see cref="T:Northwoods.Go.IGoNode" /> /// in the <paramref name="coll" /> collection. /// </remarks> public static void ReparentAllLinksToSubGraphs(IGoCollection coll, bool behind, GoLayer layer) { GoCollection goCollection = new GoCollection(); foreach (GoObject item in coll) { goCollection.Add(item); } foreach (GoObject item2 in goCollection) { IGoNode goNode = item2 as IGoNode; if (goNode != null) { foreach (IGoLink link in goNode.Links) { if (link != null && link.FromPort != null && link.ToPort != null) { ReparentToCommonSubGraph(link.GoObject, link.FromPort.GoObject, link.ToPort.GoObject, behind, layer); } } } else { IGoPort goPort = item2 as IGoPort; if (goPort != null) { foreach (IGoLink link2 in goPort.Links) { if (link2 != null && link2.FromPort != null && link2.ToPort != null) { ReparentToCommonSubGraph(link2.GoObject, link2.FromPort.GoObject, link2.ToPort.GoObject, behind, layer); } } } else { IGoLink goLink = item2 as IGoLink; if (goLink != null && goLink.FromPort != null && goLink.ToPort != null) { ReparentToCommonSubGraph(goLink.GoObject, goLink.FromPort.GoObject, goLink.ToPort.GoObject, behind, layer); } } } } }
public override PointF GetToLinkPoint(IGoLink link) { Message m = link as Message; Lifeline line = this.Parent as Lifeline; if (m != null && m.FromPort != null) { PointF p = line.GetStepPoint(m.Step); Activation act = line.FindActivation(m.Step); if (act != null) { p.X += ((m.FromPort.GoObject.Center.X > p.X) ? act.Width / 2 : -act.Width / 2); } return(p); } else { return(base.GetToLinkPoint(link)); } }
private float GetEndSegmentLength(IGoLink link) { float endSegmentLength = EndSegmentLength; if (link == null) { return(endSegmentLength); } if (LinkPointsSpread) { GoBoxPortLinkInfo[] linkInfos = GetLinkInfos(); foreach (GoBoxPortLinkInfo goBoxPortLinkInfo in linkInfos) { if (goBoxPortLinkInfo.Link == link) { return(goBoxPortLinkInfo.EndSegmentLength); } } } return(endSegmentLength); }
public override void DoMouseDown() { if (this.Predecessor == null) { FlowBlock gn = this.View.PickObject(true, false, this.LastInput.DocPoint, true) as FlowBlock; if (gn == null) { return; } if (!gn.IsPredecessor) { return; } this.Predecessor = gn; MainBase.App.SetStatusMessage("From block " + this.Predecessor.Text); MakeTemporaryLink(); } else { FlowBlock gn = this.View.PickObject(true, false, this.LastInput.DocPoint, true) as FlowBlock; if (gn != null && gn != this.Predecessor && !FlowView.IsLinked(this.Predecessor, gn)) { // delete the temporary link this.View.Layers.Default.Remove(myLink); myLink = null; // create the link in the design GoPort nearest = FindNearestPort(this.LastInput.DocPoint, gn); IGoLink link = this.View.CreateLink(this.Predecessor.BottomPort, nearest); if (link != null) { this.TransactionResult = "New link"; this.View.RaiseLinkCreated(link.GoObject); this.View.Selection.Select(link.GoObject); } StopTool(); } } }
public override void DoMouseDown() { if (this.Predecessor == null) { GraphNode gn = this.View.PickObject(true, false, this.LastInput.DocPoint, true) as GraphNode; if (gn == null) { return; } if (!gn.IsPredecessor) { return; } this.Predecessor = gn; MainForm.App.SetStatusMessage("Predecessor will be " + this.Predecessor.Text); MakeTemporaryLink(); } else { GraphNode gn = this.View.PickObject(true, false, this.LastInput.DocPoint, true) as GraphNode; if (gn != null && gn != this.Predecessor && !GraphView.IsLinked(this.Predecessor, gn)) { // get rid of the temporary link this.View.Layers.Default.Remove(myLink); myLink = null; // create the link in the document GoPort nearest = FindNearestPort(this.LastInput.DocPoint, gn); IGoLink link = this.View.CreateLink(this.Predecessor.BottomPort, nearest); if (link != null) { this.TransactionResult = "New Relationship"; this.View.RaiseLinkCreated(link.GoObject); this.View.Selection.Select(link.GoObject); } StopTool(); } } }
public void CreateRelationshipsAmongSelection() { GraphNode boss = this.Selection.Primary as GraphNode; if (boss != null) { if (boss.BottomPort == null) { MessageBox.Show(this, "Cannot create relationship originating from this node.", "Error", MessageBoxButtons.OK); } else { StartTransaction(); foreach (GoObject obj in this.Selection) { GraphNode n = obj as GraphNode; if (n != null && n != boss && !IsLinked(boss, n)) { if (n.TopPort == null) { MessageBox.Show(this, "Cannot create relationship concluding with this node.", "Error", MessageBoxButtons.OK); } else { IGoLink l = CreateLink(boss.BottomPort, n.TopPort); if (l != null) { this.Document.Add(l.GoObject); RaiseLinkCreated(l.GoObject); } } } } FinishTransaction("Created relationships among selection"); } } }
public override IGoLink CreateLink(IGoPort from, IGoPort to) { IGoLink il = base.CreateLink(from, to); if (il != null) { GoLabeledLink l = il.GoObject as GoLabeledLink; if (l != null) { FlowBlock fromNode = from.Node.GoObject as FlowBlock; if (fromNode != null && fromNode.Kind == BlockType.Condition) { GoText t = new GoText(); t.Text = "yes"; t.Selectable = false; t.Editable = true; l.FromLabel = t; } //l.Orthogonal = true; //l.Style = GoStrokeStyle.RoundedLine; //l.ToArrow = true; } } return il; }
public override IGoLink CreateLink(IGoPort from, IGoPort to) { IGoLink il = base.CreateLink(from, to); if (il != null) { GoLabeledLink l = il.GoObject as GoLabeledLink; if (l != null) { GraphNode fromNode = from.Node.GoObject as GraphNode; if (fromNode != null /* && fromNode.Kind == "Decision"*/) { GoText t = new GoText(); t.Text = ""; t.Selectable = false; t.Editable = true; l.MidLabel = t; //(l as GraphLink).FromOrTo = "To"; } //GraphNode toNode = to.Node.GoObject as GraphNode;//bylzydecision //if (toNode != null && toNode.Kind == "Decision") //{ // GoText t = new GoText(); // t.Text = "y"; // t.Selectable = false; // t.Editable = true; // l.MidLabel = t; // //(l as GraphLink).FromOrTo = "From"; //} //l.Orthogonal = true; //l.Style = GoStrokeStyle.RoundedLine; //l.ToArrow = true; } } return(il); }
public void CreateRelationshipsAmongSelection() { FlowBlock boss = this.Selection.Primary as FlowBlock; if (boss != null) { if (boss.BottomPort == null) { MessageBox.Show(this, "Cannot create link originating from this block.", "Error", MessageBoxButtons.OK); } else { StartTransaction(); foreach (GoObject obj in this.Selection) { FlowBlock n = obj as FlowBlock; if (n != null && n != boss && !IsLinked(boss, n)) { if (n.TopPort == null) { MessageBox.Show(this, "Cannot create link finishing with this block.", "Error", MessageBoxButtons.OK); } else { IGoLink l = CreateLink(boss.BottomPort, n.TopPort); if (l != null) { this.Document.Add(l.GoObject); RaiseLinkCreated(l.GoObject); } } } } FinishTransaction("Create links among selection blocks"); } } }
/// <summary> /// Override the calculation of the link point to take into account /// the size of any port label, so the link does not overlap the label. /// </summary> /// <param name="link"></param> /// <returns></returns> public override PointF GetToLinkPoint(IGoLink link) { return(GetLinkPoint(ToSpot)); }
/// <summary> /// Override the calculation of the link point to take into account /// the size of any port label, so the link does not overlap the label. /// </summary> /// <param name="link"></param> /// <returns></returns> public override PointF GetFromLinkPoint(IGoLink link) { return(GetLinkPoint(FromSpot)); }
public override PointF GetToLinkPoint(IGoLink link) { Message m = link as Message; Lifeline line = this.Parent as Lifeline; if (m != null && m.FromPort != null) { PointF p = line.GetStepPoint(m.Step); Activation act = line.FindActivation(m.Step); if (act != null) { p.X += ((m.FromPort.GoObject.Center.X > p.X) ? act.Width/2 : -act.Width/2); } return p; } else { return base.GetToLinkPoint(link); } }
/// <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)); }
/// <summary> /// Make sure the link is coming in perpendicularly to the /// sides of the port. /// </summary> /// <param name="link"></param> /// <returns>the angle in degrees</returns> public override float GetToLinkDir(IGoLink link) { if (ToSpot != 0 && ToSpot != 1) { return(GetLinkDir(ToSpot)); } GoObject goObject = PortObject; if (goObject == null || goObject.Layer == null) { goObject = this; } int num = ToSides; if (LinkPointsSpread && !myRespreading) { GoBoxPortLinkInfo[] linkInfos = GetLinkInfos(); foreach (GoBoxPortLinkInfo goBoxPortLinkInfo in linkInfos) { if (goBoxPortLinkInfo.Link == link) { num = goBoxPortLinkInfo.Side; } } } switch (num) { case 128: return(90f); case 256: return(180f); case 32: return(270f); case 64: return(0f); default: { float num2 = GetAngle(link); switch (num) { case 160: if (num2 > 180f) { return(270f); } return(90f); case 320: if (num2 > 90f && num2 <= 270f) { return(180f); } return(0f); default: { float num3 = (float)(Math.Atan2(goObject.Height, goObject.Width) * 180.0 / Math.PI); switch (num) { case 288: if (num2 > num3 && num2 <= 180f + num3) { return(180f); } return(270f); case 96: if (num2 > 180f - num3 && num2 <= 360f - num3) { return(270f); } return(0f); case 192: if (num2 > num3 && num2 <= 180f + num3) { return(90f); } return(0f); case 384: if (num2 > 180f - num3 && num2 <= 360f - num3) { return(180f); } return(90f); case 352: if (num2 > 90f && num2 <= 180f + num3) { return(180f); } if (num2 > 180f + num3 && num2 <= 360f - num3) { return(270f); } return(0f); case 224: if (num2 > 180f && num2 <= 360f - num3) { return(270f); } if (num2 > num3 && num2 <= 180f) { return(90f); } return(0f); case 448: if (num2 > num3 && num2 <= 180f - num3) { return(90f); } if (num2 > 180f - num3 && num2 <= 270f) { return(180f); } return(0f); case 416: if (num2 > 180f - num3 && num2 <= 180f + num3) { return(180f); } if (num2 > 180f + num3) { return(270f); } return(90f); default: if (IsOrthogonal(link) && num != 480) { num2 += 15f; if (num2 >= 360f) { num2 -= 360f; } } if (num2 > num3 && num2 < 180f - num3) { return(90f); } if (num2 >= 180f - num3 && num2 <= 180f + num3) { return(180f); } if (num2 > 180f + num3 && num2 < 360f - num3) { return(270f); } return(0f); } } } } } }
/// <summary> /// Be a little smarter about customizing the end-segment-length /// value used for the multiple links connected to the same side, /// to reduce the chances of overlapping segments of orthogonal /// links in some circumstances. /// </summary> /// <param name="link"></param> /// <returns> /// By default, the value of <see cref="P:Northwoods.Go.GoPort.EndSegmentLength" />, /// or a larger value to help position the adjacent segment of /// standard orthogonal links at different positions. /// </returns> public override float GetToEndSegmentLength(IGoLink link) { return(GetEndSegmentLength(link)); }
private IGoLink PickLinkFromConditionBlock(List<IGoLink> OutLinks, VarInfo blockResult, out string ErrorReport) { IGoLink pickedLink = null; ErrorReport = ""; int countElement = OutLinks.Count; // check for duplicated link value: for(int i=0; i<countElement-1; i++) for(int j=i+1; j<countElement; j++) { string linkValue1 = ( (OutLinks[i] as GoLabeledLink).FromLabel as GoText).Text; linkValue1 = linkValue1.ToUpper(); linkValue1 = FlowDataManager.RemoveSpacing(linkValue1); if (linkValue1 == "") { ErrorReport = "Error: Blank out-link label"; return null; } if (linkValue1[0] >= 'A' && linkValue1[0] <= 'Z') linkValue1 = "$" + linkValue1; string linkValue2 = ( (OutLinks[j] as GoLabeledLink).FromLabel as GoText).Text; linkValue2 = linkValue2.ToUpper(); linkValue2 = FlowDataManager.RemoveSpacing(linkValue2); if (linkValue2 == "") { ErrorReport = "Error: Blank out-link label"; return null; } if (linkValue2[0]>='A' && linkValue2[0]<='Z') linkValue2 = "$" + linkValue2; if(linkValue1 == "$ELSE") { pickedLink = OutLinks[i]; } if(linkValue2 == "$ELSE") { pickedLink = OutLinks[j]; } if(linkValue1 == "$ELSE" && linkValue2 == "$ELSE") { ErrorReport = "Error: Duplicated out link label/value: ELSE"; return null; } VarInfo linkVar1 = FlowDataManager.HandleConst(linkValue1); VarInfo linkvar2 = FlowDataManager.HandleConst(linkValue2); if( VarInfo.IsEqual(linkVar1,linkvar2) ) { ErrorReport = "Error: Duplicated out link label/value: " + linkValue1; return null; } } // check all valid links foreach(IGoLink link in OutLinks) { string linkValue = ( (link as GoLabeledLink).FromLabel as GoText).Text; linkValue = linkValue.ToUpper(); linkValue = FlowDataManager.RemoveSpacing(linkValue); if (linkValue == "") { ErrorReport = "Error: Blank out-link label"; return null; } if (linkValue[0]>='A' && linkValue[0]<='Z') linkValue = "$" + linkValue; if(linkValue == "$ELSE") { continue; } VarInfo tempVar = FlowDataManager.HandleConst(linkValue); if(tempVar.isNull) { ErrorReport = "Error: Illegal out-link label: " + linkValue; return null; } if( VarInfo.IsEqual(tempVar, blockResult) ) { pickedLink = link; } } if(pickedLink == null) { ErrorReport = "Error: Couldn't find a label that matches value: " + blockResult.value; return null; } return pickedLink; }
internal GoBoxPortLinkInfo(IGoLink l, float a, int s) { myLink = l; myAngle = a; mySide = s; }
/// <summary> /// Determine the link point by judging where the link is coming /// from, and at what angle. /// </summary> /// <param name="link"></param> /// <returns>a <c>PointF</c> on the edge of the port, in document coordinates</returns> public override PointF GetToLinkPoint(IGoLink link) { GoObject goObject = PortObject; if (goObject == null || goObject.Layer == null) { goObject = this; } if (ToSpot != 0 && ToSpot != 1) { return(goObject.GetSpotLocation(ToSpot)); } if (link == null || link.GoObject == null) { return(goObject.Center); } if (LinkPointsSpread) { GoBoxPortLinkInfo[] linkInfos = GetLinkInfos(); foreach (GoBoxPortLinkInfo goBoxPortLinkInfo in linkInfos) { if (goBoxPortLinkInfo.Link == link) { return(goBoxPortLinkInfo.LinkPoint); } } } int toSides = ToSides; switch (toSides) { case 128: return(goObject.GetSpotLocation(128)); case 256: return(goObject.GetSpotLocation(256)); case 32: return(goObject.GetSpotLocation(32)); case 64: return(goObject.GetSpotLocation(64)); default: { float num = GetAngle(link); switch (toSides) { case 160: if (num > 180f) { return(goObject.GetSpotLocation(32)); } return(goObject.GetSpotLocation(128)); case 320: if (num > 90f && num <= 270f) { return(goObject.GetSpotLocation(256)); } return(goObject.GetSpotLocation(64)); default: { float num2 = (float)(Math.Atan2(goObject.Height, goObject.Width) * 180.0 / Math.PI); switch (toSides) { case 288: if (num > num2 && num <= 180f + num2) { return(goObject.GetSpotLocation(256)); } return(goObject.GetSpotLocation(32)); case 96: if (num > 180f - num2 && num <= 360f - num2) { return(goObject.GetSpotLocation(32)); } return(goObject.GetSpotLocation(64)); case 192: if (num > num2 && num <= 180f + num2) { return(goObject.GetSpotLocation(128)); } return(goObject.GetSpotLocation(64)); case 384: if (num > 180f - num2 && num <= 360f - num2) { return(goObject.GetSpotLocation(256)); } return(goObject.GetSpotLocation(128)); case 352: if (num > 90f && num <= 180f + num2) { return(goObject.GetSpotLocation(256)); } if (num > 180f + num2 && num <= 360f - num2) { return(goObject.GetSpotLocation(32)); } return(goObject.GetSpotLocation(64)); case 224: if (num > 180f && num <= 360f - num2) { return(goObject.GetSpotLocation(32)); } if (num > num2 && num <= 180f) { return(goObject.GetSpotLocation(128)); } return(goObject.GetSpotLocation(64)); case 448: if (num > num2 && num <= 180f - num2) { return(goObject.GetSpotLocation(128)); } if (num > 180f - num2 && num <= 270f) { return(goObject.GetSpotLocation(256)); } return(goObject.GetSpotLocation(64)); case 416: if (num > 180f - num2 && num <= 180f + num2) { return(goObject.GetSpotLocation(256)); } if (num > 180f + num2) { return(goObject.GetSpotLocation(32)); } return(goObject.GetSpotLocation(128)); default: { if (IsOrthogonal(link) && toSides != 480) { num += 15f; if (num >= 360f) { num -= 360f; } } int num3 = 1; num3 = ((num > num2 && num < 180f - num2) ? 128 : ((num >= 180f - num2 && num <= 180f + num2) ? 256 : ((!(num > 180f + num2) || !(num < 360f - num2)) ? 64 : 32))); return(goObject.GetSpotLocation(num3)); } } } } } } }
public override float GetToLinkDir(IGoLink link) { if (link.FromPort == null || link.FromPort.GoObject.Center.X > this.Center.X) return 0; else return 180; }