QGIS API Documentation  2.7.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
qgsmapsettings.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmapsettings.cpp
3  --------------------------------------
4  Date : December 2013
5  Copyright : (C) 2013 by Martin Dobias
6  Email : wonder dot sk at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #include "qgsmapsettings.h"
17 
18 #include "qgsscalecalculator.h"
19 #include "qgsmaprendererjob.h"
20 #include "qgsmaptopixel.h"
21 #include "qgslogger.h"
22 
23 #include "qgscrscache.h"
24 #include "qgsmessagelog.h"
25 #include "qgsmaplayer.h"
26 #include "qgsmaplayerregistry.h"
27 #include "qgsxmlutils.h"
28 
29 
30 Q_GUI_EXPORT extern int qt_defaultDpiX();
31 
32 
34  : mDpi( qt_defaultDpiX() ) // DPI that will be used by default for QImage instances
35  , mSize( QSize( 0, 0 ) )
36  , mExtent()
37  , mRotation( 0.0 )
38  , mProjectionsEnabled( false )
39  , mDestCRS( GEOCRS_ID, QgsCoordinateReferenceSystem::InternalCrsId ) // WGS 84
40  , mDatumTransformStore( mDestCRS )
41  , mBackgroundColor( Qt::white )
42  , mSelectionColor( Qt::yellow )
43  , mFlags( Antialiasing | UseAdvancedEffects | DrawLabeling | DrawSelection )
44  , mImageFormat( QImage::Format_ARGB32_Premultiplied )
45 {
46  updateDerived();
47 
48  // set default map units - we use WGS 84 thus use degrees
50 }
51 
52 
54 {
55  return mExtent;
56 }
57 
59 {
60  mExtent = extent;
61 
62  updateDerived();
63 }
64 
66 {
67  return mRotation;
68 }
69 
70 void QgsMapSettings::setRotation( double degrees )
71 {
72  if ( mRotation == degrees ) return;
73 
74  mRotation = degrees;
75 
76  // TODO: update extent while keeping scale ?
77  updateDerived();
78 }
79 
80 
82 {
84 
85  if ( extent.isEmpty() || !extent.isFinite() )
86  {
87  mValid = false;
88  return;
89  }
90 
91  // Don't allow zooms where the current extent is so small that it
92  // can't be accurately represented using a double (which is what
93  // currentExtent uses). Excluding 0 avoids a divide by zero and an
94  // infinite loop when rendering to a new canvas. Excluding extents
95  // greater than 1 avoids doing unnecessary calculations.
96 
97  // The scheme is to compare the width against the mean x coordinate
98  // (and height against mean y coordinate) and only allow zooms where
99  // the ratio indicates that there is more than about 12 significant
100  // figures (there are about 16 significant figures in a double).
101 
102  if ( extent.width() > 0 &&
103  extent.height() > 0 &&
104  extent.width() < 1 &&
105  extent.height() < 1 )
106  {
107  // Use abs() on the extent to avoid the case where the extent is
108  // symmetrical about 0.
109  double xMean = ( qAbs( extent.xMinimum() ) + qAbs( extent.xMaximum() ) ) * 0.5;
110  double yMean = ( qAbs( extent.yMinimum() ) + qAbs( extent.yMaximum() ) ) * 0.5;
111 
112  double xRange = extent.width() / xMean;
113  double yRange = extent.height() / yMean;
114 
115  static const double minProportion = 1e-12;
116  if ( xRange < minProportion || yRange < minProportion )
117  {
118  mValid = false;
119  return;
120  }
121  }
122 
123  double myHeight = mSize.height();
124  double myWidth = mSize.width();
125 
126  if ( !myWidth || !myHeight )
127  {
128  mValid = false;
129  return;
130  }
131 
132  // calculate the translation and scaling parameters
133  double mapUnitsPerPixelY = mExtent.height() / myHeight;
134  double mapUnitsPerPixelX = mExtent.width() / myWidth;
135  mMapUnitsPerPixel = mapUnitsPerPixelY > mapUnitsPerPixelX ? mapUnitsPerPixelY : mapUnitsPerPixelX;
136 
137  // calculate the actual extent of the mapCanvas
138  double dxmin = mExtent.xMinimum(), dxmax = mExtent.xMaximum(),
139  dymin = mExtent.yMinimum(), dymax = mExtent.yMaximum(), whitespace;
140 
141  if ( mapUnitsPerPixelY > mapUnitsPerPixelX )
142  {
143  whitespace = (( myWidth * mMapUnitsPerPixel ) - mExtent.width() ) * 0.5;
144  dxmin -= whitespace;
145  dxmax += whitespace;
146  }
147  else
148  {
149  whitespace = (( myHeight * mMapUnitsPerPixel ) - mExtent.height() ) * 0.5;
150  dymin -= whitespace;
151  dymax += whitespace;
152  }
153 
154  mVisibleExtent.set( dxmin, dymin, dxmax, dymax );
155 
156  // update the scale
159 
161  visibleExtent().center().x(),
162  visibleExtent().center().y(),
163  outputSize().width(),
164  outputSize().height(),
165  mRotation);
166 
167 #if 1 // set visible extent taking rotation in consideration
168  if ( mRotation )
169  {
170  QgsPoint p1 = mMapToPixel.toMapCoordinates( QPoint( 0, 0 ) );
171  QgsPoint p2 = mMapToPixel.toMapCoordinates( QPoint( 0, myHeight ) );
172  QgsPoint p3 = mMapToPixel.toMapCoordinates( QPoint( myWidth, 0 ) );
173  QgsPoint p4 = mMapToPixel.toMapCoordinates( QPoint( myWidth, myHeight ) );
174  dxmin = std::min( p1.x(), std::min( p2.x(), std::min( p3.x(), p4.x() ) ) );
175  dymin = std::min( p1.y(), std::min( p2.y(), std::min( p3.y(), p4.y() ) ) );
176  dxmax = std::max( p1.x(), std::max( p2.x(), std::max( p3.x(), p4.x() ) ) );
177  dymax = std::max( p1.y(), std::max( p2.y(), std::max( p3.y(), p4.y() ) ) );
178  mVisibleExtent.set( dxmin, dymin, dxmax, dymax );
179  }
180 #endif
181 
182  QgsDebugMsg( QString( "Map units per pixel (x,y) : %1, %2" ).arg( qgsDoubleToString( mapUnitsPerPixelX ) ).arg( qgsDoubleToString( mapUnitsPerPixelY ) ) );
183  QgsDebugMsg( QString( "Pixmap dimensions (x,y) : %1, %2" ).arg( qgsDoubleToString( mSize.width() ) ).arg( qgsDoubleToString( mSize.height() ) ) );
184  QgsDebugMsg( QString( "Extent dimensions (x,y) : %1, %2" ).arg( qgsDoubleToString( mExtent.width() ) ).arg( qgsDoubleToString( mExtent.height() ) ) );
186  QgsDebugMsg( QString( "Adjusted map units per pixel (x,y) : %1, %2" ).arg( qgsDoubleToString( mVisibleExtent.width() / myWidth ) ).arg( qgsDoubleToString( mVisibleExtent.height() / myHeight ) ) );
187  QgsDebugMsg( QString( "Recalced pixmap dimensions (x,y) : %1, %2" ).arg( qgsDoubleToString( mVisibleExtent.width() / mMapUnitsPerPixel ) ).arg( qgsDoubleToString( mVisibleExtent.height() / mMapUnitsPerPixel ) ) );
188  QgsDebugMsg( QString( "Scale (assuming meters as map units) = 1:%1" ).arg( qgsDoubleToString( mScale ) ) );
189  QgsDebugMsg( QString( "Rotation: %1 degrees" ).arg( mRotation ) );
190 
191  mValid = true;
192 }
193 
194 
196 {
197  return mSize;
198 }
199 
201 {
202  mSize = size;
203 
204  updateDerived();
205 }
206 
208 {
209  return mDpi;
210 }
211 
213 {
214  mDpi = dpi;
215 
216  updateDerived();
217 }
218 
219 
220 QStringList QgsMapSettings::layers() const
221 {
222  return mLayers;
223 }
224 
225 void QgsMapSettings::setLayers( const QStringList& layers )
226 {
227  mLayers = layers;
228 }
229 
231 {
232  mProjectionsEnabled = enabled;
233 }
234 
236 {
237  return mProjectionsEnabled;
238 }
239 
240 
242 {
243  mDestCRS = crs;
245 }
246 
248 {
249  return mDestCRS;
250 }
251 
252 
254 {
256 
257  // Since the map units have changed, force a recalculation of the scale.
258  updateDerived();
259 }
260 
261 void QgsMapSettings::setFlags( QgsMapSettings::Flags flags )
262 {
263  mFlags = flags;
264 }
265 
267 {
268  if ( on )
269  mFlags |= flag;
270  else
271  mFlags &= ~flag;
272 }
273 
274 QgsMapSettings::Flags QgsMapSettings::flags() const
275 {
276  return mFlags;
277 }
278 
280 {
281  return mFlags.testFlag( flag );
282 }
283 
285 {
286  return mScaleCalculator.mapUnits();
287 }
288 
289 
291 {
292  return mValid;
293 }
294 
296 {
297  return mVisibleExtent;
298 }
299 
301 {
302  return mMapUnitsPerPixel;
303 }
304 
305 double QgsMapSettings::scale() const
306 {
307  return mScale;
308 }
309 
310 
311 
312 
313 
315 {
316  return mDatumTransformStore.transformation( layer );
317 }
318 
319 
320 
322 {
323  if ( hasCrsTransformEnabled() )
324  {
325  try
326  {
327  if ( const QgsCoordinateTransform* ct = layerTransform( theLayer ) )
328  {
329  QgsDebugMsg( QString( "sourceCrs = " + ct->sourceCrs().authid() ) );
330  QgsDebugMsg( QString( "destCRS = " + ct->destCRS().authid() ) );
331  QgsDebugMsg( QString( "extent = " + extent.toString() ) );
332  extent = ct->transformBoundingBox( extent );
333  }
334  }
335  catch ( QgsCsException &cse )
336  {
337  QgsMessageLog::logMessage( QString( "Transform error caught: %1" ).arg( cse.what() ), "CRS" );
338  }
339  }
340 
341  QgsDebugMsg( QString( "proj extent = " + extent.toString() ) );
342 
343  return extent;
344 }
345 
346 
348 {
349  if ( hasCrsTransformEnabled() )
350  {
351  try
352  {
353  if ( const QgsCoordinateTransform* ct = layerTransform( theLayer ) )
354  {
355  QgsDebugMsg( QString( "sourceCrs = " + ct->sourceCrs().authid() ) );
356  QgsDebugMsg( QString( "destCRS = " + ct->destCRS().authid() ) );
357  QgsDebugMsg( QString( "extent = " + extent.toString() ) );
358  extent = ct->transformBoundingBox( extent, QgsCoordinateTransform::ReverseTransform );
359  }
360  }
361  catch ( QgsCsException &cse )
362  {
363  QgsMessageLog::logMessage( QString( "Transform error caught: %1" ).arg( cse.what() ), "CRS" );
364  }
365  }
366 
367  QgsDebugMsg( QString( "proj extent = " + extent.toString() ) );
368 
369  return extent;
370 }
371 
372 
374 {
375  if ( hasCrsTransformEnabled() )
376  {
377  try
378  {
379  if ( const QgsCoordinateTransform* ct = layerTransform( theLayer ) )
380  point = ct->transform( point, QgsCoordinateTransform::ForwardTransform );
381  }
382  catch ( QgsCsException &cse )
383  {
384  QgsMessageLog::logMessage( QString( "Transform error caught: %1" ).arg( cse.what() ), "CRS" );
385  }
386  }
387  else
388  {
389  // leave point without transformation
390  }
391  return point;
392 }
393 
394 
396 {
397  if ( hasCrsTransformEnabled() )
398  {
399  try
400  {
401  if ( const QgsCoordinateTransform* ct = layerTransform( theLayer ) )
402  rect = ct->transform( rect, QgsCoordinateTransform::ForwardTransform );
403  }
404  catch ( QgsCsException &cse )
405  {
406  QgsMessageLog::logMessage( QString( "Transform error caught: %1" ).arg( cse.what() ), "CRS" );
407  }
408  }
409  else
410  {
411  // leave point without transformation
412  }
413  return rect;
414 }
415 
416 
418 {
419  if ( hasCrsTransformEnabled() )
420  {
421  try
422  {
423  if ( const QgsCoordinateTransform* ct = layerTransform( theLayer ) )
424  point = ct->transform( point, QgsCoordinateTransform::ReverseTransform );
425  }
426  catch ( QgsCsException &cse )
427  {
428  QgsMessageLog::logMessage( QString( "Transform error caught: %1" ).arg( cse.what() ), "CRS" );
429  }
430  }
431  else
432  {
433  // leave point without transformation
434  }
435  return point;
436 }
437 
438 
440 {
441  if ( hasCrsTransformEnabled() )
442  {
443  try
444  {
445  if ( const QgsCoordinateTransform* ct = layerTransform( theLayer ) )
446  rect = ct->transform( rect, QgsCoordinateTransform::ReverseTransform );
447  }
448  catch ( QgsCsException &cse )
449  {
450  QgsMessageLog::logMessage( QString( "Transform error caught: %1" ).arg( cse.what() ), "CRS" );
451  }
452  }
453  return rect;
454 }
455 
456 
457 
459 {
460  QgsDebugMsg( "called." );
462 
463  // reset the map canvas extent since the extent may now be smaller
464  // We can't use a constructor since QgsRectangle normalizes the rectangle upon construction
466  fullExtent.setMinimal();
467 
468  // iterate through the map layers and test each layers extent
469  // against the current min and max values
470  QStringList::const_iterator it = mLayers.begin();
471  QgsDebugMsg( QString( "Layer count: %1" ).arg( mLayers.count() ) );
472  while ( it != mLayers.end() )
473  {
474  QgsMapLayer * lyr = registry->mapLayer( *it );
475  if ( lyr == NULL )
476  {
477  QgsDebugMsg( QString( "WARNING: layer '%1' not found in map layer registry!" ).arg( *it ) );
478  }
479  else
480  {
481  QgsDebugMsg( "Updating extent using " + lyr->name() );
482  QgsDebugMsg( "Input extent: " + lyr->extent().toString() );
483 
484  if ( lyr->extent().isNull() )
485  {
486  ++it;
487  continue;
488  }
489 
490  // Layer extents are stored in the coordinate system (CS) of the
491  // layer. The extent must be projected to the canvas CS
493 
494  QgsDebugMsg( "Output extent: " + extent.toString() );
495  fullExtent.unionRect( extent );
496 
497  }
498  ++it;
499  }
500 
501  if ( fullExtent.width() == 0.0 || fullExtent.height() == 0.0 )
502  {
503  // If all of the features are at the one point, buffer the
504  // rectangle a bit. If they are all at zero, do something a bit
505  // more crude.
506 
507  if ( fullExtent.xMinimum() == 0.0 && fullExtent.xMaximum() == 0.0 &&
508  fullExtent.yMinimum() == 0.0 && fullExtent.yMaximum() == 0.0 )
509  {
510  fullExtent.set( -1.0, -1.0, 1.0, 1.0 );
511  }
512  else
513  {
514  const double padFactor = 1e-8;
515  double widthPad = fullExtent.xMinimum() * padFactor;
516  double heightPad = fullExtent.yMinimum() * padFactor;
517  double xmin = fullExtent.xMinimum() - widthPad;
518  double xmax = fullExtent.xMaximum() + widthPad;
519  double ymin = fullExtent.yMinimum() - heightPad;
520  double ymax = fullExtent.yMaximum() + heightPad;
521  fullExtent.set( xmin, ymin, xmax, ymax );
522  }
523  }
524 
525  QgsDebugMsg( "Full extent: " + fullExtent.toString() );
526  return fullExtent;
527 }
528 
529 
530 void QgsMapSettings::readXML( QDomNode& theNode )
531 {
532  // set units
533  QDomNode mapUnitsNode = theNode.namedItem( "units" );
534  QGis::UnitType units = QgsXmlUtils::readMapUnits( mapUnitsNode.toElement() );
535  setMapUnits( units );
536 
537  // set projections flag
538  QDomNode projNode = theNode.namedItem( "projections" );
539  setCrsTransformEnabled( projNode.toElement().text().toInt() );
540 
541  // set destination CRS
543  QDomNode srsNode = theNode.namedItem( "destinationsrs" );
544  srs.readXML( srsNode );
545  setDestinationCrs( srs );
546 
547  // set extent
548  QDomNode extentNode = theNode.namedItem( "extent" );
549  QgsRectangle aoi = QgsXmlUtils::readRectangle( extentNode.toElement() );
550  setExtent( aoi );
551 
552  // set rotation
553  QDomNode rotationNode = theNode.namedItem( "rotation" );
554  QString rotationVal = rotationNode.toElement().text();
555  if ( ! rotationVal.isEmpty() )
556  {
557  double rot = rotationVal.toDouble();
558  setRotation( rot );
559  }
560 
561  mDatumTransformStore.readXML( theNode );
562 }
563 
564 
565 
566 void QgsMapSettings::writeXML( QDomNode& theNode, QDomDocument& theDoc )
567 {
568  // units
569  theNode.appendChild( QgsXmlUtils::writeMapUnits( mapUnits(), theDoc ) );
570 
571  // Write current view extents
572  theNode.appendChild( QgsXmlUtils::writeRectangle( extent(), theDoc ) );
573 
574  // Write current view rotation
575  QDomElement rotNode = theDoc.createElement( "rotation" );
576  rotNode.appendChild(
577  theDoc.createTextNode( qgsDoubleToString( rotation() ) )
578  );
579  theNode.appendChild( rotNode );
580 
581  // projections enabled
582  QDomElement projNode = theDoc.createElement( "projections" );
583  projNode.appendChild( theDoc.createTextNode( QString::number( hasCrsTransformEnabled() ) ) );
584  theNode.appendChild( projNode );
585 
586  // destination CRS
587  QDomElement srsNode = theDoc.createElement( "destinationsrs" );
588  theNode.appendChild( srsNode );
589  destinationCrs().writeXML( srsNode, theDoc );
590 
591  mDatumTransformStore.writeXML( theNode, theDoc );
592 }
void setMapUnits(QGis::UnitType mapUnits)
Set the map units.
void unionRect(const QgsRectangle &rect)
updates rectangle to include passed argument
void setDestinationCrs(const QgsCoordinateReferenceSystem &crs)
sets destination coordinate reference system
A rectangle specified with double values.
Definition: qgsrectangle.h:35
Base class for all map layer types.
Definition: qgsmaplayer.h:48
QgsPoint layerToMapCoordinates(QgsMapLayer *theLayer, QgsPoint point) const
transform point coordinates from layer's CRS to output CRS
bool isEmpty() const
test if rectangle is empty.
QgsRectangle mVisibleExtent
extent with some additional white space that matches the output aspect ratio
void setMinimal()
Set a rectangle so that min corner is at max and max corner is at min.
QgsMapToPixel mMapToPixel
double scale() const
Return the calculated scale of the map.
void readXML(QDomNode &theNode)
QgsRectangle fullExtent() const
returns current extent of layer set
const QgsCoordinateTransform * layerTransform(QgsMapLayer *layer) const
Return coordinate transform from layer's CRS to destination CRS.
bool isFinite() const
Returns true if the rectangle has finite boundaries.
double yMaximum() const
Get the y maximum value (top side of rectangle)
Definition: qgsrectangle.h:188
#define QgsDebugMsg(str)
Definition: qgslogger.h:33
void setOutputDpi(int dpi)
Set DPI used for conversion between real world units (e.g. mm) and pixels.
UnitType
Map units that qgis supports.
Definition: qgis.h:229
QgsCoordinateReferenceSystem mDestCRS
static QgsMapLayerRegistry * instance()
Definition: qgssingleton.h:23
bool isNull() const
test if the rectangle is null (all coordinates zero or after call to setMinimal()).
QgsRectangle visibleExtent() const
Return the actual extent derived from requested extent that takes takes output image size into accoun...
void setDpi(double dpi)
Set the dpi to be used in scale calculations.
void setDestinationCrs(const QgsCoordinateReferenceSystem &destCrs)
static QDomElement writeRectangle(const QgsRectangle &rect, QDomDocument &doc)
Definition: qgsxmlutils.cpp:96
void setParameters(double mapUnitsPerPixel, double xmin, double ymin, double height)
QGis::UnitType mapUnits() const
Returns current map units.
bool hasCrsTransformEnabled() const
returns true if projections are enabled for this layer set
QgsRectangle layerExtentToOutputExtent(QgsMapLayer *theLayer, QgsRectangle extent) const
transform bounding box from layer's CRS to output CRS
Flags flags() const
Return combination of flags used for rendering.
double rotation() const
Return the rotation of the resulting map image Units are clockwise degrees.
QgsPoint mapToLayerCoordinates(QgsMapLayer *theLayer, QgsPoint point) const
transform point coordinates from output CRS to layer's CRS
void setLayers(const QStringList &layers)
Set list of layer IDs for map rendering.
Q_GUI_EXPORT int qt_defaultDpiX()
double x() const
Definition: qgspoint.h:126
static void logMessage(QString message, QString tag=QString::null, MessageLevel level=WARNING)
add a message to the instance (and create it if necessary)
void setFlag(Flag flag, bool on=true)
Enable or disable a particular flag (other flags are not affected)
void set(const QgsPoint &p1, const QgsPoint &p2)
Set the rectangle from two QgsPoints.
const QString & name() const
Get the display name of the layer.
bool mValid
whether the actual settings are valid (set in updateDerived())
int outputDpi() const
Return DPI used for conversion between real world units (e.g.
QgsRectangle mExtent
double calculate(const QgsRectangle &mapExtent, int canvasWidth)
Calculate the scale denominator.
double yMinimum() const
Get the y minimum value (bottom side of rectangle)
Definition: qgsrectangle.h:193
Flag
Enumeration of flags that adjust the way how map is rendered.
QSize outputSize() const
Return the size of the resulting map image.
double xMaximum() const
Get the x maximum value (right side of rectangle)
Definition: qgsrectangle.h:178
void setRotation(double degrees)
Set the rotation of the resulting map image Units are clockwise degrees.
bool hasValidSettings() const
Check whether the map settings are valid and can be used for rendering.
void setMapUnits(QGis::UnitType u)
Set units of map's geographical coordinates - used for scale calculation.
const QgsCoordinateReferenceSystem & destinationCrs() const
returns CRS of destination coordinate reference system
void writeXML(QDomNode &parentNode, QDomDocument &theDoc) const
const long GEOCRS_ID
Magic number for a geographic coord sys in QGIS srs.db tbl_srs.srs_id.
Definition: qgis.h:385
double mapUnitsPerPixel() const
Return the distance in geographical coordinates that equals to one pixel in the map.
QGis::UnitType mapUnits() const
Get units of map's geographical coordinates - used for scale calculation.
const QgsCoordinateTransform * transformation(QgsMapLayer *layer) const
will return transform from layer's CRS to current destination CRS.
QgsScaleCalculator mScaleCalculator
A class to represent a point.
Definition: qgspoint.h:63
static QGis::UnitType readMapUnits(const QDomElement &element)
Definition: qgsxmlutils.cpp:9
This class tracks map layers that are currently loaded and provides a means to fetch a pointer to a m...
int min(int a, int b)
Definition: util.h:93
QString qgsDoubleToString(const double &a, const int &precision=17)
Definition: qgis.h:317
bool testFlag(Flag flag) const
Check whether a particular flag is enabled.
QgsPoint toMapCoordinates(int x, int y) const
QString what() const
Definition: qgsexception.h:35
bool writeXML(QDomNode &theNode, QDomDocument &theDoc) const
double mMapUnitsPerPixel
void readXML(const QDomNode &parentNode)
void setOutputSize(const QSize &size)
Set the size of the resulting map image.
Class for storing a coordinate reference system (CRS)
void setExtent(const QgsRectangle &rect)
Set coordinates of the rectangle which should be rendered.
QgsRectangle extent() const
Return geographical coordinates of the rectangle that should be rendered.
Class for doing transforms between two map coordinate systems.
double y() const
Definition: qgspoint.h:134
QStringList layers() const
Get list of layer IDs for map rendering The layers are stored in the reverse order of how they are re...
QgsMapLayer * mapLayer(QString theLayerId)
Retrieve a pointer to a loaded layer by id.
Custom exception class for Coordinate Reference System related exceptions.
QStringList mLayers
QgsRectangle outputExtentToLayerExtent(QgsMapLayer *theLayer, QgsRectangle extent) const
transform bounding box from output CRS to layer's CRS
double width() const
Width of the rectangle.
Definition: qgsrectangle.h:198
QgsDatumTransformStore mDatumTransformStore
virtual QgsRectangle extent()
Return the extent of the layer.
double size
Definition: qgssvgcache.cpp:77
QString toString(bool automaticPrecision=false) const
returns string representation of form xmin,ymin xmax,ymax
void setFlags(Flags flags)
Set combination of flags that will be used for rendering.
double xMinimum() const
Get the x minimum value (left side of rectangle)
Definition: qgsrectangle.h:183
int max(int a, int b)
Definition: util.h:87
static QgsRectangle readRectangle(const QDomElement &element)
Definition: qgsxmlutils.cpp:38
double height() const
Height of the rectangle.
Definition: qgsrectangle.h:203
static QDomElement writeMapUnits(QGis::UnitType units, QDomDocument &doc)
Definition: qgsxmlutils.cpp:68
void setCrsTransformEnabled(bool enabled)
sets whether to use projections for this layer set
void writeXML(QDomNode &theNode, QDomDocument &theDoc)