Skip to content

Commit

Permalink
Highlight: get transformation object from maprenderer and added some …
Browse files Browse the repository at this point in the history
…consts
  • Loading branch information
mhugent committed Nov 7, 2013
1 parent 6cc5db3 commit aec1d5e
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/core/qgsmaprenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1238,7 +1238,7 @@ void QgsMapRenderer::setLabelingEngine( QgsLabelingEngineInterface* iface )
mLabelingEngine = iface;
}

const QgsCoordinateTransform* QgsMapRenderer::tr( QgsMapLayer *layer )
const QgsCoordinateTransform* QgsMapRenderer::tr( const QgsMapLayer *layer ) const
{
if ( !layer || !mDestCRS )
{
Expand Down
6 changes: 3 additions & 3 deletions src/core/qgsmaprenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ class CORE_EXPORT QgsMapRenderer : public QObject

void addLayerCoordinateTransform( const QString& layerId, const QString& srcAuthId, const QString& destAuthId, int srcDatumTransform = -1, int destDatumTransform = -1 );

const QgsCoordinateTransform* tr( const QgsMapLayer *layer ) const;

signals:

void drawingProgress( int current, int total );
Expand All @@ -313,7 +315,7 @@ class CORE_EXPORT QgsMapRenderer : public QObject
void drawError( QgsMapLayer* );

//! Notifies higher level components to show the datum transform dialog and add a QgsLayerCoordinateTransformInfo for that layer
void datumTransformInfoRequested( QgsMapLayer* ml, const QString& srcAuthId, const QString& destAuthId );
void datumTransformInfoRequested( const QgsMapLayer* ml, const QString& srcAuthId, const QString& destAuthId ) const;

public slots:

Expand Down Expand Up @@ -389,8 +391,6 @@ class CORE_EXPORT QgsMapRenderer : public QObject

QHash< QString, QgsLayerCoordinateTransform > mLayerCoordinateTransformInfo;

private:
const QgsCoordinateTransform* tr( QgsMapLayer *layer );
};

#endif
Expand Down
7 changes: 5 additions & 2 deletions src/gui/qgshighlight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,11 @@ void QgsHighlight::init()
{
if ( mMapCanvas->mapRenderer()->hasCrsTransformEnabled() )
{
QgsCoordinateTransform transform( mLayer->crs(), mMapCanvas->mapRenderer()->destinationCrs() );
mGeometry->transform( transform );
const QgsCoordinateTransform* ct = mMapCanvas->mapRenderer()->tr( mLayer );
if ( ct )
{
mGeometry->transform( *ct );
}
}
updateRect();
update();
Expand Down
6 changes: 3 additions & 3 deletions src/gui/qgsmapcanvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ QgsMapCanvas::QgsMapCanvas( QWidget * parent, const char *name )
setFocusPolicy( Qt::StrongFocus );

mMapRenderer = new QgsMapRenderer;
connect( mMapRenderer, SIGNAL( datumTransformInfoRequested( QgsMapLayer*, const QString&, const QString& ) ),
this, SLOT( getDatumTransformInfo( QgsMapLayer*, const QString& , const QString& ) ) );
connect( mMapRenderer, SIGNAL( datumTransformInfoRequested( const QgsMapLayer*, const QString&, const QString& ) ),
this, SLOT( getDatumTransformInfo( const QgsMapLayer*, const QString& , const QString& ) ) );

// create map canvas item which will show the map
mMap = new QgsMapCanvasMap( this );
Expand Down Expand Up @@ -1548,7 +1548,7 @@ void QgsMapCanvas::writeProject( QDomDocument & doc )
}

/**Ask user which datum transform to use*/
void QgsMapCanvas::getDatumTransformInfo( QgsMapLayer* ml, const QString& srcAuthId, const QString& destAuthId )
void QgsMapCanvas::getDatumTransformInfo( const QgsMapLayer* ml, const QString& srcAuthId, const QString& destAuthId )
{
if ( !ml )
{
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsmapcanvas.h
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
void writeProject( QDomDocument & );

//! ask user about datum transformation
void getDatumTransformInfo( QgsMapLayer* ml, const QString& srcAuthId, const QString& destAuthId );
void getDatumTransformInfo( const QgsMapLayer* ml, const QString& srcAuthId, const QString& destAuthId );

private slots:
//! called when current maptool is destroyed
Expand Down

0 comments on commit aec1d5e

Please sign in to comment.