ArcGIS Runtime SDK for iOS: AGSSymbol Class Reference
ArcGIS Runtime SDK for iOS  100.15
AGSSymbol Class Reference

Description

A symbol used to display a graphic or a feature.

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.

ArcGIS Runtime uses two models for defining symbols in your map: simple and advanced (multilayer). In general, simple symbols are single-layer symbols that provide basic symbols, 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; you work with them through the simple symbol classes in the API. 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 ArcGIS Runtime and ArcGIS Pro, you can use advanced symbols exclusively. Advanced symbols are vectorized in ArcGIS Runtime clients, thereby scaling better on devices with high resolution screens.

You can set AGSLoadSettings::useAdvancedSymbology to control whether the map uses advanced symbols (when available) or always renders with simple symbols.

Since
100
Inheritance diagram for AGSSymbol:
AGSObject <AGSJSONSerializable> AGSCompositeSymbol AGSDistanceCompositeSceneSymbol AGSFillSymbol AGSLineSymbol AGSMarkerSceneSymbol AGSMarkerSymbol AGSMultilayerSymbol AGSUnsupportedSymbol

Instance Methods

(id< AGSCancelable >) - createSwatchWithBackgroundColor:screen:completion:
 
(id< AGSCancelable >) - createSwatchWithCompletion:
 
(id< AGSCancelable >) - createSwatchWithGeometry:width:height:screen:backgroundColor:completion:
 
(nullable id< AGSCancelable >) - createSwatchWithWidth:height:screen:backgroundColor:completion:
 
(BOOL) - isEqualToSymbol:
 
(nullable id) - toJSON:
 

Class Methods

(nullable id< AGSJSONSerializable >) + fromJSON:error:
 

Properties

NSDictionary< NSString *, id > * unknownJSON
 
NSDictionary< NSString *, id > * unsupportedJSON
 

Method Documentation

◆ createSwatchWithBackgroundColor:screen:completion:

- (id<AGSCancelable>) createSwatchWithBackgroundColor: (nullable AGSColor *)  backgroundColor
screen: (nullable AGSScreen *)  screen
completion: (void(^)(AGSImage *__nullable swatch, NSError *__nullable error))  completion 

Creates swatch with provided background color.

Parameters
backgroundColorDesired background color of the image.
screenScreen that the swatch will be rendered for. If you specify nil then the main screen will be used.
completionA block that is invoked when the operation completes.
Since
100

◆ createSwatchWithCompletion:

- (id<AGSCancelable>) createSwatchWithCompletion: (void(^)(AGSImage *__nullable swatch, NSError *__nullable error))  completion

Creates a swatch with a clear background color. This method uses main screen's scale to determine the size of the image.

Parameters
completionblock that is invoked when operation completes.
Since
100

◆ createSwatchWithGeometry:width:height:screen:backgroundColor:completion:

- (id<AGSCancelable>) createSwatchWithGeometry: (AGSGeometry *)  geometry
width: (NSInteger)  width
height: (NSInteger)  height
screen: (nullable AGSScreen *)  screen
backgroundColor: (nullable AGSColor *)  backgroundColor
completion: (void(^)(AGSImage *__nullable swatch, NSError *__nullable error))  completion 

Creates a swatch using the provided geometry and other parameters. This is the most configurable of the methods to create swatches. You can pass the pixels per inch that you would like the image to be rendered at. This will determine how many pixels are used to render symbols of sizes that are specified in points.

Parameters
geometryThe geometry of the symbol to be drawn in the swatch image. The specified geometry is in DIPs, with the point {0,0} located at the center of the swatch image. The X-axis increases towards the right side of the swatch image. The Y-axis increases towards the top of the swatch image. For example: when creating a swatch for an AGSMarkerSymbol, 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 (AGSPoint, AGSPolyline, AGSPolygon) should correspond to the symbol type (AGSMarkerSymbol, AGSLineSymbol, AGSFillSymbol). The geometry's spatial reference is ignored.
widthDesired width of the image in pixels.
heightDesired height of the image in pixels.
screenThe screen that the swatch will be rendered for. If you specify nil then the main screen will be used.
backgroundColorThe desired background color of the image.
completionA block that is invoked when operation completes.
Since
100

◆ createSwatchWithWidth:height:screen:backgroundColor:completion:

- (nullable id<AGSCancelable>) createSwatchWithWidth: (NSInteger)  width
height: (NSInteger)  height
screen: (nullable AGSScreen *)  screen
backgroundColor: (nullable AGSColor *)  backgroundColor
completion: (void(^)(AGSImage *__nullable swatch, NSError *__nullable error))  completion 

◆ fromJSON:error:

+ (nullable id<AGSJSONSerializable>) fromJSON: (id)  JSONObject
error: (NSError **)  error 
staticrequiredinherited

Initializes and returns an object from its JSON representation.

Parameters
JSONObjectNSDictionary or NSArray containing the JSON.
errorencountered during the operation, if any.
Since
100

◆ isEqualToSymbol:

- (BOOL) isEqualToSymbol: (AGSSymbol *)  other

Compares this symbol to another for equality.

Parameters
otherThe other symbol to compare this one to.
Returns
YES if the two symbols are equal, otherwise NO.
Since
100

◆ toJSON:

- (nullable id) toJSON: (NSError **)  error
requiredinherited

Returns JSON representation for this object.

Parameters
errorencountered during the operation, if any.
Returns
NSDictionary or NSArray containing the JSON.
Since
100

Reimplemented in AGSPortalItem.

Property Documentation

◆ unknownJSON

- (NSDictionary<NSString*,id>*) unknownJSON
readrequirednonatomiccopyinherited

A dictionary of values that was in the source JSON but was unparsed by API.

Returns
NSDictionary containing the unknown JSON.
Since
100

◆ unsupportedJSON

- (NSDictionary<NSString*,id>*) unsupportedJSON
readnonatomiccopyinherited

A dictionary of values that are supported by the REST API, but not exposed through the SDK API.

Returns
NSDictionary containing the unsupported JSON.
Since
100