ArcGIS Runtime SDK for iOS symbols and rendering

Source: Internet
Author: User

ArcGIS Runtime SDK for iOS symbols and rendering

This article is translated from and clicked to open the link. please correct me if there are any mistakes!

A symbol defines the non-geographical aspect of the image appearance. It includes the color, width, and transparency of the image. ArcGIS Runtime SDK for iOS contains many symbol classes, each of which allows you to specify symbols in a unique way. The type of each symbol is also specific to a geometric type (point, line, and surface ).

The Renderer defines a set of symbols for the graphic layer. The symbols applied to each layer depend on the attributes of the image. The Renderer specifies which attribute values correspond to which symbols.

Symbol type

The available symbols and the applicable geometric symbols are summarized in the following table:

Symbol Geometric Shape Description Symbol class
Simple tag Point Sign points with simple shapes AGSSimpleMarkerSymbol
Graphic Markup Point Use images to represent points AGSPictureMakerSymbol
Simple line Line Use predefined types to represent a line AGSSimpleLineSymbol
Combination Point, line, and surface A group of symbols are used to represent geometric figures. AGSCompositeSymbol
Simple Filling Surface Fill the surface in a series of forms AGSSimpleFillSymbol
Text Point, line, and surface Display text for geometric shapes AGSTextSymbol


All the above mentioned conformity classes are inherited from AGSSymbol.


Create a symbol

In many applications, the same symbol is applied multiple times. For example, you can use "Search for tasks" to allow users to search for counties. In this case, it is meaningful to apply the same symbol to the task results each time the task is executed. In this case, you should store the object reference in the form of instance variables/attribute classes.
The following code creates a blue diamond with a white outline and three pixel widths using AGSSimpleMakerSymbol.

//Create the AGSSimpleMarker Symbol and set some propertiesAGSSimpleMarkerSymbol* myMarkerSymbol = [AGSSimpleMarkerSymbol simpleMarkerSymbol];myMarkerSymbol.color = [UIColor blueColor];myMarkerSymbol.style = AGSSimpleMarkerSymbolStyleDiamond;myMarkerSymbol.outline.color = [UIColor whiteColor];myMarkerSymbol.outline.width = 3;

The following code creates an AGSSimpleFillSymbol with a translucent red fill and a red contour (two pixel widths. The outline of a simple fill symbol is AGSSimpleLineSymbol.

//Create the AGSSimpleFillSymbol and set it’s colorAGSSimpleFillSymbol* myFillSymbol = [AGSSimpleFillSymbol simpleFillSymbol];myFillSymbol.color = [UIColor colorWithRed:0.7 green:0.1 blue:0.1 alpha:0.5];//Create the AGSSimpleLineSymbol used for the outlineAGSSimpleLineSymbol* myOutlineSymbol = [AGSSimpleLineSymbol simpleLineSymbol];myOutlineSymbol.color = [UIColor redColor];myOutlineSymbol.width = 2;//set the outline property to myOutlineSymbolmyFillSymbol.outline = myOutlineSymbol;

Now that the symbol has been declared, You can associate it with a graph or use it in the Renderer.

Renderer

The Renderer defines a set of symbols that will be used for graphics on the graphics layer. You can use the Renderer to indicate attributes in different colors and sizes Based on graphic attribute values. To use rendering, you can create it, define the symbols, and set the rendering features of a graphic layer.

myGraphicsLayer.renderer = myRenderer;

Create a simple rendering

A simple Renderer uses the same symbol for each graph. All you need to do is create a Renderer with the required symbols, and then set rendering properties for the graphic layer.

AGSSimpleRenderer* mySimpleRenderer = [AGSSimpleRenderersimpleRendererWithSymbol:myMarkerSymbol];myGraphicsLayer.renderer = mySimpleRenderer;
The symbolic attribute of AGSSimpleRenderer is read-only. Use a simple Renderer to use a symbol. You must use the required symbol to create a Renderer. In addition, the symbol type must match with the attribute type (point element and markup symbol, line element and line symbol, surface element, and fill symbol ).

Create a level interval Renderer

A level-interval Renderer represents each graph based on values of some numerical attributes. Images with similar property values get the same symbol. "Interval" defines the attribute value when the symbol changes.

The ing between symbols and values is defined in the array of AGSClassBreak objects. AGSClassBreaksRenderer uses its classBreaks attribute to store these mappings as AGSClassBreak objects. The AGSClassBreak object includes the symbols, minimum values, and maximum values used to draw graphs. Any value greater than or equal to the minimum value or less than the maximum value will be drawn with a class break symbol.

The following code creates an AGSClassBreaksRenderer and marks the City Based on its size. There are a total of three levels of interval: the first level is from DBL_MIN to 5000, the second level is from 5000 to 250,000, and the third level is from 250,000 to DBL_MAX.

//create the renderer with a default simple marker symbol  //and an attribute field.  AGSClassBreaksRenderer *cityRenderer = [[[AGSClassBreaksRenderer alloc] init] autorelease];  cityRenderer.field = @"POP1990";  cityRenderer.minValue = DBL_MIN;      //create three AGSClassBreak objects, one each for  //low, medium and high populations and the appropriate  //symbol (for clarity, the symbol creation has been omitted)  AGSClassBreak* lowClassBreak = [AGSClassBreak classBreakInfoWithLabel:@"Low" description:@"" maxValue:50000 symbol:lowMarkerSymbol];    AGSClassBreak* mediumClassBreak =[AGSClassBreak classBreakInfoWithLabel:@"Medium" description:@"" maxValue:250000 symbol:mediumMarkerSymbol];    AGSClassBreak* highClassBreak = [AGSClassBreak classBreakInfoWithLabel:@"High" description:@"" maxValue:DBL_MAX symbol:highMarkerSymbol];    //add the AGSClassBreak objects to the renderer   NSMutableArray* classBreaks = [NSMutableArray array];[classBreaks addObject:lowClassBreak];   [classBreaks addObject:mediumClassBreak];[classBreaks addObject:highClassBreak];        cityRenderer.classBreaks = classBreaks;//add the renderer to the graphics layer  citiesGraphicsLayer.renderer = cityRenderer;

Create a unique value Renderer

The unique value Renderer represents graphics groups with matching attributes. This is most common in terms or strings. For example, you can use a unique value Renderer to indicate the name of a region: Yellow is a residential area, purple is an industrial area, red is a commercial area, and so on. You can also use the unique value Renderer to encode values, or sequence words such as the first, second, and third.

The following code creates an AGSUniqueValueRenderer, which uses three values: VILLAGE, CITY, and TOWN to represent the CITY. Each unique symbol represents the attribute field of the TYPE. (For clarity, the creation of the symbol has been omitted)

//create the renderer  //specify the attribute field whose values will decide the symbol //we need to provide a default symbol for unmatched valuesAGSUniqueValueRenderer *cityRenderer = [[[AGSUniqueValueRenderer alloc] init] autorelease];  cityRenderer.defaultSymbol = defaultMakerSymbol;  cityRenderer.field1 = @"TYPE";      //create three AGSUniqueValue objects, one each for  //CITY, TOWN, and VILLAGE AGSUniqueValue* village = [[AGSUniqueValue alloc] initWithValue:@"VILLAGE" label:@"village" description:nil symbol:villageSymbol];  AGSUniqueValue* city = [[AGSUniqueValue alloc] initWithValue:@"CITY" label:@"city" description:nil symbol:citySymbol];  AGSUniqueValue* town = [[AGSUniqueValue alloc] initWithValue:@"TOWN" label:@"town" description:nil symbol:townSymbol];    //add the AGSUniqueValue objects to the renderer[cityRenderer.uniqueValues addObject:village];  [cityRenderer.uniqueValues addObject:city];  [cityRenderer.uniqueValues addObject:town];    //add the renderer to the graphics layer  citiesGraphicsLayer.renderer = cityRenderer;

Change the Rendering Dynamic Layer

In ArcGIS server 10.1 or later, dynamic layers provide the ability to change rendering from the ArcGIS Server (non-Cache) map service on the client. Setting the layer definition and drawing options on the dynamic layer allows you to control the Content and Display Mode of the Child layers in the service.

Create a Renderer on the server

For layers in ArcGIS Server10.1 or later, you can use GenerateRendererTask to create and return a level interval or a unique value Renderer. The generated Renderer can then be applied to the corresponding dynamic layers in your map.

Use the task to create a unique value Renderer so that you can specify a color gradient process, so that each unique symbol in the Renderer can obtain a unique y color. GenerateRendererTask is used to generate a Renderer using some unique values for the attribute layer, which is more effective than defining each class explicitly by writing code.

Using a task to create a category interval Renderer gives you the ability to use the statistical classification method to determine your category range. Instead of manually coding the minimum and maximum values of a category interval, you can specify the number of classes required and apply one of the following classification methods to determine the interval value of each category: natural segmentation, equidistance, quantile, or standard deviation. You can also choose to use the total percentage to standardize your data, the value of another field, or use logs.







Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.