From: David G. <mu...@us...> - 2005-10-25 14:59:23
|
Update of /cvsroot/jfreechart/jfreechart/source/org/jfree/chart/plot In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7648/source/org/jfree/chart/plot Modified Files: PolarPlot.java Log Message: 25-10-2005 David Gilbert <dav...@ob...> * source/org/jfree/chart/plot/PolarPlot.java: now implements Zoomable interface, (PolarPlot(XYDataset, ValueAxis, PolarItemRenderer)): reformatted, (addCornerTextItem): check for null argument, generate PlotChangeEvent, (removeCornerTextItem): generate PlotChangeEvent if necessary, (clearCornerTextItem): renamed clearCornerTextItems(), and generates PlotChangeEvent if necessary, (setAngleLabelsVisible): only send PlotChangeEvent if flag changes, (drawCornerTextItems): changed from public to protected, (render): likewise, (zoomDomainAxes(double, double, double)): changed signature and now implementation does nothing, (zoomDomainAxes(double, double, double, double)): likewise, (zoomRangeAxes(double, double, double)): changed signature to match Zoomable interface, (zoomRangeAxes(double, double, double, double)): likewise, (isDomainZoomable): now returns false, (getOrientation): new method, * source/org/jfree/chart/renderer/PolarItemRenderer.java (drawRadialGridLines): removed commented out code. Index: PolarPlot.java =================================================================== RCS file: /cvsroot/jfreechart/jfreechart/source/org/jfree/chart/plot/PolarPlot.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** PolarPlot.java 19 Jul 2005 14:23:54 -0000 1.15 --- PolarPlot.java 25 Oct 2005 14:59:09 -0000 1.16 *************** *** 27,31 **** * PolarPlot.java * -------------- ! * (C) Copyright 2004, by Solution Engineering, Inc. and Contributors. * * Original Author: Daniel Bridenbecker, Solution Engineering, Inc.; --- 27,31 ---- * PolarPlot.java * -------------- ! * (C) Copyright 2004, 2005, by Solution Engineering, Inc. and Contributors. * * Original Author: Daniel Bridenbecker, Solution Engineering, Inc.; *************** *** 39,42 **** --- 39,43 ---- * 07-Apr-2004 : Changed text bounds calculation (DG); * 09-Jun-2005 : Fixed getDataRange() and equals() methods (DG); + * 25-Oct-2005 : Implemented Zoomable (DG); * */ *************** *** 100,103 **** --- 101,105 ---- public class PolarPlot extends Plot implements Block, + Zoomable, ValueAxisPlot, RendererChangeListener, *************** *** 205,255 **** this.angleTicks = new java.util.ArrayList(); ! this.angleTicks.add( ! new NumberTick( ! new Double(0.0), "0", TextAnchor.CENTER, TextAnchor.CENTER, 0.0 ! ) ! ); ! this.angleTicks.add( ! new NumberTick( ! new Double(45.0), "45", TextAnchor.CENTER, TextAnchor.CENTER, ! 0.0 ! ) ! ); ! this.angleTicks.add( ! new NumberTick( ! new Double(90.0), "90", TextAnchor.CENTER, TextAnchor.CENTER, ! 0.0 ! ) ! ); ! this.angleTicks.add( ! new NumberTick( ! new Double(135.0), "135", TextAnchor.CENTER, TextAnchor.CENTER, ! 0.0 ! ) ! ); ! this.angleTicks.add( ! new NumberTick( ! new Double(180.0), "180", TextAnchor.CENTER, TextAnchor.CENTER, ! 0.0 ! ) ! ); ! this.angleTicks.add( ! new NumberTick( ! new Double(225.0), "225", TextAnchor.CENTER, TextAnchor.CENTER, ! 0.0 ! ) ! ); ! this.angleTicks.add( ! new NumberTick( ! new Double(270.0), "270", TextAnchor.CENTER, TextAnchor.CENTER, ! 0.0 ! ) ! ); ! this.angleTicks.add( ! new NumberTick( ! new Double(315.0), "315", TextAnchor.CENTER, TextAnchor.CENTER, ! 0.0 ! ) ! ); this.axis = radiusAxis; --- 207,226 ---- this.angleTicks = new java.util.ArrayList(); ! this.angleTicks.add(new NumberTick(new Double(0.0), "0", ! TextAnchor.CENTER, TextAnchor.CENTER, 0.0)); ! this.angleTicks.add(new NumberTick(new Double(45.0), "45", ! TextAnchor.CENTER, TextAnchor.CENTER, 0.0)); ! this.angleTicks.add(new NumberTick(new Double(90.0), "90", ! TextAnchor.CENTER, TextAnchor.CENTER, 0.0)); ! this.angleTicks.add(new NumberTick(new Double(135.0), "135", ! TextAnchor.CENTER, TextAnchor.CENTER, 0.0)); ! this.angleTicks.add(new NumberTick(new Double(180.0), "180", ! TextAnchor.CENTER, TextAnchor.CENTER, 0.0)); ! this.angleTicks.add(new NumberTick(new Double(225.0), "225", ! TextAnchor.CENTER, TextAnchor.CENTER, 0.0)); ! this.angleTicks.add(new NumberTick(new Double(270.0), "270", ! TextAnchor.CENTER, TextAnchor.CENTER, 0.0)); ! this.angleTicks.add(new NumberTick(new Double(315.0), "315", ! TextAnchor.CENTER, TextAnchor.CENTER, 0.0)); this.axis = radiusAxis; *************** *** 277,284 **** * Add text to be displayed in the lower right hand corner. * ! * @param text the text to display. */ public void addCornerTextItem(String text) { ! this.cornerTextItems.add(text); } --- 248,259 ---- * Add text to be displayed in the lower right hand corner. * ! * @param text the text to display (<code>null</code> not permitted). */ public void addCornerTextItem(String text) { ! if (text == null) { ! throw new IllegalArgumentException("Null 'text' argument."); ! } ! this.cornerTextItems.add(text); ! this.notifyListeners(new PlotChangeEvent(this)); } *************** *** 286,293 **** * Remove the given text from the list of corner text items. * ! * @param text the text to remove. */ public void removeCornerTextItem(String text) { ! this.cornerTextItems.remove(text); } --- 261,271 ---- * Remove the given text from the list of corner text items. * ! * @param text the text to remove (<code>null</code> ignored). */ public void removeCornerTextItem(String text) { ! boolean removed = this.cornerTextItems.remove(text); ! if (removed) { ! this.notifyListeners(new PlotChangeEvent(this)); ! } } *************** *** 295,300 **** * Clear the list of corner text items. */ ! public void clearCornerTextItem() { ! this.cornerTextItems.clear(); } --- 273,281 ---- * Clear the list of corner text items. */ ! public void clearCornerTextItems() { ! if (this.cornerTextItems.size() > 0) { ! this.cornerTextItems.clear(); ! this.notifyListeners(new PlotChangeEvent(this)); ! } } *************** *** 422,427 **** */ public void setAngleLabelsVisible(boolean visible) { ! this.angleLabelsVisible = visible; ! notifyListeners(new PlotChangeEvent(this)); } --- 403,410 ---- */ public void setAngleLabelsVisible(boolean visible) { ! if (this.angleLabelsVisible != visible) { ! this.angleLabelsVisible = visible; ! notifyListeners(new PlotChangeEvent(this)); ! } } *************** *** 726,730 **** * @param area the area. */ ! public void drawCornerTextItems(Graphics2D g2, Rectangle2D area) { if (this.cornerTextItems.isEmpty()) { return; --- 709,713 ---- * @param area the area. */ ! protected void drawCornerTextItems(Graphics2D g2, Rectangle2D area) { if (this.cornerTextItems.isEmpty()) { return; *************** *** 786,790 **** * information (<code>null</code> permitted). */ ! public void render(Graphics2D g2, Rectangle2D dataArea, PlotRenderingInfo info) { --- 769,773 ---- * information (<code>null</code> permitted). */ ! protected void render(Graphics2D g2, Rectangle2D dataArea, PlotRenderingInfo info) { *************** *** 1080,1132 **** } ! // --------------------------------------- ! // --- ValueAxisPlot Interface Methods --- ! // --------------------------------------- ! ! /** ! * Multiplies the range on the domain axis/axes by the specified factor. * - * @param x the x-coordinate (in Java2D space). - * @param y the y-coordinate (in Java2D space). * @param factor the zoom factor. */ ! public void zoomDomainAxes(double x, double y, double factor) { ! zoom(factor); } ! /** ! * Zooms in on the domain axes. ! * ! * @param x the x-coordinate (in Java2D space). ! * @param y the y-coordinate (in Java2D space). * @param lowerPercent the new lower bound. * @param upperPercent the new upper bound. */ ! public void zoomDomainAxes(double x, double y, double lowerPercent, ! double upperPercent) { ! zoom((upperPercent + lowerPercent) / 2.0); } ! /** * Multiplies the range on the range axis/axes by the specified factor. * - * @param x the x-coordinate (in Java2D space). - * @param y the y-coordinate (in Java2D space). * @param factor the zoom factor. */ ! public void zoomRangeAxes(double x, double y, double factor) { zoom(factor); } ! /** * Zooms in on the range axes. ! * ! * @param x the x-coordinate (in Java2D space). ! * @param y the y-coordinate (in Java2D space). * @param lowerPercent the new lower bound. * @param upperPercent the new upper bound. */ ! public void zoomRangeAxes(double x, double y, double lowerPercent, ! double upperPercent) { zoom((upperPercent + lowerPercent) / 2.0); } --- 1063,1115 ---- } ! /** ! * This method is required by the {@link Zoomable} interface, but since ! * the plot does not have any domain axes, it does nothing. * * @param factor the zoom factor. + * @param state the plot state. + * @param source the source point (in Java2D coordinates). */ ! public void zoomDomainAxes(double factor, PlotRenderingInfo state, ! Point2D source) { ! // do nothing } ! /** ! * This method is required by the {@link Zoomable} interface, but since ! * the plot does not have any domain axes, it does nothing. ! * * @param lowerPercent the new lower bound. * @param upperPercent the new upper bound. + * @param state the plot state. + * @param source the source point (in Java2D coordinates). */ ! public void zoomDomainAxes(double lowerPercent, double upperPercent, ! PlotRenderingInfo state, Point2D source) { ! // do nothing } ! /** * Multiplies the range on the range axis/axes by the specified factor. * * @param factor the zoom factor. + * @param state the plot state. + * @param source the source point (in Java2D coordinates). */ ! public void zoomRangeAxes(double factor, PlotRenderingInfo state, ! Point2D source) { zoom(factor); } ! /** * Zooms in on the range axes. ! * * @param lowerPercent the new lower bound. * @param upperPercent the new upper bound. + * @param state the plot state. + * @param source the source point (in Java2D coordinates). */ ! public void zoomRangeAxes(double lowerPercent, double upperPercent, ! PlotRenderingInfo state, Point2D source) { zoom((upperPercent + lowerPercent) / 2.0); } *************** *** 1138,1142 **** */ public boolean isDomainZoomable() { ! return true; } --- 1121,1125 ---- */ public boolean isDomainZoomable() { ! return false; } *************** *** 1149,1152 **** --- 1132,1145 ---- return true; } + + /** + * Returns the orientation of the plot. + * + * @return The orientation. + */ + public PlotOrientation getOrientation() { + return PlotOrientation.HORIZONTAL; + } + // ---------------------- |