[Qgis-developer] What will be in QGIS 2.0

Martin Dobias wonder.sk at gmail.com
Fri Jul 13 00:36:45 PDT 2012


On Fri, Jul 13, 2012 at 8:57 AM, Radim Blazek <radim.blazek at gmail.com> wrote:
> For example, QgsMapCanvasMap is using QgsMapCanvas in 2 methods to get
>   QgsMapRenderer (QgsMapCanvas member) and call its methods. When
> reading QgsMapCanvasMap source, you don't see that calling
> QgsMapCanvasMap methods modifies QgsMapRenderer:
>
> void QgsMapCanvasMap::resize( QSize size ) {
>   ...
>   mCanvas->mapRenderer()->setOutputSize( size, mPixmap.logicalDpiX() );
> }
>
> it is used in QgsMapCanvas:
>
>   mMap->resize( size() );
>
> I would prefer to set QgsMapRenderer size in QgsMapCanvas, either
> simply something like
>
>   mMap->resize( size() );
>   mMapRenderer->setOutputSize( mMap->size() );
>
> or with a resize signal from QgsMapCanvasMap.
>
> The second method is
>
> void QgsMapCanvasMap::render() {
>   ...
>   mCanvas->mapRenderer()->render( &paint );
> }
>
> which may be simply changed to
>
> void QgsMapCanvasMap::render( QgsMapRenderer*  renderer) {
>   ...
>   renderer->render( &paint );
> }
>
> We would have one circular dependency less with just 2 simple changes.
> In this case I don't see any real reason for circular dependency, it
> does not seem to be intentional design, it seems that this
> constellation appeared somehow itself during code evolution.

It makes sense to remove this dependency, I wasn't aware of this one...

Martin


More information about the Qgis-developer mailing list