Examples of PathIterator


Examples of java.awt.geom.PathIterator

          getDiameter(), getDiameter());
      // Apply rotation to the rectangle
      AffineTransform rotation = new AffineTransform();
      rotation.setToRotation(getNorthDirection(), getX(), getY());
      this.pointsCache = new float[4][2];
      PathIterator it = pieceRectangle.getPathIterator(rotation);
      for (int i = 0; i < this.pointsCache.length; i++) {
        it.currentSegment(this.pointsCache [i]);
        it.next();
      }
    }
    return new float [][] {this.pointsCache [0].clone(), this.pointsCache [1].clone(),
                           this.pointsCache [2].clone(), this.pointsCache [3].clone()};
  }
View Full Code Here

Examples of java.awt.geom.PathIterator

   * Returns the points of each corner of a piece.
   * @return an array of the 4 (x,y) coordinates of the piece corners.
   */
  public float [][] getPoints() {
    float [][] piecePoints = new float[4][2];
    PathIterator it = getShape().getPathIterator(null);
    for (int i = 0; i < piecePoints.length; i++) {
      it.currentSegment(piecePoints [i]);
      it.next();
    }
    return piecePoints;
  }
View Full Code Here

Examples of java.awt.geom.PathIterator

          getY() - getDepth() / 2,
          getWidth(), getDepth());
      // Apply rotation to the rectangle
      AffineTransform rotation = new AffineTransform();
      rotation.setToRotation(getAngle(), getX(), getY());
      PathIterator it = pieceRectangle.getPathIterator(rotation);
      GeneralPath pieceShape = new GeneralPath();
      pieceShape.append(it, false);
      // Cache shape
      this.shapeCache = pieceShape;
    }
View Full Code Here

Examples of java.awt.geom.PathIterator

   * Returns the points of each corner of the rectangle surrounding this camera.
   * @return an array of the 4 (x,y) coordinates of the camera corners.
   */
  public float [][] getPoints() {
    float [][] piecePoints = new float[4][2];
    PathIterator it = getRectangleShape().getPathIterator(null);
    for (int i = 0; i < piecePoints.length; i++) {
      it.currentSegment(piecePoints [i]);
      it.next();
    }
    return piecePoints;
  }
View Full Code Here

Examples of java.awt.geom.PathIterator

          getX() - getWidth() / 2, getY() - getDepth() / 2,
          getWidth(), getDepth());
      // Apply rotation to the rectangle
      AffineTransform rotation = new AffineTransform();
      rotation.setToRotation(getYaw(), getX(), getY());
      PathIterator it = cameraEllipse.getPathIterator(rotation);
      GeneralPath pieceShape = new GeneralPath();
      pieceShape.append(it, false);
      // Cache shape
      this.shapeCache = pieceShape;
    }
View Full Code Here

Examples of java.awt.geom.PathIterator

          getX() - getWidth() / 2, getY() - getDepth() / 2,
          getWidth(), getDepth());
      // Apply rotation to the rectangle
      AffineTransform rotation = new AffineTransform();
      rotation.setToRotation(getYaw(), getX(), getY());
      PathIterator it = cameraRectangle.getPathIterator(rotation);
      GeneralPath cameraRectangleShape = new GeneralPath();
      cameraRectangleShape.append(it, false);
      // Cache shape
      this.rectangleShapeCache = cameraRectangleShape;
    }
View Full Code Here

Examples of java.awt.geom.PathIterator

        doorOrWindow.getY() - doorOrWindow.getDepth() / 2 + wallDistance,
        doorOrWindow.getWidth(), wallThickness);
    // Apply rotation to the rectangle
    AffineTransform rotation = new AffineTransform();
    rotation.setToRotation(doorOrWindow.getAngle(), doorOrWindow.getX(), doorOrWindow.getY());
    PathIterator it = doorOrWindowRectangle.getPathIterator(rotation);
    GeneralPath doorOrWindowShape = new GeneralPath();
    doorOrWindowShape.append(it, false);
    return doorOrWindowShape;
  }
View Full Code Here

Examples of java.awt.geom.PathIterator

        startAngle, extentAngle, Arc2D.PIE);
    AffineTransform transformation = new AffineTransform();
    transformation.translate(doorOrWindow.getX(), doorOrWindow.getY());
    transformation.rotate(doorOrWindow.getAngle());
    transformation.translate(modelMirroredSign * -doorOrWindow.getWidth() / 2, -doorOrWindow.getDepth() / 2);
    PathIterator it = arc.getPathIterator(transformation);
    GeneralPath sashShape = new GeneralPath();
    sashShape.append(it, false);
    return sashShape;
  }
View Full Code Here

Examples of java.awt.geom.PathIterator

        if (validArea.isEmpty()) {
            return 0;
        }

        PathIterator pi = validArea.getPathIterator(new AffineTransform());

        Vector points = new Vector();

        //System.out.println("iteracao: " + cor);
        while (!pi.isDone()) {

            double[] point = new double[6];

            int mode = pi.currentSegment(point);

            if (mode == PathIterator.SEG_MOVETO) {

                //System.out.println("MOVE_TO");

                if (points.size() != 0) {
                    // FINALIZAR ESSA SHAPE E ADICIONAR A AREA A A
                    //   System.out.println("WEIRD MOVE_TO");
                    a += calculaArea(points);
                }

                double[] p = new double[2];
                p[0] = point[0];
                p[1] = point[1];
                // System.out.println("Comecando em " + p[0] + "," + p[1]);
                points.addElement(p);

            } else if (mode == PathIterator.SEG_LINETO) {

                double[] p = new double[2];
                p[0] = point[0];
                p[1] = point[1];
                //  System.out.println("passando em " + p[0] + "," + p[1]);
                points.addElement(p);

            } else if (mode == PathIterator.SEG_CLOSE) {

                // System.out.println("fechando com " + points.size() + "
                // pontos");
                a += calculaArea(points);

            } else {

                throw new SecurityException();

            }

            pi.next();

        }

        return (Math.abs(a));
View Full Code Here

Examples of java.awt.geom.PathIterator

        if (this.validArea.isEmpty()) {
            area = new Double(0);
            return;
        }

        PathIterator pi = this.validArea.getPathIterator(new AffineTransform());

        ArrayList points = new ArrayList();
       
        //System.out.println("iteracao: " + cor);
        while (!pi.isDone()) {

            double[] point = new double[6];

            int mode = pi.currentSegment(point);

            if (mode == PathIterator.SEG_MOVETO) {

                //System.out.println("MOVE_TO");

                if (points.size() != 0) {
                    // FINALIZAR ESSA SHAPE E ADICIONAR A AREA A A
                 //   System.out.println("WEIRD MOVE_TO");
                    a += calculaArea(points);
                }

                double[] p = new double[2];
                p[0] = point[0];
                p[1] = point[1];
                // System.out.println("Comecando em " + p[0] + "," + p[1]);
                points.add(p);

            } else if (mode == PathIterator.SEG_LINETO) {

                double[] p = new double[2];
                p[0] = point[0];
                p[1] = point[1];
                //  System.out.println("passando em " + p[0] + "," + p[1]);
                points.add(p);

            } else if (mode == PathIterator.SEG_CLOSE) {

                // System.out.println("fechando com " + points.size() + "
                // pontos");
                a += calculaArea(points);

            } else {

                throw new AssertionError();

            }

            pi.next();

        }

        this.area = new Double(Math.abs(a));
       
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.