Skip To Content ArcGIS for Developers Sign In Dashboard

LabelDefinition Class

class Esri::ArcGISRuntime::LabelDefinition

Labeling information about a sublayer of a map service or feature service. More...

Header: #include <LabelDefinition>
Since: Esri::ArcGISRuntime 100.1
Inherits: Esri::ArcGISRuntime::Object and Esri::ArcGISRuntime::JsonSerializable

This class was introduced in Esri::ArcGISRuntime 100.1.

Public Functions

LabelDefinition(QObject *parent = nullptr)
virtual ~LabelDefinition() override

Reimplemented Public Functions

virtual QString toJson() const override
virtual QJsonObject unknownJson() const override
virtual QJsonObject unsupportedJson() const override

Static Public Members

Esri::ArcGISRuntime::LabelDefinition *fromJson(const QString &json, QObject *parent = nullptr)

Detailed Description

LabelDefinitions can only be created from JSON currently. The JSON required follows the ArcGIS REST API specification for the various labeling objects.

An example of JSON that can be used for setting a LabelDefinition is:

{
   "allowOverrun":false,
   "deconflictionStrategy":"static",
   "labelExpressionInfo":{
      "expression":"$feature.state_name"
   },
   "labelPlacement":"esriServerLinePlacementAboveAlong",
   "lineConnection":"minimizeLabels",
   "maxScale":0,
   "minScale":0,
   "multiPart":"labelPerPart",
   "priority":-1,
   "removeDuplicates":"none",
   "removeDuplicatesDistance":0,
   "repeatLabel":true,
   "repeatLabelDistance":216,
   "stackAlignment":"textSymbol",
   "stackBreakPosition":"after",
   "stackRowLength":-1,
   "symbol":{
      "angle":0,
      "backgroundColor":[0,0,0,0],
      "borderLineColor":[0,0,0,0],
      "borderLineSize":0,
      "color":[0,0,255,255],
      "font":{
       "size":11.25
      },
      "haloColor":[0,0,0,0],
      "haloSize":0,
      "kerning":false,
      "type":"esriTS",
      "xoffset":0,
      "yoffset":0
   },
   "useCodedValues":false
}

Member Function Documentation

LabelDefinition::LabelDefinition(QObject *parent = nullptr)

Constructor that creates an empty LabelDefinition.

  • parent - The parent object.

[override virtual] LabelDefinition::~LabelDefinition()

Destructor.

[static] Esri::ArcGISRuntime::LabelDefinition *LabelDefinition::fromJson(const QString &json, QObject *parent = nullptr)

Creates this LabelDefinition from its JSON representation.

Returns a LabelDefinition created using the data in the json parameter and an optional parent.

See also JsonSerializable.

[override virtual] QString LabelDefinition::toJson() const

Reimplements: JsonSerializable::toJson() const.

Returns this LabelDefinition instance represented as a JSON String.

See also JsonSerializable.

[override virtual] QJsonObject LabelDefinition::unknownJson() const

Reimplements: JsonSerializable::unknownJson() const.

Gets the unknown JSON of this object.

See also JsonSerializable.

[override virtual] QJsonObject LabelDefinition::unsupportedJson() const

Reimplements: JsonSerializable::unsupportedJson() const.

Gets the unsupported JSON of this object.

See also JsonSerializable.


Feedback on this topic?