mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
Make maprender able to tell us the map size and dpi (there were previously no accessors for this)
git-svn-id: http://svn.osgeo.org/qgis/trunk@8135 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
01f79abe26
commit
76ada2e1ef
@ -48,6 +48,11 @@ class QgsMapRender : QObject
|
||||
|
||||
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);
|
||||
|
||||
|
@ -30,6 +30,12 @@ class QgsScaleCalculator
|
||||
*/
|
||||
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
|
||||
|
@ -118,6 +118,14 @@ void QgsMapRender::setOutputSize(QSize size, int dpi)
|
||||
mScaleCalculator->setDpi(dpi);
|
||||
adjustExtentToSize();
|
||||
}
|
||||
int QgsMapRender::outputDpi()
|
||||
{
|
||||
return mScaleCalculator->dpi();
|
||||
}
|
||||
QSize QgsMapRender::outputSize()
|
||||
{
|
||||
return mSize;
|
||||
}
|
||||
|
||||
void QgsMapRender::adjustExtentToSize()
|
||||
{
|
||||
|
@ -79,6 +79,11 @@ class CORE_EXPORT QgsMapRender : public QObject
|
||||
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);
|
||||
|
@ -35,6 +35,10 @@ void QgsScaleCalculator::setDpi(int dpi)
|
||||
{
|
||||
mDpi = dpi;
|
||||
}
|
||||
int QgsScaleCalculator::dpi()
|
||||
{
|
||||
return mDpi;
|
||||
}
|
||||
|
||||
void QgsScaleCalculator::setMapUnits(QGis::units mapUnits)
|
||||
{
|
||||
|
@ -51,6 +51,11 @@ class CORE_EXPORT QgsScaleCalculator
|
||||
* @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 @@ class CORE_EXPORT QgsScaleCalculator
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user