Skip to content

Commit 0593ef6

Browse files
committed
rename new QgsSnapper::snapPoint method to snapMapPoint and restore python name
of deprecated old version (fixes #12153)
1 parent 90cc725 commit 0593ef6

File tree

7 files changed

+20
-18
lines changed

7 files changed

+20
-18
lines changed

python/core/qgsmaptopixel.sip

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@ class QgsMapToPixel
1313
public:
1414
/* Constructor
1515
* @param mapUnitsPerPixel Map units per pixel
16-
* @param ymax Maximum y value of the map canvas
16+
* @param height Map canvas height, in pixels
1717
* @param ymin Minimum y value of the map canvas
1818
* @param xmin Minimum x value of the map canvas
1919
*/
20-
QgsMapToPixel( double mapUnitsPerPixel = 0, double ymax = 0, double ymin = 0,
21-
double xmin = 0 );
20+
QgsMapToPixel( double mapUnitsPerPixel = 0, double height = 0, double ymin = 0, double xmin = 0 );
2221
//! destructor
2322
~QgsMapToPixel();
2423
/*! Transform the point from map (world) coordinates to device coordinates
@@ -50,6 +49,7 @@ class QgsMapToPixel
5049
transform.
5150
@note not available in python bindings
5251
*/
52+
// template <class T>
5353
// void transformInPlace( QVector<double>& x, QVector<double>& y ) const;
5454

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

129129
//! String representation of the parameters used in the transform
130-
QString showParameters();
130+
QString showParameters() const;
131131

132132
};
133-
134-

python/core/qgssnapper.sip

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,26 +70,28 @@ class QgsSnapper
7070
};
7171

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

7575
explicit QgsSnapper( const QgsMapSettings& mapSettings );
7676

7777
~QgsSnapper();
78+
7879
/** Does the snapping operation
7980
@param startPoint the start point for snapping (in pixel coordinates)
8081
@param snappingResult the list where the results are inserted (everything in map coordinate system)
8182
@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
8283
@return 0 in case of success
8384
@deprecated
8485
*/
85-
int snapPoint( const QPoint& startPoint, QList<QgsSnappingResult>& snappingResult /Out/, const QList<QgsPoint>& excludePoints = QList<QgsPoint>() ) /Deprecated,PyName=snapPointOld/;
86+
int snapPoint( const QPoint &startPoint, QList<QgsSnappingResult> &snappingResult /Out/, const QList<QgsPoint> &excludePoints = QList<QgsPoint>() ) /Deprecated/;
87+
8688
/** Does the snapping operation
8789
@param mapCoordPoint the start point for snapping (in map coordinates)
8890
@param snappingResult the list where the results are inserted (everything in map coordinate system)
8991
@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
9092
@return 0 in case of success
9193
*/
92-
int snapPoint( const QgsPoint& mapCoordPoint, QList<QgsSnappingResult>& snappingResult, const QList<QgsPoint>& excludePoints = QList<QgsPoint>() );
94+
int snapMapPoint( const QgsPoint &mapCoordPoint, QList<QgsSnappingResult> &snappingResult /Out/, const QList<QgsPoint> &excludePoints = QList<QgsPoint>() );
9395

9496
//setters
9597
void setSnapLayers( const QList<QgsSnapper::SnapLayer>& snapLayers );

src/app/qgisapp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,6 @@ QgisApp *QgisApp::smInstance = 0;
478478
// constructor starts here
479479
QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent, Qt::WindowFlags fl )
480480
: QMainWindow( parent, fl )
481-
, mMousePrecisionDecimalPlaces( 0 )
482481
#ifdef Q_OS_WIN
483482
, mSkipNextContextMenuEvent( 0 )
484483
#endif
@@ -506,6 +505,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
506505
, mLayerTreeCanvasBridge( 0 )
507506
, mPreviousNonZoomMapTool( 0 )
508507
, mSplash( splash )
508+
, mMousePrecisionDecimalPlaces( 0 )
509509
, mInternalClipboard( 0 )
510510
, mShowProjectionTab( false )
511511
, mPythonUtils( 0 )

src/core/qgsmaptopixel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class CORE_EXPORT QgsMapToPixel
4141
* @param xmin Minimum x value of the map canvas
4242
* @deprecated in 2.8, use version with all parameters
4343
*/
44-
QgsMapToPixel( double mapUnitsPerPixel, double height = 0, double ymin = 0, double xmin = 0 );
44+
Q_DECL_DEPRECATED QgsMapToPixel( double mapUnitsPerPixel, double height = 0, double ymin = 0, double xmin = 0 );
4545

4646
/* Constructor
4747
* @param mapUnitsPerPixel Map units per pixel

src/core/qgssnapper.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ QgsSnapper::~QgsSnapper()
4444
int QgsSnapper::snapPoint( const QPoint& startPoint, QList<QgsSnappingResult>& snappingResult, const QList<QgsPoint>& excludePoints )
4545
{
4646
QgsPoint mapCoordPoint = mMapSettings.mapToPixel().toMapCoordinates( startPoint.x(), startPoint.y() );
47-
return snapPoint( mapCoordPoint, snappingResult, excludePoints );
47+
return snapMapPoint( mapCoordPoint, snappingResult, excludePoints );
4848
}
4949

50-
int QgsSnapper::snapPoint( const QgsPoint& mapCoordPoint, QList<QgsSnappingResult>& snappingResult, const QList<QgsPoint>& excludePoints )
50+
int QgsSnapper::snapMapPoint( const QgsPoint& mapCoordPoint, QList<QgsSnappingResult>& snappingResult, const QList<QgsPoint>& excludePoints )
5151
{
5252
snappingResult.clear();
5353

src/core/qgssnapper.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,26 +95,28 @@ class CORE_EXPORT QgsSnapper
9595
};
9696

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

100100
explicit QgsSnapper( const QgsMapSettings& mapSettings );
101101

102102
~QgsSnapper();
103+
103104
/** Does the snapping operation
104105
@param startPoint the start point for snapping (in pixel coordinates)
105106
@param snappingResult the list where the results are inserted (everything in map coordinate system)
106107
@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
107108
@return 0 in case of success
108109
@deprecated
109110
*/
110-
Q_DECL_DEPRECATED int snapPoint( const QPoint& startPoint, QList<QgsSnappingResult>& snappingResult, const QList<QgsPoint>& excludePoints = QList<QgsPoint>() );
111+
Q_DECL_DEPRECATED int snapPoint( const QPoint &startPoint, QList<QgsSnappingResult> &snappingResult, const QList<QgsPoint> &excludePoints = QList<QgsPoint>() );
112+
111113
/** Does the snapping operation
112114
@param mapCoordPoint the start point for snapping (in map coordinates)
113115
@param snappingResult the list where the results are inserted (everything in map coordinate system)
114116
@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
115117
@return 0 in case of success
116118
*/
117-
int snapPoint( const QgsPoint& mapCoordPoint, QList<QgsSnappingResult>& snappingResult, const QList<QgsPoint>& excludePoints = QList<QgsPoint>() );
119+
int snapMapPoint( const QgsPoint &mapCoordPoint, QList<QgsSnappingResult> &snappingResult, const QList<QgsPoint> &excludePoints = QList<QgsPoint>() );
118120

119121
//setters
120122
void setSnapLayers( const QList<QgsSnapper::SnapLayer>& snapLayers );

src/gui/qgsmapcanvassnapper.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ int QgsMapCanvasSnapper::snapToCurrentLayer( const QPoint& p, QList<QgsSnappingR
108108
snapLayers.append( snapLayer );
109109
mSnapper->setSnapLayers( snapLayers );
110110

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

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

258258
mSnapper->setSnapLayers( snapLayers );
259259

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

263263
if ( intersectionSnapping != 1 )

0 commit comments

Comments
 (0)