2016-08-15 12:04:17 +10:00
|
|
|
/** \class QgsPointDisplacementRenderer
|
|
|
|
* \ingroup core
|
|
|
|
* A renderer that automatically displaces points with the same geographic location.
|
|
|
|
*/
|
|
|
|
class QgsPointDisplacementRenderer : QgsPointDistanceRenderer
|
2012-09-24 02:28:15 +02:00
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include <qgspointdisplacementrenderer.h>
|
|
|
|
%End
|
|
|
|
public:
|
2015-09-18 13:20:53 +10:00
|
|
|
|
|
|
|
/** Placement methods for dispersing points
|
|
|
|
*/
|
|
|
|
enum Placement
|
|
|
|
{
|
|
|
|
Ring, /*!< Place points in a single ring around group*/
|
|
|
|
ConcentricRings /*!< Place points in concentric rings around group*/
|
|
|
|
};
|
|
|
|
|
2016-08-15 12:04:17 +10:00
|
|
|
/** Constructor for QgsPointDisplacementRenderer.
|
|
|
|
* @param labelAttributeName optional attribute name for labeling points
|
2015-11-08 19:18:00 +00:00
|
|
|
*/
|
2016-08-15 12:04:17 +10:00
|
|
|
QgsPointDisplacementRenderer( const QString& labelAttributeName = QString() );
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2016-08-15 12:04:17 +10:00
|
|
|
virtual QgsPointDisplacementRenderer* clone() const /Factory/;
|
2015-07-22 10:46:13 +02:00
|
|
|
virtual void startRender( QgsRenderContext& context, const QgsFields& fields );
|
2012-09-24 02:28:15 +02:00
|
|
|
void stopRender( QgsRenderContext& context );
|
|
|
|
QDomElement save( QDomDocument& doc );
|
2016-10-03 10:39:41 +02:00
|
|
|
virtual QSet<QString> usedAttributes() const;
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2016-08-15 12:04:17 +10:00
|
|
|
//! Create a renderer from XML element
|
|
|
|
static QgsFeatureRenderer* create( QDomElement& symbologyElem ) /Factory/;
|
2016-06-07 15:18:36 +10:00
|
|
|
|
2016-08-15 12:04:17 +10:00
|
|
|
/** Sets the line width for the displacement group circle.
|
|
|
|
* @param width line width in mm
|
|
|
|
* @see circleWidth()
|
|
|
|
* @see setCircleColor()
|
|
|
|
*/
|
|
|
|
void setCircleWidth( double width );
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2016-08-15 12:04:17 +10:00
|
|
|
/** Returns the line width for the displacement group circle in mm.
|
|
|
|
* @see setCircleWidth()
|
|
|
|
* @see circleColor()
|
|
|
|
*/
|
2012-09-24 02:28:15 +02:00
|
|
|
double circleWidth() const;
|
|
|
|
|
2016-08-15 12:04:17 +10:00
|
|
|
/** Sets the color used for drawing the displacement group circle.
|
|
|
|
* @param color circle color
|
|
|
|
* @see circleColor()
|
|
|
|
* @see setCircleWidth()
|
|
|
|
*/
|
|
|
|
void setCircleColor( const QColor& color );
|
|
|
|
|
|
|
|
/** Returns the color used for drawing the displacement group circle.
|
|
|
|
* @see setCircleColor()
|
|
|
|
* @see circleWidth()
|
|
|
|
*/
|
2012-09-24 02:28:15 +02:00
|
|
|
QColor circleColor() const;
|
|
|
|
|
2016-08-15 12:04:17 +10:00
|
|
|
/** Sets a factor for increasing the ring size of displacement groups.
|
|
|
|
* @param distance addition factor
|
|
|
|
* @see circleRadiusAddition()
|
|
|
|
*/
|
|
|
|
void setCircleRadiusAddition( double distance );
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2016-08-15 12:04:17 +10:00
|
|
|
/** Returns the factor for increasing the ring size of displacement groups.
|
|
|
|
* @see setCircleRadiusAddition()
|
|
|
|
*/
|
2012-09-24 02:28:15 +02:00
|
|
|
double circleRadiusAddition() const;
|
|
|
|
|
2015-09-18 13:20:53 +10:00
|
|
|
/** Returns the placement method used for dispersing the points.
|
|
|
|
* @see setPlacement()
|
|
|
|
* @note added in QGIS 2.12
|
|
|
|
*/
|
|
|
|
Placement placement() const;
|
|
|
|
|
|
|
|
/** Sets the placement method used for dispersing the points.
|
|
|
|
* @param placement placement method
|
|
|
|
* @see placement()
|
|
|
|
* @note added in QGIS 2.12
|
|
|
|
*/
|
|
|
|
void setPlacement( Placement placement );
|
|
|
|
|
2016-08-15 12:04:17 +10:00
|
|
|
/** Returns the symbol for the center of a displacement group (but not ownership of the symbol).
|
|
|
|
* @see setCenterSymbol()
|
|
|
|
*/
|
2016-08-06 11:01:42 +02:00
|
|
|
QgsMarkerSymbol* centerSymbol();
|
2014-01-14 17:23:16 +01:00
|
|
|
|
2016-08-15 12:04:17 +10:00
|
|
|
/** Sets the center symbol for a displacement group.
|
|
|
|
* @param symbol new center symbol. Ownership is transferred to the renderer.
|
|
|
|
* @see centerSymbol()
|
|
|
|
*/
|
|
|
|
void setCenterSymbol( QgsMarkerSymbol* symbol /Transfer/ );
|
2015-09-16 17:11:32 +10:00
|
|
|
|
2016-08-15 12:04:17 +10:00
|
|
|
/** Creates a QgsPointDisplacementRenderer from an existing renderer.
|
|
|
|
* @note added in 2.5
|
|
|
|
* @returns a new renderer if the conversion was possible, otherwise nullptr.
|
2015-09-16 17:11:32 +10:00
|
|
|
*/
|
2016-08-15 12:04:17 +10:00
|
|
|
static QgsPointDisplacementRenderer* convertFromRenderer( const QgsFeatureRenderer *renderer ) /Factory/;
|
2014-08-30 10:16:23 -06:00
|
|
|
|
2014-01-14 17:23:16 +01:00
|
|
|
private:
|
|
|
|
QgsPointDisplacementRenderer( const QgsPointDisplacementRenderer & );
|
|
|
|
QgsPointDisplacementRenderer & operator=( const QgsPointDisplacementRenderer & );
|
2016-08-15 12:04:17 +10:00
|
|
|
|
|
|
|
void drawGroup( QPointF centerPoint, QgsRenderContext& context, const QgsPointDistanceRenderer::ClusteredGroup& group );
|
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
};
|