ClassBreaksRenderer Class

  • ClassBreaksRenderer
  • class Esri::ArcGISRuntime::ClassBreaksRenderer

    A renderer that displays various symbols based on ranges of attribute values. More...

    Header: #include <ClassBreaksRenderer.h>
    Since: Esri::ArcGISRuntime 100.0
    Inherits: Esri::ArcGISRuntime::Renderer

    This class was introduced in Esri::ArcGISRuntime 100.0.

    Public Functions

    ClassBreaksRenderer(const QString &field, const QList<Esri::ArcGISRuntime::ClassBreak *> &classBreaks, QObject *parent = nullptr)
    ClassBreaksRenderer(QObject *parent = nullptr)
    virtual ~ClassBreaksRenderer() override
    Esri::ArcGISRuntime::Symbol *backgroundFillSymbol() const
    Esri::ArcGISRuntime::ClassBreakListModel *classBreaks() const
    Esri::ArcGISRuntime::RendererClassificationMethod classificationMethod() const
    QString defaultLabel() const
    Esri::ArcGISRuntime::Symbol *defaultSymbol() const
    QString fieldName() const
    double minValue() const
    QString normalizationField() const
    double normalizationTotal() const
    Esri::ArcGISRuntime::RendererNormalizationType normalizationType() const
    void setBackgroundFillSymbol(Esri::ArcGISRuntime::Symbol *backgroundFillSymbol)
    void setDefaultLabel(const QString &label)
    void setDefaultSymbol(Esri::ArcGISRuntime::Symbol *symbol)
    void setFieldName(const QString &fieldName)
    void setMinValue(double minValue)
    void setNormalizationField(const QString &field)
    void setNormalizationTotal(double total)
    void setNormalizationType(Esri::ArcGISRuntime::RendererNormalizationType type)

    Detailed Description

    A class breaks renderer symbolizes each graphic or feature based on the value of some numeric attribute. Graphics and features with similar values for the attribute get the same symbol. The "breaks" define the values at which the symbology changes.

    For example, suppose you have a "buildings" layer with an attribute that defines the building's age. You want to symbolize buildings constructed since the year 2000 in green, buildings constructed between 1980 and 2000 in yellow, and buildings built before 1980 with red. This would be a good scenario for class breaks renderer.

    Any value that is greater than or equal to the minimum and less than the maximum will be included in the break.

    Example:

    Apply a ClassBreaksRenderer to a point feature layer repesenting cities of different population sizes:

    // Create the class breaks for the different sized cities
    ClassBreak* classBreak1 = new ClassBreak("Small cities", "Cities with up to 50,000 people", 0, 50000, new SimpleMarkerSymbol(SimpleMarkerSymbolStyle::Circle, QColor(Qt::gray), 5, this), this);
    ClassBreak* classBreak2 = new ClassBreak("Moderate cities", "Cities with between 50,001 and 100,000 people", 50000, 100000, new SimpleMarkerSymbol(SimpleMarkerSymbolStyle::Circle, QColor(Qt::green), 10, this), this);
    ClassBreak* classBreak3 = new ClassBreak("Large cities", "Cities with between 100,001 and 500,000 people", 100000, 500000, new SimpleMarkerSymbol(SimpleMarkerSymbolStyle::Circle, QColor(Qt::blue), 15, this), this);
    ClassBreak* classBreak4 = new ClassBreak("Very large cities", "Cities with 500,001 or more people", 500000, 100000000, new SimpleMarkerSymbol(SimpleMarkerSymbolStyle::Circle, QColor(Qt::red), 20, this), this);
    
    // Add the class breaks to the renderer
    ClassBreaksRenderer* classBreaksRenderer = new ClassBreaksRenderer("Population", QList<ClassBreak*>() << classBreak1 << classBreak2 << classBreak3 << classBreak4, this);
    
    // Create a feature layer and apply the renderer to the layer
    ServiceFeatureTable* featureTable1 = new ServiceFeatureTable(serviceUrl, this);
    FeatureLayer* featureLayer1 = new FeatureLayer(featureTable1, this);
    featureLayer1->setRenderer(classBreaksRenderer);

    See also ClassBreakListModel and ClassBreak.

    Member Function Documentation

    ClassBreaksRenderer::ClassBreaksRenderer(const QString &field, const QList<Esri::ArcGISRuntime::ClassBreak *> &classBreaks, QObject *parent = nullptr)

    Constructor that takes a field and list of classBreaks, with an optional parent.

    ClassBreaksRenderer::ClassBreaksRenderer(QObject *parent = nullptr)

    Default constructor with an optional parent.

    [override virtual] ClassBreaksRenderer::~ClassBreaksRenderer()

    Destructor.

    Esri::ArcGISRuntime::Symbol *ClassBreaksRenderer::backgroundFillSymbol() const

    Returns the renderer's background fill symbol which should be of type SimpleFillSymbol.

    By default this symbol will be a nullptr. This symbol will only be applied if all of the following conditions apply:

    • The geometry being rendered is of type Polygon.
    • The polygon is symbolised using a ClassBreak with a point symbol at its centroid.

    This allows you to symbolise a polygon with a point for the class break but still show its full geometry. For example, a background fill symbol could be added to a ClassBreaksRenderer which shows population polygons with graduated circle symbols to indicate the number of residents. By setting the background symbol, you can show the population quantity as a point and still display the outline of the underlying polygon.

    This function was introduced in Esri::ArcGISRuntime 100.2.

    See also setBackgroundFillSymbol().

    Esri::ArcGISRuntime::ClassBreakListModel *ClassBreaksRenderer::classBreaks() const

    Returns a collection of class breaks for the renderer as a ClassBreakListModel.

    The ClassBreakListModel will contain a list model of all the class breaks defined in the renderer.

    Esri::ArcGISRuntime::RendererClassificationMethod ClassBreaksRenderer::classificationMethod() const

    The classification method that was used to generate class breaks.

    This function was introduced in Esri::ArcGISRuntime 100.2.

    QString ClassBreaksRenderer::defaultLabel() const

    Returns the default label.

    See also setDefaultLabel.

    Esri::ArcGISRuntime::Symbol *ClassBreaksRenderer::defaultSymbol() const

    Returns the default symbol.

    See also setDefaultSymbol.

    QString ClassBreaksRenderer::fieldName() const

    Returns the attribute field used by the renderer to match values.

    See also setFieldName().

    double ClassBreaksRenderer::minValue() const

    Returns the minimum value for this class breaks renderer.

    See also setMinValue().

    QString ClassBreaksRenderer::normalizationField() const

    Returns the normalization field for this class breaks renderer.

    See also setNormalizationField.

    double ClassBreaksRenderer::normalizationTotal() const

    Returns the normalization total for this class breaks renderer.

    See also setNormalizationTotal.

    Esri::ArcGISRuntime::RendererNormalizationType ClassBreaksRenderer::normalizationType() const

    The normalization type for this class breaks renderer.

    See also setNormalizationType.

    void ClassBreaksRenderer::setBackgroundFillSymbol(Esri::ArcGISRuntime::Symbol *backgroundFillSymbol)

    Sets the renderer's background fill symbol to backgroundFillSymbol.

    The symbol should be of type SimpleFillSymbol. This symbol will only be applied if all of the following conditions apply:

    • The geometry being rendered is of type Polygon.
    • The polygon is symbolised using a ClassBreak with a point symbol at its centroid.

    This function was introduced in Esri::ArcGISRuntime 100.2.

    See also backgroundFillSymbol.

    void ClassBreaksRenderer::setDefaultLabel(const QString &label)

    Sets the default label.

    The default label is used if the graphic or feature's attribute value does not fall into any of the class breaks.

    See also defaultLabel().

    void ClassBreaksRenderer::setDefaultSymbol(Esri::ArcGISRuntime::Symbol *symbol)

    Sets the default symbol.

    The default symbol is used if the graphic or feature's attribute value does not fall into any of the class breaks.

    See also defaultSymbol().

    void ClassBreaksRenderer::setFieldName(const QString &fieldName)

    Sets the attribute fieldName used by the renderer to match values.

    See also fieldName().

    void ClassBreaksRenderer::setMinValue(double minValue)

    Sets the minValue for this class breaks renderer.

    See also minValue().

    void ClassBreaksRenderer::setNormalizationField(const QString &field)

    Sets the normalization field for this class breaks renderer.

    The normalizationField is applicable when the normalizationType is by field, as opposed to percent of total or log. The data will be normalized by the value contained in the specified field.

    See also normalizationField() and normalizationType.

    void ClassBreaksRenderer::setNormalizationTotal(double total)

    Sets the normalization total for this class breaks renderer.

    The normalizationTotal is applicable when the normalizationType is percent of total, as opposed to by field or log. Use normalizationTotal to obtain or set the total value.

    See also normalizationTotal() and normalizationType.

    void ClassBreaksRenderer::setNormalizationType(Esri::ArcGISRuntime::RendererNormalizationType type)

    The normalization type for this class breaks renderer.

    Set the normalizationType to normalize the data instead of using the raw attribute value.

    For example, consider a "cities" layer that contained a total crimes attribute. If you did not normalize the data, the map would symbolize the cities with the highest amount of crimes. However, this could be misleading, as the cities with a higher population would likely have more crimes, simply due to the having more people. You could instead normalize the data by a field called population, so you could visualizes the amount of crimes per person.

    The normalizationType is used to determine how the data is normalized. When normalization type is by field, use the normalizationField to determine or set the field used to normalize the data. When normalization type is percent of total, use normalizationTotal to determine or set the total value.

    See also normalizationType().

    Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.