Quantum GIS API Documentation
1.7.4
|
00001 /*************************************************************************** 00002 qgstolerance.h - wrapper for tolerance handling 00003 ---------------------- 00004 begin : March 2009 00005 copyright : (C) 2009 by Richard Kostecky 00006 email : csf.kostej at gmail dot com 00007 *************************************************************************** 00008 * * 00009 * This program is free software; you can redistribute it and/or modify * 00010 * it under the terms of the GNU General Public License as published by * 00011 * the Free Software Foundation; either version 2 of the License, or * 00012 * (at your option) any later version. * 00013 * * 00014 ***************************************************************************/ 00015 00016 #ifndef QGSTOLERANCE_H 00017 #define QGSTOLERANCE_H 00018 #include "qgsmaptopixel.h" 00019 #include "qgsmaprenderer.h" 00020 #include "qgsmaplayer.h" 00021 #include "qgspoint.h" 00022 00028 class CORE_EXPORT QgsTolerance 00029 { 00030 00031 public: 00033 enum UnitType 00034 { 00036 MapUnits, 00038 Pixels 00039 }; 00040 00046 static double vertexSearchRadius( QgsMapLayer* layer, QgsMapRenderer* renderer ); 00047 00053 static double defaultTolerance( QgsMapLayer* layer, QgsMapRenderer* renderer ); 00054 00063 static double toleranceInMapUnits( double tolerance, QgsMapLayer* layer, QgsMapRenderer* renderer, UnitType units = MapUnits ); 00064 00065 private: 00066 static double computeMapUnitPerPixel( QgsMapLayer* layer, QgsMapRenderer* renderer ); 00067 static QgsPoint toLayerCoordinates( QgsMapLayer* layer, QgsMapRenderer* renderer, const QPoint& point ); 00068 00069 }; 00070 00071 #endif