-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate offline map with custom parameters #314
base: v.next
Are you sure you want to change the base?
Generate offline map with custom parameters #314
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice sample @TADraeseke, I have a few code suggesstion changes which would be helpful to have. Hope my comments here makes sense, or I could share my thoughts in detail if you would prefer:
In summary:
- Update the sample to use the provision path location to save offline map
- Simplify the use of multiple
?.let
/as?
Kotlin checks - Pass in
targetFeatureLayer
rather thanlayerName
causing repeated lookups. - UI feedback to break up options to sections
samples/generate-offline-map-with-custom-parameters/src/main/AndroidManifest.xml
Outdated
Show resolved
Hide resolved
...offlinemapwithcustomparameters/components/GenerateOfflineMapWithCustomParametersViewModel.kt
Outdated
Show resolved
Hide resolved
...offlinemapwithcustomparameters/components/GenerateOfflineMapWithCustomParametersViewModel.kt
Outdated
Show resolved
Hide resolved
...offlinemapwithcustomparameters/components/GenerateOfflineMapWithCustomParametersViewModel.kt
Outdated
Show resolved
Hide resolved
...offlinemapwithcustomparameters/components/GenerateOfflineMapWithCustomParametersViewModel.kt
Outdated
Show resolved
Hide resolved
...offlinemapwithcustomparameters/components/GenerateOfflineMapWithCustomParametersViewModel.kt
Outdated
Show resolved
Hide resolved
...offlinemapwithcustomparameters/components/GenerateOfflineMapWithCustomParametersViewModel.kt
Outdated
Show resolved
Hide resolved
...nerateofflinemapwithcustomparameters/screens/GenerateOfflineMapWithCustomParametersScreen.kt
Outdated
Show resolved
Hide resolved
...nerateofflinemapwithcustomparameters/screens/GenerateOfflineMapWithCustomParametersScreen.kt
Outdated
Show resolved
Hide resolved
} | ||
|
||
@Composable | ||
fun OverrideParameters( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Subjective compose high-level feedback:
-
Could each of the 4 sliders use
fillMaxWidth
with a consistent horizontal padding (for nav gestures) but also it's relevant labels along with the values are represented above each slider. This would help ensure each slider looks to be the same "width" for UI consistency. -
This sample looks to have 4 general selections of options, "Adjust basemap", "Include layers", "Filter feature layer" and "Crop layers to extent". Could each of these 4 sections be added into a container (eg
Card
) to help break up the UI? Or even something as simple as a horizontal divider with spacing should also do the trick!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've not done the consistent sliders yet, but have used horizontal dividers. The cards looked a bit funny without loads of internal padding on all child components. So I just went with the less code heavy solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for considering it, the card suggestion came mainly from looking at swift. The dividers look great and noticeably help break up the UI.
Thank you @shubham7109 -- I've made tons of changes now. In addition to your feedback I've:
The only one I haven't done is remove sliders from rows. I'm just concerned it'll add alot of extra UI code, but maybe a quick call can sort it out. Anyways ready for re-review. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @TADraeseke! The changes looks great and the reset functionality works well. I had some minor feedback suggestions mainly to do with formatting, and code quality.
Happy to approve 👍
* Set the level IDs you want to download with `exportTileCacheParameters.levelIds.add(...)`. | ||
* To buffer the extent, use `exportTileCacheParameters.areaOfInterest` where bufferedGeometry can be calculated with the `GeometryEngine`. | ||
6. To remove operational layers from the download: | ||
* Create a `OfflineParametersKey` with the operational layer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Create a `OfflineParametersKey` with the operational layer. | |
* Create an `OfflineParametersKey` with the operational layer. |
6. To remove operational layers from the download: | ||
* Create a `OfflineParametersKey` with the operational layer. | ||
* Get the generate geodatabase layer options using the key with `parameterOverrides.generateGeodatabaseParameters[key].layerOptions` | ||
* Using the `GenerateLayerOption` list, and remove the layer if its the layer option's ID matches the layer's ID. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Using the `GenerateLayerOption` list, and remove the layer if its the layer option's ID matches the layer's ID. | |
* Use the `GenerateLayerOption` list to remove the layer if the layer option's ID matches the layer's ID. |
import kotlinx.coroutines.launch | ||
import java.io.File | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Sets up a portal item and displays map area to take offline | ||
*/ | ||
private fun setUpMap() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
messageDialogVM.showMessageDialog( | ||
title = it.message.toString() | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (mapViewModel.showResetButton) { | ||
Button( | ||
onClick = { | ||
mapViewModel.reset() | ||
}, modifier = Modifier.align(Alignment.CenterHorizontally) | ||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (mapViewModel.showResetButton) { | |
Button( | |
onClick = { | |
mapViewModel.reset() | |
}, modifier = Modifier.align(Alignment.CenterHorizontally) | |
) { | |
if (mapViewModel.showResetButton) { | |
Button( | |
onClick = mapViewModel::reset, | |
modifier = Modifier.align(Alignment.CenterHorizontally) | |
) { |
} | ||
|
||
@Composable | ||
fun OverrideParameters( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for considering it, the card suggestion came mainly from looking at swift. The dividers look great and noticeably help break up the UI.
FloatingActionButton(modifier = Modifier.padding(bottom = 36.dp, end = 12.dp), | ||
onClick = { showBottomSheet = true }) { | ||
Icon( | ||
Icons.Filled.Settings, contentDescription = "Parameter overrides" | ||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FloatingActionButton(modifier = Modifier.padding(bottom = 36.dp, end = 12.dp), | |
onClick = { showBottomSheet = true }) { | |
Icon( | |
Icons.Filled.Settings, contentDescription = "Parameter overrides" | |
) | |
} | |
FloatingActionButton( | |
modifier = Modifier.padding(bottom = 36.dp, end = 12.dp), | |
onClick = { showBottomSheet = true } | |
) { | |
Icon( | |
imageVector = Icons.Filled.Settings, | |
contentDescription = "Parameter overrides" | |
) | |
} |
defineParameters: (Int, Int, Int, Boolean, Boolean, Int, Boolean) -> Unit, | ||
setBottomSheetVisibility: (Boolean) -> Unit | ||
) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Text( | ||
text = "Override parameters", | ||
style = MaterialTheme.typography.titleMedium, | ||
modifier = Modifier.align(Alignment.CenterHorizontally) | ||
) | ||
|
||
Text(text = "Adjust basemap", style = MaterialTheme.typography.labelLarge) | ||
Row( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seems to be an extra indentation here:
Text( | |
text = "Override parameters", | |
style = MaterialTheme.typography.titleMedium, | |
modifier = Modifier.align(Alignment.CenterHorizontally) | |
) | |
Text(text = "Adjust basemap", style = MaterialTheme.typography.labelLarge) | |
Row( | |
Text( | |
text = "Override parameters", | |
style = MaterialTheme.typography.titleMedium, | |
modifier = Modifier.align(Alignment.CenterHorizontally) | |
) | |
Text(text = "Adjust basemap", style = MaterialTheme.typography.labelLarge) | |
Row( |
Description
PR to add a new Kotlin sample Generate offline map with custom parameters in Edit and manage data category.