mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
sipify OSM classes
This commit is contained in:
parent
6c7a12a207
commit
b17b36efc9
@ -1,105 +1,147 @@
|
||||
/************************************************************************
|
||||
* This file has been generated automatically from *
|
||||
* *
|
||||
* src/analysis/openstreetmap/qgsosmbase.h *
|
||||
* *
|
||||
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
||||
************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
typedef qint64 QgsOSMId;
|
||||
|
||||
|
||||
struct QgsOSMElementID
|
||||
{
|
||||
%TypeHeaderCode
|
||||
#include <qgsosmbase.h>
|
||||
%End
|
||||
enum Type { Invalid, Node, Way, Relation };
|
||||
|
||||
Type type;
|
||||
qint64 id;
|
||||
QgsOSMId id;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
class QgsOSMElement
|
||||
{
|
||||
%Docstring
|
||||
Elements (also data primitives) are the basic components in OpenStreetMap from which everything else
|
||||
is defined. These consist of Nodes (which define a point in space), Ways (which define a linear features
|
||||
and areas), and Relations - with an optional role - which are sometimes used to define the relation
|
||||
between other elements. All of the above can have one of more associated tags.
|
||||
*/
|
||||
class QgsOSMElement
|
||||
{
|
||||
|
||||
%TypeHeaderCode
|
||||
#include <qgsosmbase.h>
|
||||
%End
|
||||
|
||||
%TypeHeaderCode
|
||||
#include "qgsosmbase.h"
|
||||
%End
|
||||
public:
|
||||
QgsOSMElement();
|
||||
QgsOSMElement( QgsOSMElementID::Type t, qint64 id );
|
||||
QgsOSMElement( QgsOSMElementID::Type t, QgsOSMId id );
|
||||
|
||||
bool isValid() const;
|
||||
%Docstring
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
// fetched automatically from DB
|
||||
QgsOSMElementID elemId() const;
|
||||
qint64 id() const;
|
||||
//QString username() const;
|
||||
//QDateTime timestamp() const;
|
||||
//int version() const;
|
||||
%Docstring
|
||||
:rtype: QgsOSMElementID
|
||||
%End
|
||||
QgsOSMId id() const;
|
||||
%Docstring
|
||||
:rtype: QgsOSMId
|
||||
%End
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
class QgsOSMNode : QgsOSMElement
|
||||
{
|
||||
%Docstring
|
||||
A node is one of the core elements in the OpenStreetMap data model. It consists of a single geospatial
|
||||
point using a latitude and longitude. A third optional dimension, altitude, can be recorded; key:ele
|
||||
and a node can also be defined at a particular layer=* or level=*. Nodes can be used to define standalone
|
||||
point features or be used to define the path of a way.
|
||||
*/
|
||||
class QgsOSMNode : QgsOSMElement
|
||||
{
|
||||
%End
|
||||
|
||||
%TypeHeaderCode
|
||||
#include <qgsosmbase.h>
|
||||
#include "qgsosmbase.h"
|
||||
%End
|
||||
public:
|
||||
QgsOSMNode();
|
||||
QgsOSMNode( qint64 id, const QgsPoint &point );
|
||||
QgsOSMNode( QgsOSMId id, const QgsPoint &point );
|
||||
|
||||
QgsPoint point() const;
|
||||
%Docstring
|
||||
:rtype: QgsPoint
|
||||
%End
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
class QgsOSMWay : QgsOSMElement
|
||||
{
|
||||
%Docstring
|
||||
A way is an ordered list of nodes which normally also has at least one tag or is included within
|
||||
a Relation. A way can have between 2 and 2,000 nodes, although it's possible that faulty ways with zero
|
||||
or a single node exist. A way can be open or closed. A closed way is one whose last node on the way
|
||||
is also the first on that way. A closed way may be interpreted either as a closed polyline, or an area,
|
||||
or both.
|
||||
*/
|
||||
class QgsOSMWay : QgsOSMElement
|
||||
{
|
||||
%End
|
||||
|
||||
%TypeHeaderCode
|
||||
#include <qgsosmbase.h>
|
||||
#include "qgsosmbase.h"
|
||||
%End
|
||||
public:
|
||||
QgsOSMWay();
|
||||
QgsOSMWay( qint64 id, const QList<qint64> &nodes );
|
||||
QgsOSMWay( QgsOSMId id, const QList<QgsOSMId> &nodes );
|
||||
|
||||
QList<qint64> nodes() const;
|
||||
QList<QgsOSMId> nodes() const;
|
||||
%Docstring
|
||||
:rtype: list of QgsOSMId
|
||||
%End
|
||||
|
||||
// fetched on-demand
|
||||
//QList<OSMElementID> relations() const;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* This class is a container of tags for a node, way or a relation.
|
||||
*/
|
||||
|
||||
|
||||
class QgsOSMTags
|
||||
{
|
||||
%Docstring
|
||||
This class is a container of tags for a node, way or a relation.
|
||||
%End
|
||||
|
||||
%TypeHeaderCode
|
||||
#include <qgsosmbase.h>
|
||||
#include "qgsosmbase.h"
|
||||
%End
|
||||
public:
|
||||
QgsOSMTags();
|
||||
|
||||
int count() const;
|
||||
%Docstring
|
||||
:rtype: int
|
||||
%End
|
||||
QList<QString> keys() const;
|
||||
%Docstring
|
||||
:rtype: list of str
|
||||
%End
|
||||
bool contains( const QString &k ) const;
|
||||
%Docstring
|
||||
:rtype: bool
|
||||
%End
|
||||
void insert( const QString &k, const QString &v );
|
||||
QString value( const QString &k ) const;
|
||||
%Docstring
|
||||
:rtype: str
|
||||
%End
|
||||
|
||||
};
|
||||
|
||||
/************************************************************************
|
||||
* This file has been generated automatically from *
|
||||
* *
|
||||
* src/analysis/openstreetmap/qgsosmbase.h *
|
||||
* *
|
||||
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
||||
************************************************************************/
|
||||
|
@ -1,85 +1,158 @@
|
||||
/************************************************************************
|
||||
* This file has been generated automatically from *
|
||||
* *
|
||||
* src/analysis/openstreetmap/qgsosmdatabase.h *
|
||||
* *
|
||||
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
||||
************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
typedef QPair<QString, int> QgsOSMTagCountPair;
|
||||
|
||||
/**
|
||||
* Class that encapsulates access to OpenStreetMap data stored in a database
|
||||
* previously imported from XML file.
|
||||
*
|
||||
* Internal database structure consists of the following tables:
|
||||
* - nodes
|
||||
* - nodes_tags
|
||||
* - ways
|
||||
* - ways_tags
|
||||
* - ways_nodes
|
||||
*
|
||||
* The topology representation can be translated to simple features representation
|
||||
* using exportSpatiaLite() method into SpatiaLite layers (tables). These can be
|
||||
* easily used in QGIS like any other layers.
|
||||
*/
|
||||
class QgsOSMDatabase
|
||||
{
|
||||
%Docstring
|
||||
Class that encapsulates access to OpenStreetMap data stored in a database
|
||||
previously imported from XML file.
|
||||
|
||||
Internal database structure consists of the following tables:
|
||||
- nodes
|
||||
- nodes_tags
|
||||
- ways
|
||||
- ways_tags
|
||||
- ways_nodes
|
||||
|
||||
The topology representation can be translated to simple features representation
|
||||
using exportSpatiaLite() method into SpatiaLite layers (tables). These can be
|
||||
easily used in QGIS like any other layers.
|
||||
%End
|
||||
|
||||
%TypeHeaderCode
|
||||
#include <qgsosmdatabase.h>
|
||||
#include "qgsosmdatabase.h"
|
||||
%End
|
||||
public:
|
||||
explicit QgsOSMDatabase( const QString &dbFileName = QString() );
|
||||
~QgsOSMDatabase();
|
||||
|
||||
|
||||
void setFileName( const QString &dbFileName );
|
||||
%Docstring
|
||||
Setter for the spatialite database.
|
||||
%End
|
||||
QString filename() const;
|
||||
%Docstring
|
||||
:rtype: str
|
||||
%End
|
||||
bool isOpen() const;
|
||||
%Docstring
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
bool open();
|
||||
%Docstring
|
||||
:rtype: bool
|
||||
%End
|
||||
bool close();
|
||||
%Docstring
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
QString errorString() const;
|
||||
%Docstring
|
||||
:rtype: str
|
||||
%End
|
||||
|
||||
// data access
|
||||
|
||||
int countNodes() const;
|
||||
%Docstring
|
||||
:rtype: int
|
||||
%End
|
||||
int countWays() const;
|
||||
%Docstring
|
||||
:rtype: int
|
||||
%End
|
||||
|
||||
//! @note not available in Python bindings
|
||||
//QgsOSMNodeIterator listNodes() const;
|
||||
//! @note not available in Python bindings
|
||||
//QgsOSMWayIterator listWays() const;
|
||||
|
||||
QgsOSMNode node( qint64 id ) const;
|
||||
QgsOSMWay way( qint64 id ) const;
|
||||
//OSMRelation relation( OSMId id ) const;
|
||||
|
||||
QgsOSMTags tags( bool way, qint64 id ) const;
|
||||
QgsOSMNode node( QgsOSMId id ) const;
|
||||
%Docstring
|
||||
:rtype: QgsOSMNode
|
||||
%End
|
||||
QgsOSMWay way( QgsOSMId id ) const;
|
||||
%Docstring
|
||||
:rtype: QgsOSMWay
|
||||
%End
|
||||
|
||||
//! @note available in Python bindings
|
||||
//QList<QPair<QString, int>> usedTags( bool ways ) const;
|
||||
QgsOSMTags tags( bool way, QgsOSMId id ) const;
|
||||
%Docstring
|
||||
:rtype: QgsOSMTags
|
||||
%End
|
||||
|
||||
QgsPolyline wayPoints( qint64 id ) const;
|
||||
|
||||
// export to spatialite
|
||||
QgsPolyline wayPoints( QgsOSMId id ) const;
|
||||
%Docstring
|
||||
:rtype: QgsPolyline
|
||||
%End
|
||||
|
||||
|
||||
enum ExportType { Point, Polyline, Polygon };
|
||||
bool exportSpatiaLite( ExportType type, const QString& tableName,
|
||||
const QStringList& tagKeys = QStringList(),
|
||||
bool exportSpatiaLite( ExportType type, const QString &tableName,
|
||||
const QStringList &tagKeys = QStringList(),
|
||||
const QStringList &noNullTagKeys = QStringList() );
|
||||
%Docstring
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
protected:
|
||||
bool prepareStatements();
|
||||
%Docstring
|
||||
:rtype: bool
|
||||
%End
|
||||
int runCountStatement( const char *sql ) const;
|
||||
%Docstring
|
||||
:rtype: int
|
||||
%End
|
||||
|
||||
/** @note not available in Python bindings
|
||||
*/
|
||||
//void deleteStatement( sqlite3_stmt* &stmt );
|
||||
|
||||
void exportSpatiaLiteNodes( const QString &tableName, const QStringList &tagKeys, const QStringList ¬NullTagKeys = QStringList() );
|
||||
void exportSpatiaLiteWays( bool closed, const QString &tableName, const QStringList &tagKeys, const QStringList ¬NullTagKeys = QStringList() );
|
||||
bool createSpatialTable( const QString &tableName, const QString &geometryType, const QStringList &tagKeys );
|
||||
%Docstring
|
||||
:rtype: bool
|
||||
%End
|
||||
bool createSpatialIndex( const QString &tableName );
|
||||
%Docstring
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
QString quotedIdentifier( QString id );
|
||||
%Docstring
|
||||
:rtype: str
|
||||
%End
|
||||
QString quotedValue( QString value );
|
||||
%Docstring
|
||||
:rtype: str
|
||||
%End
|
||||
|
||||
private:
|
||||
|
||||
QgsOSMDatabase( const QgsOSMDatabase &rh );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* This file has been generated automatically from *
|
||||
* *
|
||||
* src/analysis/openstreetmap/qgsosmdatabase.h *
|
||||
* *
|
||||
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
||||
************************************************************************/
|
||||
|
@ -1,35 +1,67 @@
|
||||
/************************************************************************
|
||||
* This file has been generated automatically from *
|
||||
* *
|
||||
* src/analysis/openstreetmap/qgsosmimport.h *
|
||||
* *
|
||||
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
||||
************************************************************************/
|
||||
|
||||
/**
|
||||
* @brief The QgsOSMXmlImport class imports OpenStreetMap XML format to our topological representation
|
||||
* in a SQLite database (see QgsOSMDatabase for details).
|
||||
*
|
||||
* How to use the class:
|
||||
* 1. set input XML file name and output DB file name (in constructor or with respective functions)
|
||||
* 2. run import()
|
||||
* 3. check errorString() if the import failed
|
||||
*/
|
||||
class QgsOSMXmlImport : public QObject
|
||||
|
||||
|
||||
|
||||
|
||||
class QgsOSMXmlImport : QObject
|
||||
{
|
||||
%Docstring
|
||||
The QgsOSMXmlImport class imports OpenStreetMap XML format to our topological representation
|
||||
in a SQLite database (see QgsOSMDatabase for details).
|
||||
|
||||
How to use the class:
|
||||
1. set input XML file name and output DB file name (in constructor or with respective functions)
|
||||
2. run import()
|
||||
3. check errorString() if the import failed
|
||||
%End
|
||||
|
||||
%TypeHeaderCode
|
||||
#include <qgsosmimport.h>
|
||||
#include "qgsosmimport.h"
|
||||
%End
|
||||
public:
|
||||
explicit QgsOSMXmlImport( const QString &xmlFileName = QString(), const QString &dbFileName = QString() );
|
||||
|
||||
void setInputXmlFileName( const QString &xmlFileName );
|
||||
QString inputXmlFileName() const;
|
||||
%Docstring
|
||||
:rtype: str
|
||||
%End
|
||||
|
||||
void setOutputDatabaseFileName( const QString &fileName );
|
||||
QString outputDatabaseFileName() const;
|
||||
%Docstring
|
||||
Sets the filename for the output database.
|
||||
.. seealso:: outputDatabaseFileName()
|
||||
%End
|
||||
|
||||
QString outputDatabaseFileName() const;
|
||||
%Docstring
|
||||
Returns the filename for the output database.
|
||||
.. seealso:: setOutputDatabaseFileName()
|
||||
:rtype: str
|
||||
%End
|
||||
|
||||
/**
|
||||
* Run import. This will parse the XML file and store the data in a SQLite database.
|
||||
* @return true on success, false when import failed (see errorString() for the error)
|
||||
*/
|
||||
bool import();
|
||||
%Docstring
|
||||
Run import. This will parse the XML file and store the data in a SQLite database.
|
||||
:return: true on success, false when import failed (see errorString() for the error)
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
bool hasError() const;
|
||||
%Docstring
|
||||
:rtype: bool
|
||||
%End
|
||||
QString errorString() const;
|
||||
%Docstring
|
||||
:rtype: str
|
||||
%End
|
||||
|
||||
signals:
|
||||
void progress( int percent );
|
||||
@ -37,17 +69,33 @@ class QgsOSMXmlImport : public QObject
|
||||
protected:
|
||||
|
||||
bool createDatabase();
|
||||
%Docstring
|
||||
:rtype: bool
|
||||
%End
|
||||
bool closeDatabase();
|
||||
%Docstring
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
//! @note not available in Python bindings
|
||||
//void deleteStatement( sqlite3_stmt* &stmt );
|
||||
|
||||
bool createIndexes();
|
||||
%Docstring
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
void readRoot( QXmlStreamReader &xml );
|
||||
void readNode( QXmlStreamReader &xml );
|
||||
void readWay( QXmlStreamReader &xml );
|
||||
void readTag( bool way, qint64 id, QXmlStreamReader &xml );
|
||||
void readTag( bool way, QgsOSMId id, QXmlStreamReader &xml );
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* This file has been generated automatically from *
|
||||
* *
|
||||
* src/analysis/openstreetmap/qgsosmimport.h *
|
||||
* *
|
||||
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
||||
************************************************************************/
|
||||
|
@ -233,9 +233,6 @@ analysis/interpolation/qgsgridfilewriter.sip
|
||||
analysis/interpolation/qgsinterpolator.sip
|
||||
analysis/interpolation/qgsidwinterpolator.sip
|
||||
analysis/interpolation/qgstininterpolator.sip
|
||||
analysis/openstreetmap/qgsosmbase.sip
|
||||
analysis/openstreetmap/qgsosmdatabase.sip
|
||||
analysis/openstreetmap/qgsosmimport.sip
|
||||
analysis/raster/qgsderivativefilter.sip
|
||||
analysis/raster/qgsaspectfilter.sip
|
||||
analysis/raster/qgskde.sip
|
||||
|
@ -26,7 +26,7 @@ typedef qint64 QgsOSMId;
|
||||
|
||||
class QgsOSMDatabase;
|
||||
|
||||
struct QgsOSMElementID
|
||||
struct ANALYSIS_EXPORT QgsOSMElementID
|
||||
{
|
||||
enum Type { Invalid, Node, Way, Relation };
|
||||
|
||||
|
@ -56,6 +56,7 @@ class ANALYSIS_EXPORT QgsOSMDatabase
|
||||
//! QgsOSMDatabase cannot be copied.
|
||||
QgsOSMDatabase &operator=( const QgsOSMDatabase &rh ) = delete;
|
||||
|
||||
//! Setter for the spatialite database.
|
||||
void setFileName( const QString &dbFileName ) { mDbFileName = dbFileName; }
|
||||
QString filename() const { return mDbFileName; }
|
||||
bool isOpen() const;
|
||||
@ -82,8 +83,9 @@ class ANALYSIS_EXPORT QgsOSMDatabase
|
||||
|
||||
QgsOSMTags tags( bool way, QgsOSMId id ) const;
|
||||
|
||||
//! \note available in Python bindings
|
||||
QList<QgsOSMTagCountPair> usedTags( bool ways ) const;
|
||||
//! \note not available in Python bindings
|
||||
//! SIP does not seem to handle this return type - strange
|
||||
QList<QgsOSMTagCountPair> usedTags( bool ways ) const SIP_SKIP;
|
||||
|
||||
QgsPolyline wayPoints( QgsOSMId id ) const;
|
||||
|
||||
@ -112,6 +114,11 @@ class ANALYSIS_EXPORT QgsOSMDatabase
|
||||
QString quotedValue( QString value );
|
||||
|
||||
private:
|
||||
|
||||
#ifdef SIP_RUN
|
||||
QgsOSMDatabase( const QgsOSMDatabase &rh );
|
||||
#endif
|
||||
|
||||
//! database file name
|
||||
QString mDbFileName;
|
||||
|
||||
@ -134,6 +141,7 @@ class ANALYSIS_EXPORT QgsOSMDatabase
|
||||
* Encapsulate iteration over table of nodes/
|
||||
* \note not available in Python bindings
|
||||
*/
|
||||
#ifndef SIP_RUN
|
||||
class ANALYSIS_EXPORT QgsOSMNodeIterator // clazy:exclude=rule-of-three
|
||||
{
|
||||
public:
|
||||
@ -153,6 +161,7 @@ class ANALYSIS_EXPORT QgsOSMNodeIterator // clazy:exclude=rule-of-three
|
||||
friend class QgsOSMDatabase;
|
||||
|
||||
};
|
||||
#endif // SIP_RUN
|
||||
|
||||
|
||||
|
||||
@ -160,6 +169,7 @@ class ANALYSIS_EXPORT QgsOSMNodeIterator // clazy:exclude=rule-of-three
|
||||
* Encapsulate iteration over table of ways
|
||||
* \note not available in Python bindings
|
||||
*/
|
||||
#ifndef SIP_RUN
|
||||
class ANALYSIS_EXPORT QgsOSMWayIterator // clazy:exclude=rule-of-three
|
||||
{
|
||||
public:
|
||||
@ -179,6 +189,7 @@ class ANALYSIS_EXPORT QgsOSMWayIterator // clazy:exclude=rule-of-three
|
||||
friend class QgsOSMDatabase;
|
||||
|
||||
};
|
||||
#endif // SIP_RUN
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user