Package edu.umd.cs.piccolo.nodes

Examples of edu.umd.cs.piccolo.nodes.PPath


  /**
   * Draw the now complete polyline.
   */
  public void drawPolyline() {
    PPath pn = PPath.createPolyline(ScrollView.polylineXCoords,
                                    ScrollView.polylineYCoords);
    ScrollView.polylineSize = 0;
    pn.setStrokePaint(currentPenColor);
    pn.setPaint(null)// Don't fill the polygon - this is just a polyline.
    pn.setStroke(stroke);
    layer.addChild(pn);
  }
View Full Code Here


   * Draw an ellipse at (x,y) with given width and height, using the
   * current stroke, the current brush color to fill it and the
   * current pen color for the outline.
   */
  public void drawEllipse(int x, int y, int width, int height) {
    PPath pn = PPath.createEllipse(x, y, width, height);
    pn.setStrokePaint(currentPenColor);
    pn.setStroke(stroke);
    pn.setPaint(currentBrushColor);
    layer.addChild(pn);
  }
View Full Code Here

  /**
   * Draw a line from (x1,y1) to (x2,y2) using the current pen color and stroke.
   */
  public void drawLine(int x1, int y1, int x2, int y2) {
    PPath pn = PPath.createLine(x1, y1, x2, y2);
    pn.setStrokePaint(currentPenColor);
    pn.setPaint(null)// Null paint may render faster than the default.
    pn.setStroke(stroke);
    pn.moveTo(x1, y1);
    pn.lineTo(x2, y2);
    layer.addChild(pn);
  }
View Full Code Here

      int t = y1;
      y1 = y2;
      y2 = t;
    }

    PPath pn = PPath.createRectangle(x1, y1, x2 - x1, y2 - y1);
    pn.setStrokePaint(currentPenColor);
    pn.setStroke(stroke);
    pn.setPaint(currentBrushColor);
    layer.addChild(pn);
  }
View Full Code Here

    ImageRenderer matchedPartsRenderer = new PiccoloImageRenderer(testImage){
      @Override
      protected void addContent(PLayer layer) {
        for (List<RegionMatch> tmss : Lists.newArrayList(tms1,tms2,tms3,tms4)){
          for (RegionMatch tms : tmss){
            PPath c = PPath.createRectangle(tms.getX(),tms.getY(),tms.getWidth(),tms.getHeight());
            c.setStroke(new BasicStroke(2f));
            c.setStrokePaint(Color.blue);
            c.setTransparency(0.5f);
            layer.addChild(c);
          }       
        }
      }     
    };   
    logger.step(matchedPartsRenderer, "matched parts");
   
    // generate hypotheses
    final List<MatchHypothesis> hypotheses = Lists.newArrayList();
    for (RegionMatch scoreMatch1 : tms1){
      for (RegionMatch scoreMatch3 : tms3){
       
        ModelPartMatch m1 = new ModelPartMatch(model.getTopLeft(), scoreMatch1);
        ModelPartMatch m2 = new ModelPartMatch(model.getBottomRight(), scoreMatch3);
       
        MatchHypothesis newHypothesis = new MatchHypothesis(m1,m2);
        if (newHypothesis.isValid()){
          hypotheses.add(newHypothesis);
        }
      }     
    }
   
    ImageRenderer hypothesesRenderer = new PiccoloImageRenderer(testImage){
      @Override
      protected void addContent(PLayer layer) {
        for (MatchHypothesis h : hypotheses){
          ModelPartMatch m1 = h.getTopLeft();
          ModelPartMatch m2 = h.getBottomRight();
          RegionMatch p1 = m1.getScoreMatch();
          RegionMatch p2 = m2.getScoreMatch();
          PPath line = PPath.createLine(p1.getX(),p1.getY(),p2.getX(),p2.getY());
          line.setStroke(new BasicStroke(2f));
          line.setStrokePaint(Color.red);
          layer.addChild(line);
         
         
          Point p = h.getExpectedBottomLeftPartModelLocation();
          PPath c = PPath.createRectangle(p.x,p.y,10,10);
          c.setStroke(new BasicStroke(2f));
          c.setStrokePaint(Color.green);
          layer.addChild(c);
         
          p = h.getExpectedTopRightPartModelLocation();
          c = PPath.createRectangle(p.x,p.y,10,10);
          c.setStroke(new BasicStroke(2f));
          c.setStrokePaint(Color.green);
          layer.addChild(c);
        }       
      }     
    };
    logger.step(hypothesesRenderer, "hypotheses");
View Full Code Here

//        line.setStrokePaint(Color.red);
//        layer.addChild(line);
       
       
        Rectangle bs = h.getBounds();
        PPath rect = PPath.createRectangle(bs.x,bs.y,bs.width,bs.height);
        rect.setStroke(new BasicStroke(2f));
        rect.setStrokePaint(Color.red);
        rect.setPaint(null);
        layer.addChild(rect);   
       
        // draw score
//        int score = h.getScore();
//        PText text = new PText(""+score);
//        text.setOffset(rect.getBounds().getCenterX(), rect.getBounds().y - 20);
//        text.setHorizontalAlignment(0.5f);
//        layer.addChild(text);
       
        ModelPartMatch m3 = h.getTopRight();
        ModelPartMatch m4 = h.getBottomLeft();
       
        if (m3 != null){
          RegionMatch p3 = m3.getScoreMatch();
          PPath c = PPath.createRectangle(p3.getX(),p3.getY(),p3.getWidth(),p3.getHeight());
          c.setStroke(new BasicStroke(2f));
          c.setStrokePaint(Color.blue);
          c.setTransparency(0.5f);
          layer.addChild(c);
        }
       
        if (m4 != null){
          RegionMatch p4 = m4.getScoreMatch();
          PPath c = PPath.createRectangle(p4.getX(),p4.getY(),p4.getWidth(),p4.getHeight());
          c.setStroke(new BasicStroke(2f));
          c.setStrokePaint(Color.green);
          c.setTransparency(0.5f);
          layer.addChild(c);
        }
      }       
    }     
View Full Code Here

      protected void addContent(PLayer layer) {
        for (int i = 0; i < matches.size(); ++i) {
          if (i > 1)
            continue;
          Rectangle r = matches.get(i).screenRegion.getBounds();
          PPath p = PPath
              .createRectangle(r.x, r.y, r.width, r.height);

          // if (map.computeTextScore(r.x,r.y,r.width,r.height) > 0)
          if (i == 0)
            p.setStrokePaint(Color.red);
          else
            p.setStrokePaint(Color.blue);
          p.setPaint(null);
          PText t = new PText("" + i);
          t.setOffset(r.getX(), r.getY());
          layer.addChild(p);
          layer.addChild(t);
        }
View Full Code Here

   
    ImageRenderer ir = new PiccoloImageRenderer(trimmedModelImage){
      @Override
      protected void addContent(PLayer layer) {
        for (ModelPart part : parts){         
          PPath p = PPath.createRectangle(0,0,d,d);
          p.setStrokePaint(Color.red);
          p.setStroke(new BasicStroke(2f));
          p.setOffset(part.getBounds().getLocation());
          layer.addChild(p);
        }
      }     
    };   
    VisualModelFinder.logger.step(ir, "parts");
View Full Code Here

    labelNode.setOffset(element.x, element.y);
    return addShadow(labelNode);
  }
 
  static public PNode createFrom(CircleElement element){
    PPath p = PPath.createEllipse(1,1,element.width,element.height);
    p.setStrokePaint(element.lineColor);
    p.setPaint(null);   
    p.setStroke(new BasicStroke(element.lineWidth));

    PNode foregroundNode = new PNode();
    foregroundNode.addChild(p);
    foregroundNode.setHeight(p.getHeight()+4);
    foregroundNode.setWidth(p.getWidth()+4);
    p.setOffset(2,2);

    foregroundNode.setOffset(element.x, element.y);

    return addShadow(foregroundNode);
  }
View Full Code Here

    return addShadow(foregroundNode);
  }

  static public PNode createFrom(BoxElement element){
    PPath p = PPath.createRectangle(1,1,element.width,element.height);
    p.setStrokePaint(element.lineColor);
    p.setPaint(null);   
    p.setStroke(new BasicStroke(element.lineWidth));


    PNode foregroundNode = new PNode();
    foregroundNode.addChild(p);
    foregroundNode.setHeight(p.getHeight()+4);
    foregroundNode.setWidth(p.getWidth()+4);
    p.setOffset(2,2);

    foregroundNode.setOffset(element.x, element.y);

    return addShadow(foregroundNode);
  }
View Full Code Here

TOP

Related Classes of edu.umd.cs.piccolo.nodes.PPath

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.