16 #ifndef QGSMAPTOOLIDENTIFY_H
17 #define QGSMAPTOOLIDENTIFY_H
55 DefaultQgsSetting = -1,
61 Q_ENUM( IdentifyMode )
71 Q_DECLARE_FLAGS( LayerType, Type )
80 : mLayer( layer ), mFeature( feature ), mDerivedAttributes( derivedAttributes ) {}
82 IdentifyResult(
QgsMapLayer *layer,
const QString &label,
const QMap< QString, QString > &attributes,
const QMap< QString, QString > &derivedAttributes )
83 : mLayer( layer ), mLabel( label ), mAttributes( attributes ), mDerivedAttributes( derivedAttributes ) {}
86 : mLayer( layer ), mLabel( label ), mFields( fields ), mFeature( feature ), mDerivedAttributes( derivedAttributes ) {}
116 QList<QgsMapToolIdentify::IdentifyResult> identify(
int x,
int y,
const QList<QgsMapLayer *> &layerList = QList<QgsMapLayer *>(), IdentifyMode mode = DefaultQgsSetting );
128 QList<QgsMapToolIdentify::IdentifyResult> identify(
int x,
int y, IdentifyMode mode, LayerType layerType = AllLayers );
131 QList<QgsMapToolIdentify::IdentifyResult> identify(
const QgsGeometry &geometry, IdentifyMode mode, LayerType layerType );
133 QList<QgsMapToolIdentify::IdentifyResult> identify(
const QgsGeometry &geometry, IdentifyMode mode,
const QList<QgsMapLayer *> &layerList, LayerType layerType );
146 void identifyProgress(
int,
int );
147 void identifyMessage(
const QString & );
148 void changedRasterResults( QList<QgsMapToolIdentify::IdentifyResult> & );
163 QList<QgsMapToolIdentify::IdentifyResult> identify(
int x,
int y, IdentifyMode mode,
const QList<QgsMapLayer *> &layerList, LayerType layerType = AllLayers );
168 bool identifyLayer( QList<QgsMapToolIdentify::IdentifyResult> *results,
QgsMapLayer *layer,
const QgsPointXY &point,
const QgsRectangle &viewExtent,
double mapUnitsPerPixel, QgsMapToolIdentify::LayerType layerType = AllLayers );
170 bool identifyRasterLayer( QList<QgsMapToolIdentify::IdentifyResult> *results,
QgsRasterLayer *layer,
QgsPointXY point,
const QgsRectangle &viewExtent,
double mapUnitsPerPixel );
171 bool identifyVectorLayer( QList<QgsMapToolIdentify::IdentifyResult> *results,
QgsVectorLayer *layer,
const QgsPointXY &point );
179 bool identifyMeshLayer( QList<QgsMapToolIdentify::IdentifyResult> *results,
QgsMeshLayer *layer,
const QgsPointXY &point );
182 QMap< QString, QString > derivedAttributesForPoint(
const QgsPoint &point );
196 void setCanvasPropertiesOverrides(
double searchRadiusMapUnits );
203 void restoreCanvasPropertiesOverrides();
207 bool identifyLayer( QList<QgsMapToolIdentify::IdentifyResult> *results,
QgsMapLayer *layer,
const QgsGeometry &geometry,
const QgsRectangle &viewExtent,
double mapUnitsPerPixel, QgsMapToolIdentify::LayerType layerType = AllLayers );
208 bool identifyRasterLayer( QList<QgsMapToolIdentify::IdentifyResult> *results,
QgsRasterLayer *layer,
const QgsGeometry &geometry,
const QgsRectangle &viewExtent,
double mapUnitsPerPixel );
209 bool identifyVectorLayer( QList<QgsMapToolIdentify::IdentifyResult> *results,
QgsVectorLayer *layer,
const QgsGeometry &geometry );
210 bool identifyMeshLayer( QList<QgsMapToolIdentify::IdentifyResult> *results,
QgsMeshLayer *layer,
const QgsGeometry &geometry );
232 QString formatDistance(
double distance )
const;
239 QString formatArea(
double area )
const;
263 void closestPointAttributes(
const QgsAbstractGeometry &geometry,
const QgsPointXY &layerPoint, QMap< QString, QString > &derivedAttributes );
265 QString formatCoordinate(
const QgsPointXY &canvasPoint )
const;
266 QString formatXCoordinate(
const QgsPointXY &canvasPoint )
const;
267 QString formatYCoordinate(
const QgsPointXY &canvasPoint )
const;
272 double mLastMapUnitsPerPixel;
276 int mCoordinatePrecision;
278 double mOverrideCanvasSearchRadius = -1;
281 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsMapToolIdentify::LayerType )