📄 contourplot.java
字号:
} /** * Sets the Paint used to color the crosshairs (if visible) and notifies * registered listeners that the axis has been modified. * * @param paint the new crosshair paint. */ public void setDomainCrosshairPaint(Paint paint) { this.domainCrosshairPaint = paint; notifyListeners(new PlotChangeEvent(this)); } /** * Returns a flag indicating whether or not the range crosshair is visible. * * @return the flag. */ public boolean isRangeCrosshairVisible() { return this.rangeCrosshairVisible; } /** * Sets the flag indicating whether or not the range crosshair is visible. * * @param flag the new value of the flag. */ public void setRangeCrosshairVisible(boolean flag) { if (this.rangeCrosshairVisible != flag) { this.rangeCrosshairVisible = flag; notifyListeners(new PlotChangeEvent(this)); } } /** * Returns a flag indicating whether or not the crosshair should "lock-on" * to actual data values. * * @return the flag. */ public boolean isRangeCrosshairLockedOnData() { return this.rangeCrosshairLockedOnData; } /** * Sets the flag indicating whether or not the range crosshair should "lock-on" * to actual data values. * * @param flag the flag. */ public void setRangeCrosshairLockedOnData(boolean flag) { if (this.rangeCrosshairLockedOnData != flag) { this.rangeCrosshairLockedOnData = flag; notifyListeners(new PlotChangeEvent(this)); } } /** * Returns the range crosshair value. * * @return The value. */ public double getRangeCrosshairValue() { return this.rangeCrosshairValue; } /** * Sets the domain crosshair value. * <P> * Registered listeners are notified that the plot has been modified, but * only if the crosshair is visible. * * @param value the new value. */ public void setRangeCrosshairValue(double value) { setRangeCrosshairValue(value, true); } /** * Sets the range crosshair value. * <P> * Registered listeners are notified that the axis has been modified, but * only if the crosshair is visible. * * @param value the new value. * @param notify a flag that controls whether or not listeners are notified. */ public void setRangeCrosshairValue(double value, boolean notify) { this.rangeCrosshairValue = value; if (isRangeCrosshairVisible() && notify) { notifyListeners(new PlotChangeEvent(this)); } } /** * Returns the Stroke used to draw the crosshair (if visible). * * @return the crosshair stroke. */ public Stroke getRangeCrosshairStroke() { return this.rangeCrosshairStroke; } /** * Sets the Stroke used to draw the crosshairs (if visible) and notifies * registered listeners that the axis has been modified. * * @param stroke the new crosshair stroke. */ public void setRangeCrosshairStroke(Stroke stroke) { this.rangeCrosshairStroke = stroke; notifyListeners(new PlotChangeEvent(this)); } /** * Returns the range crosshair color. * * @return the crosshair color. */ public Paint getRangeCrosshairPaint() { return this.rangeCrosshairPaint; } /** * Sets the Paint used to color the crosshairs (if visible) and notifies * registered listeners that the axis has been modified. * * @param paint the new crosshair paint. */ public void setRangeCrosshairPaint(Paint paint) { this.rangeCrosshairPaint = paint; notifyListeners(new PlotChangeEvent(this)); } /** * Returns the tool tip generator. * * @return the tool tip generator (possibly null). */ public ContourToolTipGenerator getToolTipGenerator() { return this.toolTipGenerator; } /** * Sets the tool tip generator. * * @param generator the tool tip generator (null permitted). */ public void setToolTipGenerator(ContourToolTipGenerator generator) { //Object oldValue = this.toolTipGenerator; this.toolTipGenerator = generator; } /** * Returns the URL generator for HTML image maps. * * @return the URL generator (possibly null). */ public XYURLGenerator getURLGenerator() { return this.urlGenerator; } /** * Sets the URL generator for HTML image maps. * * @param urlGenerator the URL generator (null permitted). */ public void setURLGenerator(XYURLGenerator urlGenerator) { //Object oldValue = this.urlGenerator; this.urlGenerator = urlGenerator; } /** * Draws a vertical line on the chart to represent a 'range marker'. * * @param g2 the graphics device. * @param plot the plot. * @param domainAxis the domain axis. * @param marker the marker line. * @param dataArea the axis data area. */ public void drawDomainMarker(Graphics2D g2, ContourPlot plot, ValueAxis domainAxis, Marker marker, Rectangle2D dataArea) { if (marker instanceof ValueMarker) { ValueMarker vm = (ValueMarker) marker; double value = vm.getValue(); Range range = domainAxis.getRange(); if (!range.contains(value)) { return; } double x = domainAxis.valueToJava2D(value, dataArea, RectangleEdge.BOTTOM); Line2D line = new Line2D.Double(x, dataArea.getMinY(), x, dataArea.getMaxY()); Paint paint = marker.getOutlinePaint(); Stroke stroke = marker.getOutlineStroke(); g2.setPaint(paint != null ? paint : Plot.DEFAULT_OUTLINE_PAINT); g2.setStroke(stroke != null ? stroke : Plot.DEFAULT_OUTLINE_STROKE); g2.draw(line); } } /** * Draws a horizontal line across the chart to represent a 'range marker'. * * @param g2 the graphics device. * @param plot the plot. * @param rangeAxis the range axis. * @param marker the marker line. * @param dataArea the axis data area. */ public void drawRangeMarker(Graphics2D g2, ContourPlot plot, ValueAxis rangeAxis, Marker marker, Rectangle2D dataArea) { if (marker instanceof ValueMarker) { ValueMarker vm = (ValueMarker) marker; double value = vm.getValue(); Range range = rangeAxis.getRange(); if (!range.contains(value)) { return; } double y = rangeAxis.valueToJava2D(value, dataArea, RectangleEdge.LEFT); Line2D line = new Line2D.Double(dataArea.getMinX(), y, dataArea.getMaxX(), y); Paint paint = marker.getOutlinePaint(); Stroke stroke = marker.getOutlineStroke(); g2.setPaint(paint != null ? paint : Plot.DEFAULT_OUTLINE_PAINT); g2.setStroke(stroke != null ? stroke : Plot.DEFAULT_OUTLINE_STROKE); g2.draw(line); } } /** * Returns the clipPath. * @return ClipPath */ public ClipPath getClipPath() { return this.clipPath; } /** * Sets the clipPath. * @param clipPath The clipPath to set */ public void setClipPath(ClipPath clipPath) { this.clipPath = clipPath; } /** * Returns the ptSizePct. * @return double */ public double getPtSizePct() { return this.ptSizePct; } /** * Returns the renderAsPoints. * @return boolean */ public boolean isRenderAsPoints() { return this.renderAsPoints; } /** * Sets the ptSizePct. * @param ptSizePct The ptSizePct to set */ public void setPtSizePct(double ptSizePct) { this.ptSizePct = ptSizePct; } /** * Sets the renderAsPoints. * @param renderAsPoints The renderAsPoints to set */ public void setRenderAsPoints(boolean renderAsPoints) { this.renderAsPoints = renderAsPoints; } /** * Receives notification of a change to one of the plot's axes. * * @param event information about the event. */ public void axisChanged(AxisChangeEvent event) { Object source = event.getSource(); if (source.equals(this.rangeAxis) || source.equals(this.domainAxis)) { ColorBar cba = this.colorBar; if (this.colorBar.getAxis().isAutoRange()) { cba.getAxis().configure(); } } super.axisChanged(event); } /** * Returns the visible z-range. * * @param data the dataset. * @param x the x range. * @param y the y range. * * @return The range. */ public Range visibleRange(ContourDataset data, Range x, Range y) { Range range = null; range = data.getZValueRange(x, y); return range; } /** * Returns the missingPaint. * @return Paint */ public Paint getMissingPaint() { return this.missingPaint; } /** * Sets the missingPaint. * @param missingPaint The missingPaint to set */ public void setMissingPaint(Paint missingPaint) { this.missingPaint = missingPaint; } /** * Multiplies the range on the horizontal axis/axes by the specified factor. * * @param factor the zoom factor. */ public void zoomHorizontalAxes(double factor) { // zoom the domain axis } /** * Zooms the horizontal axes (not yet implemented). * * @param lowerPercent the new lower bound. * @param upperPercent the new upper bound. */ public void zoomHorizontalAxes(double lowerPercent, double upperPercent) { // zoom the domain axis } /** * Multiplies the range on the vertical axis/axes by the specified factor. * * @param factor the zoom factor. */ public void zoomVerticalAxes(double factor) { // zoom the range axis // zoom all the secondary axes } /** * Zooms the vertical axes (not yet implemented). * * @param lowerPercent the new lower bound. * @param upperPercent the new upper bound. */ public void zoomVerticalAxes(double lowerPercent, double upperPercent) { // zoom the domain axis } /** Extends plot cloning to this plot type * @see org.jfree.chart.plot.Plot#clone() */ public Object clone() throws CloneNotSupportedException { ContourPlot clone = (ContourPlot) super.clone(); if (this.domainAxis != null) { clone.domainAxis = (ValueAxis) this.domainAxis.clone(); clone.domainAxis.setPlot(clone); clone.domainAxis.addChangeListener(clone); } if (this.rangeAxis != null) { clone.rangeAxis = (ValueAxis) this.rangeAxis.clone(); clone.rangeAxis.setPlot(clone); clone.rangeAxis.addChangeListener(clone); } if (clone.dataset != null) { clone.dataset.addChangeListener(clone); } if (this.colorBar != null) { clone.colorBar = (ColorBar) this.colorBar.clone(); } //private RectangleEdge colorBarLocation; //private boolean domainCrosshairVisible; //private double domainCrosshairValue; //private transient Stroke domainCrosshairStroke; //private transient Paint domainCrosshairPaint; //private boolean domainCrosshairLockedOnData = true; //private boolean rangeCrosshairVisible; //private double rangeCrosshairValue; //private transient Stroke rangeCrosshairStroke; //private transient Paint rangeCrosshairPaint; //private boolean rangeCrosshairLockedOnData = true; clone.domainMarkers = ObjectUtils.clone(this.domainMarkers); clone.rangeMarkers = ObjectUtils.clone(this.rangeMarkers); clone.annotations = ObjectUtils.clone(this.annotations); // private ContourToolTipGenerator toolTipGenerator; <- clone??? // private XYURLGenerator urlGenerator; <- clone??? //private boolean renderAsPoints = false; //private double ptSizePct = 0.05; if (this.clipPath != null) { clone.clipPath = (ClipPath) this.clipPath.clone(); } //private transient Paint missingPaint = null; return clone; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -