亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? colorbar.java

?? Web圖形化的Java庫
?? JAVA
字號:
/* ======================================
 * JFreeChart : a free Java chart library
 * ======================================
 *
 * Project Info:  http://www.jfree.org/jfreechart/index.html
 * Project Lead:  David Gilbert (david.gilbert@object-refinery.com);
 *
 * (C) Copyright 2000-2003, by Object Refinery Limited and Contributors.
 *
 * This library is free software; you can redistribute it and/or modify it under the terms
 * of the GNU Lesser General Public License as published by the Free Software Foundation;
 * either version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License along with this
 * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 * Boston, MA 02111-1307, USA.
 *
 * -------------
 * ColorBar.java
 * -------------
 * (C) Copyright 2002, 2003, by David M. O'Donnell and Contributors.
 *
 * Original Author:  David M. O'Donnell;
 * Contributor(s):   David Gilbert (for Object Refinery Limited);
 *
 * $Id: ColorBar.java,v 1.8 2003/09/08 16:36:15 mungady Exp $
 *
 * Changes
 * -------
 * 26-Nov-2002 : Version 1 contributed by David M. O'Donnell (DG);
 * 14-Jan-2003 : Changed autoRangeMinimumSize from Number --> double (DG);
 * 17-Jan-2003 : Moved plot classes to separate package (DG);
 * 20-Jan-2003 : Removed unnecessary constructors (DG);
 * 26-Mar-2003 : Implemented Serializable (DG);
 * 09-Jul-2003 : Changed ColorBar from extending axis classes to enclosing them (DG);
 * 05-Aug-2003 : Applied changes in bug report 780298 (DG);
 * 14-Aug-2003 : Implemented Cloneable (DG);
 * 08-Sep-2003 : Changed ValueAxis API (DG);
 *
 */

package org.jfree.chart.axis;

import java.awt.BasicStroke;
import java.awt.Graphics2D;
import java.awt.Paint;
import java.awt.RenderingHints;
import java.awt.Stroke;
import java.awt.geom.Line2D;
import java.awt.geom.Rectangle2D;
import java.io.Serializable;

import org.jfree.chart.plot.ContourPlot;
import org.jfree.chart.plot.Plot;
import org.jfree.chart.ui.ColorPalette;
import org.jfree.chart.ui.RainbowPalette;
import org.jfree.ui.RectangleEdge;

/**
 * A color bar.
 *
 * @author David M. O'Donnell
 */
public class ColorBar implements Cloneable, Serializable {

    /** The default color bar thickness. */
    public static final int DEFAULT_COLORBAR_THICKNESS = 0;

    /** The default color bar thickness percentage. */
    public static final double DEFAULT_COLORBAR_THICKNESS_PERCENT = 0.10;

    /** The default outer gap. */
    public static final int DEFAULT_OUTERGAP = 2;

    /** The axis. */
    private ValueAxis axis;
    
    /** The color bar thickness. */
    private int colorBarThickness = DEFAULT_COLORBAR_THICKNESS;

    /** The color bar thickness as a percentage of the height of the data area. */
    private double colorBarThicknessPercent = DEFAULT_COLORBAR_THICKNESS_PERCENT;

    /** The color palette. */
    private ColorPalette colorPalette = null;

    /** The color bar length. */
    private int colorBarLength = 0; // default make height of plotArea

    /** The amount of blank space around the colorbar. */
    private int outerGap;

    /**
     * Constructs a horizontal colorbar axis, using default values where necessary.
     *
     * @param label  the axis label.
     */
    public ColorBar(String label) {
   
        NumberAxis a = new NumberAxis(label);
        a.setAutoRangeIncludesZero(false);
        this.axis = a;
        this.axis.setLowerMargin(0.0);
        this.axis.setUpperMargin(0.0);

        this.colorPalette = new RainbowPalette();
        this.colorBarThickness = DEFAULT_COLORBAR_THICKNESS;
        this.colorBarThicknessPercent = DEFAULT_COLORBAR_THICKNESS_PERCENT;
        this.outerGap = DEFAULT_OUTERGAP;
        this.colorPalette.setMinZ(this.axis.getRange().getLowerBound());
        this.colorPalette.setMaxZ(this.axis.getRange().getUpperBound());

    }

    /**
     * Configures the color bar.
     * 
     * @param plot  the plot.
     */
    public void configure(ContourPlot plot) {
        double minZ = plot.getDataset().getMinZValue();
        double maxZ = plot.getDataset().getMaxZValue();
        setMinimumValue(minZ);
        setMaximumValue(maxZ);
    }
    
    /**
     * Returns the axis.
     * 
     * @return The axis.
     */
    public ValueAxis getAxis() {
        return this.axis;
    }
    
    /**
     * Sets the axis.
     * 
     * @param axis  the axis.
     */
    public void setAxis(ValueAxis axis) {
        this.axis = axis;
    }
    
    /**
     * Rescales the axis to ensure that all data are visible.
     */
    public void autoAdjustRange() {
        this.axis.autoAdjustRange();
        this.colorPalette.setMinZ(this.axis.getLowerBound());
        this.colorPalette.setMaxZ(this.axis.getUpperBound());
    }

    /**
     * Draws the plot on a Java 2D graphics device (such as the screen or a printer).
     *
     * @param g2  the graphics device.
     * @param cursor  the cursor.
     * @param plotArea  the area within which the chart should be drawn.
     * @param dataArea  the area within which the plot should be drawn (a
     *                  subset of the drawArea).
     * @param reservedArea  the reserved area.
     * @param edge  the color bar location.
     * 
     * @return The new cursor location.
     */
    public double draw(Graphics2D g2, double cursor,
                       Rectangle2D plotArea, Rectangle2D dataArea, 
                       Rectangle2D reservedArea, RectangleEdge edge) {


        Rectangle2D colorBarArea = null;
        
        double thickness = calculateBarThickness(dataArea, edge);
        if (this.colorBarThickness > 0) {
            thickness = this.colorBarThickness;  // allow fixed thickness
        }

        double length = 0.0;
        if (RectangleEdge.isLeftOrRight(edge)) {
            length = dataArea.getHeight();
        }
        else {
            length = dataArea.getWidth();
        }
        
        if (this.colorBarLength > 0) {
            length = this.colorBarLength;
        }

        if (edge == RectangleEdge.BOTTOM) {
            colorBarArea = new Rectangle2D.Double(dataArea.getX(),
                                                  plotArea.getMaxY() + this.outerGap,
                                                  length, thickness);
        }
        else if (edge == RectangleEdge.TOP) {
            colorBarArea = new Rectangle2D.Double(dataArea.getX(),
                                                  reservedArea.getMinY() + this.outerGap,
                                                  length, thickness);            
        }
        else if (edge == RectangleEdge.LEFT) {
            colorBarArea = new Rectangle2D.Double(plotArea.getX() - thickness - this.outerGap ,
                                                  dataArea.getMinY(),
                                                  thickness, length);            
        }
        else if (edge == RectangleEdge.RIGHT) {
            colorBarArea = new Rectangle2D.Double(plotArea.getMaxX() + this.outerGap,
                                                  dataArea.getMinY(),
                                                  thickness, length);            
        }
        
        // update, but dont draw tick marks (needed for stepped colors)
        this.axis.refreshTicks(g2, 0.0, plotArea, colorBarArea, edge);

        drawColorBar(g2, colorBarArea, edge);

        if (edge == RectangleEdge.TOP) {
            cursor = colorBarArea.getMinY();
            cursor = this.axis.draw(g2, cursor, reservedArea, colorBarArea, RectangleEdge.TOP);
        } 
        else if (edge == RectangleEdge.BOTTOM) {
            cursor = colorBarArea.getMaxY();
            cursor = this.axis.draw(g2, cursor, reservedArea, colorBarArea, RectangleEdge.BOTTOM);
        } 
        else if (edge == RectangleEdge.LEFT) {
            cursor = colorBarArea.getMinX();
            cursor = this.axis.draw(g2, cursor, reservedArea, colorBarArea, RectangleEdge.LEFT);
        } 
        else if (edge == RectangleEdge.RIGHT) {
            cursor = colorBarArea.getMaxX();
            cursor = this.axis.draw(g2, cursor, reservedArea, colorBarArea, RectangleEdge.RIGHT);
        }
        return cursor;
        
    }

    /**
     * Draws the plot on a Java 2D graphics device (such as the screen or a printer).
     *
     * @param g2  the graphics device.
     * @param colorBarArea  the area within which the axis should be drawn.
     * @param edge  the location.
     */
    public void drawColorBar(Graphics2D g2, Rectangle2D colorBarArea, RectangleEdge edge) {

        Object antiAlias = g2.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                            RenderingHints.VALUE_ANTIALIAS_OFF);

        // setTickValues was missing from ColorPalette v. 0.96
        colorPalette.setTickValues(this.axis.getTicks());

        Stroke strokeSaved = g2.getStroke();
        g2.setStroke(new BasicStroke(1.0f));

        if (RectangleEdge.isTopOrBottom(edge)) {
            double y1 = colorBarArea.getY();
            double y2 = colorBarArea.getMaxY();
            double xx = colorBarArea.getX();
            Line2D line = new Line2D.Double();
            while (xx <= colorBarArea.getMaxX()) {
                double value = this.axis.translateJava2DtoValue((float) xx, colorBarArea,
                                                                edge);
                line.setLine(xx, y1, xx, y2);
                g2.setPaint(getPaint(value));
                g2.draw(line);
                xx += 1;
            }
        }
        else {
            double y1 = colorBarArea.getX();
            double y2 = colorBarArea.getMaxX();
            double xx = colorBarArea.getY();
            Line2D line = new Line2D.Double();
            while (xx <= colorBarArea.getMaxY()) {
                double value = this.axis.translateJava2DtoValue((float) xx, colorBarArea,
                                                                edge);
                line.setLine(y1, xx, y2, xx);
                g2.setPaint(getPaint(value));
                g2.draw(line);
                xx += 1;
            }            
        }

        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, antiAlias);
        g2.setStroke(strokeSaved);

    }

    /**
     * Returns the color palette.
     *
     * @return the color palette.
     */
    public ColorPalette getColorPalette() {
        return colorPalette;
    }

    /**
     * Returns the Paint associated with a value.
     *
     * @param value  the value.
     *
     * @return the paint.
     */
    public Paint getPaint(double value) {
        return colorPalette.getPaint(value);
    }

    /**
     * Sets the color palette.
     *
     * @param palette  the new palette.
     */
    public void setColorPalette(ColorPalette palette) {
        this.colorPalette = palette;
    }

    /**
     * Sets the maximum value.
     *
     * @param value  the maximum value.
     */
    public void setMaximumValue(double value) {
        this.colorPalette.setMaxZ(value);
        this.axis.setUpperBound(value);
    }

    /**
     * Sets the minimum value.
     *
     * @param value  the minimum value.
     */
    public void setMinimumValue(double value) {
        this.colorPalette.setMinZ(value);
        this.axis.setLowerBound(value);
    }

    /**
     * Reserves the space required to draw the color bar.
     *
     * @param g2  the graphics device.
     * @param plot  the plot that the axis belongs to.
     * @param plotArea  the area within which the plot should be drawn.
     * @param dataArea  the data area.
     * @param edge  the axis location.
     * @param space  the space already reserved.
     *
     * @return The space required to draw the axis in the specified plot area.
     */
    public AxisSpace reserveSpace(Graphics2D g2, Plot plot, Rectangle2D plotArea,
                                  Rectangle2D dataArea, RectangleEdge edge, AxisSpace space) {

        AxisSpace result = this.axis.reserveSpace(g2, plot, plotArea, edge, space);

        double thickness = calculateBarThickness(dataArea, edge);
        result.add(thickness + 2 * this.outerGap, edge);
        return result;

    }
    
    /**
     * Calculates the bar thickness.
     * 
     * @param plotArea  the plot area.
     * @param edge  the location.
     * 
     * @return The thickness.
     */
    private double calculateBarThickness(Rectangle2D plotArea, RectangleEdge edge) {
        double result = 0.0;
        if (RectangleEdge.isLeftOrRight(edge)) {
            result = plotArea.getWidth() * colorBarThicknessPercent;
        }
        else {
            result = plotArea.getHeight() * colorBarThicknessPercent;
        }
        return result;  
    }

    /**
     * Returns a clone of the object.
     * 
     * @return A clone.
     * 
     * @throws CloneNotSupportedException if some component of the color bar does not support 
     *         cloning.
     */
    public Object clone() throws CloneNotSupportedException {
    
        ColorBar clone = (ColorBar) super.clone();
        
        clone.axis = (ValueAxis) this.axis.clone();
        
        return clone;
            
    }
    
    /**
     * Tests this object for equality with another.
     * 
     * @param obj  the object to test against.
     * 
     * @return A boolean.
     */
    public boolean equals(Object obj) {

        if (obj == null) {
            return false;
        }

        if (obj == this) {
            return true;
        }

        if (obj instanceof ColorBar) {
            ColorBar cb = (ColorBar) obj;
            boolean b0 = this.axis.equals(cb.axis);
            boolean b1 = this.colorBarThickness == cb.colorBarThickness;
            boolean b2 = this.colorBarThicknessPercent == cb.colorBarThicknessPercent;
            boolean b3 = this.colorPalette.equals(cb.colorPalette);
            boolean b4 = this.colorBarLength == cb.colorBarLength;
            boolean b5 = this.outerGap == cb.outerGap;
            return b0 && b1 && b2 && b3 && b4 && b5;
        }
        
        return false;
        
    }
    
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲欧美日韩成人高清在线一区| 欧美一区二区三区性视频| 毛片av一区二区| 亚洲一区在线视频观看| 亚洲影院免费观看| 亚洲精选免费视频| 亚洲精品videosex极品| ●精品国产综合乱码久久久久| 国产三区在线成人av| 国产视频一区二区在线| 国产精品久久久久久久午夜片| 国产精品毛片高清在线完整版| 亚洲日本免费电影| 亚洲一级二级在线| 午夜视频一区二区| 蜜桃91丨九色丨蝌蚪91桃色| 美女脱光内衣内裤视频久久影院| 久久精品999| 成人三级在线视频| 欧美性受xxxx黑人xyx性爽| 欧美久久一二三四区| 欧美另类z0zxhd电影| 亚洲精品一区在线观看| 欧美mv日韩mv国产| 国产精品视频在线看| 亚洲在线视频一区| 麻豆国产精品视频| 色哟哟国产精品| 日韩一区二区三区免费看| 国产欧美1区2区3区| 亚洲国产va精品久久久不卡综合| 日本女优在线视频一区二区| 国产91精品精华液一区二区三区| 日本韩国欧美三级| 精品国偷自产国产一区| 中文字幕制服丝袜一区二区三区 | 欧美日韩电影在线播放| 欧美xxxxxxxx| 一区二区三区小说| 天使萌一区二区三区免费观看| 精品无码三级在线观看视频 | 亚洲一区二区三区在线播放| 蜜桃视频免费观看一区| 色综合夜色一区| 欧美一区二区观看视频| 日韩美女精品在线| 国产一区视频网站| 欧美丝袜第三区| 国产精品白丝在线| 国产激情精品久久久第一区二区 | 国产盗摄女厕一区二区三区| 欧美日韩三级在线| 中文字幕在线不卡一区| 精品在线播放午夜| 这里只有精品99re| 亚洲国产毛片aaaaa无费看| 大胆欧美人体老妇| 日韩免费成人网| 日韩精品电影在线| 91浏览器入口在线观看| 日本一区二区视频在线| 久久av老司机精品网站导航| 欧美日韩国产精品成人| 亚洲精品久久7777| 色哟哟日韩精品| 亚洲免费看黄网站| 99精品久久只有精品| 国产色产综合色产在线视频| 韩国三级在线一区| 精品国偷自产国产一区| 极品少妇一区二区三区精品视频| 日韩午夜激情免费电影| 午夜精品福利一区二区三区av| 色香色香欲天天天影视综合网| 国产精品久久久久一区| aaa欧美大片| 亚洲黄色av一区| 欧美伊人久久久久久午夜久久久久| 亚洲青青青在线视频| 99精品偷自拍| 一区二区三区在线观看网站| 欧美亚洲一区二区在线| 五月天网站亚洲| 制服丝袜av成人在线看| 久久激五月天综合精品| 精品日产卡一卡二卡麻豆| 国产精品一级在线| 国产精品丝袜黑色高跟| 91精品1区2区| 日韩电影在线观看电影| 26uuu久久天堂性欧美| 成人国产精品免费网站| 一区二区三区精品| 欧美日本精品一区二区三区| 美女网站视频久久| 国产午夜精品久久久久久免费视 | 久久久.com| 色综合久久精品| 视频一区免费在线观看| 精品久久国产老人久久综合| 成人app在线观看| 亚洲一区二区三区激情| 日韩一区二区视频| 成人看片黄a免费看在线| 樱花影视一区二区| 日韩亚洲欧美一区二区三区| 国产酒店精品激情| 亚洲最新在线观看| 日韩精品一区二区三区视频播放 | 国产一区二区女| 亚洲精品视频在线观看免费 | 蜜桃视频一区二区| 亚洲国产经典视频| 欧美日韩国产精品成人| 丁香婷婷综合五月| 视频一区视频二区中文| 中文av一区特黄| 欧美不卡一区二区三区四区| 不卡的av电影在线观看| 男女性色大片免费观看一区二区| 中文字幕人成不卡一区| 久久综合九色综合97婷婷女人| 色婷婷精品久久二区二区蜜臀av| 精品一区二区三区在线观看国产| 亚洲精品乱码久久久久久| 久久日一线二线三线suv| 欧美午夜不卡在线观看免费| 国产不卡免费视频| 免费观看30秒视频久久| 夜夜嗨av一区二区三区四季av| 久久一夜天堂av一区二区三区| 欧美日韩在线电影| 91福利精品第一导航| 成人永久看片免费视频天堂| 久久99精品久久只有精品| 亚洲午夜视频在线观看| 亚洲日本在线看| 中文字幕一区二区三| 久久九九久精品国产免费直播| 91精品啪在线观看国产60岁| 欧美在线播放高清精品| 91麻豆视频网站| 91亚洲国产成人精品一区二区三| 国产精品中文字幕欧美| 久久精品999| 捆绑调教美女网站视频一区| 三级精品在线观看| 日韩黄色一级片| 日韩激情在线观看| 日本系列欧美系列| 日韩精品一二三四| 麻豆精品在线视频| 久久国产免费看| 国产精品一品二品| 成人一二三区视频| 9久草视频在线视频精品| 波波电影院一区二区三区| 成人av中文字幕| 91浏览器打开| 欧美无砖专区一中文字| 91麻豆精品国产综合久久久久久| 欧美精品色综合| 欧美videos大乳护士334| 久久女同精品一区二区| 久久久www免费人成精品| 国产精品美女视频| 亚洲人成人一区二区在线观看| 亚洲激情校园春色| 日韩在线观看一区二区| 激情六月婷婷综合| 丰满亚洲少妇av| 在线一区二区三区四区| 7777精品伊人久久久大香线蕉完整版| 欧美电影影音先锋| 久久久综合网站| 亚洲欧美电影一区二区| 亚洲va欧美va天堂v国产综合| 日本少妇一区二区| 成人黄页在线观看| 欧美色综合影院| 久久久久久久免费视频了| 综合久久一区二区三区| 三级欧美在线一区| 北岛玲一区二区三区四区| 欧美日精品一区视频| 欧美一级欧美三级在线观看| 久久久综合视频| 亚洲乱码日产精品bd| 久久99国产乱子伦精品免费| www.亚洲色图| 日韩天堂在线观看| 亚洲天堂中文字幕| 激情综合色综合久久| 在线看日韩精品电影| 精品国产免费视频| 亚洲va天堂va国产va久| 成人av影视在线观看| 精品国产91九色蝌蚪| 午夜欧美一区二区三区在线播放| 高清久久久久久|