QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
22 , mDisplayName( displayName )
24 , mGeocoder( geocoder )
25 , mBoundingBox( boundingBox )
51 const QList< QgsGeocoderResult > results = mGeocoder->
geocodeString(
string, geocodeContext, feedback );
54 if ( result.isValid() )
57 emit resultFetched( locatorRes );
65 handleGeocodeResult( geocodeResult );
75 const QVariantMap attrs = result.
userData.toMap();
76 QgsGeocoderResult geocodeResult( attrs.value( QStringLiteral(
"identifier" ) ).toString(),
77 attrs.value( QStringLiteral(
"geom" ) ).value< QgsGeometry >(),
78 attrs.value( QStringLiteral(
"crs" ) ).value< QgsCoordinateReferenceSystem >() );
80 geocodeResult.
setViewport( attrs.value( QStringLiteral(
"viewport" ) ).value< QgsRectangle >() );
89 attrs.insert( QStringLiteral(
"identifier" ), result.
identifier() );
90 attrs.insert( QStringLiteral(
"geom" ), result.
geometry() );
91 attrs.insert( QStringLiteral(
"viewport" ), result.
viewport() );
92 attrs.insert( QStringLiteral(
"crs" ), result.
crs() );
QgsCoordinateTransformContext transformContext
Coordinate transform context, to use whenever performing coordinate transformations inside a locator.
QString displayName() const override
QVariantMap additionalAttributes() const
Contains additional attributes generated during the geocode, which may be added to features being geo...
QString name() const override
void setAdditionalAttributes(const QVariantMap &attributes)
Setss additional attributes generated during the geocode, which may be added to features being geocod...
A rectangle specified with double values.
Encapsulates properties of an individual matching result found by a QgsLocatorFilter.
QgsRectangle targetExtent
Map extent to target in results.
void setGroup(const QString &group)
Sets the optional group value for the result.
QgsCoordinateReferenceSystem crs() const
Returns the coordinate reference system for the calculated geometry().
Encapsulates the properties relating to the context of a locator search.
void setAreaOfInterestCrs(const QgsCoordinateReferenceSystem &crs)
Sets the crs for the area of interest, which can be used to indicate the desired geographic area wher...
QgsCoordinateReferenceSystem targetExtentCrs
Coordinate reference system for the map extent variable.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
void setAreaOfInterest(const QgsGeometry &area)
Sets the optional area of interest, which can be used to indicate the desired geographic area where g...
void triggerResult(const QgsLocatorResult &result) override
QgsGeometry geometry() const
Returns the resultant geometry resulting from the geocoding operation.
void setDescription(const QString &description)
Sets an optional description for the result.
void setViewport(const QgsRectangle &viewport)
Sets the suggested viewport for the result, which reflects a recommended map extent for displaying th...
virtual QList< QgsGeocoderResult > geocodeString(const QString &string, const QgsGeocoderContext &context, QgsFeedback *feedback=nullptr) const
Geocodes a string.
void fetchResults(const QString &string, const QgsLocatorContext &context, QgsFeedback *feedback) override
QString group() const
Returns the optional group value for the result.
QgsRectangle viewport() const
Returns the suggested viewport for the result, which reflects a recommended map extent for displaying...
Encapsulates the context of a geocoding operation.
QString prefix() const override
Represents a matching result from a geocoder search.
QString group
Group the results by categories If left as empty string, this means that results are all shown withou...
static QgsGeometry fromRect(const QgsRectangle &rect) SIP_HOLDGIL
Creates a new geometry from a QgsRectangle.
QgsAbstractGeocoderLocatorFilter(const QString &name, const QString &displayName, const QString &prefix, QgsGeocoderInterface *geocoder, const QgsRectangle &boundingBox=QgsRectangle())
Constructor for QgsAbstractGeocoderLocatorFilter.
QgsGeocoderResult locatorResultToGeocoderResult(const QgsLocatorResult &result) const
Converts a locator result to a geocoder result.
QString description() const
Returns the optional description for the result.
QString identifier() const
Returns the identifier string for the result.
QgsLocatorResult geocoderResultToLocatorResult(const QgsGeocoderResult &result)
Converts a geocoder result to a locator result.
QString description
Descriptive text for result.
QgsGeocoderInterface * geocoder() const
Returns the geocoder attached to the filter.
QVariant userData
Custom reference or other data set by the filter.