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 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105
|
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsdiagramrenderer.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
class QgsDiagramLayerSettings
{
%Docstring(signature="appended")
Stores the settings for rendering of all diagrams for a layer.
:py:class:`QgsDiagramSettings` stores the settings related to rendering
the individual diagrams themselves, while
:py:class:`QgsDiagramLayerSettings` stores settings which control how
ALL diagrams within a layer are rendered.
%End
%TypeHeaderCode
#include "qgsdiagramrenderer.h"
%End
public:
enum Placement /BaseType=IntEnum/
{
AroundPoint,
OverPoint,
Line,
Curved,
Horizontal,
Free
};
enum LinePlacementFlag /BaseType=IntEnum/
{
OnLine,
AboveLine,
BelowLine,
MapOrientation,
};
typedef QFlags<QgsDiagramLayerSettings::LinePlacementFlag> LinePlacementFlags;
enum class Property /BaseType=IntEnum/
{
BackgroundColor,
StrokeColor,
StrokeWidth,
PositionX,
PositionY,
Distance,
Priority,
ZIndex,
IsObstacle,
Show,
AlwaysShow,
StartAngle,
};
enum DiagramType /BaseType=IntEnum/
{
Single,
Stacked
};
static const QgsPropertiesDefinition &propertyDefinitions();
%Docstring
Returns the diagram property definitions.
%End
QgsDiagramLayerSettings();
QgsDiagramLayerSettings( const QgsDiagramLayerSettings &rh );
~QgsDiagramLayerSettings();
Placement placement() const;
%Docstring
Returns the diagram placement.
.. seealso:: :py:func:`setPlacement`
%End
void setPlacement( Placement value );
%Docstring
Sets the diagram placement.
:param value: placement value
.. seealso:: :py:func:`placement`
%End
LinePlacementFlags linePlacementFlags() const;
%Docstring
Returns the diagram placement flags. These are only used if the diagram
placement is set to a line type.
.. seealso:: :py:func:`setLinePlacementFlags`
%End
void setLinePlacementFlags( LinePlacementFlags flags );
%Docstring
Sets the the diagram placement flags. These are only used if the diagram
placement is set to a line type.
:param flags: placement value
.. seealso:: :py:func:`linePlacementFlags`
%End
int priority() const;
%Docstring
Returns the diagram priority.
:return: diagram priority, where 0 = low and 10 = high
.. note::
placement priority is shared with labeling, so diagrams with a high priority may displace labels
and vice-versa
.. seealso:: :py:func:`setPriority`
%End
void setPriority( int value );
%Docstring
Sets the diagram priority.
:param value: priority, where 0 = low and 10 = high
.. seealso:: :py:func:`priority`
%End
double zIndex() const;
%Docstring
Returns the diagram z-index. Diagrams (or labels) with a higher z-index
are drawn over diagrams with a lower z-index.
.. note::
z-index ordering is shared with labeling, so diagrams with a high z-index may be drawn over labels
with a low z-index and vice-versa
.. seealso:: :py:func:`setZIndex`
%End
void setZIndex( double index );
%Docstring
Sets the diagram z-index. Diagrams (or labels) with a higher z-index are
drawn over diagrams with a lower z-index.
:param index: diagram z-index
.. seealso:: :py:func:`zIndex`
%End
bool isObstacle() const;
%Docstring
Returns whether the feature associated with a diagram acts as an
obstacle for other labels or diagrams.
.. seealso:: :py:func:`setIsObstacle`
%End
void setIsObstacle( bool isObstacle );
%Docstring
Sets whether the feature associated with a diagram acts as an obstacle
for other labels or diagrams.
:param isObstacle: set to ``True`` for feature to act as obstacle
.. seealso:: :py:func:`isObstacle`
%End
double distance() const;
%Docstring
Returns the distance between the diagram and the feature (in mm).
.. seealso:: :py:func:`setDistance`
%End
void setDistance( double distance );
%Docstring
Sets the distance between the diagram and the feature.
:param distance: distance in mm
.. seealso:: :py:func:`distance`
%End
QgsDiagramRenderer *renderer();
%Docstring
Returns the diagram renderer associated with the layer.
.. seealso:: :py:func:`setRenderer`
%End
void setRenderer( QgsDiagramRenderer *diagramRenderer /Transfer/ );
%Docstring
Sets the diagram renderer associated with the layer.
:param diagramRenderer: diagram renderer. Ownership is transferred to
the object.
.. seealso:: :py:func:`renderer`
%End
QgsCoordinateTransform coordinateTransform() const;
%Docstring
Returns the coordinate transform associated with the layer, or an
invalid transform if no transformation is required.
.. seealso:: :py:func:`setCoordinateTransform`
%End
void setCoordinateTransform( const QgsCoordinateTransform &transform );
%Docstring
Sets the coordinate transform associated with the layer.
:param transform: coordinate transform. Ownership is transferred to the
object.
.. seealso:: :py:func:`coordinateTransform`
%End
bool showAllDiagrams() const;
%Docstring
Returns whether the layer should show all diagrams, including
overlapping diagrams
.. seealso:: :py:func:`setShowAllDiagrams`
%End
void setShowAllDiagrams( bool showAllDiagrams );
%Docstring
Sets whether the layer should show all diagrams, including overlapping
diagrams
:param showAllDiagrams: set to ``True`` to show all diagrams
.. seealso:: :py:func:`showAllDiagrams`
%End
void readXml( const QDomElement &elem );
%Docstring
Reads the diagram settings from a DOM element.
.. seealso:: :py:func:`writeXml`
%End
void writeXml( QDomElement &layerElem, QDomDocument &doc ) const;
%Docstring
Writes the diagram settings to a DOM element.
.. seealso:: :py:func:`readXml`
%End
bool prepare( const QgsExpressionContext &context = QgsExpressionContext() ) const;
%Docstring
Prepares the diagrams for a specified expression context. Calling
prepare before rendering multiple diagrams allows precalculation of
expensive setup tasks such as parsing expressions. Returns ``True`` if
preparation was successful.
%End
QSet< QString > referencedFields( const QgsExpressionContext &context = QgsExpressionContext() ) const;
%Docstring
Returns the set of any fields referenced by the layer's diagrams.
:param context: expression context the diagrams will be drawn using
%End
QgsPropertyCollection &dataDefinedProperties();
%Docstring
Returns a reference to the diagram's property collection, used for data
defined overrides.
.. seealso:: :py:func:`setDataDefinedProperties`
%End
void setDataDefinedProperties( const QgsPropertyCollection &collection );
%Docstring
Sets the diagram's property collection, used for data defined overrides.
:param collection: property collection. Existing properties will be
replaced.
.. seealso:: :py:func:`dataDefinedProperties`
.. seealso:: Property
%End
};
class QgsDiagramSettings
{
%Docstring(signature="appended")
Stores the settings for rendering a single diagram.
:py:class:`QgsDiagramSettings` stores the settings related to rendering
the individual diagrams themselves, while
:py:class:`QgsDiagramLayerSettings` stores settings which control how
ALL diagrams within a layer are rendered.
%End
%TypeHeaderCode
#include "qgsdiagramrenderer.h"
%End
public:
enum LabelPlacementMethod /BaseType=IntEnum/
{
Height,
XHeight
};
enum DiagramOrientation /BaseType=IntEnum/
{
Up,
Down,
Left,
Right
};
enum Direction /BaseType=IntEnum/
{
Clockwise,
Counterclockwise,
};
enum StackedDiagramMode /BaseType=IntEnum/
{
Horizontal,
Vertical
};
QgsDiagramSettings();
~QgsDiagramSettings();
QgsDiagramSettings( const QgsDiagramSettings &other );
bool enabled;
QFont font;
QList< QColor > categoryColors;
QList< QString > categoryAttributes;
QList< QString > categoryLabels;
QSizeF size; //size
Qgis::RenderUnit sizeType;
QgsMapUnitScale sizeScale;
Qgis::RenderUnit lineSizeUnit;
QgsMapUnitScale lineSizeScale;
QColor backgroundColor;
QColor penColor;
double penWidth;
LabelPlacementMethod labelPlacementMethod;
DiagramOrientation diagramOrientation;
StackedDiagramMode stackedDiagramMode;
double barWidth;
double opacity;
bool scaleByArea;
double rotationOffset;
bool scaleBasedVisibility;
double maximumScale;
double minimumScale;
double minimumSize;
double spacing() const;
%Docstring
Returns the spacing between diagram contents.
Spacing units can be retrieved by calling
:py:func:`~QgsDiagramSettings.spacingUnit`.
.. seealso:: :py:func:`setSpacing`
.. seealso:: :py:func:`spacingUnit`
.. seealso:: :py:func:`spacingMapUnitScale`
.. versionadded:: 3.12
%End
void setSpacing( double spacing );
%Docstring
Sets the ``spacing`` between diagram contents.
Spacing units are set via :py:func:`~QgsDiagramSettings.setSpacingUnit`.
.. seealso:: :py:func:`spacing`
.. seealso:: :py:func:`setSpacingUnit`
.. seealso:: :py:func:`setSpacingMapUnitScale`
.. versionadded:: 3.12
%End
void setSpacingUnit( Qgis::RenderUnit unit );
%Docstring
Sets the ``unit`` for the content spacing.
.. seealso:: :py:func:`spacingUnit`
.. seealso:: :py:func:`setSpacing`
.. seealso:: :py:func:`setSpacingMapUnitScale`
.. versionadded:: 3.12
%End
Qgis::RenderUnit spacingUnit() const;
%Docstring
Returns the units for the content spacing.
.. seealso:: :py:func:`setSpacingUnit`
.. seealso:: :py:func:`spacing`
.. seealso:: :py:func:`spacingMapUnitScale`
.. versionadded:: 3.12
%End
void setSpacingMapUnitScale( const QgsMapUnitScale &scale );
%Docstring
Sets the map unit ``scale`` for the content spacing.
.. seealso:: :py:func:`spacingMapUnitScale`
.. seealso:: :py:func:`setSpacing`
.. seealso:: :py:func:`setSpacingUnit`
.. versionadded:: 3.12
%End
const QgsMapUnitScale &spacingMapUnitScale() const;
%Docstring
Returns the map unit scale for the content spacing.
.. seealso:: :py:func:`setSpacingMapUnitScale`
.. seealso:: :py:func:`spacing`
.. seealso:: :py:func:`spacingUnit`
.. versionadded:: 3.12
%End
double stackedDiagramSpacing() const;
%Docstring
Returns the spacing between subdiagrams in a stacked diagram.
Spacing units can be retrieved by calling
:py:func:`~QgsDiagramSettings.stackedDiagramSpacingUnit`.
.. seealso:: :py:func:`setStackedDiagramSpacing`
.. seealso:: :py:func:`stackedDiagramSpacingUnit`
.. seealso:: :py:func:`stackedDiagramSpacingMapUnitScale`
.. versionadded:: 3.40
%End
void setStackedDiagramSpacing( double spacing );
%Docstring
Sets the ``spacing`` between subdiagrams in a stacked diagram.
Spacing units are set via
:py:func:`~QgsDiagramSettings.setStackedDiagramSpacingUnit`.
.. seealso:: :py:func:`stackedDiagramSpacing`
.. seealso:: :py:func:`setStackedDiagramSpacingUnit`
.. seealso:: :py:func:`setStackedDiagramSpacingMapUnitScale`
.. versionadded:: 3.40
%End
void setStackedDiagramSpacingUnit( Qgis::RenderUnit unit );
%Docstring
Sets the ``unit`` for the spacing between subdiagrams in a stacked
diagram.
.. seealso:: :py:func:`stackedDiagramSpacingUnit`
.. seealso:: :py:func:`setStackedDiagramSpacing`
.. seealso:: :py:func:`setStackedDiagramSpacingMapUnitScale`
.. versionadded:: 3.40
%End
Qgis::RenderUnit stackedDiagramSpacingUnit() const;
%Docstring
Returns the units for the spacing between subdiagrams in a stacked
diagram.
.. seealso:: :py:func:`setStackedDiagramSpacingUnit`
.. seealso:: :py:func:`stackedDiagramSpacing`
.. seealso:: :py:func:`stackedDiagramSpacingMapUnitScale`
.. versionadded:: 3.40
%End
void setStackedDiagramSpacingMapUnitScale( const QgsMapUnitScale &scale );
%Docstring
Sets the map unit ``scale`` for the spacing between subdiagrams in a
stacked diagram.
.. seealso:: :py:func:`stackedDiagramSpacingMapUnitScale`
.. seealso:: :py:func:`setStackedDiagramSpacing`
.. seealso:: :py:func:`setStackedDiagramSpacingUnit`
.. versionadded:: 3.40
%End
const QgsMapUnitScale &stackedDiagramSpacingMapUnitScale() const;
%Docstring
Returns the map unit scale for the spacing between subdiagrams in a
stacked diagram.
.. seealso:: :py:func:`setStackedDiagramSpacingMapUnitScale` ;
.. seealso:: :py:func:`stackedDiagramSpacing`
.. seealso:: :py:func:`stackedDiagramSpacingUnit`
.. versionadded:: 3.40
%End
Direction direction() const;
%Docstring
Returns the chart's angular direction.
.. seealso:: :py:func:`setDirection`
.. versionadded:: 3.12
%End
void setDirection( Direction direction );
%Docstring
Sets the chart's angular ``direction``.
.. seealso:: :py:func:`direction`
.. versionadded:: 3.12
%End
void readXml( const QDomElement &elem, const QgsReadWriteContext &context = QgsReadWriteContext() );
%Docstring
Reads diagram settings from XML
%End
void writeXml( QDomElement &rendererElem, QDomDocument &doc, const QgsReadWriteContext &context = QgsReadWriteContext() ) const;
%Docstring
Writes diagram settings to XML
%End
QList< QgsLayerTreeModelLegendNode * > legendItems( QgsLayerTreeLayer *nodeLayer ) const /Factory/;
%Docstring
Returns list of legend nodes for the diagram
.. note::
caller is responsible for deletion of :py:class:`QgsLayerTreeModelLegendNodes`
%End
QgsLineSymbol *axisLineSymbol() const;
%Docstring
Returns the line symbol to use for rendering axis in diagrams.
.. seealso:: :py:func:`setAxisLineSymbol`
.. seealso:: :py:func:`showAxis`
.. versionadded:: 3.12
%End
void setAxisLineSymbol( QgsLineSymbol *symbol /Transfer/ );
%Docstring
Sets the line ``symbol`` to use for rendering axis in diagrams.
Ownership of ``symbol`` is transferred to the settings.
.. seealso:: :py:func:`axisLineSymbol`
.. seealso:: :py:func:`setShowAxis`
.. versionadded:: 3.12
%End
bool showAxis() const;
%Docstring
Returns ``True`` if the diagram axis should be shown.
.. seealso:: :py:func:`setShowAxis`
.. seealso:: :py:func:`axisLineSymbol`
.. versionadded:: 3.12
%End
void setShowAxis( bool showAxis );
%Docstring
Sets whether the diagram axis should be shown.
.. seealso:: :py:func:`showAxis`
.. seealso:: :py:func:`setAxisLineSymbol`
.. versionadded:: 3.12
%End
QgsPaintEffect *paintEffect() const;
%Docstring
Returns the paint effect to use while rendering diagrams.
.. seealso:: :py:func:`setPaintEffect`
.. versionadded:: 3.12
%End
void setPaintEffect( QgsPaintEffect *effect /Transfer/ );
%Docstring
Sets the paint ``effect`` to use while rendering diagrams.
Ownership of ``effect`` is transferred to the settings.
.. seealso:: :py:func:`paintEffect`
.. versionadded:: 3.12
%End
};
class QgsDiagramInterpolationSettings
{
%Docstring(signature="appended")
Additional diagram settings for interpolated size rendering.
%End
%TypeHeaderCode
#include "qgsdiagramrenderer.h"
%End
public:
QSizeF lowerSize;
QSizeF upperSize;
double lowerValue;
double upperValue;
QString classificationField;
QString classificationAttributeExpression;
bool classificationAttributeIsExpression;
};
class QgsDiagramRenderer
{
%Docstring(signature="appended")
Evaluates and returns the diagram settings relating to a diagram for a
specific feature.
%End
%TypeHeaderCode
#include "qgsdiagramrenderer.h"
%End
%ConvertToSubClassCode
if ( sipCpp->rendererName() == QLatin1String( "SingleCategory" ) )
sipType = sipType_QgsSingleCategoryDiagramRenderer;
else if ( sipCpp->rendererName() == QLatin1String( "LinearlyInterpolated" ) )
sipType = sipType_QgsLinearlyInterpolatedDiagramRenderer;
else if ( sipCpp->rendererName() == QLatin1String( "Stacked" ) )
sipType = sipType_QgsStackedDiagramRenderer;
else
sipType = NULL;
%End
public:
QgsDiagramRenderer();
virtual ~QgsDiagramRenderer();
virtual QgsDiagramRenderer *clone() const = 0 /Factory/;
%Docstring
Returns new instance that is equivalent to this one
%End
virtual QSizeF sizeMapUnits( const QgsFeature &feature, const QgsRenderContext &c ) const;
%Docstring
Returns size of the diagram for a feature in map units. Returns an
invalid QSizeF in case of error
%End
virtual QString rendererName() const = 0;
virtual QList<QString> diagramAttributes() const = 0;
%Docstring
Returns attribute indices needed for diagram rendering
%End
virtual QSet< QString > referencedFields( const QgsExpressionContext &context = QgsExpressionContext() ) const;
%Docstring
Returns the set of any fields required for diagram rendering
:param context: expression context the diagrams will be drawn using
%End
virtual void renderDiagram( const QgsFeature &feature, QgsRenderContext &c, QPointF pos, const QgsPropertyCollection &properties = QgsPropertyCollection() ) const;
%Docstring
Renders the diagram for a specified feature at a specific position in
the passed render context.
%End
void setDiagram( QgsDiagram *d /Transfer/ );
QgsDiagram *diagram() const;
virtual QList<QgsDiagramSettings> diagramSettings() const = 0;
%Docstring
Returns list with all diagram settings in the renderer
%End
virtual void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) = 0;
%Docstring
Reads diagram state from a DOM element. Subclasses should ensure that
_readXml() is called by their readXml implementation to restore the
general QgsDiagramRenderer settings.
.. seealso:: :py:func:`writeXml`
%End
virtual void writeXml( QDomElement &layerElem, QDomDocument &doc, const QgsReadWriteContext &context ) const = 0;
%Docstring
Writes diagram state to a DOM element. Subclasses should ensure that
_writeXml() is called by their writeXml implementation to save the
general QgsDiagramRenderer settings.
.. seealso:: :py:func:`readXml`
%End
virtual QList< QgsLayerTreeModelLegendNode * > legendItems( QgsLayerTreeLayer *nodeLayer ) const /Factory/;
%Docstring
Returns list of legend nodes for the diagram
.. note::
caller is responsible for deletion of :py:class:`QgsLayerTreeModelLegendNodes`
%End
bool attributeLegend() const;
%Docstring
Returns ``True`` if renderer will show legend items for diagram
attributes.
.. seealso:: :py:func:`setAttributeLegend`
%End
void setAttributeLegend( bool enabled );
%Docstring
Sets whether the renderer will show legend items for diagram attributes.
:param enabled: set to ``True`` to show diagram attribute legend
.. seealso:: :py:func:`attributeLegend`
%End
protected:
QgsDiagramRenderer( const QgsDiagramRenderer &other );
virtual bool diagramSettings( const QgsFeature &feature, const QgsRenderContext &c, QgsDiagramSettings &s ) const = 0;
%Docstring
Returns diagram settings for a feature (or ``False`` if the diagram for
the feature is not to be rendered). Used internally within
:py:func:`~QgsDiagramRenderer.renderDiagram`
:param feature: the feature
:param c: render context
:param s: out: diagram settings for the feature
%End
virtual QSizeF diagramSize( const QgsFeature &feature, const QgsRenderContext &c ) const = 0;
%Docstring
Returns size of the diagram (in painter units) or an invalid size in
case of error
:param feature: the feature
:param c: render context
%End
void convertSizeToMapUnits( QSizeF &size, const QgsRenderContext &context ) const;
%Docstring
Converts size from mm to map units
%End
static int dpiPaintDevice( const QPainter * );
%Docstring
Returns the paint device dpi (or -1 in case of error
%End
void _readXml( const QDomElement &elem, const QgsReadWriteContext &context );
%Docstring
Reads internal QgsDiagramRenderer state from a DOM element.
.. seealso:: _writeXml
%End
void _writeXml( QDomElement &rendererElem, QDomDocument &doc, const QgsReadWriteContext &context ) const;
%Docstring
Writes internal QgsDiagramRenderer diagram state to a DOM element.
.. seealso:: _readXml
%End
};
class QgsSingleCategoryDiagramRenderer : QgsDiagramRenderer
{
%Docstring(signature="appended")
Renders the diagrams for all features with the same settings
%End
%TypeHeaderCode
#include "qgsdiagramrenderer.h"
%End
public:
QgsSingleCategoryDiagramRenderer();
virtual QgsSingleCategoryDiagramRenderer *clone() const /Factory/;
virtual QString rendererName() const;
virtual QList<QString> diagramAttributes() const;
void setDiagramSettings( const QgsDiagramSettings &s );
virtual QList<QgsDiagramSettings> diagramSettings() const;
virtual void readXml( const QDomElement &elem, const QgsReadWriteContext &context );
virtual void writeXml( QDomElement &layerElem, QDomDocument &doc, const QgsReadWriteContext &context ) const;
virtual QList< QgsLayerTreeModelLegendNode * > legendItems( QgsLayerTreeLayer *nodeLayer ) const /Factory/;
protected:
virtual bool diagramSettings( const QgsFeature &feature, const QgsRenderContext &c, QgsDiagramSettings &s ) const;
virtual QSizeF diagramSize( const QgsFeature &, const QgsRenderContext &c ) const;
};
class QgsLinearlyInterpolatedDiagramRenderer : QgsDiagramRenderer
{
%Docstring(signature="appended")
Alters the size of rendered diagrams using a linear scaling.
%End
%TypeHeaderCode
#include "qgsdiagramrenderer.h"
%End
public:
QgsLinearlyInterpolatedDiagramRenderer();
~QgsLinearlyInterpolatedDiagramRenderer();
QgsLinearlyInterpolatedDiagramRenderer( const QgsLinearlyInterpolatedDiagramRenderer &other );
virtual QgsLinearlyInterpolatedDiagramRenderer *clone() const /Factory/;
virtual QList<QgsDiagramSettings> diagramSettings() const;
%Docstring
Returns list with all diagram settings in the renderer
%End
void setDiagramSettings( const QgsDiagramSettings &s );
virtual QList<QString> diagramAttributes() const;
virtual QSet< QString > referencedFields( const QgsExpressionContext &context = QgsExpressionContext() ) const;
virtual QString rendererName() const;
void setLowerValue( double val );
double lowerValue() const;
void setUpperValue( double val );
double upperValue() const;
void setLowerSize( QSizeF s );
QSizeF lowerSize() const;
void setUpperSize( QSizeF s );
QSizeF upperSize() const;
QString classificationField() const;
%Docstring
Returns the field name used for interpolating the diagram size.
.. seealso:: :py:func:`setClassificationField`
%End
void setClassificationField( const QString &field );
%Docstring
Sets the field name used for interpolating the diagram size.
.. seealso:: :py:func:`classificationField`
%End
QString classificationAttributeExpression() const;
void setClassificationAttributeExpression( const QString &expression );
bool classificationAttributeIsExpression() const;
void setClassificationAttributeIsExpression( bool isExpression );
virtual void readXml( const QDomElement &elem, const QgsReadWriteContext &context );
virtual void writeXml( QDomElement &layerElem, QDomDocument &doc, const QgsReadWriteContext &context ) const;
virtual QList< QgsLayerTreeModelLegendNode * > legendItems( QgsLayerTreeLayer *nodeLayer ) const /Factory/;
void setDataDefinedSizeLegend( QgsDataDefinedSizeLegend *settings /Transfer/ );
%Docstring
Configures appearance of legend. Takes ownership of the passed settings
objects.
%End
QgsDataDefinedSizeLegend *dataDefinedSizeLegend() const;
%Docstring
Returns configuration of appearance of legend. Will return ``None`` if
no configuration has been set.
%End
protected:
virtual bool diagramSettings( const QgsFeature &feature, const QgsRenderContext &c, QgsDiagramSettings &s ) const;
virtual QSizeF diagramSize( const QgsFeature &, const QgsRenderContext &c ) const;
};
class QgsStackedDiagramRenderer : QgsDiagramRenderer
{
%Docstring(signature="appended")
Renders diagrams using mixed diagram render types. The size of the
rendered diagram is given by a combination of subrenderers.
.. versionadded:: 3.40
%End
%TypeHeaderCode
#include "qgsdiagramrenderer.h"
%End
public:
QgsStackedDiagramRenderer();
~QgsStackedDiagramRenderer();
QgsStackedDiagramRenderer( const QgsStackedDiagramRenderer &other );
virtual QgsStackedDiagramRenderer *clone() const /Factory/;
virtual QSizeF sizeMapUnits( const QgsFeature &feature, const QgsRenderContext &c ) const;
%Docstring
Returns size of the diagram for a feature in map units. Returns an
invalid QSizeF in case of error
%End
virtual void renderDiagram( const QgsFeature &feature, QgsRenderContext &c, QPointF pos, const QgsPropertyCollection &properties = QgsPropertyCollection() ) const;
%Docstring
Renders the diagram for a specified feature at a specific position in
the passed render context, taking all renderers and their own diagrams
into account. Diagram rendering is delegated to renderer's diagram.
%End
virtual QList<QgsDiagramSettings> diagramSettings() const;
%Docstring
Returns list with all diagram settings in the renderer
%End
void setDiagramSettings( const QgsDiagramSettings &s );
virtual QList<QString> diagramAttributes() const;
virtual QString rendererName() const;
virtual void readXml( const QDomElement &elem, const QgsReadWriteContext &context );
virtual void writeXml( QDomElement &layerElem, QDomDocument &doc, const QgsReadWriteContext &context ) const;
void _readXmlSubRenderers( const QDomElement &elem, const QgsReadWriteContext &context );
%Docstring
Reads stacked renderers state from a DOM element.
.. seealso:: _writeXmlSubRenderers
%End
void _writeXmlSubRenderers( QDomElement &rendererElem, QDomDocument &doc, const QgsReadWriteContext &context ) const;
%Docstring
Writes stacked renderers state to a DOM element.
.. seealso:: _readXmlSubRenderers
%End
virtual QList< QgsLayerTreeModelLegendNode * > legendItems( QgsLayerTreeLayer *nodeLayer ) const /Factory/;
QList< QgsDiagramRenderer * > renderers( bool sortByDiagramMode = false ) const;
%Docstring
Returns an ordered list with the renderers of the stacked renderer
object. Does not transfer ownership.
:param sortByDiagramMode: If true, the list is returned backwards for
vertical orientation.
%End
void addRenderer( QgsDiagramRenderer *renderer /Transfer/ );
%Docstring
Adds a renderer to the stacked renderer object. Takes ownership.
Renderers added first will render their diagrams first, i.e., more to
the left (horizontal mode) or more to the top (vertical mode).
:param renderer: diagram renderer to be added to the stacked renderer
%End
const QgsDiagramRenderer *renderer( const int index ) const;
%Docstring
Returns the renderer at the given ``index``. Does not transfer
ownership.
:param index: index of the desired renderer in the stacked renderer
%End
int rendererCount() const;
%Docstring
Returns the number of sub renderers in the stacked diagram renderer
%End
protected:
virtual bool diagramSettings( const QgsFeature &feature, const QgsRenderContext &c, QgsDiagramSettings &s ) const;
virtual QSizeF diagramSize( const QgsFeature &, const QgsRenderContext &c ) const;
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsdiagramrenderer.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
|