Symbol Class
Base type for symbols used to display a graphic or a feature. More...
Header: | #include <Symbol.h> |
Since: | Esri::ArcGISRuntime 100.0 |
Inherits: | Esri::ArcGISRuntime::Object and Esri::ArcGISRuntime::JsonSerializable |
Inherited By: | Esri::ArcGISRuntime::CompositeSymbol, Esri::ArcGISRuntime::DistanceCompositeSceneSymbol, Esri::ArcGISRuntime::FillSymbol, Esri::ArcGISRuntime::LineSymbol, Esri::ArcGISRuntime::MarkerSceneSymbol, Esri::ArcGISRuntime::MarkerSymbol, and Esri::ArcGISRuntime::MultilayerSymbol |
Public Functions
virtual | ~Symbol() override |
Esri::ArcGISRuntime::Symbol * | clone(QObject *parent = nullptr) const |
Esri::ArcGISRuntime::TaskWatcher | createSwatch(const Esri::ArcGISRuntime::Geometry &geometry, float width, float height, const QColor &backgroundColor = QColor()) |
Esri::ArcGISRuntime::TaskWatcher | createSwatch(const Esri::ArcGISRuntime::Geometry &geometry, float width, float height, float screenScale, const QColor &backgroundColor = QColor()) |
Esri::ArcGISRuntime::TaskWatcher | createSwatch(float width, float height, float screenScale, const QColor &backgroundColor = QColor()) |
Esri::ArcGISRuntime::TaskWatcher | createSwatch(const QColor &backgroundColor = QColor()) |
Esri::ArcGISRuntime::TaskWatcher | createSwatch(float screenScale, const QColor &backgroundColor = QColor()) |
QFuture<QImage> | createSwatchAsync(const Esri::ArcGISRuntime::Geometry &geometry, float width, float height, const QColor &backgroundColor = QColor()) |
QFuture<QImage> | createSwatchAsync(const Esri::ArcGISRuntime::Geometry &geometry, float width, float height, float screenScale, const QColor &backgroundColor = QColor()) |
QFuture<QImage> | createSwatchAsync(float width, float height, float screenScale, const QColor &backgroundColor = QColor()) |
QFuture<QImage> | createSwatchAsync(const QColor &backgroundColor = QColor()) |
QFuture<QImage> | createSwatchAsync(float screenScale, const QColor &backgroundColor = QColor()) |
Esri::ArcGISRuntime::SymbolType | symbolType() const |
bool | operator!=(const Esri::ArcGISRuntime::Symbol *other) const |
bool | operator==(const Esri::ArcGISRuntime::Symbol *other) const |
Reimplemented Public Functions
virtual QString | toJson() const override |
virtual QJsonObject | unknownJson() const override |
virtual QJsonObject | unsupportedJson() const override |
Signals
void | createSwatchCompleted(const QUuid &taskId, const QImage &image) |
Static Public Members
Esri::ArcGISRuntime::Symbol * | fromJson(const QString &json, QObject *parent = nullptr) |
Protected Functions
Symbol(QObject *parent = nullptr) |
Detailed Description
Symbols describe how graphics and features look on the map. Different symbols are used with different geometry types: marker symbols for point and multipoint geometries, fill symbols for polygon geometries, and line symbols for polyline geometries. Other types of 2D and 3D symbols inherit from Symbol and its subtypes to implement capabilities such as composite and dynamic symbols.
A symbol defines display properties for features and graphics (collectively referred to as geoelements). A geoelement has a geometry (location and shape), and optional descriptive information. For features and graphics to appear on a map, they must be assigned a symbol.
There are two models for defining symbols in your map: simple and advanced (multilayer). In general, simple symbols are single-layer symbols that provide basic representations, such as marker, line, fill, text, or picture. Advanced symbols are composed of one or several layers that can be defined individually and combined to create complex representations. Both of these are more fully described as follows:
- Simple symbols follow the web map specification and you work with them through the simple symbol classes. These are also the symbols you get from web maps or from feature services when advanced symbology is turned off. Simple symbols can be created for points (marker symbols), lines (line symbols), and polygons (fill symbols). Each of the simple symbol types provides an enumeration of pre-defined styles that can be applied to the symbol.
- Advanced symbols, accessed through multilayer symbol classes, follow the ArcGIS Pro symbol model. These symbols come from feature services (that use advanced symbology), mobile style files, the dictionary renderer, and mobile map packages. You can also build your own advanced symbols for points, lines, and polygons.
Simple symbology is the symbology of the web map. When authoring maps in ArcGIS Pro as web maps, your multilayer symbols will be converted to simple symbols. In general, point symbols are converted to picture marker symbols optimized for the web, and line and polygon symbols are simplified while representing the original symbol as closely as possible. If you're authoring a feature service from ArcGIS Pro or ArcGIS Desktop, however, both the original symbols and the simplified symbols are stored. This allows clients that support advanced symbols to render the features as originally symbolized, while those that do not support advanced symbols (such as ArcGIS Online Map Viewer) can use the simple symbols for display. Having both sets of symbols allows you to retain the advanced symbology where available and still share the feature service as widely as possible.
If your app works primarily with web maps that you want to look the same throughout the platform, your app should use the simple symbols API. Otherwise, make sure your users understand that advanced symbols render slightly differently on clients that don't support advanced symbology.
If your maps are used only with this API and ArcGIS Pro, you can use advanced symbols exclusively. When rendered by this API, advanced symbols are vectorized. This allows them to scale better on devices with high resolution screens.
You can set LoadSettings::setUseAdvancedSymbology to control whether the map uses advanced symbols (when available) or always renders with simple symbols.
Member Function Documentation
[explicit protected]
Symbol::Symbol(QObject *parent = nullptr)
Default constructor with an optional parent.
[override virtual]
Symbol::~Symbol()
Destructor.
[since Esri::ArcGISRuntime 200.1]
Esri::ArcGISRuntime::Symbol *Symbol::clone(QObject *parent = nullptr) const
Clones the Symbol to a new instance.
- parent - The optional parent QObject.
Returns a new instance of the current Symbol.
This function was introduced in Esri::ArcGISRuntime 200.1.
Esri::ArcGISRuntime::TaskWatcher Symbol::createSwatch (const Esri::ArcGISRuntime::Geometry &geometry, float width, float height, const QColor &backgroundColor = QColor())
Creates a swatch image using the provided geometry, width, height, and optional backgroundColor.
The background color defaults to transparent when the backgroundColor is not provided. The width, height, and geometry coordinate values are measured in device independent pixels (DIPs). This operation will determine the primary screen scale factor for scaling the image size.
Emits the createSwatchCompleted(QUuid, QImage) signal when the swatch image operation completes.
Note: The specified geometry is in DIPs, with the point {0,0} located at the centerpoint of the swatch image. The x-axis increases towards the right-hand side of the swatch image. The y-axis increases towards the top of the swatch image. For example, when creating a swatch for a MarkerSymbol, specifying a geometry of {10,10} will draw the marker 10 DIPs up and to the right of the center of the swatch. The geometry type should correspond to the symbol type. The geometry's spatial reference is ignored.
Esri::ArcGISRuntime::TaskWatcher Symbol::createSwatch (const Esri::ArcGISRuntime::Geometry &geometry, float width, float height, float screenScale , const QColor &backgroundColor = QColor())
Creates a swatch image using the provided geometry, width, height, screenScale, and optional backgroundColor.
The background color defaults to transparent when the backgroundColor is not provided. The width, height, and geometry coordinate values are measured in device independent pixels (DIPs). This operation will use the provided screenScale parameter to scale the image size.
Emits the createSwatchCompleted(QUuid, QImage) signal when the swatch image operation completes.
Note: The specified geometry is in DIPs, with the point {0,0} located at the centerpoint of the swatch image. The x-axis increases towards the right-hand side of the swatch image. The y-axis increases towards the top of the swatch image. for example, when creating a swatch for a MarkerSymbol, specifying a geometry of {10,10} will draw the marker 10 DIPs up and to the right of the center of the swatch. The geometry type should correspond to the symbol type. The geometry's spatial reference is ignored.
[since Esri::ArcGISRuntime 100.3]
Esri::ArcGISRuntime::TaskWatcher Symbol::createSwatch (float width, float height, float screenScale , const QColor &backgroundColor = QColor())
Creates a swatch image using the provided width, height, screenScale, and optional backgroundColor.
The background color defaults to transparent when the backgroundColor is not provided. The width, and height are measured in device independent pixels (DIPs). This operation will use the provided screenScale parameter to scale the image size.
Emits the createSwatchCompleted(QUuid, QImage) signal when the swatch image operation completes.
This function was introduced in Esri::ArcGISRuntime 100.3.
Esri::ArcGISRuntime::TaskWatcher Symbol::createSwatch (const QColor &backgroundColor = QColor())
Creates a swatch image using the optional backgroundColor.
The background color defaults to transparent when the backgroundColor is not provided. This operation will determine the primary screen scale factor for scaling the image size.
Emits the createSwatchCompleted(QUuid, QImage) signal when the swatch image operation completes.
Esri::ArcGISRuntime::TaskWatcher Symbol::createSwatch (float screenScale , const QColor &backgroundColor = QColor())
Creates a swatch image using the provided screenScale, and optional backgroundColor.
The background color defaults to transparent when the backgroundColor is not provided. This operation will use the provided screenScale parameter to scale the image size.
Emits the createSwatchCompleted(QUuid, QImage) signal when the swatch image operation completes.
QFuture<QImage> Symbol::createSwatchAsync (const Esri::ArcGISRuntime::Geometry &geometry, float width, float height, const QColor &backgroundColor = QColor())
Creates a swatch image using the provided geometry, width, height, and optional backgroundColor.
The background color defaults to transparent when the backgroundColor is not provided. The width, height, and geometry coordinate values are measured in device independent pixels (DIPs). This operation will determine the primary screen scale factor for scaling the image size.
Note: The specified geometry is in DIPs, with the point {0,0} located at the centerpoint of the swatch image. The x-axis increases towards the right-hand side of the swatch image. The y-axis increases towards the top of the swatch image. For example, when creating a swatch for a MarkerSymbol, specifying a geometry of {10,10} will draw the marker 10 DIPs up and to the right of the center of the swatch. The geometry type should correspond to the symbol type. The geometry's spatial reference is ignored.
This method returns a QFuture for the asynchronous operation. Use future.then() to continue processing when the operation completes. Use future.onFailed() to handle exceptions of type ErrorException.
See Working with QFuture for further details.
since Esri::ArcGISRuntime 200.2
QFuture<QImage> Symbol::createSwatchAsync (const Esri::ArcGISRuntime::Geometry &geometry, float width, float height, float screenScale , const QColor &backgroundColor = QColor())
Creates a swatch image using the provided geometry, width, height, screenScale, and optional backgroundColor.
The background color defaults to transparent when the backgroundColor is not provided. The width, height, and geometry coordinate values are measured in device independent pixels (DIPs). This operation will use the provided screenScale parameter to scale the image size.
Note: The specified geometry is in DIPs, with the point {0,0} located at the centerpoint of the swatch image. The x-axis increases towards the right-hand side of the swatch image. The y-axis increases towards the top of the swatch image. for example, when creating a swatch for a MarkerSymbol, specifying a geometry of {10,10} will draw the marker 10 DIPs up and to the right of the center of the swatch. The geometry type should correspond to the symbol type. The geometry's spatial reference is ignored.
This method returns a QFuture for the asynchronous operation. Use future.then() to continue processing when the operation completes. Use future.onFailed() to handle exceptions of type ErrorException.
See Working with QFuture for further details.
since Esri::ArcGISRuntime 200.2
[since Esri::ArcGISRuntime 200.2]
QFuture<QImage> Symbol::createSwatchAsync (float width, float height, float screenScale , const QColor &backgroundColor = QColor())
Creates a swatch image using the provided width, height, screenScale, and optional backgroundColor.
The background color defaults to transparent when the backgroundColor is not provided. The width, and height are measured in device independent pixels (DIPs). This operation will use the provided screenScale parameter to scale the image size.
This method returns a QFuture for the asynchronous operation. Use future.then() to continue processing when the operation completes. Use future.onFailed() to handle exceptions of type ErrorException.
See Working with QFuture for further details.
This function was introduced in Esri::ArcGISRuntime 200.2.
QFuture<QImage> Symbol::createSwatchAsync (const QColor &backgroundColor = QColor())
Creates a swatch image using the optional backgroundColor.
The background color defaults to transparent when the backgroundColor is not provided. This operation will determine the primary screen scale factor for scaling the image size.
This method returns a QFuture for the asynchronous operation. Use future.then() to continue processing when the operation completes. Use future.onFailed() to handle exceptions of type ErrorException.
See Working with QFuture for further details.
since Esri::ArcGISRuntime 200.2
QFuture<QImage> Symbol::createSwatchAsync (float screenScale , const QColor &backgroundColor = QColor())
Returns a swatch of the symbol.
- backgroundColor - The background color of the swatch. Can be
nullptr
, in which case a transparent background is used. - screenScale - The number of pixels per DIP (sometimes referred to as screen density or device pixel ratio).
This method returns a QFuture for the asynchronous operation. Use future.then() to continue processing when the operation completes. Use future.onFailed() to handle exceptions of type ErrorException.
See Working with QFuture for further details.
since Esri::ArcGISRuntime 200.2
[signal]
void Symbol::createSwatchCompleted (const QUuid &taskId , const QImage &image)
Emitted when create swatch image operation completes successfully.
- taskId - The ID of the create swatch task.
- image - The swatch image.
[static]
Esri::ArcGISRuntime::Symbol *Symbol::fromJson (const QString &json, QObject *parent = nullptr)
Creates and returns a new Symbol from the provided json, with an optional parent.
Sizes of symbols in JSON are represented in points (not pixels).
Symbol layers in a multilayer symbol are in reverse order of how they appear in the JSON representation.
For Symbols of type MarkerSymbol, an angle set from JSON will be inverted (e.g. an angle of 20 will become -20).
See also JsonSerializable.
Esri::ArcGISRuntime::SymbolType Symbol::symbolType () const
Returns the symbol type.
[override virtual]
QString Symbol::toJson () const
Reimplements: JsonSerializable::toJson() const.
Returns this Symbol as a JSON representation.
Sizes of symbols in JSON are represented in points (not pixels).
Symbol layers in a multilayer symbol are in reverse order of how they appear in the JSON representation.
See also JsonSerializable.
[override virtual]
QJsonObject Symbol::unknownJson () const
Reimplements: JsonSerializable::unknownJson() const.
Gets the unknown JSON of this object.
See also JsonSerializable.
[override virtual]
QJsonObject Symbol::unsupportedJson () const
Reimplements: JsonSerializable::unsupportedJson() const.
Gets the unsupported JSON of this object.
See also JsonSerializable.
[since Esri::ArcGISRuntime 200.2]
bool Symbol::operator!=(const Esri::ArcGISRuntime::Symbol *other) const
Inequality operator. Returns true
if this object and other are not equal.
This function was introduced in Esri::ArcGISRuntime 200.2.
See also Symbol::operator==.
bool Symbol::operator==(const Esri::ArcGISRuntime::Symbol *other) const
Equivalency operator.
Returns whether this object and other are equal.