QGIS API Documentation  3.24.2-Tisler (13c1a02865)
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 
64  QgsAbstractGeocoderLocatorFilter( const QString &name, const QString &displayName,
65  const QString &prefix,
66  QgsGeocoderInterface *geocoder,
67  const QgsRectangle &boundingBox = QgsRectangle() );
68 
69  QString name() const override;
70  QString displayName() const override;
71  QString prefix() const override;
72  void fetchResults( const QString &string, const QgsLocatorContext &context, QgsFeedback *feedback ) override;
73  void triggerResult( const QgsLocatorResult &result ) override;
74 
78  QgsGeocoderInterface *geocoder() const;
79 
83  const QgsRectangle boundingBox() { return mBoundingBox; }
84 
90  QgsGeocoderResult locatorResultToGeocoderResult( const QgsLocatorResult &result ) const;
91 
97  QgsLocatorResult geocoderResultToLocatorResult( const QgsGeocoderResult &result );
98 
99  private:
100 
104  virtual void handleGeocodeResult( const QgsGeocoderResult &result ) = 0;
105 
106  QString mName;
107  QString mDisplayName;
108  QString mPrefix;
109  QgsGeocoderInterface *mGeocoder = nullptr;
110  QgsRectangle mBoundingBox;
111 
112 };
113 
114 #endif // QGSABSTRACTGEOCODERLOCATORFILTER_H
An abstract base class which implements a locator filter populated from a QgsGeocoderInterface.
const QgsRectangle boundingBox()
Returns the WGS84 bounding box attached to the filter.
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.
A rectangle specified with double values.
Definition: qgsrectangle.h:42
#define SIP_ABSTRACT
Definition: qgis_sip.h:199