Skip to content

Commit

Permalink
Anti aliasing is now enable/disable able at run time :-)
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@4664 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Jan 12, 2006
1 parent 9c6133e commit a676689
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/gui/qgisapp.cpp
Expand Up @@ -270,6 +270,8 @@ static void setTitleBarText_( QWidget & qgisApp )
mQgisInterface = new QgisIface(this);
// set the legend control for the map canvas
mMapCanvas->setLegend(mMapLegend);
QSettings mySettings;
mMapCanvas->enableAntiAliasing(mySettings.value("/qgis/enable_anti_aliasing").toBool());


//
Expand Down Expand Up @@ -4558,6 +4560,8 @@ void QgisApp::options()
setupToolbarPopups(optionsDialog->theme());
// set the visible flag for new layers
mAddedLayersHidden = optionsDialog->newVisible();
QSettings mySettings;
mMapCanvas->enableAntiAliasing(mySettings.value("/qgis/enable_anti_aliasing").toBool());
}
}

Expand Down
14 changes: 12 additions & 2 deletions src/gui/qgsmapcanvas.cpp
Expand Up @@ -143,6 +143,10 @@ QgsMapCanvas::~QgsMapCanvas()
// CanvasProperties struct has its own dtor for freeing resources
} // dtor

void QgsMapCanvas::enableAntiAliasing(bool theFlag)
{
mCanvasProperties->mAntiAliasFlag= theFlag;
} // anti aliasing


void QgsMapCanvas::setLegend(QgsLegend * legend)
Expand Down Expand Up @@ -555,7 +559,10 @@ void QgsMapCanvas::render(QPaintDevice * theQPaintDevice)
{
mCanvasProperties->pmCanvas->fill(mCanvasProperties->bgColor);
paint->begin(mCanvasProperties->pmCanvas);
paint->setRenderHint(QPainter::Antialiasing);
if (mCanvasProperties->mAntiAliasFlag)
{
paint->setRenderHint(QPainter::Antialiasing);
}
myHeight=height();
myWidth=width();
}
Expand All @@ -576,7 +583,10 @@ void QgsMapCanvas::render(QPaintDevice * theQPaintDevice)
}
//initialise the painter
paint->begin(theQPaintDevice);
paint->setRenderHint(QPainter::Antialiasing);
if (mCanvasProperties->mAntiAliasFlag)
{
paint->setRenderHint(QPainter::Antialiasing);
}
}
// hardwire the current extent for projection testing
// mCanvasProperties->currentExtent.setXmin(-156.00);
Expand Down
3 changes: 2 additions & 1 deletion src/gui/qgsmapcanvas.h
Expand Up @@ -185,7 +185,8 @@ class QgsMapCanvas : public QWidget
//! true if canvas currently drawing
bool isDrawing();


//used to determine if anti-aliasing is enabled or not
void enableAntiAliasing(bool theFlag);
public slots:

/*! Adds a layer to the map canvas.
Expand Down
4 changes: 3 additions & 1 deletion src/gui/qgsmapcanvasproperties.h
Expand Up @@ -251,7 +251,9 @@ class QgsMapCanvas::CanvasProperties

//! Map scale of the canvas at its current zool level
double mScale;


//! Whether to anti-alias map line drawing
bool mAntiAliasFlag;
private:

/** not copyable
Expand Down

0 comments on commit a676689

Please sign in to comment.