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

Consolidate OfflineRegionDefintions #12685

Closed
tobrun opened this issue Aug 21, 2018 · 1 comment
Closed

Consolidate OfflineRegionDefintions #12685

tobrun opened this issue Aug 21, 2018 · 1 comment
Assignees
Labels
Android Mapbox Maps SDK for Android SEMVER-MAJOR Requires a major release according to Semantic Versioning rules

Comments

@tobrun
Copy link
Member

tobrun commented Aug 21, 2018

Follow up from #11447, where we weren't able to address the issue below due to semver.

With next major version bump, we should consolidate the implementations of OfflineRegionDefintion and increase the API surface of the OfflineRegionDefinition interface. Atm we have two concrete implementations of this interface:

  • OfflineTilePyramidRegionDefinition
  • OfflineGeometryRegionDefinition

These implementations share a lot of similar concepts but aren't found in the OfflineRegionDefinition. This results in writing boilerplate as below to support both implementations:

    if (definition instanceof OfflineTilePyramidRegionDefinition) {
      OfflineTilePyramidRegionDefinition regionDefinition = (OfflineTilePyramidRegionDefinition) definition;
      styleUrl =  regionDefinition.getStyleURL();
      minZoom = regionDefinition.getMinZoom();
      maxZoom = regionDefinition.getMaxZoom();
      cameraPosition = new CameraPosition.Builder()
        .target(regionDefinition.getBounds().getCenter())
        .zoom(minZoom)
        .build();
    } else if (definition instanceof OfflineGeometryRegionDefinition) {
      OfflineGeometryRegionDefinition regionDefinition = (OfflineGeometryRegionDefinition) definition;
      styleUrl = regionDefinition.getStyleURL();
      minZoom = regionDefinition.getMinZoom();
      maxZoom = regionDefinition.getMaxZoom();
      cameraPosition = new CameraPosition.Builder()
        .target(regionDefinition.getBounds().getCenter())
        .zoom(minZoom)
        .build();
    }

I'm suggesting altering the OfflineRegionDefinition to include:

  • styleUrl
  • minZoom
  • maxZoom
  • initial camera position
  • ...
@tobrun tobrun added Android Mapbox Maps SDK for Android SEMVER-MAJOR Requires a major release according to Semantic Versioning rules labels Aug 21, 2018
@tobrun tobrun added this to the android-v7.0.0 milestone Aug 21, 2018
@tobrun tobrun removed this from the android-v7.0.0 milestone Sep 19, 2018
@tobrun tobrun modified the milestones: android-v6.7.0, android-v7.0.0 Oct 24, 2018
@tobrun
Copy link
Member Author

tobrun commented Oct 31, 2018

landed with #13237

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android SEMVER-MAJOR Requires a major release according to Semantic Versioning rules
Projects
None yet
Development

No branches or pull requests

2 participants