|
| 1 | +/************************************************************************ |
| 2 | + * This file has been generated automatically from * |
| 3 | + * * |
| 4 | + * src/core/qgsdatadefinedsizelegend.h * |
| 5 | + * * |
| 6 | + * Do not edit manually ! Edit header and run scripts/sipify.pl again * |
| 7 | + ************************************************************************/ |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | +class QgsDataDefinedSizeLegend |
| 15 | +{ |
| 16 | +%Docstring |
| 17 | + Object that keeps configuration of appearance of marker symbol's data-defined size in legend. |
| 18 | + For example: the list of classes (size values), whether the classes should appear in separate |
| 19 | + legend nodes or whether to collapse them into one legend node. |
| 20 | +
|
| 21 | +.. versionadded:: 3.0 |
| 22 | +%End |
| 23 | +
|
| 24 | +%TypeHeaderCode |
| 25 | +#include "qgsdatadefinedsizelegend.h" |
| 26 | +%End |
| 27 | + public: |
| 28 | + QgsDataDefinedSizeLegend(); |
| 29 | +
|
| 30 | + QgsDataDefinedSizeLegend( const QgsDataDefinedSizeLegend &other ); |
| 31 | +%Docstring |
| 32 | +Copy constructor |
| 33 | +%End |
| 34 | +
|
| 35 | + enum LegendType |
| 36 | + { |
| 37 | + LegendSeparated, |
| 38 | + LegendCollapsed, |
| 39 | + }; |
| 40 | +
|
| 41 | + enum VerticalAlignment |
| 42 | + { |
| 43 | + AlignCenter, |
| 44 | + AlignBottom, |
| 45 | + }; |
| 46 | +
|
| 47 | + struct SizeClass |
| 48 | + { |
| 49 | + SizeClass( double size, const QString &label ); |
| 50 | +
|
| 51 | + double size; //!< Marker size in units used by the symbol (usually millimeters) |
| 52 | + QString label; //!< Label to be shown with the particular symbol size |
| 53 | + }; |
| 54 | +
|
| 55 | + void setLegendType( LegendType type ); |
| 56 | +%Docstring |
| 57 | +Sets how the legend should be rendered |
| 58 | +%End |
| 59 | + LegendType legendType() const; |
| 60 | +%Docstring |
| 61 | +Returns how the legend should be rendered |
| 62 | + :rtype: LegendType |
| 63 | +%End |
| 64 | +
|
| 65 | + void setSymbol( QgsMarkerSymbol *symbol /Transfer/ ); |
| 66 | +%Docstring |
| 67 | +Sets marker symbol that will be used to draw markers in legend |
| 68 | +%End |
| 69 | + QgsMarkerSymbol *symbol() const; |
| 70 | +%Docstring |
| 71 | +Returns marker symbol that will be used to draw markers in legend |
| 72 | + :rtype: QgsMarkerSymbol |
| 73 | +%End |
| 74 | +
|
| 75 | + void setClasses( const QList<QgsDataDefinedSizeLegend::SizeClass> &classes ); |
| 76 | +%Docstring |
| 77 | +Sets list of classes: each class is a pair of symbol size (in units used by the symbol) and label |
| 78 | +%End |
| 79 | + QList<QgsDataDefinedSizeLegend::SizeClass> classes() const; |
| 80 | +%Docstring |
| 81 | +Returns list of classes: each class is a pair of symbol size (in units used by the symbol) and label |
| 82 | + :rtype: list of QgsDataDefinedSizeLegend.SizeClass |
| 83 | +%End |
| 84 | +
|
| 85 | + void setTitle( const QString &title ); |
| 86 | +%Docstring |
| 87 | +Sets title label for data-defined size legend |
| 88 | +%End |
| 89 | + QString title() const; |
| 90 | +%Docstring |
| 91 | +Returns title label for data-defined size legend |
| 92 | + :rtype: str |
| 93 | +%End |
| 94 | +
|
| 95 | + void setVerticalAlignment( VerticalAlignment vAlign ); |
| 96 | +%Docstring |
| 97 | +Sets vertical alignment of symbols - only valid for collapsed legend |
| 98 | +%End |
| 99 | + VerticalAlignment verticalAlignment() const; |
| 100 | +%Docstring |
| 101 | +Returns vertical alignment of symbols - only valid for collapsed legend |
| 102 | + :rtype: VerticalAlignment |
| 103 | +%End |
| 104 | +
|
| 105 | + void setFont( const QFont &font ); |
| 106 | +%Docstring |
| 107 | +Sets font used for rendering of labels - only valid for collapsed legend |
| 108 | +%End |
| 109 | + QFont font() const; |
| 110 | +%Docstring |
| 111 | +Returns font used for rendering of labels - only valid for collapsed legend |
| 112 | + :rtype: QFont |
| 113 | +%End |
| 114 | +
|
| 115 | + void setTextColor( const QColor &color ); |
| 116 | +%Docstring |
| 117 | +Sets text color for rendering of labels - only valid for collapsed legend |
| 118 | +%End |
| 119 | + QColor textColor() const; |
| 120 | +%Docstring |
| 121 | +Returns text color for rendering of labels - only valid for collapsed legend |
| 122 | + :rtype: QColor |
| 123 | +%End |
| 124 | +
|
| 125 | + void setTextAlignment( Qt::AlignmentFlag flag ); |
| 126 | +%Docstring |
| 127 | +Sets horizontal text alignment for rendering of labels - only valid for collapsed legend |
| 128 | +%End |
| 129 | + Qt::AlignmentFlag textAlignment() const; |
| 130 | +%Docstring |
| 131 | +Returns horizontal text alignment for rendering of labels - only valid for collapsed legend |
| 132 | + :rtype: Qt.AlignmentFlag |
| 133 | +%End |
| 134 | +
|
| 135 | +
|
| 136 | + void updateFromSymbolAndProperty( const QgsMarkerSymbol *symbol, const QgsProperty &ddSize ); |
| 137 | +%Docstring |
| 138 | +Updates the list of classes, source symbol and title label from given symbol and property |
| 139 | +%End |
| 140 | +
|
| 141 | + QgsLegendSymbolList legendSymbolList() const; |
| 142 | +%Docstring |
| 143 | +Generates legend symbol items according to the configuration |
| 144 | + :rtype: QgsLegendSymbolList |
| 145 | +%End |
| 146 | +
|
| 147 | + void drawCollapsedLegend( QgsRenderContext &context, QSize *outputSize /Out/ = 0, int *labelXOffset /Out/ = 0 ) const; |
| 148 | +%Docstring |
| 149 | +Does nothing if legend is not configured as collapsed. |
| 150 | +%End |
| 151 | +
|
| 152 | + QImage collapsedLegendImage( QgsRenderContext &context, const QColor &backgroundColor = Qt::transparent, double paddingMM = 1 ) const; |
| 153 | +%Docstring |
| 154 | +Returns output image that would be shown in the legend. Returns invalid image if legend is not configured as collapsed. |
| 155 | + :rtype: QImage |
| 156 | +%End |
| 157 | +
|
| 158 | + static QgsDataDefinedSizeLegend *readXml( const QDomElement &elem, const QgsReadWriteContext &context ) /Factory/; |
| 159 | +%Docstring |
| 160 | +Creates instance from given element and returns it (caller takes ownership). Returns null on error. |
| 161 | + :rtype: QgsDataDefinedSizeLegend |
| 162 | +%End |
| 163 | +
|
| 164 | + void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const; |
| 165 | +%Docstring |
| 166 | +Writes configuration to the given XML element. |
| 167 | +%End |
| 168 | +
|
| 169 | +}; |
| 170 | +
|
| 171 | +/************************************************************************ |
| 172 | + * This file has been generated automatically from * |
| 173 | + * * |
| 174 | + * src/core/qgsdatadefinedsizelegend.h * |
| 175 | + * * |
| 176 | + * Do not edit manually ! Edit header and run scripts/sipify.pl again * |
| 177 | + ************************************************************************/ |
0 commit comments