Skip to content
Permalink
Browse files

Boost coverage of SIP bindings

Now all classes and members are either exposed to bindings or marked
as "not available in Python bindings" in the docs.

Drop test thresholds to 0. Now it should be much easier to determine
what missing members have been added which are causing test
failures.
  • Loading branch information
nyalldawson committed Jan 4, 2016
1 parent 2341c2b commit 881074b1941dc73cac2eff49a035995076244b74
Showing with 1,542 additions and 171 deletions.
  1. +3 −0 python/CMakeLists.txt
  2. +5 −0 python/analysis/analysis.sip
  3. +105 −0 python/analysis/openstreetmap/qgsosmbase.sip
  4. +82 −0 python/analysis/openstreetmap/qgsosmdatabase.sip
  5. +65 −0 python/analysis/openstreetmap/qgsosmdownload.sip
  6. +53 −0 python/analysis/openstreetmap/qgsosmimport.sip
  7. +2 −0 python/analysis/raster/qgsrastermatrix.sip
  8. +6 −0 python/core/auth/qgsauthmanager.sip
  9. +4 −0 python/core/core.sip
  10. +4 −0 python/core/geometry/qgsgeometrycollectionv2.sip
  11. +6 −1 python/core/geometry/qgsgeometryengine.sip
  12. +4 −0 python/core/gps/qgsqtlocationconnection.sip
  13. +12 −0 python/core/layertree/qgslayertreegroup.sip
  14. +10 −0 python/core/layertree/qgslayertreelayer.sip
  15. +55 −1 python/core/layertree/qgslayertreemodel.sip
  16. +21 −0 python/core/layertree/qgslayertreemodellegendnode.sip
  17. +8 −0 python/core/layertree/qgslayertreenode.sip
  18. +9 −0 python/core/layertree/qgslayertreeregistrybridge.sip
  19. +3 −0 python/core/qgsapplication.sip
  20. +14 −0 python/core/qgsdataitem.sip
  21. +16 −0 python/core/qgsdataprovider.sip
  22. +5 −0 python/core/qgsdatasourceuri.sip
  23. +6 −0 python/core/qgsdiagramrendererv2.sip
  24. +7 −0 python/core/qgsexpression.sip
  25. +3 −0 python/core/qgsexpressioncontext.sip
  26. +6 −0 python/core/qgsgml.sip
  27. +53 −0 python/core/qgsmaphittest.sip
  28. +11 −2 python/core/qgsmaprenderer.sip
  29. +3 −0 python/core/qgsmapsettings.sip
  30. +5 −0 python/core/qgsmaptopixelgeometrysimplifier.sip
  31. +20 −0 python/core/qgsnetworkaccessmanager.sip
  32. +37 −0 python/core/qgsobjectcustomproperties.sip
  33. +30 −0 python/core/qgspallabeling.sip
  34. +36 −0 python/core/qgspoint.sip
  35. +10 −5 python/core/qgsproject.sip
  36. +0 −8 python/core/qgsrelation.sip
  37. +5 −0 python/core/qgssnappingutils.sip
  38. +5 −0 python/core/qgsvectorlayercache.sip
  39. +20 −0 python/core/qgsvectorlayereditpassthrough.sip
  40. +32 −15 python/core/qgsvectorlayerfeatureiterator.sip
  41. +20 −0 python/core/qgsxmlutils.sip
  42. +2 −0 python/core/raster/qgsrasterblock.sip
  43. +23 −14 python/core/raster/qgsrasterdataprovider.sip
  44. +2 −1 python/core/raster/qgsrasterdrawer.sip
  45. +18 −0 python/core/raster/qgsrasterinterface.sip
  46. +23 −0 python/core/raster/qgsrasterprojector.sip
  47. +20 −0 python/core/raster/qgsrasterrenderer.sip
  48. +6 −0 python/core/symbology-ng/qgscategorizedsymbolrendererv2.sip
  49. +4 −0 python/core/symbology-ng/qgsfillsymbollayerv2.sip
  50. +10 −0 python/core/symbology-ng/qgsgraduatedsymbolrendererv2.sip
  51. +20 −0 python/core/symbology-ng/qgsrendererv2.sip
  52. +3 −0 python/core/symbology-ng/qgssymbollayerv2.sip
  53. +2 −0 python/gui/attributetable/qgsdualview.sip
  54. +6 −0 python/gui/attributetable/qgsfeaturelistmodel.sip
  55. +2 −0 python/gui/attributetable/qgsfeaturelistviewdelegate.sip
  56. +18 −0 python/gui/attributetable/qgsfieldconditionalformatwidget.sip
  57. +12 −0 python/gui/editorwidgets/core/qgseditorwidgetfactory.sip
  58. +7 −0 python/gui/editorwidgets/core/qgseditorwidgetregistry.sip
  59. +59 −0 python/gui/editorwidgets/core/qgssearchwidgetwrapper.sip
  60. +17 −0 python/gui/editorwidgets/qgsrelationreferencewidget.sip
  61. +5 −0 python/gui/gui.sip
  62. +11 −0 python/gui/layertree/qgslayertreeview.sip
  63. +36 −0 python/gui/qgsattributetypeloaddialog.sip
  64. +31 −0 python/gui/qgsgroupwmsdatadialog.sip
  65. +3 −0 python/gui/qgsmapcanvas.sip
  66. +4 −0 python/gui/qgsmaplayercombobox.sip
  67. +8 −0 python/gui/qgsmapmouseevent.sip
  68. +14 −20 python/gui/qgsorderbydialog.sip
  69. +30 −0 python/gui/qgspixmaplabel.sip
  70. +1 −0 python/gui/qgsrasterlayersaveasdialog.sip
  71. +4 −0 python/gui/symbology-ng/qgsgraduatedsymbolrendererv2widget.sip
  72. +2 −0 python/gui/symbology-ng/qgsrendererv2widget.sip
  73. +3 −0 python/gui/symbology-ng/qgsstylev2managerdialog.sip
  74. +16 −0 python/gui/symbology-ng/qgssymbolslistwidget.sip
  75. +2 −0 python/server/qgsserverinterface.sip
  76. +1 −1 src/analysis/interpolation/qgsinterpolator.h
  77. +0 −6 src/analysis/openstreetmap/qgsosmbase.h
  78. +18 −2 src/analysis/openstreetmap/qgsosmdatabase.h
  79. +2 −0 src/analysis/openstreetmap/qgsosmimport.h
  80. +28 −9 src/core/auth/qgsauthcertutils.h
  81. +1 −0 src/core/auth/qgsauthcrypto.h
  82. +16 −5 src/core/auth/qgsauthmanager.h
  83. +1 −0 src/core/auth/qgsauthmethodmetadata.h
  84. +1 −0 src/core/auth/qgsauthmethodregistry.h
  85. +3 −1 src/core/dxf/qgsdxfpaintdevice.h
  86. +4 −0 src/core/dxf/qgsdxfpaintengine.h
  87. +1 −0 src/core/dxf/qgsdxfpallabeling.h
  88. +1 −1 src/core/geometry/qgsgeometry.cpp
  89. +1 −1 src/core/geometry/qgsgeometryeditutils.cpp
  90. +1 −0 src/core/geometry/qgsgeometryeditutils.h
  91. +1 −1 src/core/geometry/qgsgeometryengine.h
  92. +1 −0 src/core/geometry/qgsgeometryfactory.h
  93. +1 −0 src/core/geometry/qgsgeometryutils.h
  94. +1 −1 src/core/geometry/qgsgeos.cpp
  95. +1 −1 src/core/geometry/qgsgeos.h
  96. +4 −0 src/core/gps/qgsqtlocationconnection.h
  97. +3 −0 src/core/layertree/qgslayertreemodel.h
  98. +3 −0 src/core/qgsbrowsermodel.h
  99. +2 −1 src/core/qgsconnectionpool.h
  100. +1 −0 src/core/qgsdataitemproviderregistry.cpp
  101. +1 −0 src/core/qgsexception.h
  102. +12 −0 src/core/qgsexpression.h
  103. +6 −2 src/core/qgsfeatureiterator.h
  104. +1 −0 src/core/qgslabelfeature.h
  105. +2 −0 src/core/qgslabelingenginev2.h
  106. +4 −0 src/core/qgsmaphittest.h
  107. +1 −0 src/core/qgsmaprenderer.h
  108. +1 −0 src/core/qgsmaprendererjob.h
  109. +1 −0 src/core/qgsmaprendererparalleljob.h
  110. +0 −1 src/core/qgsnetworkaccessmanager.cpp
  111. +1 −0 src/core/qgsnetworkreplyparser.h
  112. +1 −0 src/core/qgspalgeometry.h
  113. +2 −0 src/core/qgspoint.h
  114. +8 −3 src/core/qgsproject.h
  115. +2 −2 src/core/qgsrelation.h
  116. +2 −0 src/core/qgsrendercontext.h
  117. +17 −1 src/core/qgsrulebasedlabeling.h
  118. +4 −0 src/core/qgsslconnect.h
  119. +17 −3 src/core/qgsspatialindex.cpp
  120. +2 −2 src/core/qgsspatialindex.h
  121. +2 −0 src/core/qgsvectorlayer.h
  122. +4 −1 src/core/qgsvectorlayerdiagramprovider.h
  123. +33 −17 src/core/qgsvectorlayerfeatureiterator.h
  124. +4 −0 src/core/qgsvectorlayerlabeling.h
  125. +2 −0 src/core/qgsvectorlayerlabelprovider.h
  126. +1 −0 src/core/qgsvectorlayerrenderer.h
  127. +2 −2 src/core/raster/qgsrasterblock.h
  128. +1 −1 src/core/raster/qgsrasterdataprovider.h
  129. +2 −1 src/core/raster/qgsrasterdrawer.h
  130. +1 −0 src/core/raster/qgsrasterlayerrenderer.h
  131. +1 −0 src/core/raster/qgsrasterrendererregistry.h
  132. +1 −0 src/core/symbology-ng/qgsgraduatedsymbolrendererv2.h
  133. +6 −6 src/core/symbology-ng/qgssymbollayerv2registry.h
  134. +1 −0 src/gui/attributetable/qgsfeaturelistview.h
  135. +1 −0 src/gui/attributetable/qgsgenericfeatureselectionmanager.h
  136. +4 −0 src/gui/attributetable/qgsvectorlayerselectionmanager.h
  137. +1 −0 src/gui/auth/qgsauthconfigedit.h
  138. +1 −0 src/gui/auth/qgsauthconfigidedit.h
  139. +1 −0 src/gui/auth/qgsauthguiutils.h
  140. +3 −1 src/gui/auth/qgsauthimportidentitydialog.h
  141. +1 −0 src/gui/auth/qgsauthmasterpassresetdialog.h
  142. +1 −0 src/gui/editorwidgets/core/qgseditorwidgetfactory.h
  143. +0 −1 src/gui/editorwidgets/core/qgssearchwidgetwrapper.h
  144. +1 −1 src/gui/editorwidgets/qgsdefaultsearchwidgetwrapper.h
  145. +5 −0 src/gui/editorwidgets/qgsdummyconfigdlg.h
  146. +1 −2 src/gui/editorwidgets/qgsrelationreferencewidget.h
  147. +1 −0 src/gui/editorwidgets/qgsvaluemapsearchwidgetwrapper.h
  148. +1 −0 src/gui/editorwidgets/qgsvaluerelationsearchwidgetwrapper.h
  149. +1 −0 src/gui/qgscodeeditor.h
  150. +1 −0 src/gui/qgscodeeditorhtml.h
  151. +1 −0 src/gui/qgscodeeditorpython.h
  152. +1 −0 src/gui/qgscodeeditorsql.h
  153. +3 −0 src/gui/qgscredentialdialog.h
  154. +4 −0 src/gui/qgsdatumtransformdialog.h
  155. +4 −2 src/gui/qgsmapcanvas.cpp
  156. +1 −0 src/gui/qgsmapcanvas.h
  157. +1 −0 src/gui/qgsmaptooltouch.h
  158. +4 −1 src/gui/qgsorderbydialog.h
  159. +1 −1 src/gui/qgspixmaplabel.h
  160. +1 −0 src/gui/symbology-ng/qgsrendererv2widget.h
  161. +1 −1 src/plugins/geometry_checker/checks/qgsgeometrygapcheck.cpp
  162. +22 −3 src/server/qgsrequesthandler.h
  163. +1 −9 tests/src/python/CMakeLists.txt
  164. +2 −8 tests/src/python/test_qgssipcoverage.py
  165. +3 −2 tests/src/python/utilities.py
@@ -203,10 +203,12 @@ INCLUDE_DIRECTORIES(
../src/analysis/raster
../src/analysis/network
../src/analysis/interpolation
../src/analysis/openstreetmap
${CMAKE_BINARY_DIR}/src/analysis/vector
${CMAKE_BINARY_DIR}/src/analysis/network
${CMAKE_BINARY_DIR}/src/analysis/raster
${CMAKE_BINARY_DIR}/src/analysis/interpolation
${CMAKE_BINARY_DIR}/src/analysis/openstreetmap
)

# analysis module
@@ -215,6 +217,7 @@ FILE(GLOB sip_files_analysis
analysis/raster/*.sip
analysis/vector/*.sip
analysis/interpolation/*.sip
analysis/openstreetmap/*.sip
)
SET(SIP_EXTRA_FILES_DEPEND ${sip_files_core} ${sip_files_analysis})
SET(SIP_EXTRA_OPTIONS ${PYQT_SIP_FLAGS} -o -a ${CMAKE_BINARY_DIR}/python/qgis.analysis.api)
@@ -34,6 +34,11 @@
%Include interpolation/qgsidwinterpolator.sip
%Include interpolation/qgstininterpolator.sip

%Include openstreetmap/qgsosmbase.sip
%Include openstreetmap/qgsosmdatabase.sip
%Include openstreetmap/qgsosmdownload.sip
%Include openstreetmap/qgsosmimport.sip

%Include raster/qgsalignraster.sip
%Include raster/qgsderivativefilter.sip
%Include raster/qgsaspectfilter.sip
@@ -0,0 +1,105 @@
typedef qint64 QgsOSMId;

struct QgsOSMElementID
{
%TypeHeaderCode
#include <qgsosmbase.h>
%End
enum Type { Invalid, Node, Way, Relation };

Type type;
qint64 id;
};


/**
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

public:
QgsOSMElement();
QgsOSMElement( QgsOSMElementID::Type t, qint64 id );

bool isValid() const;

// fetched automatically from DB
QgsOSMElementID elemID() const;
qint64 id() const;
//QString username() const;
//QDateTime timestamp() const;
//int version() const;

};



/**
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
{
%TypeHeaderCode
#include <qgsosmbase.h>
%End
public:
QgsOSMNode();
QgsOSMNode( qint64 id, const QgsPoint& point );

QgsPoint point() const;

};


/**
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
{
%TypeHeaderCode
#include <qgsosmbase.h>
%End
public:
QgsOSMWay();
QgsOSMWay( qint64 id, const QList<qint64>& nodes );

QList<qint64> nodes() const;

// fetched on-demand
//QList<OSMElementID> relations() const;

};

/**
* This class is a container of tags for a node, way or a relation.
*/
class QgsOSMTags
{
%TypeHeaderCode
#include <qgsosmbase.h>
%End
public:
QgsOSMTags();

int count() const;
QList<QString> keys() const;
bool contains( const QString& k ) const;
void insert( const QString& k, const QString& v );
QString value( const QString& k ) const;

};
@@ -0,0 +1,82 @@
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
{
%TypeHeaderCode
#include <qgsosmdatabase.h>
%End
public:
explicit QgsOSMDatabase( const QString& dbFileName = QString() );
~QgsOSMDatabase();

void setFileName( const QString& dbFileName );
QString filename() const;
bool isOpen() const;

bool open();
bool close();

QString errorString() const;

// data access

int countNodes() const;
int countWays() const;

//! @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;

//! @note available in Python bindings
//QList<QPair<QString, int>> usedTags( bool ways ) const;

QgsPolyline wayPoints( qint64 id ) const;

// export to spatialite

enum ExportType { Point, Polyline, Polygon };
bool exportSpatiaLite( ExportType type, const QString& tableName,
const QStringList& tagKeys = QStringList(),
const QStringList& noNullTagKeys = QStringList() );

protected:
bool prepareStatements();
int runCountStatement( const char* sql ) const;

/** @note not available in Python bindings
*/
//void deleteStatement( sqlite3_stmt*& stmt );

void exportSpatiaLiteNodes( const QString& tableName, const QStringList& tagKeys, const QStringList& notNullTagKeys = QStringList() );
void exportSpatiaLiteWays( bool closed, const QString& tableName, const QStringList& tagKeys, const QStringList& notNullTagKeys = QStringList() );
bool createSpatialTable( const QString& tableName, const QString& geometryType, const QStringList& tagKeys );
bool createSpatialIndex( const QString& tableName );

QString quotedIdentifier( QString id );
QString quotedValue( QString value );

};


@@ -0,0 +1,65 @@
/**
* @brief 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 retreive 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.
*/
class QgsOSMDownload : QObject
{
%TypeHeaderCode
#include <qgsosmdownload.h>
%End
public:

//! Return URL of the service that is used by default
static QString defaultServiceUrl();

//! Create query (in Overpass Query Language) that fetches everything in given rectangle
static QString queryFromRect( const QgsRectangle& rect );

QgsOSMDownload();
~QgsOSMDownload();

void setServiceUrl( const QString& serviceUrl );
QString serviceUrl() const;

void setQuery( const QString& query );
QString query() const;

void setOutputFileName( const QString& outputFileName );
QString outputFileName() const;

bool hasError() const;
QString errorString() const;

/**
* @brief 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.
*
* @return true if the network request has been issued, false otherwise (and sets error string)
*/
bool start();

/**
* @brief Aborts current pending request
* @return true if there is a pending request and has been aborted, false otherwise
*/
bool abort();

//! Returns true if the request has already finished
bool isFinished() const;

signals:
void finished(); //!< emitted when the network reply has finished (with success or with an error)
void downloadProgress( qint64, qint64 ); //!< normally the total length is not known (until we reach end)

};
@@ -0,0 +1,53 @@

/**
* @brief The QgsOSMXmlImport class imports OpenStreetMap XML format to our topological representation
* in a SQLite database (see QgsOSMDatabase for details).
*
* How to use the classs:
* 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
{
%TypeHeaderCode
#include <qgsosmimport.h>
%End
public:
explicit QgsOSMXmlImport( const QString& xmlFileName = QString(), const QString& dbFileName = QString() );

void setInputXmlFileName( const QString& xmlFileName );
QString inputXmlFileName() const;

void setOutputDbFileName( const QString& dbFileName );
QString outputDbFileName() const;

/**
* 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();

bool hasError() const;
QString errorString() const;

signals:
void progress( int percent );

protected:

bool createDatabase();
bool closeDatabase();

//! @note not available in Python bindings
//void deleteStatement( sqlite3_stmt*& stmt );

bool createIndexes();

void readRoot( QXmlStreamReader& xml );
void readNode( QXmlStreamReader& xml );
void readWay( QXmlStreamReader& xml );
void readTag( bool way, qint64 id, QXmlStreamReader& xml );

};

@@ -86,4 +86,6 @@ class QgsRasterMatrix
bool tangens();
bool atangens();
bool changeSign();
bool log();
bool log10();
};
@@ -131,6 +131,9 @@ class QgsAuthManager : QObject

const QList<QSslCertificate> getCertIdentities();

/** Get list of certificate identity ids from database */
QStringList getCertIdentityIds() const;

bool existsCertIdentity( const QString& id );

bool removeCertIdentity( const QString& id );
@@ -217,6 +220,9 @@ class QgsAuthManager : QObject

void masterPasswordVerified( bool verified ) const;

/** Emmitted when a user has indicated they may want to erase the authentication db. */
void authDatabaseEraseRequested() const;

void authDatabaseChanged() const;

public slots:

1 comment on commit 881074b

@NathanW2

This comment has been minimized.

Copy link
Member

@NathanW2 NathanW2 commented on 881074b Jan 5, 2016

wow nice work.

Please sign in to comment.
You can’t perform that action at this time.