Skip To Content ArcGIS for Developers Sign In Dashboard

LabelDefinition 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: Object and JsonSerializable

Public Functions

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

Reimplemented Public Functions

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

Static Public Members

LabelDefinition *fromJson(const QString &json, QObject *parent = nullptr)
  • 10 static public members inherited from QObject

Additional Inherited Members

Detailed Description

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

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.

LabelDefinition::~LabelDefinition()

Destructor.

[static] 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.

[virtual] QString LabelDefinition::toJson() const

Reimplemented from JsonSerializable::toJson().

Returns this LabelDefinition instance represented as a JSON String.

See also JsonSerializable.

[virtual] QJsonObject LabelDefinition::unknownJson() const

Reimplemented from JsonSerializable::unknownJson().

Gets the unknown JSON of this object.

See also JsonSerializable.

[virtual] QJsonObject LabelDefinition::unsupportedJson() const

Reimplemented from JsonSerializable::unsupportedJson().

Gets the unsupported JSON of this object.

See also JsonSerializable.


Feedback on this topic?