35 , mSize( QSize( 0, 0 ) )
38 , mProjectionsEnabled( false )
40 , mDatumTransformStore( mDestCRS )
41 , mBackgroundColor( Qt::white )
42 , mSelectionColor( Qt::yellow )
43 , mFlags( Antialiasing | UseAdvancedEffects | DrawLabeling | DrawSelection )
44 , mImageFormat( QImage::Format_ARGB32_Premultiplied )
47 , mMapUnitsPerPixel( 1 )
106 if ( extent.
width() > 0 &&
108 extent.
width() < 1 &&
113 double xMean = ( qAbs( extent.
xMinimum() ) + qAbs( extent.
xMaximum() ) ) * 0.5;
114 double yMean = ( qAbs( extent.
yMinimum() ) + qAbs( extent.
yMaximum() ) ) * 0.5;
116 double xRange = extent.
width() / xMean;
117 double yRange = extent.
height() / yMean;
119 static const double minProportion = 1e-12;
120 if ( xRange < minProportion || yRange < minProportion )
127 double myHeight =
mSize.height();
128 double myWidth =
mSize.width();
130 if ( !myWidth || !myHeight )
139 mMapUnitsPerPixel = mapUnitsPerPixelY > mapUnitsPerPixelX ? mapUnitsPerPixelY : mapUnitsPerPixelX;
145 if ( mapUnitsPerPixelY > mapUnitsPerPixelX )
171 #if 1 // set visible extent taking rotation in consideration
295 return mFlags.testFlag( flag );
354 QgsDebugMsg( QString(
"sourceCrs = " + ct->sourceCrs().authid() ) );
355 QgsDebugMsg( QString(
"destCRS = " + ct->destCRS().authid() ) );
357 extent = ct->transformBoundingBox( extent );
380 QgsDebugMsg( QString(
"sourceCrs = " + ct->sourceCrs().authid() ) );
381 QgsDebugMsg( QString(
"destCRS = " + ct->destCRS().authid() ) );
495 QStringList::const_iterator it =
mLayers.begin();
502 QgsDebugMsg( QString(
"WARNING: layer '%1' not found in map layer registry!" ).arg( *it ) );
526 if ( fullExtent.
width() == 0.0 || fullExtent.
height() == 0.0 )
535 fullExtent.
set( -1.0, -1.0, 1.0, 1.0 );
539 const double padFactor = 1e-8;
540 double widthPad = fullExtent.
xMinimum() * padFactor;
541 double heightPad = fullExtent.
yMinimum() * padFactor;
542 double xmin = fullExtent.
xMinimum() - widthPad;
543 double xmax = fullExtent.
xMaximum() + widthPad;
544 double ymin = fullExtent.
yMinimum() - heightPad;
545 double ymax = fullExtent.
yMaximum() + heightPad;
546 fullExtent.
set( xmin, ymin, xmax, ymax );
558 QDomNode mapUnitsNode = theNode.namedItem(
"units" );
563 QDomNode projNode = theNode.namedItem(
"projections" );
568 QDomNode srsNode = theNode.namedItem(
"destinationsrs" );
573 QDomNode extentNode = theNode.namedItem(
"extent" );
578 QDomNode rotationNode = theNode.namedItem(
"rotation" );
579 QString rotationVal = rotationNode.toElement().text();
580 if ( ! rotationVal.isEmpty() )
582 double rot = rotationVal.toDouble();
600 QDomElement rotNode = theDoc.createElement(
"rotation" );
604 theNode.appendChild( rotNode );
607 QDomElement projNode = theDoc.createElement(
"projections" );
609 theNode.appendChild( projNode );
612 QDomElement srsNode = theDoc.createElement(
"destinationsrs" );
613 theNode.appendChild( srsNode );