00001 /* 00002 * The information in this file is 00003 * Copyright(c) 2007 Ball Aerospace & Technologies Corporation 00004 * and is subject to the terms and conditions of the 00005 * GNU Lesser General Public License Version 2.1 00006 * The license text is available from 00007 * http://www.gnu.org/licenses/lgpl.html 00008 */ 00009 00010 #ifndef GRIDLINES_H 00011 #define GRIDLINES_H 00012 00013 #include "PlotObject.h" 00014 #include "ColorType.h" 00015 #include "TypesFile.h" 00016 00017 /** 00018 * Provides a grid from which all other plot objects can be referenced. 00019 * 00020 * The gridlines object is provided automatically by a plot view and is 00021 * created as a secondary plot object. As a secondary object, the gridlines 00022 * object does not have extents, so the getExtents() method will return 00023 * \b false. 00024 * 00025 * A gridlines object consists of major and minor gridlines. The major 00026 * gridlines are always displayed, and the display of the minor gridlines can 00027 * be toggled on and off with enableMinorGridlines(). 00028 * 00029 * This subclass of Subject will notify upon the following conditions: 00030 * - The following methods are called: enableMinorGridlines(), setColor(), 00031 * setLineWidth(), setLineStyle(), setMaxNumMajorLines(), and 00032 * setMaxNumMinorLines(). 00033 * - Everything else documented in PlotObject. 00034 * 00035 * @see PlotObject 00036 */ 00037 class Gridlines : public PlotObject 00038 { 00039 public: 00040 /** 00041 * Toggles the display of the minor gridlines. 00042 * 00043 * @param bEnable 00044 * Set this value to \b true to display the minor gridlines, or to 00045 * \b false to hide the minor gridlines. 00046 * 00047 * @notify This method notifies Subject::signalModified() since the number 00048 * of gridlines displayed changes. 00049 */ 00050 virtual void enableMinorGridlines(bool bEnable) = 0; 00051 00052 /** 00053 * Queries whether minor gridlines are displayed. 00054 * 00055 * @return Returns \b true if the minor gridlines are displayed, or 00056 * \b false if the minor gridlines are hidden. 00057 */ 00058 virtual bool areMinorGridlinesEnabled() const = 0; 00059 00060 /** 00061 * Sets the color of the gridlines. 00062 * 00063 * @param lineColor 00064 * The gridline color. 00065 * 00066 * @notify This method notifies Subject::signalModified() if the given 00067 * color is different than the current color, and the given color 00068 * is valid. 00069 * 00070 * @see ColorType::isValid() 00071 */ 00072 virtual void setColor(const ColorType& lineColor) = 0; 00073 00074 /** 00075 * Returns the gridline color. 00076 * 00077 * @return The gridline color. 00078 */ 00079 virtual ColorType getColor() const = 0; 00080 00081 /** 00082 * Sets the line width of the gridlines. 00083 * 00084 * @param lineWidth 00085 * The gridline width. 00086 * 00087 * @notify This method notifies Subject::signalModified() if the given 00088 * line width is different than the current line width, and the 00089 * given line width is greater than zero. 00090 */ 00091 virtual void setLineWidth(int lineWidth) = 0; 00092 00093 /** 00094 * Returns the gridline width. 00095 * 00096 * @return The gridline width. 00097 */ 00098 virtual int getLineWidth() const = 0; 00099 00100 /** 00101 * Sets the line style of the gridlines. 00102 * 00103 * @param lineStyle 00104 * The gridline style. 00105 * 00106 * @notify This method notifies Subject::signalModified() if the given 00107 * line style is different than the current line style. 00108 */ 00109 virtual void setLineStyle(LineStyle lineStyle) = 0; 00110 00111 /** 00112 * Returns the gridline style. 00113 * 00114 * @return The gridline style. 00115 */ 00116 virtual LineStyle getLineStyle() const = 0; 00117 00118 /** 00119 * Sets the maximum number of major gridlines. 00120 * 00121 * This method sets the maximum number of major gridlines to display in the 00122 * plot view. Calling this method recalculates the overall locations of 00123 * the gridlines. 00124 * 00125 * @param numLines 00126 * The new maximum number of major gridlines. 00127 * 00128 * @notify This method notifies Subject::signalModified() if the given 00129 * maximum number of major gridlines is different than the current 00130 * maximum number. 00131 * 00132 * @see setMaxNumMinorLines() 00133 */ 00134 virtual void setMaxNumMajorLines(int numLines) = 0; 00135 00136 /** 00137 * Sets the maximum number of minor gridlines. 00138 * 00139 * This method sets the maximum number of minor gridlines to display 00140 * between each major gridline in the plot view. Calling this method 00141 * recalculates the overall locations of the gridlines. 00142 * 00143 * @param numLines 00144 * The new maximum number of minor gridlines. 00145 * 00146 * @notify This method notifies Subject::signalModified() if the given 00147 * maximum number of minor gridlines is different than the current 00148 * maximum number. 00149 * 00150 * @see setMaxNumMajorLines() 00151 */ 00152 virtual void setMaxNumMinorLines(int numLines) = 0; 00153 00154 /** 00155 * Returns the maximum number of major gridlines. 00156 * 00157 * This method returns the maximum number of major gridlines that are 00158 * displayed in the plot view. The default value is ten. 00159 * 00160 * @return The maximum value of major gridlines. 00161 */ 00162 virtual int getMaxNumMajorLines() const = 0; 00163 00164 /** 00165 * Returns the maximum number of minor gridlines. 00166 * 00167 * This method returns the maximum number of minor gridlines that are 00168 * displayed between each major gridline in the plot view. The default 00169 * value is four. 00170 * 00171 * @return The maximum value of minor gridlines. 00172 */ 00173 virtual int getMaxNumMinorLines() const = 0; 00174 00175 protected: 00176 /** 00177 * A plug-in cannot create this object, it can only retrieve an already 00178 * existing object from a plot view. The plot view manages any instances 00179 * of this object. 00180 */ 00181 virtual ~Gridlines() {} 00182 }; 00183 00184 #endif