Skip to content
Permalink
Browse files

Update Python bindings to match changes in core/gui libraries.

  • Loading branch information
wonder-sk committed Dec 5, 2013
1 parent 412eaf4 commit 2bece090f5389d8f867cf4a76c2a4270f22f96ee
Showing with 589 additions and 205 deletions.
  1. +2 −1 python/core/composer/qgscomposermap.sip
  2. +13 −2 python/core/composer/qgscomposition.sip
  3. +2 −0 python/core/core.sip
  4. +3 −0 python/core/diagram/qgsdiagram.sip
  5. +2 −0 python/core/diagram/qgshistogramdiagram.sip
  6. +2 −0 python/core/diagram/qgspiediagram.sip
  7. +3 −0 python/core/diagram/qgstextdiagram.sip
  8. +10 −0 python/core/qgsdiagramrendererv2.sip
  9. +20 −0 python/core/qgsfeaturerequest.sip
  10. +12 −2 python/core/qgsfield.sip
  11. +1 −3 python/core/qgsgeometrycache.sip
  12. +2 −2 python/core/qgslabelsearchtree.sip
  13. +19 −32 python/core/qgsmaplayer.sip
  14. +2 −1 python/core/qgsmaplayerregistry.sip
  15. +20 −0 python/core/qgsmaplayerrenderer.sip
  16. +29 −9 python/core/qgsmaprenderer.sip
  17. +122 −0 python/core/qgsmapsettings.sip
  18. +40 −10 python/core/qgspallabeling.sip
  19. +4 −0 python/core/qgsrendercontext.sip
  20. +5 −1 python/core/qgssnapper.sip
  21. +10 −5 python/core/qgsspatialindex.sip
  22. +30 −4 python/core/qgstolerance.sip
  23. +20 −2 python/core/qgsvectordataprovider.sip
  24. +5 −10 python/core/qgsvectorlayer.sip
  25. +5 −0 python/core/qgsvectorlayerfeatureiterator.sip
  26. +11 −6 python/core/raster/qgsrasterlayer.sip
  27. +1 −1 python/core/symbology-ng/qgscategorizedsymbolrendererv2.sip
  28. +1 −1 python/core/symbology-ng/qgsgraduatedsymbolrendererv2.sip
  29. +1 −1 python/core/symbology-ng/qgspointdisplacementrenderer.sip
  30. +4 −1 python/core/symbology-ng/qgsrendererv2.sip
  31. +2 −2 python/core/symbology-ng/qgsrulebasedrendererv2.sip
  32. +1 −1 python/core/symbology-ng/qgssinglesymbolrendererv2.sip
  33. +1 −1 python/core/symbology-ng/qgssymbollayerv2.sip
  34. +8 −4 python/core/symbology-ng/qgssymbolv2.sip
  35. +66 −22 python/gui/qgsmapcanvas.sip
  36. +2 −1 python/gui/qgsmapcanvasitem.sip
  37. +21 −14 python/gui/qgsmapcanvasmap.sip
  38. +7 −4 python/gui/qgsmapoverviewcanvas.sip
  39. +2 −1 python/gui/qgsmaptool.sip
  40. +1 −1 src/app/nodetool/qgsselectedfeature.cpp
  41. +4 −4 src/app/qgisapp.cpp
  42. +1 −1 src/app/qgisapp.h
  43. +1 −1 src/app/qgsdecorationgrid.cpp
  44. +1 −1 src/app/qgsmaptoolmeasureangle.cpp
  45. +1 −1 src/app/qgsmeasuretool.cpp
  46. +1 −1 src/core/composer/qgscomposermap.cpp
  47. +1 −0 src/core/composer/qgscomposition.h
  48. +3 −1 src/core/qgsfeaturerequest.h
  49. +11 −13 src/core/qgsmaprenderer.cpp
  50. +4 −1 src/core/qgsmaprenderer.h
  51. +2 −2 src/core/qgsmapsettings.cpp
  52. +2 −4 src/core/qgsmapsettings.h
  53. +1 −0 src/core/qgsrendercontext.h
  54. +6 −0 src/core/qgsspatialindex.cpp
  55. +3 −0 src/core/qgsspatialindex.h
  56. +0 −1 src/gui/CMakeLists.txt
  57. +13 −17 src/gui/qgsmapcanvas.cpp
  58. +10 −3 src/gui/qgsmapcanvas.h
  59. +1 −1 src/gui/qgsmapcanvasmap.h
  60. +1 −1 src/gui/qgsmapoverviewcanvas.cpp
  61. +3 −0 src/gui/qgsmapoverviewcanvas.h
  62. +1 −1 src/plugins/coordinate_capture/coordinatecapture.cpp
  63. +1 −1 src/plugins/grass/qgsgrassplugin.cpp
  64. +1 −1 src/plugins/grass/qgsgrassregion.cpp
  65. +1 −1 tests/src/core/testqgsatlascomposition.cpp
  66. +1 −1 tests/src/core/testqgscomposerlabel.cpp
  67. +1 −1 tests/src/core/testqgscomposermap.cpp
  68. +1 −1 tests/src/core/testqgscomposerscalebar.cpp
@@ -141,7 +141,8 @@ class QgsComposerMap : QgsComposerItem

QgsRectangle extent() const;

const QgsMapRenderer* mapRenderer() const;
//! @deprecated since 2.1 - use mapSettings() - may return 0 if not initialized with QgsMapRenderer
const QgsMapRenderer* mapRenderer() const /Deprecated/;

/**Sets offset values to shift image (useful for live updates when moving item content)*/
void setOffset( double xOffset, double yOffset );
@@ -28,7 +28,9 @@ class QgsComposition : QGraphicsScene
Crosses
};

QgsComposition( QgsMapRenderer* mapRenderer );
//! @deprecated since 2.1 - use the constructor with QgsMapSettings
QgsComposition( QgsMapRenderer* mapRenderer ) /Deprecated/;
explicit QgsComposition( const QgsMapSettings& mapSettings );
~QgsComposition();

/**Changes size of paper item*/
@@ -151,7 +153,12 @@ class QgsComposition : QGraphicsScene
void setWorldFileMap( QgsComposerMap* map );

/**Returns pointer to map renderer of qgis map canvas*/
QgsMapRenderer* mapRenderer();
//! @deprecated since 2.1 - use mapSettings() instead. May return null if not initialized with QgsMapRenderer
QgsMapRenderer* mapRenderer() /Deprecated/;

//! Return setting of QGIS map canvas
//! @note added in 2.1
const QgsMapSettings& mapSettings() const;

QgsComposition::PlotStyle plotStyle() const;
void setPlotStyle( QgsComposition::PlotStyle style );
@@ -310,6 +317,10 @@ class QgsComposition : QGraphicsScene
public slots:
/**Casts object to the proper subclass type and calls corresponding itemAdded signal*/
void sendItemAddedSignal( QgsComposerItem* item );

protected:
void init();

signals:
void paperSizeChanged();
void nPagesChanged();
@@ -45,7 +45,9 @@
%Include qgslogger.sip
%Include qgsmaplayer.sip
%Include qgsmaplayerregistry.sip
%Include qgsmaplayerrenderer.sip
%Include qgsmaprenderer.sip
%Include qgsmapsettings.sip
%Include qgsmaptopixel.sip
%Include qgsmessagelog.sip
%Include qgsmessageoutput.sip
@@ -5,6 +5,9 @@ class QgsDiagram
%End
public:
virtual ~QgsDiagram();
/** Returns an instance that is equivalent to this one
* @note added in 2.1 */
virtual QgsDiagram* clone() const = 0;
/**Draws the diagram at the given position (in pixel coordinates)*/
virtual void renderDiagram( const QgsAttributes& att, QgsRenderContext& c, const QgsDiagramSettings& s, const QPointF& position ) = 0;
virtual QString diagramName() const = 0;
@@ -7,6 +7,8 @@ class QgsHistogramDiagram: QgsDiagram
QgsHistogramDiagram();
~QgsHistogramDiagram();

virtual QgsDiagram* clone() const;

void renderDiagram( const QgsAttributes& att, QgsRenderContext& c, const QgsDiagramSettings& s, const QPointF& position );
QSizeF diagramSize( const QgsAttributes& attributes, const QgsRenderContext& c, const QgsDiagramSettings& s );
QSizeF diagramSize( const QgsAttributes& attributes, const QgsRenderContext& c, const QgsDiagramSettings& s, const QgsDiagramInterpolationSettings& is );
@@ -7,6 +7,8 @@ class QgsPieDiagram: QgsDiagram
QgsPieDiagram();
~QgsPieDiagram();

virtual QgsDiagram* clone() const;

void renderDiagram( const QgsAttributes& att, QgsRenderContext& c, const QgsDiagramSettings& s, const QPointF& position );
QSizeF diagramSize( const QgsAttributes& attributes, const QgsRenderContext& c, const QgsDiagramSettings& s );
QSizeF diagramSize( const QgsAttributes& attributes, const QgsRenderContext& c, const QgsDiagramSettings& s, const QgsDiagramInterpolationSettings& is );
@@ -20,6 +20,9 @@ class QgsTextDiagram: QgsDiagram

QgsTextDiagram();
~QgsTextDiagram();

virtual QgsDiagram* clone() const;

void renderDiagram( const QgsAttributes& att, QgsRenderContext& c, const QgsDiagramSettings& s, const QPointF& position );
QSizeF diagramSize( const QgsAttributes& attributes, const QgsRenderContext& c, const QgsDiagramSettings& s );
QSizeF diagramSize( const QgsAttributes& attributes, const QgsRenderContext& c, const QgsDiagramSettings& s, const QgsDiagramInterpolationSettings& is );
@@ -24,6 +24,8 @@ struct QgsDiagramLayerSettings

QgsDiagramLayerSettings();

~QgsDiagramLayerSettings();

//pal placement properties
Placement placement;
LinePlacementFlags placementFlags;
@@ -118,6 +120,10 @@ class QgsDiagramRendererV2
QgsDiagramRendererV2();
virtual ~QgsDiagramRendererV2();

/** Returns new instance that is equivalent to this one
* @note added in 2.1 */
virtual QgsDiagramRendererV2* clone() const = 0;

/**Returns size of the diagram for feature f in map units. Returns an invalid QSizeF in case of error*/
virtual QSizeF sizeMapUnits( const QgsAttributes& attributes, const QgsRenderContext& c );

@@ -171,6 +177,8 @@ class QgsSingleCategoryDiagramRenderer : QgsDiagramRendererV2
QgsSingleCategoryDiagramRenderer();
~QgsSingleCategoryDiagramRenderer();

QgsDiagramRendererV2* clone() const;

QString rendererName() const;

QList<int> diagramAttributes() const;
@@ -198,6 +206,8 @@ class QgsLinearlyInterpolatedDiagramRenderer : QgsDiagramRendererV2
QgsLinearlyInterpolatedDiagramRenderer();
~QgsLinearlyInterpolatedDiagramRenderer();

QgsDiagramRendererV2* clone() const;

/**Returns list with all diagram settings in the renderer*/
QList<QgsDiagramSettings> diagramSettings() const;

@@ -63,3 +63,23 @@ class QgsFeatureRequest
QgsFeatureRequest& setSubsetOfAttributes( const QStringList& attrNames, const QgsFields& fields );

};


/** base class that can be used for any class that is capable of returning features
* @note added in 2.1
*/
class QgsAbstractFeatureSource
{
%TypeHeaderCode
#include <qgsfeaturerequest.h>
%End

public:
virtual ~QgsAbstractFeatureSource();

virtual QgsFeatureIterator getFeatures( const QgsFeatureRequest& request ) = 0;

protected:
void iteratorOpened( QgsAbstractFeatureIterator* it );
void iteratorClosed( QgsAbstractFeatureIterator* it );
};
@@ -126,6 +126,7 @@ class QgsFields
void clear();
void append( const QgsField& field, FieldOrigin origin = OriginProvider, int originIndex = -1 );
void remove( int fieldIdx );
void extend( const QgsFields& other );

bool isEmpty() const;
// __len__ annotation since sip 4.10.3
@@ -139,16 +140,24 @@ class QgsFields
//const QgsField& operator[](int i) const;
//QgsField& operator[](int i);
const QgsField& at(int i) const;
QList<QgsField> toList() const;

const QgsField& field( int fieldIdx ) const;
const QgsField& field( const QString& name ) const;
FieldOrigin fieldOrigin( int fieldIdx ) const;
int fieldOriginIndex( int fieldIdx ) const;

int indexFromName( const QString& name ) const;
void extend( const QgsFields& other );

//! Look up field's index from name - case insensitive
//! TODO: sort out case sensitive (indexFromName()) vs insensitive (fieldNameIndex()) calls
//! @note added in 2.1
int fieldNameIndex( const QString& fieldName ) const;

//! Utility function to get list of attribute indexes
//! @note added in 2.1
QgsAttributeList allAttributesList() const;

QList<QgsField> toList() const;

QgsField& operator[](int i) /Factory/;
%MethodCode
@@ -181,5 +190,6 @@ void __setitem__(int key, const QgsField& field);
(*sipCpp)[idx] = *a1;
%End


};

@@ -4,7 +4,7 @@ class QgsGeometryCache
#include <qgsgeometrycache.h>
%End
public:
QgsGeometryCache( QgsVectorLayer* layer );
QgsGeometryCache();
~QgsGeometryCache();

QgsGeometryMap& cachedGeometries();
@@ -25,6 +25,4 @@ class QgsGeometryCache
void setCachedGeometriesRect( const QgsRectangle& extent );
const QgsRectangle& cachedGeometriesRect();

protected:
QgsVectorLayerEditBuffer *editBuffer();
};
@@ -12,10 +12,10 @@ class QgsLabelSearchTree
void clear();

/**Returns label position(s) at a given point. QgsLabelSearchTree keeps ownership, don't delete the LabelPositions*/
// void label( const QgsPoint& p, QList<QgsLabelPosition*>& posList );
// void label( const QgsPoint& p, QList<QgsLabelPosition*>& posList ) const;

/**Returns label position(s) in given rectangle. QgsLabelSearchTree keeps ownership, don't delete the LabelPositions*/
// void labelsInRect( const QgsRectangle& r, QList<QgsLabelPosition*>& posList );
// void labelsInRect( const QgsRectangle& r, QList<QgsLabelPosition*>& posList ) const;

/**Inserts label position. Does not take ownership of labelPos
@return true in case of success*/
@@ -116,6 +116,11 @@ class QgsMapLayer : QObject
@note added in version 1.6*/
virtual void reload();

/** Return new instance of QgsMapLayerRenderer that will be used for rendering of given context
* @note added in 2.1
*/
virtual QgsMapLayerRenderer* createMapRenderer( QgsRenderContext& rendererContext ) /Factory/;

/** This is the method that does the actual work of
* drawing the layer onto a paint device.
* @param rendererContext describes the extents,
@@ -210,21 +215,11 @@ class QgsMapLayer : QObject
void removeCustomProperty( const QString& key );


/**
* If an operation returns 0 (e.g. draw()), this function
* returns the text of the error associated with the failure.
* Interactive users of this provider can then, for example,
* call a QMessageBox to display the contents.
*/
virtual QString lastErrorTitle();
//! @deprecated since 2.1 - returns empty string
virtual QString lastErrorTitle() /Deprecated/;

/**
* If an operation returns 0 (e.g. draw()), this function
* returns the text of the error associated with the failure.
* Interactive users of this provider can then, for example,
* call a QMessageBox to display the contents.
*/
virtual QString lastError();
//! @deprecated since 2.1 - returns empty string
virtual QString lastError() /Deprecated/;

/** Get current status error. This error describes some principal problem
* for which layer cannot work and thus is not valid. It is not last error
@@ -346,18 +341,12 @@ class QgsMapLayer : QObject
/** Return pointer to layer's undo stack */
QUndoStack* undoStack();

/** Get the QImage used for caching render operations
* @note This method was added in QGIS 1.4 **/
QImage *cacheImage();
/** Set the QImage used for caching render operations
* @note This method was added in QGIS 1.4 **/
void setCacheImage( QImage * thepImage /Transfer/ );

/**
* @brief Is called when the cache image is being deleted. Overwrite and use to clean up.
* @note added in 2.0
*/
virtual void onCacheImageDelete();
/** @deprecated since 2.1 - returns NULL */
QImage *cacheImage() /Deprecated/;
/** @deprecated since 2.1 - does nothing */
void setCacheImage( QImage * thepImage /Transfer/ ) /Deprecated/;
/** @deprecated since 2.1 - does nothing */
virtual void onCacheImageDelete() /Deprecated/;

public slots:

@@ -376,9 +365,8 @@ class QgsMapLayer : QObject
void toggleScaleBasedVisibility( bool theVisibilityFlag );
bool hasScaleBasedVisibility();

/** Clear cached image
* added in 1.5 */
void clearCacheImage();
/** @deprecated since 2.1 - does nothing */
void clearCacheImage() /Deprecated/;

/** \brief Obtain Metadata for this layer */
virtual QString metadata();
@@ -388,7 +376,7 @@ class QgsMapLayer : QObject

signals:

/** Emit a signal to notify of a progress event */
//! @deprecated in 2.1 - not emitted anymore
void drawingProgress( int theProgress, int theTotalSteps );

/** Emit a signal with status (e.g. to be caught by QgisApp and display a msg on status bar) */
@@ -407,8 +395,7 @@ class QgsMapLayer : QObject
*/
void repaintRequested();

/**The layer emits this signal when a screen update is requested.
This signal should be connected with the slot QgsMapCanvas::updateMap()*/
//! \note Deprecated in 2.1 and not emitted anymore
void screenUpdateRequested();

/** This is used to send a request that any mapcanvas using this layer update its extents */
@@ -119,7 +119,8 @@ class QgsMapLayerRegistry : QObject
*
* @note Added in QGIS 1.4
*/
void clearAllLayerCaches();
//! @deprecated since 2.1 - does nothing
void clearAllLayerCaches() /Deprecated/;

/**
* Reload all provider data caches (currently used for WFS and WMS providers)
@@ -0,0 +1,20 @@

class QgsMapLayerRenderer
{
%TypeHeaderCode
#include <qgsmaplayerrenderer.h>
%End

public:
QgsMapLayerRenderer( const QString& layerID );
virtual ~QgsMapLayerRenderer();

//! Do the rendering (based on data stored in the class)
virtual bool render() = 0;

//! Return list of errors (problems) that happened during the rendering
QStringList errors() const;

//! Get access to the ID of the layer rendered by this class
QString layerID() const;
};

0 comments on commit 2bece09

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