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
Feature/#725 #729
Feature/#725 #729
Conversation
…d of scroll) and the map orientation This is the first (slightly unrelated) step. Why should we use the map center instead of the scroll? Because when tilting the smartphone portrait-landscape-wise, the map center is kept only modulo the difference between `MapView`'s width and height. Impactes classes: * `OpenStreetMapConstants`: deprecated scroll preference tags, added latitude, longitude and orientation preference tags * `MapView`: added the concept of `IGeoPoint initCenter`, took it into account in method `myOnLayout`, added a no-force-redraw version of method `setMapOrientation` * `StarterMapFragment`: deprecated the use of scroll preferences tags, introduced the use of new preferences' tags (latitude, longitude, orientation), gently refactored in order to avoid Android Studio's nagging
…equired zoom level correctly This commit: * fixes the calculation of the zoom that matches a bounding box * adds Unit Tests for `TileSystem` * makes a more explicit demo Impact on existing classes: * `BoundingBox`: created method `getCenterWithDateLine` that takes into consideration the date line; deprecated `getCenter` * `MapView`: created method `zoomToBoundingBox` with an additional `borderSizeInPixels` parameter; modified previous method `zoomToBoundingBox` in order to use the new `zoomToBoundingBox` with 0 as border size; fixed the bounding box zoom calculation that is now testable and moved to `TileSystem.getBoundingBoxZoom` * `TileSystem`: created methods `getBoundingBoxZoom`, `getLongitudeZoom`, `getLatitudeZoom`, `getX01FromLongitude`and `getY01FromLatitude`; modified `LatLongToPixelXYMapSize` in order to take into account the new "XY01" methods; gently refactored javadoc version `6.0.0` to `5.6.6` * `SampleZoomToBounding`: made a more explicit test (which is accessed in "More Samples / Events / Zoom to Bounding Box" demo) New class: * `TileSystemTest`: created in order to test methods `getY01FromLatitude`, `getX01FromLongitude`, `LatLongToPixelXYMapSize` and `getBoundingBoxZoom`
Impact on existing classes: * OpenStreetMapViewTest: added random iterations; set zoom before center for decent results; added a +-1 tolerance because of my benevolence towards rounding; wrote a relevant test tag; removed commented and deprecated code
Impact on existing classes: * Bug445Caching: made the test less resource dependent by limiting max zoom level to 16 (cf. https://operations.osmfoundation.org/policies/tiles/: "[tiles at zoom levels 17 and higher] are generally not available (cached) on the server in advance, and have to be rendered specifically for those requests, putting an unjustified burden on the available resources"); gently refactoring javadoc from `6.0` to `5.6.6` * TileSystemTest: made the XY01 test stronger by checking [0,1]
New files: * 30 `.png` files corresponding to the tiles of the same place on the 30 zoom levels from 0 to 29. I had no way to compute real tiles for high zoom levels, therefore I created the "Abstract" source of tiles with simple colored .png where the zoom level is displayed. New classes: * `PointL`: like a `Point`, but with long instead of int * `ProjectionTest`: a unit test class for `Projection` * `RectL`: like a `Rect`, but with long instead of int * `SampleVeryHighZoomLevel`: a demo dedicated to high zoom levels, available in "More Samples / Tileproviders / Offline abstract tiles for zoom levels 0 to 29" Biggest impacts on existing classes: * `MapView`: used `PointL` and `RectL` types for Projected data; removed `initCenter`; added `GeoPoint mCenter`, `long mMapScrollX` and `mMapScrollY` and their setters/getters; overridden `scrollBy`; changed `scrollTo`; added `getMapScale` * `Projection`: created a new constructor without any reference to `MapView`; created `getOffspring` in order to compute a `Projection` from another (e.g. for `MinimapOverlay`); renamed methods for clarity; created _many_ methods * org.osmdroid.util.TileSystem: renamed methods for clarity; used `PointL` and `RectL` types for Mercator data; created _many_ methods Other impacted classes: * `CacheManager`: removed useless code that would have required refactoring * `GeometryMath`: refactored `DEG2RAD` / `RAD2DEG`; used `MyMath.floorToInt` instead of `(int)` for better handling of negative values; used simpler syntax on `Rect` for easier unit testing purposes * `GeoPoint`: created method `distanceToAsDouble` to go beyond the meter; used a distance calculation algorithm more precise for small distances; increased precision from float to double * `GeoPointTest`: create methods `test_distanceTo_itself`, `test_distanceTo_Equator`, `test_distanceTo_Equator_Smaller`, `test_distanceTo_Parallels`, `getCleanLongitudeDiff`, `getRandomLongitude`, `getRandomLatitude`; removed less relevant methods `test_distanceTo_zero`, `test_distanceTo_one`, test_distanceTo_one_degree` * `MapController`: changed animation methods according to the new scroll behavior * `MapTileProviderBase`: used `PointL` and `RectL` types for Mercator data * `Marker`: refactored the use of methods from `Projection` to `MapView` * `MathConstants`: increased precision from float to double * `MinimapOverlay`: relied more on inherited methods than on specific code * `MyLocationNewOverlay`: used `PointL` type for Projected data; using `double` instead of `int` zoom level; using new method `Projection.getPixelsFromProjected` * `MyMath`: created new methods `flootToLong` and `flootToInt` in order to fix a counter intuitive Java behavior * `OpenStreetMapViewTest`: unrelated light refactoring * `OsmBitmapShader`: used `PointL` type for Mercator data * `PathOverlay`: used `PointL` and `RectL` types for Projected data * `PathProjection`: used `PointL` type for Mercator data * `Polygon`: used `PointL` type for Projected data * `Polyline`: used `PointL` type for Projected data * `SampleAnimateTo`: changed slightly for testing reasons * `SampleFactory`: added new class `SampleVeryHighZoomLevel` * `SampleZoomToBounding`: unrelated light refactoring * `ScaleBarOverlay`: used more precise new method `GeoPoint.distanceToAsDouble`; handled double distances in method `scaleBarLengthText`; added helper method `getScaleString`; refactored the use of methods from `Projection` to `MapView` * `StarterMapFragment`: unrelated bug fix *** setInitCenter * `TileLooper`: used `RectL` type for Mercator data; slightly refactored * `TilesOverlay`: used `PointL` and `RectL` types for Mercator data; refactored `onTileReadyToDraw`; created `protected` methods `setCanvasRect`, `getCanvasRect`, `setProjection` and `getProjection` * `microsoft.mappoint.TileSystem`: used 64 instead of 32 as a limit parameter in `setTileSize`; introduced the notions of `primaryKeyMaxZoomLevel` and `projectionZoomLevel` * `TileSystemTest`: added `testGetLatitudeFromY01`, `testLatitude`, `testGetLongitudeFromX01`, `testLongitude`, `checkLatitude` and `checkLongitude`; removed `testLatLongToPixelXYMapSize`
* `SampleFactory`: added a reference to new demo `SampleVeryHighZoomLevel` * `TileSystem`: switched to `double` zoom level versions for methods `MapScale` and `GroundResolution` * `TileSystemMathTest`: moved to `TileSystemTest` methods `test_MapSize`, `test_groundResolution` and `test_groundMapScale` * `TileSystemTest`: moved from `TileSystemTest` methods `test_MapSize`, `test_groundResolution` and `test_groundMapScale`; improved their handling of high zoom levels
Impacts in `Polygon` class: * `mOriginalPoints` is now an array of `double`, no more `intE6` (but it's not related to the bug fixing) * new method `setCloserPoint`: the assumption is that 2 consecutive points should be as close as possible, therefore we add or subtract "the size of the world" if necessary
…om levels with/wo hardware acceleration With this fix, the `Polygon`s looks OK up to zoom 29. What remains to be done: * check with holes * same work on `Polyline` * low-zoom "best top-left version" of `Polygon` / `Polyline` Regarding this delivery... New classes: * `SegmentIntersection`: tools in order to compute the intersection between two 2D segments through `public` method `intersection` * `SegmentIntersectionTest`: unit tests on `SegmentIntersection` Impacted classes: * `PointL`: added overriden methods `toString` and `equals`; added methods `set` and `squareDistanceTo` * `Polygon`: modified method `buildPathPortion` in order to use less overflow prone `PointL` (instead of `Point`), to consider `Path` as a list of 2D segments, and to clip those segments into a min/max values square; added methods `clip`, `isInClipArea`, `intersection`, `lineTo` * `Projection`: added methods `getLongPixelsFromProjected`, `getLongPixelXFromMercator`, `getLongPixelYFromMercator` and `getLongPixelFromMercator` for overflow reasons; removed 2 unused imports
…m levels with/wo hardware acceleration : * check with holes * same work on `Polyline` * low-zoom "best top-left version" of `Polygon` / `Polyline` Regarding this delivery... New classes: * `Distance`: a tool class dedicated to the computation of 2D distances * `DistanceTest`: a Unit Test class dedicated to `Distance` * `LinearRing`: used to be an inner class in `Polygon` but needed to go out in order to be used by `Polyline` too; was enhanced too in order to match the new requirements and the new zoom level limit Impacted classes: * `PointL`: removed methods `squareDistanceTo` that are now more or less available in new dedicated class `Distance` * `Polygon`: moved `LinearRing` code to the new eponymous class; handled a common offset for the main polygon and the holes * `Polyline`: removed all the code that could now be handled by `LinearRing` * `Projection`: added parameter `pCloser` to method `getLongPixelsFromProjected`
@spyhunter99 The good news is that I've just fixed #725. |
I switched off my computer, switched it on, performed random tasks on git, and the conflicts disappeared. |
* mClipMax is now 17000 (instead of Integer.MAX_VALUE / 8) * mClipMin is now -mClipMax (instead of Integer.MIN_VALUE / 8)
…eue size": * added `ensureCapacity` in order to actually cache all tiles * added methods `getMaxTileExpected`, `getMinNumberExpected`, `getMaxNumberExpected`
…cceleration related path not displaying bugs: * `mClipMax` = 1400 * `mClipMin` = -600
Impacted classes: * `LinearRing`: used `List<RectL>` for segments instead of `List<PointL>` for both segments start and end points; added method `applyOffset`; changed `getBestOffset` so that it focuses on the smallest distance to the screen center rather than on the biggest common area with the screen rect; removed `getCommonArea` * `RectL`: added constructor `RectL(RectL other)` and method `set(RectL other)`
New class: * `SegmentClipper`: a tool to clip segments * `SegmentClipperTest`: a Unit Test class dedicated to `SegmentClipper` Impacted classes: * `LinearRing`: now has a constructor with a `Path` as a parameter; now implements `SegmentClipper.SegmentClippable`; moved clipping code to new class `SegmentClipper`; added parameter `boolean pClosePath` to method `getSegmentsFromProjected` as we cannot just use `path.close()` with the clipping process; remove parameter `boolean pClosePath` from method `getPathFromSegments` for the same reason ;) * `PointL`: added constructor `PointL(PointL other)` * `Polygon`: impacted the fact that `LinearRing`'s constructor now demands a `Path` * `Polyline`: impacted the fact that `LinearRing`'s constructor now demands a `Path` * `RectL`: added overridden methods `equals` and `hashCode`
No description provided.