QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
qgsgeocoderresult.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsgeocoderresult.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 QGSGEOCODERRESULT_H
17#define QGSGEOCODERRESULT_H
18
19#include "qgis_core.h"
21#include "qgsgeometry.h"
22
38class CORE_EXPORT QgsGeocoderResult
39{
40
41 public:
42
46 static QgsGeocoderResult errorResult( const QString &errorMessage );
47
52
58 bool isValid() const { return mIsValid; }
59
63 QString error() const { return mErrorString; }
64
68 QString identifier() const { return mIdentifier; }
69
79 QgsGeometry geometry() const { return mGeometry; }
80
90 void setGeometry( const QgsGeometry &geometry ) { mGeometry = geometry; }
91
98 QgsCoordinateReferenceSystem crs() const { return mCrs; }
99
106 void setCrs( const QgsCoordinateReferenceSystem &crs ) { mCrs = crs; }
107
119 QgsRectangle viewport() const { return mViewport; }
120
132 void setViewport( const QgsRectangle &viewport ) { mViewport = viewport; }
133
140 QVariantMap additionalAttributes() const { return mAdditionalAttributes; }
141
148 void setAdditionalAttributes( const QVariantMap &attributes ) { mAdditionalAttributes = attributes; }
149
157 QString group() const;
158
166 void setGroup( const QString &group );
167
173 QString description() const;
174
180 void setDescription( const QString &description );
181
182 private:
183
184 QgsGeocoderResult() = default;
185
186 bool mIsValid = false;
187 QString mErrorString;
188
189 QString mIdentifier;
190 QString mDescription;
191 QString mGroup;
192 QgsGeometry mGeometry;
194 QgsRectangle mViewport;
195 QVariantMap mAdditionalAttributes;
196
197};
198
199#endif // QGSGEOCODERRESULT_H
Represents a coordinate reference system (CRS).
Represents a matching result from a geocoder search.
void setAdditionalAttributes(const QVariantMap &attributes)
Setss additional attributes generated during the geocode, which may be added to features being geocod...
QgsGeocoderResult(const QString &identifier, const QgsGeometry &geometry, const QgsCoordinateReferenceSystem &crs)
Constructor for a valid QgsGeocoderResult, with the specified geometry and crs.
QString error() const
Returns the error string, if the result is invalid.
QString identifier() const
Returns the identifier string for the result.
QgsRectangle viewport() const
Returns the suggested viewport for the result, which reflects a recommended map extent for displaying...
QgsCoordinateReferenceSystem crs() const
Returns the coordinate reference system for the calculated geometry().
void setGeometry(const QgsGeometry &geometry)
Sets the resultant geometry resulting from the geocoding operation.
void setViewport(const QgsRectangle &viewport)
Sets the suggested viewport for the result, which reflects a recommended map extent for displaying th...
QgsGeometry geometry() const
Returns the resultant geometry resulting from the geocoding operation.
static QgsGeocoderResult errorResult(const QString &errorMessage)
Creates an invalid error result, with the specified errorMessage string.
bool isValid() const
Returns true if the result is a valid result.
void setCrs(const QgsCoordinateReferenceSystem &crs)
Sets the coordinate reference system for the calculated geometry().
QVariantMap additionalAttributes() const
Contains additional attributes generated during the geocode, which may be added to features being geo...
A geometry is the spatial representation of a feature.
A rectangle specified with double values.