[QGIS Commit] r8135 - in trunk/qgis: python/core src/core
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Mon Feb 11 05:39:40 EST 2008
Author: timlinux
Date: 2008-02-11 05:39:40 -0500 (Mon, 11 Feb 2008)
New Revision: 8135
Modified:
trunk/qgis/python/core/qgsmaprender.sip
trunk/qgis/python/core/qgsscalecalculator.sip
trunk/qgis/src/core/qgsmaprender.cpp
trunk/qgis/src/core/qgsmaprender.h
trunk/qgis/src/core/qgsscalecalculator.cpp
trunk/qgis/src/core/qgsscalecalculator.h
Log:
Make maprender able to tell us the map size and dpi (there were previously no accessors for this)
Modified: trunk/qgis/python/core/qgsmaprender.sip
===================================================================
--- trunk/qgis/python/core/qgsmaprender.sip 2008-02-10 21:14:32 UTC (rev 8134)
+++ trunk/qgis/python/core/qgsmaprender.sip 2008-02-11 10:39:40 UTC (rev 8135)
@@ -48,6 +48,11 @@
void setOutputSize(QSize size, int dpi);
+ //!accessor for output dpi
+ int outputDpi();
+ //!accessor for output size
+ QSize outputSize();
+
//! transform extent in layer's SRS to extent in output SRS
QgsRect layerExtentToOutputExtent(QgsMapLayer* theLayer, QgsRect extent);
Modified: trunk/qgis/python/core/qgsscalecalculator.sip
===================================================================
--- trunk/qgis/python/core/qgsscalecalculator.sip 2008-02-10 21:14:32 UTC (rev 8134)
+++ trunk/qgis/python/core/qgsscalecalculator.sip 2008-02-11 10:39:40 UTC (rev 8135)
@@ -31,6 +31,12 @@
void setDpi(int dpi);
/**
+ * Accessor for dpi used in scale calculations
+ * @return int the dpi used for scale calculations.
+ */
+ int dpi();
+
+ /**
* Set the map units
* @param mapUnits Units of the data on the map. Must match a value from the
*/
Modified: trunk/qgis/src/core/qgsmaprender.cpp
===================================================================
--- trunk/qgis/src/core/qgsmaprender.cpp 2008-02-10 21:14:32 UTC (rev 8134)
+++ trunk/qgis/src/core/qgsmaprender.cpp 2008-02-11 10:39:40 UTC (rev 8135)
@@ -118,6 +118,14 @@
mScaleCalculator->setDpi(dpi);
adjustExtentToSize();
}
+int QgsMapRender::outputDpi()
+{
+ return mScaleCalculator->dpi();
+}
+QSize QgsMapRender::outputSize()
+{
+ return mSize;
+}
void QgsMapRender::adjustExtentToSize()
{
Modified: trunk/qgis/src/core/qgsmaprender.h
===================================================================
--- trunk/qgis/src/core/qgsmaprender.h 2008-02-10 21:14:32 UTC (rev 8134)
+++ trunk/qgis/src/core/qgsmaprender.h 2008-02-11 10:39:40 UTC (rev 8135)
@@ -79,6 +79,11 @@
void setOverview(bool isOverview = true) { mOverview = isOverview; }
void setOutputSize(QSize size, int dpi);
+
+ //!accessor for output dpi
+ int outputDpi();
+ //!accessor for output size
+ QSize outputSize();
//! transform extent in layer's SRS to extent in output SRS
QgsRect layerExtentToOutputExtent(QgsMapLayer* theLayer, QgsRect extent);
Modified: trunk/qgis/src/core/qgsscalecalculator.cpp
===================================================================
--- trunk/qgis/src/core/qgsscalecalculator.cpp 2008-02-10 21:14:32 UTC (rev 8134)
+++ trunk/qgis/src/core/qgsscalecalculator.cpp 2008-02-11 10:39:40 UTC (rev 8135)
@@ -35,6 +35,10 @@
{
mDpi = dpi;
}
+int QgsScaleCalculator::dpi()
+{
+ return mDpi;
+}
void QgsScaleCalculator::setMapUnits(QGis::units mapUnits)
{
Modified: trunk/qgis/src/core/qgsscalecalculator.h
===================================================================
--- trunk/qgis/src/core/qgsscalecalculator.h 2008-02-10 21:14:32 UTC (rev 8134)
+++ trunk/qgis/src/core/qgsscalecalculator.h 2008-02-11 10:39:40 UTC (rev 8135)
@@ -51,6 +51,11 @@
* @param dpi Dots per inch of monitor resolution
*/
void setDpi(int dpi);
+ /**
+ * Accessor for dpi used in scale calculations
+ * @return int the dpi used for scale calculations.
+ */
+ int dpi();
/**
* Set the map units
@@ -70,7 +75,7 @@
double calculate(QgsRect &mapExtent, int canvasWidth);
/**
- * Calculate the distance between to points in geographic coordinates.
+ * Calculate the distance between two points in geographic coordinates.
* Used to calculate scale for map views with geographic (decimal degree)
* data.
* @param mapExtent QgsRect containing the current map extent
More information about the QGIS-commit
mailing list