QGIS API Documentation  3.18.1-Zürich (202f1bf7e5)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
qgsabstractgeocoderlocatorfilter.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsabstractgeocoderlocatorfilter.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 QGSABSTRACTGEOCODERLOCATORFILTER_H
17 #define QGSABSTRACTGEOCODERLOCATORFILTER_H
18 
19 #include "qgis_core.h"
20 #include "qgslocatorfilter.h"
21 
23 class QgsGeocoderResult;
24 
40 {
41  Q_OBJECT
42 
43  public:
44 
61  QgsAbstractGeocoderLocatorFilter( const QString &name, const QString &displayName,
62  const QString &prefix,
63  QgsGeocoderInterface *geocoder );
64 
65  QString name() const override;
66  QString displayName() const override;
67  QString prefix() const override;
68  void fetchResults( const QString &string, const QgsLocatorContext &context, QgsFeedback *feedback ) override;
69  void triggerResult( const QgsLocatorResult &result ) override;
70 
74  QgsGeocoderInterface *geocoder() const;
75 
81  QgsGeocoderResult locatorResultToGeocoderResult( const QgsLocatorResult &result ) const;
82 
88  QgsLocatorResult geocoderResultToLocatorResult( const QgsGeocoderResult &result );
89 
90  private:
91 
95  virtual void handleGeocodeResult( const QgsGeocoderResult &result ) = 0;
96 
97  QString mName;
98  QString mDisplayName;
99  QString mPrefix;
100  QgsGeocoderInterface *mGeocoder = nullptr;
101 
102 };
103 
104 #endif // QGSABSTRACTGEOCODERLOCATORFILTER_H
An abstract base class which implements a locator filter populated from a QgsGeocoderInterface.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition: qgsfeedback.h:45
Interface for geocoders.
Definition: qgsgeocoder.h:37
Represents a matching result from a geocoder search.
Encapsulates the properties relating to the context of a locator search.
Abstract base class for filters which collect locator results.
virtual QString prefix() const
Returns the search prefix character(s) for this filter.
virtual QString displayName() const =0
Returns a translated, user-friendly name for the filter.
virtual QString name() const =0
Returns the unique name for the filter.
virtual void triggerResult(const QgsLocatorResult &result)=0
Triggers a filter result from this filter.
virtual void fetchResults(const QString &string, const QgsLocatorContext &context, QgsFeedback *feedback)=0
Retrieves the filter results for a specified search string.
Encapsulates properties of an individual matching result found by a QgsLocatorFilter.
#define SIP_ABSTRACT
Definition: qgis_sip.h:199