For WMS layers, clean-up the raster Properties dialog so that it better reflects the relatively implemented capabilities of the WMS provider. The Pyramids and Histogram tabs have been disabled (not necessarily removed since a future QGIS version may wish to extend this raster functionality into WMS layers).

The symbology tab still needs to be cleaned-up in operation but at least it's set to "Color Image" by default now.



git-svn-id: http://svn.osgeo.org/qgis/trunk@5678 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
morb_au 2006-08-09 21:43:52 +00:00
parent 12fff4ceb3
commit e132f37edd
4 changed files with 71 additions and 22 deletions

View File

@ -35,6 +35,20 @@ QgsRasterLayerProperties::QgsRasterLayerProperties(QgsMapLayer *lyr, QWidget *pa
: QDialog(parent, fl),
rasterLayer( dynamic_cast<QgsRasterLayer*>(lyr) )
{
if (rasterLayer->getDataProvider() == 0)
{
// This is a GDAL-based layer
rasterLayerIsGdal = TRUE;
rasterLayerIsWms = FALSE;
}
else if (rasterLayer->getDataProvider()->name() == "wms")
{
// This is a WMS-based layer
rasterLayerIsWms = TRUE;
rasterLayerIsGdal = FALSE;
}
setupUi(this);
connect(buttonApply, SIGNAL(clicked()), this, SLOT(apply()));
connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept()));
@ -201,7 +215,7 @@ QgsRasterLayerProperties::QgsRasterLayerProperties(QgsMapLayer *lyr, QWidget *pa
QPixmap myNoPyramidPixmap(myThemePath + "/mIconNoPyramid.png");
// Only do pyramids if dealing directly with GDAL.
if (!(rasterLayer->usesProvider()))
if (rasterLayerIsGdal)
{
QgsRasterLayer::RasterPyramidList myPyramidList = rasterLayer->buildRasterPyramidList();
QgsRasterLayer::RasterPyramidList::iterator myRasterPyramidIterator;
@ -224,6 +238,14 @@ QgsRasterLayerProperties::QgsRasterLayerProperties(QgsMapLayer *lyr, QWidget *pa
}
}
}
else if (rasterLayerIsWms)
{
// disable Pyramids tab completely
tabBar->setTabEnabled(tabBar->indexOf(tabPagePyramids), FALSE);
// disable Histogram tab completely
tabBar->setTabEnabled(tabBar->indexOf(tabPageHistogram), FALSE);
}
if ( rasterLayer->coordinateTransform() )
{
@ -233,7 +255,7 @@ QgsRasterLayerProperties::QgsRasterLayerProperties(QgsMapLayer *lyr, QWidget *pa
//on_pbnHistRefresh_clicked();
// update based on lyr's current state
sync();
sync();
} // QgsRasterLayerProperties ctor
@ -510,10 +532,21 @@ void QgsRasterLayerProperties::sync()
//populate the metadata tab's text browser widget with gdal metadata info
txtbMetadata->setText(rasterLayer->getMetadata());
//tabSymbology->removePage(tabMetadata);
//display the raster dimensions and no data value
lblColumns->setText(tr("Columns:") + QString::number(rasterLayer->getRasterXDim()));
lblRows->setText(tr("Rows:") + QString::number(rasterLayer->getRasterYDim()));
lblNoData->setText(tr("No Data:") + QString::number(rasterLayer->getNoDataValue()));
if (rasterLayerIsGdal)
{
lblColumns->setText(tr("Columns: ") + QString::number(rasterLayer->getRasterXDim()));
lblRows->setText(tr("Rows: ") + QString::number(rasterLayer->getRasterYDim()));
lblNoData->setText(tr("No-Data Value: ") + QString::number(rasterLayer->getNoDataValue()));
}
else if (rasterLayerIsWms)
{
// TODO: Account for fixedWidth and fixedHeight WMS layers
lblColumns->setText(tr("Columns: ") + tr("n/a"));
lblRows->setText(tr("Rows: ") + tr("n/a"));
lblNoData->setText(tr("No-Data Value: ") + tr("n/a"));
}
//these properties (layername and label) are provided by the qgsmaplayer superclass
leLayerSource->setText(rasterLayer->source());

View File

@ -64,6 +64,20 @@ class QgsRasterLayerProperties : public QDialog, private Ui::QgsRasterLayerPrope
private:
/** \brief Pointer to the raster layer that this property dilog changes the behaviour of. */
QgsRasterLayer * rasterLayer;
/** \brief If the underlying raster layer is of GDAL type (i.e. non-provider)
This variable is used to determine if various parts of the Properties UI are
included or not
*/
bool rasterLayerIsGdal;
/** \brief If the underlying raster layer is of WMS type (i.e. WMS data provider)
This variable is used to determine if various parts of the Properties UI are
included or not
*/
bool rasterLayerIsWms;
};
#endif

View File

@ -5049,6 +5049,8 @@ void QgsRasterLayer::setDataProvider( QString const & provider,
QgsDebugMsg("QgsRasterLayer::setDataProvider: layerName: " + name());
// set up the raster drawing style
drawingStyle = MULTI_BAND_COLOR; //sensible default
//
// Get the layers project info and set up the QgsCoordinateTransform for this layer

View File

@ -29,8 +29,8 @@
<number>6</number>
</property>
<item row="0" column="0" >
<widget class="QTabWidget" name="tabSymbology" >
<widget class="QWidget" name="tab" >
<widget class="QTabWidget" name="tabBar" >
<widget class="QWidget" name="tabPageSymbology" >
<attribute name="title" >
<string>Symbology</string>
</attribute>
@ -361,7 +361,7 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab" >
<widget class="QWidget" name="tabPageGeneral" >
<attribute name="title" >
<string>General</string>
</attribute>
@ -710,7 +710,7 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tabMetadata" >
<widget class="QWidget" name="tabPageMetadata" >
<attribute name="title" >
<string>Metadata</string>
</attribute>
@ -726,7 +726,7 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="TabPage" >
<widget class="QWidget" name="tabPagePyramids" >
<attribute name="title" >
<string>Pyramids</string>
</attribute>
@ -853,7 +853,7 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="TabPage" >
<widget class="QWidget" name="tabPageHistogram" >
<attribute name="title" >
<string>Histogram</string>
</attribute>
@ -1095,10 +1095,10 @@
<pixmapfunction></pixmapfunction>
<customwidgets>
<customwidget>
<class>Q3GroupBox</class>
<class>Q3TextEdit</class>
<extends></extends>
<header>Qt3Support/Q3GroupBox</header>
<container>1</container>
<header>q3textedit.h</header>
<container>0</container>
<pixmap></pixmap>
</customwidget>
<customwidget>
@ -1108,13 +1108,6 @@
<container>1</container>
<pixmap></pixmap>
</customwidget>
<customwidget>
<class>Q3TextEdit</class>
<extends></extends>
<header>q3textedit.h</header>
<container>0</container>
<pixmap></pixmap>
</customwidget>
<customwidget>
<class>Q3ListBox</class>
<extends></extends>
@ -1122,9 +1115,16 @@
<container>0</container>
<pixmap></pixmap>
</customwidget>
<customwidget>
<class>Q3GroupBox</class>
<extends></extends>
<header>Qt3Support/Q3GroupBox</header>
<container>1</container>
<pixmap></pixmap>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>tabSymbology</tabstop>
<tabstop>tabBar</tabstop>
<tabstop>rbtnThreeBand</tabstop>
<tabstop>rbtnSingleBand</tabstop>
<tabstop>cboxInvertColorMap</tabstop>