28 QgsPoint ptMapCenterRightMU( ptMapCenterMU.
x() + distMU, ptMapCenterMU.
y() );
31 double distLU = sqrt( ptMapCenterLU.sqrDist( ptMapCenterRightLU ) );
32 double ratio = distMU / distLU;
41 else if ( units ==
Pixels )
46 return tolerance *
_ratioMU2LU( mapSettings, layer );
58 else if ( units ==
Pixels )
60 double layerUnitsPerPixel = computeMapUnitPerPixel( layer, mapSettings );
61 return tolerance * layerUnitsPerPixel;
66 return tolerance /
_ratioMU2LU( mapSettings, layer );
78 double tolerance = settings.
value(
"/qgis/digitizing/search_radius_vertex_edit", 10 ).
toDouble();
88 double tolerance = settings.
value(
"/qgis/digitizing/search_radius_vertex_edit", 10 ).
toDouble();
101 double tolerance = settings.
value(
"/qgis/digitizing/default_snapping_tolerance", 0 ).
toDouble();
124 QgsPoint p1 = toLayerCoordinates( layer, mapSettings,
QPoint( 0, 1 ) );
125 QgsPoint p2 = toLayerCoordinates( layer, mapSettings,
QPoint( 0, 2 ) );
126 QgsPoint p3 = toLayerCoordinates( layer, mapSettings,
QPoint( 1, 0 ) );
127 QgsPoint p4 = toLayerCoordinates( layer, mapSettings,
QPoint( 2, 0 ) );
const QgsMapSettings & mapSettings()
bridge to QgsMapSettings
Base class for all map layer types.
QgsRectangle visibleExtent() const
Return the actual extent derived from requested extent that takes takes output image size into accoun...
UnitType
Type of unit of tolerance value from settings.
bool hasCrsTransformEnabled() const
returns true if projections are enabled for this layer set
const QgsMapToPixel & mapToPixel() const
A non GUI class for rendering a map layer set onto a QPainter.
static double toleranceInMapUnits(double tolerance, QgsMapLayer *layer, const QgsMapSettings &mapSettings, UnitType units=LayerUnits)
Static function to translate tolerance value into layer units.
QgsPoint mapToLayerCoordinates(QgsMapLayer *theLayer, QgsPoint point) const
transform point coordinates from output CRS to layer's CRS
double sqrDist(double x, double y) const
Returns the squared distance between this point and x,y.
The QgsMapSettings class contains configuration for rendering of the map.
int toInt(bool *ok) const
Pixels unit of tolerance.
double mapUnitsPerPixel() const
Return the distance in geographical coordinates that equals to one pixel in the map.
static double defaultTolerance(QgsMapLayer *layer, const QgsMapSettings &mapSettings)
Static function to get default tolerance value for a layer.
A class to represent a point.
QgsPoint toMapCoordinates(int x, int y) const
static double vertexSearchRadius(const QgsMapSettings &mapSettings)
Static function to get vertex tolerance value.
QVariant value(const QString &key, const QVariant &defaultValue) const
static double toleranceInProjectUnits(double tolerance, QgsMapLayer *layer, const QgsMapSettings &mapSettings, QgsTolerance::UnitType units)
Static function to translate tolerance value into map units.
double _ratioMU2LU(const QgsMapSettings &mapSettings, QgsMapLayer *layer)
double toDouble(bool *ok) const
QgsPoint center() const
Center point of the rectangle.