mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
Less enthusistic progress updates from raster stats (only updates when raste stats are being collected, not when they are simply being returned from stats cache).
Rendering layers in app now increments progress bar as each layer is drawn. git-svn-id: http://svn.osgeo.org/qgis/trunk@1651 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
d08c6f46e6
commit
cd224828a2
@ -323,6 +323,7 @@ QgisApp::QgisApp(QWidget * parent, const char *name, WFlags fl):QgisAppBase(pare
|
||||
connect(mMapCanvas, SIGNAL(xyCoordinates(QgsPoint &)), this, SLOT(showMouseCoordinate(QgsPoint &)));
|
||||
//signal when mouse in capturePoint mode and mouse clicked on canvas
|
||||
connect(mMapCanvas, SIGNAL(xyClickCoordinates(QgsPoint &)), this, SLOT(showCapturePointCoordinate(QgsPoint &)));
|
||||
connect(mMapCanvas, SIGNAL(setProgress(int,int)), this, SLOT(showProgress(int,int)));
|
||||
connect(mMapCanvas, SIGNAL(extentsChanged(QgsRect )),this,SLOT(showExtents(QgsRect )));
|
||||
connect(mMapCanvas, SIGNAL(scaleChanged(QString)), this, SLOT(showScale(QString)));
|
||||
connect(mMapCanvas, SIGNAL(addedLayer(QgsMapLayer *)), mMapLegend, SLOT(addLayer(QgsMapLayer *)));
|
||||
@ -1163,10 +1164,10 @@ void QgisApp::fileNew(bool thePromptToSaveFlag)
|
||||
else
|
||||
{
|
||||
mMapCanvas->removeAll();
|
||||
mMapCanvas->clear();
|
||||
mOverviewCanvas->removeAll();
|
||||
mOverviewCanvas->clear();
|
||||
setCaption(tr("Quantum GIS -- Untitled"));
|
||||
mMapCanvas->clear();
|
||||
// mMapLegend->update(); NOW UPDATED VIA SIGNAL/SLOT
|
||||
mFullPathName = "";
|
||||
mProjectIsDirtyFlag = false;
|
||||
@ -1178,21 +1179,20 @@ void QgisApp::fileOpen()
|
||||
int answer = saveDirty();
|
||||
|
||||
if (answer != QMessageBox::Cancel)
|
||||
{
|
||||
QgsProjectIo *pio = new QgsProjectIo( QgsProjectIo::OPEN, this);
|
||||
mOverviewCanvas->freeze(true);
|
||||
mMapCanvas->freeze(true);
|
||||
if (pio->read())
|
||||
{
|
||||
mMapCanvas->freeze(true);
|
||||
QgsProjectIo *pio = new QgsProjectIo( QgsProjectIo::OPEN, this);
|
||||
|
||||
if (pio->read())
|
||||
{
|
||||
setCaption(tr("Quantum GIS --") + " " + pio->baseName());
|
||||
mFullPathName = pio->fullPathName();
|
||||
}
|
||||
delete pio;
|
||||
|
||||
// mMapLegend->update(); UPDATED VIA SIGNAL/SLOTS
|
||||
mMapCanvas->freeze(false);
|
||||
mProjectIsDirtyFlag = false;
|
||||
setCaption(tr("Quantum GIS --") + " " + pio->baseName());
|
||||
mFullPathName = pio->fullPathName();
|
||||
}
|
||||
delete pio;
|
||||
mOverviewCanvas->freeze(false);
|
||||
mMapCanvas->freeze(false);
|
||||
mProjectIsDirtyFlag = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1348,6 +1348,7 @@ void QgisApp::saveMapAsImage(QString theImageFileNameQString, QPixmap * theQPixm
|
||||
|
||||
void QgisApp::addAllToOverview()
|
||||
{
|
||||
mOverviewCanvas->freeze(true);
|
||||
std::map<QString, QgsMapLayer *> myMapLayers = mMapLayerRegistry->mapLayers();
|
||||
std::map<QString, QgsMapLayer *>::iterator myMapIterator;
|
||||
for ( myMapIterator = myMapLayers.begin(); myMapIterator != myMapLayers.end(); ++myMapIterator )
|
||||
@ -1360,6 +1361,7 @@ void QgisApp::addAllToOverview()
|
||||
}
|
||||
// draw the map
|
||||
mOverviewCanvas->clear();
|
||||
mOverviewCanvas->freeze(false);
|
||||
mOverviewCanvas->render();
|
||||
}
|
||||
|
||||
@ -2735,6 +2737,14 @@ void QgisApp::setOverviewZOrder(QgsLegend * lv)
|
||||
mOverviewCanvas->refresh();
|
||||
|
||||
}
|
||||
|
||||
//set the zorder of both overview and mapcanvas
|
||||
void QgisApp::setZOrder (std::list<QString>)
|
||||
{
|
||||
//do me!
|
||||
|
||||
}
|
||||
|
||||
//copy the click coord to clipboard and let the user know its there
|
||||
void QgisApp::showCapturePointCoordinate(QgsPoint & theQgsPoint)
|
||||
{
|
||||
@ -2885,6 +2895,7 @@ bool QgisApp::addRasterLayer(QFileInfo const & rasterFile)
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
|
||||
mMapCanvas->freeze(true);
|
||||
mOverviewCanvas->freeze(true);
|
||||
|
||||
// XXX ya know QgsRasterLayer can snip out the basename on its own;
|
||||
// XXX why do we have to pass it in for it?
|
||||
@ -2903,6 +2914,7 @@ bool QgisApp::addRasterLayer(QFileInfo const & rasterFile)
|
||||
{
|
||||
statusBar()->message(mMapCanvas->extent().stringRep(2));
|
||||
mMapCanvas->freeze(false);
|
||||
mOverviewCanvas->freeze(false);
|
||||
QApplication::restoreOverrideCursor();
|
||||
return true;
|
||||
}
|
||||
@ -2919,9 +2931,11 @@ bool QgisApp::addRasterLayer(QStringList const &theFileNameQStringList)
|
||||
// allow mMapCanvas to handle events
|
||||
// first
|
||||
mMapCanvas->freeze(false);
|
||||
mMapCanvas->freeze(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
mMapCanvas->freeze(true);
|
||||
mMapCanvas->freeze(true);
|
||||
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
@ -2967,6 +2981,7 @@ bool QgisApp::addRasterLayer(QStringList const &theFileNameQStringList)
|
||||
|
||||
statusBar()->message(mMapCanvas->extent().stringRep(2));
|
||||
mMapCanvas->freeze(false);
|
||||
mOverviewCanvas->freeze(false);
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
||||
return returnValue;
|
||||
|
@ -66,6 +66,11 @@ Q_OBJECT public:
|
||||
public:
|
||||
QgisIface *getInterface();
|
||||
|
||||
/** \brief Set the Z order of both mapcanvas and overview canvas. Typically this will
|
||||
* be called by projectio when loading a stored project.
|
||||
*/
|
||||
void setZOrder (std::list<QString>);
|
||||
|
||||
void addVectorLayer(QString vectorLayerPath, QString baseName, QString providerKey);
|
||||
/** \brief overloaded vesion of the privat addLayer method that takes a list of
|
||||
* filenames instead of prompting user with a dialog.
|
||||
|
@ -478,12 +478,13 @@ void QgsMapCanvas::render(QPaintDevice * theQPaintDevice)
|
||||
mCanvasProperties->currentExtent.setXmax(dxmax);
|
||||
mCanvasProperties->currentExtent.setYmin(dymin);
|
||||
mCanvasProperties->currentExtent.setYmax(dymax);
|
||||
|
||||
int myRenderCounter=1;
|
||||
// render all layers in the stack, starting at the base
|
||||
std::list < QString >::iterator li = mCanvasProperties->zOrder.begin();
|
||||
// std::cout << "MAP LAYER COUNT: " << layers.size() << std::endl;
|
||||
while (li != mCanvasProperties->zOrder.end())
|
||||
{
|
||||
emit setProgress(myRenderCounter++,mCanvasProperties->zOrder.size());
|
||||
QgsMapLayer *ml = mCanvasProperties->layers[*li];
|
||||
|
||||
if (ml)
|
||||
|
@ -186,7 +186,8 @@ public slots:
|
||||
void setZOrderFromLegend(QgsLegend *lv);
|
||||
|
||||
signals:
|
||||
|
||||
/** Let the owner know how far we are with render operations */
|
||||
void setProgress(int,int);
|
||||
/** emits current mouse position */
|
||||
void xyCoordinates(QgsPoint & p);
|
||||
/** emits mouse position when the canvas is clicked */
|
||||
|
@ -1853,11 +1853,9 @@ const bool QgsRasterLayer::hasStats(int theBandNoInt)
|
||||
Note that this is a cpu intensive /slow task!*/
|
||||
const RasterBandStats QgsRasterLayer::getRasterBandStats(int theBandNoInt)
|
||||
{
|
||||
emit setStatus(QString("Calculating stats for ")+layerName);
|
||||
//reset the main app progress bar
|
||||
emit setProgress(0,0);
|
||||
emit setStatus(QString("Retrieving stats for ")+layerName);
|
||||
#ifdef QGISDEBUG
|
||||
std::cout << "QgsRasterLayer::calculate stats for band " << theBandNoInt << std::endl;
|
||||
std::cout << "QgsRasterLayer::retrieve stats for band " << theBandNoInt << std::endl;
|
||||
#endif
|
||||
//check if we have received a valid band number
|
||||
if ((gdalDataset->GetRasterCount() < theBandNoInt) && rasterLayerType != PALETTE)
|
||||
@ -1921,6 +1919,9 @@ const RasterBandStats QgsRasterLayer::getRasterBandStats(int theBandNoInt)
|
||||
}
|
||||
myRasterBandStats.elementCountInt = rasterXDimInt * rasterYDimInt;
|
||||
|
||||
emit setStatus(QString("Calculating stats for ")+layerName);
|
||||
//reset the main app progress bar
|
||||
emit setProgress(0,0);
|
||||
|
||||
// let the user know we're going to possibly be taking a while
|
||||
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||
|
Loading…
x
Reference in New Issue
Block a user