different EdgeRenderes in same graph

Help
jhe2
2014-03-03
2014-04-07
  • jhe2

    jhe2 - 2014-03-03

    Hi,

    I use prefuse to visualise (directed) graphs. In my visualisations I want to have edges with just a forward arrow AND edges without arrows . I tried many things found in the docs, but failed. Either all edges have a forward arrow or none.
    I configure the visualizqtion with
    EdgeRenderer er = new EdgeRenderer(Constants.EDGE_TYPE_CURVE, Constants.EDGE_ARROW_FORWARD);
    EdgeRenderer erNoArrow = new EdgeRenderer(Constants.EDGE_TYPE_LINE, Constants.EDGE_ARROW_NONE);
    // includes straight line edges for EdgeItems by default
    DefaultRendererFactory drf = new DefaultRendererFactory(r);
    drf.setDefaultEdgeRenderer(er);

    drf.add(new InGroupPredicate(EDGE_DECORATORS), new LabelRenderer(VisualItem.LABEL));
    drf.add(new InGroupPredicate("noArrow"), erNoArrow);
    vis.setRendererFactory(drf);

    Edges are created with
    Edge e = mygraph.addEdge(from, to);
    e.setString(VisualItem.LABEL, "a label");
    e.setString("arrowtype", "noArrow"); // this however does not work

    How should I created edges to use either the "er" or "erNoArrow" EdgeRenderer ?

    Thank you very much in advance
    Johannes

     
  • Björn Kruse

    Björn Kruse - 2014-04-07

    Best you create a datafield "arrowtype" on your edge table.
    Then the e.setString("arrowtype", "noArrow"); is ok.
    The predicate (or expressionparser.parse, can't remember) must be different, not ingroup but like "arrowtype == noArrow". Can't remember exactly, sorry, but examples should be around on this forum.
    Best regards, Björn

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks