16 #ifndef QGSMAPTOOLIDENTIFY_H
17 #define QGSMAPTOOLIDENTIFY_H
56 DefaultQgsSetting = -1,
62 Q_ENUM( IdentifyMode )
70 AllLayers = VectorLayer | RasterLayer | MeshLayer | VectorTileLayer
72 Q_DECLARE_FLAGS( LayerType, Type )
81 : mLayer( layer ), mFeature( feature ), mDerivedAttributes( derivedAttributes ) {}
83 IdentifyResult(
QgsMapLayer *layer,
const QString &label,
const QMap< QString, QString > &attributes,
const QMap< QString, QString > &derivedAttributes )
84 : mLayer( layer ), mLabel( label ), mAttributes( attributes ), mDerivedAttributes( derivedAttributes ) {}
87 : mLayer( layer ), mLabel( label ), mFields( fields ), mFeature( feature ), mDerivedAttributes( derivedAttributes ) {}
118 QList<QgsMapToolIdentify::IdentifyResult> identify(
int x,
int y,
const QList<QgsMapLayer *> &layerList = QList<QgsMapLayer *>(), IdentifyMode mode = DefaultQgsSetting );
130 QList<QgsMapToolIdentify::IdentifyResult> identify(
int x,
int y, IdentifyMode mode, LayerType layerType = AllLayers );
133 QList<QgsMapToolIdentify::IdentifyResult> identify(
const QgsGeometry &geometry, IdentifyMode mode, LayerType layerType );
135 QList<QgsMapToolIdentify::IdentifyResult> identify(
const QgsGeometry &geometry, IdentifyMode mode,
const QList<QgsMapLayer *> &layerList, LayerType layerType );
165 QList<QgsMapToolIdentify::IdentifyResult> identify(
int x,
int y,
IdentifyMode mode,
const QList<QgsMapLayer *> &layerList, LayerType layerType = AllLayers );
170 bool identifyLayer( QList<QgsMapToolIdentify::IdentifyResult> *results,
QgsMapLayer *layer,
const QgsPointXY &point,
const QgsRectangle &viewExtent,
double mapUnitsPerPixel, QgsMapToolIdentify::LayerType layerType = AllLayers );
172 bool identifyRasterLayer( QList<QgsMapToolIdentify::IdentifyResult> *results,
QgsRasterLayer *layer,
QgsPointXY point,
const QgsRectangle &viewExtent,
double mapUnitsPerPixel );
173 bool identifyVectorLayer( QList<QgsMapToolIdentify::IdentifyResult> *results,
QgsVectorLayer *layer,
const QgsPointXY &point );
181 bool identifyMeshLayer( QList<QgsMapToolIdentify::IdentifyResult> *results,
QgsMeshLayer *layer,
const QgsPointXY &point );
184 QMap< QString, QString > derivedAttributesForPoint(
const QgsPoint &point );
198 void setCanvasPropertiesOverrides(
double searchRadiusMapUnits );
205 void restoreCanvasPropertiesOverrides();
209 bool identifyLayer( QList<QgsMapToolIdentify::IdentifyResult> *results,
QgsMapLayer *layer,
const QgsGeometry &geometry,
const QgsRectangle &viewExtent,
double mapUnitsPerPixel, QgsMapToolIdentify::LayerType layerType = AllLayers );
210 bool identifyRasterLayer( QList<QgsMapToolIdentify::IdentifyResult> *results,
QgsRasterLayer *layer,
const QgsGeometry &geometry,
const QgsRectangle &viewExtent,
double mapUnitsPerPixel );
211 bool identifyVectorLayer( QList<QgsMapToolIdentify::IdentifyResult> *results,
QgsVectorLayer *layer,
const QgsGeometry &geometry );
212 bool identifyMeshLayer( QList<QgsMapToolIdentify::IdentifyResult> *results,
QgsMeshLayer *layer,
const QgsGeometry &geometry );
234 QString formatDistance(
double distance )
const;
241 QString formatArea(
double area )
const;
265 void closestPointAttributes(
const QgsAbstractGeometry &geometry,
const QgsPointXY &layerPoint, QMap< QString, QString > &derivedAttributes );
267 QString formatCoordinate(
const QgsPointXY &canvasPoint )
const;
268 QString formatXCoordinate(
const QgsPointXY &canvasPoint )
const;
269 QString formatYCoordinate(
const QgsPointXY &canvasPoint )
const;
274 double mLastMapUnitsPerPixel;
278 int mCoordinatePrecision;
280 double mOverrideCanvasSearchRadius = -1;