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 00011 00012 #ifndef CURVECOLLECTION_H 00013 #define CURVECOLLECTION_H 00014 00015 #include "ColorType.h" 00016 #include "PlotObject.h" 00017 #include "TypesFile.h" 00018 00019 #include <vector> 00020 00021 class Curve; 00022 00023 /** 00024 * Curve plot objects grouped into a single plot object. 00025 * 00026 * This subclass of Subject will notify upon the following conditions: 00027 * - The following methods are called: addCurve(), deleteCurve(), clear(), 00028 * setLineWidth(), setLineStyle(). 00029 * - Everything else documented in PlotObject. 00030 * 00031 * @see Curve 00032 * @see PlotObject 00033 */ 00034 class CurveCollection : public PlotObject 00035 { 00036 public: 00037 /** 00038 * Emitted with any<Curve*> when a Curve is added. 00039 */ 00040 SIGNAL_METHOD(CurveCollection, CurveAdded) 00041 /** 00042 * Emitted with any<Curve*> when a Curve is removed. 00043 */ 00044 SIGNAL_METHOD(CurveCollection, CurveDeleted) 00045 00046 /** 00047 * Adds a curve to the collection. 00048 * 00049 * @return A pointer to the newly created Curve. 00050 * 00051 * @notify signalCurveAdded with any<Curve*> 00052 */ 00053 virtual Curve* addCurve() = 0; 00054 00055 /** 00056 * Retrieves all curves in the collection. 00057 * 00058 * @return A reference to a vector containing pointers to the curves in 00059 * the collection. 00060 */ 00061 virtual const std::vector<Curve*>& getCurves() const = 0; 00062 00063 /** 00064 * Returns the number of curves in the collection. 00065 * 00066 * @return A number of curves currently in the collection. 00067 */ 00068 virtual unsigned int getNumCurves() const = 0; 00069 00070 /** 00071 * Removes a curve from the collection and deletes it. 00072 * 00073 * @param pCurve 00074 * The curve to delete. Cannot be NULL. 00075 * 00076 * @return TRUE if the curve was successfully removed from the collection 00077 * and deleted. FALSE is returned if the curve is not found in 00078 * the collection. 00079 * 00080 * @notify signalCurveDeleted with any<Curve*> 00081 */ 00082 virtual bool deleteCurve(Curve* pCurve) = 0; 00083 00084 /** 00085 * Removes all curves from the collection and deletes them. 00086 * 00087 * @notify signalCurveDeleted with any<Curve*> for each curve 00088 */ 00089 virtual void clear() = 0; 00090 00091 /** 00092 * Sets the color of all curves in the collection. 00093 * 00094 * This method applies a single color to all curves in the collection. 00095 * The color of a single curve can also be changed directly on the 00096 * Curve. 00097 * 00098 * @param collectionColor 00099 * The new curve color. 00100 * 00101 * @see Curve::setColor() 00102 */ 00103 virtual void setColor(const ColorType& collectionColor) = 0; 00104 00105 /** 00106 * Returns the color of the curves in the collection. 00107 * 00108 * @return The color of all curves in the collection. If the curves 00109 * have different colors, an invalid color is returned. 00110 * 00111 * @see ColorType::isValid() 00112 */ 00113 virtual ColorType getColor() const = 0; 00114 00115 /** 00116 * Sets the line width of all curves in the collection. 00117 * 00118 * This method applies a single line width to all curves in the collection. 00119 * The line width of a single curve can also be changed directly on the 00120 * Curve. 00121 * 00122 * @param iWidth 00123 * The new curve line width. 00124 * 00125 * @notify Subject::signalModified 00126 * 00127 * @see Curve::setLineWidth() 00128 */ 00129 virtual void setLineWidth(int iWidth) = 0; 00130 00131 /** 00132 * Returns the line width of the curves in the collection. 00133 * 00134 * @return The line width of all curves in the collection. If the curves 00135 * have different line widths, a value of -1 is returned. 00136 */ 00137 virtual int getLineWidth() const = 0; 00138 00139 /** 00140 * Sets the line style of all curves in the collection. 00141 * 00142 * This method applies a single line style to all curves in the collection. 00143 * The line style of a single curve can also be changed directly on the 00144 * Curve. 00145 * 00146 * @param lineStyle 00147 * The new curve line style. 00148 * 00149 * @notify Subject::signalModified 00150 * 00151 * @see LineStyle 00152 * @see Curve::setLineStyle() 00153 */ 00154 virtual void setLineStyle(const LineStyle& lineStyle) = 0; 00155 00156 /** 00157 * Returns the line style of the curves in the collection. 00158 * 00159 * @return The line style of all curves in the collection. If the curves 00160 * have different line widths, the value is undefined. 00161 */ 00162 virtual LineStyle getLineStyle() const = 0; 00163 00164 protected: 00165 /** 00166 * This should be destroyed by calling PlotView::deleteObject. 00167 */ 00168 virtual ~CurveCollection() {} 00169 }; 00170 00171 #endif