Examples of PNode


Examples of edu.umd.cs.piccolo.PNode

  }

  static private final Color SHADOW_PAINT = new Color(10, 10, 10, 200);
  static private PNode addShadow(PNode contentNode){

    PNode contentNodeWithShadow = new PNode();

    double xoffset = contentNode.getXOffset();
    double yoffset = contentNode.getYOffset();

    int blurRadius = 4;
    int tx = 5;
    int ty = 5;

    PShadow shadowNode = new PShadow(contentNode.toImage(), SHADOW_PAINT, blurRadius );   
    contentNode.setOffset(tx, ty);
    shadowNode.setOffset(tx - (2 * blurRadius) + 1.0d, ty - (2 * blurRadius) + 1.0d)
    contentNodeWithShadow.addChild(shadowNode);
    contentNodeWithShadow.addChild(contentNode);         
    contentNodeWithShadow.removeChild(shadowNode);
    contentNodeWithShadow.setOffset(xoffset - tx  - blurRadius, yoffset - ty - blurRadius);
    contentNodeWithShadow.setBounds(0,0, contentNode.getWidth() + 2*blurRadius + tx, contentNode.getHeight() + 2*blurRadius + ty);
    return contentNodeWithShadow;
  }
View Full Code Here

Examples of org.piccolo2d.PNode

            public void mouseDragged(final PInputEvent event) {
                updateToolTip(event);
            }

            public void updateToolTip(final PInputEvent event) {
                final PNode n = event.getPickedNode();
                final Object object = (Object) n.getAttribute("tooltip");
                if (object != null) {
                    final String tooltipString = object.toString();
                    final Point2D p = event.getCanvasPosition();

                    event.getPath().canvasToLocal(p, camera);
View Full Code Here

Examples of org.piccolo2d.PNode

        public Component getMainPanel() {
            return container;
        }
       
        public void paintConvexHull() {
            PNode pointSet = new PNode();
            for (Vector2D point : points) {
                final PNode node = PPath.createEllipse(point.getX() - 1, point.getY() - 1, 2, 2);
                node.addAttribute("tooltip", point);
                node.setPaint(Color.gray);
                pointSet.addChild(node);
            }

            canvas.getLayer().addChild(pointSet);

            ConvexHullGenerator2D generator = new MonotoneChain(true, 1e-6);
            ConvexHull2D hull = generator.generate(points); //AklToussaintHeuristic.reducePoints(points));

            PNode hullNode = new PNode();
            for (Vector2D vertex : hull.getVertices()) {
                final PPath node = PPath.createEllipse(vertex.getX() - 1, vertex.getY() - 1, 2, 2);
                node.addAttribute("tooltip", vertex);
                node.setPaint(Color.red);
                node.setStrokePaint(Color.red);
                hullNode.addChild(node);
            }

            for (Segment line : hull.getLineSegments()) {
                final PPath node = PPath.createLine(line.getStart().getX(), line.getStart().getY(),
                                                    line.getEnd().getX(), line.getEnd().getY());
                node.setPickable(false);
                node.setPaint(Color.red);
                node.setStrokePaint(Color.red);
                hullNode.addChild(node);
            }

            canvas.getLayer().addChild(hullNode);

            Encloser<Euclidean2D, Vector2D> encloser =
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.