RasterDataDescriptor.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 RASTERDATADESCRIPTOR_H
00011 #define RASTERDATADESCRIPTOR_H
00012 
00013 #include "DataDescriptor.h"
00014 #include "DimensionDescriptor.h"
00015 #include "TypesFile.h"
00016 
00017 #include <vector>
00018 
00019 class Units;
00020 
00021 /**
00022  *  Describes a raster data element.
00023  *
00024  *  In addition to the anscillary information stored in the DataDescriptor base
00025  *  class, this class contains information pertinent to raster data elements.
00026  *
00027  *  This subclass of Subject will notify upon the following conditions:
00028  *  - The following methods are called: setDataType(), setValidDataTypes(),
00029  *    setBadValues(), setInterleaveFormat(), setRows(), setColumns(),
00030  *    setBands(), setXPixelSize(), setYPixelSize(), setDisplayBand(),
00031  *    setDisplayMode(), and setUnits().
00032  *  - All notifications documented in DataDescriptor.
00033  *
00034  *  @see        RasterElement
00035  */
00036 class RasterDataDescriptor : public DataDescriptor
00037 {
00038 public:
00039    /**
00040     *  Emitted when the data type changes with
00041     *  boost::any<\link ::EncodingType EncodingType\endlink> containing the new
00042     *  data type.
00043     *
00044     *  @see     setDataType()
00045     */
00046    SIGNAL_METHOD(RasterDataDescriptor, DataTypeChanged)
00047 
00048    /**
00049     *  Emitted when the vector of valid data types changes with
00050     *  boost::any<std::vector<\link ::EncodingType EncodingType\endlink> >
00051     *  containing the new valid data types.
00052     *
00053     *  @see     setValidDataTypes()
00054     */
00055    SIGNAL_METHOD(RasterDataDescriptor, ValidDataTypesChanged)
00056 
00057    /**
00058     *  Emitted when the vector of bad values changes with
00059     *  boost::any<std::vector<int> > containing the new bad values.
00060     *
00061     *  @see     setBadValues()
00062     */
00063    SIGNAL_METHOD(RasterDataDescriptor, BadValuesChanged)
00064 
00065    /**
00066     *  Emitted when the interleave format changes with
00067     *  boost::any<\link ::InterleaveFormatType InterleaveFormatType\endlink>
00068     *  containing the new interleave format.
00069     *
00070     *  @see     setInterleaveFormat()
00071     */
00072    SIGNAL_METHOD(RasterDataDescriptor, InterleaveFormatChanged)
00073 
00074    /**
00075     *  Emitted when the rows change with
00076     *  boost::any<std::vector<\link DimensionDescriptor\endlink> > containing
00077     *  the new rows.
00078     *
00079     *  @see     setRows()
00080     */
00081    SIGNAL_METHOD(RasterDataDescriptor, RowsChanged)
00082 
00083    /**
00084     *  Emitted when the columns change with
00085     *  boost::any<std::vector<\link DimensionDescriptor\endlink> > containing
00086     *  the new columns.
00087     *
00088     *  @see     setColumns()
00089     */
00090    SIGNAL_METHOD(RasterDataDescriptor, ColumnsChanged)
00091 
00092    /**
00093     *  Emitted when the bands change with
00094     *  boost::any<std::vector<\link DimensionDescriptor\endlink> > containing
00095     *  the new bands.
00096     *
00097     *  @see     setBands()
00098     */
00099    SIGNAL_METHOD(RasterDataDescriptor, BandsChanged)
00100 
00101    /**
00102     *  Emitted when the X or Y pixel size changes.
00103     *
00104     *  No value is associated with this signal.
00105     *
00106     *  @see     setXPixelSize(), setYPixelSize()
00107     */
00108    SIGNAL_METHOD(RasterDataDescriptor, PixelSizeChanged)
00109 
00110    /**
00111     *  Emitted when the band to display changes for any raster channel.
00112     *
00113     *  No value is associated with this signal.
00114     *
00115     *  @see     setDisplayBand(), RasterChannelType
00116     */
00117    SIGNAL_METHOD(RasterDataDescriptor, DisplayBandChanged)
00118 
00119    /**
00120     *  Emitted when the initial display mode changes with
00121     *  boost::any<\link ::DisplayMode DisplayMode\endlink> containing the new
00122     *  display mode.
00123     *
00124     *  @see     setDisplayMode()
00125     */
00126    SIGNAL_METHOD(RasterDataDescriptor, DisplayModeChanged)
00127 
00128    /**
00129     *  Sets the data type of the values in the data set.
00130     *
00131     *  @param   dataType
00132     *           The data type of the values in the data set.
00133     *
00134     *  @notify  This method notifies signalDataTypeChanged() if the given
00135     *           data type is different than the current data type.
00136     */
00137    virtual void setDataType(EncodingType dataType) = 0;
00138 
00139    /**
00140     *  Returns the data type of the values in the data set.
00141     *
00142     *  @return  The data type.
00143     */
00144    virtual EncodingType getDataType() const = 0;
00145 
00146    /**
00147     *  Sets the valid data types for the data set. The current data type may or may not be valid.
00148     *  By default, all Encoding Types are valid.
00149     *
00150     *  @param   validDataTypes
00151     *           The valid data types for the data set.
00152     *
00153     *  @notify  This method notifies signalValidDataTypesChanged() if the given
00154     *           valid data types are different than the current valid data types.
00155     *
00156     *  @see     setDataType()
00157     */
00158    virtual void setValidDataTypes(const std::vector<EncodingType>& validDataTypes) = 0;
00159 
00160    /**
00161     *  Returns the valid data types for the data set. The current data type may or may not be valid.
00162     *  By default, all Encoding Types are valid.
00163     *
00164     *  @return  The valid data types.
00165     *
00166     *  @see     getDataType()
00167     */
00168    virtual const std::vector<EncodingType>& getValidDataTypes() const = 0;
00169 
00170    /**
00171     *  Returns the number of bytes used for each pixel element value.
00172     *
00173     *  This is a convenience method that returns the number of bytes used for
00174     *  each pixel element as determined by the data type.
00175     *
00176     *  @return  The number of bytes.
00177     *
00178     *  @see     getDataType()
00179     */
00180    virtual unsigned int getBytesPerElement() const = 0;
00181 
00182    /**
00183     *  Sets bad values that should be ignored in the data statistics.
00184     *
00185     *  This method is intended to be used when creating a data descriptor that
00186     *  will be used to create a RasterElement.  When the RasterElement is
00187     *  created, the bad values that were set in the data descriptor by calling
00188     *  this method will be set into the Statistics objects in the raster
00189     *  element.  After the raster element is created, the bad values should be
00190     *  changed by calling Statistics::setBadValues() instead of this method.
00191     *
00192     *  @param   badValues
00193     *           The bad values that should be ignored.
00194     *
00195     *  @notify  This method notifies signalBadValuesChanged() if the given
00196     *           bad values are different than the current bad values.
00197     *
00198     *  @see     Statistics::setBadValues()
00199     */
00200    virtual void setBadValues(const std::vector<int>& badValues) = 0;
00201 
00202    /**
00203     *  Returns the bad values that should be ignored in the data statistics.
00204     *
00205     *  @return  The bad values as integers that should be ignored.
00206     */
00207    virtual const std::vector<int>& getBadValues() const = 0;
00208 
00209    /**
00210     *  Sets the interleave format of the data values.
00211     *
00212     *  @param   format
00213     *           The interleave format in which the values in the data set are
00214     *           stored.
00215     *
00216     *  @notify  This method notifies signalInterleaveFormatChanged() if the
00217     *           given interleave format is different than the current interleave
00218     *           format.
00219     */
00220    virtual void setInterleaveFormat(InterleaveFormatType format) = 0;
00221 
00222    /**
00223     *  Returns the interleave format of the data values.
00224     *
00225     *  @return  The interleave format in which the values in the data set are
00226     *           stored.
00227     */
00228    virtual InterleaveFormatType getInterleaveFormat() const = 0;
00229 
00230    /**
00231     *  Sets the rows for the data element that are available for processing.
00232     *
00233     *  This method sets the rows of the data element that are available for
00234     *  processing.  It is typically called in the following scenarios:
00235     *  - <b>Importing</b> - An importer would call this method to set the
00236     *    default rows to import, where the given vector is identical to or a
00237     *    subset of the rows vector in the RasterFileDescriptor contained
00238     *    in this data descriptor.  It would then called by the core after the
00239     *    user identifies any subset to load before Executable::execute() is
00240     *    called on the importer.
00241     *  - <b>Creating a new raster element</b> - Between calls to
00242     *    ModelServices::createDataDescriptor() and
00243     *    ModelServices::createElement() an object would call this method to
00244     *    set the rows describing the data in the element.
00245     *
00246     *  These rows differ from the rows in a corresponding
00247     *  RasterFileDescriptor in that they contain only those row objects
00248     *  that have been imported.
00249     *
00250     *  @param   rows
00251     *           A vector of DimensionDescriptors containing one
00252     *           instance for each row of the data set that is available for
00253     *           processing.
00254     *
00255     *  @notify  This method notifies signalRowsChanged() if the given rows are
00256     *           different than the current rows.
00257     *
00258     *  @see     DimensionDescriptor
00259     */
00260    virtual void setRows(const std::vector<DimensionDescriptor>& rows) = 0;
00261 
00262    /**
00263     *  Returns the rows for the data element that are available for processing.
00264     *
00265     *  @return  A vector of DimensionDescriptors containing one
00266     *           instance for each row of the data set that is available for
00267     *           processing.
00268     */
00269    virtual const std::vector<DimensionDescriptor>& getRows() const = 0;
00270 
00271    /**
00272     *  Returns the uniform skip factor between the on-disk numbers of
00273     *  DimensionDescriptors returned by getRows().  This is a convenience method.
00274     *
00275     *  @return the uniform skip factor. 0 means there is no skipping
00276     *
00277     *  @see RasterUtilities::determineSkipFactor()
00278     */
00279    virtual unsigned int getRowSkipFactor() const = 0;
00280 
00281    /**
00282     *  Returns the row object containing a given original number.
00283     *
00284     *  @param   originalNumber
00285     *           The zero-based original number for which to get the row object.
00286     *
00287     *  @return  The row object that has the given original number.  An invalid 
00288     *           DimensionDescriptor is returned if a row object does not exist 
00289     *           with the given original number.  This could occur if that particular 
00290     *           row has not been imported.
00291     */
00292    virtual DimensionDescriptor getOriginalRow(unsigned int originalNumber) const = 0;
00293 
00294    /**
00295     *  Returns the row object containing a given on-disk number.
00296     *
00297     *  @param   onDiskNumber
00298     *           The zero-based on-disk number for which to get the row object.
00299     *
00300     *  @return  The row object that has the given on-disk number.  An invalid 
00301     *           DimensionDescriptor is returned if a row object does not exist 
00302     *           with the given on-disk number.  This could occur if the element 
00303     *           was created from an algorithm instead of an import, where there 
00304     *           would be no on-disk representation of the data.
00305     */
00306    virtual DimensionDescriptor getOnDiskRow(unsigned int onDiskNumber) const = 0;
00307 
00308    /**
00309     *  Returns the row object containing a given active number.
00310     *
00311     *  @param   activeNumber
00312     *           The zero-based active number for which to get the row object.
00313     *
00314     *  @return  The row object that has the given active number.  An invalid 
00315     *           DimensionDescriptor is returned if a row object does not exist 
00316     *           with the given active number.  
00317     */
00318    virtual DimensionDescriptor getActiveRow(unsigned int activeNumber) const = 0;
00319 
00320    /**
00321     *  Returns the number of rows available for processing.
00322     *
00323     *  This is a convenience method that returns getRows().size().
00324     *
00325     *  @return  The number of rows available for processing.
00326     */
00327    virtual unsigned int getRowCount() const = 0;
00328 
00329    /**
00330     *  Sets the columns for the data element that are available for processing.
00331     *
00332     *  This method sets the columns of the data element that are available for
00333     *  processing.  It is typically called in the following scenarios:
00334     *  - <b>Importing</b> - An importer would call this method to set the
00335     *    default columns to import, where the given vector is identical to or
00336     *    a subset of the columns vector in the RasterFileDescriptor
00337     *    contained in this data descriptor.  It would then called by the core
00338     *    after the user identifies any subset to load before Executable::execute()
00339     *    is called on the importer.
00340     *  - <b>Creating a new raster element</b> - Between calls to
00341     *    ModelServices::createDataDescriptor() and
00342     *    ModelServices::createElement() an object would call this method to
00343     *    set the columns describing the data in the element.
00344     *
00345     *  These columns differ from the columns in a corresponding
00346     *  RasterFileDescriptor in that they contain only those column objects
00347     *  that have been imported.
00348     *
00349     *  @param   columns
00350     *           A vector of DimensionDescriptors containing one
00351     *           instance for each column of the data set that is available for
00352     *           processing.
00353     *
00354     *  @notify  This method notifies signalColumnsChanged() if the given columns
00355     *           are different than the current columns.
00356     *
00357     *  @see     DimensionDescriptor
00358     */
00359    virtual void setColumns(const std::vector<DimensionDescriptor>& columns) = 0;
00360 
00361    /**
00362     *  Returns the columns for the data element that are available for
00363     *  processing.
00364     *
00365     *  @return  A vector of DimensionDescriptors containing one
00366     *           instance for each column of the data set that is available for
00367     *           processing.
00368     */
00369    virtual const std::vector<DimensionDescriptor>& getColumns() const = 0;
00370 
00371    /**
00372     *  Returns the uniform skip factor between the on-disk numbers of
00373     *  DimensionDescriptors returned by getColumns().  This is a convenience method.
00374     *
00375     *  @return the uniform skip factor. 0 means there is no skipping
00376     *
00377     *  @see RasterUtilities::determineSkipFactor()
00378     */
00379    virtual unsigned int getColumnSkipFactor() const = 0;
00380 
00381    /**
00382     *  Returns the column object containing a given original number.
00383     *
00384     *  @param   originalNumber
00385     *           The zero-based original number for which to get the column
00386     *           object.
00387     *
00388     *  @return  The column object that has the given original number.  An invalid 
00389     *           DimensionDescriptor is returned if a column object does not exist 
00390     *           with the given original number.  This could occur if that particular 
00391     *           column has not been imported.
00392     */
00393    virtual DimensionDescriptor getOriginalColumn(unsigned int originalNumber) const = 0;
00394 
00395    /**
00396     *  Returns the column object containing a given on-disk number.
00397     *
00398     *  @param   onDiskNumber
00399     *           The zero-based on-disk number for which to get the column
00400     *           object.
00401     *
00402     *  @return  The column object that has the given on-disk number.  An invalid 
00403     *           DimensionDescriptor is returned if a column object does not exist 
00404     *           with the given on-disk number.  This could occur if the element 
00405     *           was created from an algorithm instead of an import, where there would be
00406     *           no on-disk representation of the data.
00407     */
00408    virtual DimensionDescriptor getOnDiskColumn(unsigned int onDiskNumber) const = 0;
00409 
00410    /**
00411     *  Returns the column object containing a given active number.
00412     *
00413     *  @param   activeNumber
00414     *           The zero-based active number for which to get the column
00415     *           object.
00416     *
00417     *  @return  The column object that has the given active number.  An invalid 
00418     *           DimensionDescriptor is returned if a column object does not exist 
00419     *           with the given active number.
00420     */
00421    virtual DimensionDescriptor getActiveColumn(unsigned int activeNumber) const = 0;
00422 
00423    /**
00424     *  Returns the number of columns available for processing.
00425     *
00426     *  This is a convenience method that returns getColumns().size().
00427     *
00428     *  @return  The number of columns available for processing.
00429     */
00430    virtual unsigned int getColumnCount() const = 0;
00431 
00432    /**
00433     *  Sets the bands for the data element that are available for processing.
00434     *
00435     *  This method sets the bands of the data element that are available for
00436     *  processing.  It is typically called in the following scenarios:
00437     *  - <b>Importing</b> - An importer would call this method to set the
00438     *    default bands to import, where the given vector is identical to or a
00439     *    subset of the bands vector in the RasterFileDescriptor contained
00440     *    in this data descriptor.  It would then called by the core after the
00441     *    user identifies any subset to load before Executable::execute() is
00442     *    called on the importer.
00443     *  - <b>Creating a new sensor data element</b> - Between calls to
00444     *    ModelServices::createDataDescriptor() and
00445     *    ModelServices::createElement() an object would call this method to
00446     *    set the bands describing the data in the element.
00447     *
00448     *  These bands differ from the bands in a corresponding
00449     *  RasterFileDescriptor in that they contain only those band objects
00450     *  that have been imported.
00451     *
00452     *  @param   bands
00453     *           A vector of DimensionDescriptors containing one
00454     *           instance for each band of the data set that is available for
00455     *           processing.
00456     *
00457     *  @notify  This method notifies signalBandsChanged() if the given bands are
00458     *           different than the current bands.
00459     *
00460     *  @see     DimensionDescriptor
00461     */
00462    virtual void setBands(const std::vector<DimensionDescriptor>& bands) = 0;
00463 
00464    /**
00465     *  Returns the bands for the data element that are available for
00466     *  processing.
00467     *
00468     *  @return  A vector of DimensionDescriptors containing one
00469     *           instance for each band of the data set that is available for
00470     *           processing.
00471     */
00472    virtual const std::vector<DimensionDescriptor>& getBands() const = 0;
00473 
00474    /**
00475     *  Returns the band object containing a given original number.
00476     *
00477     *  @param   originalNumber
00478     *           The zero-based original number for which to get the band
00479     *           object.
00480     *
00481     *  @return  The band object that has the given original number.  An invalid 
00482     *           DimensionDescriptor is returned if a band object does not exist 
00483     *           with the given original number.  This could occur if that 
00484     *           particular band has not been imported.
00485     */
00486    virtual DimensionDescriptor getOriginalBand(unsigned int originalNumber) const = 0;
00487 
00488    /**
00489     *  Returns the band object containing a given on-disk number.
00490     *
00491     *  @param   onDiskNumber
00492     *           The zero-based on-disk number for which to get the band object.
00493     *
00494     *  @return  The band object that has the given on-disk number.   An invalid 
00495     *           DimensionDescriptor is returned if a band object does not exist 
00496     *           with the given on-disk number.  This could occur if the element
00497     *           was created from an algorithm instead of an import, where there
00498     *           would be no on-disk representation of the data.
00499     */
00500    virtual DimensionDescriptor getOnDiskBand(unsigned int onDiskNumber) const = 0;
00501 
00502    /**
00503     *  Returns the band object containing a given active number.
00504     *
00505     *  @param   activeNumber
00506     *           The zero-based active number for which to get the band object.
00507     *
00508     *  @return  The band object that has the given active number.  An invalid 
00509     *           DimensionDescriptor is returned if a band object does not exist 
00510     *           with the given active number.
00511     */
00512    virtual DimensionDescriptor getActiveBand(unsigned int activeNumber) const = 0;
00513 
00514    /**
00515     *  Returns the number of bands available for processing.
00516     *
00517     *  This is a convenience method that returns getBands().size().
00518     *
00519     *  @return  The number of bands available for processing.
00520     */
00521    virtual unsigned int getBandCount() const = 0;
00522 
00523    /**
00524     *  Sets the pixel size of each column in the data set.
00525     *
00526     *  By default, each row and column has a pixel size of 1.0, thereby
00527     *  producing a size ratio of 1.0, which indicates that the pixel appears
00528     *  as a square in the view.  Calling this method with a value other than
00529     *  1.0 allows for non-square pixels, which may represent the true nature
00530     *  of the data.
00531     *
00532     *  This method serves as a default for the view that can be associated
00533     *  with a model element.  Once a view is created, call the
00534     *  Layer::setXScaleFactor() and Layer::setXOffset() method to change the
00535     *  display pixel size.
00536     *
00537     *  @param   pixelSize
00538     *           The pixel size for each column in the data set.  If this value
00539     *           is negative or zero, this method does nothing.
00540     *
00541     *  @notify  This method notifies signalPixelSizeChanged() if the given
00542     *           column pixel size is different than the current column pixel
00543     *           size.
00544     */
00545    virtual void setXPixelSize(double pixelSize) = 0;
00546 
00547    /**
00548     *  Returns the pixel size of each column in the data set.
00549     *
00550     *  @return  The column pixel size.
00551     *
00552     *  @see     setXPixelSize()
00553     */
00554    virtual double getXPixelSize() const = 0;
00555 
00556    /**
00557     *  Sets the pixel size of each row in the data set.
00558     *
00559     *  By default, each row and column has a pixel size of 1.0, thereby
00560     *  producing a size ratio of 1.0, which indicates that the pixel appears
00561     *  as a square in the view.  Calling this method with a value other than
00562     *  1.0 allows for non-square pixels, which may represent the true nature
00563     *  of the data.
00564     *
00565     *  This method serves as a default for the view that can be associated
00566     *  with a model element.  Once a view is created, call the
00567     *  Layer::setYScaleFactor() and Layer::setYOffset() method to change the
00568     *  display pixel size.
00569     *
00570     *  @param   pixelSize
00571     *           The pixel size for each row in the data set.  If this value
00572     *           is negative or zero, this method does nothing.
00573     *
00574     *  @notify  This method notifies signalPixelSizeChanged() if the given
00575     *           row pixel size is different than the current row pixel size.
00576     */
00577    virtual void setYPixelSize(double pixelSize) = 0;
00578 
00579    /**
00580     *  Returns the pixel size of each row in the data set.
00581     *
00582     *  @return  The row pixel size.
00583     *
00584     *  @see     setYPixelSize()
00585     */
00586    virtual double getYPixelSize() const = 0;
00587 
00588    /**
00589     *  Sets the units the values in the data set.
00590     *
00591     *  @param   pUnits
00592     *           The units of the values in the data set.
00593     *
00594     *  @notify  This method notifies Subject::signalModified if the given
00595     *           units object is different than the current units object.
00596     */
00597    virtual void setUnits(const Units* pUnits) = 0;
00598 
00599    /**
00600     *  Returns a pointer to the element's units object.
00601     *
00602     *  @return  A pointer to the element's units object.
00603     */
00604    virtual Units* getUnits() = 0;
00605 
00606    /**
00607     *  Returns read-only access to the element's units object.
00608     *
00609     *  @return  A const pointer to the element's units object.  The units
00610     *           represented by the returned pointer should not be modified.  To
00611     *           modify the values, call the non-const version of getUnits().
00612     */
00613    virtual const Units* getUnits() const = 0;
00614 
00615   /**
00616     *  Sets the band that is initially displayed in a RasterLayer.
00617     *
00618     *  This method sets a band to be initially displayed when a raster layer is
00619     *  created.
00620     *
00621     *  @param   eColor
00622     *           The color in which to display the given band.
00623     *  @param   band
00624     *           The band object to display in the given color.
00625     *
00626     *  @notify  This method notifies signalDisplayBandChanged() if the given
00627     *           display band is different than the current display band for the
00628     *           given raster channel.
00629     *
00630     *  @see     setDisplayMode()
00631     */
00632    virtual void setDisplayBand(RasterChannelType eColor, DimensionDescriptor band) = 0;
00633 
00634    /**
00635     *  Returns the band object that is initially displayed in a RasterLayer.
00636     *
00637     *  @param   eColor
00638     *           The color in which to get the initially displayed band.
00639     *
00640     *  @return  A pointer to the band object that is initially displayed in the
00641     *           given color.  \b NULL is returned if no band has been set to
00642     *           be initially displayed for the given color.
00643     */
00644    virtual DimensionDescriptor getDisplayBand(RasterChannelType eColor) const = 0;
00645 
00646    /**
00647     *  Sets the initial display mode for the data in a RasterLayer.
00648     *
00649     *  @param   displayMode
00650     *           The initial display mode.
00651     *
00652     *  @notify  This method notifies signalDisplayModeChanged() if the given
00653     *           initial display mode is different than the current display mode.
00654     *
00655     *  @see     setDisplayBand()
00656     */
00657    virtual void setDisplayMode(DisplayMode displayMode) = 0;
00658 
00659    /**
00660     *  Returns the initial display mode for the data in a RasterLayer.
00661     *
00662     *  @return  The initial display mode.
00663     */
00664    virtual DisplayMode getDisplayMode() const = 0;
00665 
00666 protected:
00667    /**
00668     * This should be destroyed by calling ModelServices::destroyDataDescriptor.
00669     */
00670    virtual ~RasterDataDescriptor() {}
00671 };
00672 
00673 #endif

Software Development Kit - Opticks 4.9.0 Build 16218