[ios][android] Replacing altitude difference to ascent and descent #3062

Merged
ArsenyN merged 6 commits from master into master 2022-08-01 22:05:50 +00:00
ArsenyN commented 2022-07-31 09:02:29 +00:00 (Migrated from github.com)

Summary

The app for pedestrian and cyclists route show altitude difference
between highest and lowest points. It's not too useful data in multiple
cases. More informative for hikers and cyclists from values of
elevation total ascent and total descent on route.

I replaced altitude difference to total ascent and total descent.

Current state

ios-current300

Example of route elevation profile where altitude difference between highest and lowest points is useless.

altitude-difference650

Result

iOS
ios-result300

Android
android-result300

### Summary The app for pedestrian and cyclists route show altitude difference between highest and lowest points. It's not too useful data in multiple cases. More informative for hikers and cyclists from values of elevation total ascent and total descent on route. I replaced altitude difference to total ascent and total descent. **Current state** ![ios-current300](https://user-images.githubusercontent.com/235630/182018536-d231e846-abaa-4d3b-99c3-37fdfb11e4d7.png) **Example of route elevation profile where altitude difference between highest and lowest points is useless.** ![altitude-difference650](https://user-images.githubusercontent.com/235630/182018672-a620c1f7-0dd7-45cb-a150-7b97e0f9bad8.png) **Result** **iOS** ![ios-result300](https://user-images.githubusercontent.com/235630/182018881-1e531f51-d595-4a01-92a0-91ac9f49b311.png) **Android** ![android-result300](https://user-images.githubusercontent.com/235630/182018886-8d0da837-4188-4eed-b9d9-e2c74af9933e.png)
biodranik (Migrated from github.com) requested changes 2022-07-31 11:57:04 +00:00
biodranik (Migrated from github.com) left a comment

Thank you for your contribution! There are a few minor comments.

Thank you for your contribution! There are a few minor comments.
@ -264,17 +264,10 @@ final class RoutingBottomMenuController implements View.OnClickListener
{
mAltitudeChart.setImageBitmap(bm);
biodranik (Migrated from github.com) commented 2022-07-31 11:46:35 +00:00

Looks like there are tabs and spaces mixed in the indentation. Please set the editor to use 2 spaces instead of tabs, and check/fix indentation in all your changes.

Looks like there are tabs and spaces mixed in the indentation. Please set the editor to use 2 spaces instead of tabs, and check/fix indentation in all your changes.
biodranik (Migrated from github.com) commented 2022-07-31 11:48:06 +00:00

This call is unnecessary in the metric system, and the previous call is useless in the imperial one. Please rewrite the code without unnecessary function calls. We want to have the fastest app that eats less battery 😉

This call is unnecessary in the metric system, and the previous call is useless in the imperial one. Please rewrite the code without unnecessary function calls. We want to have _the fastest_ app that eats _less_ battery 😉
biodranik (Migrated from github.com) commented 2022-07-31 11:51:33 +00:00
  1. Tabs and spaces are also mixed. Please clean up.
  2. Is guard really needed here? Why not a simple if?
1. Tabs and spaces are also mixed. Please clean up. 2. Is guard really needed here? Why not a simple `if`?
@ -386,15 +387,16 @@ char const *kRenderAltitudeImagesQueueLabel = "mapsme.mwmrouter.renderAltitudeIm
router.altitudeImagesData[sizeValue] = imageData;
biodranik (Migrated from github.com) commented 2022-07-31 11:52:58 +00:00

Are feet (imperial system) work on iOS in this case?

Are feet (imperial system) work on iOS in this case?
biodranik (Migrated from github.com) commented 2022-07-31 11:53:55 +00:00

tabs + spaces 😢

tabs + spaces 😢
biodranik (Migrated from github.com) commented 2022-07-31 11:54:32 +00:00

If totalAscent/Descent can't be negative, please use size_t for it.

If totalAscent/Descent can't be negative, please use size_t for it.
biodranik (Migrated from github.com) commented 2022-07-31 11:55:59 +00:00
    if (delta > 0)
      totalAscentM += delta;
    else
      totalDescentM += -delta;   
```suggestion if (delta > 0) totalAscentM += delta; else totalDescentM += -delta; ```
biodranik (Migrated from github.com) commented 2022-07-31 11:56:15 +00:00

There is a code style guide in the repo :)

There is a code style guide in the repo :)
ArsenyN commented 2022-07-31 12:01:38 +00:00 (Migrated from github.com)

@biodranik Thanks for review and you comments.
Will check and fix all soon

@biodranik Thanks for review and you comments. Will check and fix all soon
ArsenyN (Migrated from github.com) reviewed 2022-08-01 05:48:50 +00:00
@ -264,17 +264,10 @@ final class RoutingBottomMenuController implements View.OnClickListener
{
mAltitudeChart.setImageBitmap(bm);
ArsenyN (Migrated from github.com) commented 2022-08-01 05:48:50 +00:00

Fixed at d80c3a0

Fixed at d80c3a0
ArsenyN (Migrated from github.com) reviewed 2022-08-01 05:51:11 +00:00
@ -264,17 +264,10 @@ final class RoutingBottomMenuController implements View.OnClickListener
{
mAltitudeChart.setImageBitmap(bm);
ArsenyN (Migrated from github.com) commented 2022-08-01 05:51:10 +00:00

Removed unnecessary function calls d80c3a0

Removed unnecessary function calls d80c3a0
ArsenyN (Migrated from github.com) reviewed 2022-08-01 05:51:56 +00:00
ArsenyN (Migrated from github.com) commented 2022-08-01 05:51:55 +00:00
  • Fixed idents
  • Replaced 2 guard by if
    d80c3a0
- Fixed idents - Replaced 2 guard by if d80c3a0
ArsenyN (Migrated from github.com) reviewed 2022-08-01 05:52:41 +00:00
@ -386,15 +387,16 @@ char const *kRenderAltitudeImagesQueueLabel = "mapsme.mwmrouter.renderAltitudeIm
router.altitudeImagesData[sizeValue] = imageData;
ArsenyN (Migrated from github.com) commented 2022-08-01 05:52:40 +00:00

Checked on iOS and Android there are similar code. All works with both measurement systems.

Checked on iOS and Android there are similar code. All works with both measurement systems.
ArsenyN (Migrated from github.com) reviewed 2022-08-01 05:53:10 +00:00
ArsenyN (Migrated from github.com) commented 2022-08-01 05:53:10 +00:00

fixed

fixed
ArsenyN (Migrated from github.com) reviewed 2022-08-01 05:53:54 +00:00
ArsenyN (Migrated from github.com) commented 2022-08-01 05:53:53 +00:00

I used uint32_t instead size_t

I used uint32_t instead size_t
biodranik (Migrated from github.com) reviewed 2022-08-01 11:57:56 +00:00
biodranik (Migrated from github.com) left a comment

Almost there )

Almost there )
biodranik (Migrated from github.com) commented 2022-08-01 11:50:53 +00:00

Is there a warning here about uint to int conversion? static_cast<int32_t> is needed, probably also asserted that the uint value is not greater than an int one.

Is there a warning here about uint to int conversion? static_cast<int32_t> is needed, probably also asserted that the uint value is not greater than an int one.
biodranik (Migrated from github.com) commented 2022-08-01 11:54:55 +00:00

Can this constant be a part of the class and reused, to avoid unnecessary memory allocations on each moment?

Can this constant be a part of the class and reused, to avoid unnecessary memory allocations on each moment?
biodranik (Migrated from github.com) commented 2022-08-01 11:57:37 +00:00
  /// \param totalDescent is total descent of the route in altitudeUnits.
```suggestion /// \param totalDescent is total descent of the route in altitudeUnits. ```
ArsenyN (Migrated from github.com) reviewed 2022-08-01 14:31:48 +00:00
ArsenyN (Migrated from github.com) commented 2022-08-01 14:31:48 +00:00

Added explicit cast. But without assertion

Added explicit cast. But without assertion
biodranik (Migrated from github.com) approved these changes 2022-08-01 20:59:20 +00:00
biodranik (Migrated from github.com) left a comment

I would argue about the swift lambda formatting, but let's leave it for future PRs )

I would argue about the swift lambda formatting, but let's leave it for future PRs )
ArsenyN commented 2022-08-02 07:44:40 +00:00 (Migrated from github.com)

Thanks

Thanks
This repo is archived. You cannot comment on pull requests.
No reviewers
No labels
Accessibility
Accessibility
Address
Address
Android
Android
Android Auto
Android Auto
Android Automotive (AAOS)
Android Automotive (AAOS)
API
API
AppGallery
AppGallery
AppStore
AppStore
Battery and Performance
Battery and Performance
Blocker
Blocker
Bookmarks and Tracks
Bookmarks and Tracks
Borders
Borders
Bug
Bug
Build
Build
CarPlay
CarPlay
Classificator
Classificator
Community
Community
Core
Core
CrashReports
CrashReports
Cycling
Cycling
Desktop
Desktop
DevEx
DevEx
DevOps
DevOps
dev_sandbox
dev_sandbox
Directions
Directions
Documentation
Documentation
Downloader
Downloader
Drape
Drape
Driving
Driving
Duplicate
Duplicate
Editor
Editor
Elevation
Elevation
Enhancement
Enhancement
Epic
Epic
External Map Datasets
External Map Datasets
F-Droid
F-Droid
Fonts
Fonts
Frequently User Reported
Frequently User Reported
Fund
Fund
Generator
Generator
Good first issue
Good first issue
Google Play
Google Play
GPS
GPS
GSoC
GSoC
iCloud
iCloud
Icons
Icons
iOS
iOS
Legal
Legal
Linux Desktop
Linux Desktop
Linux packaging
Linux packaging
Linux Phone
Linux Phone
Mac OS
Mac OS
Map Data
Map Data
Metro
Metro
Navigation
Navigation
Need Feedback
Need Feedback
Night Mode
Night Mode
NLnet 2024-06-281
NLnet 2024-06-281
No Feature Parity
No Feature Parity
Opening Hours
Opening Hours
Outdoors
Outdoors
POI Info
POI Info
Privacy
Privacy
Public Transport
Public Transport
Raw Idea
Raw Idea
Refactoring
Refactoring
Regional
Regional
Regression
Regression
Releases
Releases
RoboTest
RoboTest
Route Planning
Route Planning
Routing
Routing
Ruler
Ruler
Search
Search
Security
Security
Styles
Styles
Tests
Tests
Track Recording
Track Recording
Translations
Translations
TTS
TTS
UI
UI
UX
UX
Walk Navigation
Walk Navigation
Watches
Watches
Web
Web
Wikipedia
Wikipedia
Windows
Windows
Won't fix
Won't fix
World Map
World Map
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: organicmaps/organicmaps-tmp#3062
No description provided.