Skip To Content ArcGIS for Developers Sign In Dashboard

ClassBreaksRenderer Class

(Esri::ArcGISRuntime::ClassBreaksRenderer)

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

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

Public Functions

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

Additional Inherited Members

Detailed Description

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

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 less than 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,000 and 100,000 people", 50001, 100000, new SimpleMarkerSymbol(SimpleMarkerSymbolStyle::Circle, QColor(Qt::green), 10, this), this);
ClassBreak* classBreak3 = new ClassBreak("Large cities", "Cities with between 100,000 and 500,000 people", 100001, 500000, new SimpleMarkerSymbol(SimpleMarkerSymbolStyle::Circle, QColor(Qt::blue), 15, this), this);
ClassBreak* classBreak4 = new ClassBreak("Very large cities", "Cities with more than 500,000 people", 500001, 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(QObject *parent = nullptr)

Default constructor with an optional parent.

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

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

ClassBreaksRenderer::~ClassBreaksRenderer()

Destructor.

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().

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.

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.

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.

RendererNormalizationType ClassBreaksRenderer::normalizationType() const

The normalization type for this class breaks renderer.

See also setNormalizationType.

void ClassBreaksRenderer::setBackgroundFillSymbol(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(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(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().


Feedback on this topic?