Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added GUI for data-defined size legend (single/categorized/graduated …
…renderer)
- Loading branch information
Showing
24 changed files
with
677 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,178 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/core/qgsdatadefinedsizelegend.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
|
||
|
||
|
||
class QgsDataDefinedSizeLegend | ||
{ | ||
%Docstring | ||
Object that keeps configuration of appearance of marker symbol's data-defined size in legend. | ||
For example: the list of classes (size values), whether the classes should appear in separate | ||
legend nodes or whether to collapse them into one legend node. | ||
|
||
.. versionadded:: 3.0 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgsdatadefinedsizelegend.h" | ||
%End | ||
public: | ||
QgsDataDefinedSizeLegend(); | ||
|
||
QgsDataDefinedSizeLegend( const QgsDataDefinedSizeLegend &other ); | ||
|
||
enum LegendType | ||
{ | ||
LegendSeparated, | ||
LegendCollapsed, | ||
}; | ||
|
||
enum VerticalAlignment | ||
{ | ||
AlignCenter, | ||
AlignBottom, | ||
}; | ||
|
||
struct SizeClass | ||
{ | ||
SizeClass( double size, const QString &label ); | ||
|
||
double size; //!< Marker size in units used by the symbol (usually millimeters) | ||
QString label; //!< Label to be shown with the particular symbol size | ||
}; | ||
|
||
void setLegendType( LegendType type ); | ||
%Docstring | ||
Sets how the legend should be rendered | ||
%End | ||
LegendType legendType() const; | ||
%Docstring | ||
Returns how the legend should be rendered | ||
:rtype: LegendType | ||
%End | ||
|
||
void setSymbol( QgsMarkerSymbol *symbol /Transfer/ ); | ||
%Docstring | ||
Sets marker symbol that will be used to draw markers in legend | ||
%End | ||
QgsMarkerSymbol *symbol() const; | ||
%Docstring | ||
Returns marker symbol that will be used to draw markers in legend | ||
:rtype: QgsMarkerSymbol | ||
%End | ||
|
||
void setClasses( const QList<QgsDataDefinedSizeLegend::SizeClass> &classes ); | ||
%Docstring | ||
Sets list of classes: each class is a pair of symbol size (in units used by the symbol) and label | ||
%End | ||
QList<QgsDataDefinedSizeLegend::SizeClass> classes() const; | ||
%Docstring | ||
Returns list of classes: each class is a pair of symbol size (in units used by the symbol) and label | ||
:rtype: list of QgsDataDefinedSizeLegend.SizeClass | ||
%End | ||
|
||
void setTitle( const QString &title ); | ||
%Docstring | ||
Sets title label for data-defined size legend | ||
%End | ||
QString title() const; | ||
%Docstring | ||
Returns title label for data-defined size legend | ||
:rtype: str | ||
%End | ||
|
||
void setVerticalAlignment( VerticalAlignment vAlign ); | ||
%Docstring | ||
Sets vertical alignment of symbols - only valid for collapsed legend | ||
%End | ||
VerticalAlignment verticalAlignment() const; | ||
%Docstring | ||
Returns vertical alignment of symbols - only valid for collapsed legend | ||
:rtype: VerticalAlignment | ||
%End | ||
|
||
void setFont( const QFont &font ); | ||
%Docstring | ||
Sets font used for rendering of labels - only valid for collapsed legend | ||
%End | ||
QFont font() const; | ||
%Docstring | ||
Returns font used for rendering of labels - only valid for collapsed legend | ||
:rtype: QFont | ||
%End | ||
|
||
void setTextColor( const QColor &color ); | ||
%Docstring | ||
Sets text color for rendering of labels - only valid for collapsed legend | ||
%End | ||
QColor textColor() const; | ||
%Docstring | ||
Returns text color for rendering of labels - only valid for collapsed legend | ||
:rtype: QColor | ||
%End | ||
|
||
void setTextAlignment( Qt::AlignmentFlag flag ); | ||
%Docstring | ||
Sets horizontal text alignment for rendering of labels - only valid for collapsed legend | ||
%End | ||
Qt::AlignmentFlag textAlignment() const; | ||
%Docstring | ||
Returns horizontal text alignment for rendering of labels - only valid for collapsed legend | ||
:rtype: Qt.AlignmentFlag | ||
%End | ||
|
||
|
||
void updateFromSymbolAndProperty( const QgsMarkerSymbol *symbol, const QgsProperty &ddSize ); | ||
%Docstring | ||
Updates the list of classes, source symbol and title label from given symbol and property | ||
%End | ||
|
||
QgsLegendSymbolList legendSymbolList() const; | ||
%Docstring | ||
Generates legend symbol items according to the configuration | ||
:rtype: QgsLegendSymbolList | ||
%End | ||
|
||
void drawCollapsedLegend( QgsRenderContext &context, QSize *outputSize /Out/ = 0, int *labelXOffset /Out/ = 0 ) const; | ||
%Docstring | ||
Does nothing if legend is not configured as collapsed. | ||
%End | ||
|
||
QImage collapsedLegendImage( QgsRenderContext &context, double paddingMM = 1 ) const; | ||
%Docstring | ||
Returns output image that would be shown in the legend. Returns invalid image if legend is not configured as collapsed. | ||
:rtype: QImage | ||
%End | ||
|
||
static QgsDataDefinedSizeLegend *readTypeAndAlignmentFromXml( const QDomElement &elem ) /Factory/; | ||
%Docstring | ||
.. note:: | ||
|
||
This is a temporary method and may be removed in the future | ||
:rtype: QgsDataDefinedSizeLegend | ||
%End | ||
|
||
static void writeTypeAndAlignmentToXml( const QgsDataDefinedSizeLegend &ddsLegend, QDomElement &elem ); | ||
%Docstring | ||
.. note:: | ||
|
||
This is a temporary method and may be removed in the future | ||
%End | ||
|
||
}; | ||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/core/qgsdatadefinedsizelegend.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
python/gui/symbology-ng/qgsdatadefinedsizelegenddialog.sip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/symbology-ng/qgsdatadefinedsizelegenddialog.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
|
||
|
||
class QgsDataDefinedSizeLegendDialog : QDialog | ||
{ | ||
%Docstring | ||
Dialog for configuration of appearance of legend for marker symbols with data-defined size. | ||
|
||
.. versionadded:: 3.0 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgsdatadefinedsizelegenddialog.h" | ||
%End | ||
public: | ||
explicit QgsDataDefinedSizeLegendDialog( const QgsDataDefinedSizeLegend *ddsLegend, QWidget *parent /TransferThis/ = 0 ); | ||
%Docstring | ||
Creates the dialog and initializes the content to what is passed in the legend configuration (may be null) | ||
%End | ||
~QgsDataDefinedSizeLegendDialog(); | ||
|
||
void setSourceSymbol( QgsMarkerSymbol *symbol /Transfer/ ); | ||
%Docstring | ||
Use given symbol for preview. Takes ownership of the symbol. It should have data-defined size enabled + size scale transformer attached. | ||
%End | ||
|
||
void setLegendMapViewData( double mapUnitsPerPixel, int dpi, double scale ); | ||
%Docstring | ||
Setup map view details to make preview match the expected output | ||
%End | ||
|
||
QgsDataDefinedSizeLegend *dataDefinedSizeLegend() const /Factory/; | ||
%Docstring | ||
Returns configuration as set up in the dialog (may be null). Ownership is passed to the caller. | ||
:rtype: QgsDataDefinedSizeLegend | ||
%End | ||
|
||
signals: | ||
|
||
}; | ||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/symbology-ng/qgsdatadefinedsizelegenddialog.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.