AGSLayerViewState State 6

394
2
Jump to solution
12-02-2021 04:04 PM
marius
by
New Contributor III

Hello,

It seems that somehow the AGSLayerViewState is set to 6.

We already handle active/notVisible/outOfScale/loading/error/warning (0 to 5).

I've checked the documentation https://developers.arcgis.com/ios/api-reference/_a_g_s_layer_view_state_8h.html#ae64e23b127ffb327986... and there are no other options.

Do you have any ideas what would  that mean?

Thank you

0 Kudos
1 Solution

Accepted Solutions
Ting
by Esri Contributor
Esri Contributor

We already handle active/notVisible/outOfScale/loading/error/warning (0 to 5)


Actually they are not 0 to 5, but 1, 2, 4, 8, 16 and 32 (1 << 0 to 1 << 5).

The raw values of AGSLayerViewState are NS_OPTIONS, or OptionSet, which allows multiple options/states to be returned at the same time.

It seems that somehow the AGSLayerViewState is set to 6.

Consider this snippet

 

let states: [AGSLayerViewStatus] = [.active, .notVisible, .outOfScale, .loading, .error, .warning]
states.forEach { state in
    print(state.rawValue)
}
// 1, 2, 4, 8, 16, 32

print(AGSLayerViewStatus.notVisible.rawValue | AGSLayerViewStatus.outOfScale.rawValue)
// 6

 

When there are multiple states involved, you'll see a combination of values.

 

Here is a related snippet that may help: https://github.com/Esri/arcgis-runtime-samples-ios/blob/main/arcgis-ios-sdk-samples/Maps/Display%20l... 

View solution in original post

2 Replies
Ting
by Esri Contributor
Esri Contributor

We already handle active/notVisible/outOfScale/loading/error/warning (0 to 5)


Actually they are not 0 to 5, but 1, 2, 4, 8, 16 and 32 (1 << 0 to 1 << 5).

The raw values of AGSLayerViewState are NS_OPTIONS, or OptionSet, which allows multiple options/states to be returned at the same time.

It seems that somehow the AGSLayerViewState is set to 6.

Consider this snippet

 

let states: [AGSLayerViewStatus] = [.active, .notVisible, .outOfScale, .loading, .error, .warning]
states.forEach { state in
    print(state.rawValue)
}
// 1, 2, 4, 8, 16, 32

print(AGSLayerViewStatus.notVisible.rawValue | AGSLayerViewStatus.outOfScale.rawValue)
// 6

 

When there are multiple states involved, you'll see a combination of values.

 

Here is a related snippet that may help: https://github.com/Esri/arcgis-runtime-samples-ios/blob/main/arcgis-ios-sdk-samples/Maps/Display%20l... 

marius
by
New Contributor III

Thanks for clarifying that. I've handled them as "switch:", hence the error.

I'll convert it to the example code.

0 Kudos