QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
qgsquickidentifykit.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsquickidentifykit.h
3  ---------------------
4  Date : 30.8.2016
5  Copyright : (C) 2016 by Matthias Kuhn
6  Email : matthias (at) opengis.ch
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSQUICKIDENTIFYKIT_H
17 #define QGSQUICKIDENTIFYKIT_H
18 
19 #include <QObject>
20 #include <QPair>
21 
22 #include "qgsfeature.h"
23 #include "qgsmapsettings.h"
24 #include "qgspoint.h"
25 #include "qgsrendercontext.h"
26 
27 #include "qgis_quick.h"
29 
30 class QgsMapLayer;
32 class QgsVectorLayer;
33 
46 class QUICK_EXPORT QgsQuickIdentifyKit : public QObject
47 {
48  Q_OBJECT
49 
53  Q_PROPERTY( QgsQuickMapSettings *mapSettings READ mapSettings WRITE setMapSettings NOTIFY mapSettingsChanged )
54 
55 
60  Q_PROPERTY( double searchRadiusMm READ searchRadiusMm WRITE setSearchRadiusMm NOTIFY searchRadiusMmChanged )
61 
62 
67  Q_PROPERTY( int featuresLimit READ featuresLimit WRITE setFeaturesLimit NOTIFY featuresLimitChanged )
68 
69 
74  Q_PROPERTY( IdentifyMode identifyMode MEMBER mIdentifyMode NOTIFY identifyModeChanged )
75 
76  public:
77 
82  {
83 
88  TopDownAll = 0,
89 
94  TopDownStopAtFirst
95  };
96  Q_ENUM( IdentifyMode )
97 
98 
99  explicit QgsQuickIdentifyKit( QObject *parent = nullptr );
100 
102  QgsQuickMapSettings *mapSettings() const;
103 
105  void setMapSettings( QgsQuickMapSettings *mapSettings );
106 
108  double searchRadiusMm() const;
109 
111  void setSearchRadiusMm( double searchRadiusMm );
112 
114  int featuresLimit() const;
115 
117  void setFeaturesLimit( int limit );
118 
132  Q_INVOKABLE QgsQuickFeatureLayerPair identifyOne( const QPointF &point, QgsVectorLayer *layer = nullptr );
133 
148  Q_INVOKABLE QgsQuickFeatureLayerPairs identify( const QPointF &point, QgsVectorLayer *layer = nullptr );
149 
150  signals:
159 
160  private:
161  QgsQuickMapSettings *mMapSettings = nullptr; // not owned
162 
163  double searchRadiusMU( const QgsRenderContext &context ) const;
164  double searchRadiusMU() const;
165 
166  QgsRectangle toLayerCoordinates( QgsMapLayer *layer, const QgsRectangle &rect ) const;
167  QgsFeatureList identifyVectorLayer( QgsVectorLayer *layer, const QgsPointXY &point ) const;
168 
169  double mSearchRadiusMm = 5;
170  int mFeaturesLimit = 100;
171  IdentifyMode mIdentifyMode = IdentifyMode::TopDownAll;
172 };
173 
174 #endif // QGSQUICKIDENTIFYKIT_H
qgsquickfeaturelayerpair.h
QgsQuickIdentifyKit::mapSettingsChanged
void mapSettingsChanged()
Map settings.
QgsQuickIdentifyKit::featuresLimitChanged
void featuresLimitChanged()
Maximum number of features returned from the QgsQuickIdentifyKit::identify()
qgsfeature.h
QgsRenderContext
Contains information about the context of a rendering operation.
Definition: qgsrendercontext.h:58
qgspoint.h
qgsmapsettings.h
QgsRectangle
A rectangle specified with double values.
Definition: qgsrectangle.h:42
QgsQuickIdentifyKit
Convenient set of tools to identify features.
Definition: qgsquickidentifykit.h:47
QgsQuickMapSettings
The QgsQuickMapSettings class encapsulates QgsMapSettings class to offer settings of configuration of...
Definition: qgsquickmapsettings.h:47
QgsQuickFeatureLayerPairs
QList< QgsQuickFeatureLayerPair > QgsQuickFeatureLayerPairs
Definition: qgsquickfeaturelayerpair.h:102
QgsQuickIdentifyKit::identifyModeChanged
void identifyModeChanged()
Defines behavior of the identify tool (See description of IdentifyMode enum).
qgsrendercontext.h
QgsFeatureList
QList< QgsFeature > QgsFeatureList
Definition: qgsfeature.h:583
QgsQuickIdentifyKit::searchRadiusMmChanged
void searchRadiusMmChanged()
Search radius for the identify functions.
QgsPointXY
A class to represent a 2D point.
Definition: qgspointxy.h:44
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition: qgsvectorlayer.h:387
QgsMapLayer
Base class for all map layer types.
Definition: qgsmaplayer.h:83
QgsQuickFeatureLayerPair
Pair of QgsFeature and QgsVectorLayer.
Definition: qgsquickfeaturelayerpair.h:41
QgsQuickIdentifyKit::IdentifyMode
IdentifyMode
IdentifyMode enums used to define identify tool behavior on identifiable layers.
Definition: qgsquickidentifykit.h:82