Skip to content

Commit

Permalink
Update readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
CalebRas committed Oct 15, 2024
1 parent 78ddb71 commit d51aa96
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ struct DisplayAlternateSymbolsAtDifferentScalesView: View {
}
.toolbar {
ToolbarItem(placement: .bottomBar) {
Button("Reset viewpoint") {
Button("Reset Viewpoint") {
viewpoint = map.initialViewpoint
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Apply a unique value with alternate symbols at different scales.

![image of display alternate symbols at different scales](DisplayAlternateSymbolsAtDifferentScales.gif)
![Display alternate symbols at different scales sample](display-alternate-symbols-at-different-scales.gif)

## Use case

Expand All @@ -12,25 +12,21 @@ Once scale ranges are applied to unique values, you can further refine the appea

## How to use the sample

Zoom in and out of the map to see alternate symbols at each scale. The symbology changes according to the following scale ranges: 0-5000, 5000-10000, 10000-20000. To go back to the initial viewpoint, press "Reset Viewpoint".
Zoom in and out of the map to see alternate symbols at each scale. The symbology changes according to the following scale ranges: 0-5,000, 5,000-10,000, 10,000-20,000. To go back to the initial viewpoint, tap "Reset Viewpoint".

## How it works

1. Create a `featureLayer` using the service url and add it to the map's list of operational layers.
1. Create a `FeatureLayer` using the service URL and add it to the map's list of operational layers.
2. Create two alternate symbols (a blue square and a yellow diamond) to be used as alternate symbols. To create an alternate symbol:

a. Create a symbol using `SimpleMarkerSymbol`.

b. Convert the simple marker symbol to a `MultilayerSymbol` using `SimpleMarkerSymbol::toMultilayerSymbol`.

c. Set the valid scale range through reference properties on the multilayer point symbols blue square and yellow diamond by calling `MultilayerSymbol::setReferenceProperties(new SymbolReferenceProperties(double minScale, double maxScale, QObject *parent = nullptr));`.

1. Create a symbol using `SimpleMarkerSymbol`.
2. Convert the simple marker symbol to an `MultilayerSymbol` using `SimpleMarkerSymbol.toMultilayerSymbol()`.
3. Set the multilayer symbol's `referenceProperties` to the valid scale ranges with the blue square and yellow diamond.
3. Create a third multilayer symbol to be used to create a `UniqueValue` class.
4. Create a unique value using the red triangle from step 3 and the list of alternate symbols from step 2.
5. Create a `UniqueValueRenderer` and add the unique value from step 4 to it.
6. Create a purple diamond simple marker and convert it to a multilayer symbol to be used as the default symbol.
7. Set the default symbol on the unique value renderer to the purple diamond from step 6 using `setDefaultSymbol`.
8. Set the `fieldNames` on the unique value renderer to "req_type".
7. Set the unique value renderer's `defaultSymbol` property to the purple diamond from step 6.
8. Set the unique value renderer's `fieldNames` property to "req_type".
9. Apply this unique value renderer to the renderer on feature layer.

## Relevant API
Expand All @@ -43,7 +39,7 @@ Zoom in and out of the map to see alternate symbols at each scale. The symbology

## About the data

The [San Francisco 311 incidents layer](https://sampleserver6.arcgisonline.com/arcgis/rest/services/SF311/FeatureServer/0) in this sample displays point features related to crime incidents such as grafitti and tree damage that have been reported by city residents.
The [San Francisco 311 incidents layer](https://sampleserver6.arcgisonline.com/arcgis/rest/services/SF311/FeatureServer/0) in this sample displays point features related to crime incidents such as graffiti and tree damage that have been reported by city residents.

## Tags

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"category": "Layers",
"category": "Visualization",
"description": "Apply a unique value with alternate symbols at different scales.",
"ignore": false,
"images": [],
"images": [
"display-alternate-symbols-at-different-scales.gif"
],
"keywords": [
"alternate symbols",
"multilayer symbol",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d51aa96

Please sign in to comment.