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

[android] rotated map returns incorrect bounds when going over date line #11309

Merged
merged 1 commit into from Mar 1, 2018

Conversation

osana
Copy link
Contributor

@osana osana commented Feb 26, 2018

No description provided.

@tobrun
Copy link
Member

tobrun commented Feb 26, 2018

@osana could you retarget this branch to release-boba? Capturing from chat that we should avoid cherry-picking every commit, treat release-boba as the master branch for now.

@osana osana changed the base branch from master to release-boba February 26, 2018 09:50
@osana osana changed the base branch from release-boba to master February 26, 2018 09:51
@osana osana force-pushed the osana-visibleregion-rotatied-11137-dateline branch from ceb92c8 to 5902bc1 Compare February 27, 2018 14:18
@osana osana changed the base branch from master to release-boba February 27, 2018 14:22
@osana osana force-pushed the osana-visibleregion-rotatied-11137-dateline branch 2 times, most recently from 923ca5c to c4e7aeb Compare February 27, 2018 14:27
@osana osana added the Android Mapbox Maps SDK for Android label Feb 27, 2018
@osana osana added this to the android-v6.0.0 milestone Feb 27, 2018
@osana osana force-pushed the osana-visibleregion-rotatied-11137-dateline branch 3 times, most recently from 25c2e02 to 10b77e6 Compare February 28, 2018 21:39
@osana osana force-pushed the osana-visibleregion-rotatied-11137-dateline branch from 10b77e6 to 6f28867 Compare February 28, 2018 23:44
@osana
Copy link
Contributor Author

osana commented Feb 28, 2018

@tobrun I tested it interactively using a test program but I am not sure how to write a unit test for it.

@tobrun
Copy link
Member

tobrun commented Mar 1, 2018

@osana the best way to test this is through an Android instrumentation test.

some pseudo code:

@RunWith(AndroidJUnit4.class)
public class SomeTest extends BaseActivityTest {

  @Override
  protected Class getActivityClass() {
    return EspressoTestActivity.class;
  }

  @Test
  public void test() {
    validateTestSetup();
    invoke(mapboxMap, (uiController, mapboxMap) -> {
      // set camera bearing with CameraUpdateFactory.bearingTo
      // if needed use waitloop() to wait for a render
      // get bounds from the map and assert
    });
  }
}

@osana
Copy link
Contributor Author

osana commented Mar 1, 2018

@tobrun I might be just hitting some other bugs. Yesterday I sort of went the same route you are suggesting. Added a test to MapboxMapTest.java

  public void testVisibleRegionBounds() {
    ViewUtils.checkViewIsDisplayed(R.id.mapView);
    onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> {

      CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngBounds(
        LatLngBounds.from(10, -170, -10, 170), 0);
      mapboxMap.moveCamera(cameraUpdate, new MapboxMap.CancelableCallback() {
        @Override
        public void onCancel() {
        }

        @Override
        public void onFinish() {
          VisibleRegion visibleRegion = mapboxMap.getProjection().getVisibleRegion();
          Log.d(">>>>>>>>>>>", " VisRect= " +visibleRegion.toString());
        }
      });
    }));
  }

The output that I was getting was not taking dateline into account. I suspect that CameraUpdate might be interpreting LatLngBounds incorrectly - I still need to confirm that though. Also I need to figure out what is the reasonable error as bounds will be different when rotated.

@osana osana merged commit 5b4b3c5 into release-boba Mar 1, 2018
@LukasPaczos LukasPaczos mentioned this pull request Mar 2, 2018
23 tasks
@jfirebaugh jfirebaugh deleted the osana-visibleregion-rotatied-11137-dateline branch July 27, 2018 22:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants