Package com.google.code.appengine.awt.geom

Examples of com.google.code.appengine.awt.geom.Rectangle2D


        i = i + 2;
      }
    }
   
    private double getAreaBoundsSquare() {
        Rectangle2D bounds = getBounds2D();
        return bounds.getHeight() * bounds.getWidth();
    }
View Full Code Here


        double absExtent = Math.abs(getAngleExtent());
        if (type != PIE || absExtent <= 180.0 || absExtent >= 360.0) {
            return true;
        }

        Rectangle2D r = new Rectangle2D.Double(rx, ry, rw, rh);

        double cx = getCenterX();
        double cy = getCenterY();
        if (r.contains(cx, cy)) {
            return false;
        }

        Point2D p1 = getStartPoint();
        Point2D p2 = getEndPoint();

        return !r.intersectsLine(cx, cy, p1.getX(), p1.getY())
                && !r.intersectsLine(cx, cy, p2.getX(), p2.getY());
    }
View Full Code Here

        double cx = getCenterX();
        double cy = getCenterY();
        Point2D p1 = getStartPoint();
        Point2D p2 = getEndPoint();
        Rectangle2D r = new Rectangle2D.Double(rx, ry, rw, rh);

        // Check: Does rectangle contain arc's points
        if (r.contains(p1) || r.contains(p2) || (type == PIE && r.contains(cx, cy))) {
            return true;
        }

        if (type == PIE) {
            if (r.intersectsLine(p1.getX(), p1.getY(), cx, cy) ||
                r.intersectsLine(p2.getX(), p2.getY(), cx, cy))
            {
                return true;
            }
        } else {
            if (r.intersectsLine(p1.getX(), p1.getY(), p2.getX(), p2.getY())) {
                return true;
            }
        }

        // Nearest rectangle point
View Full Code Here

     * All coordinates are expressed in points (72 dpi).
     *
     * @return the anchor of this shape
     */
    public com.google.code.appengine.awt.Rectangle getAnchor(){
        Rectangle2D anchor2d = getAnchor2D();
        return anchor2d.getBounds();
    }
View Full Code Here

     * @return the anchor of this shape
     */
    public Rectangle2D getAnchor2D(){
        EscherSpRecord spRecord = _escherContainer.getChildById(EscherSpRecord.RECORD_ID);
        int flags = spRecord.getFlags();
        Rectangle2D anchor=null;
        if ((flags & EscherSpRecord.FLAG_CHILD) != 0){
            EscherChildAnchorRecord rec = (EscherChildAnchorRecord)getEscherChild(_escherContainer, EscherChildAnchorRecord.RECORD_ID);
            anchor = new com.google.code.appengine.awt.Rectangle();
            if(rec == null){
                logger.log(POILogger.WARN, "EscherSpRecord.FLAG_CHILD is set but EscherChildAnchorRecord was not found");
View Full Code Here

     *
     * @param x the x coordinate of the top left corner of the shape
     * @param y the y coordinate of the top left corner of the shape
     */
    public void moveTo(float x, float y){
        Rectangle2D anchor = getAnchor2D();
        anchor.setRect(x, y, anchor.getWidth(), anchor.getHeight());
        setAnchor(anchor);
    }
View Full Code Here


    //---get the original transform so can reset it.
    AffineTransform affineTransform=g2d.getTransform();

    Rectangle2D rectangle;

    //LOOP
    //---pre-compute the dimensions of each Shape so do not do it in loop.
    for( int i=0; i < iAxisChartDataSet.getNumberOfDataSets(); i++ )
    {
      rectangle=pointChartProperties.getShape( i ).getBounds2D();
      cornerXOffset[ i ]=rectangle.getWidth() / 2;
      cornerYOffset[ i ]=rectangle.getHeight() / 2;
    }

    g2d.setStroke( PointChartProperties.DEFAULT_POINT_BORDER_STROKE );

    //LOOP
View Full Code Here

        if (getClip() != null) {
            GeneralPath gp = new GeneralPath();
            gp.append(pi, true);
            // create the stroked shape
            Stroke stroke = getStroke() == null? defaultStroke : getStroke();
            Rectangle2D bounds = stroke.createStrokedShape(gp).getBounds();
            // clip should intersect the path
            // if clip contains the bounds completely, clipping is not needed
            drawClipped = getClip().intersects(bounds) && !getClip().contains(bounds);
        }
View Full Code Here

     * Used for drawing GradientPaint or image
     * @param shape Shape usede as clipping area
     * @param paint Paint used
     */
    protected void fill(Shape shape, Paint paint) {
        Rectangle2D bounds = shape.getBounds2D();

        // create image
        BufferedImage image = new BufferedImage(
            (int)Math.ceil(bounds.getWidth()) + 1,
            (int)Math.ceil(bounds.getHeight()) + 1,
            BufferedImage.TYPE_INT_ARGB);

        // fill background
        Graphics2D graphics = image.createGraphics();
        graphics.setComposite(AlphaComposite.getInstance(AlphaComposite.CLEAR, 0.0f));
        graphics.fill(graphics.getDeviceConfiguration().getBounds());
        graphics.setComposite(AlphaComposite.SrcOver);

        // draw paint
        graphics.setPaint(paint);
        graphics.translate(- bounds.getMinX(), - bounds.getMinY());
        graphics.fill(shape);
        graphics.dispose();

        // draw image
        Shape clip = getClip();
        clip(shape);
        drawImage(image, (int)bounds.getX(), (int)bounds.getY(), null);
        setClip(clip);
    }
View Full Code Here

        }
        return at;
    }

    public void paint(Graphics2D graphics){
        Rectangle2D anchor = _shape.getLogicalAnchor2D();
        TextElement[] elem = getTextElements((float)anchor.getWidth(), graphics.getFontRenderContext());
        if(elem == null) return;

        float textHeight = 0;
        for (int i = 0; i < elem.length; i++) {
            textHeight += elem[i].ascent + elem[i].descent;
        }

        int valign = _shape.getVerticalAlignment();
        double y0 = anchor.getY();
        switch (valign){
            case TextShape.AnchorTopBaseline:
            case TextShape.AnchorTop:
                y0 += _shape.getMarginTop();
                break;
            case TextShape.AnchorBottom:
                y0 += anchor.getHeight() - textHeight - _shape.getMarginBottom();
                break;
            default:
            case TextShape.AnchorMiddle:
                float delta =  (float)anchor.getHeight() - textHeight - _shape.getMarginTop() - _shape.getMarginBottom();
                y0 += _shape.getMarginTop()  + delta/2;
                break;
        }

        //finally draw the text fragments
        for (int i = 0; i < elem.length; i++) {
            y0 += elem[i].ascent;

            Point2D.Double pen = new Point2D.Double();
            pen.y = y0;
            switch (elem[i]._align) {
                default:
                case TextShape.AlignLeft:
                    pen.x = anchor.getX() + _shape.getMarginLeft();
                    break;
                case TextShape.AlignCenter:
                    pen.x = anchor.getX() + _shape.getMarginLeft() +
                            (anchor.getWidth() - elem[i].advance - _shape.getMarginLeft() - _shape.getMarginRight()) / 2;
                    break;
                case TextShape.AlignRight:
                    pen.x = anchor.getX() + _shape.getMarginLeft() +
                            (anchor.getWidth() - elem[i].advance - _shape.getMarginLeft() - _shape.getMarginRight());
                    break;
            }
            if(elem[i]._bullet != null){
                graphics.drawString(elem[i]._bullet.getIterator(), (float)(pen.x + elem[i]._bulletOffset), (float)pen.y);
            }
View Full Code Here

TOP

Related Classes of com.google.code.appengine.awt.geom.Rectangle2D

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.