Exemplo n.º 1
0
private void ConvertOutput (StringBuffer ostr, CGNode node)
    {
	node.SortChilds ();
        String s = node.GetText();

        if (node.IsConcept()) {
            ostr.append ("[" + s + "]");
        } else {
            ostr.append ("(" + s + ")");
        }

        int nchilds = node.NumChilds();
        if (nchilds == 1) {
            ostr.append ("->");
            ConvertOutput (ostr, node.ChildAt (0));
        } else if (nchilds > 1) {
            ostr.append ("-");
            for (int i = 0; i < nchilds; ++i) {
                ostr.append ("->");
                ConvertOutput (ostr, node.ChildAt (i));
                if (i+1 != nchilds)
                    ostr.append (",");
            }
            ostr.append (".");
        }
    }
Exemplo n.º 2
0
private int LayoutPass1 (CGNode root, int y, Vector vdist, int level)
    {
	Rectangle bbox = root.Bbox();
	root.layout_y = y;
	root.SortChilds ();

	if (level >= vdist.size()) {
	    vdist.addElement (new Integer (bbox.width));
	} else {
	    int width = ((Integer)vdist.elementAt(level)).intValue();
	    if (width < bbox.width) {
		vdist.setElementAt (new Integer (bbox.width), level);
	    }
	}
	int nchilds = root.NumChilds(), y2 = y;
	for (int i = 0; i < nchilds; ++i) {
	    y2 = LayoutPass1 (root.ChildAt(i), y2, vdist, level+1);
	}
	return Math.max (y + bbox.height + layoutYDist, y2);
    }