00001 /****************************************************************************\ 00002 * VRVis * 00003 * http://vrvis.sourceforge.net * 00004 * (C) 2004 by Alex Loeffler * 00005 * mailto:aloeffler@users.sourceforge.net * 00006 **************************************************************************** 00007 * License * 00008 * * 00009 * This library is free software; you can redistribute it and/or modify it * 00010 * under the terms of the GNU Library General Public License as published * 00011 * by the Free Software Foundation, version 2. * 00012 * * 00013 * This library is distributed in the hope that it will be useful, but * 00014 * WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00016 * Library General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU Library General Public * 00019 * License along with this library; if not, write to the Free Software * 00020 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 00021 \****************************************************************************/ 00022 00023 #ifndef IMAGEBAND_HPP 00024 #define IMAGEBAND_HPP 00025 00026 #include <vector> 00027 #include "Common.hpp" 00028 #include "RasterData.hpp" 00029 00030 class GDALDataset; 00031 class GDALRasterBand; 00032 00033 namespace vrvis 00034 { 00035 00036 template <class DataTypeT> class Image; 00037 00039 template <class DataTypeT> 00040 class ImageBand : public RasterData 00041 { 00042 // ================================================================== PUBLIC 00043 00044 public: 00045 00046 // ----------------------------------------------- Constructor & Destructor. 00048 00050 ImageBand(Image<DataTypeT>* pParentImage, const int cBandIndex); 00052 ~ImageBand(void); 00053 00055 // ------------------------- Data Loading/Unloading (Implements RasterData). 00057 00059 void load(void); 00061 void unload(void); 00062 00064 // --------------------------------------- Geometry (Implements RasterData). 00066 00068 void getSizeInPixels(int& rPixelsX, int& rPixelsY) const; 00069 00070 // ------------------------------------------- Data (Implements RasterData). 00071 00073 double* getValues(void) const; 00074 00075 // -------------------------------------------------------------- Accessors. 00076 00078 DataTypeT getMinValue(void) const; 00080 DataTypeT getMaxValue(void) const; 00081 00083 GDALRasterBand* getGDALRasterBand(void); 00084 00086 // ================================================================= PRIVATE 00087 00088 private: 00089 00090 // ---------------------------------------------------- Member Construction. 00091 00093 static GDALRasterBand* constructRasterBand(Image<DataTypeT>* pParentImage, 00094 const int cBandIndex); 00095 00097 static DataTypeT constructMinValue(GDALRasterBand* pBand); 00099 static DataTypeT constructMaxValue(GDALRasterBand* pBand); 00100 00101 // ---------------------------------------------------------------- Members. 00102 00104 Image<DataTypeT>* mpParentImage; 00106 const int mcBandIndex; 00108 GDALRasterBand* mpGDALRasterBand; 00110 const DataTypeT mcMinValue; 00112 const DataTypeT mcMaxValue; 00114 double* mpValues; 00116 bool mIsLoaded; 00117 }; 00118 00119 } // End namespace. 00120 00121 // Include template implementation. 00122 #include "ImageBand.inl" 00123 00124 #endif // IMAGEBAND_HPP