1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220
|
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/scalebar/qgsscalebarrenderer.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
class QgsScaleBarRenderer
{
%Docstring(signature="appended")
Abstract base class for scale bar renderers.
Scalebar renderer subclasses implement custom drawing logic, with the
possibility to implement custom labeling.
%End
%TypeHeaderCode
#include "qgsscalebarrenderer.h"
%End
public:
enum class Flag /BaseType=IntFlag/
{
FlagUsesLineSymbol,
FlagUsesFillSymbol,
FlagUsesAlternateFillSymbol,
FlagRespectsUnits,
FlagRespectsMapUnitsPerScaleBarUnit,
FlagUsesUnitLabel,
FlagUsesSegments,
FlagUsesLabelBarSpace,
FlagUsesLabelVerticalPlacement,
FlagUsesLabelHorizontalPlacement,
FlagUsesAlignment,
FlagUsesSubdivisions,
FlagUsesDivisionSymbol,
FlagUsesSubdivisionSymbol,
FlagUsesSubdivisionsHeight,
};
typedef QFlags<QgsScaleBarRenderer::Flag> Flags;
struct ScaleBarContext
{
double segmentWidth;
QSizeF size;
double scale;
Flags flags;
bool isValid() const;
%Docstring
Returns ``True`` if the context has valid settings.
.. versionadded:: 3.40
%End
};
QgsScaleBarRenderer();
virtual ~QgsScaleBarRenderer();
QString name() const /Deprecated/;
%Docstring
Returns the unique name for this style.
.. deprecated:: 3.40
Use :py:func:`~QgsScaleBarRenderer.id` instead.
%End
virtual QString id() const = 0;
%Docstring
Returns the unique ID for this renderer.
.. versionadded:: 3.14
%End
virtual QString visibleName() const = 0;
%Docstring
Returns the user friendly, translated name for the renderer.
.. versionadded:: 3.14
%End
virtual Flags flags() const;
%Docstring
Returns the scalebar rendering flags, which dictates the renderer's
behavior.
.. versionadded:: 3.14
%End
virtual int sortKey() const;
%Docstring
Returns a sorting key value, where renderers with a lower sort key will
be shown earlier in lists.
Generally, subclasses should return
:py:func:`QgsScaleBarRenderer.sortKey()` as their sorting key.
%End
virtual QgsScaleBarRenderer *clone() const = 0 /Factory/;
%Docstring
Returns a clone of the renderer. The caller takes ownership of the
returned value.
%End
virtual void draw( QgsRenderContext &context,
const QgsScaleBarSettings &settings,
const QgsScaleBarRenderer::ScaleBarContext &scaleContext ) const = 0;
%Docstring
Draws the scalebar using the specified ``settings`` and ``scaleContext``
to a destination render ``context``.
%End
virtual QSizeF calculateBoxSize( const QgsScaleBarSettings &settings,
const QgsScaleBarRenderer::ScaleBarContext &scaleContext ) const /Deprecated/;
%Docstring
Calculates the required box size (in millimeters) for a scalebar using
the specified ``settings`` and ``scaleContext``.
.. deprecated:: 3.40
Use the version with a :py:class:`QgsRenderContext` instead.
%End
virtual QSizeF calculateBoxSize( QgsRenderContext &context,
const QgsScaleBarSettings &settings,
const QgsScaleBarRenderer::ScaleBarContext &scaleContext ) const;
%Docstring
Calculates the required box size (in millimeters) for a scalebar using
the specified ``settings`` and ``scaleContext``.
.. versionadded:: 3.14
%End
virtual bool applyDefaultSettings( QgsScaleBarSettings &settings ) const;
%Docstring
Applies any default settings relating to the scalebar to the passed
``settings`` object.
Returns ``True`` if settings were applied.
.. versionadded:: 3.14
%End
protected:
void drawDefaultLabels( QgsRenderContext &context,
const QgsScaleBarSettings &settings,
const QgsScaleBarRenderer::ScaleBarContext &scaleContext ) const;
%Docstring
Draws default scalebar labels using the specified ``settings`` and
``scaleContext`` to a destination render ``context``.
%End
QString firstLabelString( const QgsScaleBarSettings &settings ) const;
%Docstring
Returns the text used for the first label in the scalebar.
%End
double firstLabelXOffset( const QgsScaleBarSettings &settings ) const /Deprecated/;
%Docstring
Returns the x-offset (in millimeters) used for the first label in the
scalebar.
.. deprecated:: 3.40
Use the version with :py:class:`QgsRenderContext` instead.
%End
double firstLabelXOffset( const QgsScaleBarSettings &settings, const QgsRenderContext &context, const ScaleBarContext &scaleContext ) const;
%Docstring
Returns the x-offset (in render context painter units) used for the
first label in the scalebar.
.. versionadded:: 3.2
%End
QList<double> segmentPositions( const QgsScaleBarRenderer::ScaleBarContext &scaleContext, const QgsScaleBarSettings &settings ) const /Deprecated/;
%Docstring
Returns a list of positions for each segment within the scalebar.
.. deprecated:: 3.40
Use the version with a :py:class:`QgsRenderContext` instead.
%End
QList<double> segmentPositions( QgsRenderContext &context, const QgsScaleBarRenderer::ScaleBarContext &scaleContext, const QgsScaleBarSettings &settings ) const;
%Docstring
Returns a list of positions for each segment within the scalebar.
.. versionadded:: 3.14
%End
QList<double> segmentWidths( const QgsScaleBarRenderer::ScaleBarContext &scaleContext, const QgsScaleBarSettings &settings ) const;
%Docstring
Returns a list of widths of each segment of the scalebar.
%End
};
QFlags<QgsScaleBarRenderer::Flag> operator|(QgsScaleBarRenderer::Flag f1, QFlags<QgsScaleBarRenderer::Flag> f2);
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/scalebar/qgsscalebarrenderer.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
|