[graphl-cvs] graphl/src/org/mediavirus/graphl/layout AbsoluteNodeLayouter.java Layouter.java Spring
Status: Pre-Alpha
Brought to you by:
flo1
From: Flo L. <fl...@us...> - 2006-06-30 14:32:14
|
Update of /cvsroot/graphl/graphl/src/org/mediavirus/graphl/layout In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv11488/src/org/mediavirus/graphl/layout Modified Files: AbsoluteNodeLayouter.java Layouter.java SpringEdgeLayouter.java Log Message: - migrated from jxpath to jaxen, which gives a much cleaner implementation of custom axes Index: Layouter.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/layout/Layouter.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Layouter.java 30 Nov 2004 09:38:32 -0000 1.4 --- Layouter.java 30 Jun 2006 14:31:38 -0000 1.5 *************** *** 48,52 **** t.interrupt(); try { ! t.join(); } catch (InterruptedException ignored) { --- 48,53 ---- t.interrupt(); try { ! //hack: omitting the timeout my result in a deadlock here - have to investigate! ! t.join(500); } catch (InterruptedException ignored) { Index: AbsoluteNodeLayouter.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/layout/AbsoluteNodeLayouter.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** AbsoluteNodeLayouter.java 8 Jun 2006 13:14:57 -0000 1.10 --- AbsoluteNodeLayouter.java 30 Jun 2006 14:31:38 -0000 1.11 *************** *** 10,16 **** import java.util.Map; - import org.apache.commons.jxpath.JXPathContext; import org.mediavirus.graphl.graph.Node; - import org.mediavirus.graphl.jxpath.JXPathFactory; import org.mediavirus.graphl.layout.GraphlLayoutStrategy.GraphManager; import org.mediavirus.graphl.view.AbstractFacet; --- 10,14 ---- *************** *** 55,82 **** double y = 0; ! if (xExpr != null || yExpr != null) { ! JXPathContext context = JXPathFactory.createContext(node); ! if (xExpr != null) { ! Object xO = context.getValue(xExpr); ! try { ! x = ((Double) xO).doubleValue(); ! x -= 51; ! x *= 100; ! } ! catch (Exception ex) { ! } ! } ! ! if (yExpr != null) { ! Object yO = context.getValue(yExpr); ! try { ! y = ((Double) yO).doubleValue(); ! //y -= 51.51; ! y *= 100; ! } ! catch (Exception ex) { ! } ! } ! } System.out.println("pos: " + x + ":" + y); pos = new Point2D.Double(x, y); --- 53,80 ---- double y = 0; ! // if (xExpr != null || yExpr != null) { ! // JXPathContext context = JXPathFactory.createContext(node); ! // if (xExpr != null) { ! // Object xO = context.getValue(xExpr); ! // try { ! // x = ((Double) xO).doubleValue(); ! // x -= 51; ! // x *= 100; ! // } ! // catch (Exception ex) { ! // } ! // } ! // ! // if (yExpr != null) { ! // Object yO = context.getValue(yExpr); ! // try { ! // y = ((Double) yO).doubleValue(); ! // //y -= 51.51; ! // y *= 100; ! // } ! // catch (Exception ex) { ! // } ! // } ! // } System.out.println("pos: " + x + ":" + y); pos = new Point2D.Double(x, y); *************** *** 95,119 **** double height = 0; ! if (widthExpr != null || heightExpr != null) { ! JXPathContext context = JXPathFactory.createContext(node); ! if (widthExpr != null) { ! Object widthO = context.getValue(widthExpr); ! try { ! width = ((Double) widthO).doubleValue(); ! } ! catch (Exception ex) { ! } ! } ! ! if (heightExpr != null) { ! Object heightO = context.getValue(heightExpr); ! try { ! height = ((Double) heightO).doubleValue(); ! } ! catch (Exception ex) { ! } ! } ! } ! else return null; size = new Point2D.Double(width, height); --- 93,117 ---- double height = 0; ! // if (widthExpr != null || heightExpr != null) { ! // JXPathContext context = JXPathFactory.createContext(node); ! // if (widthExpr != null) { ! // Object widthO = context.getValue(widthExpr); ! // try { ! // width = ((Double) widthO).doubleValue(); ! // } ! // catch (Exception ex) { ! // } ! // } ! // ! // if (heightExpr != null) { ! // Object heightO = context.getValue(heightExpr); ! // try { ! // height = ((Double) heightO).doubleValue(); ! // } ! // catch (Exception ex) { ! // } ! // } ! // } ! // else return null; size = new Point2D.Double(width, height); Index: SpringEdgeLayouter.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/layout/SpringEdgeLayouter.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** SpringEdgeLayouter.java 8 Jun 2006 13:14:57 -0000 1.11 --- SpringEdgeLayouter.java 30 Jun 2006 14:31:38 -0000 1.12 *************** *** 8,15 **** import java.util.Map; - import org.apache.commons.jxpath.JXPathContext; import org.mediavirus.graphl.graph.Edge; import org.mediavirus.graphl.graph.Node; - import org.mediavirus.graphl.jxpath.JXPathFactory; import org.mediavirus.graphl.layout.GraphlLayoutStrategy.GraphManager; import org.mediavirus.graphl.view.AbstractFacet; --- 8,13 ---- *************** *** 53,76 **** float rigidity = defaultRigidity; ! if (lengthExpr != null || rigidityExpr != null) { ! JXPathContext context = JXPathFactory.createContext(edge); ! if (lengthExpr != null) { ! Object lengthO = context.getValue(lengthExpr); ! try { ! length = ((Double) lengthO).floatValue(); ! } ! catch (Exception ex) { ! } ! } ! ! if (rigidityExpr != null) { ! Object rigidityO = context.getValue(rigidityExpr); ! try { ! rigidity = ((Double) rigidityO).floatValue(); ! } ! catch (Exception ex) { ! } ! } ! } spring = new Spring(length, rigidity); --- 51,74 ---- float rigidity = defaultRigidity; ! // if (lengthExpr != null || rigidityExpr != null) { ! // JXPathContext context = JXPathFactory.createContext(edge); ! // if (lengthExpr != null) { ! // Object lengthO = context.getValue(lengthExpr); ! // try { ! // length = ((Double) lengthO).floatValue(); ! // } ! // catch (Exception ex) { ! // } ! // } ! // ! // if (rigidityExpr != null) { ! // Object rigidityO = context.getValue(rigidityExpr); ! // try { ! // rigidity = ((Double) rigidityO).floatValue(); ! // } ! // catch (Exception ex) { ! // } ! // } ! // } spring = new Spring(length, rigidity); |