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 HDF4IMPORTERSHELL_H 00011 #define HDF4IMPORTERSHELL_H 00012 00013 #include "AppConfig.h" 00014 00015 #include "HdfImporterShell.h" 00016 00017 #include <string> 00018 00019 class Hdf4Dataset; 00020 class Hdf4File; 00021 class RasterElement; 00022 00023 /** 00024 * \ingroup ShellModule 00025 * The base class of an importer that loads data in HDF Version 4 format. 00026 * 00027 * The HDF4 Importer Shell is a class designed to wrap the HDF4 libraries and 00028 * provide a convenient means of importing simple (header, metadata, 1 cube) 00029 * HDF4 data. The shell class is highly customizable, but to use 00030 * these features requires (a) downloading the HDF4 v4.2r1 precompiled libraries 00031 * from <A HREF=ftp://ftp.ncsa.uiuc.edu/HDF/HDF/HDF4.2r1/bin/>*</A> 00032 * 00033 * To link a derived plugin under Windows, link to hm421md.lib/hd421md.lib (DEBUG) 00034 * or hm421m.lib/hd421m.lib (RELEASE). 00035 * To link a derived plugin under Solaris, link to libmfhdf.a, libdf.a, libjpeg.a, 00036 * and libudport.a. 00037 */ 00038 class Hdf4ImporterShell : public HdfImporterShell 00039 { 00040 protected: 00041 /** 00042 * Constructs the Hdf4ImporterShell object to load file data in HDF Version 4 format. 00043 */ 00044 Hdf4ImporterShell(); 00045 00046 /** 00047 * Populates a representation of the HDF File. 00048 * 00049 * @param hdfFile 00050 * An EMPTY Hdf4File object to populate. 00051 * 00052 * @return TRUE if the %Hdf4File object was successfully populated, otherwise FALSE. 00053 */ 00054 virtual bool getFileData(Hdf4File& hdfFile) const; 00055 00056 /** 00057 * Loads entire Hdf4Dataset into the studio's memory block and returns the pointer to it. 00058 * 00059 * Calls ModelServices::getMemoryBlock() to fetch the memory. 00060 * 00061 * @param hdfFile 00062 * A const reference to the Hdf4File that contains the dataset to load into memory. 00063 * @param dataset 00064 * The dataset to load into memory from the Hdf4File. 00065 * 00066 * @return A pointer to memory in the studio's memory space with the loaded data. If 00067 * passed in NULL, this method will allocate enough memory for reading. 00068 */ 00069 void* loadDatasetFromFile(const Hdf4File& hdfFile, const Hdf4Dataset& dataset) const; 00070 00071 private: 00072 /** 00073 * Creates an RasterPager Plug-In and sets it in the RasterElement. 00074 * 00075 * This method can be overridden for importers that do not have a one-to-one correspondence between 00076 * an HDF dataset and an RasterElement (ie. MODIS). Those that load one HDF dataset as a RasterElement 00077 * can use the default implementation provided. 00078 * 00079 * Called from HdfImporterShell::createRasterPagerPlugIn(const string&, const string&, RasterElement&). 00080 * 00081 * @param pRaster 00082 * A pointer to the RasterElement for placing the raster pager plug-in. 00083 * 00084 * @return TRUE if the operation succeeds, FALSE otherwise. 00085 */ 00086 virtual bool createRasterPager(RasterElement *pRaster) const; 00087 }; 00088 00089 #endif