Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Map API inconsistences - #2994

Closed
brunoabinader wants to merge 0 commit into
masterfrom
2994-map-api-inconsistencies
Closed

brunoabinader wants to merge 0 commit into
masterfrom
2994-map-api-inconsistencies

Conversation

@brunoabinader

Copy link
Copy Markdown
Contributor

We currently have some API inconsistencies in our Map API:

  • Pixel points are sometimes represented separately (e.g. double x, double y) or inside vec2<double> structs - see Map::scaleBy and Map::setLatLng as examples;
  • Inconsistent usage of const for return types and pass-by-value, pass-by-const-ref, pass-by-ref in function parameters;
  • We should be checking more for std::nan() in Transform functions;

For the pixel handling, I propose a PrecisionPoint struct with two double x and y members in the same fashion as the other structures in include/mbgl/util/geo.hpp.

These changes shouldn't affect current behavior, but might break API compatibility with Android and iOS platforms.

/cc @mapbox/gl @mapbox/mobile

@brunoabinader brunoabinader added iOS Mapbox Maps SDK for iOS refactor Android Mapbox Maps SDK for Android ready and removed in progress labels Nov 10, 2015
@brunoabinader
brunoabinader force-pushed the 2994-map-api-inconsistencies branch from 9be82e6 to 835a2ed Compare November 10, 2015 14:31
Comment thread src/mbgl/map/transform.cpp Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This line mutates the CameraOptions for local purposes. There are several instances of this in Map and Transform, which is why the CameraOptions was being passed in by value.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This method should receive by const reference and copy before resetting.

@brunoabinader
brunoabinader force-pushed the 2994-map-api-inconsistencies branch from 835a2ed to 6845756 Compare November 11, 2015 14:51
@brunoabinader
brunoabinader force-pushed the 2994-map-api-inconsistencies branch from 6845756 to aa88576 Compare November 11, 2015 15:10
@mourner mourner removed the ready label Nov 11, 2015
@brunoabinader
brunoabinader deleted the 2994-map-api-inconsistencies branch November 11, 2015 15:10
@1ec5

1ec5 commented Nov 11, 2015

Copy link
Copy Markdown
Contributor

This was committed in:

e5c460f
e2052ea
c78e769
99ac8d8
5a24ac6
994ee51
12e0e5e
cd0266f
aa88576
e31c96d

@ljbade

ljbade commented Nov 12, 2015

Copy link
Copy Markdown
Contributor

@brunoabinader @1ec5 for future reference if a PR does not get "merged" status properly, you only need to force push to the branch with a appropriately rebased tree. GH will then fixup closed PR to merged status. This works even if you merge to master and forget to update the branch first after rebase.

@ljbade

ljbade commented Nov 12, 2015

Copy link
Copy Markdown
Contributor

@jfirebaugh you might also find ^ tip handy if you spot a broken PR merge

@brunoabinader
brunoabinader restored the 2994-map-api-inconsistencies branch November 12, 2015 08:34
@brunoabinader
brunoabinader deleted the 2994-map-api-inconsistencies branch November 12, 2015 08:45
@1ec5

1ec5 commented Nov 12, 2015

Copy link
Copy Markdown
Contributor

@ljbade, actually, I think that's what happened here, which is why the PR lists zero commits.

1ec5 added a commit that referenced this pull request Nov 12, 2015
Corrected Transform::_setScale() after the refactoring in 5a24ac6 for #2994. This change also addresses two dead store warnings from the static analyzer.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Android Mapbox Maps SDK for Android iOS Mapbox Maps SDK for iOS refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants