49
49
const char * const ident =
50
50
" $Id$" ;
51
51
52
+ // Constant that signals property not used.
53
+ const QString QgsRasterLayerProperties::QSTRING_NOT_SET = " Not Set" ;
52
54
53
55
QgsRasterLayerProperties::QgsRasterLayerProperties (QgsMapLayer *lyr, QWidget *parent, Qt::WFlags fl)
54
56
: QDialog(parent, fl),
@@ -146,30 +148,30 @@ mRasterLayer( dynamic_cast<QgsRasterLayer*>(lyr) )
146
148
//
147
149
// Set up the combo boxes that contain band lists using the qstring list generated above
148
150
//
149
-
151
+
150
152
if (mRasterLayer ->getRasterLayerType ()
151
153
== QgsRasterLayer::PALETTE) // paletted layers have hard coded color entries
152
154
{
153
- cboRed->addItem (" Red" );
154
- cboGreen->addItem (" Red" );
155
- cboBlue->addItem (" Red" );
155
+ cboRed->addItem (tr ( " Red" ) );
156
+ cboGreen->addItem (tr ( " Red" ) );
157
+ cboBlue->addItem (tr ( " Red" ) );
156
158
157
- cboRed->addItem (" Green" );
158
- cboGreen->addItem (" Green" );
159
- cboBlue->addItem (" Green" );
159
+ cboRed->addItem (tr ( " Green" ) );
160
+ cboGreen->addItem (tr ( " Green" ) );
161
+ cboBlue->addItem (tr ( " Green" ) );
160
162
161
- cboRed->addItem (" Blue" );
162
- cboGreen->addItem (" Blue" );
163
- cboBlue->addItem (" Blue" );
163
+ cboRed->addItem (tr ( " Blue" ) );
164
+ cboGreen->addItem (tr ( " Blue" ) );
165
+ cboBlue->addItem (tr ( " Blue" ) );
164
166
165
- cboRed->addItem (tr (QgsRasterLayer:: QSTRING_NOT_SET));
166
- cboGreen->addItem (tr (QgsRasterLayer:: QSTRING_NOT_SET));
167
- cboBlue->addItem (tr (QgsRasterLayer:: QSTRING_NOT_SET));
167
+ cboRed->addItem (tr (QSTRING_NOT_SET));
168
+ cboGreen->addItem (tr (QSTRING_NOT_SET));
169
+ cboBlue->addItem (tr (QSTRING_NOT_SET));
168
170
169
- cboGray->addItem (" Red" );
170
- cboGray->addItem (" Green" );
171
- cboGray->addItem (" Blue" );
172
- cboGray->addItem (tr (QgsRasterLayer:: QSTRING_NOT_SET));
171
+ cboGray->addItem (tr ( " Red" ) );
172
+ cboGray->addItem (tr ( " Green" ) );
173
+ cboGray->addItem (tr ( " Blue" ) );
174
+ cboGray->addItem (tr (QSTRING_NOT_SET));
173
175
174
176
lstHistogramLabels->insertItem (tr (" Palette" ));
175
177
}
@@ -268,16 +270,15 @@ mRasterLayer( dynamic_cast<QgsRasterLayer*>(lyr) )
268
270
cboGreen->addItem (myQString);
269
271
cboBlue->addItem (myQString);
270
272
}
271
- // TODO: Need to handle situations where a band is set to Not Set, currently if you set a band to this it will segfault.
272
- cboRed->addItem (tr (QgsRasterLayer::QSTRING_NOT_SET));
273
- cboGreen->addItem (tr (QgsRasterLayer::QSTRING_NOT_SET));
274
- cboBlue->addItem (tr (QgsRasterLayer::QSTRING_NOT_SET));
275
- if (cboGray->count () != 1 )
276
- cboGray->addItem (tr (QgsRasterLayer::QSTRING_NOT_SET));
273
+
274
+ cboRed->addItem (tr (QSTRING_NOT_SET));
275
+ cboGreen->addItem (tr (QSTRING_NOT_SET));
276
+ cboBlue->addItem (tr (QSTRING_NOT_SET));
277
+ cboGray->addItem (tr (QSTRING_NOT_SET));
277
278
}
278
279
279
- cboxTransparencyBand->addItem (tr (QgsRasterLayer:: QSTRING_NOT_SET));
280
- cboxTransparencyLayer->addItem (tr (QgsRasterLayer:: QSTRING_NOT_SET));
280
+ cboxTransparencyBand->addItem (tr (QSTRING_NOT_SET));
281
+ cboxTransparencyLayer->addItem (tr (QSTRING_NOT_SET));
281
282
QMap<QString, QgsMapLayer *> myLayers = QgsMapLayerRegistry::instance ()->mapLayers ();
282
283
QMap<QString, QgsMapLayer *>::iterator it;
283
284
for (it = myLayers.begin (); it != myLayers.end (); it++)
@@ -641,17 +642,17 @@ void QgsRasterLayerProperties::sync()
641
642
QgsRasterLayer::PALETTED_SINGLE_BAND_PSEUDO_COLOR != mRasterLayer ->getDrawingStyle () &&
642
643
QgsRasterLayer::PALETTED_MULTI_BAND_COLOR != mRasterLayer ->getDrawingStyle ())
643
644
{
644
- if (mRasterLayer ->getRedBandName () != tr (QgsRasterLayer:: QSTRING_NOT_SET))
645
+ if (mRasterLayer ->getRedBandName () != tr (QSTRING_NOT_SET))
645
646
{
646
647
leRedMin->setText (QString::number (mRasterLayer ->getMinimumValue (mRasterLayer ->getRedBandName ())));
647
648
leRedMax->setText (QString::number (mRasterLayer ->getMaximumValue (mRasterLayer ->getRedBandName ())));
648
649
}
649
- if (mRasterLayer ->getGreenBandName () != tr (QgsRasterLayer:: QSTRING_NOT_SET))
650
+ if (mRasterLayer ->getGreenBandName () != tr (QSTRING_NOT_SET))
650
651
{
651
652
leGreenMin->setText (QString::number (mRasterLayer ->getMinimumValue (mRasterLayer ->getGreenBandName ())));
652
653
leGreenMax->setText (QString::number (mRasterLayer ->getMaximumValue (mRasterLayer ->getGreenBandName ())));
653
654
}
654
- if (mRasterLayer ->getBlueBandName () != tr (QgsRasterLayer:: QSTRING_NOT_SET))
655
+ if (mRasterLayer ->getBlueBandName () != tr (QSTRING_NOT_SET))
655
656
{
656
657
leBlueMin->setText (QString::number (mRasterLayer ->getMinimumValue (mRasterLayer ->getBlueBandName ())));
657
658
leBlueMax->setText (QString::number (mRasterLayer ->getMaximumValue (mRasterLayer ->getBlueBandName ())));
@@ -678,7 +679,7 @@ void QgsRasterLayerProperties::sync()
678
679
QgsRasterLayer::PALETTED_SINGLE_BAND_PSEUDO_COLOR != mRasterLayer ->getDrawingStyle () &&
679
680
QgsRasterLayer::PALETTED_MULTI_BAND_COLOR != mRasterLayer ->getDrawingStyle ())
680
681
{
681
- if (mRasterLayer ->getGrayBandName () != tr (QgsRasterLayer:: QSTRING_NOT_SET))
682
+ if (mRasterLayer ->getGrayBandName () != tr (QSTRING_NOT_SET))
682
683
{
683
684
leGrayMin->setText (QString::number (mRasterLayer ->getMinimumValue (mRasterLayer ->getGrayBandName ())));
684
685
leGrayMax->setText (QString::number (mRasterLayer ->getMaximumValue (mRasterLayer ->getGrayBandName ())));
@@ -754,7 +755,7 @@ void QgsRasterLayerProperties::sync()
754
755
}
755
756
else
756
757
{
757
- cboxTransparencyLayer->setCurrentIndex (cboxTransparencyLayer->findText (tr (QgsRasterLayer:: QSTRING_NOT_SET)));
758
+ cboxTransparencyLayer->setCurrentIndex (cboxTransparencyLayer->findText (tr (QSTRING_NOT_SET)));
758
759
}
759
760
760
761
myIndex = cboxTransparencyBand->findText (mRasterLayer ->getTransparentBandName ());
@@ -764,7 +765,7 @@ void QgsRasterLayerProperties::sync()
764
765
}
765
766
else
766
767
{
767
- cboxTransparencyBand->setCurrentIndex (cboxTransparencyBand->findText (tr (QgsRasterLayer:: QSTRING_NOT_SET)));
768
+ cboxTransparencyBand->setCurrentIndex (cboxTransparencyBand->findText (tr (QSTRING_NOT_SET)));
768
769
}
769
770
// add current NoDataValue to NoDataValue line edit
770
771
if (mRasterLayer ->isNoDataValueValid ())
@@ -1133,17 +1134,17 @@ void QgsRasterLayerProperties::apply()
1133
1134
// Set min max based on user defined values if all are set and stdDev is 0.0
1134
1135
if (rbtnThreeBandMinMax->isEnabled () && rbtnThreeBandMinMax->isChecked () && validUserDefinedMinMax ())
1135
1136
{
1136
- if (mRasterLayer ->getRedBandName () != tr (QgsRasterLayer:: QSTRING_NOT_SET))
1137
+ if (mRasterLayer ->getRedBandName () != tr (QSTRING_NOT_SET))
1137
1138
{
1138
1139
mRasterLayer ->setMinimumValue (cboRed->currentText (), leRedMin->text ().toDouble (), false );
1139
1140
mRasterLayer ->setMaximumValue (cboRed->currentText (), leRedMax->text ().toDouble ());
1140
1141
}
1141
- if (mRasterLayer ->getGreenBandName () != tr (QgsRasterLayer:: QSTRING_NOT_SET))
1142
+ if (mRasterLayer ->getGreenBandName () != tr (QSTRING_NOT_SET))
1142
1143
{
1143
1144
mRasterLayer ->setMinimumValue (cboGreen->currentText (), leGreenMin->text ().toDouble (), false );
1144
1145
mRasterLayer ->setMaximumValue (cboGreen->currentText (), leGreenMax->text ().toDouble ());
1145
1146
}
1146
- if (mRasterLayer ->getBlueBandName () != tr (QgsRasterLayer:: QSTRING_NOT_SET))
1147
+ if (mRasterLayer ->getBlueBandName () != tr (QSTRING_NOT_SET))
1147
1148
{
1148
1149
mRasterLayer ->setMinimumValue (cboBlue->currentText (), leBlueMin->text ().toDouble (), false );
1149
1150
mRasterLayer ->setMaximumValue (cboBlue->currentText (), leBlueMax->text ().toDouble ());
@@ -1167,7 +1168,7 @@ void QgsRasterLayerProperties::apply()
1167
1168
// Set min max based on user defined values if all are set and stdDev is 0.0
1168
1169
if (rbtnSingleBandMinMax->isEnabled () && rbtnSingleBandMinMax->isChecked () && validUserDefinedMinMax ())
1169
1170
{
1170
- if (mRasterLayer ->getGrayBandName () != tr (QgsRasterLayer:: QSTRING_NOT_SET))
1171
+ if (mRasterLayer ->getGrayBandName () != tr (QSTRING_NOT_SET))
1171
1172
{
1172
1173
mRasterLayer ->setMinimumValue (cboGray->currentText (), leGrayMin->text ().toDouble (), false );
1173
1174
mRasterLayer ->setMaximumValue (cboGray->currentText (), leGrayMax->text ().toDouble ());
@@ -1485,17 +1486,17 @@ void QgsRasterLayerProperties::apply()
1485
1486
1486
1487
if (rbtnThreeBandMinMax->isEnabled ())
1487
1488
{
1488
- if (mRasterLayer ->getRedBandName () != tr (QgsRasterLayer:: QSTRING_NOT_SET))
1489
+ if (mRasterLayer ->getRedBandName () != tr (QSTRING_NOT_SET))
1489
1490
{
1490
1491
leRedMin->setText (QString::number (mRasterLayer ->getMinimumValue (mRasterLayer ->getRedBandName ())));
1491
1492
leRedMax->setText (QString::number (mRasterLayer ->getMaximumValue (mRasterLayer ->getRedBandName ())));
1492
1493
}
1493
- if (mRasterLayer ->getGreenBandName () != tr (QgsRasterLayer:: QSTRING_NOT_SET))
1494
+ if (mRasterLayer ->getGreenBandName () != tr (QSTRING_NOT_SET))
1494
1495
{
1495
1496
leGreenMin->setText (QString::number (mRasterLayer ->getMinimumValue (mRasterLayer ->getGreenBandName ())));
1496
1497
leGreenMax->setText (QString::number (mRasterLayer ->getMaximumValue (mRasterLayer ->getGreenBandName ())));
1497
1498
}
1498
- if (mRasterLayer ->getBlueBandName () != tr (QgsRasterLayer:: QSTRING_NOT_SET))
1499
+ if (mRasterLayer ->getBlueBandName () != tr (QSTRING_NOT_SET))
1499
1500
{
1500
1501
leBlueMin->setText (QString::number (mRasterLayer ->getMinimumValue (mRasterLayer ->getBlueBandName ())));
1501
1502
leBlueMax->setText (QString::number (mRasterLayer ->getMaximumValue (mRasterLayer ->getBlueBandName ())));
@@ -1511,7 +1512,7 @@ void QgsRasterLayerProperties::apply()
1511
1512
1512
1513
if (rbtnSingleBandMinMax->isEnabled ())
1513
1514
{
1514
- if (mRasterLayer ->getGrayBandName () != tr (QgsRasterLayer:: QSTRING_NOT_SET))
1515
+ if (mRasterLayer ->getGrayBandName () != tr (QSTRING_NOT_SET))
1515
1516
{
1516
1517
leGrayMin->setText (QString::number (mRasterLayer ->getMinimumValue (mRasterLayer ->getGrayBandName ())));
1517
1518
leGrayMax->setText (QString::number (mRasterLayer ->getMaximumValue (mRasterLayer ->getGrayBandName ())));
@@ -1623,7 +1624,7 @@ void QgsRasterLayerProperties::on_buttonBuildPyramids_clicked()
1623
1624
1624
1625
void QgsRasterLayerProperties::on_cboBlue_currentIndexChanged (const QString& theText)
1625
1626
{
1626
- if (mRasterLayerIsGdal && tr (QgsRasterLayer:: QSTRING_NOT_SET) != theText)
1627
+ if (mRasterLayerIsGdal && tr (QSTRING_NOT_SET) != theText)
1627
1628
{
1628
1629
leBlueMin->setText (QString::number (mRasterLayer ->getMinimumValue (theText)));
1629
1630
leBlueMax->setText (QString::number (mRasterLayer ->getMaximumValue (theText)));
@@ -1632,7 +1633,7 @@ void QgsRasterLayerProperties::on_cboBlue_currentIndexChanged(const QString& the
1632
1633
1633
1634
void QgsRasterLayerProperties::on_cboGray_currentIndexChanged (const QString& theText)
1634
1635
{
1635
- if (mRasterLayerIsGdal && tr (QgsRasterLayer:: QSTRING_NOT_SET) != theText)
1636
+ if (mRasterLayerIsGdal && tr (QSTRING_NOT_SET) != theText)
1636
1637
{
1637
1638
leGrayMin->setText (QString::number (mRasterLayer ->getMinimumValue (theText)));
1638
1639
leGrayMax->setText (QString::number (mRasterLayer ->getMaximumValue (theText)));
@@ -1641,7 +1642,7 @@ void QgsRasterLayerProperties::on_cboGray_currentIndexChanged(const QString& the
1641
1642
1642
1643
void QgsRasterLayerProperties::on_cboGreen_currentIndexChanged (const QString& theText)
1643
1644
{
1644
- if (mRasterLayerIsGdal && tr (QgsRasterLayer:: QSTRING_NOT_SET) != theText)
1645
+ if (mRasterLayerIsGdal && tr (QSTRING_NOT_SET) != theText)
1645
1646
{
1646
1647
leGreenMin->setText (QString::number (mRasterLayer ->getMinimumValue (theText)));
1647
1648
leGreenMax->setText (QString::number (mRasterLayer ->getMaximumValue (theText)));
@@ -1650,7 +1651,7 @@ void QgsRasterLayerProperties::on_cboGreen_currentIndexChanged(const QString& th
1650
1651
1651
1652
void QgsRasterLayerProperties::on_cboRed_currentIndexChanged (const QString& theText)
1652
1653
{
1653
- if (mRasterLayerIsGdal && tr (QgsRasterLayer:: QSTRING_NOT_SET) != theText)
1654
+ if (mRasterLayerIsGdal && tr (QSTRING_NOT_SET) != theText)
1654
1655
{
1655
1656
leRedMin->setText (QString::number (mRasterLayer ->getMinimumValue (theText)));
1656
1657
leRedMax->setText (QString::number (mRasterLayer ->getMaximumValue (theText)));
@@ -1743,10 +1744,10 @@ void QgsRasterLayerProperties::on_cboxColorMap_currentIndexChanged(const QString
1743
1744
1744
1745
void QgsRasterLayerProperties::on_cboxTransparencyLayer_currentIndexChanged (const QString& theText)
1745
1746
{
1746
- if (theText == tr (QgsRasterLayer:: QSTRING_NOT_SET))
1747
+ if (theText == tr (QSTRING_NOT_SET))
1747
1748
{
1748
1749
cboxTransparencyBand->clear ();
1749
- cboxTransparencyBand->addItem (tr (QgsRasterLayer:: QSTRING_NOT_SET));
1750
+ cboxTransparencyBand->addItem (tr (QSTRING_NOT_SET));
1750
1751
}
1751
1752
else
1752
1753
{
@@ -1759,7 +1760,7 @@ void QgsRasterLayerProperties::on_cboxTransparencyLayer_currentIndexChanged(cons
1759
1760
QgsRasterLayer* myRasterLayer = (QgsRasterLayer*)it.value ();
1760
1761
int myBandCount = myRasterLayer->getBandCount ();
1761
1762
cboxTransparencyBand->clear ();
1762
- cboxTransparencyBand->addItem (tr (QgsRasterLayer:: QSTRING_NOT_SET));
1763
+ cboxTransparencyBand->addItem (tr (QSTRING_NOT_SET));
1763
1764
for (int bandRunner = 1 ; bandRunner <= myBandCount; bandRunner++)
1764
1765
{
1765
1766
cboxTransparencyBand->addItem (myRasterLayer->getRasterBandName (bandRunner));
@@ -2459,7 +2460,7 @@ void QgsRasterLayerProperties::on_rbtnSingleBand_toggled(bool theState)
2459
2460
// Populate transparency table with single value transparency pixels
2460
2461
populateTransparencyTable ();
2461
2462
// If no band is selected but there are multiple bands, selcet the first as the default
2462
- if (cboGray->currentText () == tr (QgsRasterLayer:: QSTRING_NOT_SET) && 1 < cboGray->count ())
2463
+ if (cboGray->currentText () == tr (QSTRING_NOT_SET) && 1 < cboGray->count ())
2463
2464
{
2464
2465
cboGray->setCurrentIndex (0 );
2465
2466
}
0 commit comments