QgsMapCanvasRendererSync::QgsMapCanvasRendererSync( QgsMapCanvas* canvas, QgsMapRenderer* renderer ) : QObject( canvas ) , mCanvas( canvas ) , mRenderer( renderer ) , mSyncingExtent( false ) { connect( mCanvas, SIGNAL( extentsChanged() ), this, SLOT( onExtentC2R() ) ); connect( mRenderer, SIGNAL( extentsChanged() ), this, SLOT( onExtentR2C() ) ); connect( mCanvas, SIGNAL( mapUnitsChanged() ), this, SLOT( onMapUnitsC2R() ) ); connect( mRenderer, SIGNAL( mapUnitsChanged() ), this, SLOT( onMapUnitsR2C() ) ); connect( mCanvas, SIGNAL( rotationChanged( double ) ), this, SLOT( onMapRotationC2R() ) ); connect( mRenderer, SIGNAL( rotationChanged( double ) ), this, SLOT( onMapRotationR2C() ) ); connect( mCanvas, SIGNAL( hasCrsTransformEnabledChanged( bool ) ), this, SLOT( onCrsTransformC2R() ) ); connect( mRenderer, SIGNAL( hasCrsTransformEnabled( bool ) ), this, SLOT( onCrsTransformR2C() ) ); connect( mCanvas, SIGNAL( destinationCrsChanged() ), this, SLOT( onDestCrsC2R() ) ); connect( mRenderer, SIGNAL( destinationSrsChanged() ), this, SLOT( onDestCrsR2C() ) ); connect( mCanvas, SIGNAL( layersChanged() ), this, SLOT( onLayersC2R() ) ); // TODO: layers R2C ? (should not happen!) }
QgsDecorationGrid::QgsDecorationGrid( QObject* parent ) : QgsDecorationItem( parent ) { setName( "Grid" ); mLineSymbol = nullptr; mMarkerSymbol = nullptr; projectRead(); connect( QgisApp::instance()->mapCanvas(), SIGNAL( mapUnitsChanged() ), this, SLOT( checkMapUnitsChanged() ) ); }
void QgsMapCanvas::setMapUnits( QGis::UnitType u ) { if ( mSettings.mapUnits() == u ) return; QgsDebugMsg( "Setting map units to " + QString::number( static_cast<int>( u ) ) ); mSettings.setMapUnits( u ); updateScale(); refresh(); // this will force the scale bar to be updated emit mapUnitsChanged(); }