Skip to content

Commit

Permalink
Merge pull request #3536 from nyalldawson/cluster_marker
Browse files Browse the repository at this point in the history
[FEATURE] Cluster marker renderer
  • Loading branch information
nyalldawson committed Sep 30, 2016
2 parents 19585ee + 168688c commit ddcea34
Show file tree
Hide file tree
Showing 83 changed files with 3,200 additions and 1,194 deletions.
47 changes: 47 additions & 0 deletions doc/api_break.dox
Expand Up @@ -850,6 +850,12 @@ plugins calling this method will need to be updated.</li>
<li>labelsWithinRect() was removed. Use takeResults() and methods of QgsLabelingResults.</li>
</ul>

\subsection qgis_api_break_3_0_QgsLayerPropertiesWidget QgsLayerPropertiesWidget

<ul>
<li>expressionContext(), setExpressionContext(), setMapCanvas() and mapCanvas() have been removed in favor of setContext()/context()</li>
</ul>

\subsection qgis_api_break_3_0_QgsLayerTreeGroup QgsLayerTreeGroup

<ul>
Expand Down Expand Up @@ -1084,6 +1090,12 @@ be used instead of a null pointer if no transformation is required.</li>
<li>createMapRenderer(): default implementation (which called plugin's draw() method) has been removed. Plugin layers must implement createMapRenderer().</li>
</ul>

\subsection qgis_api_break_3_0_QgsPointDisplacementRenderer QgsPointDisplacementRenderer

<ul>
<li>The deprecated method setDisplacementGroups() has been removed. This method has had no effect since QGIS 2.4</li>
</ul>

\subsection qgis_api_break_3_0_QgsPointLocator QgsPointLocator

<ul>
Expand Down Expand Up @@ -1170,6 +1182,20 @@ be returned instead of a null pointer if no transformation is required.</li>
<li>setCoordinateTransform() now takes 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_QgsRendererWidget QgsRendererWidget

<ul>
<li>expressionContext(), setExpressionContext(), setMapCanvas() and mapCanvas() have been removed in favor of setContext()/context()</li>
</ul>

\subsection qgis_api_break_3_0_QgsRendererRulePropsWidget QgsRendererRulePropsWidget

<ul>
<li>expressionContext(), setExpressionContext(), setMapCanvas() and mapCanvas() have been removed in favor of setContext()/context()</li>
</ul>



\subsection qgis_api_break_3_0_QgsRubberBand QgsRubberBand

<ul>
Expand Down Expand Up @@ -1257,6 +1283,13 @@ the variant which takes QgsSymbolRenderContext instead.</li>
<li>expression() was removed. Use getDataDefinedProperty or evaluateDataDefinedProperty instead.</li>
</ul>

\subsection qgis_api_break_3_0_QgsSymbolLayerWidget QgsSymbolLayerWidget

<ul>
<li>expressionContext(), setExpressionContext(), setMapCanvas() and mapCanvas() have been removed in favor of setContext()/context()</li>
</ul>


\subsection qgis_api_break_3_0_QgsSymbolRenderContext QgsSymbolRenderContext (renamed from QgsSymbolV2RenderContext)

<ul>
Expand Down Expand Up @@ -1285,6 +1318,20 @@ than an integer value</li>
<li>saveSymbol() was removed.</li>
</ul>

\subsection qgis_api_break_3_0_QgsSymbolSelectorDialog QgsSymbolSelectorDialog

<ul>
<li>expressionContext(), setExpressionContext(), setMapCanvas() and mapCanvas() have been removed in favor of setContext()/context()</li>
</ul>

\subsection qgis_api_break_3_0_QgsSymbolsListWidget QgsSymbolsListWidget

<ul>
<li>expressionContext(), setExpressionContext(), setMapCanvas() and mapCanvas() have been removed in favor of setContext()/context()</li>
</ul>



\subsection qgis_api_break_3_0_QgsTolerance QgsTolerance

<ul>
Expand Down
1 change: 1 addition & 0 deletions images/images.qrc
Expand Up @@ -573,6 +573,7 @@
<file>themes/default/dependencies.svg</file>
<file>themes/default/mIconClearText.svg</file>
<file>themes/default/mIconClearTextHover.svg</file>
<file>themes/default/rendererPointClusterSymbol.svg</file>
</qresource>
<qresource prefix="/images/tips">
<file alias="symbol_levels.png">qgis_tips/symbol_levels.png</file>
Expand Down
88 changes: 88 additions & 0 deletions images/themes/default/rendererPointClusterSymbol.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions python/core/core.sip
Expand Up @@ -294,7 +294,9 @@
%Include symbology-ng/qgsinvertedpolygonrenderer.sip
%Include symbology-ng/qgslegendsymbolitem.sip
%Include symbology-ng/qgsnullsymbolrenderer.sip
%Include symbology-ng/qgspointclusterrenderer.sip
%Include symbology-ng/qgspointdisplacementrenderer.sip
%Include symbology-ng/qgspointdistancerenderer.sip
%Include symbology-ng/qgsrenderer.sip
%Include symbology-ng/qgsrendererregistry.sip
%Include symbology-ng/qgsrulebasedrenderer.sip
Expand Down
4 changes: 4 additions & 0 deletions python/core/qgsexpressioncontext.sip
Expand Up @@ -457,6 +457,10 @@ class QgsExpressionContext
static const QString EXPR_GEOMETRY_PART_COUNT;
//! Inbuilt variable name for geometry part number variable
static const QString EXPR_GEOMETRY_PART_NUM;
//! Inbuilt variable name for cluster size variable
static const QString EXPR_CLUSTER_SIZE;
//! Inbuilt variable name for cluster color variable
static const QString EXPR_CLUSTER_COLOR;
};

/** \ingroup core
Expand Down
46 changes: 46 additions & 0 deletions python/core/symbology-ng/qgspointclusterrenderer.sip
@@ -0,0 +1,46 @@
/** \class QgsPointClusterRenderer
* \ingroup core
* A renderer that automatically clusters points with the same geographic position.
* \note added in QGIS 3.0
*/
class QgsPointClusterRenderer : QgsPointDistanceRenderer
{
%TypeHeaderCode
#include <qgspointclusterrenderer.h>
%End
public:

QgsPointClusterRenderer();

virtual QgsPointClusterRenderer* clone() const /Factory/;
virtual void startRender( QgsRenderContext& context, const QgsFields& fields );
void stopRender( QgsRenderContext& context );
QDomElement save( QDomDocument& doc );
virtual QList<QString> usedAttributes();

//! Create a renderer from XML element
static QgsFeatureRenderer* create( QDomElement& symbologyElem ) /Factory/;

/** Returns the symbol used for rendering clustered groups (but not ownership of the symbol).
* @see setClusterSymbol()
*/
QgsMarkerSymbol* clusterSymbol();

/** Sets the symbol for rendering clustered groups.
* @param symbol new cluster symbol. Ownership is transferred to the renderer.
* @see clusterSymbol()
*/
void setClusterSymbol( QgsMarkerSymbol* symbol /Transfer/ );

/** Creates a QgsPointDisplacementRenderer from an existing renderer.
* @note added in 2.5
* @returns a new renderer if the conversion was possible, otherwise nullptr.
*/
static QgsPointClusterRenderer* convertFromRenderer( const QgsFeatureRenderer *renderer ) /Factory/;

private:
QgsPointClusterRenderer( const QgsPointClusterRenderer & );
QgsPointClusterRenderer & operator=( const QgsPointClusterRenderer & );

void drawGroup( QPointF centerPoint, QgsRenderContext& context, const QgsPointDistanceRenderer::ClusteredGroup& group );
};

0 comments on commit ddcea34

Please sign in to comment.