protected internal virtual Shape makeShapeFromNode(ViewGraphNode act, LinkedList queue) { System.Drawing.Color bg = getBackgroundColorForNode(act); System.Drawing.Color border = getBorderColorForNode(act); System.String desc = ""; BaseNode reteNode = act.ReteNode; HashSet terminalNodes = new HashSet(); getCorrespondingTerminalNodes(act, terminalNodes); if (reteNode != null) desc = reteNode.NodeId.ToString(); Shape s; if (reteNode == null) { // ROOT NODE s = new Ellipse(); } else if (reteNode is BaseJoin || act.ReteNode is BaseAlpha2) { s = new Trapezoid(); } else if (reteNode is TerminalNode) { s = new RoundedRectangle(); } else if (reteNode is LIANode) { s = new Ellipse(); } else { s = new Rectangle(); } s.Bgcolor = bg; s.Bordercolor = border; //UPGRADE_WARNING: Narrowing conversions may produce unexpected results in C#. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1042"' int x = (spaceHorizontal / 2) + (int) ((float) (act.X * (spaceHorizontal + nodeHorizontal)) / 2.0); int y = (spaceVertical / 2) + act.Y * (spaceVertical + nodeVertical); System.String key = x + "," + y; // if there is already a node at the given location, we shift it right while (this.coordinates.ContainsKey(key)) { x = x + ((spaceHorizontal + nodeHorizontal) * 2); key = x + "," + y; } SupportClass.PutElement(coordinates, key, s); s.X = x; s.Y = y; s.Width = nodeHorizontal; s.Height = nodeVertical; System.String longdesc = ""; if (reteNode == null) { longdesc = "Root Node"; } else { longdesc = "ID:" + reteNode.NodeId + " NodeType:" + reteNode.GetType().FullName; longdesc += " Details:" + reteNode.toPPString(); } longdesc += " Rules:"; Iterator iter = terminalNodes.iterator(); while (iter.hasNext()) { TerminalNode t = (TerminalNode) iter.next(); longdesc += t.Rule.Name; if (iter.hasNext()) longdesc += ";"; } s.LongDescription = longdesc; if (reteNode is LIANode) s.incWidth(- nodeHorizontal / 3); s.Text = desc; act.Shape = s; addPrimitive(s); for (Iterator it = act.Successors.iterator(); it.hasNext(); ) { ViewGraphNode n = (ViewGraphNode) it.next(); queue.add(n); } return s; }
protected internal virtual Shape makeShapeFromNode(ViewGraphNode act, LinkedList queue) { System.Drawing.Color bg = getBackgroundColorForNode(act); System.Drawing.Color border = getBorderColorForNode(act); System.String desc = ""; BaseNode reteNode = act.ReteNode; HashSet terminalNodes = new HashSet(); getCorrespondingTerminalNodes(act, terminalNodes); if (reteNode != null) { desc = reteNode.NodeId.ToString(); } Shape s; if (reteNode == null) { // ROOT NODE s = new Ellipse(); } else if (reteNode is BaseJoin || act.ReteNode is BaseAlpha2) { s = new Trapezoid(); } else if (reteNode is TerminalNode) { s = new RoundedRectangle(); } else if (reteNode is LIANode) { s = new Ellipse(); } else { s = new Rectangle(); } s.Bgcolor = bg; s.Bordercolor = border; //UPGRADE_WARNING: Narrowing conversions may produce unexpected results in C#. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1042"' int x = (spaceHorizontal / 2) + (int)((float)(act.X * (spaceHorizontal + nodeHorizontal)) / 2.0); int y = (spaceVertical / 2) + act.Y * (spaceVertical + nodeVertical); System.String key = x + "," + y; // if there is already a node at the given location, we shift it right while (this.coordinates.ContainsKey(key)) { x = x + ((spaceHorizontal + nodeHorizontal) * 2); key = x + "," + y; } SupportClass.PutElement(coordinates, key, s); s.X = x; s.Y = y; s.Width = nodeHorizontal; s.Height = nodeVertical; System.String longdesc = ""; if (reteNode == null) { longdesc = "Root Node"; } else { longdesc = "ID:" + reteNode.NodeId + " NodeType:" + reteNode.GetType().FullName; longdesc += " Details:" + reteNode.toPPString(); } longdesc += " Rules:"; Iterator iter = terminalNodes.iterator(); while (iter.hasNext()) { TerminalNode t = (TerminalNode)iter.next(); longdesc += t.Rule.Name; if (iter.hasNext()) { longdesc += ";"; } } s.LongDescription = longdesc; if (reteNode is LIANode) { s.incWidth(-nodeHorizontal / 3); } s.Text = desc; act.Shape = s; addPrimitive(s); for (Iterator it = act.Successors.iterator(); it.hasNext();) { ViewGraphNode n = (ViewGraphNode)it.next(); queue.add(n); } return(s); }