/** * @param root * @throws IOException */ private static void addNode( BufferedWriter out, FeatureType ft ) throws IOException { if ( ft != null ) { String dotName = dotName( ft ); List<String> attributes = createAttributes( ft ); List<PropertyType> pd = ft.getPropertyDeclarations(); StringBuilder sb = new StringBuilder( "tooltip=\"" ); if ( pd != null && !pd.isEmpty() ) { Iterator<PropertyType> it = pd.iterator(); while ( it.hasNext() ) { sb.append( dotName( it.next().getName() ) ); if ( it.hasNext() ) { sb.append( ",<br/>" ); } } } sb.append( "\"" ); attributes.add( sb.toString() ); GraphvizDot.writeVertex( dotName, attributes, out ); } }
/** * @param out * @param id * @param level * @param sonID * @throws IOException */ public void outputAsDot( Writer out, String id, int level, int sonID ) throws IOException { if ( isLeaf() ) { GraphvizDot.writeVertex( id, getDotVertex( level, sonID, true ), out ); } else { GraphvizDot.writeVertex( id, getDotVertex( level, sonID, false ), out ); for ( int i = 0; i < 4; ++i ) { QTree<T> child = children[i]; if ( child != null ) { String newID = id + i; child.outputAsDot( out, newID, level + 1, i ); GraphvizDot.writeEdge( id, newID, null, out ); } } } }
attribs.add( GraphvizDot.getShapeDef( "diamond" ) ); attribs.add( GraphvizDot.getFillColorDef( "green" ) ); GraphvizDot.writeVertex( "feature", attribs, out );