⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 combinedrangexyplot.java

📁 这是一个segy数据显示程序
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
                                                              adjustedPlotArea.getHeight());                x = x + w + this.gap;            }            else if (orientation == PlotOrientation.HORIZONTAL) {                double h = usableSize * plot.getWeight() / this.totalWeight;                this.subplotAreas[i] = new Rectangle2D.Double(x, y, adjustedPlotArea.getWidth(), h);                y = y + h + this.gap;            }            AxisSpace subSpace = plot.calculateDomainAxisSpace(g2, this.subplotAreas[i], null);            space.ensureAtLeast(subSpace);        }        return space;    }    /**     * Draws the plot on a Java 2D graphics device (such as the screen or a printer).     * Will perform all the placement calculations for each sub-plots and then tell these to draw     * themselves.     *     * @param g2  the graphics device.     * @param area  the area within which the plot (including axis labels) should be drawn.     * @param parentState  the state from the parent plot (if there is one).     * @param info  collects information about the drawing (<code>null</code> permitted).     */    public void draw(Graphics2D g2,                      Rectangle2D area,                      PlotState parentState,                     PlotRenderingInfo info) {        draw(g2, area, null, parentState, info);                              }        /**     * Draws the plot within the specified area on a graphics device.     *      * @param g2  the graphics device.     * @param area  the plot area (in Java2D space).     * @param anchor  an anchor point in Java2D space (<code>null</code> permitted).     * @param parentState  the state from the parent plot, if there is one (<code>null</code>      *                     permitted).     * @param info  collects chart drawing information (<code>null</code> permitted).     */    public void draw(Graphics2D g2,                     Rectangle2D area,                     Point2D anchor,                     PlotState parentState,                     PlotRenderingInfo info) {                // set up info collection...        if (info != null) {            info.setPlotArea(area);        }        // adjust the drawing area for plot insets (if any)...        Insets insets = getInsets();        if (insets != null) {            area.setRect(area.getX() + insets.left,                         area.getY() + insets.top,                         area.getWidth() - insets.left - insets.right,                         area.getHeight() - insets.top - insets.bottom);        }        AxisSpace space = calculateAxisSpace(g2, area);        Rectangle2D dataArea = space.shrink(area, null);        //this.axisOffset.trim(dataArea);        // set the width and height of non-shared axis of all sub-plots        setFixedDomainAxisSpaceForSubplots(space);        // draw the shared axis        ValueAxis axis = getRangeAxis();        RectangleEdge edge = getRangeAxisEdge();        double cursor = RectangleEdge.coordinate(dataArea, edge);        AxisState axisState = axis.draw(g2, cursor, area, dataArea, edge, info);        if (parentState == null) {            parentState = new PlotState();        }        parentState.getSharedAxisStates().put(axis, axisState);                // draw all the charts        for (int i = 0; i < this.subplots.size(); i++) {            XYPlot plot = (XYPlot) this.subplots.get(i);            PlotRenderingInfo subplotInfo = null;            if (info != null) {                subplotInfo = new PlotRenderingInfo(info.getOwner());                info.addSubplotInfo(subplotInfo);            }            plot.draw(g2, this.subplotAreas[i], anchor, parentState, subplotInfo);        }        if (info != null) {            info.setDataArea(dataArea);        }    }    /**     * Returns a collection of legend items for the plot.     *     * @return the legend items.     */    public LegendItemCollection getLegendItems() {        LegendItemCollection result = new LegendItemCollection();        if (this.subplots != null) {            Iterator iterator = this.subplots.iterator();            while (iterator.hasNext()) {                XYPlot plot = (XYPlot) iterator.next();                LegendItemCollection more = plot.getLegendItems();                result.addAll(more);            }        }        return result;    }    /**     * A zoom method that (currently) does nothing.     *     * @param percent  the zoom percentage.     */    public void zoom(double percent) {        // need to decide how to handle zooming...    }    /**     * Sets the item renderer FOR ALL SUBPLOTS.  Registered listeners are notified that the plot     * has been modified.     * <P>     * Note: usually you will want to set the renderer independently for each subplot, which is     * NOT what this method does.     *     * @param renderer the new renderer.     */    public void setRenderer(XYItemRenderer renderer) {        super.setRenderer(renderer);  // not strictly necessary, since the renderer set for the                                      // parent plot is not used        Iterator iterator = this.subplots.iterator();        while (iterator.hasNext()) {            XYPlot plot = (XYPlot) iterator.next();            plot.setRenderer(renderer);        }    }    /**     * Sets the orientation for the plot (and all its subplots).     *      * @param orientation  the orientation.     */    public void setOrientation(PlotOrientation orientation) {        super.setOrientation(orientation);        Iterator iterator = this.subplots.iterator();        while (iterator.hasNext()) {            XYPlot plot = (XYPlot) iterator.next();            plot.setOrientation(orientation);        }    }    /**     * Returns the range for the axis.  This is the combined range of all the subplots.     *     * @param axis  the axis.     *     * @return the range.     */    public Range getDataRange(ValueAxis axis) {        Range result = null;        if (this.subplots != null) {            Iterator iterator = this.subplots.iterator();            while (iterator.hasNext()) {                XYPlot subplot = (XYPlot) iterator.next();                result = Range.combine(result, subplot.getDataRange(axis));            }        }        return result;    }    /**     * Sets the space (width or height, depending on the orientation of the plot) for the domain     * axis of each subplot.     *     * @param space  the space.     */    protected void setFixedDomainAxisSpaceForSubplots(AxisSpace space) {        Iterator iterator = this.subplots.iterator();        while (iterator.hasNext()) {            XYPlot plot = (XYPlot) iterator.next();            plot.setFixedDomainAxisSpace(space);        }    }    /**     * Handles a 'click' on the plot by updating the anchor values...     *     * @param x  x-coordinate, where the click occured.     * @param y  y-coordinate, where the click occured.     * @param info  object containing information about the plot dimensions.     */    public void handleClick(int x, int y, PlotRenderingInfo info) {        Rectangle2D dataArea = info.getDataArea();        if (dataArea.contains(x, y)) {            for (int i = 0; i < this.subplots.size(); i++) {                XYPlot subplot = (XYPlot) this.subplots.get(i);                PlotRenderingInfo subplotInfo = info.getSubplotInfo(i);                subplot.handleClick(x, y, subplotInfo);            }        }    }    /**     * Receives a {@link PlotChangeEvent} and responds by notifying all listeners.     *      * @param event  the event.     */    public void plotChanged(PlotChangeEvent event) {        notifyListeners(event);    }    /**     * Tests this plot for equality with another object.     *     * @param obj  the other object.     *     * @return <code>true</code> or <code>false</code>.     */    public boolean equals(Object obj) {        if (obj == null) {            return false;        }        if (obj == this) {            return true;        }        if (obj instanceof CombinedRangeXYPlot) {            CombinedRangeXYPlot p = (CombinedRangeXYPlot) obj;            if (super.equals(obj)) {                boolean b0 = ObjectUtils.equal(this.subplots, p.subplots);                boolean b1 = (this.totalWeight == p.totalWeight);                boolean b2 = (this.gap == p.gap);                return b0 && b1 && b2;            }        }        return false;    }        /**     * Returns a clone of the plot.     *      * @return A clone.     *      * @throws CloneNotSupportedException  this class will not throw this exception, but subclasses     *         (if any) might.     */    public Object clone() throws CloneNotSupportedException {                CombinedRangeXYPlot result = (CombinedRangeXYPlot) super.clone();         result.subplots = ObjectUtils.clone(this.subplots);        for (Iterator it = result.subplots.iterator(); it.hasNext();) {            Plot child = (Plot) it.next();            child.setParent(result);        }                // after setting up all the subplots, the shared range axis may need reconfiguring        ValueAxis rangeAxis = result.getRangeAxis();        if (rangeAxis != null) {            rangeAxis.configure();        }                return result;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -