|
1 |
| -# Add Graphics with Symbols |
| 1 | +# Add graphics with symbols |
2 | 2 |
|
3 |
| -Draw simple graphics with marker, line, polygon, and text symbols. |
| 3 | +Use a symbol style to display a graphic on a graphics overlay. |
4 | 4 |
|
5 |
| - |
| 5 | + |
| 6 | + |
| 7 | +## Use case |
| 8 | + |
| 9 | +Allows you to customize a graphic by assigning a unique symbol. For example, you may wish to display individual graphics for different landmarks across a region, and to style each one with a unique symbol. |
| 10 | + |
| 11 | +## How to use the sample |
| 12 | + |
| 13 | +Pan and zoom around the map. Observe the graphics on the map. |
6 | 14 |
|
7 | 15 | ## How it works
|
8 | 16 |
|
9 |
| -To display a `Graphic` using a symbol: |
10 |
| - |
11 |
| -1. Create a `GraphicsOverlay` and add it to the `MapView`, `MapView.getGraphicsOverlay.add()`. |
12 |
| -2. To create a graphic using a `SimpleMarkerSymbol`. |
13 |
| - * create a `Point` where the graphic will be located |
14 |
| - * create a simple marker symbol that will display at that point |
15 |
| - * assign point and symbol to graphic, `Graphic(point, symbol)` |
16 |
| -3. To create a graphic using a `SimpleLineSymbol`. |
17 |
| - * create a `PointCollection` that will hold all the points that make up the line |
18 |
| - * create a `Polyline` using the point collection, `Polyline(PointCollection)` |
19 |
| - * create a simple line symbol that will display over those collected points |
20 |
| - * assign polyline and symbol to graphic, `Graphic(polyline, symbol)` |
21 |
| -4. To create a graphic using a `SimepleFillSymbol`. |
22 |
| - * create a point collection that will hold all the points that make up the line |
23 |
| - * create a `Polygon` using the point collection, `Polygon(PointCollection)` |
24 |
| - * create a simple line symbol that will display as an outline for points collected |
25 |
| - * create a simeple fill symbol, using line symbol from above, that will fill the region in between the points collected with a single color |
26 |
| - * assign polygon and symbol to graphic, `Graphic(polygon, symbol)` |
27 |
| -5. To create a graphic using a `TextSymbol`. |
28 |
| - * create a point where the graphic will be located |
29 |
| - * create a text symbol, that will display at that point |
30 |
| - * assign point and symbol to graphic, `Graphic(point, symbol)` |
31 |
| -6. Add graphic to graphics overlay to display it to the map view. |
| 17 | +1. Create a `GraphicsOverlay` and add it to the `MapView`. |
| 18 | +2. Create a `Symbol` such as `SimpleMarkerSymbol`, `SimpleLineSymbol`, `SimpleFillSymbol` or `TextSymbol`. |
| 19 | +3. Create a `Graphic`, specifying a `Geometry` and a symbol. |
| 20 | +4. Add the graphic to the graphics overlay. |
32 | 21 |
|
33 | 22 | ## Relevant API
|
34 | 23 |
|
| 24 | +* Geometry |
35 | 25 | * Graphic
|
36 | 26 | * GraphicsOverlay
|
37 |
| -* MapView |
38 |
| -* Point |
39 |
| -* PointCollection |
40 |
| -* Polygon |
41 |
| -* Polyline |
42 |
| -* SimepleFillSymbol |
| 27 | +* SimpleFillSymbol |
43 | 28 | * SimpleLineSymbol
|
44 | 29 | * SimpleMarkerSymbol
|
45 | 30 | * TextSymbol
|
| 31 | + |
| 32 | +## Additional information |
| 33 | + |
| 34 | +To set a symbol style across a number of graphics (e.g. showing trees as graphics sharing a symbol in a park), see the "Add graphics with renderer" sample. |
| 35 | + |
| 36 | +## Tags |
| 37 | + |
| 38 | +display, fill, graphics, line, marker, overlay, point, symbol |
0 commit comments