-
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
Find nearest vertex sample #319
base: v.next
Are you sure you want to change the base?
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.
Looks good, not much to add.
...n/java/com/esri/arcgismaps/sample/findnearestvertex/components/FindNearestVertexViewModel.kt
Outdated
Show resolved
Hide resolved
...n/java/com/esri/arcgismaps/sample/findnearestvertex/components/FindNearestVertexViewModel.kt
Outdated
Show resolved
Hide resolved
...n/java/com/esri/arcgismaps/sample/findnearestvertex/components/FindNearestVertexViewModel.kt
Outdated
Show resolved
Hide resolved
...n/java/com/esri/arcgismaps/sample/findnearestvertex/components/FindNearestVertexViewModel.kt
Outdated
Show resolved
Hide resolved
...n/java/com/esri/arcgismaps/sample/findnearestvertex/components/FindNearestVertexViewModel.kt
Outdated
Show resolved
Hide resolved
...n/java/com/esri/arcgismaps/sample/findnearestvertex/components/FindNearestVertexViewModel.kt
Outdated
Show resolved
Hide resolved
...n/java/com/esri/arcgismaps/sample/findnearestvertex/components/FindNearestVertexViewModel.kt
Outdated
Show resolved
Hide resolved
Co-authored-by: Oliver Smith <67012037+01smito01@users.noreply.github.com>
…arcgis-maps-sdk-kotlin-samples into find_nearest_vertex_sample
Makes the code a little bit tidier
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.
@darryl-lynch looks good. A few comments to consider.
val distanceInformationFlow = _distanceInformationFlow.asStateFlow() | ||
|
||
// create a message dialog view model for handling error messages | ||
val messageDialogVM = MessageDialogViewModel() |
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 think our general rule is to not use abbreviations so it would be ViewModel
instead of VM
but maybe a different style is used in the samples.
}.onFailure { error -> | ||
messageDialogVM.showMessageDialog( | ||
title = "Failed to load map", | ||
description = error.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.
Do you need toString()
here? Isn't the message already a string?
} | ||
|
||
/** | ||
* Finds the nearest vertex from [mapPoint] from the [polygon]. |
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.
Shouldn't the comment be something like "Finds the nearest vertex on the polygon to the map point"?
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.
Maybe mapPoint
should be clickPoint
or tapPoint
to make it clearer where the point comes from.
GeometryEngine.nearestCoordinate(geometry = polygon, point = mapPoint) | ||
// set the nearest coordinate graphic's geometry to the nearest coordinate | ||
nearestCoordinateGraphic.geometry = nearestCoordinateResult?.coordinate | ||
// calculate the distances to the nearest vertex and nearest coordinate then convert to miles |
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 think m or km would be better since more parts of the world use metric measurements.
The image in the design shows km.
* Converts a quantity in feet to miles. | ||
*/ | ||
private fun Double.feetToMiles(): Double { | ||
return this/5280.0 |
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.
We'd usually put spaces around the operator e.g. this / 5280.0
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.
Is this conversion correct for the spatial reference being used? You can use LinearUnit
methods to convert.
Description
Adding more functionality to the create and edit geometries working branch
Links and Data
Issues: https://devtopia.esri.com/runtime/kotlin/issues/4989
vTest: https://runtime-kotlin.esri.com/view/all/job/vtest/job/sampleviewer/80/
What To Review
Review like ordinary sample. The delete button is of particular interest since a new dropdown was added to try make it fit and have sufficient detail on what it does. Will fail style checks as README will likely be part of final stage.
How to Test
Run the sample on the sample viewer or the repo.