QGIS API Documentation  2.99.0-Master (283d45a)
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 
19 #include "qgis_core.h"
20 #include "qgis.h"
21 
22 class QgsMapSettings;
23 class QgsMapLayer;
24 class QgsPoint;
25 
29 class CORE_EXPORT QgsTolerance
30 {
31 
32  public:
33 
36  enum UnitType
37  {
43  ProjectUnits
44  };
45 
52  static double vertexSearchRadius( const QgsMapSettings& mapSettings );
53 
59  static double vertexSearchRadius( QgsMapLayer* layer, const QgsMapSettings& mapSettings );
60 
66  static double defaultTolerance( QgsMapLayer* layer, const QgsMapSettings& mapSettings );
67 
77  static double toleranceInProjectUnits( double tolerance, QgsMapLayer* layer, const QgsMapSettings& mapSettings, QgsTolerance::UnitType units );
78 
87  static double toleranceInMapUnits( double tolerance, QgsMapLayer* layer, const QgsMapSettings& mapSettings, UnitType units = LayerUnits );
88 
89  private:
90  static double computeMapUnitPerPixel( QgsMapLayer* layer, const QgsMapSettings& mapSettings );
91  static QgsPoint toLayerCoordinates( QgsMapLayer* layer, const QgsMapSettings& mapSettings, QPoint point );
92 
93 };
94 
95 #endif
Base class for all map layer types.
Definition: qgsmaplayer.h:50
UnitType
Type of unit of tolerance value from settings.
Definition: qgstolerance.h:36
The QgsMapSettings class contains configuration for rendering of the map.
Pixels unit of tolerance.
Definition: qgstolerance.h:41
This is the class is providing tolerance value in map unit values.
Definition: qgstolerance.h:29
A class to represent a point.
Definition: qgspoint.h:143
Layer unit value.
Definition: qgstolerance.h:39