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

📄 categoryplot.java

📁 这是一个segy数据显示程序
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
    /**     * Sets the position used for the domain gridlines.     *      * @param position  the position.     */    public void setDomainGridlinePosition(CategoryAnchor position) {        this.domainGridlinePosition = position;        notifyListeners(new PlotChangeEvent(this));    }    /**     * Returns the stroke used to draw grid-lines against the domain axis.     *     * @return the stroke.     */    public Stroke getDomainGridlineStroke() {        return this.domainGridlineStroke;    }    /**     * Sets the stroke used to draw grid-lines against the domain axis.  A {@link PlotChangeEvent}     * is sent to all registered listeners.     *     * @param stroke  the stroke.     */    public void setDomainGridlineStroke(Stroke stroke) {        this.domainGridlineStroke = stroke;        notifyListeners(new PlotChangeEvent(this));    }    /**     * Returns the paint used to draw grid-lines against the domain axis.     *     * @return the paint.     */    public Paint getDomainGridlinePaint() {        return this.domainGridlinePaint;    }    /**     * Sets the paint used to draw the grid-lines (if any) against the domain axis.     * A {@link PlotChangeEvent} is sent to all registered listeners.     *     * @param paint  the paint.     */    public void setDomainGridlinePaint(Paint paint) {        this.domainGridlinePaint = paint;        notifyListeners(new PlotChangeEvent(this));    }    /**     * Returns the flag that controls whether the range grid-lines are visible.     *     * @return the flag.     */    public boolean isRangeGridlinesVisible() {        return this.rangeGridlinesVisible;    }    /**     * Sets the flag that controls whether or not grid-lines are drawn against the range axis.     * If the flag changes value, a {@link PlotChangeEvent} is sent to all registered listeners.     *     * @param visible  the new value of the flag.     */    public void setRangeGridlinesVisible(boolean visible) {        if (this.rangeGridlinesVisible != visible) {            this.rangeGridlinesVisible = visible;            notifyListeners(new PlotChangeEvent(this));        }    }    /**     * Returns the stroke used to draw the grid-lines against the range axis.     *     * @return the stroke.     */    public Stroke getRangeGridlineStroke() {        return this.rangeGridlineStroke;    }    /**     * Sets the stroke used to draw the grid-lines against the range axis.     * A {@link PlotChangeEvent} is sent to all registered listeners.     *     * @param stroke  the stroke.     */    public void setRangeGridlineStroke(Stroke stroke) {        this.rangeGridlineStroke = stroke;        notifyListeners(new PlotChangeEvent(this));    }    /**     * Returns the paint used to draw the grid-lines against the range axis.     *     * @return the paint.     */    public Paint getRangeGridlinePaint() {        return this.rangeGridlinePaint;    }    /**     * Sets the paint used to draw the grid lines against the range axis.     * A {@link PlotChangeEvent} is sent to all registered listeners.     *     * @param paint  the paint.     */    public void setRangeGridlinePaint(Paint paint) {        this.rangeGridlinePaint = paint;        notifyListeners(new PlotChangeEvent(this));    }        /**     * Returns the fixed legend items, if any.     *      * @return The legend items (possibly <code>null</code>).     */    public LegendItemCollection getFixedLegendItems() {        return this.fixedLegendItems;       }    /**     * Sets the fixed legend items for the plot.  Leave this set to <code>null</code> if you     * prefer the legend items to be created automatically.     *      * @param items  the legend items (<code>null</code> permitted).     */    public void setFixedLegendItems(LegendItemCollection items) {        this.fixedLegendItems = items;        notifyListeners(new PlotChangeEvent(this));    }        /**     * Returns the legend items for the plot.  By default, this method creates a legend item for     * each series in each of the datasets.  You can change this behaviour by overriding this      * method.     *     * @return The legend items.     */    public LegendItemCollection getLegendItems() {        LegendItemCollection result = this.fixedLegendItems;        if (result == null) {            result = new LegendItemCollection();            // get the legend items for the datasets...            int count = this.datasets.size();            for (int datasetIndex = 0; datasetIndex < count; datasetIndex++) {                CategoryDataset dataset = getDataset(datasetIndex);                if (dataset != null) {                    CategoryItemRenderer renderer = getRenderer(datasetIndex);                    if (renderer != null) {                        int seriesCount = dataset.getRowCount();                        for (int i = 0; i < seriesCount; i++) {                            LegendItem item = renderer.getLegendItem(datasetIndex, i);                            if (item != null) {                                result.add(item);                            }                        }                    }                }            }        }        return result;    }    /**     * Handles a 'click' on the plot by updating the anchor value.     *     * @param x  x-coordinate of the click (in Java2D space).     * @param y  y-coordinate of the click (in Java2D space).     * @param info  information about the plot's dimensions.     *     */    public void handleClick(int x, int y, PlotRenderingInfo info) {        Rectangle2D dataArea = info.getDataArea();        if (dataArea.contains(x, y)) {            // set the anchor value for the range axis...            double java2D = 0.0;            if (this.orientation == PlotOrientation.HORIZONTAL) {                java2D = x;            }            else if (this.orientation == PlotOrientation.VERTICAL) {                java2D = y;            }            RectangleEdge edge = Plot.resolveRangeAxisLocation(getRangeAxisLocation(),                                                                this.orientation);            double value = getRangeAxis().java2DToValue(java2D, info.getDataArea(), edge);            setAnchorValue(value);            setRangeCrosshairValue(value);        }    }    /**     * Zooms (in or out) on the plot's value axis.     * <p>     * If the value 0.0 is passed in as the zoom percent, the auto-range     * calculation for the axis is restored (which sets the range to include     * the minimum and maximum data values, thus displaying all the data).     *     * @param percent  the zoom amount.     */    public void zoom(double percent) {        if (percent > 0.0) {            double range = getRangeAxis().getRange().getLength();            double scaledRange = range * percent;            getRangeAxis().setRange(                this.anchorValue - scaledRange / 2.0,                this.anchorValue + scaledRange / 2.0            );        }        else {            getRangeAxis().setAutoRange(true);        }    }    /**     * Receives notification of a change to the plot's dataset.     * <P>     * The range axis bounds will be recalculated if necessary.     *     * @param event  information about the event (not used here).     */    public void datasetChanged(DatasetChangeEvent event) {        int count = this.rangeAxes.size();        for (int axisIndex = 0; axisIndex < count; axisIndex++) {            ValueAxis yAxis = getRangeAxis(axisIndex);            if (yAxis != null) {                yAxis.configure();            }        }        if (getParent() != null) {            getParent().datasetChanged(event);        }        else {            PlotChangeEvent e = new PlotChangeEvent(this);            notifyListeners(e);        }    }    /**     * Receives notification of a renderer change event.     *     * @param event  the event.     */    public void rendererChanged(RendererChangeEvent event) {        Plot parent = getParent();        if (parent != null) {            if (parent instanceof RendererChangeListener) {                RendererChangeListener rcl = (RendererChangeListener) parent;                rcl.rendererChanged(event);            }            else {                // this should never happen with the existing code, but throw an exception in                // case future changes make it possible...                throw new RuntimeException("The renderer has changed and I don't know what to do!");            }        }        else {            PlotChangeEvent e = new PlotChangeEvent(this);            notifyListeners(e);        }    }        /**     * Adds a marker for display (in the foreground) against the range axis and sends a      * {@link PlotChangeEvent} to all registered listeners. Typically a marker will be drawn      * by the renderer as a line perpendicular to the range axis, however this is entirely up      * to the renderer.     *     * @param marker  the marker (<code>null</code> not permitted).     */    public void addRangeMarker(Marker marker) {        addRangeMarker(marker, Layer.FOREGROUND);     }            /**     * Adds a marker for display against the range axis and sends a {@link PlotChangeEvent} to     * all registered listeners.  Typically a marker will be drawn by the renderer as a line      * perpendicular to the range axis, however this is entirely up to the renderer.     *     * @param marker  the marker (<code>null</code> not permitted).     * @param layer  the layer (foreground or background) (<code>null</code> not permitted).     */    public void addRangeMarker(Marker marker, Layer layer) {        addRangeMarker(0, marker, layer);    }    /**     * Adds a marker for display by a particular renderer.     * <P>     * Typically a marker will be drawn by the renderer as a line perpendicular     * to a range axis, however this is entirely up to the renderer.     *     * @param index  the renderer index.     * @param marker  the marker.     * @param layer  the layer.     */    public void addRangeMarker(int index, Marker marker, Layer layer) {        Collection markers;        if (layer == Layer.FOREGROUND) {            markers = (Collection) this.foregroundRangeMarkers.get(new Integer(index));            if (markers == null) {                markers = new java.util.ArrayList();                this.foregroundRangeMarkers.put(new Integer(index), markers);            }            markers.add(marker);        }        else if (layer == Layer.BACKGROUND) {            markers = (Collection) this.backgroundRangeMarkers.get(new Integer(index));            if (markers == null) {                markers = new java.util.ArrayList();                this.backgroundRangeMarkers.put(new Integer(index), markers);            }            markers.add(marker);                    }        notifyListeners(new PlotChangeEvent(this));    }    /**     * Clears all the range markers for the plot and sends a {@link PlotChangeEvent}     * to all registered listeners.     */    public void clearRangeMarkers() {        if (this.backgroundRangeMarkers != null) {            this.backgroundRangeMarkers.clear();        }        if (this.foregroundRangeMarkers != null) {            this.foregroundRangeMarkers.clear();        }        notifyListeners(new PlotChangeEvent(this));    }    /**     * Returns the list of range markers (read only) for the specified layer.     *     * @param layer  the layer (foreground or background).     *      * @return The list of range markers.     */    public Collection getRangeMarkers(Layer layer) {        return getRangeMarkers(0, layer);    }    /**     * Returns a collection of range markers for a particular renderer and layer.     *      * @param index  the renderer index.     * @param layer  the layer.     *      * @return A collection of markers (possibly <code>null</code>).     */    public Collection getRangeMarkers(int index, Layer layer) {        Collection result = null;        Integer key = new Integer(index);        if (layer == Layer.FOREGROUND) {            result = (Collection) this.foregroundRangeMarkers.get(key);        }            else if (layer == Layer.BACKGROUND) {            result = (Collection) this.backgroundRangeMarkers.get(key);        }        if (result != null) {            result = Collections.unmodifiableCollection(result);        }        return result;    }        /**     * Clears all the range markers for the specified renderer.     *      * @param index  the renderer index.     */    public void clearRangeMarkers(int index) {        Integer key = new Integer(index);        if (this.backgroundRangeMarkers != null) {            Collection markers = (Collection) this.backgroundRangeMarkers.get(key);            if (markers != null) {                markers.clear();            }        }        if (this.foregroundRangeMarkers != null) {            Collection markers = (Collection) this.foregroundRangeMarkers.get(key);

⌨️ 快捷键说明

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