QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
Signals | Public Member Functions | Static Public Member Functions | List of all members
QgsOSMDownload Class Reference

OSMDownload is a utility class for downloading OpenStreetMap via Overpass API. More...

#include <qgsosmdownload.h>

Inheritance diagram for QgsOSMDownload:
Inheritance graph
[legend]

Signals

void downloadProgress (qint64, qint64)
 normally the total length is not known (until we reach end) More...
 
void finished ()
 emitted when the network reply has finished (with success or with an error) More...
 

Public Member Functions

 QgsOSMDownload ()
 
 ~QgsOSMDownload ()
 
bool abort ()
 Aborts current pending request. More...
 
QString errorString () const
 
bool hasError () const
 
bool isFinished () const
 Returns true if the request has already finished. More...
 
QString outputFileName () const
 
QString query () const
 
QString serviceUrl () const
 
void setOutputFileName (const QString &outputFileName)
 
void setQuery (const QString &query)
 
void setServiceUrl (const QString &serviceUrl)
 
bool start ()
 Starts network request for data. More...
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
 QObject (QObject *parent, const char *name)
 
virtual ~QObject ()
 
bool blockSignals (bool block)
 
QObjectchild (const char *objName, const char *inheritsClass, bool recursiveSearch) const
 
const QObjectList & children () const
 
const char * className () const
 
bool connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const QObject *receiver, const char *method)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method)
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QByteArraydynamicPropertyNames () const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name) const
 
QList< T > findChildren (const QRegExp &regExp) const
 
QList< T > findChildren (const QString &name) const
 
bool inherits (const char *className) const
 
void insertChild (QObject *object)
 
void installEventFilter (QObject *filterObj)
 
bool isA (const char *className) const
 
bool isWidgetType () const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const
 
void moveToThread (QThread *targetThread)
 
const char * name () const
 
const char * name (const char *defaultName) const
 
QString objectName () const
 
QObjectparent () const
 
QVariant property (const char *name) const
 
void removeChild (QObject *object)
 
void removeEventFilter (QObject *obj)
 
void setName (const char *name)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval)
 
QThreadthread () const
 

Static Public Member Functions

static QString defaultServiceUrl ()
 Return URL of the service that is used by default. More...
 
static QString queryFromRect (const QgsRectangle &rect)
 Create query (in Overpass Query Language) that fetches everything in given rectangle. More...
 
- Static Public Member Functions inherited from QObject
bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 

Additional Inherited Members

- Protected Member Functions inherited from QObject
bool checkConnectArgs (const char *signal, const QObject *object, const char *method)
 
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const char *signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const char *signal)
 
int receivers (const char *signal) const
 
QObjectsender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 
- Static Protected Member Functions inherited from QObject
QByteArray normalizeSignalSlot (const char *signalSlot)
 
- Properties inherited from QObject
 objectName
 

Detailed Description

OSMDownload is a utility class for downloading OpenStreetMap via Overpass API.

To use this class, it is necessary to set query, output file name and start the request. The interface is asynchronous, the caller has to wait for finished() signal that is emitted whe the request has finished (successfully or with an error).

To check whether the the request has been successful, check hasError() and use errorString() to retrieve error message. An error may happen either directly in start() method or during the network communication.

By default OSMDownload uses remote service at location returned by defaultServiceUrl() method.

Definition at line 39 of file qgsosmdownload.h.

Constructor & Destructor Documentation

◆ QgsOSMDownload()

QgsOSMDownload::QgsOSMDownload ( )

Definition at line 38 of file qgsosmdownload.cpp.

◆ ~QgsOSMDownload()

QgsOSMDownload::~QgsOSMDownload ( )

Definition at line 44 of file qgsosmdownload.cpp.

Member Function Documentation

◆ abort()

bool QgsOSMDownload::abort ( )

Aborts current pending request.

Returns
true if there is a pending request and has been aborted, false otherwise

Definition at line 96 of file qgsosmdownload.cpp.

◆ defaultServiceUrl()

QString QgsOSMDownload::defaultServiceUrl ( )
static

Return URL of the service that is used by default.

Definition at line 25 of file qgsosmdownload.cpp.

◆ downloadProgress

void QgsOSMDownload::downloadProgress ( qint64  ,
qint64   
)
signal

normally the total length is not known (until we reach end)

◆ errorString()

QString QgsOSMDownload::errorString ( ) const
inline

Definition at line 63 of file qgsosmdownload.h.

◆ finished

void QgsOSMDownload::finished ( )
signal

emitted when the network reply has finished (with success or with an error)

◆ hasError()

bool QgsOSMDownload::hasError ( ) const
inline

Definition at line 62 of file qgsosmdownload.h.

◆ isFinished()

bool QgsOSMDownload::isFinished ( ) const

Returns true if the request has already finished.

Definition at line 138 of file qgsosmdownload.cpp.

◆ outputFileName()

QString QgsOSMDownload::outputFileName ( ) const
inline

Definition at line 60 of file qgsosmdownload.h.

◆ query()

QString QgsOSMDownload::query ( ) const
inline

Definition at line 57 of file qgsosmdownload.h.

◆ queryFromRect()

QString QgsOSMDownload::queryFromRect ( const QgsRectangle rect)
static

Create query (in Overpass Query Language) that fetches everything in given rectangle.

Definition at line 31 of file qgsosmdownload.cpp.

◆ serviceUrl()

QString QgsOSMDownload::serviceUrl ( ) const
inline

Definition at line 54 of file qgsosmdownload.h.

◆ setOutputFileName()

void QgsOSMDownload::setOutputFileName ( const QString outputFileName)
inline

Definition at line 59 of file qgsosmdownload.h.

◆ setQuery()

void QgsOSMDownload::setQuery ( const QString query)
inline

Definition at line 56 of file qgsosmdownload.h.

◆ setServiceUrl()

void QgsOSMDownload::setServiceUrl ( const QString serviceUrl)
inline

Definition at line 53 of file qgsosmdownload.h.

◆ start()

bool QgsOSMDownload::start ( )

Starts network request for data.

The prerequisite is that the query string and output file name have been set.

Only one request may be pending at one point - if you need more requests at once, use several instances.

Returns
true if the network request has been issued, false otherwise (and sets error string)

Definition at line 55 of file qgsosmdownload.cpp.


The documentation for this class was generated from the following files: