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 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554
|
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/symbology/qgsgraduatedsymbolrenderer.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
class QgsGraduatedSymbolRenderer : QgsFeatureRenderer
{
%Docstring(signature="appended")
A vector feature renderer which uses numeric attributes to classify
features into different ranges.
%End
%TypeHeaderCode
#include "qgsgraduatedsymbolrenderer.h"
%End
public:
QgsGraduatedSymbolRenderer( const QString &attrName = QString(), const QgsRangeList &ranges = QgsRangeList() );
~QgsGraduatedSymbolRenderer();
virtual Qgis::FeatureRendererFlags flags() const;
virtual QgsSymbol *symbolForFeature( const QgsFeature &feature, QgsRenderContext &context ) const;
virtual QgsSymbol *originalSymbolForFeature( const QgsFeature &feature, QgsRenderContext &context ) const;
virtual void startRender( QgsRenderContext &context, const QgsFields &fields );
virtual void stopRender( QgsRenderContext &context );
virtual QSet<QString> usedAttributes( const QgsRenderContext &context ) const;
virtual bool filterNeedsGeometry() const;
virtual QString dump() const;
virtual QgsGraduatedSymbolRenderer *clone() const /Factory/;
virtual void toSld( QDomDocument &doc, QDomElement &element, const QVariantMap &props = QVariantMap() ) const;
virtual QgsFeatureRenderer::Capabilities capabilities();
virtual QgsSymbolList symbols( QgsRenderContext &context ) const;
virtual bool accept( QgsStyleEntityVisitorInterface *visitor ) const;
QString classAttribute() const;
%Docstring
Returns the attribute name (or expression) used for the classification.
.. seealso:: :py:func:`setClassAttribute`
%End
void setClassAttribute( const QString &attr );
%Docstring
Sets the attribute name (or expression) used for the classification.
.. seealso:: :py:func:`classAttribute`
%End
const QgsRangeList &ranges() const;
%Docstring
Returns a list of all ranges used in the classification.
%End
bool updateRangeSymbol( int rangeIndex, QgsSymbol *symbol /Transfer/ );
bool updateRangeLabel( int rangeIndex, const QString &label );
bool updateRangeUpperValue( int rangeIndex, double value );
bool updateRangeLowerValue( int rangeIndex, double value );
bool updateRangeRenderState( int rangeIndex, bool render );
void addClass( QgsSymbol *symbol );
void addClass( const QgsRendererRange &range ) /PyName=addClassRange/;
%Docstring
%End
void addClass( double lower, double upper ) /PyName=addClassLowerUpper/;
%Docstring
%End
void addBreak( double breakValue, bool updateSymbols = true );
%Docstring
Add a breakpoint by splitting existing classes so that the specified
value becomes a break between two classes.
:param breakValue: position to insert break
:param updateSymbols: set to ``True`` to reapply ramp colors to the new
symbol ranges
%End
void deleteClass( int idx );
void deleteAllClasses();
void moveClass( int from, int to );
%Docstring
Moves the category at index position from to index position to.
%End
bool rangesOverlap() const;
%Docstring
Tests whether classes assigned to the renderer have ranges which
overlap.
:return: ``True`` if ranges overlap
%End
bool rangesHaveGaps() const;
%Docstring
Tests whether classes assigned to the renderer have gaps between the
ranges.
:return: ``True`` if ranges have gaps
%End
void sortByValue( Qt::SortOrder order = Qt::AscendingOrder );
void sortByLabel( Qt::SortOrder order = Qt::AscendingOrder );
QgsClassificationMethod *classificationMethod() const;
%Docstring
Returns the classification method
.. versionadded:: 3.10
%End
void setClassificationMethod( QgsClassificationMethod *method /Transfer/ );
%Docstring
Defines the classification method This will take ownership of the method
.. versionadded:: 3.10
%End
enum Mode /BaseType=IntEnum/
{
EqualInterval,
Quantile,
Jenks,
StdDev,
Pretty,
Custom
};
Mode mode() const /Deprecated/;
%Docstring
.. deprecated:: 3.10
Use classficationMethod instead.
%End
void setMode( Mode mode ) /Deprecated/;
%Docstring
.. deprecated:: 3.10
Use classficationMethod instead.
%End
bool useSymmetricMode() const /Deprecated/;
%Docstring
Returns if we want to classify symmetric around a given value
.. versionadded:: 3.4
.. deprecated:: 3.10
Use classficationMethod instead.
%End
void setUseSymmetricMode( bool useSymmetricMode ) /Deprecated/;
%Docstring
Set if we want to classify symmetric around a given value
.. versionadded:: 3.4
.. deprecated:: 3.10
Use classficationMethod instead.
%End
double symmetryPoint() const /Deprecated/;
%Docstring
Returns the pivot value for symmetric classification
.. versionadded:: 3.4
.. deprecated:: 3.10
Use classficationMethod instead.
%End
void setSymmetryPoint( double symmetryPoint ) /Deprecated/;
%Docstring
Set the pivot point
.. versionadded:: 3.4
.. deprecated:: 3.10
Use classficationMethod instead.
%End
bool astride() const /Deprecated/;
%Docstring
Returns if we want to have a central class astride the pivot value
.. versionadded:: 3.4
.. deprecated:: 3.10
Use classficationMethod instead.
%End
void setAstride( bool astride ) /Deprecated/;
%Docstring
Set if we want a central class astride the pivot value
.. versionadded:: 3.4
.. deprecated:: 3.10
Use classficationMethod instead.
%End
static void makeBreaksSymmetric( QList<double> &breaks /In,Out/, double symmetryPoint, bool astride ) /Deprecated/;
%Docstring
Remove the breaks that are above the existing opposite sign classes to
keep colors symmetrically balanced around symmetryPoint Does not put a
break on the symmetryPoint. This is done before.
:param breaks: The breaks of an already-done classification
:param symmetryPoint: The point around which we want a symmetry
:param astride: A bool indicating if the symmetry is made astride the
symmetryPoint or not ( [-1,1] vs. [-1,0][0,1] )
.. versionadded:: 3.4
.. deprecated:: 3.10
Use :py:class:`QgsClassificationMethod`.makeBreaksSymmetric instead.
%End
static QList<double> calcEqualIntervalBreaks( double minimum, double maximum, int classes, bool useSymmetricMode, double symmetryPoint, bool astride ) /Deprecated/;
%Docstring
Compute the equal interval classification
:param minimum: The minimum value of the distribution
:param maximum: The maximum value of the distribution
:param classes: The number of classes desired
:param useSymmetricMode: A bool indicating if we want to have classes
and hence colors ramp symmetric around a value
:param symmetryPoint: The point around which we want a symmetry
:param astride: A bool indicating if the symmetry is made astride the
symmetryPoint or not ( [-1,1] vs. [-1,0][0,1] )
.. deprecated:: 3.10
Use :py:class:`QgsClassificationEqualInterval` class instead.
%End
void updateClasses( QgsVectorLayer *vlayer, Mode mode, int nclasses, bool useSymmetricMode = false, double symmetryPoint = 0.0, bool astride = false ) /Deprecated/;
%Docstring
Recalculate classes for a layer
:param vlayer: The layer being rendered (from which data values are
calculated)
:param mode: The calculation mode
:param nclasses: The number of classes to calculate (approximate for
some modes)
:param useSymmetricMode: A bool indicating if we want to have classes
and hence colors ramp symmetric around a value
:param symmetryPoint: The value around which the classes will be
symmetric if useSymmetricMode is checked
:param astride: A bool indicating if the symmetry is made astride the
symmetryPoint or not ( [-1,1] vs. [-1,0][0,1] )
.. deprecated:: 3.10
%End
void updateClasses( const QgsVectorLayer *vl, int nclasses, QString &error /Out/ );
%Docstring
Recalculate classes for a layer
:param vl: The layer being rendered (from which data values are
calculated)
:param nclasses: the number of classes
:return: Optional parameter for error reporting
%End
QgsRendererRangeLabelFormat labelFormat() const /Deprecated/;
%Docstring
Returns the label format used to generate default classification labels
.. deprecated:: 3.10
Use :py:func:`~QgsGraduatedSymbolRenderer.classificationMethod` and :py:class:`QgsClassificationMethod`.setLabelFormat instead.
%End
void setLabelFormat( const QgsRendererRangeLabelFormat &labelFormat, bool updateRanges = false ) /Deprecated/;
%Docstring
Set the label format used to generate default classification labels
:param labelFormat: The string appended to classification labels
:param updateRanges: If ``True`` then ranges ending with the old unit
string are updated to the new.
.. deprecated:: 3.10
Use :py:func:`~QgsGraduatedSymbolRenderer.classificationMethod` and :py:class:`QgsClassificationMethod`.setLabelFormat instead.
%End
void calculateLabelPrecision( bool updateRanges = true );
%Docstring
Reset the label decimal places to a numberbased on the minimum class
interval
:param updateRanges: if ``True`` then ranges currently using the default
label will be updated
%End
static QgsGraduatedSymbolRenderer *createRenderer( QgsVectorLayer *vlayer,
const QString &attrName,
int classes,
Mode mode,
QgsSymbol *symbol /Transfer/,
QgsColorRamp *ramp /Transfer/,
const QgsRendererRangeLabelFormat &legendFormat = QgsRendererRangeLabelFormat(),
bool useSymmetricMode = false,
double symmetryPoint = 0.0,
const QStringList &listForCboPrettyBreaks = QStringList(),
bool astride = false ) /Deprecated/;
%Docstring
Creates a new graduated renderer.
:param vlayer: vector layer
:param attrName: attribute to classify
:param classes: number of classes
:param mode: classification mode
:param symbol: base symbol
:param ramp: color ramp for classes
:param legendFormat:
:param useSymmetricMode: A bool indicating if we want to have classes
and hence colors ramp symmetric around a value
:param symmetryPoint: The value around which the classes will be
symmetric if useSymmetricMode is checked
:param listForCboPrettyBreaks: The list of potential pivot values for
symmetric mode with prettybreaks mode
:param astride: A bool indicating if the symmetry is made astride the
symmetryPoint or not ( [-1,1] vs. [-1,0][0,1] )
:return: new QgsGraduatedSymbolRenderer object
.. deprecated:: 3.10
%End
static QgsFeatureRenderer *create( QDomElement &element, const QgsReadWriteContext &context ) /Factory/;
%Docstring
create renderer from XML element
%End
virtual QDomElement save( QDomDocument &doc, const QgsReadWriteContext &context );
virtual QgsLegendSymbolList legendSymbolItems() const;
virtual QSet< QString > legendKeysForFeature( const QgsFeature &feature, QgsRenderContext &context ) const;
virtual QString legendKeyToExpression( const QString &key, QgsVectorLayer *layer, bool &ok ) const;
QgsSymbol *sourceSymbol();
%Docstring
Returns the renderer's source symbol, which is the base symbol used for
the each classes' symbol before applying the classes' color.
.. seealso:: :py:func:`setSourceSymbol`
.. seealso:: :py:func:`sourceColorRamp`
%End
void setSourceSymbol( QgsSymbol *sym /Transfer/ );
%Docstring
Sets the source symbol for the renderer, which is the base symbol used
for the each classes' symbol before applying the classes' color.
:param sym: source symbol, ownership is transferred to the renderer
.. seealso:: :py:func:`sourceSymbol`
.. seealso:: :py:func:`setSourceColorRamp`
%End
QgsColorRamp *sourceColorRamp();
%Docstring
Returns the source color ramp, from which each classes' color is
derived.
.. seealso:: :py:func:`setSourceColorRamp`
.. seealso:: :py:func:`sourceSymbol`
%End
void setSourceColorRamp( QgsColorRamp *ramp /Transfer/ );
%Docstring
Sets the source color ramp.
:param ramp: color ramp. Ownership is transferred to the renderer
%End
void updateColorRamp( QgsColorRamp *ramp /Transfer/ = 0 );
%Docstring
Update the color ramp used. Also updates all symbols colors. Doesn't
alter current breaks.
:param ramp: color ramp. Ownership is transferred to the renderer
%End
void updateSymbols( QgsSymbol *sym );
%Docstring
Update all the symbols but leave breaks and colors. This method also
sets the source symbol for the renderer.
:param sym: source symbol to use for classes. Ownership is not
transferred.
.. seealso:: :py:func:`setSourceSymbol`
%End
void setSymbolSizes( double minSize, double maxSize );
%Docstring
set varying symbol size for classes
.. note::
the classes must already be set so that symbols exist
%End
double minSymbolSize() const;
%Docstring
Returns the min symbol size when graduated by size
%End
double maxSymbolSize() const;
%Docstring
Returns the max symbol size when graduated by size
%End
Qgis::GraduatedMethod graduatedMethod() const;
%Docstring
Returns the method used for graduation (either size or color).
.. seealso:: :py:func:`setGraduatedMethod`
%End
void setGraduatedMethod( Qgis::GraduatedMethod method );
%Docstring
Set the ``method`` used for graduation (either size or color).
.. seealso:: :py:func:`graduatedMethod`
%End
virtual bool legendSymbolItemsCheckable() const;
virtual bool legendSymbolItemChecked( const QString &key );
virtual void checkLegendSymbolItem( const QString &key, bool state = true );
virtual void setLegendSymbolItem( const QString &key, QgsSymbol *symbol /Transfer/ );
virtual QString legendClassificationAttribute() const;
static QgsGraduatedSymbolRenderer *convertFromRenderer( const QgsFeatureRenderer *renderer ) /Factory/;
%Docstring
creates a QgsGraduatedSymbolRenderer from an existing renderer.
:return: a new renderer if the conversion was possible, otherwise
``None``.
%End
void setDataDefinedSizeLegend( QgsDataDefinedSizeLegend *settings /Transfer/ );
%Docstring
Configures appearance of legend when renderer is configured to use
data-defined size for marker symbols. This allows configuring for which
values (symbol sizes) should be shown in the legend, whether to display
different symbol sizes collapsed in one legend node or separated across
multiple legend nodes etc.
When renderer does not use data-defined size or does not use marker
symbols, these settings will be ignored. Takes ownership of the passed
settings objects. ``None`` is a valid input that disables data-defined
size legend.
%End
QgsDataDefinedSizeLegend *dataDefinedSizeLegend() const;
%Docstring
Returns configuration of appearance of legend when using data-defined
size for marker symbols. Will return ``None`` if the functionality is
disabled.
%End
void updateRangeLabels();
%Docstring
Updates the labels of the ranges
.. versionadded:: 3.10
%End
const QgsRendererRange *rangeForValue( double value ) const;
%Docstring
Returns the renderer range matching the provided ``value``, or ``None``
if no range matches the value.
.. versionadded:: 3.10.1
%End
protected:
QgsSymbol *symbolForValue( double value ) const;
%Docstring
Gets the symbol which is used to represent ``value``.
%End
QString legendKeyForValue( double value ) const;
%Docstring
Returns the matching legend key for a value.
%End
private:
QgsGraduatedSymbolRenderer( const QgsGraduatedSymbolRenderer & );
QgsGraduatedSymbolRenderer &operator=( const QgsGraduatedSymbolRenderer & );
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/symbology/qgsgraduatedsymbolrenderer.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
|