Package java.awt.geom

Examples of java.awt.geom.Rectangle2D


      return;
    }

    double value = dataValue.doubleValue();

    Rectangle2D adjusted = new Rectangle2D.Double(dataArea.getX(),
      dataArea.getY() + getYOffset(),
      dataArea.getWidth() - getXOffset(),
      dataArea.getHeight() - getYOffset());

    PlotOrientation orientation = plot.getOrientation();

    double barW0 = calculateBarW0(plot, orientation, adjusted, domainAxis,
      state, row, column);
    double[] barL0L1 = calculateBarL0L1(value);
    if (barL0L1 == null) {
      return// the bar is not visible
    }

    RectangleEdge edge = plot.getRangeAxisEdge();
    double transL0 = rangeAxis.valueToJava2D(barL0L1[0], adjusted, edge);
    double transL1 = rangeAxis.valueToJava2D(barL0L1[1], adjusted, edge);
    double barL0 = Math.min(transL0, transL1);
    double barLength = Math.abs(transL1 - transL0);

    // draw the bar...
    Rectangle2D bar = null;
    if (orientation == PlotOrientation.HORIZONTAL) {
      bar = new Rectangle2D.Double(barL0, barW0, barLength, state.getBarWidth());
    }
    else {
      bar = new Rectangle2D.Double(barW0, barL0, state.getBarWidth(), barLength);
    }
    Paint itemPaint = getItemPaint(row, column);
    if (itemPaint instanceof GradientPaint)
    {
      itemPaint = getGradientPaintTransformer().transform((GradientPaint)itemPaint, bar);
    }
    g2.setPaint(itemPaint);
    g2.fill(bar);

    double x0 = bar.getMinX();
    double x1 = x0 + getXOffset();
    double x2 = bar.getMaxX();
    double x3 = x2 + getXOffset();

    double y0 = bar.getMinY() - getYOffset();
    double y1 = bar.getMinY();
    double y2 = bar.getMaxY() - getYOffset();
    double y3 = bar.getMaxY();

    GeneralPath bar3dRight = null;
    GeneralPath bar3dTop = null;
    if (barLength > 0.0) {
      bar3dRight = new GeneralPath();
View Full Code Here


        // In case a null op was passed in, skip it instead of dying
        if (op == null)
          continue;

        long opStartTime = System.currentTimeMillis();
        Rectangle2D dims = op.getBounds2D(result);

        /*
         * We must manually create the target image; we cannot rely on
         * the null-dest filter() method to create a valid destination
         * for us thanks to this JDK bug that has been filed for almost
         * a decade:
         * http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4965606
         */
        BufferedImage dest = new BufferedImage((int) Math.round(dims
            .getWidth()), (int) Math.round(dims.getHeight()),
            result.getType());

        result = op.filter(result, dest);

        if (DEBUG)
View Full Code Here

    /* (non-Javadoc)
     * @see org.jpox.store.mapping.JavaTypeMapping#setObject(org.jpox.ObjectManager, java.lang.Object, int[], java.lang.Object)
     */
    public void setObject(ObjectManager om, Object preparedStatement, int[] exprIndex, Object value)
    {
      Rectangle2D rectangle = (Rectangle2D)value;
        if (rectangle == null)
        {
        for (int i = 0; i < exprIndex.length; i++)
        {
          getDataStoreMapping(i).setObject(preparedStatement, exprIndex[i], null);         
      }
        }
        else
        {
            getDataStoreMapping(0).setDouble(preparedStatement,exprIndex[0],rectangle.getX());
            getDataStoreMapping(1).setDouble(preparedStatement,exprIndex[1],rectangle.getY());
            getDataStoreMapping(2).setDouble(preparedStatement,exprIndex[2],rectangle.getWidth());
            getDataStoreMapping(3).setDouble(preparedStatement,exprIndex[3],rectangle.getHeight());
        }
    }
View Full Code Here

        Font f = c.getFont();
       
        for(double d = min; d <= max; d += tick) {
            if(paint) {
                String sb = df.format(d);
                Rectangle2D r = f.getStringBounds(sb, frc);
               
                height = Math.max(height, (int)r.getHeight());               
            }
            paint = !paint;
        }
       
        return height;
View Full Code Here

        Font f = c.getFont();
   
        for(double d = min; d <= max; d += tick) {
            if(paint) {
                String sb = df.format(d);
                Rectangle2D r = f.getStringBounds(sb, frc);
               
                width = Math.max((int)r.getWidth(), width);
            }
            paint = !paint;
        }
       
        return width;
View Full Code Here

           
            ticks.setLine(v.getX(), v.getY() - marginOffset/2, v.getX(), v.getY() + marginOffset/2);
            g.draw(ticks);
            if(paint && paintLabels) {
                String sb = df.format(d);
                Rectangle2D r = f.getStringBounds(sb, frc);
               
                g.drawString(sb, (float)(v.getX() - r.getWidth() / 2),
              (float)(v.getY() + r.getHeight() + marginOffset));
            }
            paint = !paint;
        }
    }
View Full Code Here

                g.draw(ticks);
           
            // Draw Strings between ticks
            if(oldv != null && paintLabels) {
                String sb = (String)model.getColumnValueAt(i);
                Rectangle2D r = f.getStringBounds(sb, frc);
               
                g.drawString(sb, (float)(oldv.getX()+(v.getX() - oldv.getX()) / 2 - r.getWidth() / 2),
                                (float)(v.getY() + r.getHeight() + marginOffset));
            }
           
            oldv = v;
        }
    }
View Full Code Here

                g.setColor(backupColor);
            }
           
            if(paintLabels && (paint || !c.isPaintAltTick())) {
                String sb = df.format(d);
                Rectangle2D r = f.getStringBounds(sb, frc);
               
                g.drawString(sb, (float)(v.getX() - r.getWidth() - marginOffset),
                            (float)(v.getY() + r.getHeight() / 2));
            }
            paint = !paint;
        }
    }
View Full Code Here

   
    /** Returns the preferred size needed for the renderer.
     * @return a non-null Dimension object
     */
    public Dimension getPreferredSize() {
        Rectangle2D titleBounds =
            getFont().getStringBounds(getText(),
                                      new FontRenderContext(null, true, false));
       
        return new Dimension((int)titleBounds.getWidth(),
                             (int)titleBounds.getHeight());
    }   
View Full Code Here

            return 0;
        Graphics2D g2 = (Graphics2D) g;
        FontRenderContext frc = g2.getFontRenderContext();
        Font font = g.getFont();
        TextLayout layout = new TextLayout(text, font, frc);
        Rectangle2D bounds = layout.getBounds();
        return (int) bounds.getWidth() + 1;
    }
View Full Code Here

TOP

Related Classes of java.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.