Ejemplo n.º 1
0
void QgsComposerPicture::updateMapRotation()
{
  if ( !mRotationMap )
    return;

  // take map rotation
  double rotation = mRotationMap->mapRotation();

  // handle true north
  switch ( mNorthMode )
  {
    case GridNorth:
      break; // nothing to do

    case TrueNorth:
    {
      QgsPoint center = mRotationMap->currentMapExtent()->center();
      QgsCoordinateReferenceSystem crs = mComposition->mapSettings().destinationCrs();

      try
      {
        double bearing = QgsBearingUtils::bearingTrueNorth( crs, center );
        rotation += bearing;
      }
      catch ( QgsException& e )
      {
        Q_UNUSED( e );
        QgsDebugMsg( QString( "Caught exception %1" ).arg( e.what() ) );
      }
      break;
    }
  }

  rotation += mNorthOffset;
  setPictureRotation( rotation );
}
Ejemplo n.º 2
0
void QgsComposerPicture::setRotation( double r )
{
  //kept for compatibility for QGIS2.0 api
  setPictureRotation( r );
}