QgsGeoNodeRequest class
Request handler for GeoNode servers.
Contents
QgsGeoNodeRequest handles requesting and parsing service details from a GeoNode server instance, for instance requesting all available layers or layer styles.
Public types
- struct ServiceLayerDetail
- Service layer details for an individual layer from a GeoNode connection.
Constructors, destructors, conversion operators
- QgsGeoNodeRequest(const QString& baseUrl, bool forceRefresh, QObject* parent = nullptr)
- Constructor for QgsGeoNodeRequest.
Public functions
- auto fetchDefaultStyleBlocking(const QString& layerName) -> QgsGeoNodeStyle
- Requests the default style for the layer with matching layerName from the server.
- void fetchLayers()
- Triggers a new request to fetch the list of available layers from the server.
-
auto fetchLayersBlocking() -> QList<QgsGeoNodeRequest::
ServiceLayerDetail> - Requests the list of available layers from the server.
- auto fetchServiceUrlDataBlocking(const QString& serviceType) -> QgsStringMap
- Obtains a map of layer name to URL for available services with matching serviceType from the server.
- auto fetchServiceUrlsBlocking(const QString& serviceType) -> QStringList
- Requests the list of unique URLs for available services with matching serviceType from the server.
- auto fetchStyleBlocking(const QString& styleId) -> QgsGeoNodeStyle
- Requests the details for the style with matching styleId from the server.
- auto fetchStylesBlocking(const QString& layerName) -> QList<QgsGeoNodeStyle>
- Requests the list of available styles for the layer with matching layerName from the server.
- auto lastError() const -> QString
- Returns the most recent error string for any encountered errors, or an empty string if no errors have been encountered.
- auto lastResponse() const -> QByteArray
- Returns the most recent response obtained from the server.
- auto protocol() const -> QString
- Returns the network protocol (e.g.
- void request(const QString& endPoint)
- Triggers a new request to the GeoNode server, with the requested endPoint.
- auto requestBlocking(const QString& endPoint) -> bool
- Triggers a new request to the GeoNode server, with the requested endPoint.
- void setProtocol(const QString& protocol)
- Sets the network protocol (e.g.
Signals
-
void layersFetched(const QList<QgsGeoNodeRequest::
ServiceLayerDetail>& layers) - Emitted when the result of a fetchLayers call has been received and processed.
- void requestFinished()
- Emitted when the existing request has been completed.
- void statusChanged(const QString& statusQString)
- Emitted when the status of an ongoing request is changed.
Public slots
- void abort()
- Aborts any active network request immediately.
Function documentation
QgsGeoNodeRequest:: QgsGeoNodeRequest(const QString& baseUrl,
bool forceRefresh,
QObject* parent = nullptr)
Constructor for QgsGeoNodeRequest.
If forceRefresh is false, then cached copies of the request may be reused.
QgsGeoNodeStyle QgsGeoNodeRequest:: fetchDefaultStyleBlocking(const QString& layerName)
Requests the default style for the layer with matching layerName from the server.
This method is blocking and will wait for results from the server before returning. Accordingly it should not be used from any code which potentially blocks operation in the main GUI thread.
void QgsGeoNodeRequest:: fetchLayers()
Triggers a new request to fetch the list of available layers from the server.
When complete, the layersFetched() signal will be emitted with the result.
This method is non-blocking and returns immediately.
QList<QgsGeoNodeRequest:: ServiceLayerDetail> QgsGeoNodeRequest:: fetchLayersBlocking()
Requests the list of available layers from the server.
This method is blocking and will wait for results from the server before returning. Accordingly it should not be used from any code which potentially blocks operation in the main GUI thread.
QgsStringMap QgsGeoNodeRequest:: fetchServiceUrlDataBlocking(const QString& serviceType)
Obtains a map of layer name to URL for available services with matching serviceType from the server.
This method is blocking and will wait for results from the server before returning. Accordingly it should not be used from any code which potentially blocks operation in the main GUI thread.
QStringList QgsGeoNodeRequest:: fetchServiceUrlsBlocking(const QString& serviceType)
Requests the list of unique URLs for available services with matching serviceType from the server.
This method is blocking and will wait for results from the server before returning. Accordingly it should not be used from any code which potentially blocks operation in the main GUI thread.
QgsGeoNodeStyle QgsGeoNodeRequest:: fetchStyleBlocking(const QString& styleId)
Requests the details for the style with matching styleId from the server.
This method is blocking and will wait for results from the server before returning. Accordingly it should not be used from any code which potentially blocks operation in the main GUI thread.
QList<QgsGeoNodeStyle> QgsGeoNodeRequest:: fetchStylesBlocking(const QString& layerName)
Requests the list of available styles for the layer with matching layerName from the server.
This method is blocking and will wait for results from the server before returning. Accordingly it should not be used from any code which potentially blocks operation in the main GUI thread.
QString QgsGeoNodeRequest:: protocol() const
Returns the network protocol (e.g.
'http') used for connecting with the server.
void QgsGeoNodeRequest:: request(const QString& endPoint)
Triggers a new request to the GeoNode server, with the requested endPoint.
Any existing request will be aborted.
Calling this method does not block while waiting for a result.
bool QgsGeoNodeRequest:: requestBlocking(const QString& endPoint)
Triggers a new request to the GeoNode server, with the requested endPoint.
Any existing request will be aborted.
Calling this method will block while waiting for a result. It should not be used from any code which potentially blocks operation in the main GUI thread.
void QgsGeoNodeRequest:: setProtocol(const QString& protocol)
Sets the network protocol (e.g.
'http') used for connecting with the server.