mirror of
				https://github.com/qgis/QGIS.git
				synced 2025-11-04 00:04:25 -05:00 
			
		
		
		
	
		
			
				
	
	
		
			310 lines
		
	
	
		
			11 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			310 lines
		
	
	
		
			11 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
/************************************************************************
 | 
						|
 * This file has been generated automatically from                      *
 | 
						|
 *                                                                      *
 | 
						|
 * src/gui/maptools/qgsmaptoolidentify.h                                *
 | 
						|
 *                                                                      *
 | 
						|
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 | 
						|
 ************************************************************************/
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
class QgsMapToolIdentify : QgsMapTool
 | 
						|
{
 | 
						|
%Docstring(signature="appended")
 | 
						|
Map tool for identifying features in layers.
 | 
						|
 | 
						|
After the tool is used to select a point, this map tool performs the
 | 
						|
identification:
 | 
						|
 | 
						|
- for raster layers shows value of underlying pixel
 | 
						|
- for vector layers shows feature attributes within search radius
 | 
						|
  (allows editing values when vector layer is in editing mode)
 | 
						|
%End
 | 
						|
 | 
						|
%TypeHeaderCode
 | 
						|
#include "qgsmaptoolidentify.h"
 | 
						|
%End
 | 
						|
  public:
 | 
						|
    enum IdentifyMode /BaseType=IntEnum/
 | 
						|
    {
 | 
						|
      DefaultQgsSetting,
 | 
						|
      ActiveLayer,
 | 
						|
      TopDownStopAtFirst,
 | 
						|
      TopDownAll,
 | 
						|
      LayerSelection
 | 
						|
    };
 | 
						|
 | 
						|
    enum Type /BaseType=IntEnum/
 | 
						|
    {
 | 
						|
      VectorLayer,
 | 
						|
      RasterLayer,
 | 
						|
      MeshLayer,
 | 
						|
      VectorTileLayer,
 | 
						|
      PointCloudLayer,
 | 
						|
      AllLayers
 | 
						|
    };
 | 
						|
    typedef QFlags<QgsMapToolIdentify::Type> LayerType;
 | 
						|
 | 
						|
 | 
						|
    struct IdentifyResult
 | 
						|
    {
 | 
						|
        IdentifyResult();
 | 
						|
 | 
						|
        IdentifyResult( QgsMapLayer *layer, const QgsFeature &feature, const QMap<QString, QString> &derivedAttributes );
 | 
						|
        IdentifyResult( QgsMapLayer *layer, const QString &label, const QMap<QString, QString> &attributes, const QMap<QString, QString> &derivedAttributes );
 | 
						|
        IdentifyResult( QgsMapLayer *layer, const QString &label, const QgsFields &fields, const QgsFeature &feature, const QMap<QString, QString> &derivedAttributes );
 | 
						|
        QgsMapLayer *mLayer;
 | 
						|
        QString mLabel;
 | 
						|
        QgsFields mFields;
 | 
						|
        QgsFeature mFeature;
 | 
						|
        QMap<QString, QString> mAttributes;
 | 
						|
        QMap<QString, QString> mDerivedAttributes;
 | 
						|
        QMap<QString, QVariant> mParams;
 | 
						|
    };
 | 
						|
 | 
						|
    struct IdentifyProperties
 | 
						|
    {
 | 
						|
        double searchRadiusMapUnits;
 | 
						|
        bool skip3DLayers;
 | 
						|
    };
 | 
						|
 | 
						|
    QgsMapToolIdentify( QgsMapCanvas *canvas );
 | 
						|
%Docstring
 | 
						|
constructor
 | 
						|
%End
 | 
						|
 | 
						|
    ~QgsMapToolIdentify();
 | 
						|
 | 
						|
    virtual Flags flags() const;
 | 
						|
    virtual void canvasMoveEvent( QgsMapMouseEvent *e );
 | 
						|
 | 
						|
    virtual void canvasPressEvent( QgsMapMouseEvent *e );
 | 
						|
 | 
						|
    virtual void canvasReleaseEvent( QgsMapMouseEvent *e );
 | 
						|
 | 
						|
    virtual void activate();
 | 
						|
 | 
						|
    virtual void deactivate();
 | 
						|
 | 
						|
 | 
						|
    QList<QgsMapToolIdentify::IdentifyResult> identify( int x, int y, const QList<QgsMapLayer *> &layerList = QList<QgsMapLayer *>(), IdentifyMode mode = DefaultQgsSetting, const QgsIdentifyContext &identifyContext = QgsIdentifyContext() );
 | 
						|
%Docstring
 | 
						|
Performs the identification.
 | 
						|
 | 
						|
:param x: x coordinates of mouseEvent
 | 
						|
:param y: y coordinates of mouseEvent
 | 
						|
:param layerList: Performs the identification within the given list of
 | 
						|
                  layers. Default value is an empty list, i.e. uses all
 | 
						|
                  the layers.
 | 
						|
:param mode: Identification mode. Can use QGIS default settings or a
 | 
						|
             defined mode. Default mode is DefaultQgsSetting.
 | 
						|
:param identifyContext: Identify context object.
 | 
						|
 | 
						|
:return: a list of IdentifyResult
 | 
						|
%End
 | 
						|
 | 
						|
    QList<QgsMapToolIdentify::IdentifyResult> identify( int x, int y, IdentifyMode mode, LayerType layerType = AllLayers, const QgsIdentifyContext &identifyContext = QgsIdentifyContext() );
 | 
						|
%Docstring
 | 
						|
Performs the identification. To avoid being forced to specify
 | 
						|
IdentifyMode with a list of layers this has been made private and two
 | 
						|
publics methods are offered
 | 
						|
 | 
						|
:param x: x coordinates of mouseEvent
 | 
						|
:param y: y coordinates of mouseEvent
 | 
						|
:param mode: Identification mode. Can use QGIS default settings or a
 | 
						|
             defined mode.
 | 
						|
:param layerType: Only performs identification in a certain type of
 | 
						|
                  layers (raster, vector, mesh). Default value is
 | 
						|
                  AllLayers.
 | 
						|
:param identifyContext: Identify context object.
 | 
						|
 | 
						|
:return: a list of IdentifyResult
 | 
						|
%End
 | 
						|
 | 
						|
    QList<QgsMapToolIdentify::IdentifyResult> identify( const QgsGeometry &geometry, IdentifyMode mode, LayerType layerType, const QgsIdentifyContext &identifyContext = QgsIdentifyContext() );
 | 
						|
%Docstring
 | 
						|
Performs identification based on a geometry (in map coordinates)
 | 
						|
%End
 | 
						|
    QList<QgsMapToolIdentify::IdentifyResult> identify( const QgsGeometry &geometry, IdentifyMode mode, const QList<QgsMapLayer *> &layerList, LayerType layerType, const QgsIdentifyContext &identifyContext = QgsIdentifyContext() );
 | 
						|
%Docstring
 | 
						|
Performs identification based on a geometry (in map coordinates)
 | 
						|
%End
 | 
						|
 | 
						|
 | 
						|
    QgsIdentifyMenu *identifyMenu();
 | 
						|
%Docstring
 | 
						|
Returns a pointer to the identify menu which will be used in layer
 | 
						|
selection mode this menu can also be customized
 | 
						|
%End
 | 
						|
 | 
						|
 | 
						|
 | 
						|
  public slots:
 | 
						|
    void formatChanged( QgsRasterLayer *layer );
 | 
						|
 | 
						|
  signals:
 | 
						|
 | 
						|
    void identifyProgress( int processed, int total );
 | 
						|
%Docstring
 | 
						|
Emitted when the identify action progresses.
 | 
						|
 | 
						|
:param processed: number of objects processed so far
 | 
						|
:param total: total number of objects to process
 | 
						|
%End
 | 
						|
 | 
						|
    void identifyMessage( const QString &message );
 | 
						|
%Docstring
 | 
						|
Emitted when the identify operation needs to show a user-facing message
 | 
						|
 | 
						|
:param message: Message to show to the user
 | 
						|
%End
 | 
						|
 | 
						|
    void changedRasterResults( QList<QgsMapToolIdentify::IdentifyResult> &results );
 | 
						|
%Docstring
 | 
						|
Emitted when the format of raster ``results`` is changed and need to be
 | 
						|
updated in user-facing displays.
 | 
						|
%End
 | 
						|
 | 
						|
  protected:
 | 
						|
    QList<QgsMapToolIdentify::IdentifyResult> identify( int x, int y, IdentifyMode mode, const QList<QgsMapLayer *> &layerList, LayerType layerType = AllLayers, const QgsIdentifyContext &identifyContext = QgsIdentifyContext() );
 | 
						|
%Docstring
 | 
						|
Performs the identification. To avoid being forced to specify
 | 
						|
IdentifyMode with a list of layers this has been made private and two
 | 
						|
publics methods are offered
 | 
						|
 | 
						|
:param x: x coordinates of mouseEvent
 | 
						|
:param y: y coordinates of mouseEvent
 | 
						|
:param mode: Identification mode. Can use QGIS default settings or a
 | 
						|
             defined mode.
 | 
						|
:param layerList: Performs the identification within the given list of
 | 
						|
                  layers.
 | 
						|
:param layerType: Only performs identification in a certain type of
 | 
						|
                  layers (raster, vector, mesh).
 | 
						|
:param identifyContext: Identify context object.
 | 
						|
 | 
						|
:return: a list of IdentifyResult
 | 
						|
%End
 | 
						|
 | 
						|
 | 
						|
    bool identifyLayer( QList<QgsMapToolIdentify::IdentifyResult> *results, QgsMapLayer *layer, const QgsPointXY &point, const QgsRectangle &viewExtent, double mapUnitsPerPixel, QgsMapToolIdentify::LayerType layerType = AllLayers, const QgsIdentifyContext &identifyContext = QgsIdentifyContext() );
 | 
						|
%Docstring
 | 
						|
Call the right method depending on layer type
 | 
						|
%End
 | 
						|
 | 
						|
    bool identifyRasterLayer( QList<QgsMapToolIdentify::IdentifyResult> *results, QgsRasterLayer *layer, QgsPointXY point, const QgsRectangle &viewExtent, double mapUnitsPerPixel, const QgsIdentifyContext &identifyContext = QgsIdentifyContext() );
 | 
						|
%Docstring
 | 
						|
Performs the identification against a given raster layer.
 | 
						|
 | 
						|
:param results: list of identify results
 | 
						|
:param layer: raster layer to identify from
 | 
						|
:param point: point coordinate to identify
 | 
						|
:param viewExtent: view extent
 | 
						|
:param mapUnitsPerPixel: map units per pixel value
 | 
						|
:param identifyContext: identify context object
 | 
						|
%End
 | 
						|
 | 
						|
    bool identifyVectorLayer( QList<QgsMapToolIdentify::IdentifyResult> *results, QgsVectorLayer *layer, const QgsPointXY &point, const QgsIdentifyContext &identifyContext = QgsIdentifyContext() );
 | 
						|
%Docstring
 | 
						|
Performs the identification against a given vector layer.
 | 
						|
 | 
						|
:param results: list of identify results
 | 
						|
:param layer: raster layer to identify from
 | 
						|
:param point: point coordinate to identify
 | 
						|
:param identifyContext: identify context object
 | 
						|
%End
 | 
						|
 | 
						|
    bool identifyMeshLayer( QList<QgsMapToolIdentify::IdentifyResult> *results, QgsMeshLayer *layer, const QgsPointXY &point, const QgsIdentifyContext &identifyContext = QgsIdentifyContext() );
 | 
						|
%Docstring
 | 
						|
Identifies data from active scalar and vector dataset from the mesh
 | 
						|
layer
 | 
						|
 | 
						|
Works only if layer was already rendered (triangular mesh is created)
 | 
						|
 | 
						|
.. versionadded:: 3.6
 | 
						|
%End
 | 
						|
 | 
						|
    QMap<QString, QString> derivedAttributesForPoint( const QgsPoint &point );
 | 
						|
%Docstring
 | 
						|
Returns derived attributes map for a clicked point in map coordinates.
 | 
						|
May be 2D or 3D point.
 | 
						|
%End
 | 
						|
 | 
						|
 void setCanvasPropertiesOverrides( double searchRadiusMapUnits ) /Deprecated="Since 3.42. Use setPropertiesOverrides() instead."/;
 | 
						|
%Docstring
 | 
						|
Overrides some map canvas properties inside the map tool for the
 | 
						|
upcoming identify requests.
 | 
						|
 | 
						|
This is useful when the identification is triggered by some other piece
 | 
						|
of GUI like a 3D map view and some properties like search radius need to
 | 
						|
be adjusted so that identification returns correct results. When the
 | 
						|
custom identification has finished,
 | 
						|
:py:func:`~QgsMapToolIdentify.restoreCanvasPropertiesOverrides` should
 | 
						|
be called to erase any overrides.
 | 
						|
 | 
						|
:param searchRadiusMapUnits: The overridden search radius in map units
 | 
						|
 | 
						|
.. seealso:: :py:func:`restoreCanvasPropertiesOverrides`
 | 
						|
 | 
						|
.. versionadded:: 3.4
 | 
						|
 | 
						|
.. deprecated:: 3.42
 | 
						|
 | 
						|
   Use :py:func:`~QgsMapToolIdentify.setPropertiesOverrides` instead.
 | 
						|
%End
 | 
						|
 | 
						|
 void restoreCanvasPropertiesOverrides() /Deprecated="Since 3.42. Use restorePropertiesOverrides() instead."/;
 | 
						|
%Docstring
 | 
						|
Clears canvas properties overrides previously set with
 | 
						|
:py:func:`~QgsMapToolIdentify.setCanvasPropertiesOverrides`
 | 
						|
 | 
						|
.. seealso:: :py:func:`setCanvasPropertiesOverrides`
 | 
						|
 | 
						|
.. versionadded:: 3.4
 | 
						|
 | 
						|
.. deprecated:: 3.42
 | 
						|
 | 
						|
   Use :py:func:`~QgsMapToolIdentify.restorePropertiesOverrides` instead.
 | 
						|
%End
 | 
						|
 | 
						|
    void setPropertiesOverrides( IdentifyProperties overrides );
 | 
						|
%Docstring
 | 
						|
Overrides some map canvas properties inside the map tool for the
 | 
						|
upcoming identify requests.
 | 
						|
 | 
						|
This is useful when the identification is triggered by some other piece
 | 
						|
of GUI like a 3D map view and some properties like search radius need to
 | 
						|
be adjusted so that identification returns correct results. When the
 | 
						|
custom identification has finished,
 | 
						|
:py:func:`~QgsMapToolIdentify.restorePropertiesOverrides` should be
 | 
						|
called to erase any overrides.
 | 
						|
 | 
						|
:param overrides: The identify tool properties that will be overridden
 | 
						|
 | 
						|
.. versionadded:: 3.42
 | 
						|
%End
 | 
						|
 | 
						|
    void restorePropertiesOverrides();
 | 
						|
%Docstring
 | 
						|
Clears canvas properties overrides previously set with
 | 
						|
:py:func:`~QgsMapToolIdentify.setPropertiesOverrides`
 | 
						|
 | 
						|
.. seealso:: :py:func:`setPropertiesOverrides`
 | 
						|
 | 
						|
.. versionadded:: 3.42
 | 
						|
%End
 | 
						|
 | 
						|
};
 | 
						|
 | 
						|
QFlags<QgsMapToolIdentify::Type> operator|(QgsMapToolIdentify::Type f1, QFlags<QgsMapToolIdentify::Type> f2);
 | 
						|
 | 
						|
 | 
						|
/************************************************************************
 | 
						|
 * This file has been generated automatically from                      *
 | 
						|
 *                                                                      *
 | 
						|
 * src/gui/maptools/qgsmaptoolidentify.h                                *
 | 
						|
 *                                                                      *
 | 
						|
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 | 
						|
 ************************************************************************/
 |