QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
31 const QgsPointXY ptMapCenterRightMU( ptMapCenterMU.
x() + distMU, ptMapCenterMU.
y() );
34 const double distLU = std::sqrt( ptMapCenterLU.
sqrDist( ptMapCenterRightLU ) );
35 const double ratio = distMU / distLU;
44 else if ( units ==
Pixels )
49 return tolerance *
_ratioMU2LU( mapSettings, layer );
61 else if ( units ==
Pixels )
63 const double layerUnitsPerPixel = computeMapUnitPerPixel( layer, mapSettings );
64 return tolerance * layerUnitsPerPixel;
69 return tolerance /
_ratioMU2LU( mapSettings, layer );
102 const QgsPointXY p1 = toLayerCoordinates( layer, mapSettings, QPoint( 0, 1 ) );
103 const QgsPointXY p2 = toLayerCoordinates( layer, mapSettings, QPoint( 0, 2 ) );
104 const QgsPointXY p3 = toLayerCoordinates( layer, mapSettings, QPoint( 1, 0 ) );
105 const QgsPointXY p4 = toLayerCoordinates( layer, mapSettings, QPoint( 2, 0 ) );
106 const double x = p1.
sqrDist( p2 );
107 const double y = p3.
sqrDist( p4 );
110 return std::sqrt( x );
114 return std::sqrt( y );
static double defaultTolerance(QgsMapLayer *layer, const QgsMapSettings &mapSettings)
Static function to get default tolerance value for a layer.
QgsPointXY mapToLayerCoordinates(const QgsMapLayer *layer, QgsPointXY point) const
transform point coordinates from output CRS to layer's CRS
QgsPointXY center() const SIP_HOLDGIL
Returns the center point of the rectangle.
static const QgsSettingsEntryEnumFlag< QgsTolerance::UnitType > settingsDigitizingSearchRadiusVertexEditUnit
Settings entry digitizing search radius vertex edit unit.
double mapUnitsPerPixel() const
Returns the distance in geographical coordinates that equals to one pixel in the map.
static const QgsSettingsEntryEnumFlag< QgsTolerance::UnitType > settingsDigitizingDefaultSnappingToleranceUnit
Settings entry digitizing default snapping tolerance unit.
@ ProjectUnits
Map (project) units. Added in 2.8.
QgsPointXY toMapCoordinates(int x, int y) const
Transforms device coordinates to map (world) coordinates.
double sqrDist(double x, double y) const SIP_HOLDGIL
Returns the squared distance between this point a specified x, y coordinate.
double _ratioMU2LU(const QgsMapSettings &mapSettings, QgsMapLayer *layer)
UnitType
Type of unit of tolerance value from settings.
@ Pixels
Pixels unit of tolerance.
static double vertexSearchRadius(const QgsMapSettings &mapSettings)
Static function to get vertex tolerance value.
@ LayerUnits
Layer unit value.
static const QgsSettingsEntryDouble settingsDigitizingSearchRadiusVertexEdit
Settings entry digitizing search radius vertex edit.
A class to represent a 2D point.
static double toleranceInMapUnits(double tolerance, QgsMapLayer *layer, const QgsMapSettings &mapSettings, UnitType units=LayerUnits)
Static function to translate tolerance value into layer units.
Base class for all map layer types. This is the base class for all map layer types (vector,...
static double toleranceInProjectUnits(double tolerance, QgsMapLayer *layer, const QgsMapSettings &mapSettings, QgsTolerance::UnitType units)
Static function to translate tolerance value into map units.
The QgsMapSettings class contains configuration for rendering of the map. The rendering itself is don...
QgsRectangle visibleExtent() const
Returns the actual extent derived from requested extent that takes output image size into account.
static const QgsSettingsEntryDouble settingsDigitizingDefaultSnappingTolerance
Settings entry digitizing default snapping tolerance.
const QgsMapToPixel & mapToPixel() const
T value(const QString &dynamicKeyPart=QString()) const
Returns settings value.