Skip to content
Permalink
Browse files
-updated enums and respective functions to have undefined be initial …
…value

-replaced some QT3 calls with QT4 calls in raster layer properties
-updated python bindings 

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@8026 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
ersts committed Jan 22, 2008
1 parent b751ccd commit bac4fc88a3b7dd5b8939ca5d55fdf38db5b66843
Showing with 69 additions and 66 deletions.
  1. +2 −0 python/core/qgsrasterlayer.sip
  2. +49 −48 src/app/qgsrasterlayerproperties.cpp
  3. +16 −18 src/core/raster/qgsrasterlayer.cpp
  4. +2 −0 src/core/raster/qgsrasterlayer.h
@@ -286,6 +286,7 @@ public:
/** \brief This enumerator describes the types of shading that can be used. */
enum COLOR_SHADING_ALGORITHM
{
UNDEFINED_SHADING_ALGORITHM,
PSEUDO_COLOR,
FREAK_OUT, //it will scare your granny!
COLOR_RAMP,
@@ -315,6 +316,7 @@ public:
/** \brief This enumerator describes the different kinds of drawing we can do. */
enum DRAWING_STYLE
{
UNDEFINED_DRAWING_STYLE,
SINGLE_BAND_GRAY, // a "Gray" or "Undefined" layer drawn as a range of gray colors
SINGLE_BAND_PSEUDO_COLOR,// a "Gray" or "Undefined" layer drawn using a pseudocolor algorithm
PALETTED_COLOR, //a "Palette" image drawn using color table
@@ -95,16 +95,16 @@ mRasterLayer( dynamic_cast<QgsRasterLayer*>(lyr) )
spinMaximumScale->setValue((int)lyr->maxScale());

// build GUI components
cboxColorMap->insertItem(tr("Grayscale"));
cboxColorMap->insertItem(tr("Pseudocolor"));
cboxColorMap->insertItem(tr("Freak Out"));
cboxColorMap->insertItem(tr("Custom Colormap"));
cboxColorMap->addItem(tr("Grayscale"));
cboxColorMap->addItem(tr("Pseudocolor"));
cboxColorMap->addItem(tr("Freak Out"));
cboxColorMap->addItem(tr("Custom Colormap"));

//add items to the color stretch combo box
cboxContrastEnhancementAlgorithm->insertItem(tr("No Stretch"));
cboxContrastEnhancementAlgorithm->insertItem(tr("Stretch To MinMax"));
cboxContrastEnhancementAlgorithm->insertItem(tr("Stretch And Clip To MinMax"));
cboxContrastEnhancementAlgorithm->insertItem(tr("Clip To MinMax"));
cboxContrastEnhancementAlgorithm->addItem(tr("No Stretch"));
cboxContrastEnhancementAlgorithm->addItem(tr("Stretch To MinMax"));
cboxContrastEnhancementAlgorithm->addItem(tr("Stretch And Clip To MinMax"));
cboxContrastEnhancementAlgorithm->addItem(tr("Clip To MinMax"));

//set initial states of all Min Max and StdDev fields and labels to disabled
sboxThreeBandStdDev->setEnabled(false);
@@ -129,10 +129,10 @@ mRasterLayer( dynamic_cast<QgsRasterLayer*>(lyr) )
pbtnLoadMinMax->setEnabled(false);

//setup custom colormap tab
cboxColorInterpolation->insertItem(-1, tr("Discrete"));
cboxColorInterpolation->insertItem(-1, tr("Linearly"));
cboxClassificationMode->insertItem(-1, tr("Equal interval"));
cboxClassificationMode->insertItem(-1, tr("Quantiles"));
cboxColorInterpolation->addItem(tr("Discrete"));
cboxColorInterpolation->addItem(tr("Linearly"));
cboxClassificationMode->addItem(tr("Equal interval"));
cboxClassificationMode->addItem(tr("Quantiles"));

QStringList headerLabels;
headerLabels << "Value";
@@ -150,26 +150,26 @@ mRasterLayer( dynamic_cast<QgsRasterLayer*>(lyr) )
if (mRasterLayer->getRasterLayerType()
== QgsRasterLayer::PALETTE) //paletted layers have hard coded color entries
{
cboRed->insertItem("Red");
cboGreen->insertItem("Red");
cboBlue->insertItem("Red");
cboRed->addItem("Red");
cboGreen->addItem("Red");
cboBlue->addItem("Red");

cboRed->insertItem("Green");
cboGreen->insertItem("Green");
cboBlue->insertItem("Green");
cboRed->addItem("Green");
cboGreen->addItem("Green");
cboBlue->addItem("Green");

cboRed->insertItem("Blue");
cboGreen->insertItem("Blue");
cboBlue->insertItem("Blue");
cboRed->addItem("Blue");
cboGreen->addItem("Blue");
cboBlue->addItem("Blue");

cboRed->insertItem(tr(QgsRasterLayer::QSTRING_NOT_SET));
cboGreen->insertItem(tr(QgsRasterLayer::QSTRING_NOT_SET));
cboBlue->insertItem(tr(QgsRasterLayer::QSTRING_NOT_SET));
cboRed->addItem(tr(QgsRasterLayer::QSTRING_NOT_SET));
cboGreen->addItem(tr(QgsRasterLayer::QSTRING_NOT_SET));
cboBlue->addItem(tr(QgsRasterLayer::QSTRING_NOT_SET));

cboGray->insertItem("Red");
cboGray->insertItem("Green");
cboGray->insertItem("Blue");
cboGray->insertItem(tr(QgsRasterLayer::QSTRING_NOT_SET));
cboGray->addItem("Red");
cboGray->addItem("Green");
cboGray->addItem("Blue");
cboGray->addItem(tr(QgsRasterLayer::QSTRING_NOT_SET));

lstHistogramLabels->insertItem(tr("Palette"));
}
@@ -263,41 +263,41 @@ mRasterLayer( dynamic_cast<QgsRasterLayer*>(lyr) )
std::cout << "Inserting : " << myQString.toLocal8Bit().data() << std::endl;
#endif

cboGray->insertItem(myQString);
cboRed->insertItem(myQString);
cboGreen->insertItem(myQString);
cboBlue->insertItem(myQString);
cboGray->addItem(myQString);
cboRed->addItem(myQString);
cboGreen->addItem(myQString);
cboBlue->addItem(myQString);
}
//TODO: Need to handle situations where a band is set to Not Set, currently if you set a band to this it will segfault.
cboRed->insertItem(tr(QgsRasterLayer::QSTRING_NOT_SET));
cboGreen->insertItem(tr(QgsRasterLayer::QSTRING_NOT_SET));
cboBlue->insertItem(tr(QgsRasterLayer::QSTRING_NOT_SET));
cboRed->addItem(tr(QgsRasterLayer::QSTRING_NOT_SET));
cboGreen->addItem(tr(QgsRasterLayer::QSTRING_NOT_SET));
cboBlue->addItem(tr(QgsRasterLayer::QSTRING_NOT_SET));
if (cboGray->count() != 1)
cboGray->insertItem(tr(QgsRasterLayer::QSTRING_NOT_SET));
cboGray->addItem(tr(QgsRasterLayer::QSTRING_NOT_SET));
}

cboxTransparencyBand->insertItem(tr(QgsRasterLayer::QSTRING_NOT_SET));
cboxTransparencyLayer->insertItem(tr(QgsRasterLayer::QSTRING_NOT_SET));
cboxTransparencyBand->addItem(tr(QgsRasterLayer::QSTRING_NOT_SET));
cboxTransparencyLayer->addItem(tr(QgsRasterLayer::QSTRING_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->insertItem(it.value()->name());
cboxTransparencyLayer->addItem(it.value()->name());
}
}

QString myThemePath = QgsApplication::themePath();
QPixmap myPyramidPixmap(myThemePath + "/mIconPyramid.png");
QPixmap myNoPyramidPixmap(myThemePath + "/mIconNoPyramid.png");

pbnAddValuesManually->setIconSet(QIcon(QPixmap(myThemePath + "/mActionNewAttribute.png")));
pbnAddValuesFromDisplay->setIconSet(QIcon(QPixmap(myThemePath + "/mActionContextHelp.png")));
pbnRemoveSelectedRow->setIconSet(QIcon(QPixmap(myThemePath + "/mActionDeleteAttribute.png")));
pbnDefaultValues->setIconSet(QIcon(QPixmap(myThemePath + "/mActionCopySelected.png")));
pbnImportTransparentPixelValues->setIconSet(QIcon(QPixmap(myThemePath + "/mActionFileOpen.png")));
pbnExportTransparentPixelValues->setIconSet(QIcon(QPixmap(myThemePath + "/mActionFileSave.png")));
pbnAddValuesManually->setIcon(QIcon(QPixmap(myThemePath + "/mActionNewAttribute.png")));
pbnAddValuesFromDisplay->setIcon(QIcon(QPixmap(myThemePath + "/mActionContextHelp.png")));
pbnRemoveSelectedRow->setIcon(QIcon(QPixmap(myThemePath + "/mActionDeleteAttribute.png")));
pbnDefaultValues->setIcon(QIcon(QPixmap(myThemePath + "/mActionCopySelected.png")));
pbnImportTransparentPixelValues->setIcon(QIcon(QPixmap(myThemePath + "/mActionFileOpen.png")));
pbnExportTransparentPixelValues->setIcon(QIcon(QPixmap(myThemePath + "/mActionFileSave.png")));

// Only do pyramids if dealing directly with GDAL.
if (mRasterLayerIsGdal)
@@ -542,6 +542,7 @@ void QgsRasterLayerProperties::sync()
if(mRasterLayerIsWms)
{
tabBar->setCurrentIndex(tabBar->indexOf(tabPageMetadata));
tabBar->removeTab(tabBar->indexOf(tabPageColormap));
tabBar->removeTab(tabBar->indexOf(tabPageSymbology));
tabBar->removeTab(tabBar->indexOf(tabPageTransparency));
tabBar->removeTab(tabBar->indexOf(tabPageHistogram));
@@ -1717,7 +1718,7 @@ void QgsRasterLayerProperties::on_cboxTransparencyLayer_currentIndexChanged(cons
if(theText == tr(QgsRasterLayer::QSTRING_NOT_SET))
{
cboxTransparencyBand->clear();
cboxTransparencyBand->insertItem(tr(QgsRasterLayer::QSTRING_NOT_SET));
cboxTransparencyBand->addItem(tr(QgsRasterLayer::QSTRING_NOT_SET));
}
else
{
@@ -1730,10 +1731,10 @@ void QgsRasterLayerProperties::on_cboxTransparencyLayer_currentIndexChanged(cons
QgsRasterLayer* myRasterLayer = (QgsRasterLayer*)it.value();
int myBandCount = myRasterLayer->getBandCount();
cboxTransparencyBand->clear();
cboxTransparencyBand->insertItem(tr(QgsRasterLayer::QSTRING_NOT_SET));
cboxTransparencyBand->addItem(tr(QgsRasterLayer::QSTRING_NOT_SET));
for(int bandRunner = 1; bandRunner <= myBandCount; bandRunner++)
{
cboxTransparencyBand->insertItem(myRasterLayer->getRasterBandName(bandRunner));
cboxTransparencyBand->addItem(myRasterLayer->getRasterBandName(bandRunner));
}
break;
}
@@ -816,7 +816,7 @@ QString QgsRasterLayer::getDrawingStyleAsQString()
break;
}

return QString("INVALID_DRAWING_STYLE"); // XXX I hope this is ok to return
return QString("UNDEFINED_DRAWING_STYLE");

}

@@ -825,42 +825,38 @@ void QgsRasterLayer::setDrawingStyle(QString const & theDrawingStyleQString)
if (theDrawingStyleQString == "SINGLE_BAND_GRAY")//no need to tr() this its not shown in ui
{
drawingStyle = SINGLE_BAND_GRAY;
return;
}
if (theDrawingStyleQString == "SINGLE_BAND_PSEUDO_COLOR")//no need to tr() this its not shown in ui
else if (theDrawingStyleQString == "SINGLE_BAND_PSEUDO_COLOR")//no need to tr() this its not shown in ui
{
drawingStyle = SINGLE_BAND_PSEUDO_COLOR;
return;
}
if (theDrawingStyleQString == "PALETTED_SINGLE_BAND_GRAY")//no need to tr() this its not shown in ui
else if (theDrawingStyleQString == "PALETTED_SINGLE_BAND_GRAY")//no need to tr() this its not shown in ui
{
drawingStyle = PALETTED_SINGLE_BAND_GRAY;
return;
}
if (theDrawingStyleQString == "PALETTED_SINGLE_BAND_PSEUDO_COLOR")//no need to tr() this its not shown in ui
else if (theDrawingStyleQString == "PALETTED_SINGLE_BAND_PSEUDO_COLOR")//no need to tr() this its not shown in ui
{
drawingStyle = PALETTED_SINGLE_BAND_PSEUDO_COLOR;
return;
}
if (theDrawingStyleQString == "PALETTED_MULTI_BAND_COLOR")//no need to tr() this its not shown in ui
else if (theDrawingStyleQString == "PALETTED_MULTI_BAND_COLOR")//no need to tr() this its not shown in ui
{
drawingStyle = PALETTED_MULTI_BAND_COLOR;
return;
}
if (theDrawingStyleQString == "MULTI_BAND_SINGLE_BAND_GRAY")//no need to tr() this its not shown in ui
else if (theDrawingStyleQString == "MULTI_BAND_SINGLE_BAND_GRAY")//no need to tr() this its not shown in ui
{
drawingStyle = MULTI_BAND_SINGLE_BAND_GRAY;
return;
}
if (theDrawingStyleQString == "MULTI_BAND_SINGLE_BAND_PSEUDO_COLOR")//no need to tr() this its not shown in ui
else if (theDrawingStyleQString == "MULTI_BAND_SINGLE_BAND_PSEUDO_COLOR")//no need to tr() this its not shown in ui
{
drawingStyle = MULTI_BAND_SINGLE_BAND_PSEUDO_COLOR;
return;
}
if (theDrawingStyleQString == "MULTI_BAND_COLOR")//no need to tr() this its not shown in ui
else if (theDrawingStyleQString == "MULTI_BAND_COLOR")//no need to tr() this its not shown in ui
{
drawingStyle = MULTI_BAND_COLOR;
return;
}
else
{
drawingStyle = UNDEFINED_DRAWING_STYLE;
}
}

@@ -5309,7 +5305,7 @@ QString QgsRasterLayer::getColorShadingAlgorithmAsQString()
break;
}

return QString("UNKNOWN");
return QString("UNDEFINED_SHADING_ALGORITHM");
}

void QgsRasterLayer::setColorShadingAlgorithm(QString theShaderAlgorithm)
@@ -5326,6 +5322,8 @@ void QgsRasterLayer::setColorShadingAlgorithm(QString theShaderAlgorithm)
setColorShadingAlgorithm(COLOR_RAMP);
else if(theShaderAlgorithm == "USER_DEFINED")
setColorShadingAlgorithm(USER_DEFINED);
else
setColorShadingAlgorithm(UNDEFINED_SHADING_ALGORITHM);
}

QString QgsRasterLayer::getContrastEnhancementAlgorithmAsQString()
@@ -5349,7 +5347,7 @@ QString QgsRasterLayer::getContrastEnhancementAlgorithmAsQString()
break;
}

return QString("UNKNOWN");
return QString("NO_STRETCH");
}

void QgsRasterLayer::setContrastEnhancementAlgorithm(QString theAlgorithm, bool theGenerateLookupTableFlag)
@@ -580,6 +580,7 @@ class CORE_EXPORT QgsRasterLayer : public QgsMapLayer
/** \brief This enumerator describes the types of shading that can be used. */
enum COLOR_SHADING_ALGORITHM
{
UNDEFINED_SHADING_ALGORITHM,
PSEUDO_COLOR,
FREAK_OUT, //it will scare your granny!
COLOR_RAMP,
@@ -629,6 +630,7 @@ class CORE_EXPORT QgsRasterLayer : public QgsMapLayer
/** \brief This enumerator describes the different kinds of drawing we can do. */
enum DRAWING_STYLE
{
UNDEFINED_DRAWING_STYLE,
SINGLE_BAND_GRAY, // a "Gray" or "Undefined" layer drawn as a range of gray colors
SINGLE_BAND_PSEUDO_COLOR,// a "Gray" or "Undefined" layer drawn using a pseudocolor algorithm
PALETTED_COLOR, //a "Palette" image drawn using color table

0 comments on commit bac4fc8

Please sign in to comment.