QGIS API Documentation  2.6.0-Brighton
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgstolerance.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgstolerance.h - wrapper for tolerance handling
3  ----------------------
4  begin : March 2009
5  copyright : (C) 2009 by Richard Kostecky
6  email : csf.kostej at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSTOLERANCE_H
17 #define QGSTOLERANCE_H
18 #include "qgsmaptopixel.h"
19 #include "qgsmaprenderer.h"
20 #include "qgsmaplayer.h"
21 #include "qgspoint.h"
22 
26 class CORE_EXPORT QgsTolerance
27 {
28 
29  public:
31  enum UnitType
32  {
36  Pixels
37  };
38 
44  static double vertexSearchRadius( QgsMapLayer* layer, const QgsMapSettings& mapSettings );
45 
51 
52  Q_DECL_DEPRECATED static double vertexSearchRadius( QgsMapLayer* layer, QgsMapRenderer* renderer );
53 
59  static double defaultTolerance( QgsMapLayer* layer, const QgsMapSettings& mapSettings );
60 
66 
67  Q_DECL_DEPRECATED static double defaultTolerance( QgsMapLayer* layer, QgsMapRenderer* renderer );
68 
77  static double toleranceInMapUnits( double tolerance, QgsMapLayer* layer, const QgsMapSettings& mapSettings, UnitType units = MapUnits );
78 
87 
88  Q_DECL_DEPRECATED static double toleranceInMapUnits( double tolerance, QgsMapLayer* layer, QgsMapRenderer* renderer, UnitType units = MapUnits );
89 
90  private:
91  static double computeMapUnitPerPixel( QgsMapLayer* layer, const QgsMapSettings& mapSettings );
92  static QgsPoint toLayerCoordinates( QgsMapLayer* layer, const QgsMapSettings& mapSettings, const QPoint& point );
93 
94 };
95 
96 #endif