HistogramPlot.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 #ifndef HISTOGRAMPLOT_H
00011 #define HISTOGRAMPLOT_H
00012 
00013 #include "CartesianPlot.h"
00014 #include "TypesFile.h"
00015 
00016 class Layer;
00017 
00018 /**
00019  *  Sets the data and adjusts the properties of a histogram plot.
00020  *
00021  *  The histogram data to display in the plot can be derived from a layer by
00022  *  calling setHistogram(Layer*) or can be set by passing in raw histogram
00023  *  values into
00024  *  setHistogram(unsigned int,const double*,const double*,const double*,bool).
00025  *
00026  *  This subclass of Subject will notify upon the following conditions:
00027  *  - The histogram data changes.
00028  *  - The layer associated with the histogram changes.
00029  *  - Everything documented in CartesianPlot.
00030  *
00031  *  @see     CartesianPlot
00032  */
00033 class HistogramPlot : public CartesianPlot
00034 {
00035 public:
00036    /**
00037     *  @copydoc SessionItem::getContextMenuActions()
00038     *
00039     *  @default The default implementation returns the context menu actions
00040     *           listed \ref histogramplot "here".  The default actions can be
00041     *           removed or additional actions can be added by attaching to the
00042     *           signalAboutToShowContextMenu() signal.
00043     */
00044    virtual std::list<ContextMenuAction> getContextMenuActions() const = 0;
00045 
00046    /**
00047     *  Sets the histogram data values to those of the data element for a given
00048     *  layer.
00049     *
00050     *  @param   pLayer
00051     *           The layer for which to display the histogram of its data.  If
00052     *           \em pLayer is \b NULL or not a RasterLayer or ThresholdLayer,
00053     *           the existing histogram is cleared.  If \em pLayer is a
00054     *           RasterLayer, the histogram of the data currently displayed in
00055     *           grayscale mode is set.  To set the histogram for a different
00056     *           display color, call setHistogram(Layer*, RasterChannelType)
00057     *           instead.
00058     *
00059     *  @notify  This method will notify Subject::signalModified().
00060     *
00061     *  @return  Returns \b true if the histogram for the layer was set
00062     *           successfully, otherwise returns \b false.
00063     */
00064    virtual bool setHistogram(Layer* pLayer) = 0;
00065 
00066    /**
00067     *  Sets the histogram data values to those of the data element for a given
00068     *  layer with a given display color.
00069     *
00070     *  @param   pLayer
00071     *           The layer for which to display the histogram of its data.  See
00072     *           setHistogram(Layer*) for restrictions on the layer type.
00073     *  @param   color
00074     *           The display color for which to get the histogram to set.  If
00075     *           \em pLayer is not a RasterLayer, this parameter is ignored.
00076     *
00077     *  @notify  This method will notify Subject::signalModified().
00078     *
00079     *  @return  Returns \b true if the histogram for the layer and display
00080     *           color was set successfully, otherwise returns \b false.
00081     */
00082    virtual bool setHistogram(Layer* pLayer, RasterChannelType color) = 0;
00083 
00084    /**
00085     *  Sets the histogram data values.
00086     *
00087     *  The histogram plot contains a default properties page widget that allows
00088     *  users to set the histogram color.  The page only appears in the properties
00089     *  dialog when the histogram data contains at least one bin.  Calling this
00090     *  method creates the default properties page widget if a properties widget
00091     *  has not yet been set and \e binCount is greater than zero.  If the
00092     *  number of bins is zero and the properties page widget is the default widget,
00093     *  the widget is deleted.
00094     *
00095     *  @param   binCount
00096     *           The number of data values in the histogram.
00097     *  @param   pBinCenters
00098     *           The histogram bin center values.
00099     *  @param   pValues
00100     *           The count values for each histogram bin.
00101     *  @param   pBinWidths
00102     *           The width of each histogram bin.  If this value is \b NULL, a
00103     *           default bin width is calculated.
00104     *  @param   bAbove
00105     *           An optional flag to display the count values as either positive
00106     *           or negative.  Set this parameter to \b true to count the values
00107     *           as a positive number.
00108     *
00109     *  @notify  This method will notify Subject::signalModified().
00110     *
00111     *  @return  Returns \b true if the histogram data values were set successfully;
00112     *           otherwise returns \b false.
00113     *
00114     *  @see     getPropertiesWidget()
00115     */
00116    virtual bool setHistogram(unsigned int binCount, const double* pBinCenters, const double* pValues,
00117       const double* pBinWidths = NULL, bool bAbove = true) = 0;
00118 
00119    /**
00120     *  Sets the histogram color.
00121     *
00122     *  @param   histogramColor
00123     *           The new color for the histogram.  If \em histogramColor is
00124     *           invalid, the method does nothing.
00125     *
00126     *  @see     ColorType::isValid()
00127     */
00128    virtual void setHistogramColor(const ColorType& histogramColor) = 0;
00129 
00130    /**
00131     *  Returns the histogram color.
00132     *
00133     *  @return  The current histogram color.
00134     */
00135    virtual ColorType getHistogramColor() const = 0;
00136 
00137    /**
00138     *  Toggles the capability of the plot to update its zoom when the histogram
00139     *  data changes.
00140     *
00141     *  This method toggles the capability to automatically zoom RasterLayer
00142     *  plots to the extents of the histogram data when the displayed band
00143     *  changes.  This capability is only available for plots displaying
00144     *  RasterLayer histograms.
00145     *
00146     *  @param   enable
00147     *           Set this value to \c true to automatically zoom a RasterLayer
00148     *           plot when the displayed band changes.  Set this value to
00149     *           \c false to not modify the zoom level when the displayed band
00150     *           changes.
00151     */
00152    virtual void enableAutoZoom(bool enable) = 0;
00153 
00154    /**
00155     *  Queries whether the plot updates its zoom when the histogram data
00156     *  changes.
00157     *
00158     *  @return  Returns \c true if a RasterLayer plot automatically zooms to
00159     *           the extents of the histogram data when the displayed band
00160     *           Returns \c false if the zoom level is not modified when the
00161     *           displayed band changes.
00162     */
00163    virtual bool isAutoZoomEnabled() const = 0;
00164 
00165 protected:
00166    /**
00167     * This object should be destroyed by calling DesktopServices::deleteView().
00168     */
00169    virtual ~HistogramPlot() {}
00170 };
00171 
00172 #endif

Software Development Kit - Opticks 4.9.0 Build 16218