Ejemplo n.º 1
0
  private static void paintNodeRecursively(PLayer layer, Block node) {
    Rectangle r = node.getBounds();
    PPath rect = PPath.createRectangle(r.x, r.y, r.width, r.height);

    // Color randomColor = new Color(numGen.nextInt(256), numGen.nextInt(256), numGen.nextInt(256));
    // rect.setStrokePaint(randomColor);
    // if (node.isLeaf()){
    if (node.isText()) {
      rect.setStrokePaint(Color.red);
      rect.setPaint(null);
    } else if (node.isLeaf()) {
      rect.setStrokePaint(Color.green);
      // rect.setStrokePaint(Color.red);
      rect.setPaint(Color.green);
      rect.setTransparency(0.3f);
    } else {
      rect.setStrokePaint(Color.cyan);
      rect.setPaint(null);
    }

    layer.addChild(rect);

    for (Block child : node.getChildren()) {
      paintNodeRecursively(layer, child);
    }
  }
Ejemplo n.º 2
0
 public void updateEdgeColorsTo(double value) {
   PPath ppath = getEdgePPath();
   if (ppath != null) {
     double normValue = normalizeForColorScale(value);
     if (isSelfLoop) {
       ppath.setPaint(createPaintFor(normValue));
     } else {
       ppath.setStrokePaint(createPaintFor(normValue));
     }
   }
 }
Ejemplo n.º 3
0
  ///////////////////////////////////////////////////////////////////////////
  /// Marquee
  protected void initializeMarquee(PInputEvent e) {
    marquee = PPath.createRectangle((float) presspt.getX(), (float) presspt.getY(), 0, 0);
    marquee.setPaint(marqueePaint);
    marquee.setTransparency(marqueePaintTransparency);
    marquee.setStrokePaint(marqueeStrokePaint);
    marquee.setStroke(strokes[0]);

    marqueeParent.getPiccolo().addChild(marquee);

    marqueeObjects.clear();
  }
Ejemplo n.º 4
0
 public static PPath rect(double x, double y, double w, double h, Paint stroke, Paint fill) {
   PPath rect = new PPath(new Rectangle2D.Double(x, y, w, h));
   rect.setPaint(fill);
   rect.setStrokePaint(stroke);
   return rect;
 }
 private void addArrows() {
   layer.addChild(a1 = new PPath());
   a1.setPaint(Color.white);
 }