SymbolStyle Class

  • SymbolStyle
  • class Esri::ArcGISRuntime::SymbolStyle

    A symbol style object. More...

    Header: #include <SymbolStyle.h>
    Since: Esri::ArcGISRuntime 100.10
    Inherits: Esri::ArcGISRuntime::Object, Esri::ArcGISRuntime::Loadable, and Esri::ArcGISRuntime::RemoteResource
    Inherited By:

    Esri::ArcGISRuntime::DictionarySymbolStyle

    Public Functions

    SymbolStyle(const QString &styleLocation, QObject *parent = nullptr)
    SymbolStyle(Esri::ArcGISRuntime::PortalItem *portalItem, QObject *parent = nullptr)
    SymbolStyle(Esri::ArcGISRuntime::PortalItem *portalItem, Esri::ArcGISRuntime::Credential *credential, QObject *parent = nullptr)
    SymbolStyle(const QString &styleName, Esri::ArcGISRuntime::Portal *portal, QObject *parent = nullptr)
    virtual ~SymbolStyle() override
    QFuture<Esri::ArcGISRuntime::SymbolStyleSearchParameters> defaultSearchParametersAsync()
    QFuture<Esri::ArcGISRuntime::Symbol *> fetchSymbolAsync(const QStringList &keys, QObject *parent = nullptr)
    Esri::ArcGISRuntime::Portal *portal() const
    Esri::ArcGISRuntime::PortalItem *portalItem() const
    QFuture<Esri::ArcGISRuntime::SymbolStyleSearchResultListModel *> searchSymbolsAsync(const Esri::ArcGISRuntime::SymbolStyleSearchParameters &searchParameters, QObject *parent = nullptr)
    QString styleLocation() const
    QString styleName() const
    Esri::ArcGISRuntime::SymbolStyleType symbolStyleType() const

    Reimplemented Public Functions

    virtual void cancelLoad() override
    virtual Esri::ArcGISRuntime::Credential *credential() const override
    virtual void load() override
    virtual Esri::ArcGISRuntime::Error loadError() const override
    virtual Esri::ArcGISRuntime::LoadStatus loadStatus() const override
    virtual Esri::ArcGISRuntime::RequestConfiguration requestConfiguration() const override
    virtual void retryLoad() override
    virtual void setRequestConfiguration(const Esri::ArcGISRuntime::RequestConfiguration &requestConfiguration) override
    virtual QUrl url() const override

    Signals

    void doneLoading(const Esri::ArcGISRuntime::Error &loadError)
    void loadStatusChanged(Esri::ArcGISRuntime::LoadStatus loadStatus)

    Static Public Members

    Esri::ArcGISRuntime::SymbolStyle *createSymbolStyleFromUrl(const QUrl &webStyleUrl, QObject *parent = nullptr)

    Detailed Description

    A SymbolStyle is created either from a style file on disk (an SQLite database with a .stylx extension, created with ArcGIS Pro) or from a style file hosted on ArcGIS Online or an ArcGIS Enterprise portal (also referred to as a web style).

    When used by itself, the symbol style supports two key workflows. One is to return a symbol based on a provided set of key values. Since each symbol in the style has a key that uniquely identifies it, you can pass an array of keys into fetchSymbol to return a new Symbol built from the individual symbols represented by those keys. You might use this symbol to create a new Graphic.

    The other common workflow is to use a standalone symbol style to search for symbol primitives. Symbol primitives are the individual symbols that compose more complex symbols. This is achieved using searchSymbolsAsync. You could create a symbol picker app, for example, that searches for all symbols in the style that have the tag "maritime" in it. The search results contain symbols that you could use directly. You could also extract their individual symbol components to create a new multilayer symbol.

    See also DictionarySymbolStyle.

    Member Function Documentation

    [explicit] SymbolStyle::SymbolStyle(const QString &styleLocation, QObject *parent = nullptr)

    Creates a new Symbol style object.

    • styleLocation - Path to the local .stylx file on disk to which a connection will be established.
    • parent - The optional parent QObject.

    An example of stylx file is mil2525d.stylx. .stylx file keeps collection of symbols as JSON with a unique key associated to them. You can provide the list of the keys as attributes to retrieve a composed symbol.

    [explicit, since Esri::ArcGISRuntime 100.10] SymbolStyle::SymbolStyle(Esri::ArcGISRuntime::PortalItem *portalItem, QObject *parent = nullptr)

    Creates a new symbol style object from a portal item. The portal item must contain a style.

    • portalItem - A PortalItem that contains a web style.
    • parent - The optional parent QObject.

    If you have the item id of a style file, you can search the portal to find the item using its item id. Use this constructor if you have a reference to a portal item.

    This function was introduced in Esri::ArcGISRuntime 100.10.

    [since Esri::ArcGISRuntime 100.13] SymbolStyle::SymbolStyle(Esri::ArcGISRuntime::PortalItem *portalItem, Esri::ArcGISRuntime::Credential *credential, QObject *parent = nullptr)

    Creates a new symbol style object from a portal item. The portal item must contain a style.

    • portalItem - A PortalItem that contains a web style.
    • credential - The credential used to access the remote resource.
    • parent - The optional parent QObject.

    If you have the item id of a style file, you can search the portal to find the item using its item id. Use this constructor if you have a reference to a portal item.

    This function was introduced in Esri::ArcGISRuntime 100.13.

    [since Esri::ArcGISRuntime 100.10] SymbolStyle::SymbolStyle(const QString &styleName, Esri::ArcGISRuntime::Portal *portal, QObject *parent = nullptr)

    Creates a new symbol style object using the registered style name of the Esri web style on the portal.

    • styleName - The registered Esri symbol style name. The styleName cannot be a custom web style name.
    • portal - A Portal hosting the Esri web style. If nullptr is passed, ArcGIS online is used as the default portal.
    • parent - The optional parent QObject.

    Esri provides a set of web symbol styles "out of the box" for localized use with ArcGIS Online and Enterprise. Users can use this constructor only if you are creating a symbol style using the Esri web style's unique name on your portal or arcgis.com. If nullptr is passed for portal parameter, ArcGIS online is used as the default portal. An overview of esri web styles and symbols currently in production is available for 3D and 2D. Tip: Click on the symbol icon to find its associated style name. Esri registered style names can also be found in the json of symbol web style. As an example see item json for EsriThematicShapesStyle hosted on ArcGIS Online.

    This function was introduced in Esri::ArcGISRuntime 100.10.

    [override virtual] SymbolStyle::~SymbolStyle()

    Destructor.

    [override virtual] void SymbolStyle::cancelLoad()

    Reimplements: Loadable::cancelLoad().

    See Loadable.

    [static, since Esri::ArcGISRuntime 100.10] Esri::ArcGISRuntime::SymbolStyle *SymbolStyle::createSymbolStyleFromUrl(const QUrl &webStyleUrl, QObject *parent = nullptr)

    Returns a new symbol style object using web style item URL.

    • webStyleUrl - The URL of the web style item.
    • parent - The optional parent QObject.

    A symbol style using style item's URL. For example, https://www.arcgis.com/home/item.html?id=bf27400d167d4c2e8e12c8a46f87afe4 is the URL of the "Basic Shapes" style on ArcGIS Online.".

    This function was introduced in Esri::ArcGISRuntime 100.10.

    [override virtual, since Esri::ArcGISRuntime 100.13] Esri::ArcGISRuntime::Credential *SymbolStyle::credential() const

    Reimplements: RemoteResource::credential() const.

    Returns security credentials to access the remote resource.

    Only applicable if the resource is secured.

    This function was introduced in Esri::ArcGISRuntime 100.13.

    [since Esri::ArcGISRuntime 200.2] QFuture<Esri::ArcGISRuntime::SymbolStyleSearchParameters> SymbolStyle::defaultSearchParametersAsync()

    Returns a Symbol Style Search Parameters object providing all available search parameters from the database. This asynchronous task retrieves all the valid input search parameters for a style. This means you get all of the possible input values for categories, keys, names, symbolClasses, and tags. This is an expensive task that should be used sparingly.

    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.

    [signal] void SymbolStyle::doneLoading(const Esri::ArcGISRuntime::Error &loadError)

    Signal emitted when this object is done loading.

    • loadError - Details about any error that may have occurred.

    Note: If there is a load error it will also be emitted on the errorOccurred signal.

    See also Loadable and Object.

    [since Esri::ArcGISRuntime 200.2] QFuture<Esri::ArcGISRuntime::Symbol *> SymbolStyle::fetchSymbolAsync(const QStringList &keys, QObject *parent = nullptr)

    Asynchronously returns a symbol based on the provided list of keys.

    • keys - QStringList type value. It is the list of keys required to obtain a symbol from the style.
    • parent - An optional parent.

    This function is useful for obtaining a single, multi-layer symbol from supplied keys. This is commonly used to create symbols and graphics on-the-fly. For example, assume XYZ style has a symbol with key "abc" which is the central symbol and another symbol with key "pqr", which could be the modifier/echelon placed at some offset from central geometry. So if you provide these two keys as attributes then symbol style will find and assemble a symbol accordingly. Once you have that symbol, you can apply it to a Graphic or Renderer, obtain its swatch image, or serialize to JSON. If the Symbol style is not loaded then starting this task will start the load cycle. 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.

    [override virtual] void SymbolStyle::load()

    Reimplements: Loadable::load().

    See Loadable.

    [override virtual] Esri::ArcGISRuntime::Error SymbolStyle::loadError() const

    Reimplements: Loadable::loadError() const.

    See Loadable.

    [override virtual] Esri::ArcGISRuntime::LoadStatus SymbolStyle::loadStatus() const

    Reimplements: Loadable::loadStatus() const.

    See Loadable.

    [signal] void SymbolStyle::loadStatusChanged(Esri::ArcGISRuntime::LoadStatus loadStatus)

    Signal emitted when the load status changes for this object.

    See also Loadable.

    [since Esri::ArcGISRuntime 100.10] Esri::ArcGISRuntime::Portal *SymbolStyle::portal() const

    Returns the portal that hosts the web style identified with styleName. This will be nullptr if the style was identified with a PortalItem, URL, or a local .stylx file on disk.

    This function was introduced in Esri::ArcGISRuntime 100.10.

    [since Esri::ArcGISRuntime 100.10] Esri::ArcGISRuntime::PortalItem *SymbolStyle::portalItem() const

    Returns the portal item representing the web style.

    The PortalItem will be set when SymbolStyle is created using SymbolStyle or createSymbolStyleFromUrl.

    This will be nullptr if the style was created using SymbolStyle or is identified with a local .stylx file on disk.

    This function was introduced in Esri::ArcGISRuntime 100.10.

    [override virtual, since Esri::ArcGISRuntime 100.13] Esri::ArcGISRuntime::RequestConfiguration SymbolStyle::requestConfiguration() const

    Reimplements: RemoteResource::requestConfiguration() const.

    Returns the RequestConfiguration used to customize the request to this RemoteResource.

    This function was introduced in Esri::ArcGISRuntime 100.13.

    See also setRequestConfiguration().

    [override virtual] void SymbolStyle::retryLoad()

    Reimplements: Loadable::retryLoad().

    Loads or retries loading metadata for the object asynchronously.

    Will retry loading the metadata if the object is failed to load. Will load the object if it is not loaded. Will not retry to load the object if the object is loaded. Will always call the done loading if this is called.

    [since Esri::ArcGISRuntime 200.2] QFuture<Esri::ArcGISRuntime::SymbolStyleSearchResultListModel *> SymbolStyle::searchSymbolsAsync(const Esri::ArcGISRuntime::SymbolStyleSearchParameters &searchParameters, QObject *parent = nullptr)

    Returns a SymbolStyleSearchResultListModel containing the search results.

    This asynchronous task searches for symbol primitives in the symbol style. The input searchParameters define what is searched for. For example, you could search for all symbols that have the tag "airspace". You can also set the match to be strict or not, which will determine if the search uses "=" or "LIKE" for each parameter.

    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.

    [override virtual, since Esri::ArcGISRuntime 100.13] void SymbolStyle::setRequestConfiguration(const Esri::ArcGISRuntime::RequestConfiguration &requestConfiguration)

    Reimplements: RemoteResource::setRequestConfiguration(const Esri::ArcGISRuntime::RequestConfiguration &requestConfiguration).

    Sets the RequestConfiguration, which is used to customize the request to this RemoteResource, to requestConfiguration.

    This function was introduced in Esri::ArcGISRuntime 100.13.

    See also requestConfiguration().

    QString SymbolStyle::styleLocation() const

    Returns the path of the style (*.stylx) file.

    [since Esri::ArcGISRuntime 100.10] QString SymbolStyle::styleName() const

    Returns the name of the web style. This will be empty if the style was identified with a URL, or a PortalItem, or a local .stylx file on disk.

    This function was introduced in Esri::ArcGISRuntime 100.10.

    Esri::ArcGISRuntime::SymbolStyleType SymbolStyle::symbolStyleType() const

    Gets the type of Symbol Style this object is.

    [override virtual, since Esri::ArcGISRuntime 100.10] QUrl SymbolStyle::url() const

    Reimplements: RemoteResource::url() const.

    Returns the URL of the web style.

    This will be empty if the style was identified with a PortalItem, style name, or a local .stylx file on disk.

    This function was introduced in Esri::ArcGISRuntime 100.10.

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