RegionObject.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 REGIONOBJECT_H
00013 #define REGIONOBJECT_H
00014 
00015 #include "ColorType.h"
00016 #include "PlotObject.h"
00017 #include "TypesFile.h"
00018 
00019 #include <vector>
00020 
00021 /**
00022  *  A shaded rectangular object.
00023  *
00024  *  The region plot object provides a shaded rectanuglar area with a
00025  *  transparency value.  The shading can be solid with a single color, or
00026  *  a gradient with multiple colors.
00027  *
00028  *  This subclass of Subject will notify upon the following conditions:
00029  *  - The following methods are called: setRegion(), setColor(), setColors(),
00030  *    setTransparency(), setDrawBorder().
00031  *  - Everything else documented in PlotObject.
00032  *
00033  *  @see     PlotObject
00034  */
00035 class RegionObject : public PlotObject
00036 {
00037 public:
00038    /**
00039     *  Emitted with any<boost::tuple<double,double,double,double> > when the 
00040     *          region boundary is changed. The values in the tuple are minX,
00041     *          minY, maxX and maxY respectively.
00042     */
00043    SIGNAL_METHOD(RegionObject, RegionChanged)
00044    /**
00045     *  Emitted with any<vector<ColorType> when the colors of the region are changed.
00046     */
00047    SIGNAL_METHOD(RegionObject, ColorsChanged)
00048    /**
00049     *  Emitted with any<int> when the opacity is changed. The value represents the
00050     *          opacity, ranging from 0 to 255.
00051     */
00052    SIGNAL_METHOD(RegionObject, TransparencyChanged)
00053    /**
00054     *  Emitted with any<bool> when the border is enabled or disabled.
00055     */
00056    SIGNAL_METHOD(RegionObject, BorderToggled)
00057 
00058    /**
00059     *  Queries whether the region has valid values.
00060     *
00061     *  A region, when it is first created, is invalid.  A region becomes valid
00062     *  when its values are set such that both the width and height are not zero.
00063     *
00064     *  @return  True if the region has valid values, or false if the values
00065     *           are invalid.
00066     *
00067     *  @see     setRegion()
00068     */
00069    virtual bool isValid() const = 0;
00070 
00071    /**
00072     *  Sets the region location.
00073     *
00074     *  This method sets the region location by specifying  the minimum and maximum
00075     *  coordinate extents.  The region can be obtained by getting the extents of
00076     *  the object.
00077     *
00078     *  @param   dMinX
00079     *           The new minimum x-coordinate value.
00080     *  @param   dMinY
00081     *           The new minimum y-coordinate value.
00082     *  @param   dMaxX
00083     *           The new maximum x-coordinate value.
00084     *  @param   dMaxY
00085     *           The new maximum y-coordinate value.
00086     *
00087     *  @notify  This method will notify signalRegionChanged with any<boost::tuple<double,double,double,double> >.
00088     *
00089     *  @see     PlotObject::getExtents()
00090     */
00091    virtual void setRegion(double dMinX, double dMinY, double dMaxX, double dMaxY) = 0;
00092 
00093    /**
00094     * Get the data coordinates for the region.
00095     *
00096     * @param minX
00097     *        The minimum x-coordinate.  This will set by this method.
00098     * @param minY
00099     *        The minimum y-coordinate.  This will set by this method.
00100     * @param maxX
00101     *        The maximum x-coordinate.  This will set by this method.
00102     * @param maxY
00103     *        The maximum y-coordinate.  This will set by this method.
00104     *
00105     * @return True if the operation was a success, false otherwise.
00106     */
00107    virtual bool getRegion(double &minX, double &minY, 
00108       double &maxX, double &maxY) const = 0;
00109 
00110    /**
00111     *  Queries whether a single, solid color is used.
00112     *
00113     *  @return  True if the region is using a single color, otherwise false.
00114     *
00115     *  @see     getColor()
00116     */
00117    virtual bool isSolidColor() const = 0;
00118 
00119    /**
00120     *  Sets the region to have a single, solid color.
00121     *
00122     *  @param   regionColor
00123     *           The new region color.  Must be a valid color.
00124     *
00125     *  @notify  This method will notify signalColorsChanged with vector<ColorType>.
00126     *           The vector will have only one color.
00127     *
00128     *  @see     ColorType::isValid()
00129     */
00130    virtual void setColor(const ColorType& regionColor) = 0;
00131 
00132    /**
00133     *  Set the region colors.
00134     *
00135     *  The colors will be drawn in order from the minimum x-coordinate extent
00136     *  to the maximum x-coordinate extent.
00137     *
00138     *  @param   colors
00139     *           The colors to be drawn, in order.
00140     *
00141     *  @notify  This method will notify signalColorsChanged with vector<ColorType>.
00142     */
00143    virtual void setColors(const std::vector<ColorType>& colors) = 0;
00144 
00145    /**
00146     *  Returns the region color.
00147     *
00148     *  This method returns the region color if the region is displayed as a
00149     *  single, solid color.
00150     *
00151     *  @return  The current region color.  The color is invalid if the region
00152     *           uses multiple colors.
00153     *
00154     *  @see     ColorType::isValid(), getColors()
00155     */
00156    virtual ColorType getColor() const = 0;
00157 
00158    /**
00159     *  Returns the region colors.
00160     *
00161     *  @return  A reference to vector containing the region colors, in order.
00162     *           The vector is valid if the region uses a single color.
00163     */
00164    virtual const std::vector<ColorType>& getColors() const = 0;
00165 
00166    /**
00167     *  Sets the region transparency value.
00168     *
00169     *  The region can be set to be transparent or semi-transparent by setting
00170     *  its transparency value.  Valid values range from 0 to 255, with the 0
00171     *  value being fully transparent and the 255 value being fully opaque.
00172     *  The default value is 255. When the region is displaying a colormap, this
00173     *  value will be applied as a multiplier on the transparency values of
00174     *  each value in the colormap.
00175     *
00176     *  @param   iTransparency
00177     *           The new transparency value.  Valid values range from 0 to 255.
00178     *
00179     *  @notify  This method will notify signalTransparencyChanged with any<int>.
00180     *
00181     *  @see   setColors()
00182     */
00183    virtual void setTransparency(int iTransparency) = 0;
00184 
00185    /**
00186     *  Returns the region transparency value.
00187     *
00188     *  @return  The current region transparency value.
00189     *
00190     *  @see     setTransparency()
00191     */
00192    virtual int getTransparency() const = 0;
00193 
00194    /**
00195     *  Toggles the region border.
00196     *
00197     *  This method sets whether a black border is drawn around the region.  The
00198     *  object defaults to not draw the border.
00199     *
00200     *  @param   bBorder
00201     *           Set this value to true to draw a black border around the object.
00202     *
00203     *  @notify  This method will notify signalBorderToggled with any<bool>.
00204     */
00205    virtual void setDrawBorder(bool bBorder) = 0;
00206 
00207    /**
00208     *  Queries whether the region border is drawn.
00209     *
00210     *  @return  True if the border is drawn, otherwise false.
00211     *
00212     *  @see     setDrawBorder()
00213     */
00214    virtual bool getDrawBorder() const = 0;
00215 
00216 protected:
00217    /**
00218     * This should be destroyed by calling PlotView::deleteObject.
00219     */
00220    virtual ~RegionObject() {}
00221 };
00222 
00223 #endif

Software Development Kit - Opticks 4.9.0 Build 16218