LCOV - code coverage report
Current view: top level - core/geocoding - qgsgeocoder.h (source / functions) Hit Total Coverage
Test: coverage.info.cleaned Lines: 0 2 0.0 %
Date: 2021-04-10 08:29:14 Functions: 0 0 -
Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /***************************************************************************
       2                 :            :   qgsgeocoder.h
       3                 :            :   ---------------
       4                 :            :   Date                 : August 2020
       5                 :            :   Copyright            : (C) 2020 by Nyall Dawson
       6                 :            :   Email                : nyall dot dawson at gmail dot com
       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 QGSGEOCODER_H
      17                 :            : #define QGSGEOCODER_H
      18                 :            : 
      19                 :            : #include "qgis_core.h"
      20                 :            : #include "qgsgeocoderresult.h"
      21                 :            : #include "qgsgeometry.h"
      22                 :            : #include "qgsfields.h"
      23                 :            : 
      24                 :            : class QgsFeature;
      25                 :            : class QgsGeocoderContext;
      26                 :            : 
      27                 :            : /**
      28                 :            :  * \ingroup core
      29                 :            :  * \brief Interface for geocoders.
      30                 :            :  *
      31                 :            :  * QgsGeocoderInterface implementations are able to take either a QgsFeature or a free-form string
      32                 :            :  * and calculate the corresponding geometry of the feature.
      33                 :            :  *
      34                 :            :  * \since QGIS 3.18
      35                 :            : */
      36                 :          0 : class CORE_EXPORT QgsGeocoderInterface
      37                 :            : {
      38                 :            : 
      39                 :            :   public:
      40                 :            : 
      41                 :            :     //! Capability flags for the geocoder.
      42                 :            :     enum class Flag
      43                 :            :     {
      44                 :            :       GeocodesStrings = 1 << 0, //!< Can geocode string input values
      45                 :            :       GeocodesFeatures = 1 << 1, //!< Can geocode QgsFeature input values
      46                 :            :     };
      47                 :            :     Q_DECLARE_FLAGS( Flags, Flag )
      48                 :            : 
      49                 :          0 :     virtual ~QgsGeocoderInterface() = default;
      50                 :            : 
      51                 :            :     /**
      52                 :            :      * Returns the geocoder's capability flags.
      53                 :            :      */
      54                 :            :     virtual Flags flags() const = 0;
      55                 :            : 
      56                 :            :     /**
      57                 :            :      * Geocodes a \a feature.
      58                 :            :      *
      59                 :            :      * If implemented by the geocoder (i.e. flags() returns the QgsGeocoderInterface::Flag::GeocodesFeatures flag), a list of matching results will be returned.
      60                 :            :      *
      61                 :            :      * The optional \a feedback argument can be used to provider cancellation support.
      62                 :            :      */
      63                 :            :     virtual QList< QgsGeocoderResult > geocodeFeature( const QgsFeature &feature, const QgsGeocoderContext &context, QgsFeedback *feedback = nullptr ) const;
      64                 :            : 
      65                 :            :     /**
      66                 :            :      * Returns a set of newly created fields which will be appended to existing features during the geocode
      67                 :            :      * operation.
      68                 :            :      *
      69                 :            :      * These fields will include any extra content returned by the geocoder, such as fields for accuracy of the
      70                 :            :      * match or correct attribute values.
      71                 :            :      */
      72                 :            :     virtual QgsFields appendedFields() const;
      73                 :            : 
      74                 :            :     /**
      75                 :            :      * Returns the WKB type of geometries returned by the geocoder.
      76                 :            :      *
      77                 :            :      * If this is not known in advance then QgsWkbTypes::Unknown should be returned (e.g.
      78                 :            :      * in the case that a geocoder may return different geometry types depending on the
      79                 :            :      * quality of the match).
      80                 :            :      */
      81                 :            :     virtual QgsWkbTypes::Type wkbType() const;
      82                 :            : 
      83                 :            :     /**
      84                 :            :      * Geocodes a \a string.
      85                 :            :      *
      86                 :            :      * If implemented by the geocoder (i.e. flags() returns the QgsGeocoderInterface::Flag::GeocodesStrings flag), a list of matching results will be returned.
      87                 :            :      *
      88                 :            :      * The optional \a feedback argument can be used to provider cancellation support.
      89                 :            :      */
      90                 :            :     virtual QList< QgsGeocoderResult > geocodeString( const QString &string, const QgsGeocoderContext &context, QgsFeedback *feedback = nullptr ) const;
      91                 :            : 
      92                 :            : };
      93                 :            : 
      94                 :            : #endif // QGSGEOCODER_H

Generated by: LCOV version 1.14