Histogram.h

Go to the documentation of this file.
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 HISTOGRAM_H
00013 #define HISTOGRAM_H
00014 
00015 #include "ColorType.h"
00016 #include "PlotObject.h"
00017 
00018 #include <vector>
00019 
00020 /**
00021  *  Displays a histogram as a single plot object.
00022  *
00023  *  This subclass of Subject will notify upon the following conditions:
00024  *  - The following methods are called: setHistogramData(), setColor(). 
00025  *  - Everything else documented in PlotObject.
00026  *
00027  *  @see     PlotObject
00028  */
00029 class Histogram : public PlotObject
00030 {
00031 public:
00032    /**
00033     *  Emitted when the histogram data changes.
00034     */
00035    SIGNAL_METHOD(Histogram, HistogramChanged)
00036    /**
00037     *  Emitted with any<ColorType> when the bin color changes.
00038     */
00039    SIGNAL_METHOD(Histogram, ColorChanged)
00040 
00041    /**
00042     *  Sets the histogram data values.
00043     *
00044     *  @param   binCount
00045     *           The number of data values in the histogram.
00046     *  @param   pBinCenters
00047     *           The histogram bin center values.
00048     *  @param   pValues
00049     *           The count values for each histogram bin.
00050     *  @param   pBinWidths
00051     *           The width of each histogram bin.  If this value is NULL, a default
00052     *           bin width is calculated.
00053     *  @param   bAbove
00054     *           An optional flag to display the count values as either positive or
00055     *           negative.  TRUE sets the values as positive.
00056     *
00057     *  @return  TRUE if the histogram data values were set successfully, otherwise FALSE.
00058     *
00059     *  @notify  This method will notify signalHistogramChanged.
00060     */
00061    virtual bool setHistogramData(unsigned int binCount, const double* pBinCenters, const double* pValues,
00062       const double* pBinWidths = NULL, bool bAbove = true) = 0;
00063 
00064    /**
00065     *  Retrieves the histogram data values.
00066     *
00067     *  @param   binCenters
00068     *           A vector populated with the location of each bin center.  The size of
00069     *           the vector indicates the number of bins.
00070     *  @param   binValues
00071     *           A vector populated with the count value for each bin.  The size of the
00072     *           vector indicates the number of bins.
00073     *  @param   binWidths
00074     *           A vector populated with the width of each bin.  The size of the vector
00075     *           indicates the number of bins.
00076     *
00077     *  @see     getNumBins()
00078     */
00079    virtual void getHistogramData(std::vector<double>& binCenters, std::vector<double>& binValues,
00080       std::vector<double>& binWidths) const = 0;
00081 
00082    /**
00083     *  Returns the number of bins in the histogram.
00084     *
00085     *  @return  The number of bins in the histogram.
00086     */
00087    virtual unsigned int getNumBins() const = 0;
00088 
00089    /**
00090     *  Sets the histogram color.
00091     *
00092     *  @param   histogramColor
00093     *           The new color for the histogram.  Must be a valid color.
00094     *
00095     *  @see     ColorType::isValid()
00096     *
00097     *  @notify  This method will notify signalColorChanged with any<ColorType>.
00098     */
00099    virtual void setColor(const ColorType& histogramColor) = 0;
00100 
00101    /**
00102     *  Returns the histogram color.
00103     *
00104     *  @return  The current histogram color.
00105     */
00106    virtual ColorType getColor() const = 0;
00107 
00108 protected:
00109    /**
00110     * This should be destroyed by calling PlotView::deleteObject.
00111     */
00112    virtual ~Histogram() {}
00113 };
00114 
00115 #endif

Software Development Kit - Opticks 4.9.0 Build 16218