Skip to content
Permalink
Browse files

rename new QgsSnapper::snapPoint method to snapMapPoint and restore p…

…ython name

of deprecated old version (fixes #12153)
  • Loading branch information
jef-n committed Feb 8, 2015
1 parent 90cc725 commit 0593ef6a2635876f31453a6133fe5ebaa0838f3b
@@ -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
@@ -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;
@@ -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;

};


@@ -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 );
@@ -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
@@ -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 )
@@ -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
@@ -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();

@@ -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 );
@@ -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;
@@ -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 )

1 comment on commit 0593ef6

@m-kuhn

This comment has been minimized.

Copy link
Member

m-kuhn commented on 0593ef6 Feb 9, 2015

Much better, thanks a lot!

Please sign in to comment.
You can’t perform that action at this time.