Package java.awt.geom

Examples of java.awt.geom.Area$AreaPathIterator


    float xVertex3 = vertices [2 * vertexIndex3];
    float yVertex3 = vertices [2 * vertexIndex3 + 1];
    if ((xVertex2 - xVertex1) * (yVertex3 - yVertex2) - (yVertex2 - yVertex1) * (xVertex3 - xVertex2) > 0) {
      if (quadrilateralIndex > 0 && quadrilateralIndex % 1000 == 0) {
        // Add now current path to area otherwise area gets too slow
        nodeArea.add(new Area(geometryPath));
        geometryPath.reset();
      }
      geometryPath.moveTo(xVertex1, yVertex1);     
      geometryPath.lineTo(xVertex2, yVertex2);     
      geometryPath.lineTo(xVertex3, yVertex3);
View Full Code Here


      // If room isn't singular retrieve all the points of its different polygons
      List<float [][]> roomPoints = new ArrayList<float[][]>();
      Map<Integer, List<float [][]>> roomHoles = new HashMap<Integer, List<float [][]>>();
      List<Room> homeRooms = this.home.getRooms();
      if (!room.isSingular() || homeRooms.get(homeRooms.size() - 1) != room) {       
        Area roomArea = new Area(getShape(points));
        if (homeRooms.contains(room)) {
          // Remove other rooms surface that may overlap the current room
          for (int i = homeRooms.size() - 1; i > 0 && homeRooms.get(i) != room; i--) {
            Room otherRoom = homeRooms.get(i);
            if (roomPart == FLOOR_PART && otherRoom.isFloorVisible()
                || roomPart == CEILING_PART && otherRoom.isCeilingVisible()) {
              roomArea.subtract(new Area(getShape(otherRoom.getPoints())));
            }
          }
        }
        // Retrieve the points of the different polygons
        // and reverse their points order if necessary
        List<float []> currentPathPoints = new ArrayList<float[]>();
        roomPoints = new ArrayList<float[][]>();
        float [] previousRoomPoint = null;
        int i = 0;
        for (PathIterator it = roomArea.getPathIterator(null); !it.isDone(); ) {
          float [] roomPoint = new float[2];
          switch (it.currentSegment(roomPoint)) {
            case PathIterator.SEG_MOVETO :
            case PathIterator.SEG_LINETO :
              if (previousRoomPoint == null
View Full Code Here

    Ellipse2D outer = getDraggableArea(control);
    Ellipse2D inner = new Ellipse2D.Double(origin_x + 2.0 - CONTROL_POINT_SIZE / 2.0,
        origin_y + 2.0 - CONTROL_POINT_SIZE / 2.0,
        8.0, 8.0);

    Area circle = new Area(outer);
    circle.subtract(new Area(inner));

    Stroke stroke = g2.getStroke();
    g2.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER,
        5, new float[] { 5, 5 }, 0));
    g2.setColor(new Color(1.0f, 0.0f, 0.0f, 0.4f));
View Full Code Here

            Polygon pol2 = new Polygon();
            for (int i = 0; i != max; i++) {
                pol2.addPoint(translate(p[i * 2 + 1]), translate(p[i * 2 + 2]));
            }

            Area a = new Area(pol);
            a.exclusiveOr(new Area(pol2));
            double z = calculateArea(a);
            // ????
            z = Math.round(z * 100);

            long zz = (long) (z);
View Full Code Here

            MyPolygon p2 = lePoligono(1);
            MyPolygon p3 = lePoligono(2);

            Set s = new TreeSet();

            Area a1 = new Area((p1));

            Area a2 = new Area((p2));

            Area a3 = new Area((p3));

            // uniao a1, a2 e a3
            Area a123 = new Area(a1);
            a123.intersect(a2);
            a123.intersect(a3);
            MyArea ma123 = new MyArea(a123, cores[0] + cores[1] + cores[2]);
            ma123.calculateArea("a123");

            // uniao a1 e a2
            Area a12 = new Area(a1);
            a12.intersect(a2);
            a12.subtract(a3);
            MyArea ma12 = new MyArea(a12, cores[0] + cores[1]);
            ma12.calculateArea("a12");

            // uniao a1 e a3
            Area a13 = new Area(a1);
            a13.intersect(a3);
            a13.subtract(a2);
            MyArea ma13 = new MyArea(a13, cores[2] + cores[0]);
            ma13.calculateArea("a13");

            // uniao a1 e a3
            Area a23 = new Area(a2);
            a23.intersect(a3);
            a23.subtract(a1);
            MyArea ma23 = new MyArea(a23, cores[1] + cores[2]);
            ma23.calculateArea("a23");

            // fix its area
            Area aa1 = (Area) a1.clone();
            aa1.subtract(a2);
            aa1.subtract(a3);
            MyArea ma1 = new MyArea(aa1, cores[0]);
            ma1.calculateArea("aa1");
           
            Area aa2 = (Area) a2.clone();
            aa2.subtract(a1);
            aa2.subtract(a3);
            MyArea ma2 = new MyArea(aa2, cores[1]);
            ma2.calculateArea("aa2");

            Area aa3 = new Area(a3);
            aa3.subtract(a1);
            aa3.subtract(a2);
            MyArea ma3 = new MyArea(aa3, cores[2]);
            ma3.calculateArea("aa3");

            // adding the color area
            for (int i = 0; i != 16; i++) {
View Full Code Here

                return;
            }

            AffineTransform at = new AffineTransform();
            at.setToScale(0.01, 0.01);
            Area a = new Area(p1);
//            a = a.createTransformedArea(at);

            int contem = 0;
            for (int x = (((int) (minX / 200.0)) - 1) * 100; x <= maxX + 200; x += 100) {

                for (int y = (((int) (minY / 200.0)) - 1) * 100; y <= maxY + 200; y += 100) {

                    System.out.println("testando: " + x + "," + y + ": "
                            + p1.contains(x, y));

                    if (a.contains(new Point2D.Double(x, y))) {
                        contem++;
                    }

                }

View Full Code Here

    s = readLine().trim();
    String p[] = split(s);
    pol.addPoint(translate(p[0]),translate(p[1]));
  }

            Area a = new Area(pol);
            double z = calculateArea(a);
    z /= 10000;
            // ????
            z = Math.round(z * 100);

 
View Full Code Here

                              oldParamBlock.getIntParameter(1),
                              srcBounds.height + topPad +
                              oldParamBlock.getIntParameter(3));

            // Determine invalid area by subtracting source bounds.
            Area invalidArea = new Area(dstBounds);
            invalidArea.subtract(new Area(srcBounds));
            invalidRegion = invalidArea;

        } else if((newParamBlock.getIntParameter(1) <   // new R < old R
            oldParamBlock.getIntParameter(1) &&
            newParamBlock.getIntParameter(3) <=  // new B <= old B
            oldParamBlock.getIntParameter(3)) ||
           (newParamBlock.getIntParameter(3) <   // new B < old B
            oldParamBlock.getIntParameter(3) &&
            newParamBlock.getIntParameter(1) <=  // new R <= old R
            oldParamBlock.getIntParameter(1))) {
            // One or both right and bottom padding decreased.

            // Get source and the left and top padding.
            RenderedImage src = oldParamBlock.getRenderedSource(0);
            int leftPad = oldParamBlock.getIntParameter(0);
            int topPad = oldParamBlock.getIntParameter(2);

            // Get source bounds.
            Rectangle srcBounds =
                new Rectangle(src.getMinX(), src.getMinY(),
                              src.getWidth(), src.getHeight());

            // Get old destination bounds.
            Rectangle oldBounds =
                new Rectangle(srcBounds.x - leftPad,
                              srcBounds.y - topPad,
                              srcBounds.width + leftPad +
                              oldParamBlock.getIntParameter(1),
                              srcBounds.height + topPad +
                              oldParamBlock.getIntParameter(3));

            // Get new destination bounds.
            Rectangle newBounds =
                new Rectangle(srcBounds.x - leftPad,
                              srcBounds.y - topPad,
                              srcBounds.width + leftPad +
                              newParamBlock.getIntParameter(1),
                              srcBounds.height + topPad +
                              newParamBlock.getIntParameter(3));

            // Determine invalid area by subtracting new from old bounds.
            Area invalidArea = new Area(oldBounds);
            invalidArea.subtract(new Area(newBounds));
            invalidRegion = invalidArea;

        } else {
            // Either nothing changed or one or both of the right and bottom
            // padding was increased.
View Full Code Here

  }

  //recover Area instance
  switch (type) {
  case SHAPE_AREA:
      theObject = new Area(path);
      break;
  default:
      theObject = path;
      break;
  }
View Full Code Here

    synchronized public static void initializeScreenArea(int priority) {
        if (_initializationThread == null) {
            _initializationThread = new Thread() {
                @Override
                public void run() {
                    SCREEN_AREA = new Area();
                    SCREEN_BOUNDS = new Rectangle();
                    GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment();
                    List<Rectangle> screensList = new ArrayList<Rectangle>();
                    List<Insets> insetsList = new ArrayList<Insets>();
                    GraphicsDevice[] screenDevices = environment.getScreenDevices();
                    for (GraphicsDevice device : screenDevices) {
                        GraphicsConfiguration configuration = device.getDefaultConfiguration();
                        Rectangle screenBounds = configuration.getBounds();
                        Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(configuration);
                        screensList.add(screenBounds);
                        insetsList.add(insets);
                        SCREEN_AREA.add(new Area(screenBounds));
                        SCREEN_BOUNDS = SCREEN_BOUNDS.union(screenBounds);
                    }
                    SCREENS = screensList.toArray(new Rectangle[screensList.size()]);
                    INSETS = insetsList.toArray(new Insets[screensList.size()]);
                    _initializationThread = null;
View Full Code Here

TOP

Related Classes of java.awt.geom.Area$AreaPathIterator

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.