Skip to content
Permalink
Browse files
Patch that provides incremental screen update
git-svn-id: http://svn.osgeo.org/qgis/trunk@7846 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Jan 5, 2008
1 parent 9b3cdb2 commit 28c5599c7e786250aace034774d3c61af240c185
@@ -182,8 +182,6 @@ class QgsMapCanvas : QGraphicsView
/**Sets dirty=true and calls render()*/
void refresh();

virtual void render();

//! Save the convtents of the map canvas to disk as an image
void saveAsImage(QString theFileName,QPixmap * QPixmap=0, QString="PNG" );

@@ -124,6 +124,11 @@ void QgsLegend::removeAll()

void QgsLegend::selectAll(bool select)
{
if(!mMapCanvas || mMapCanvas->isDrawing())
{
return;
}

QTreeWidgetItem* theItem = firstItem();

while (theItem)
@@ -140,6 +145,11 @@ void QgsLegend::selectAll(bool select)

void QgsLegend::removeLayer(QString layer_key)
{
if(!mMapCanvas || mMapCanvas->isDrawing())
{
return;
}

QTreeWidgetItem* theItem = firstItem();
#ifdef QGISDEBUG
qWarning("in QgsLegend::removeLayer");
@@ -371,20 +381,24 @@ void QgsLegend::mouseReleaseEvent(QMouseEvent * e)

void QgsLegend::mouseDoubleClickEvent(QMouseEvent* e)
{
if(!mMapCanvas || mMapCanvas->isDrawing())
{
return;
}
legendLayerShowProperties();
}

void QgsLegend::handleRightClickEvent(QTreeWidgetItem* item, const QPoint& position)
{
if(!mMapCanvas || mMapCanvas->isDrawing())
{
return;
}

QMenu theMenu;

QString iconsPath = QgsApplication::themePath();

if(mMapCanvas->isDrawing())
{
return;
}

QgsLegendItem* li = dynamic_cast<QgsLegendItem*>(item);
if (li)
{
@@ -446,6 +460,11 @@ int QgsLegend::getItemPos(QTreeWidgetItem* item)

void QgsLegend::addLayer( QgsMapLayer * layer )
{
if(!mMapCanvas || mMapCanvas->isDrawing())
{
return;
}

QgsLegendLayer * llayer = new QgsLegendLayer(layer->name());//generate entry for mStateOfCheckBoxes below
QgsLegendLayerFileGroup * llfgroup = new QgsLegendLayerFileGroup(llayer,QString("Files"));
QgsLegendLayerFile * llfile = new QgsLegendLayerFile(llfgroup, QgsLegendLayerFile::nameFromLayer(layer), layer);
@@ -535,6 +554,11 @@ QgsMapLayer* QgsLegend::currentLayer()

void QgsLegend::legendGroupRemove()
{
if(!mMapCanvas || mMapCanvas->isDrawing())
{
return;
}

QgsLegendGroup* lg = dynamic_cast<QgsLegendGroup*>(currentItem());
if(lg)
{
@@ -553,6 +577,11 @@ void QgsLegend::legendGroupRemove()

void QgsLegend::legendLayerRemove()
{
if(!mMapCanvas || mMapCanvas->isDrawing())
{
return;
}

//if the current item is a legend layer: remove all layers of the current legendLayer
QgsLegendLayer* ll = dynamic_cast<QgsLegendLayer*>(currentItem());
if(ll)
@@ -572,14 +601,12 @@ void QgsLegend::legendLayerRemove()
//remove the layer
if(*it)
{
//the map layer registry emits a signal an this will remove the legend layer
//from the legend and from memory by calling QgsLegend::removeLayer(QString layer key)
QgsMapLayerRegistry::instance()->removeMapLayer((*it)->getLayerID());
}
}

if(maplayers.size()>0)
{
mMapCanvas->refresh();
}
removeItem(ll);
delete ll;
adjustIconSize();
@@ -604,6 +631,11 @@ void QgsLegend::legendLayerRemove()

void QgsLegend::legendLayerShowProperties()
{
if(!mMapCanvas || mMapCanvas->isDrawing())
{
return;
}

QgsLegendItem* li = dynamic_cast<QgsLegendItem*>(currentItem());
QgsLegendLayerFile* llf = 0;

@@ -679,6 +711,11 @@ void QgsLegend::legendLayerShowProperties()

void QgsLegend::legendLayerShowInOverview()
{
if(!mMapCanvas || mMapCanvas->isDrawing())
{
return;
}

QgsLegendItem* li = dynamic_cast<QgsLegendItem*>(currentItem());
if(!li)
return;
@@ -1585,6 +1622,7 @@ void QgsLegend::handleItemChange(QTreeWidgetItem* item, int row)
//set all the child layer files to the new check state
subfiles = ll->legendLayerFiles();
bool renderFlagState = mMapCanvas->renderFlag();
mMapCanvas->freeze(true);
mMapCanvas->setRenderFlag(false);
for(std::list<QgsLegendLayerFile*>::iterator iter = subfiles.begin(); iter != subfiles.end(); ++iter)
{
@@ -1605,7 +1643,10 @@ void QgsLegend::handleItemChange(QTreeWidgetItem* item, int row)
// If it was on, turn it back on, otherwise leave it
// off, as turning it on causes a refresh.
if (renderFlagState)
mMapCanvas->setRenderFlag(true);
{
mMapCanvas->setRenderFlag(true);
}
mMapCanvas->freeze(false);
//update check state of the legend group
mStateOfCheckBoxes[item] = item->checkState(0);
}
@@ -1752,6 +1793,10 @@ void QgsLegend::legendLayerZoomNative()

void QgsLegend::legendLayerAttributeTable()
{
if(!mMapCanvas || mMapCanvas->isDrawing())
{
return;
}

// try whether it's a legend layer
QgsLegendLayer* ll = dynamic_cast<QgsLegendLayer*>(currentItem());
@@ -249,6 +249,7 @@ void QgsLegendLayerFile::table()
// but be can get it using this ugly hack. [jef]
// TODO: do this cleanly
QgisApp *app = NULL;

QList<QWidget *> list = QApplication::topLevelWidgets();

int i;
Loading

0 comments on commit 28c5599

Please sign in to comment.