Skip to content

Commit

Permalink
rename new QgsSnapper::snapPoint method to snapMapPoint and restore p…
Browse files Browse the repository at this point in the history
…ython name

of deprecated old version (fixes #12153)
  • Loading branch information
jef-n committed Feb 9, 2015
1 parent 90cc725 commit 0593ef6
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 18 deletions.
10 changes: 4 additions & 6 deletions python/core/qgsmaptopixel.sip
Expand Up @@ -13,12 +13,11 @@ class QgsMapToPixel
public:
/* Constructor
* @param mapUnitsPerPixel Map units per pixel
* @param ymax Maximum y value of the map canvas
* @param height Map canvas height, in pixels
* @param ymin Minimum y value of the map canvas
* @param xmin Minimum x value of the map canvas
*/
QgsMapToPixel( double mapUnitsPerPixel = 0, double ymax = 0, double ymin = 0,
double xmin = 0 );
QgsMapToPixel( double mapUnitsPerPixel = 0, double height = 0, double ymin = 0, double xmin = 0 );
//! destructor
~QgsMapToPixel();
/*! Transform the point from map (world) coordinates to device coordinates
Expand Down Expand Up @@ -50,6 +49,7 @@ class QgsMapToPixel
transform.
@note not available in python bindings
*/
// template <class T>
// void transformInPlace( QVector<double>& x, QVector<double>& y ) const;

QgsPoint toMapCoordinates( int x, int y ) const;
Expand Down Expand Up @@ -127,8 +127,6 @@ class QgsMapToPixel
void setParameters( double mapUnitsPerPixel, double xc, double yc, int width, int height, double rotation );

//! String representation of the parameters used in the transform
QString showParameters();
QString showParameters() const;

};


8 changes: 5 additions & 3 deletions python/core/qgssnapper.sip
Expand Up @@ -70,26 +70,28 @@ class QgsSnapper
};

//!@ deprecated since 2.4 - use constructor with QgsMapSettings
QgsSnapper( QgsMapRenderer* mapRender ) /Deprecated/;
QgsSnapper( QgsMapRenderer *mapRender ) /Deprecated/;

explicit QgsSnapper( const QgsMapSettings& mapSettings );

~QgsSnapper();

/** Does the snapping operation
@param startPoint the start point for snapping (in pixel coordinates)
@param snappingResult the list where the results are inserted (everything in map coordinate system)
@param excludePoints a list with (map coordinate) points that should be excluded in the snapping result. Useful e.g. for vertex moves where a vertex should not be snapped to its original position
@return 0 in case of success
@deprecated
*/
int snapPoint( const QPoint& startPoint, QList<QgsSnappingResult>& snappingResult /Out/, const QList<QgsPoint>& excludePoints = QList<QgsPoint>() ) /Deprecated,PyName=snapPointOld/;
int snapPoint( const QPoint &startPoint, QList<QgsSnappingResult> &snappingResult /Out/, const QList<QgsPoint> &excludePoints = QList<QgsPoint>() ) /Deprecated/;

/** Does the snapping operation
@param mapCoordPoint the start point for snapping (in map coordinates)
@param snappingResult the list where the results are inserted (everything in map coordinate system)
@param excludePoints a list with (map coordinate) points that should be excluded in the snapping result. Useful e.g. for vertex moves where a vertex should not be snapped to its original position
@return 0 in case of success
*/
int snapPoint( const QgsPoint& mapCoordPoint, QList<QgsSnappingResult>& snappingResult, const QList<QgsPoint>& excludePoints = QList<QgsPoint>() );
int snapMapPoint( const QgsPoint &mapCoordPoint, QList<QgsSnappingResult> &snappingResult /Out/, const QList<QgsPoint> &excludePoints = QList<QgsPoint>() );

//setters
void setSnapLayers( const QList<QgsSnapper::SnapLayer>& snapLayers );
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgisapp.cpp
Expand Up @@ -478,7 +478,6 @@ QgisApp *QgisApp::smInstance = 0;
// constructor starts here
QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent, Qt::WindowFlags fl )
: QMainWindow( parent, fl )
, mMousePrecisionDecimalPlaces( 0 )
#ifdef Q_OS_WIN
, mSkipNextContextMenuEvent( 0 )
#endif
Expand Down Expand Up @@ -506,6 +505,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
, mLayerTreeCanvasBridge( 0 )
, mPreviousNonZoomMapTool( 0 )
, mSplash( splash )
, mMousePrecisionDecimalPlaces( 0 )
, mInternalClipboard( 0 )
, mShowProjectionTab( false )
, mPythonUtils( 0 )
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsmaptopixel.h
Expand Up @@ -41,7 +41,7 @@ class CORE_EXPORT QgsMapToPixel
* @param xmin Minimum x value of the map canvas
* @deprecated in 2.8, use version with all parameters
*/
QgsMapToPixel( double mapUnitsPerPixel, double height = 0, double ymin = 0, double xmin = 0 );
Q_DECL_DEPRECATED QgsMapToPixel( double mapUnitsPerPixel, double height = 0, double ymin = 0, double xmin = 0 );

/* Constructor
* @param mapUnitsPerPixel Map units per pixel
Expand Down
4 changes: 2 additions & 2 deletions src/core/qgssnapper.cpp
Expand Up @@ -44,10 +44,10 @@ QgsSnapper::~QgsSnapper()
int QgsSnapper::snapPoint( const QPoint& startPoint, QList<QgsSnappingResult>& snappingResult, const QList<QgsPoint>& excludePoints )
{
QgsPoint mapCoordPoint = mMapSettings.mapToPixel().toMapCoordinates( startPoint.x(), startPoint.y() );
return snapPoint( mapCoordPoint, snappingResult, excludePoints );
return snapMapPoint( mapCoordPoint, snappingResult, excludePoints );
}

int QgsSnapper::snapPoint( const QgsPoint& mapCoordPoint, QList<QgsSnappingResult>& snappingResult, const QList<QgsPoint>& excludePoints )
int QgsSnapper::snapMapPoint( const QgsPoint& mapCoordPoint, QList<QgsSnappingResult>& snappingResult, const QList<QgsPoint>& excludePoints )
{
snappingResult.clear();

Expand Down
8 changes: 5 additions & 3 deletions src/core/qgssnapper.h
Expand Up @@ -95,26 +95,28 @@ class CORE_EXPORT QgsSnapper
};

//!@ deprecated since 2.4 - use constructor with QgsMapSettings
Q_DECL_DEPRECATED QgsSnapper( QgsMapRenderer* mapRender );
Q_DECL_DEPRECATED QgsSnapper( QgsMapRenderer *mapRender );

explicit QgsSnapper( const QgsMapSettings& mapSettings );

~QgsSnapper();

/** Does the snapping operation
@param startPoint the start point for snapping (in pixel coordinates)
@param snappingResult the list where the results are inserted (everything in map coordinate system)
@param excludePoints a list with (map coordinate) points that should be excluded in the snapping result. Useful e.g. for vertex moves where a vertex should not be snapped to its original position
@return 0 in case of success
@deprecated
*/
Q_DECL_DEPRECATED int snapPoint( const QPoint& startPoint, QList<QgsSnappingResult>& snappingResult, const QList<QgsPoint>& excludePoints = QList<QgsPoint>() );
Q_DECL_DEPRECATED int snapPoint( const QPoint &startPoint, QList<QgsSnappingResult> &snappingResult, const QList<QgsPoint> &excludePoints = QList<QgsPoint>() );

/** Does the snapping operation
@param mapCoordPoint the start point for snapping (in map coordinates)
@param snappingResult the list where the results are inserted (everything in map coordinate system)
@param excludePoints a list with (map coordinate) points that should be excluded in the snapping result. Useful e.g. for vertex moves where a vertex should not be snapped to its original position
@return 0 in case of success
*/
int snapPoint( const QgsPoint& mapCoordPoint, QList<QgsSnappingResult>& snappingResult, const QList<QgsPoint>& excludePoints = QList<QgsPoint>() );
int snapMapPoint( const QgsPoint &mapCoordPoint, QList<QgsSnappingResult> &snappingResult, const QList<QgsPoint> &excludePoints = QList<QgsPoint>() );

//setters
void setSnapLayers( const QList<QgsSnapper::SnapLayer>& snapLayers );
Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgsmapcanvassnapper.cpp
Expand Up @@ -108,7 +108,7 @@ int QgsMapCanvasSnapper::snapToCurrentLayer( const QPoint& p, QList<QgsSnappingR
snapLayers.append( snapLayer );
mSnapper->setSnapLayers( snapLayers );

if ( mSnapper->snapPoint( p, results, excludePoints ) != 0 )
if ( mSnapper->snapMapPoint( p, results, excludePoints ) != 0 )
return 4;

return 0;
Expand Down Expand Up @@ -257,7 +257,7 @@ int QgsMapCanvasSnapper::snapToBackgroundLayers( const QgsPoint& point, QList<Qg

mSnapper->setSnapLayers( snapLayers );

if ( mSnapper->snapPoint( point, results, excludePoints ) != 0 )
if ( mSnapper->snapMapPoint( point, results, excludePoints ) != 0 )
return 4;

if ( intersectionSnapping != 1 )
Expand Down

1 comment on commit 0593ef6

@m-kuhn
Copy link
Member

@m-kuhn m-kuhn commented on 0593ef6 Feb 9, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much better, thanks a lot!

Please sign in to comment.