QGIS/python/core/auto_generated/geocoding/qgsgeocoderresult.sip.in
Nyall Dawson 9935bbe05e Add adapter class QgsGeocoderLocatorFilter
This class implements the required logic to bridge a
class which implements the QgsGeocoderInterface interface to a
QgsLocatorFilter. It allows easy creation of a locator filter
from a geocoder.

E.g.

    class GoogleGeocoder(QgsGeocoderInterface):
      ... class which implements QgsGeocoderInterface...

    my_google_geocoder = GoogleGeocoder(api_key)
    my_google_locator_filter = QgsGeocoderLocatorFilter('google', 'Google Maps', 'google', my_google_geocoder, iface.mapCanvas())
    iface.registerLocatorFilter(my_google_locator_filter)

Note:

There's an abstract base class QgsAbstractGeocoderLocatorFilter which
lives in core. This base class has the guts of the geocoder to filter
adapter logic, but it does NOT implement the part which actually zooms
the canvas to the geocode results (because it's in core!)

This abstract base class is in place for applications like QField,
where the GUI library and QgsMapCanvas is NOT used. Those applications
can then implement their own concrete class based on QgsAbstractGeocoderLocatorFilter
with the correct logic to zoom their interface to a region. Ultimately,
a single QgsGeocoderInterface could be usable across QGIS desktop, QField,
with almost all logic shared via the common abstract adapter class.
2020-11-02 11:22:48 +10:00

129 lines
4.0 KiB
Plaintext

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/geocoding/qgsgeocoderresult.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsGeocoderResult
{
%Docstring
Represents a matching result from a geocoder search.
QgsGeocoderResult objects may represent valid matches, or an invalid
error result. This can be checked by testing :py:func:`~isValid`. An invalid
result represents that an error was encountered while geocoding, in which case the
error message can be retrieved by calling :py:func:`~error`.
Valid geocoding results will have a :py:func:`~geometry` and :py:func:`~crs`, along with a set
of optional :py:func:`~additionalAttributes` which may contain information such as the
accuracy of the geocoding result.
.. versionadded:: 3.18
%End
%TypeHeaderCode
#include "qgsgeocoderresult.h"
%End
public:
static QgsGeocoderResult errorResult( const QString &errorMessage );
%Docstring
Creates an invalid error result, with the specified ``errorMessage`` string.
%End
QgsGeocoderResult( const QString &identifier, const QgsGeometry &geometry, const QgsCoordinateReferenceSystem &crs );
%Docstring
Constructor for a valid QgsGeocoderResult, with the specified ``geometry`` and ``crs``.
%End
bool isValid() const;
%Docstring
Returns ``True`` if the result is a valid result.
If the result is invalid, the error message can be retrieved by calling :py:func:`~QgsGeocoderResult.error`.
%End
QString error() const;
%Docstring
Returns the error string, if the result is invalid.
%End
QString identifier() const;
%Docstring
Returns the identifier string for the result.
%End
QgsGeometry geometry() const;
%Docstring
Returns the resultant geometry resulting from the geocoding operation.
The coordinate reference system for the geometry can be retrieved
via :py:func:`~QgsGeocoderResult.crs`.
.. seealso:: :py:func:`setGeometry`
.. seealso:: :py:func:`crs`
%End
void setGeometry( const QgsGeometry &geometry );
%Docstring
Sets the resultant ``geometry`` resulting from the geocoding operation.
The coordinate reference system for the geometry should also be set
via :py:func:`~QgsGeocoderResult.setCrs`.
.. seealso:: :py:func:`geometry`
.. seealso:: :py:func:`setCrs`
%End
QgsCoordinateReferenceSystem crs() const;
%Docstring
Returns the coordinate reference system for the calculated :py:func:`~QgsGeocoderResult.geometry`.
.. seealso:: :py:func:`setCrs`
.. seealso:: :py:func:`geometry`
%End
void setCrs( const QgsCoordinateReferenceSystem &crs );
%Docstring
Sets the coordinate reference system for the calculated :py:func:`~QgsGeocoderResult.geometry`.
.. seealso:: :py:func:`crs`
.. seealso:: :py:func:`geometry`
%End
QVariantMap additionalAttributes() const;
%Docstring
Contains additional attributes generated during the geocode,
which may be added to features being geocoded.
.. seealso:: :py:func:`setAdditionalAttributes`
%End
void setAdditionalAttributes( const QVariantMap &attributes );
%Docstring
Setss additional attributes generated during the geocode,
which may be added to features being geocoded.
.. seealso:: :py:func:`additionalAttributes`
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/geocoding/qgsgeocoderresult.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/