Package java.awt

Examples of java.awt.Polygon.translate()


        assertEquals(new Rectangle(1, 2, 2, 3), pg.getBounds());
        pg.addPoint(4, 1);
        assertEquals(new Rectangle(1, 1, 3, 4), pg.getBounds());
        pg.translate(0, 0);
        assertEquals(new Rectangle(1, 1, 3, 4), pg.getBounds());
        pg.translate(2, 3);
        assertEquals(new Rectangle(3, 4, 3, 4), pg.getBounds());
    }

    @SuppressWarnings("deprecation")
    public void testGetBoundingBox() {
View Full Code Here


        assertEquals(new Rectangle(1, 2, 0, 0), pg.getBoundingBox());
        pg.addPoint(3, 5);
        assertEquals(new Rectangle(1, 2, 2, 3), pg.getBoundingBox());
        pg.addPoint(4, 1);
        assertEquals(new Rectangle(1, 1, 3, 4), pg.getBoundingBox());
        pg.translate(0, 0);
        assertEquals(new Rectangle(1, 1, 3, 4), pg.getBoundingBox());
        pg.translate(2, 3);
        assertEquals(new Rectangle(3, 4, 3, 4), pg.getBoundingBox());
    }
View Full Code Here

        assertEquals(new Rectangle(1, 2, 2, 3), pg.getBoundingBox());
        pg.addPoint(4, 1);
        assertEquals(new Rectangle(1, 1, 3, 4), pg.getBoundingBox());
        pg.translate(0, 0);
        assertEquals(new Rectangle(1, 1, 3, 4), pg.getBoundingBox());
        pg.translate(2, 3);
        assertEquals(new Rectangle(3, 4, 3, 4), pg.getBoundingBox());
    }

    public void testGetBounds2D() {
        Polygon pg = new Polygon();
View Full Code Here

        assertEquals(new Rectangle2D.Double(1, 2, 0, 0), pg.getBounds2D());
        pg.addPoint(3, 5);
        assertEquals(new Rectangle2D.Double(1, 2, 2, 3), pg.getBounds2D());
        pg.addPoint(4, 1);
        assertEquals(new Rectangle2D.Double(1, 1, 3, 4), pg.getBounds2D());
        pg.translate(0, 0);
        assertEquals(new Rectangle(1, 1, 3, 4), pg.getBounds2D());
        pg.translate(2, 3);
        assertEquals(new Rectangle(3, 4, 3, 4), pg.getBounds2D());
    }
View Full Code Here

        assertEquals(new Rectangle2D.Double(1, 2, 2, 3), pg.getBounds2D());
        pg.addPoint(4, 1);
        assertEquals(new Rectangle2D.Double(1, 1, 3, 4), pg.getBounds2D());
        pg.translate(0, 0);
        assertEquals(new Rectangle(1, 1, 3, 4), pg.getBounds2D());
        pg.translate(2, 3);
        assertEquals(new Rectangle(3, 4, 3, 4), pg.getBounds2D());
    }

    public void testTranslate() {
        Polygon pg = new Polygon(new int[]{1, 2, 3}, new int[]{7, 8, 9}, 3);
View Full Code Here

        assertEquals(new Rectangle(3, 4, 3, 4), pg.getBounds2D());
    }

    public void testTranslate() {
        Polygon pg = new Polygon(new int[]{1, 2, 3}, new int[]{7, 8, 9}, 3);
        pg.translate(0, 0);
        assertEquals(3, pg.npoints);
        assertEquals(new int[]{1, 2, 3}, pg.xpoints, 3);
        assertEquals(new int[]{7, 8, 9}, pg.ypoints, 3);

        pg.translate(2, 3);
View Full Code Here

        pg.translate(0, 0);
        assertEquals(3, pg.npoints);
        assertEquals(new int[]{1, 2, 3}, pg.xpoints, 3);
        assertEquals(new int[]{7, 8, 9}, pg.ypoints, 3);

        pg.translate(2, 3);
        assertEquals(3, pg.npoints);
        assertEquals(new int[]{3, 4, 5}, pg.xpoints, 3);
        assertEquals(new int[]{10, 11, 12}, pg.ypoints, 3);
    }
View Full Code Here

                    if (layer instanceof SelectionLayer) {
                      if (shouldPaintBrushTile())
                        RenderingUtil.drawTile(gc, tile, drawLoc.x, drawLoc.y, zoom);
                        //Polygon gridPoly = createGridPolygon(
                                //drawLoc.x, drawLoc.y - tileSize.height, 0);
                        gridPoly.translate(drawLoc.x, drawLoc.y - tileSize.y / 2);
                        gc.setAlpha(SEL_HOVER_ALPHA);
                        gc.fillPolygon(Converter.getPolygonArray(gridPoly));
                        gridPoly.translate(-drawLoc.x, -(drawLoc.y - tileSize.y / 2));
                        gc.setAlpha(OPAQUE);
                        //paintEdge(g2d, layer, drawLoc.x, drawLoc.y);
View Full Code Here

                        //Polygon gridPoly = createGridPolygon(
                                //drawLoc.x, drawLoc.y - tileSize.height, 0);
                        gridPoly.translate(drawLoc.x, drawLoc.y - tileSize.y / 2);
                        gc.setAlpha(SEL_HOVER_ALPHA);
                        gc.fillPolygon(Converter.getPolygonArray(gridPoly));
                        gridPoly.translate(-drawLoc.x, -(drawLoc.y - tileSize.y / 2));
                        gc.setAlpha(OPAQUE);
                        //paintEdge(g2d, layer, drawLoc.x, drawLoc.y);
                    } else {
                        RenderingUtil.drawTile(gc, tile, drawLoc.x, drawLoc.y, zoom);
                    }
View Full Code Here

        if ( hexEdgesToTheLeft ) {
            for (int x = startX; x <= endX; x++) {
                grid = createGridPolygon(x, startY, 1);
                for (int y = startY; y <= endY; y++) {
                    g2d.drawPolygon(Converter.getPolygonArray(grid));
                    grid.translate(0, tileSize.y + 1);
                }
            }
        } else {
            for (int y = startY; y <= endY; y++) {
                grid = createGridPolygon(startX, y, 1);
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.