QGIS API Documentation  3.21.0-Master (5b68dc587e)
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"
20 
22 #include "qgsgeometry.h"
23 
24 
40 class CORE_EXPORT QgsGeocoderResult
41 {
42 
43  public:
44 
48  static QgsGeocoderResult errorResult( const QString &errorMessage );
49 
53  QgsGeocoderResult( const QString &identifier, const QgsGeometry &geometry, const QgsCoordinateReferenceSystem &crs );
54 
60  bool isValid() const { return mIsValid; }
61 
65  QString error() const { return mErrorString; }
66 
70  QString identifier() const { return mIdentifier; }
71 
81  QgsGeometry geometry() const { return mGeometry; }
82 
92  void setGeometry( const QgsGeometry &geometry ) { mGeometry = geometry; }
93 
100  QgsCoordinateReferenceSystem crs() const { return mCrs; }
101 
108  void setCrs( const QgsCoordinateReferenceSystem &crs ) { mCrs = crs; }
109 
121  QgsRectangle viewport() const { return mViewport; }
122 
134  void setViewport( const QgsRectangle &viewport ) { mViewport = viewport; }
135 
142  QVariantMap additionalAttributes() const { return mAdditionalAttributes; }
143 
150  void setAdditionalAttributes( const QVariantMap &attributes ) { mAdditionalAttributes = attributes; }
151 
159  QString group() const;
160 
168  void setGroup( const QString &group );
169 
175  QString description() const;
176 
182  void setDescription( const QString &description );
183 
184  private:
185 
186  QgsGeocoderResult() = default;
187 
188  bool mIsValid = false;
189  QString mErrorString;
190 
191  QString mIdentifier;
192  QString mDescription;
193  QString mGroup;
194  QgsGeometry mGeometry;
196  QgsRectangle mViewport;
197  QVariantMap mAdditionalAttributes;
198 
199 };
200 
201 #endif // QGSGEOCODERRESULT_H
This class 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...
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.
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.
Definition: qgsgeometry.h:124
A rectangle specified with double values.
Definition: qgsrectangle.h:42
const QgsCoordinateReferenceSystem & crs