From: SourceForge.net <no...@so...> - 2011-06-29 20:34:50
|
The following forum message was posted by gthaha at http://sourceforge.net/projects/jung/forums/forum/252062/topic/4589885: I have a problem dealing with the shape of the vertex. I use the following code to customize the shape of my vertex: Transformer <String, Shape> vertextShape = new Transformer <String, Shape>() { public Shape transform(String arg0) { if (change.contains(arg0)) { Point2D center = layout.transform(arg0); //System.out.println (center.toString()); Shape shape = new Ellipse2D.Double(center.getX(), center.getY(), 20, 20); return shape; } return new Ellipse2D.Double(0,0,20,20); } }; After I applied this code, the shape of vertex was changed. However, all the vertex were moved from their original location. I guess the problem is that the center point of the vertex is changed after the customized shape is applied. Could any one give me a hint on how to solve it? Thanks! |