QGIS API Documentation  2.3.0-Master
 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 
28 class CORE_EXPORT QgsTolerance
29 {
30 
31  public:
33  enum UnitType
34  {
38  Pixels
39  };
40 
46  static double vertexSearchRadius( QgsMapLayer* layer, const QgsMapSettings& mapSettings );
47 
53  Q_DECL_DEPRECATED static double vertexSearchRadius( QgsMapLayer* layer, QgsMapRenderer* renderer );
55 
61  static double defaultTolerance( QgsMapLayer* layer, const QgsMapSettings& mapSettings );
62 
68  Q_DECL_DEPRECATED static double defaultTolerance( QgsMapLayer* layer, QgsMapRenderer* renderer );
70 
79  static double toleranceInMapUnits( double tolerance, QgsMapLayer* layer, const QgsMapSettings& mapSettings, UnitType units = MapUnits );
80 
89  Q_DECL_DEPRECATED static double toleranceInMapUnits( double tolerance, QgsMapLayer* layer, QgsMapRenderer* renderer, UnitType units = MapUnits );
91 
92  private:
93  static double computeMapUnitPerPixel( QgsMapLayer* layer, const QgsMapSettings& mapSettings );
94  static QgsPoint toLayerCoordinates( QgsMapLayer* layer, const QgsMapSettings& mapSettings, const QPoint& point );
95 
96 };
97 
98 #endif
Base class for all map layer types.
Definition: qgsmaplayer.h:46
UnitType
Type of unit of tolerance value from settings.
Definition: qgstolerance.h:33
A non GUI class for rendering a map layer set onto a QPainter.
Map unit value.
Definition: qgstolerance.h:36
This is the class is providing tolerance value in map unit values.
Definition: qgstolerance.h:28
A class to represent a point geometry.
Definition: qgspoint.h:63