Package java.awt.geom

Examples of java.awt.geom.AffineTransform


        g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                AbstractShape.ANTI_ALIASING
                ? RenderingHints.VALUE_ANTIALIAS_ON
                        : RenderingHints.VALUE_ANTIALIAS_OFF);

        AffineTransform oldTransform=null;
        if(transform!=null){
            oldTransform=g.getTransform();
            g.transform(transform.getTransform());
        }
View Full Code Here


        // read persitent fields
        s.defaultReadObject();

        // backward compatiblity
        if(displayFirstArrow){
            firstArrowTransform=new AffineTransform();
        }
        if(displayLastArrow){
            lastArrowTransform=new AffineTransform();
        }
        if (path == null){
           setPath(new StraightPath(_xv, _yv));
        }
        _xv = null;
View Full Code Here

        Color oldBackground = g.getBackground();
        Stroke oldStroke = g.getStroke();
        Object antialiasHint = g.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
        g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                AbstractShape.ANTI_ALIASING ? RenderingHints.VALUE_ANTIALIAS_ON : RenderingHints.VALUE_ANTIALIAS_OFF);
        AffineTransform oldTransform = null;
        if (transform != null) {
            oldTransform = g.getTransform();
            g.transform(getTransform());
        }
        drawHook(g, false);
View Full Code Here

   
    /* (non-Javadoc)
     * @see simtools.shapes.AbstractShape#getTransform()
     */
    public AffineTransform getTransform(){
        AffineTransform res = null;
        if (transform != null){
            res =  transform.getTransform();
        } else {
            res = super.getTransform();
        }
View Full Code Here

     * @param g the Graphics2D object in which to render
     */
    public void renderChart(Graphics2D g) {
        ChartDataModel m = getChartDataModel();
        RowColorModel rcm = getRowColorModel();
        AffineTransform yaxis1 = getTransform(CoordSystem.FIRST_YAXIS);
       
        int datasetcount = m.getDataSetNumber();
        Point2D val;
        Point2D paint = null;
        Point2D oldpaint = null;
        if(! m.isColumnNumeric())
            return;
       
        for(int set = 0; set < datasetcount; set++) {
            // Creating Interpolated Function Data
            /*
             "for i in range(AMOUNT) :\n"+
             "   x = lowrange + i * (float(abs(highrange - lowrange)) / AMOUNT)\n"+
             "   columns.append(x)\n"+
             "   model.append("+function+")\n";
            */
           
            double[] x = new double[m.getDataSetLength(set)];
            double[] y = new double[x.length];
           
            for(int i = 0; i < m.getDataSetLength(set);  i++) {
                x[i] = ((Number)m.getColumnValueAt(set, i)).doubleValue();
               
                // Catch x[i] == Not A Number
                if(x[i] != x[i]) x[i] = 0.0;
               
                y[i] = m.getValueAt(set, i).doubleValue();
            }       
                       
            int AMOUNT = 2000;
            double lowrange = m.getChartDataModelConstraints(CoordSystem.FIRST_YAXIS).getMinimumColumnValue();
            double hirange = m.getChartDataModelConstraints(CoordSystem.FIRST_YAXIS).getMaximumColumnValue();

            double xa[] = new double[AMOUNT];
            double ya[] = new double[AMOUNT];
           
            for(int i = 0; i < AMOUNT; i++) {
                xa[i] = lowrange + i * (Math.abs(hirange - lowrange) / (double)AMOUNT);
                ya[i] = ChartUtilities.interpolate(x, y, xa[i]);
            }
           
            // Rendering xa[] and ya[]
            for(int i = 0; i < AMOUNT; i++) {
               
                val = new Point2D.Double(xa[i], ya[i]);
                   
                oldpaint = paint;
                if(yaxis1.transform(val, null) != null)
                    paint = yaxis1.transform(val, paint);
                else
                    continue;
               
                g.setColor(rcm.getColor(set));
               
View Full Code Here

     * @param g the Graphics2D object in which to render
     */
    public void renderChart(Graphics2D g) {
        ChartDataModel m = getChartDataModel();
        RowColorModel rcm = getRowColorModel();
        AffineTransform yaxis1 = getTransform(CoordSystem.FIRST_YAXIS);
       
        int datasetcount = m.getDataSetNumber();
        Point2D val;
        Point2D paint = null;
        Point2D oldpaint = null;
        boolean numericalcolumns = m.isColumnNumeric();
        float modelVal = 0f;
        //System.out.println("** Render LineChart.-");
        for(int set = 0; set < datasetcount; set++) {
            for(int value = 0; value < m.getDataSetLength(set);  value++) {
                modelVal = m.getValueAt(set, value).floatValue();
               
                if(modelVal != modelVal || modelVal == Float.NEGATIVE_INFINITY || modelVal == Float.POSITIVE_INFINITY) {
                    //System.out.print(".");
                    oldpaint = null;
                    continue;
                }
               
                if(numericalcolumns)
                    val = new Point2D.Float(((Number)m.getColumnValueAt(set, value)).floatValue(),
                                            modelVal);
                else
                    val = new Point2D.Float((float)value,
                                            modelVal);

                //System.out.println("** Rendered "+val);
                oldpaint = paint;
               
                if(yaxis1.transform(val, null) != null) {
                    paint = yaxis1.transform(val, null);
                    //System.out.println("** val = "+val+"  paint = "+paint);
                }
                else
                    continue;

View Full Code Here

    System.out.println(" image type = "+image.getType());
    System.out.println(" transfer type = "+sm.getTransferType());

    // see if we can operate on it
    AffineTransform at = new AffineTransform()// identity transform
    AffineTransformOp op = new AffineTransformOp( at, AffineTransformOp.TYPE_NEAREST_NEIGHBOR );
    BufferedImage targetImage = new BufferedImage(
             image.getWidth(), image.getHeight(), BufferedImage.TYPE_3BYTE_BGR );

    BufferedImage image2 = op.filter( image, targetImage );
View Full Code Here

     * @param g the Graphics2D object in which to render
     */
    public void renderChart(Graphics2D g) {
        ChartDataModel m = getChartDataModel();
        RowColorModel rcm = getRowColorModel();
        AffineTransform yaxis1 = getTransform(CoordSystem.FIRST_YAXIS);
       
        int datasetcount = m.getDataSetNumber();
        Point2D val;
        Point2D paint = new Point2D.Float(0f, 0f);
        boolean numericalcolumns = m.isColumnNumeric();
 
        float modelVal = 0f;
       
        RectangularShape shape;
       
        for(int set = 0; set < datasetcount; set++) {
            for(int value = 0; value < m.getDataSetLength(set);  value++) {
                modelVal = m.getValueAt(set, value).floatValue();
               
                // Catch modelVal == Not A Number
                if(modelVal != modelVal)
                    continue;
               
                if(numericalcolumns)
                    val = new Point2D.Float(((Number)m.getColumnValueAt(set, value)).floatValue(),
                                            modelVal);
                else
                    val = new Point2D.Float((float)value,
                                            modelVal);
                   
               
                yaxis1.transform(val, paint);
                if(paint == null)
                    continue;
               
                g.setColor(rcm.getColor(set));
               
View Full Code Here

       
        if(m.isColumnNumeric())
            return;
       
        RowColorModel rcm = getRowColorModel();
        AffineTransform yaxis1 = getTransform(CoordSystem.FIRST_YAXIS);       
        AffineTransform yaxis2 = getTransform(CoordSystem.SECOND_YAXIS);
       
        int datasetcount = m.getDataSetNumber();
           
        Point2D point1 = yaxis1.transform(new Point2D.Float((float)con.getMinimumColumnValue(),
                                                           con.getMaximumValue().floatValue()),
View Full Code Here

       
        if(m.isColumnNumeric())
            return;
       
        RowColorModel rcm = getRowColorModel();
        AffineTransform yaxis1 = getTransform(CoordSystem.FIRST_YAXIS);
       
        int datasetcount = m.getDataSetNumber();
       
        int maximumDataSetLength = Integer.MIN_VALUE;
       
        for(int i = 0; i < model.getDataSetNumber(); i++) {
            maximumDataSetLength = Math.max(maximumDataSetLength, model.getDataSetLength(i));
        }
       
        Point2D pointzero;
        if(con.getMinimumValue().floatValue() > 0)
           pointzero = yaxis1.transform(new Point2D.Float((float)con.getMinimumColumnValue(),
                                                         con.getMinimumValue().floatValue()),
                                        null);
        else if(con.getMaximumValue().floatValue() < 0)
           pointzero = yaxis1.transform(new Point2D.Float((float)con.getMinimumColumnValue(),
                                                         con.getMaximumValue().floatValue()),
                                        null);
        else
           pointzero = yaxis1.transform(new Point2D.Float((float)con.getMinimumColumnValue(),
                                                         0f),
                                        null);
       
        Point2D point1 = yaxis1.transform(new Point2D.Float((float)con.getMinimumColumnValue(),
                                                           con.getMaximumValue().floatValue()),
                                          null);
        Point2D point2 = yaxis1.transform(new Point2D.Float((float)con.getMaximumColumnValue(),
                                                             con.getMaximumValue().floatValue()),
                                          null);
        Point2D value = point1;
       
        int dataunitwidth = (int)((point2.getX() - point1.getX()) / con.getMaximumColumnValue());
        int boxwidth = (int)(dataunitwidth * boxWidth);
        float margin = (float)(dataunitwidth * ((1.0 - boxWidth)/2f));
       
        /* We paint the values starting at x-value "0".
         * As we only render BarCharts for ChartDataModels with
         * non-numeric x-axis values we don't have to read those
         * values from the data model. You can look in
         * ObjectChartDataModel to see, how the x-axis bounds
         * are defined: the minimum value is always 0, the maximum
         * value is the amount of non-numeric x-axis values.
         */
        double currentvalue = 0.0;
        Rectangle2D box = null;
        Point2D oldmaxvalue;
        Point2D oldminvalue;
       
        for(int j = 0; j < maximumDataSetLength; j++) {
            double minvalue = 0.0;
            double maxvalue = 0.0;
           
            oldmaxvalue = pointzero;
            oldminvalue = pointzero;
           
            for(int i = 0; i < m.getDataSetNumber(); i++) {
               
                if(j < m.getDataSetLength(i))
                    currentvalue = m.getValueAt(i, j).doubleValue();
                else
                    currentvalue = 0.0;
               
                if(currentvalue < 0.0) {
                    minvalue += currentvalue;
                    yaxis1.transform(new Point2D.Float((float)j, (float)minvalue),
                                     value);
                  
                    box =
                        new Rectangle2D.Float((float)(value.getX()),
                                              (float)Math.min(value.getY(), oldminvalue.getY()),
                                              (float)boxwidth,
                                              (float)Math.abs(oldminvalue.getY() - value.getY()));
                    oldminvalue = (Point2D)value.clone();
                 }
                else {
                    maxvalue += currentvalue;
                    yaxis1.transform(new Point2D.Float((float)j, (float)maxvalue),
                                     value);
                   
                    box =
                        new Rectangle2D.Float((float)(value.getX()),
                                              (float)Math.min(value.getY(), oldmaxvalue.getY()),
View Full Code Here

TOP

Related Classes of java.awt.geom.AffineTransform

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.