|
| 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 | + |
| 32 | + enum LegendType |
| 33 | + { |
| 34 | + LegendSeparated, |
| 35 | + LegendCollapsed, |
| 36 | + }; |
| 37 | + |
| 38 | + enum VerticalAlignment |
| 39 | + { |
| 40 | + AlignCenter, |
| 41 | + AlignBottom, |
| 42 | + }; |
| 43 | + |
| 44 | + struct SizeClass |
| 45 | + { |
| 46 | + SizeClass( double size, const QString &label ); |
| 47 | + |
| 48 | + double size; //!< Marker size in units used by the symbol (usually millimeters) |
| 49 | + QString label; //!< Label to be shown with the particular symbol size |
| 50 | + }; |
| 51 | + |
| 52 | + void setLegendType( LegendType type ); |
| 53 | +%Docstring |
| 54 | +Sets how the legend should be rendered |
| 55 | +%End |
| 56 | + LegendType legendType() const; |
| 57 | +%Docstring |
| 58 | +Returns how the legend should be rendered |
| 59 | + :rtype: LegendType |
| 60 | +%End |
| 61 | + |
| 62 | + void setSymbol( QgsMarkerSymbol *symbol /Transfer/ ); |
| 63 | +%Docstring |
| 64 | +Sets marker symbol that will be used to draw markers in legend |
| 65 | +%End |
| 66 | + QgsMarkerSymbol *symbol() const; |
| 67 | +%Docstring |
| 68 | +Returns marker symbol that will be used to draw markers in legend |
| 69 | + :rtype: QgsMarkerSymbol |
| 70 | +%End |
| 71 | + |
| 72 | + void setClasses( const QList<QgsDataDefinedSizeLegend::SizeClass> &classes ); |
| 73 | +%Docstring |
| 74 | +Sets list of classes: each class is a pair of symbol size (in units used by the symbol) and label |
| 75 | +%End |
| 76 | + QList<QgsDataDefinedSizeLegend::SizeClass> classes() const; |
| 77 | +%Docstring |
| 78 | +Returns list of classes: each class is a pair of symbol size (in units used by the symbol) and label |
| 79 | + :rtype: list of QgsDataDefinedSizeLegend.SizeClass |
| 80 | +%End |
| 81 | + |
| 82 | + void setTitle( const QString &title ); |
| 83 | +%Docstring |
| 84 | +Sets title label for data-defined size legend |
| 85 | +%End |
| 86 | + QString title() const; |
| 87 | +%Docstring |
| 88 | +Returns title label for data-defined size legend |
| 89 | + :rtype: str |
| 90 | +%End |
| 91 | + |
| 92 | + void setVerticalAlignment( VerticalAlignment vAlign ); |
| 93 | +%Docstring |
| 94 | +Sets vertical alignment of symbols - only valid for collapsed legend |
| 95 | +%End |
| 96 | + VerticalAlignment verticalAlignment() const; |
| 97 | +%Docstring |
| 98 | +Returns vertical alignment of symbols - only valid for collapsed legend |
| 99 | + :rtype: VerticalAlignment |
| 100 | +%End |
| 101 | + |
| 102 | + void setFont( const QFont &font ); |
| 103 | +%Docstring |
| 104 | +Sets font used for rendering of labels - only valid for collapsed legend |
| 105 | +%End |
| 106 | + QFont font() const; |
| 107 | +%Docstring |
| 108 | +Returns font used for rendering of labels - only valid for collapsed legend |
| 109 | + :rtype: QFont |
| 110 | +%End |
| 111 | + |
| 112 | + void setTextColor( const QColor &color ); |
| 113 | +%Docstring |
| 114 | +Sets text color for rendering of labels - only valid for collapsed legend |
| 115 | +%End |
| 116 | + QColor textColor() const; |
| 117 | +%Docstring |
| 118 | +Returns text color for rendering of labels - only valid for collapsed legend |
| 119 | + :rtype: QColor |
| 120 | +%End |
| 121 | + |
| 122 | + void setTextAlignment( Qt::AlignmentFlag flag ); |
| 123 | +%Docstring |
| 124 | +Sets horizontal text alignment for rendering of labels - only valid for collapsed legend |
| 125 | +%End |
| 126 | + Qt::AlignmentFlag textAlignment() const; |
| 127 | +%Docstring |
| 128 | +Returns horizontal text alignment for rendering of labels - only valid for collapsed legend |
| 129 | + :rtype: Qt.AlignmentFlag |
| 130 | +%End |
| 131 | + |
| 132 | + |
| 133 | + void updateFromSymbolAndProperty( const QgsMarkerSymbol *symbol, const QgsProperty &ddSize ); |
| 134 | +%Docstring |
| 135 | +Updates the list of classes, source symbol and title label from given symbol and property |
| 136 | +%End |
| 137 | + |
| 138 | + QgsLegendSymbolList legendSymbolList() const; |
| 139 | +%Docstring |
| 140 | +Generates legend symbol items according to the configuration |
| 141 | + :rtype: QgsLegendSymbolList |
| 142 | +%End |
| 143 | + |
| 144 | + void drawCollapsedLegend( QgsRenderContext &context, QSize *outputSize /Out/ = 0, int *labelXOffset /Out/ = 0 ) const; |
| 145 | +%Docstring |
| 146 | +Does nothing if legend is not configured as collapsed. |
| 147 | +%End |
| 148 | + |
| 149 | + QImage collapsedLegendImage( QgsRenderContext &context, double paddingMM = 1 ) const; |
| 150 | +%Docstring |
| 151 | +Returns output image that would be shown in the legend. Returns invalid image if legend is not configured as collapsed. |
| 152 | + :rtype: QImage |
| 153 | +%End |
| 154 | + |
| 155 | + static QgsDataDefinedSizeLegend *readTypeAndAlignmentFromXml( const QDomElement &elem ) /Factory/; |
| 156 | +%Docstring |
| 157 | +.. note:: |
| 158 | + |
| 159 | + This is a temporary method and may be removed in the future |
| 160 | + :rtype: QgsDataDefinedSizeLegend |
| 161 | +%End |
| 162 | + |
| 163 | + static void writeTypeAndAlignmentToXml( const QgsDataDefinedSizeLegend &ddsLegend, QDomElement &elem ); |
| 164 | +%Docstring |
| 165 | +.. note:: |
| 166 | + |
| 167 | + This is a temporary method and may be removed in the future |
| 168 | +%End |
| 169 | + |
| 170 | +}; |
| 171 | + |
| 172 | +/************************************************************************ |
| 173 | + * This file has been generated automatically from * |
| 174 | + * * |
| 175 | + * src/core/qgsdatadefinedsizelegend.h * |
| 176 | + * * |
| 177 | + * Do not edit manually ! Edit header and run scripts/sipify.pl again * |
| 178 | + ************************************************************************/ |
0 commit comments