Skip to content
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

Open
wants to merge 12 commits into
base: v.next
Choose a base branch
from

Conversation

TADraeseke
Copy link
Collaborator

Description

PR to add a new Kotlin sample Generate offline map with custom parameters in Edit and manage data category.

@TADraeseke TADraeseke changed the base branch from main to v.next February 1, 2025 00:40
@TADraeseke TADraeseke added the New sample New Kotlin sample using ArcGIS Maps SDK label Feb 3, 2025
@TADraeseke TADraeseke self-assigned this Feb 3, 2025
@TADraeseke TADraeseke marked this pull request as ready for review February 3, 2025 19:28
Copy link
Collaborator

@shubham7109 shubham7109 left a 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 than layerName causing repeated lookups.
  • UI feedback to break up options to sections

}

@Composable
fun OverrideParameters(
Copy link
Collaborator

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!

Copy link
Collaborator Author

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.

Copy link
Collaborator

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.

@shubham7109 shubham7109 changed the title Trev8939/generate offline map with custom parameters Generate offline map with custom parameters Feb 5, 2025
@TADraeseke
Copy link
Collaborator Author

Thank you @shubham7109 -- I've made tons of changes now. In addition to your feedback I've:

  • disabled map rotation
  • blocked taps while the progress dialog is showing
  • Handle a reset option once map is generated
  • Loads of other refactoring

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!

Copy link
Collaborator

@shubham7109 shubham7109 left a 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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* 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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* 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


Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

* Sets up a portal item and displays map area to take offline
*/
private fun setUpMap() {

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

messageDialogVM.showMessageDialog(
title = it.message.toString()
)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

Comment on lines +144 to +149
if (mapViewModel.showResetButton) {
Button(
onClick = {
mapViewModel.reset()
}, modifier = Modifier.align(Alignment.CenterHorizontally)
) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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(
Copy link
Collaborator

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.

Comment on lines +158 to +163
FloatingActionButton(modifier = Modifier.padding(bottom = 36.dp, end = 12.dp),
onClick = { showBottomSheet = true }) {
Icon(
Icons.Filled.Settings, contentDescription = "Parameter overrides"
)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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
) {

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

Comment on lines +191 to +198
Text(
text = "Override parameters",
style = MaterialTheme.typography.titleMedium,
modifier = Modifier.align(Alignment.CenterHorizontally)
)

Text(text = "Adjust basemap", style = MaterialTheme.typography.labelLarge)
Row(
Copy link
Collaborator

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:

Suggested change
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(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New sample New Kotlin sample using ArcGIS Maps SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants