Package java.awt

Examples of java.awt.Polygon


    /* (non-Javadoc)
     * @see org.datanucleus.store.mapping.JavaTypeMapping#setObject(org.datanucleus.ObjectManager, java.lang.Object, int[], java.lang.Object)
     */
    public void setObject(ExecutionContext ec, Object preparedStatement, int[] exprIndex, Object value)
    {
      Polygon poly = (Polygon)value;
        if (poly == null)
        {
            getDatastoreMapping(0).setObject(preparedStatement, exprIndex[0], null);
            getDatastoreMapping(1).setObject(preparedStatement, exprIndex[1], null);
            getDatastoreMapping(2).setObject(preparedStatement, exprIndex[2], null);
View Full Code Here


        }

        int[] xpoints = (int[])getDatastoreMapping(0).getObject(resultSet,exprIndex[0]);
        int[] ypoints = (int[])getDatastoreMapping(1).getObject(resultSet,exprIndex[1]);
        int npoints = getDatastoreMapping(2).getInt(resultSet,exprIndex[2]);
        return new Polygon(xpoints, ypoints, npoints);
    }
View Full Code Here

    g2d.fillRoundRect(BUBBLE_OFFSET, 0, width, height, ARC_DIAMETER, ARC_DIAMETER);
    g2d.setColor(fillColor);
    g2d.fillRoundRect(BUBBLE_OFFSET + 1, 1, width - 2, height - 2, ARC_DIAMETER, ARC_DIAMETER);
   
    // The bubble handle
    final Polygon p = new Polygon();
    p.addPoint(BUBBLE_OFFSET + 1, MARGIN_WIDTH + 1);
    p.addPoint(0, LINE_HEIGHT);
    p.addPoint(BUBBLE_OFFSET + 1, LINE_HEIGHT / 2 + MARGIN_WIDTH);
    g2d.fillPolygon(p);
   
    g2d.setColor(outLineColor);
    g2d.drawLine(0, LINE_HEIGHT, BUBBLE_OFFSET, MARGIN_WIDTH + 1);
    g2d.drawLine(0, LINE_HEIGHT, BUBBLE_OFFSET, LINE_HEIGHT / 2 + MARGIN_WIDTH);
View Full Code Here

    Graphics g = graphics.create();
   
    int borderWidth = getBorderWidth(component);
   
    // *** Clipping for  top and left borders ***
    Polygon p = new Polygon();
    p.addPoint(x, y);
    p.addPoint(x + width, y);
    p.addPoint(x + width - borderWidth, y + borderWidth);
    p.addPoint(x + borderWidth, y + borderWidth);
    p.addPoint(x + borderWidth, y + height - borderWidth);
    p.addPoint(x, y + height);
    g.setClip(p);
    g.clipRect(oldClip.x, oldClip.y, oldClip.width, oldClip.height);
   
    // top border
    for (int i = x; i < x + width; i += imageWidth) {
      g.drawImage(topLeftImage, i, y, null);
    }
    // left border
    for (int i = y; i < y + height; i += imageHeight) {
      g.drawImage(topLeftImage, x, i, null);
    }
   
    // *** Clipping for bottom and right borders ***
    // We have the same number of vertices as before, so it's efficient to
    // reuse the polygon 
    p.reset();
    p.addPoint(x + width, y);
    p.addPoint(x + width, y + height);
    p.addPoint(x, y + height);
    p.addPoint(x + borderWidth, y + height - borderWidth);
    p.addPoint(x + width - borderWidth, y + height - borderWidth);
    p.addPoint(x + width - borderWidth, y + borderWidth);
    g.setClip(p);
    g.clipRect(oldClip.x, oldClip.y, oldClip.width, oldClip.height);
   
    // Bottom border. More than one y coordinate may be needed in case the
    // tile border coincides to be inside the bottom border.
View Full Code Here

    }
    private static final int[] PTS = new int[]{0, 0, 0};

    public Polygon getExactTabIndication(int i) {
        //Should never be called
        return new Polygon(PTS, PTS, PTS.length);
    }
View Full Code Here

        //Should never be called
        return new Polygon(PTS, PTS, PTS.length);
    }

    public Polygon getInsertTabIndication(int i) {
        return new Polygon(PTS, PTS, PTS.length);
    }
View Full Code Here

                return;
            }

            String p[] = split(s);
            int max = Integer.parseInt(p[0]);
            Polygon pol = new Polygon();
            for (int i = 0; i != max; i++) {
                pol.addPoint(translate(p[i * 2 + 1]), translate(p[i * 2 + 2]));
            }

            p = split(readLine().trim());
            max = Integer.parseInt(p[0]);
            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);
View Full Code Here

            minX = 9999999;
            minY = 9999999;
            maxX = 0;
            maxY = 0;
            Polygon p1 = split(readLine());

            if (p1 == null) {
                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

        if (x[0] == 0 && x[1] == 0 && x[2] == 0 && y[1] == 0 && y[2] == 0
                && y[0] == 0) {
            return null;
        }

        return new Polygon(x, y, 3);

    }
View Full Code Here

            int max = Integer.parseInt(readLine().trim());
            if (max==0) {
                return;
            }

            Polygon pol = new Polygon();
  for(int i=0;i!=max;i++) {
    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;
View Full Code Here

TOP

Related Classes of java.awt.Polygon

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.