[QGIS Commit] r13841 - branches/threading-branch/src/core
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Tue Jun 29 06:17:13 EDT 2010
Author: wonder
Date: 2010-06-29 10:17:13 +0000 (Tue, 29 Jun 2010)
New Revision: 13841
Modified:
branches/threading-branch/src/core/qgsmaprenderer.cpp
branches/threading-branch/src/core/qgsmaprenderer.h
Log:
Remove QgsScaleCalculator from the definition of QgsMapRenderer
Modified: branches/threading-branch/src/core/qgsmaprenderer.cpp
===================================================================
--- branches/threading-branch/src/core/qgsmaprenderer.cpp 2010-06-29 09:45:10 UTC (rev 13840)
+++ branches/threading-branch/src/core/qgsmaprenderer.cpp 2010-06-29 10:17:13 UTC (rev 13841)
@@ -48,7 +48,6 @@
QgsMapRenderer::QgsMapRenderer()
{
- mScaleCalculator = new QgsScaleCalculator;
mDistArea = new QgsDistanceArea;
mDrawing = false;
@@ -56,6 +55,8 @@
mThreadingEnabled = false;
mCache = NULL;
+ mDpi = 96;
+
// set default map units - we use WGS 84 thus use degrees
setMapUnits( QGis::Degrees );
@@ -81,7 +82,6 @@
cancelThreadedRendering();
}
- delete mScaleCalculator;
delete mDistArea;
delete mDestCRS;
delete mLabelingEngine;
@@ -96,7 +96,8 @@
void QgsMapRenderer::updateScale()
{
- mScale = mScaleCalculator->calculate( mExtent, mSize.width() );
+ QgsScaleCalculator calc(mDpi, mMapUnits);
+ mScale = calc.calculate( mExtent, mSize.width() );
}
bool QgsMapRenderer::setExtent( const QgsRectangle& extent )
@@ -153,12 +154,12 @@
}
mSize = size;
- mScaleCalculator->setDpi( dpi );
+ mDpi = dpi;
adjustExtentToSize();
}
int QgsMapRenderer::outputDpi()
{
- return mScaleCalculator->dpi();
+ return mDpi;
}
QSize QgsMapRenderer::outputSize()
{
@@ -251,7 +252,7 @@
//calculate scale factor
//use the specified dpi and not those from the paint device
//because sometimes QPainter units are in a local coord sys (e.g. in case of QGraphicsScene)
- double sceneDpi = mScaleCalculator->dpi();
+ double sceneDpi = mDpi;
double scaleFactor = 1.0;
if ( mOutputUnits == QgsMapRenderer::Millimeters )
{
@@ -289,7 +290,7 @@
//find overlay positions and draw the vector overlays
if ( mOverlayManager )
{
- mOverlayManager->drawOverlays( mRenderContext, mScaleCalculator->mapUnits() );
+ mOverlayManager->drawOverlays( mRenderContext, mMapUnits );
delete mOverlayManager;
mOverlayManager = NULL;
}
@@ -782,7 +783,7 @@
return; // do not allow changes while rendering
}
- mScaleCalculator->setMapUnits( u );
+ mMapUnits = u;
// Since the map units have changed, force a recalculation of the scale.
updateScale();
@@ -792,7 +793,7 @@
QGis::UnitType QgsMapRenderer::mapUnits() const
{
- return mScaleCalculator->mapUnits();
+ return mMapUnits;
}
void QgsMapRenderer::onDrawingProgress( int current, int total )
Modified: branches/threading-branch/src/core/qgsmaprenderer.h
===================================================================
--- branches/threading-branch/src/core/qgsmaprenderer.h 2010-06-29 09:45:10 UTC (rev 13840)
+++ branches/threading-branch/src/core/qgsmaprenderer.h 2010-06-29 10:17:13 UTC (rev 13841)
@@ -35,7 +35,6 @@
class QgsMapToPixel;
class QgsMapLayer;
class QgsMapRenderer;
-class QgsScaleCalculator;
class QgsCoordinateReferenceSystem;
class QgsDistanceArea;
class QgsOverlayObjectPositionManager;
@@ -362,9 +361,12 @@
//! Map scale at its current zool level
double mScale;
- //! scale calculator
- QgsScaleCalculator * mScaleCalculator;
+ //! Scene DPI
+ double mDpi;
+ //! map unit type
+ QGis::UnitType mMapUnits;
+
//! current extent to be drawn
QgsRectangle mExtent;
@@ -413,5 +415,6 @@
QList<ThreadedRenderContext> mThreadedJobs;
};
+
#endif
More information about the QGIS-commit
mailing list