Skip to content
Permalink
Browse files

Goodbye to QgsMapRenderer (#3333)

For the time being the class is kept in the server code while it is still being used there.
  • Loading branch information
wonder-sk committed Jul 24, 2016
1 parent 2bbfe8a commit ab4a83b49bbec04900cb3cd549c91a509e08cdfe
Showing with 592 additions and 1,260 deletions.
  1. +47 −0 doc/api_break.dox
  2. +0 −3 python/core/composer/qgscomposermap.sip
  3. +0 −6 python/core/composer/qgscomposition.sip
  4. +1 −1 python/core/core.sip
  5. +45 −0 python/core/qgspainting.sip
  6. +76 −3 python/core/qgspallabeling.sip
  7. +0 −3 python/core/qgsrenderchecker.sip
  8. +0 −3 python/core/qgssnapper.sip
  9. +0 −26 python/core/qgstolerance.sip
  10. +0 −1 python/gui/gui.sip
  11. +3 −53 python/gui/qgsmapcanvas.sip
  12. +0 −62 python/gui/qgsmapcanvasmap.sip
  13. +1 −110 python/{core → server}/qgsmaprenderer.sip
  14. +1 −0 python/server/server.sip
  15. +0 −1 src/app/composer/qgscomposerlegendwidget.cpp
  16. +0 −1 src/app/composer/qgscomposermapwidget.cpp
  17. +0 −1 src/app/gps/qgsgpsinformationwidget.cpp
  18. +0 −1 src/app/gps/qgsgpsmarker.cpp
  19. +0 −1 src/app/nodetool/qgsselectedfeature.cpp
  20. +0 −1 src/app/nodetool/qgsvertexentry.cpp
  21. +2 −3 src/app/qgisapp.cpp
  22. +0 −1 src/app/qgsbookmarks.cpp
  23. +0 −1 src/app/qgsdecorationgrid.cpp
  24. +0 −1 src/app/qgsdecorationnortharrow.cpp
  25. +0 −1 src/app/qgslabelinggui.cpp
  26. +0 −1 src/app/qgslabelpropertydialog.cpp
  27. +0 −1 src/app/qgsmaptoollabel.h
  28. +0 −1 src/app/qgsmeasuredialog.cpp
  29. +0 −1 src/app/qgsmeasuretool.cpp
  30. +0 −1 src/app/qgsoptions.cpp
  31. +0 −1 src/app/qgsprojectproperties.cpp
  32. +0 −1 src/app/qgsrasterlayerproperties.cpp
  33. +2 −2 src/core/CMakeLists.txt
  34. +3 −3 src/core/composer/qgscomposeritem.cpp
  35. +3 −10 src/core/composer/qgscomposermap.cpp
  36. +0 −4 src/core/composer/qgscomposermap.h
  37. +1 −1 src/core/composer/qgscomposermapgrid.cpp
  38. +3 −3 src/core/composer/qgscomposermapoverview.cpp
  39. +1 −1 src/core/composer/qgscomposerscalebar.cpp
  40. +1 −47 src/core/composer/qgscomposition.cpp
  41. +1 −9 src/core/composer/qgscomposition.h
  42. +1 −1 src/core/qgslabelsearchtree.h
  43. +123 −0 src/core/qgspainting.cpp
  44. +54 −0 src/core/qgspainting.h
  45. +25 −31 src/core/qgspallabeling.cpp
  46. +107 −5 src/core/qgspallabeling.h
  47. +0 −5 src/core/qgsrenderchecker.cpp
  48. +0 −4 src/core/qgsrenderchecker.h
  49. +0 −8 src/core/qgssnapper.cpp
  50. +2 −4 src/core/qgssnapper.h
  51. +0 −17 src/core/qgstolerance.cpp
  52. +0 −28 src/core/qgstolerance.h
  53. +5 −4 src/core/qgsvectorlayer.cpp
  54. +0 −1 src/core/raster/qgsrasterchecker.h
  55. +3 −3 src/core/raster/qgsrasterlayer.cpp
  56. +3 −3 src/gui/qgsblendmodecombobox.cpp
  57. +0 −1 src/gui/qgshighlight.cpp
  58. +1 −166 src/gui/qgsmapcanvas.cpp
  59. +3 −106 src/gui/qgsmapcanvas.h
  60. +0 −1 src/gui/qgsmapcanvasitem.cpp
  61. +0 −7 src/gui/qgsmapcanvasmap.cpp
  62. +4 −32 src/gui/qgsmapcanvasmap.h
  63. +0 −1 src/gui/qgsmaptool.cpp
  64. +0 −1 src/gui/qgsmaptoolcapture.cpp
  65. +0 −1 src/gui/qgsrubberband.cpp
  66. +0 −1 src/plugins/coordinate_capture/coordinatecapture.cpp
  67. +0 −1 src/plugins/evis/eventbrowser/evisgenericeventbrowsergui.cpp
  68. +0 −1 src/plugins/evis/eventbrowser/evisgenericeventbrowsergui.h
  69. +0 −1 src/plugins/georeferencer/qgsgcpcanvasitem.cpp
  70. +2 −2 src/plugins/georeferencer/qgsgeorefplugingui.cpp
  71. +0 −1 src/plugins/grass/qgsgrassregion.cpp
  72. +0 −1 src/plugins/roadgraph/roadgraphplugin.cpp
  73. +0 −1 src/plugins/roadgraph/shortestpathwidget.cpp
  74. +9 −0 src/server/CMakeLists.txt
  75. +0 −119 src/{core → server}/qgsmaprenderer.cpp
  76. +3 −144 src/{core → server}/qgsmaprenderer.h
  77. +1 −2 tests/src/core/CMakeLists.txt
  78. +0 −1 tests/src/core/testqgsatlascomposition.cpp
  79. +0 −1 tests/src/core/testqgscentroidfillsymbol.cpp
  80. +0 −1 tests/src/core/testqgscomposereffects.cpp
  81. +0 −1 tests/src/core/testqgscomposerlabel.cpp
  82. +0 −1 tests/src/core/testqgscomposermap.cpp
  83. +0 −1 tests/src/core/testqgscomposermapgrid.cpp
  84. +0 −1 tests/src/core/testqgscomposermapoverview.cpp
  85. +0 −1 tests/src/core/testqgscomposerrotation.cpp
  86. +0 −1 tests/src/core/testqgscomposerscalebar.cpp
  87. +0 −1 tests/src/core/testqgsdiagram.cpp
  88. +0 −1 tests/src/core/testqgsellipsemarker.cpp
  89. +0 −1 tests/src/core/testqgsfilledmarker.cpp
  90. +0 −1 tests/src/core/testqgsfontmarker.cpp
  91. +0 −1 tests/src/core/testqgsgradients.cpp
  92. +0 −1 tests/src/core/testqgsinvertedpolygonrenderer.cpp
  93. +0 −1 tests/src/core/testqgslinefillsymbol.cpp
  94. +11 −12 tests/src/core/{testqgsmaprenderer.cpp → testqgsmaprendererjob.cpp}
  95. +0 −1 tests/src/core/testqgsmaprotation.cpp
  96. +0 −1 tests/src/core/testqgsmarkerlinesymbol.cpp
  97. +0 −1 tests/src/core/testqgspointpatternfillsymbol.cpp
  98. +0 −1 tests/src/core/testqgsrasterlayer.cpp
  99. +0 −1 tests/src/core/testqgsrastersublayer.cpp
  100. +0 −1 tests/src/core/testqgsrenderers.cpp
  101. +0 −1 tests/src/core/testqgssimplemarker.cpp
  102. +0 −1 tests/src/core/testqgssvgmarker.cpp
  103. +1 −15 tests/src/core/testqgsvectorlayer.cpp
  104. +0 −1 tests/src/gui/testprojectionissues.cpp
  105. +0 −65 tests/src/gui/testqgsmapcanvas.cpp
  106. +10 −18 tests/src/providers/testqgswcspublicservers.cpp
  107. +5 −6 tests/src/python/test_qgsblendmodes.py
  108. +3 −3 tests/src/python/test_qgscomposereffects.py
  109. +1 −1 tests/src/python/test_qgscomposerhtml.py
  110. +5 −7 tests/src/python/test_qgscomposerlabel.py
  111. +5 −7 tests/src/python/test_qgscomposermap.py
  112. +7 −9 tests/src/python/test_qgscomposition.py
  113. +2 −9 tests/src/python/test_qgspallabeling_base.py
  114. +5 −8 tests/src/python/test_qgsrasterlayer.py
@@ -22,6 +22,8 @@ This page tries to maintain a list with incompatible changes that happened in pr

<ul>
<li>QgsLabel and QgsLabelAttributes. Replaced by labeling based on PAL library, see QgsLabelingEngineV2.</li>
<li>QgsMapCanvasMap. It is an internal class used by map canvas.</li>
<li>QgsMapRenderer. It has been replaced by QgsMapRendererJob with subclasses and QgsMapSettings.</li>
</ul>

\subsection qgis_api_break_3_0_global General changes
@@ -72,6 +74,7 @@ qgsPermissiveToInt()</li>

<ul>
<li>containsWMSLayer() has been renamed to containsWmsLayer()</li>
<li>mapRenderer() has been removed. Use mapSettings() instead.</li>
</ul>

\subsection qgis_api_break_3_0_QgsComposerNodesItem QgsComposerNodesItem
@@ -93,6 +96,8 @@ qgsPermissiveToInt()</li>

<ul>
<li>addItemsFromXML() has been renamed to addItemsFromXml()</li>
<li>Constructor with QgsMapRenderer parameter has been removed. Use the variant with QgsMapSettings parameter.</li>
<li>mapRenderer() has been removed. Use mapSettings() instead.</li>
</ul>

\subsection qgis_api_break_3_0_QgsCoordinateReferenceSystem QgsCoordinateReferenceSystem
@@ -201,6 +206,12 @@ objects are implicitly shared, returning a copy helps simplify and make code mor
only affects third party c++ providers, and does not affect PyQGIS scripts.</li>
</ul>

\subsection qgis_api_break_3_0_QgsLabelingEngineInterface QgsLabelingEngineInterface

<ul>
<li>init(QgsMapRenderer*) has been removed. Use init(const QgsMapSettings&) instead.</li>
</ul>

\subsection qgis_api_break_3_0_QgsLayerTreeGroup QgsLayerTreeGroup

<ul>
@@ -218,6 +229,17 @@ only affects third party c++ providers, and does not affect PyQGIS scripts.</li>

<ul>
<li>rotationEnabled() and enableRotation() have been removed, since map rotation is now always supported</li>
<li>The "name" parameter has been removed from constructor. Use QObject::setObjectName() to set canvas name if necessary.</li>
<li>map() has been removed because QgsMapCanvasMap is not available in API anymore.</li>
<li>mapRenderer() has been removed. Use directly map canvas methods to get/set configuration or mapSettings() (for reading only).</li>
<li>canvasPaintDevice() has been removed. Use map canvas items to draw anything on top of canvas.</li>
<li>clear() has been removed. Use refresh() instead.</li>
<li>setCanvasColor() and canvasColor() are not virtual methods anymore.</li>
<li>updateFullExtent() has been removed. No need to call it explicitly. Full extent calculation is done in QgsMapSettings.</li>
<li>setDirty() and isDirty() have been removed. Use refresh() to refresh canvas content.</li>
<li>setWheelAction() and WheelAction enum have been removed. Custom wheel actions are not supported anymore.</li>
<li>updateMap(), showError(), useImageToRender() have been removed. They did nothing since 2.4.</li>
<li>setProgress() signal has been removed. It was not emitted since 2.0.</li>
</ul>

\subsection qgis_api_break_3_0_QgsMapLayer QgsMapLayer
@@ -254,6 +276,7 @@ screenUpdateRequested() were removed. These members have had no effect for a num
<li>transformation() now returns a QgsCoordinateTransform object, not a pointer. An invalid QgsCoordinateTransform will
be returned instead of a null pointer if no transformation is required.</li>
<li>destinationSrsChanged() was renamed to destinationCrsChanged()</li>
<li>getCompositionMode(), getBlendModeEnum() and BlendMode enum have been moved to QgsPainting utility class.</li>
</ul>

\subsection qgis_api_break_3_0_QgsMapRendererJob QgsMapRendererJob
@@ -272,6 +295,12 @@ be used instead of a null pointer if no transformation is required.</li>
be returned instead of a null pointer if no transformation is required.</li>
</ul>

\subsection qgis_api_break_3_0_QgsPalLabeling QgsPalLabeling

<ul>
<li>init(QgsMapRenderer*) has been removed. Use init(const QgsMapSettings&) instead.</li>
</ul>

\subsection qgis_api_break_3_0_QgsOSMElement QgsOSMElement

<ul>
@@ -318,6 +347,12 @@ be returned instead of a null pointer if no transformation is required.</li>
<li>createFromXML() has been renamed to createFromXml()</li>
</ul>

\subsection qgis_api_break_3_0_QgsRenderChecker QgsRenderChecker

<ul>
<li>setMapRenderer() has been removed. Use setMapSettings() instead.</li>
</ul>

\subsection qgis_api_break_3_0_QgsRenderContext QgsRenderContext

<ul>
@@ -334,6 +369,18 @@ be used instead of a null pointer if no transformation is required.</li>
<li>prepareGeometry() and geometryRequiresPreparation() now take a QgsCoordinateTransform reference, not a pointer. An invalid QgsCoordinateTransform should be used instead of a null pointer if no transformation is required.</li>
</ul>

\subsection qgis_api_break_3_0_QgsSnapper QgsSnapper

<ul>
<li>Constructor variant with QgsMapRenderer has been removed. Use the variant with QgsMapSettings.</li>
</ul>

\subsection qgis_api_break_3_0_QgsTolerance QgsTolerance

<ul>
<li>vertexSearchRadius(), defaultTolerance(), toleranceInMapUnits() do not have variant with QgsMapRenderer anymore. Use the variants with QgsMapSettings.</li>
</ul>

\subsection qgis_api_break_3_0_QgsJSONExporter QgsJSONExporter

<ul>
@@ -249,9 +249,6 @@ class QgsComposerMap : QgsComposerItem

QgsRectangle extent() const;

//! @deprecated since 2.4 - 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 );

@@ -40,8 +40,6 @@ class QgsComposition : QGraphicsScene
Landscape
};

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

/** Composition atlas modes*/
@@ -413,10 +411,6 @@ class QgsComposition : QGraphicsScene
/** Used to enable or disable advanced effects such as blend modes in a composition */
void setUseAdvancedEffects( const bool effectsEnabled );

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

//! Return setting of QGIS map canvas
//! @note added in 2.4
const QgsMapSettings& mapSettings() const;
@@ -80,7 +80,6 @@
%Include qgsmaplayerregistry.sip
%Include qgsmaplayerrenderer.sip
%Include qgsmaplayerstylemanager.sip
%Include qgsmaprenderer.sip
%Include qgsmaprenderercache.sip
%Include qgsmaprenderercustompainterjob.sip
%Include qgsmaprendererjob.sip
@@ -100,6 +99,7 @@
%Include qgsogcutils.sip
%Include qgsowsconnection.sip
%Include qgspaintenginehack.sip
%Include qgspainting.sip
%Include qgspallabeling.sip
%Include qgspluginlayer.sip
%Include qgspluginlayerregistry.sip
@@ -0,0 +1,45 @@
class QgsPainting
{
%TypeHeaderCode
#include <qgspainting.h>
%End

public:

/** Blending modes enum defining the available composition modes that can
* be used when rendering a layer
*/
enum BlendMode
{
BlendNormal,
BlendLighten,
BlendScreen,
BlendDodge,
BlendAddition,
BlendDarken,
BlendMultiply,
BlendBurn,
BlendOverlay,
BlendSoftLight,
BlendHardLight,
BlendDifference,
BlendSubtract,
BlendSource,
BlendDestinationOver,
BlendClear,
BlendDestination,
BlendSourceIn,
BlendDestinationIn,
BlendSourceOut,
BlendDestinationOut,
BlendSourceAtop,
BlendDestinationAtop,
BlendXor,
};

//! Returns a QPainter::CompositionMode corresponding to a BlendMode
static QPainter::CompositionMode getCompositionMode( QgsPainting::BlendMode blendMode );
//! Returns a BlendMode corresponding to a QPainter::CompositionMode
static QgsPainting::BlendMode getBlendModeEnum( QPainter::CompositionMode blendMode );

};
@@ -77,6 +77,82 @@
%End
};


class QgsLabelPosition
{
%TypeHeaderCode
#include <qgspallabeling.h>
%End
public:
QgsLabelPosition( int id, double r, const QVector< QgsPoint >& corners, const QgsRectangle& rect, double w, double h, const QString& layer, const QString& labeltext, const QFont& labelfont, bool upside_down, bool diagram = false, bool pinned = false, const QString& providerId = QString() );
QgsLabelPosition();
int featureId;
double rotation;
QVector< QgsPoint > cornerPoints;
QgsRectangle labelRect;
double width;
double height;
QString layerID;
QString labelText;
QFont labelFont;
bool upsideDown;
bool isDiagram;
bool isPinned;
//! @note added in 2.14
QString providerID;
};

/** Labeling engine interface. */
class QgsLabelingEngineInterface
{
%TypeHeaderCode
#include <qgspallabeling.h>
%End

public:

virtual ~QgsLabelingEngineInterface();

//! called when we're going to start with rendering
virtual void init( const QgsMapSettings& mapSettings ) = 0;
//! called to find out whether the layer is used for labeling
virtual bool willUseLayer( QgsVectorLayer* layer ) = 0;
//! clears all PAL layer settings for registered layers
virtual void clearActiveLayers() = 0;
//! clears data defined objects from PAL layer settings for a registered layer
virtual void clearActiveLayer( const QString& layerID ) = 0;
//! called when starting rendering of a layer
virtual int prepareLayer( QgsVectorLayer* layer, QStringList& attrNames, QgsRenderContext& ctx ) = 0;
//! returns PAL layer settings for a registered layer
//! @deprecated since 2.12 - if direct access to QgsPalLayerSettings is necessary, use QgsPalLayerSettings::fromLayer()
virtual QgsPalLayerSettings &layer( const QString &layerName ) = 0 /Deprecated/;
//! adds a diagram layer to the labeling engine
//! @note added in QGIS 2.12
virtual int prepareDiagramLayer( QgsVectorLayer *layer, QStringList &attrNames, QgsRenderContext &ctx );
//! adds a diagram layer to the labeling engine
//! @deprecated since 2.12 - use prepareDiagramLayer()
virtual int addDiagramLayer( QgsVectorLayer *layer, const QgsDiagramLayerSettings *s ) /Deprecated/;
//! called for every feature
virtual void registerFeature( const QString &layerID, QgsFeature &feat, QgsRenderContext &context ) = 0;
//! called for every diagram feature
virtual void registerDiagramFeature( const QString &layerID, QgsFeature &feat, QgsRenderContext &context );
//! called when the map is drawn and labels should be placed
virtual void drawLabeling( QgsRenderContext& context ) = 0;
//! called when we're done with rendering
virtual void exit() = 0;
//! return infos about labels at a given (map) position
//! @deprecated since 2.4 - use takeResults() and methods of QgsLabelingResults
virtual QList<QgsLabelPosition> labelsAtPosition( const QgsPoint& p ) = 0 /Deprecated/;
//! return infos about labels within a given (map) rectangle
//! @deprecated since 2.4 - use takeResults() and methods of QgsLabelingResults
virtual QList<QgsLabelPosition> labelsWithinRect( const QgsRectangle& r ) = 0 /Deprecated/;

//! called when passing engine among map renderers
virtual QgsLabelingEngineInterface* clone() = 0 /Factory/;
};



class QgsPalLayerSettings
{
%TypeHeaderCode
@@ -835,9 +911,6 @@ class QgsPalLabeling : QgsLabelingEngineInterface

// implemented methods from labeling engine interface

//! called when we're going to start with rendering
//! @deprecated since 2.4 - use override with QgsMapSettings
virtual void init( QgsMapRenderer* mr ) /Deprecated/;
//! called when we're going to start with rendering
virtual void init( const QgsMapSettings& mapSettings );
//! called to find out whether the layer is used for labeling
@@ -49,9 +49,6 @@ class QgsRenderChecker
*/
QString renderedImage();

//! @deprecated since 2.4 - use setMapSettings()
void setMapRenderer( QgsMapRenderer *thepMapRenderer ) /Deprecated/;

//! @note added in 2.4
void setMapSettings( const QgsMapSettings& mapSettings );

@@ -70,9 +70,6 @@ class QgsSnapper
QgsTolerance::UnitType mUnitType;
};

//!@deprecated since 2.4 - use constructor with QgsMapSettings
QgsSnapper( QgsMapRenderer *mapRender ) /Deprecated/;

explicit QgsSnapper( const QgsMapSettings& mapSettings );

/** Does the snapping operation
@@ -36,29 +36,13 @@ class QgsTolerance
*/
static double vertexSearchRadius( QgsMapLayer* layer, const QgsMapSettings& mapSettings );

/**
* Static function to get vertex tolerance value for a layer.
* The value is read from settings and transformed if necessary.
* @return value of vertex tolerance in layer units
*/
//! @deprecated since 2.4 - use override with QgsMapSettings
static double vertexSearchRadius( QgsMapLayer* layer, QgsMapRenderer* renderer ) /Deprecated/;

/**
* Static function to get default tolerance value for a layer.
* The value is read from settings and transformed if necessary.
* @return value of default tolerance in layer units
*/
static double defaultTolerance( QgsMapLayer* layer, const QgsMapSettings& mapSettings );

/**
* Static function to get default tolerance value for a layer.
* The value is read from settings and transformed if necessary.
* @return value of default tolerance in layer units
*/
//! @deprecated since 2.4 - use override with QgsMapSettings
static double defaultTolerance( QgsMapLayer* layer, QgsMapRenderer* renderer ) /Deprecated/;

/**
* Static function to translate tolerance value into map units
* @param tolerance tolerance value to be translated
@@ -80,14 +64,4 @@ class QgsTolerance
*/
static double toleranceInMapUnits( double tolerance, QgsMapLayer* layer, const QgsMapSettings& mapSettings, UnitType units = LayerUnits );

/**
* Static function to translate tolerance value into layer units
* @param tolerance tolerance value to be translated
* @param layer reference layer
* @param renderer renderer
* @param units type of units to be translated
* @return value of tolerance in layer units
*/
//! @deprecated since 2.4 - use the override with QgsMapSettings
static double toleranceInMapUnits( double tolerance, QgsMapLayer* layer, QgsMapRenderer* renderer, UnitType units = LayerUnits ) /Deprecated/;
};
@@ -98,7 +98,6 @@
%Include qgsmanageconnectionsdialog.sip
%Include qgsmapcanvas.sip
%Include qgsmapcanvasitem.sip
%Include qgsmapcanvasmap.sip
%Include qgsmapcanvassnapper.sip
%Include qgsmapcanvassnappingutils.sip
%Include qgsmapcanvastracer.sip

0 comments on commit ab4a83b

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