[QGIS Commit] r15230 - in branches/raster-providers/src: app core core/raster providers/gdal providers/grass providers/wms

svn_qgis at osgeo.org svn_qgis at osgeo.org
Mon Feb 21 05:06:36 EST 2011


Author: rblazek
Date: 2011-02-21 02:06:36 -0800 (Mon, 21 Feb 2011)
New Revision: 15230

Modified:
   branches/raster-providers/src/app/qgsrasterlayerproperties.cpp
   branches/raster-providers/src/core/qgsrasterdataprovider.h
   branches/raster-providers/src/core/raster/qgsrasterlayer.cpp
   branches/raster-providers/src/providers/gdal/qgsgdalprovider.cpp
   branches/raster-providers/src/providers/gdal/qgsgdalprovider.h
   branches/raster-providers/src/providers/grass/qgsgrassrasterprovider.cpp
   branches/raster-providers/src/providers/grass/qgsgrassrasterprovider.h
   branches/raster-providers/src/providers/wms/qgswmsprovider.cpp
   branches/raster-providers/src/providers/wms/qgswmsprovider.h
Log:
color enhancement min/max fix, temporarily show all properties

Modified: branches/raster-providers/src/app/qgsrasterlayerproperties.cpp
===================================================================
--- branches/raster-providers/src/app/qgsrasterlayerproperties.cpp	2011-02-20 22:48:13 UTC (rev 15229)
+++ branches/raster-providers/src/app/qgsrasterlayerproperties.cpp	2011-02-21 10:06:36 UTC (rev 15230)
@@ -71,7 +71,9 @@
   mGrayMinimumMaximumEstimated = true;
   mRGBMinimumMaximumEstimated = true;
 
-  mRasterLayerIsInternal = mRasterLayer->dataProvider() == 0;
+  // TODO: use providers capabilietes
+  //mRasterLayerIsInternal = mRasterLayer->dataProvider() == 0;
+  mRasterLayerIsInternal = true;
 
   setupUi( this );
   connect( buttonBox, SIGNAL( accepted() ), this, SLOT( accept() ) );
@@ -520,10 +522,11 @@
 
   if ( !mRasterLayerIsInternal )
   {
-    delete tabPageSymbology;
-    delete tabPageColormap;
-    delete tabPagePyramids;
-    delete tabPageHistogram;
+    // TODO: add providers capabilities
+    //delete tabPageSymbology;
+    //delete tabPageColormap;
+    //delete tabPagePyramids;
+    //delete tabPageHistogram;
 
     gboxNoDataValue->setEnabled( false );
     gboxCustomTransparency->setEnabled( false );

Modified: branches/raster-providers/src/core/qgsrasterdataprovider.h
===================================================================
--- branches/raster-providers/src/core/qgsrasterdataprovider.h	2011-02-20 22:48:13 UTC (rev 15229)
+++ branches/raster-providers/src/core/qgsrasterdataprovider.h	2011-02-21 10:06:36 UTC (rev 15230)
@@ -168,7 +168,7 @@
     /** Returns data type for the band specified by number */
     virtual int dataType ( int bandNo ) const
     {
-      return QgsRasterDataProvider::UnknownDataType;
+      return srcDataType ( bandNo );
     }
 
     /** Returns source data type for the band specified by number,
@@ -462,7 +462,7 @@
     @note: this member has been added in version 1.2*/
     int mDpi;
 
-    /** \brief Cell value representing no data. e.g. -9999, indexed from 1  */
+    /** \brief Cell value representing no data. e.g. -9999, indexed from 0  */
     QList<double> mNoDataValue;
 
     /** \brief Flag indicating if the nodatavalue is valid*/

Modified: branches/raster-providers/src/core/raster/qgsrasterlayer.cpp
===================================================================
--- branches/raster-providers/src/core/raster/qgsrasterlayer.cpp	2011-02-20 22:48:13 UTC (rev 15229)
+++ branches/raster-providers/src/core/raster/qgsrasterlayer.cpp	2011-02-21 10:06:36 UTC (rev 15230)
@@ -2580,7 +2580,8 @@
     mRasterStatsList.push_back( myRasterBandStats );
 
     //Build a new contrast enhancement for the band and store in list
-    QgsContrastEnhancement myContrastEnhancement(( QgsContrastEnhancement::QgsRasterDataType )mDataProvider->dataType( i ) );
+    //QgsContrastEnhancement myContrastEnhancement(( QgsContrastEnhancement::QgsRasterDataType )mDataProvider->dataType( i ) );
+    QgsContrastEnhancement myContrastEnhancement(( QgsContrastEnhancement::QgsRasterDataType )mDataProvider->srcDataType( i ) );
     mContrastEnhancementList.append( myContrastEnhancement );
   }
 
@@ -4371,7 +4372,7 @@
         myGrayVal = 255 - myGrayVal;
       }
 
-      //QgsDebugMsg( QString( "i = %1 myGrayValue = %2 myAlphaValue = %3").arg(i).arg( myGrayValue ).arg(myAlphaValue) );
+      QgsDebugMsg( QString( "i = %1 myGrayValue = %2 myGrayVal = %3 myAlphaValue = %4").arg(i).arg( myGrayValue ).arg(myGrayVal).arg(myAlphaValue) );
       imageScanLine[ i ] = qRgba( myGrayVal, myGrayVal, myGrayVal, myAlphaValue );
     }
   }

Modified: branches/raster-providers/src/providers/gdal/qgsgdalprovider.cpp
===================================================================
--- branches/raster-providers/src/providers/gdal/qgsgdalprovider.cpp	2011-02-20 22:48:13 UTC (rev 15229)
+++ branches/raster-providers/src/providers/gdal/qgsgdalprovider.cpp	2011-02-21 10:06:36 UTC (rev 15230)
@@ -256,8 +256,6 @@
   // Determine the nodata value and data type
   //
   mValidNoDataValue = true;
-  mGdalDataType.append( 0 ); // not used index
-  mNoDataValue.append( 0 ); // not used index
   for ( int i = 1; i <= GDALGetRasterCount( mGdalBaseDataset ); i++ )
   {
     GDALRasterBandH myGdalBand = GDALGetRasterBand( mGdalDataset, i );
@@ -280,17 +278,17 @@
           // Use longer data type to avoid conflict with real data
           //myNoDataValue = 255.0;
           myNoDataValue = -32768.0;
-          mGdalDataType.append( GDT_UInt16 );
+          mGdalDataType.append( GDT_Int16 );
           break;
         case QgsRasterDataProvider::Int16:
           //myNoDataValue = -32768.0;
           myNoDataValue = -2147483648.0;
-          mGdalDataType.append( GDT_UInt32 );
+          mGdalDataType.append( GDT_Int32 );
           break;
         case QgsRasterDataProvider::UInt16:
           //myNoDataValue = 65535.0;
           myNoDataValue = -2147483648.0;
-          mGdalDataType.append( GDT_UInt32 );
+          mGdalDataType.append( GDT_Int32 );
           break;
         case QgsRasterDataProvider::Int32:
           myNoDataValue = -2147483648.0;
@@ -308,7 +306,7 @@
       }
     }
     mNoDataValue.append( myNoDataValue );
-    QgsDebugMsg( QString("mNoDataValue[%1] = %1").arg(i).arg ( mNoDataValue[i] ) ); 
+    QgsDebugMsg( QString("mNoDataValue[%1] = %1").arg(i-1).arg ( mNoDataValue[i-1] ) ); 
   }
 
   // This block of code was in old version in QgsRasterLayer::bandStatistics 
@@ -568,7 +566,7 @@
  
   // TODO: more bands support
   //myMemDsn.sprintf ( "MEM:::DATAPOINTER=%lu,PIXELS=%d,LINES=%d,BANDS=1,DATATYPE=%s,PIXELOFFSET=0,LINEOFFSET=0,BANDOFFSET=0", (long)theBlock, thePixelWidth, thePixelHeight,  GDALGetDataTypeName( myGdalDataType ) );
-  myMemDsn.sprintf ( "MEM:::DATAPOINTER=%lu,PIXELS=%d,LINES=%d,BANDS=1,DATATYPE=%s,PIXELOFFSET=0,LINEOFFSET=0,BANDOFFSET=0", (long)theBlock, thePixelWidth, thePixelHeight,  GDALGetDataTypeName( (GDALDataType)mGdalDataType[theBandNo] ) );
+  myMemDsn.sprintf ( "MEM:::DATAPOINTER=%lu,PIXELS=%d,LINES=%d,BANDS=1,DATATYPE=%s,PIXELOFFSET=0,LINEOFFSET=0,BANDOFFSET=0", (long)theBlock, thePixelWidth, thePixelHeight,  GDALGetDataTypeName( (GDALDataType)mGdalDataType[theBandNo-1] ) );
 
   QgsDebugMsg( "Open GDAL MEM : " + myMemDsn );
 
@@ -664,7 +662,7 @@
 
   }
   */
-  myWarpOptions->padfDstNoDataReal[0] = mNoDataValue[theBandNo];
+  myWarpOptions->padfDstNoDataReal[0] = mNoDataValue[theBandNo-1];
   myWarpOptions->padfDstNoDataImag[0] = 0.0;
 
   GDALSetRasterNoDataValue( GDALGetRasterBand( myGdalMemDataset, 
@@ -705,8 +703,8 @@
 }
 
 double  QgsGdalProvider::noDataValue() const {
-  if ( mNoDataValue.size () > 1 ) {
-    return mNoDataValue[1];
+  if ( mNoDataValue.size () > 0 ) {
+    return mNoDataValue[0];
   }
   return std::numeric_limits<int>::max(); // should not happen or be used
 }
@@ -899,7 +897,7 @@
 #endif
       QString v;
 
-      if ( mValidNoDataValue && ( fabs( value - mNoDataValue[i] ) <= TINY_VALUE || value != value ) )
+      if ( mValidNoDataValue && ( fabs( value - mNoDataValue[i-1] ) <= TINY_VALUE || value != value ) )
       {
         v = tr( "null (no data)" );
       }
@@ -980,7 +978,7 @@
 
 int QgsGdalProvider::dataType( int bandNo ) const
 {
-  return dataTypeFormGdal ( mGdalDataType[bandNo] );
+  return dataTypeFormGdal ( mGdalDataType[bandNo-1] );
 }
 
 int QgsGdalProvider::bandCount() const

Modified: branches/raster-providers/src/providers/gdal/qgsgdalprovider.h
===================================================================
--- branches/raster-providers/src/providers/gdal/qgsgdalprovider.h	2011-02-20 22:48:13 UTC (rev 15229)
+++ branches/raster-providers/src/providers/gdal/qgsgdalprovider.h	2011-02-21 10:06:36 UTC (rev 15230)
@@ -269,7 +269,7 @@
 
     /** \brief Gdal data types used to represent data in in QGIS, 
                may be longer than source data type to keep nulls 
-               indexed from 1 
+               indexed from 0 
      */
     QList<int>mGdalDataType;
 

Modified: branches/raster-providers/src/providers/grass/qgsgrassrasterprovider.cpp
===================================================================
--- branches/raster-providers/src/providers/grass/qgsgrassrasterprovider.cpp	2011-02-20 22:48:13 UTC (rev 15229)
+++ branches/raster-providers/src/providers/grass/qgsgrassrasterprovider.cpp	2011-02-21 10:06:36 UTC (rev 15230)
@@ -340,7 +340,7 @@
   return capability;
 }
 
-int QgsGrassRasterProvider::dataType( int bandNo ) const
+int QgsGrassRasterProvider::srcDataType( int bandNo ) const
 {
   switch ( mGrassDataType ) {
     case CELL_TYPE:

Modified: branches/raster-providers/src/providers/grass/qgsgrassrasterprovider.h
===================================================================
--- branches/raster-providers/src/providers/grass/qgsgrassrasterprovider.h	2011-02-20 22:48:13 UTC (rev 15229)
+++ branches/raster-providers/src/providers/grass/qgsgrassrasterprovider.h	2011-02-21 10:06:36 UTC (rev 15230)
@@ -178,6 +178,7 @@
     int capabilities() const;
 
     int dataType ( int bandNo ) const;
+    int srcDataType ( int bandNo ) const;
 
     int bandCount() const;
 

Modified: branches/raster-providers/src/providers/wms/qgswmsprovider.cpp
===================================================================
--- branches/raster-providers/src/providers/wms/qgswmsprovider.cpp	2011-02-20 22:48:13 UTC (rev 15229)
+++ branches/raster-providers/src/providers/wms/qgswmsprovider.cpp	2011-02-21 10:06:36 UTC (rev 15230)
@@ -996,7 +996,7 @@
   mCapabilitiesReply = 0;
 }
 
-int QgsWmsProvider::dataType( int bandNo ) const
+int QgsWmsProvider::srcDataType( int bandNo ) const
 {
   return QgsRasterDataProvider::ARGBDataType;
 }

Modified: branches/raster-providers/src/providers/wms/qgswmsprovider.h
===================================================================
--- branches/raster-providers/src/providers/wms/qgswmsprovider.h	2011-02-20 22:48:13 UTC (rev 15229)
+++ branches/raster-providers/src/providers/wms/qgswmsprovider.h	2011-02-21 10:06:36 UTC (rev 15230)
@@ -529,8 +529,8 @@
     int capabilities() const;
 
     int dataType ( int bandNo ) const;
+    int srcDataType ( int bandNo ) const;
     int bandCount() const;
-   
     
 
     /**



More information about the QGIS-commit mailing list