00001 #ifndef __INMEMFORMAT_H 00002 #define __INMEMFORMAT_H 00003 00004 #include "windows_defs.h" 00005 00006 #include "imageformat.h" 00007 #include "imagestate.h" 00008 00009 #include "TraceLog.h" 00010 00011 #include <iostream> 00012 00024 class GV_EXPORT InMemFormat : public ImageFormat { 00025 protected: 00026 00030 typedef struct { 00031 int iband; 00032 char *data; 00033 int width; 00034 int height; 00035 DataType dtype; 00036 int sz_dtype; 00037 } MemBandInf; 00038 00039 ImageFormat *mEmulateFormat; 00040 ImageState *mImgState; 00041 00042 std::vector<MemBandInf> mMemBandSet; 00043 00044 bool inMemSet( int iband ) { 00045 for ( int i=0; i < (int)mMemBandSet.size(); i++ ) 00046 if ( mMemBandSet[i].iband == iband ) 00047 return true; 00048 return false; 00049 } 00050 00051 char* getMemRect( int iband, int x, int y, 00052 int w, int h, int ow, int oh, ScaleType st ) const; 00053 00054 00055 public: 00056 InMemFormat( ImageFormat *frmt, ImageState *imgstate ) : 00057 mEmulateFormat( frmt ), 00058 mImgState( imgstate ) { 00059 stateToMem(); 00060 mBandSet = frmt->getBandInfSet(); 00061 } 00062 00063 ~InMemFormat( ) { 00064 for ( unsigned int imem=0; imem < mMemBandSet.size(); imem++ ) 00065 delete [] mMemBandSet[imem].data; 00066 } 00067 00068 void stateToMem( ); 00069 00070 // THIS METHOD IS NOT AVAILABLE 00071 virtual bool open( std::string ) { 00072 return false; 00073 } 00074 00075 virtual void* getBand( int iband, 00076 int x1, 00077 int y1, 00078 int w1, 00079 int h1, 00080 int w2, 00081 int h2, 00082 ScaleType st=SCALE_BI ) const; 00083 00084 virtual void getLL( int iband, double &i, double &j ) { 00085 mEmulateFormat->getLL( iband, i, j ); 00086 } 00087 00088 virtual void getXY( int iband, double &i, double &j ) { 00089 mEmulateFormat->getXY( iband, i, j ); 00090 } 00091 00092 ImageFormat* getFormat( ) { 00093 return mEmulateFormat; 00094 } 00095 }; 00096 00097 00098 00099 #endif 00100 00101 00102 00103
Home |
Search |
Disclaimers & Privacy |
Contact Us GLIMSView Maintainer: dsoltesz@usgs.gov |