[QGIS Commit] r8629 - in trunk/qgis: python/core src/app src/core/raster src/ui

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sun Jun 8 21:44:01 EDT 2008


Author: ersts
Date: 2008-06-08 21:44:01 -0400 (Sun, 08 Jun 2008)
New Revision: 8629

Modified:
   trunk/qgis/python/core/qgsrasterlayer.sip
   trunk/qgis/src/app/qgsrasterlayerproperties.cpp
   trunk/qgis/src/app/qgsrasterlayerproperties.h
   trunk/qgis/src/core/raster/qgsrasterlayer.cpp
   trunk/qgis/src/core/raster/qgsrasterlayer.h
   trunk/qgis/src/ui/qgsrasterlayerpropertiesbase.ui
Log:
-Removed some unneeded code for a freature that will not be in 1.0
-Added flags to indicate if min max values are actual computed values or estimates/userdefined
-Implemented the min/max estimate warning on gui

Modified: trunk/qgis/python/core/qgsrasterlayer.sip
===================================================================
--- trunk/qgis/python/core/qgsrasterlayer.sip	2008-06-09 01:35:46 UTC (rev 8628)
+++ trunk/qgis/python/core/qgsrasterlayer.sip	2008-06-09 01:44:01 UTC (rev 8629)
@@ -207,15 +207,7 @@
     
     /** \brief Mutator for transparent band name mapping.  */
     void setTransparentBandName(const QString & theBandNameQString);
-    //
-    // Accessor and mutator for transparent band name
-    // 
-    /** \brief  Accessor for transparent band name mapping. */
-    QString getTransparentLayerName();
     
-    /** \brief Mutator for transparent band name mapping.  */
-    void setTransparentLayerName(const QString & theLayerNameQString);
-    
     //
     // Accessor and mutator for gray band name
     //
@@ -450,13 +442,13 @@
      /** \brief Mutator for mUserDefinedRGBMinMaxFlag */
     void setUserDefinedRGBMinMax(bool theBool);
 
-    /** \brief Accessor for userDefinedMinMax.  */
+    /** \brief Accessor for mUserDefinedRGBMinMaxFlag.  */
     bool getUserDefinedRGBMinMax();
 
-    /** \brief Mutator for mUserDefinedRGBMinMaxFlag */
+    /** \brief Mutator for mUserDefinedGrayMinMaxFlag */
     void setUserDefinedGrayMinMax(bool theBool);
 
-    /** \brief Accessor for userDefinedMinMax.  */
+    /** \brief Accessor for mUserDefinedGrayMinMaxFlag.  */
     bool getUserDefinedGrayMinMax();
 
 public slots:    

Modified: trunk/qgis/src/app/qgsrasterlayerproperties.cpp
===================================================================
--- trunk/qgis/src/app/qgsrasterlayerproperties.cpp	2008-06-09 01:35:46 UTC (rev 8628)
+++ trunk/qgis/src/app/qgsrasterlayerproperties.cpp	2008-06-09 01:44:01 UTC (rev 8629)
@@ -56,7 +56,9 @@
   TRSTRING_NOT_SET( tr("Not Set"))
 {
   ignoreSpinBoxEvent = false; //Short circuit signal loop between min max field and stdDev spin box
-
+  mGrayActualMinimumMaximum = false;
+  mRGBActualMinimumMaximum = false;
+  
   if (mRasterLayer->getDataProvider() == 0)
   {
     // This is a GDAL-based layer
@@ -277,16 +279,6 @@
   }
 
   cboxTransparencyBand->addItem(TRSTRING_NOT_SET);
-  cboxTransparencyLayer->addItem(TRSTRING_NOT_SET);
-  QMap<QString, QgsMapLayer *> myLayers = QgsMapLayerRegistry::instance()->mapLayers();
-  QMap<QString, QgsMapLayer *>::iterator it;
-  for(it = myLayers.begin(); it != myLayers.end(); it++)
-  {
-    if(QgsMapLayer::RASTER == it.value()->type())
-    {
-      cboxTransparencyLayer->addItem(it.value()->name());
-    }
-  }
 
   QString myThemePath = QgsApplication::themePath();
   QPixmap myPyramidPixmap(myThemePath + "/mIconPyramid.png");
@@ -438,6 +430,29 @@
   tableTransparency->resizeRowsToContents();
 }
 
+/** Set the message indicating if any min max values are estimates */
+void QgsRasterLayerProperties::setMinimumMaximumEstimateWarning()
+{
+  bool myActualComputedValues = false;
+  if(rbtnThreeBand->isChecked())
+  {
+    myActualComputedValues = mRGBActualMinimumMaximum;
+  }
+  else
+  {
+    myActualComputedValues = mGrayActualMinimumMaximum;
+  }
+  
+  if(myActualComputedValues)
+  {
+    lblMinMaxEstimateWarning->setText("Note: Minimum Maximum values are actual values computed from the band(s)");
+  }
+  else
+  {
+    lblMinMaxEstimateWarning->setText("Note: Minimum Maximum values are estimates or user defined");
+  }
+}
+
 /**
   @note moved from ctor
 
@@ -584,24 +599,24 @@
   {   
     if(mRasterLayer->getColorShadingAlgorithm()==QgsRasterLayer::PSEUDO_COLOR)
     {
-      cboxColorMap->setCurrentText(tr("Pseudocolor"));
+      cboxColorMap->setCurrentIndex(cboxColorMap->findText(tr("Pseudocolor")));
     }
     else if(mRasterLayer->getColorShadingAlgorithm()==QgsRasterLayer::FREAK_OUT)
     {
-      cboxColorMap->setCurrentText(tr("Freak Out"));
+      cboxColorMap->setCurrentIndex(cboxColorMap->findText(tr("Freak Out")));
     }
     else if(mRasterLayer->getColorShadingAlgorithm()==QgsRasterLayer::COLOR_RAMP)
     {
-      cboxColorMap->setCurrentText(tr("Custom Colormap"));
+      cboxColorMap->setCurrentIndex(cboxColorMap->findText(tr("Custom Colormap")));
     }
     else if(mRasterLayer->getColorShadingAlgorithm()==QgsRasterLayer::USER_DEFINED)
     {
-      cboxColorMap->setCurrentText(tr("User Defined"));
+      cboxColorMap->setCurrentIndex(cboxColorMap->findText(tr("User Defined")));
     }
   }
   else
   {
-    cboxColorMap->setCurrentText(tr("Grayscale"));
+    cboxColorMap->setCurrentIndex(cboxColorMap->findText(tr("Grayscale")));
   }
   
   //set whether the layer histogram should be inverted
@@ -615,14 +630,15 @@
   }
 
   //set the combos to the correct values
-  cboRed->setCurrentText(mRasterLayer->getRedBandName());
-  cboGreen->setCurrentText(mRasterLayer->getGreenBandName());
-  cboBlue->setCurrentText(mRasterLayer->getBlueBandName());
-  cboGray->setCurrentText(mRasterLayer->getGrayBandName());
+  cboRed->setCurrentIndex(cboRed->findText(mRasterLayer->getRedBandName()));
+  cboGreen->setCurrentIndex(cboGreen->findText(mRasterLayer->getGreenBandName()));
+  cboBlue->setCurrentIndex(cboBlue->findText(mRasterLayer->getBlueBandName()));
+  cboGray->setCurrentIndex(cboGray->findText(mRasterLayer->getGrayBandName()));
 
   //set the stdDevs and min max values
   if(mRasterLayerIsGdal && rbtnThreeBand->isChecked())
   {
+    mRGBActualMinimumMaximum = mRasterLayer->getActualRGBMinMaxFlag();
     if(mRasterLayer->getUserDefinedRGBMinMax())
     {
       sboxThreeBandStdDev->setValue(0.0);
@@ -656,10 +672,12 @@
         leBlueMin->setText(QString::number(mRasterLayer->getMinimumValue(mRasterLayer->getBlueBandName())));
         leBlueMax->setText(QString::number(mRasterLayer->getMaximumValue(mRasterLayer->getBlueBandName())));
       }
+      setMinimumMaximumEstimateWarning();
     }
   }
   else if(mRasterLayerIsGdal)
   {
+    mGrayActualMinimumMaximum = mRasterLayer->getActualGrayMinMaxFlag();
     if(mRasterLayer->getUserDefinedGrayMinMax())
     {
       sboxSingleBandStdDev->setValue(0.0);
@@ -684,29 +702,29 @@
         leGrayMax->setText(QString::number(mRasterLayer->getMaximumValue(mRasterLayer->getGrayBandName())));
       }
     }
-
+    setMinimumMaximumEstimateWarning();
   }
 
   //set color scaling algorithm
   if(QgsContrastEnhancement::STRETCH_TO_MINMAX == mRasterLayer->getContrastEnhancementAlgorithm())
   {
-    cboxContrastEnhancementAlgorithm->setCurrentText(tr("Stretch To MinMax"));
+    cboxContrastEnhancementAlgorithm->setCurrentIndex(cboxContrastEnhancementAlgorithm->findText(tr("Stretch To MinMax")));
   }
   else if(QgsContrastEnhancement::STRETCH_AND_CLIP_TO_MINMAX == mRasterLayer->getContrastEnhancementAlgorithm())
   {
-    cboxContrastEnhancementAlgorithm->setCurrentText(tr("Stretch And Clip To MinMax"));
+    cboxContrastEnhancementAlgorithm->setCurrentIndex(cboxContrastEnhancementAlgorithm->findText(tr("Stretch And Clip To MinMax")));
   }
   else if(QgsContrastEnhancement::CLIP_TO_MINMAX == mRasterLayer->getContrastEnhancementAlgorithm())
   {
-    cboxContrastEnhancementAlgorithm->setCurrentText(tr("Clip To MinMax"));
+    cboxContrastEnhancementAlgorithm->setCurrentIndex(cboxContrastEnhancementAlgorithm->findText(tr("Clip To MinMax")));
   }
   else if(QgsContrastEnhancement::USER_DEFINED == mRasterLayer->getContrastEnhancementAlgorithm())
   {
-    cboxContrastEnhancementAlgorithm->setCurrentText(tr("User Defined"));
+    cboxContrastEnhancementAlgorithm->setCurrentIndex(cboxContrastEnhancementAlgorithm->findText(tr("User Defined")));
   }
   else
   {
-    cboxContrastEnhancementAlgorithm->setCurrentText(tr("No Scaling"));
+    cboxContrastEnhancementAlgorithm->setCurrentIndex(cboxContrastEnhancementAlgorithm->findText(tr("No Stretch")));
   }
   
   //Display the current default contrast enhancement algorithm
@@ -714,7 +732,7 @@
   QString myDefaultAlgorithm = myQSettings.value("/Raster/defaultContrastEnhancementAlgorithm", "NO_STRETCH").toString();
   if(myDefaultAlgorithm == "NO_STRETCH")
   {
-    labelDefaultContrastEnhancementAlgorithm->setText(tr("No Scaling"));
+    labelDefaultContrastEnhancementAlgorithm->setText(tr("No Stretch"));
   }
   if(myDefaultAlgorithm == "STRETCH_TO_MINMAX")
   {
@@ -730,7 +748,7 @@
   }
   else
   {
-    labelDefaultContrastEnhancementAlgorithm->setText(tr("No Scaling"));
+    labelDefaultContrastEnhancementAlgorithm->setText(tr("No Stretch"));
   }
 
 
@@ -746,18 +764,8 @@
   sliderTransparency->setValue(255 - mRasterLayer->getTransparency());
   //update the transparency percentage label
   sliderTransparency_valueChanged(255 - mRasterLayer->getTransparency());
-   
-  int myIndex = cboxTransparencyLayer->findText(mRasterLayer->getTransparentLayerName());
-  if(-1 != myIndex)
-  {
-    cboxTransparencyLayer->setCurrentIndex(myIndex);
-  }
-  else
-  {
-    cboxTransparencyLayer->setCurrentIndex(cboxTransparencyLayer->findText(TRSTRING_NOT_SET));
-  }
 
-  myIndex = cboxTransparencyBand->findText(mRasterLayer->getTransparentBandName());
+  int myIndex = cboxTransparencyBand->findText(mRasterLayer->getTransparentBandName());
   if(-1 != myIndex)
   {
     cboxTransparencyBand->setCurrentIndex(myIndex);
@@ -1085,7 +1093,6 @@
   mRasterLayer->setBlueBandName(cboBlue->currentText());
   mRasterLayer->setGrayBandName(cboGray->currentText());
   mRasterLayer->setTransparentBandName(cboxTransparencyBand->currentText());
-  mRasterLayer->setTransparentLayerName(cboxTransparencyLayer->currentText());
 
   //set the appropriate color shading type
   //If USER_DEFINED do nothing, user defined can only be set programatically
@@ -1133,6 +1140,7 @@
     //Set min max based on user defined values if all are set and stdDev is 0.0
     if(rbtnThreeBandMinMax->isEnabled() && rbtnThreeBandMinMax->isChecked() && validUserDefinedMinMax())
     {
+      mRasterLayer->setActualRGBMinMaxFlag(mRGBActualMinimumMaximum);
       if(mRasterLayer->getRedBandName() != TRSTRING_NOT_SET)
       {
         mRasterLayer->setMinimumValue(cboRed->currentText(), leRedMin->text().toDouble(), false);
@@ -1167,6 +1175,7 @@
     //Set min max based on user defined values if all are set and stdDev is 0.0
     if(rbtnSingleBandMinMax->isEnabled() && rbtnSingleBandMinMax->isChecked() && validUserDefinedMinMax())
     {
+      mRasterLayer->setActualGrayMinMaxFlag(mGrayActualMinimumMaximum);
       if(mRasterLayer->getGrayBandName() != TRSTRING_NOT_SET)
       {
         mRasterLayer->setMinimumValue(cboGray->currentText(), leGrayMin->text().toDouble(), false);
@@ -1474,7 +1483,6 @@
   //Becuase Min Max values can be set during the redraw if a strech is requested we need to resync after apply
   if(mRasterLayerIsGdal && QgsContrastEnhancement::NO_STRETCH != mRasterLayer->getContrastEnhancementAlgorithm())
   {
-
     //set the stdDevs and min max values
     if(rbtnThreeBand->isChecked())
    {
@@ -1485,6 +1493,7 @@
 
       if(rbtnThreeBandMinMax->isEnabled())
       {
+        mRGBActualMinimumMaximum = mRasterLayer->getActualRGBMinMaxFlag();
         if(mRasterLayer->getRedBandName() != TRSTRING_NOT_SET)
         {
           leRedMin->setText(QString::number(mRasterLayer->getMinimumValue(mRasterLayer->getRedBandName())));
@@ -1500,6 +1509,7 @@
           leBlueMin->setText(QString::number(mRasterLayer->getMinimumValue(mRasterLayer->getBlueBandName())));
           leBlueMax->setText(QString::number(mRasterLayer->getMaximumValue(mRasterLayer->getBlueBandName())));
         }
+        setMinimumMaximumEstimateWarning();
       }
     }
     else
@@ -1511,11 +1521,13 @@
 
       if(rbtnSingleBandMinMax->isEnabled())
       {
+        mGrayActualMinimumMaximum = mRasterLayer->getActualGrayMinMaxFlag();
         if(mRasterLayer->getGrayBandName() != TRSTRING_NOT_SET)
         {
           leGrayMin->setText(QString::number(mRasterLayer->getMinimumValue(mRasterLayer->getGrayBandName())));
           leGrayMax->setText(QString::number(mRasterLayer->getMaximumValue(mRasterLayer->getGrayBandName())));
         }
+        setMinimumMaximumEstimateWarning();
       }
     }
   }
@@ -1741,35 +1753,6 @@
   }
 }
 
-void QgsRasterLayerProperties::on_cboxTransparencyLayer_currentIndexChanged(const QString& theText)
-{
-  if(theText == TRSTRING_NOT_SET)
-  {
-    cboxTransparencyBand->clear();
-    cboxTransparencyBand->addItem(TRSTRING_NOT_SET);
-  }
-  else
-  {
-    QMap<QString, QgsMapLayer *> myLayers = QgsMapLayerRegistry::instance()->mapLayers();
-    QMap<QString, QgsMapLayer *>::iterator it;
-    for(it = myLayers.begin(); it != myLayers.end(); it++)
-    {
-      if(theText == it.value()->name() && QgsMapLayer::RASTER == it.value()->type())
-      {
-        QgsRasterLayer* myRasterLayer = (QgsRasterLayer*)it.value();
-        int myBandCount = myRasterLayer->getBandCount();
-        cboxTransparencyBand->clear();
-        cboxTransparencyBand->addItem(TRSTRING_NOT_SET);
-        for(int bandRunner = 1; bandRunner <= myBandCount; bandRunner++)
-        {
-          cboxTransparencyBand->addItem(myRasterLayer->getRasterBandName(bandRunner));
-        }
-        break;
-      }
-    }
-  }
-}
-
 void QgsRasterLayerProperties::on_pbnDefaultValues_clicked()
 {
 
@@ -2512,7 +2495,7 @@
        mRasterLayer->getRasterLayerType() == QgsRasterLayer::PALETTE)
     {
       pbtnLoadMinMax->setEnabled(false);
-      cboxContrastEnhancementAlgorithm->setCurrentText(tr("No Stretch"));
+      cboxContrastEnhancementAlgorithm->setCurrentIndex(cboxContrastEnhancementAlgorithm->findText(tr("No Stretch")));
       cboxContrastEnhancementAlgorithm->setEnabled(false);
       labelContrastEnhancement->setEnabled(false);
       sboxThreeBandStdDev->setEnabled(false);
@@ -2614,6 +2597,7 @@
       ignoreSpinBoxEvent = true;
       sboxThreeBandStdDev->setValue(0.0);
     }
+    mRGBActualMinimumMaximum = false;
   }
   else
   {
@@ -2622,7 +2606,9 @@
       ignoreSpinBoxEvent = true;
       sboxSingleBandStdDev->setValue(0.0);
     }
+    mGrayActualMinimumMaximum = false;
   }
+  setMinimumMaximumEstimateWarning();
 }
 
 void QgsRasterLayerProperties::on_mClassifyButton_clicked()
@@ -2737,6 +2723,7 @@
         myRasterBandStats = mRasterLayer->getRasterBandStats(mRasterLayer->getRasterBandNumber(cboBlue->currentText()));
         leBlueMin->setText(QString::number(myRasterBandStats.minVal));
         leBlueMax->setText(QString::number(myRasterBandStats.maxVal));
+        mRGBActualMinimumMaximum = true;
       }
       else
       {
@@ -2751,6 +2738,7 @@
         mRasterLayer->computeMinimumMaximumEstimates(mRasterLayer->getRasterBandNumber(cboBlue->currentText()), myMinimumMaximum);
         leBlueMin->setText(QString::number(myMinimumMaximum[0]));
         leBlueMax->setText(QString::number(myMinimumMaximum[1]));
+        mRGBActualMinimumMaximum = false;
       }
 
     }
@@ -2762,6 +2750,7 @@
         myRasterBandStats = mRasterLayer->getRasterBandStats(mRasterLayer->getRasterBandNumber(cboGray->currentText()));
         leGrayMin->setText(QString::number(myRasterBandStats.minVal));
         leGrayMax->setText(QString::number(myRasterBandStats.maxVal));
+        mGrayActualMinimumMaximum = true;
       }
       else
       {
@@ -2770,8 +2759,10 @@
         mRasterLayer->computeMinimumMaximumEstimates(mRasterLayer->getRasterBandNumber(cboGray->currentText()), myMinimumMaximum);
         leGrayMin->setText(QString::number(myMinimumMaximum[0]));
         leGrayMax->setText(QString::number(myMinimumMaximum[1]));
+        mGrayActualMinimumMaximum = false;
       }
     }
+    setMinimumMaximumEstimateWarning();
   }
 }
 

Modified: trunk/qgis/src/app/qgsrasterlayerproperties.h
===================================================================
--- trunk/qgis/src/app/qgsrasterlayerproperties.h	2008-06-09 01:35:46 UTC (rev 8628)
+++ trunk/qgis/src/app/qgsrasterlayerproperties.h	2008-06-09 01:44:01 UTC (rev 8629)
@@ -100,8 +100,6 @@
       void on_cboRed_currentIndexChanged(const QString&); 
       /**The slot handles necessary interface modifications based when color map selected changes*/
       void on_cboxColorMap_currentIndexChanged(const QString&);
-      /**The slot handles necessary interface modifications based when transparency band selection changes*/
-      void on_cboxTransparencyLayer_currentIndexChanged(const QString&);
 	    /**This slot calculates classification values and colors for the tree widget on the colormap tab*/
 	    void on_mClassifyButton_clicked();
 	    /**This slot deletes the current class from the tree widget on the colormap tab*/
@@ -131,7 +129,19 @@
     private:        
         /** \brief  A constant that signals property not used */
         const QString TRSTRING_NOT_SET;
-    
+        
+        /** Id for context help */
+        static const int context_id = 394441851;
+        
+        /** \brief Internal flag used to short circuit signal loop between min max field and stdDev spin box */
+        bool ignoreSpinBoxEvent;
+        
+        /** \brief Flag to indicate if Gray minimum maximum values are actual minimum maximum values */
+        bool mGrayActualMinimumMaximum;
+        
+        /** \brief Flag to indicate if RGB minimum maximum values are actual minimum maximum values */
+        bool mRGBActualMinimumMaximum;
+        
         /** \brief Pointer to the raster layer that this property dilog changes the behaviour of. */
         QgsRasterLayer * mRasterLayer;
 
@@ -149,22 +159,19 @@
          */
         bool mRasterLayerIsWms;
 
-        /** Id for context help */
-        static const int context_id = 394441851;
-
         /** \brief Clear the current transparency table and populate the table with the correct types for current drawing mode and data type*/
         void populateTransparencyTable();
+        
+        /** \brief Set the message indicating if any min max values are estimates */
+        void setMinimumMaximumEstimateWarning();
+        
+        /**Restores the state of the colormap tab*/
+        void syncColormapTab();
 
         /** \brief Verify values in custom min max line edits */
         bool validUserDefinedMinMax();
 
-	/**Restores the state of the colormap tab*/
-	void syncColormapTab();
-
-        //Short circuit signal loop between min max field and stdDev spin box
-        bool ignoreSpinBoxEvent;
-
-        //@TODO we should move these gradient generators somewhere more generic
+	      //@TODO we should move these gradient generators somewhere more generic
         //so they can be used generically throughut the app
         QLinearGradient greenGradient();
         QLinearGradient redGradient();

Modified: trunk/qgis/src/core/raster/qgsrasterlayer.cpp
===================================================================
--- trunk/qgis/src/core/raster/qgsrasterlayer.cpp	2008-06-09 01:35:46 UTC (rev 8628)
+++ trunk/qgis/src/core/raster/qgsrasterlayer.cpp	2008-06-09 01:44:01 UTC (rev 8629)
@@ -321,6 +321,8 @@
 
   mUserDefinedRGBMinMaxFlag = false; //defaults needed to bypass stretch
   mUserDefinedGrayMinMaxFlag = false;
+  mRGBActualMinimumMaximum = false;
+  mGrayActualMinimumMaximum = false;
 
   mRasterShader = new QgsRasterShader();
 
@@ -569,15 +571,7 @@
       mBlueBandName = TRSTRING_NOT_SET;  // sensible default
     }
 
-    //Beacuse the transparent band can be set from a different layer defaulting to the fourth
-    //is not a sensible default P.Ersts 2007-05-14
-    /*
-    if (mGdalDataset->GetRasterCount() > 3)
-      mTransparencyBandName = getRasterBandName(4);
-    else
-    */
     mTransparencyBandName = TRSTRING_NOT_SET;
-
     mGrayBandName = TRSTRING_NOT_SET;  //sensible default
     drawingStyle = MULTI_BAND_COLOR;  //sensible default
   }
@@ -1391,6 +1385,7 @@
 
   if(QgsContrastEnhancement::NO_STRETCH != getContrastEnhancementAlgorithm() && !mUserDefinedGrayMinMaxFlag && mStandardDeviations > 0)
   {
+    mGrayActualMinimumMaximum = true;
     myGrayBandStats = getRasterBandStats(theBandNo);
     setMaximumValue(theBandNo, myGrayBandStats.mean + (mStandardDeviations * myGrayBandStats.stdDev));
     setMinimumValue(theBandNo, myGrayBandStats.mean - (mStandardDeviations * myGrayBandStats.stdDev));
@@ -1401,7 +1396,7 @@
     //from calling generate raster band stats
     double GDALrange[2];
     GDALComputeRasterMinMax( myGdalBand, 1, GDALrange ); //Approximate
-
+    mGrayActualMinimumMaximum = false;
     setMaximumValue(theBandNo, GDALrange[1]);
     setMinimumValue(theBandNo, GDALrange[0]);
 
@@ -2063,7 +2058,7 @@
     myRedBandStats = getRasterBandStats(myRedBandNo);
     myGreenBandStats = getRasterBandStats(myGreenBandNo);
     myBlueBandStats = getRasterBandStats(myBlueBandNo);
-
+    mRGBActualMinimumMaximum = true;
     setMaximumValue(myRedBandNo, myRedBandStats.mean + (mStandardDeviations * myRedBandStats.stdDev));
     setMinimumValue(myRedBandNo, myRedBandStats.mean - (mStandardDeviations * myRedBandStats.stdDev));
     setMaximumValue(myGreenBandNo, myGreenBandStats.mean + (mStandardDeviations * myGreenBandStats.stdDev));
@@ -2076,6 +2071,8 @@
         //This case will be true the first time the image is loaded, so just approimate the min max to keep
     //from calling generate raster band stats
     double GDALrange[2];
+    mRGBActualMinimumMaximum = false;
+    
     GDALComputeRasterMinMax( myGdalRedBand, 1, GDALrange ); //Approximate
     setMaximumValue(myRedBandNo, GDALrange[1]);
     setMinimumValue(myRedBandNo, GDALrange[0]);
@@ -4236,11 +4233,21 @@
   myQVariant = (QVariant) myElement.attribute("boolean");
   setUserDefinedRGBMinMax(myQVariant.toBool());
   
+  snode = mnl.namedItem("mRGBActualMinimumMaximum");
+  myElement = snode.toElement();
+  myQVariant = (QVariant) myElement.attribute("boolean");
+  setActualRGBMinMaxFlag(myQVariant.toBool());
+  
   snode = mnl.namedItem("mUserDefinedGrayMinMaxFlag");
   myElement = snode.toElement();
   myQVariant = (QVariant) myElement.attribute("boolean");
   setUserDefinedGrayMinMax(myQVariant.toBool());
   
+  snode = mnl.namedItem("mGrayActualMinimumMaximum");
+  myElement = snode.toElement();
+  myQVariant = (QVariant) myElement.attribute("boolean");
+  setActualGrayMinMaxFlag(myQVariant.toBool());
+  
   snode = mnl.namedItem("mContrastEnhancementAlgorithm");
   myElement = snode.toElement();
   setContrastEnhancementAlgorithm(myElement.text(), false);
@@ -4594,6 +4601,20 @@
 
   rasterPropertiesElement.appendChild( userDefinedRGBMinMaxFlag );
   
+  // <mRGBActualMinimumMaximum>
+  QDomElement RGBActualMinimumMaximum = document.createElement( "mRGBActualMinimumMaximum" );
+
+  if ( getActualRGBMinMaxFlag() )
+  {
+    RGBActualMinimumMaximum.setAttribute( "boolean", "true" );
+  }
+  else
+  {
+    RGBActualMinimumMaximum.setAttribute( "boolean", "false" );
+  }
+
+  rasterPropertiesElement.appendChild( RGBActualMinimumMaximum );
+  
   // <mUserDefinedGrayMinMaxFlag>
   QDomElement userDefinedGrayMinMaxFlag = document.createElement( "mUserDefinedGrayMinMaxFlag" );
 
@@ -4608,6 +4629,20 @@
 
   rasterPropertiesElement.appendChild( userDefinedGrayMinMaxFlag );
   
+  // <mGrayActualMinimumMaximum>
+  QDomElement GrayActualMinimumMaximum = document.createElement( "mGrayActualMinimumMaximum" );
+
+  if ( getActualGrayMinMaxFlag() )
+  {
+    GrayActualMinimumMaximum.setAttribute( "boolean", "true" );
+  }
+  else
+  {
+    GrayActualMinimumMaximum.setAttribute( "boolean", "false" );
+  }
+
+  rasterPropertiesElement.appendChild( GrayActualMinimumMaximum );
+  
   // <contrastEnhancementAlgorithm>
   QDomElement contrastEnhancementAlgorithmElement = document.createElement( "mContrastEnhancementAlgorithm" );
   QDomText    contrastEnhancementAlgorithmText    = document.createTextNode( getContrastEnhancementAlgorithmAsQString() );

Modified: trunk/qgis/src/core/raster/qgsrasterlayer.h
===================================================================
--- trunk/qgis/src/core/raster/qgsrasterlayer.h	2008-06-09 01:35:46 UTC (rev 8628)
+++ trunk/qgis/src/core/raster/qgsrasterlayer.h	2008-06-09 01:44:01 UTC (rev 8629)
@@ -413,19 +413,6 @@
     }
     /** \brief Mutator for transparent band name mapping.  */
     void setTransparentBandName(const QString & theBandNameQString);
-    //
-    // Accessor and mutator for transparent band name
-    // 
-    /** \brief  Accessor for transparent band name mapping. */
-    QString getTransparentLayerName()
-    {
-        return mTransparentLayerName;
-    }
-    /** \brief Mutator for transparent band name mapping.  */
-    void setTransparentLayerName(const QString & theLayerNameQString)
-    {
-      mTransparentLayerName = theLayerNameQString;
-    }
     
     //
     // Accessor and mutator for gray band name
@@ -793,30 +780,55 @@
      */
     const QgsRasterDataProvider* getDataProvider() const;
 
-     /** \brief Mutator for mUserDefinedRGBMinMaxFlag */
+    /** \brief Mutator for mUserDefinedRGBMinMaxFlag */
     void setUserDefinedRGBMinMax(bool theBool)
     {
       mUserDefinedRGBMinMaxFlag = theBool;
     } 
 
-    /** \brief Accessor for userDefinedMinMax.  */
+    /** \brief Accessor for mUserDefinedRGBMinMaxFlag.  */
     bool getUserDefinedRGBMinMax()
     {
       return mUserDefinedRGBMinMaxFlag;
     }
+    
+    /** \brief Mutator for mRGBActualMinimumMaximum */
+    void setActualRGBMinMaxFlag(bool theBool)
+    {
+      mRGBActualMinimumMaximum = theBool;
+    } 
 
-    /** \brief Mutator for mUserDefinedRGBMinMaxFlag */
+    /** \brief Accessor for mRGBActualMinimumMaximum.  */
+    bool getActualRGBMinMaxFlag()
+    {
+      return mRGBActualMinimumMaximum;
+    }
+    
+
+    /** \brief Mutator for mUserDefinedGrayMinMaxFlag */
     void setUserDefinedGrayMinMax(bool theBool)
     {
       mUserDefinedGrayMinMaxFlag = theBool;
     } 
 
-    /** \brief Accessor for userDefinedMinMax.  */
+    /** \brief Accessor for mUserDefinedGrayMinMaxFlag.  */
     bool getUserDefinedGrayMinMax()
     {
       return mUserDefinedGrayMinMaxFlag;
     }
+    
+    /** \brief Mutator for mGrayActualMinimumMaximum */
+    void setActualGrayMinMaxFlag(bool theBool)
+    {
+      mGrayActualMinimumMaximum = theBool;
+    } 
 
+    /** \brief Accessor for mGrayActualMinimumMaximum.  */
+    bool getActualGrayMinMaxFlag()
+    {
+      return mGrayActualMinimumMaximum;
+    }
+
 public slots:    
     /**
      * Convert this raster to another format
@@ -1043,16 +1055,18 @@
     QgsRasterTransparency mRasterTransparency;
     /** \brief The band to be associated with transparency.  */
     QString mTransparencyBandName;
-    /** \brief The Layer to be associated with transparency.  */
-    QString mTransparentLayerName;
     /** \brief The band to be associated with the grayscale only ouput - usually 1.  */
     QString mGrayBandName;
     /** \brief Whether this raster has overviews / pyramids or not */
     bool hasPyramidsFlag;
     /** \brief Flag to indicate if the user entered custom min max values */
     bool mUserDefinedRGBMinMaxFlag;
+    /** \brief Flag to indicate of the min max values are actual or estimates/user defined */
+    bool mRGBActualMinimumMaximum;
     /** \brief Flag to indicate if the user entered custom min max values */
     bool mUserDefinedGrayMinMaxFlag;
+    /** \brief Flag to indicate of the min max values are actual or estimates/user defined */
+    bool mGrayActualMinimumMaximum;
     /** \brief This list holds a series of RasterPyramid structs
      * which store infomation for each potential pyramid level for this raster.*/
     RasterPyramidList mPyramidList;

Modified: trunk/qgis/src/ui/qgsrasterlayerpropertiesbase.ui
===================================================================
--- trunk/qgis/src/ui/qgsrasterlayerpropertiesbase.ui	2008-06-09 01:35:46 UTC (rev 8628)
+++ trunk/qgis/src/ui/qgsrasterlayerpropertiesbase.ui	2008-06-09 01:44:01 UTC (rev 8629)
@@ -6,7 +6,7 @@
     <x>0</x>
     <y>0</y>
     <width>596</width>
-    <height>629</height>
+    <height>610</height>
    </rect>
   </property>
   <property name="windowTitle" >
@@ -64,7 +64,7 @@
           </sizepolicy>
          </property>
          <property name="currentIndex" >
-          <number>1</number>
+          <number>0</number>
          </property>
          <widget class="QWidget" name="rgb" >
           <layout class="QGridLayout" >
@@ -475,7 +475,7 @@
                 </property>
                </widget>
               </item>
-              <item row="0" column="1" colspan="6" >
+              <item row="0" column="1" colspan="5" >
                <widget class="QComboBox" name="cboGray" >
                 <property name="sizePolicy" >
                  <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
@@ -498,7 +498,7 @@
                 </property>
                </widget>
               </item>
-              <item row="1" column="1" colspan="6" >
+              <item row="1" column="1" colspan="5" >
                <widget class="QComboBox" name="cboxColorMap" >
                 <property name="sizePolicy" >
                  <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
@@ -514,7 +514,7 @@
                 </property>
                </widget>
               </item>
-              <item row="2" column="1" colspan="6" >
+              <item row="2" column="1" colspan="5" >
                <widget class="QCheckBox" name="cboxInvertColorMap" >
                 <property name="sizePolicy" >
                  <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
@@ -534,7 +534,7 @@
                 </property>
                </widget>
               </item>
-              <item row="3" column="3" >
+              <item row="3" column="2" >
                <widget class="QLabel" name="lblGrayMin" >
                 <property name="sizePolicy" >
                  <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
@@ -547,7 +547,7 @@
                 </property>
                </widget>
               </item>
-              <item row="3" column="4" >
+              <item row="3" column="3" >
                <widget class="QLineEdit" name="leGrayMin" >
                 <property name="sizePolicy" >
                  <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
@@ -572,7 +572,7 @@
                 </property>
                </widget>
               </item>
-              <item row="3" column="5" >
+              <item row="3" column="4" >
                <widget class="QLabel" name="lblGrayMax" >
                 <property name="sizePolicy" >
                  <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
@@ -585,7 +585,7 @@
                 </property>
                </widget>
               </item>
-              <item row="3" column="6" >
+              <item row="3" column="5" >
                <widget class="QLineEdit" name="leGrayMax" >
                 <property name="sizePolicy" >
                  <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
@@ -610,14 +610,14 @@
                 </property>
                </widget>
               </item>
-              <item row="4" column="0" colspan="3" >
+              <item row="4" column="0" colspan="2" >
                <widget class="QRadioButton" name="rbtnSingleBandStdDev" >
                 <property name="text" >
                  <string>Use standard deviation</string>
                 </property>
                </widget>
               </item>
-              <item row="4" column="4" >
+              <item row="4" column="3" >
                <widget class="QDoubleSpinBox" name="sboxSingleBandStdDev" >
                 <property name="maximum" >
                  <double>10.000000000000000</double>
@@ -630,19 +630,6 @@
                 </property>
                </widget>
               </item>
-              <item row="5" column="0" colspan="7" >
-               <widget class="QLabel" name="lblMinMaxEstimateWarning" >
-                <property name="sizePolicy" >
-                 <sizepolicy vsizetype="Maximum" hsizetype="Expanding" >
-                  <horstretch>0</horstretch>
-                  <verstretch>0</verstretch>
-                 </sizepolicy>
-                </property>
-                <property name="text" >
-                 <string>Estimate note:</string>
-                </property>
-               </widget>
-              </item>
              </layout>
             </widget>
            </item>
@@ -650,14 +637,34 @@
          </widget>
         </widget>
        </item>
-       <item row="3" column="0" colspan="2" >
+       <item row="2" column="0" colspan="2" >
+        <widget class="QLabel" name="lblMinMaxEstimateWarning" >
+         <property name="text" >
+          <string>Note:</string>
+         </property>
+        </widget>
+       </item>
+       <item row="3" column="0" >
+        <spacer>
+         <property name="orientation" >
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeHint" >
+          <size>
+           <width>20</width>
+           <height>0</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item row="4" column="0" colspan="2" >
         <widget class="Line" name="line" >
          <property name="orientation" >
           <enum>Qt::Horizontal</enum>
          </property>
         </widget>
        </item>
-       <item row="4" column="0" >
+       <item row="5" column="0" >
         <widget class="QGroupBox" name="groupBox_2" >
          <property name="title" >
           <string>Load min / max values from band</string>
@@ -713,7 +720,7 @@
          </layout>
         </widget>
        </item>
-       <item row="4" column="1" >
+       <item row="5" column="1" >
         <widget class="QGroupBox" name="groupBox_8" >
          <property name="title" >
           <string>Contrast enhancement</string>
@@ -790,19 +797,6 @@
          </layout>
         </widget>
        </item>
-       <item row="2" column="0" >
-        <spacer>
-         <property name="orientation" >
-          <enum>Qt::Vertical</enum>
-         </property>
-         <property name="sizeHint" >
-          <size>
-           <width>20</width>
-           <height>0</height>
-          </size>
-         </property>
-        </spacer>
-       </item>
       </layout>
      </widget>
      <widget class="QWidget" name="tabPageTransparency" >
@@ -923,13 +917,6 @@
             </property>
            </widget>
           </item>
-          <item row="0" column="1" >
-           <widget class="QLabel" name="label_3" >
-            <property name="text" >
-             <string>Transparency layer;</string>
-            </property>
-           </widget>
-          </item>
           <item row="0" column="2" colspan="2" >
            <spacer>
             <property name="orientation" >
@@ -962,13 +949,6 @@
             </property>
            </widget>
           </item>
-          <item row="1" column="1" >
-           <widget class="QComboBox" name="cboxTransparencyLayer" >
-            <property name="enabled" >
-             <bool>false</bool>
-            </property>
-           </widget>
-          </item>
           <item row="1" column="2" colspan="2" >
            <spacer>
             <property name="orientation" >
@@ -1732,8 +1712,8 @@
          <property name="html" >
           <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
 p, li { white-space: pre-wrap; }
-&lt;/style>&lt;/head>&lt;body style=" font-family:'Lucida Grande'; font-size:13pt; font-weight:400; font-style:normal;">
-&lt;p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;">&lt;/p>&lt;/body>&lt;/html></string>
+&lt;/style>&lt;/head>&lt;body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
+&lt;p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;/p>&lt;/body>&lt;/html></string>
          </property>
         </widget>
        </item>



More information about the QGIS-commit mailing list