示例#1
0
  public void CenterGraph(int borderSpacing, boolean _repaint) {
    List<Functionality.Node> ln = myGraph.getNodes();

    double xsum = 0;
    double ysum = 0;

    for (int i = 0; i < ln.size(); i++) {
      xsum += layout.getX(ln.get(i));
      ysum += layout.getY(ln.get(i));
    }

    double xmean = xsum / ln.size();
    double ymean = ysum / ln.size();

    double xcoef = (layout_width - borderSpacing * 2) / (double) layout_width;
    double ycoef = (layout_height - borderSpacing * 2) / (double) layout_height;

    for (int i = 0; i < ln.size(); i++) {
      double xnew = layout.getX(ln.get(i)) + (layout_width / 2 - xmean);
      double ynew = layout.getY(ln.get(i)) + (layout_height / 2 - ymean);

      layout.setLocation(ln.get(i), xnew, ynew);
    }

    for (int i = 0; i < ln.size(); i++) {
      double xnew = borderSpacing + layout.getX(ln.get(i)) * xcoef;
      double ynew = borderSpacing + layout.getY(ln.get(i)) * ycoef;

      layout.setLocation(ln.get(i), xnew, ynew);
    }

    if (_repaint == true) vv.repaint();
  }
示例#2
0
 public void setEdgeWeightStrokeFunction() {
   double _normalEdgeThreshold = DataModule.displayedGraph.getNormalEdgeThreshold();
   double _thickEdgeThreshold = DataModule.displayedGraph.getThickEdgeThreshold();
   EdgeWeightStrokeFunction<Functionality.Edge> ewsf =
       new EdgeWeightStrokeFunction<Functionality.Edge>(_normalEdgeThreshold, _thickEdgeThreshold);
   vv.getRenderContext().setEdgeStrokeTransformer(ewsf);
   vv.repaint();
   // System.err.println("edge stroke fc: " + _normalEdgeThreshold + ", " + _thickEdgeThreshold);
 }
示例#3
0
  public void setDistanceFilter(
      int _depth, VertexDisplayPredicateMode _vdpm, EdgeTypeEnum coreEdgeType) {

    vdp =
        new VertexDisplayPredicateDistance(
            _depth, _vdpm, vv.getPickedVertexState().getPicked(), coreEdgeType);
    vv.getRenderContext().setVertexIncludePredicate(vdp);

    // filter_setting_depth = _depth;
    // filter_setting_filter = _filter;
    vv.repaint();
    System.err.println("SetDistanceFilter");
  }
示例#4
0
 public void setNoneFilter() {
   vdp = new VertexDisplayPredicateNone();
   vv.getRenderContext().setVertexIncludePredicate(vdp);
   vv.repaint();
 }
示例#5
0
 public void setEdgeFilter(boolean dotted, boolean normal, boolean thick) {
   eip = new EdgeIncludePredicate(dotted, normal, thick);
   vv.getRenderContext().setEdgeIncludePredicate(eip);
   vv.repaint();
 }