PseudocolorLayer.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 PSEUDOCOLORLAYER_H
00013 #define PSEUDOCOLORLAYER_H
00014 
00015 #include "Layer.h"
00016 #include "ConfigurationSettings.h"
00017 #include "TypesFile.h"
00018 
00019 #include <string>
00020 #include <vector>
00021 
00022 class ColorType;
00023 
00024 /**
00025  *  Adjusts the properties of a pseudocolor layer.
00026  *
00027  *  A pseudocolor layer consists of sets of markers identifying pixels in a scene.  Each
00028  *  set of markers is called a class, and each class has four properties: name, inclusion
00029  *  value, color, and a display flag.  The inclusion value defines which pixels are
00030  *  included in the class.  The value corresponds with the data value of the underlying
00031  *  spectral element.  Element values in float or double values are truncated for the
00032  *  inclusion value.  This class manages the pseudocolor classes and their properties,
00033  *  where each class is identified by a unique ID value.  The pixel marker is drawn with
00034  *  a symbol based on the layer properties.
00035  *
00036  *  This subclass of Subject will notify upon the following conditions:
00037  *  - The following methods are called: addClass(), removeClass(), clear().
00038  *  - An action on the PseudocolorLayer is undone.
00039  *  - Everything else documented in Layer.
00040  *
00041  *  @see     Layer
00042  */
00043 class PseudocolorLayer : public Layer
00044 {
00045 public:
00046    SETTING(MarkerSymbol, PseudocolorLayer, SymbolType, SOLID)
00047 
00048    /**
00049     *  Emitted with any<SymbolType> when the symbol style is changed.
00050     */
00051    SIGNAL_METHOD(PseudocolorLayer, SymbolChanged)
00052    /**
00053     *  Emitted when the list of classes is cleared.
00054     */
00055    SIGNAL_METHOD(PseudocolorLayer, Cleared)
00056 
00057    /**
00058     *  Adds a new class to the current pseudocolor layer.
00059     *
00060     *  @return  The unique class ID on success. Otherwise, -1.
00061     *
00062     *  @notify  This method will notify Subject::signalModified.
00063     *
00064     *  @see     addInitializedClass(), removeClass()
00065     */
00066    virtual int addClass() = 0;
00067 
00068    /**
00069     *  Adds a new class to the current pseudocolor layer.
00070     *
00071     *  @param   className
00072     *           The new class name.
00073     *  @param   iValue
00074     *           The new class value.
00075     *  @param   classColor
00076     *           The new class RGB color.
00077     *  @param   bDisplayed
00078     *           TRUE if the new class should initially be displayed, otherwise FALSE.
00079     *
00080     *  @return  The unique class ID on success. Otherwise, -1.
00081     *
00082     *  @notify  This method will notify Subject::signalModified.
00083     *
00084     *  @see     addClass()
00085     */
00086    virtual int addInitializedClass(const std::string& className, int iValue, const ColorType& classColor,
00087       bool bDisplayed = true) = 0;
00088 
00089    /**
00090     *  Retrieves the unique IDs for all classes.
00091     *
00092     *  @param   classIds
00093     *           A reference to a vector in which to put the class IDs.
00094     *           This vector should be allocated by the studio. A plug-in can do
00095     *           this via the ObjectFactory.
00096     */
00097    virtual void getClassIDs(std::vector<int>& classIds) const = 0;
00098 
00099    /**
00100     *  Returns the number of classes in the pseudocolor layer.
00101     *
00102     *  @return  The number of classes.
00103     *
00104     *  @see     getClassIDs()
00105     */
00106    virtual unsigned int getClassCount() const = 0;
00107 
00108    /**
00109     *  Removes a class from the pseudocolor layer.
00110     *
00111     *  @param   iID
00112     *           The unique ID of the class to remove.
00113     *
00114     *  @return  TRUE if the class was successfully removed.  FALSE if no class exists
00115     *           with the given ID or if an error occurred.
00116     *
00117     *  @notify  This method will notify Subject::signalModified.
00118     *
00119     *  @see     clear()
00120     */
00121    virtual bool removeClass(int iID) = 0;
00122 
00123    /**
00124     *  Removes all classes from the current pseudocolor layer.
00125     *
00126     *  @notify  This method will notify signalCleared.
00127     *
00128     *  @see     removeClass()
00129     */
00130    virtual void clear() = 0;
00131 
00132    /**
00133     *  Sets all properties for an existing class on the current pseudocolor layer.
00134     *
00135     *  @param   iID
00136     *           The unique ID of the class.
00137     *  @param   className
00138     *           The new class name.
00139     *  @param   iValue
00140     *           The new class value.
00141     *  @param   classColor
00142     *           The new class RGB color.
00143     *  @param   bDisplayed
00144     *           TRUE if the new class should be displayed, otherwise FALSE.
00145     *
00146     *  @return  TRUE if the properties were set successfully, otherwise FALSE.
00147     */
00148    virtual bool setClassProperties(int iID, const std::string& className, int iValue, const ColorType& classColor,
00149       bool bDisplayed) = 0;
00150 
00151    /**
00152     *  Sets the name of a pseudocolor class.
00153     *
00154     *  @param   iID
00155     *           The unique ID of the class.
00156     *  @param   className
00157     *           The new name.
00158     *
00159     *  @return  TRUE if the class name was successfully set.  FALSE if no class exists
00160     *           with the given ID or if an error occurred.
00161     *
00162     *  @see     getClassName()
00163     */
00164    virtual bool setClassName(int iID, const std::string& className) = 0;
00165 
00166    /**
00167     *  Retrieves the name of a pseudocolor class.
00168     *
00169     *  @param   iID
00170     *           The unique ID of the class.
00171     *  @param   className
00172     *           A string that is populated with the class name
00173     *
00174     *  @return  True if the class name was successfully populated, otherwise false.
00175     *
00176     *  @see     setClassName()
00177     */
00178    virtual bool getClassName(int iID, std::string& className) const = 0;
00179 
00180    /**
00181     *  Sets the value of a pseudocolor class.
00182     *
00183     *  @param   iID
00184     *           The unique ID of the class.
00185     *  @param   iValue
00186     *           The new value.
00187     *
00188     *  @return  TRUE if the class value was successfully set.  FALSE if no class exists
00189     *           with the given ID or if an error occurred.
00190     *
00191     *  @see     getClassValue()
00192     */
00193    virtual bool setClassValue(int iID, int iValue) = 0;
00194 
00195    /**
00196     *  Retrieves the value of a pseudocolor class.
00197     *
00198     *  @param   iID
00199     *           The unique ID of the class.
00200     *
00201     *  @return  The class value.  A value of -1 is returned if no class exists with the
00202     *           given ID or if an error occurred.
00203     *
00204     *  @see     setClassValue()
00205     */
00206    virtual int getClassValue(int iID) const = 0;
00207 
00208    /**
00209     *  Sets the color of a pseudocolor class.
00210     *
00211     *  @param   iID
00212     *           The unique ID of the class.
00213     *  @param   classColor
00214     *           The new RGB color for the class.
00215     *
00216     *  @return  TRUE if the class color was successfully set.  FALSE if no class exists
00217     *           with the given ID or if an error occurred.
00218     *
00219     *  @see     getClassColor()
00220     */
00221    virtual bool setClassColor(int iID, const ColorType& classColor) = 0;
00222 
00223    /**
00224     *  Retrieves the color of a pseudocolor class.
00225     *
00226     *  @param   iID
00227     *           The unique ID of the class.
00228     *
00229     *  @return  The class color.
00230     *
00231     *  @see     setClassColor()
00232     */
00233    virtual ColorType getClassColor(int iID) const = 0;
00234 
00235    /**
00236     *  Sets the display state of a pseudocolor class.
00237     *
00238     *  @param   iID
00239     *           The unique ID of the class.
00240     *  @param   bDisplayed
00241     *           TRUE if the class should be displayed.  FALSE if the class should not
00242     *           be displayed.
00243     *
00244     *  @return  TRUE if the class display state was successfully set.  FALSE if no
00245     *           class exists with the given ID or if an error occurred.
00246     *
00247     *  @see     isClassDisplayed()
00248     */
00249    virtual bool setClassDisplayed(int iID, bool bDisplayed) = 0;
00250 
00251    /**
00252     *  Retrieves the display state of a pseudocolor class.
00253     *
00254     *  @param   iID
00255     *           The unique ID of the class.
00256     *
00257     *  @return  TRUE if the class if displayed.  FALSE if the class is not displayed
00258     *           or if no class exists with the given ID
00259     *
00260     *  @see     setClassDisplayed()
00261     */
00262   virtual bool isClassDisplayed(int iID) const = 0;
00263 
00264   virtual SymbolType getSymbol() const = 0;
00265 
00266   virtual void setSymbol(SymbolType symbol) = 0;
00267 
00268 protected:
00269    /**
00270     * This should be destroyed by calling SpatialDataView::deleteLayer.
00271     */
00272    virtual ~PseudocolorLayer() {}
00273 };
00274 
00275 #endif

Software Development Kit - Opticks 4.9.0 Build 16218