diff options
author | Paolo Angelelli <paolo.angelelli@qt.io> | 2016-12-02 18:18:23 +0100 |
---|---|---|
committer | Paolo Angelelli <paolo.angelelli@qt.io> | 2017-01-16 16:18:23 +0000 |
commit | 45b1f2c23cf0e782c0b99f38e4d01a88da765753 (patch) | |
tree | 1bfe5d5706db94722b3956ac17b65897b2370d30 /tests/auto/declarative_ui/tst_map.qml | |
parent | 5504a4c00ec01fdbc95a862c9bc63a680095daee (diff) | |
download | qtlocation-45b1f2c23cf0e782c0b99f38e4d01a88da765753.tar.gz |
Make zoomLevel refer to a default 256^2 tile size
Currently the zoomLevel is the power of 2 reflecting how many tiles
are in a map edge.
This means that two plugins with two different tileSize will show a
map of different size at the same zoomLevel.
With this patch the zoomLevel is "normalized" upon a tileSize of 256,
regardless of the tile size in use.
In this way, the new 256 based zoom level can be a consistent parameter
also for plugins that are not tile based.
CameraCapabilities therefore now offers two new methods,
m[in,ax]imumZoomLevelAt256, that return the respective value for
the normalized 256^2 tilesize.
It also gets a setTileSize, which is currently not used as all our
plugins use a tile size of 256 (which is the camera capabilities
default tilesize value).
Change-Id: Ib12092fd14faf7fc85f8be5fb799dbd5496b760b
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'tests/auto/declarative_ui/tst_map.qml')
-rw-r--r-- | tests/auto/declarative_ui/tst_map.qml | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/tests/auto/declarative_ui/tst_map.qml b/tests/auto/declarative_ui/tst_map.qml index a81885fb..998a06d4 100644 --- a/tests/auto/declarative_ui/tst_map.qml +++ b/tests/auto/declarative_ui/tst_map.qml @@ -79,6 +79,8 @@ Item { Map {id: map; plugin: testPlugin; center: coordinate1; width: 100; height: 100} SignalSpy {id: mapCenterSpy; target: map; signalName: 'centerChanged'} + Map {id: mapPar; plugin: testPlugin; center: coordinate1; width: 512; height: 512} + Map {id: coordinateMap; plugin: herePlugin; center: coordinate3; width: 1000; height: 1000; zoomLevel: 15 } @@ -135,46 +137,46 @@ Item { function test_map_parameters() { // coordinate is set at map element declaration - var center = map.toCoordinate(Qt.point((map.width - 1) / 2.0, (map.height - 1) / 2.0)) + var center = mapPar.toCoordinate(Qt.point((mapPar.width - 1) / 2.0, (mapPar.height - 1) / 2.0)) fuzzyCompare(center.latitude, 10, 0.1) fuzzyCompare(center.longitude, 11, 0.1) - compare(map.mapParameters.length, 0) + compare(mapPar.mapParameters.length, 0) - map.addMapParameter(testParameter) + mapPar.addMapParameter(testParameter) - compare(map.mapParameters.length, 1) + compare(mapPar.mapParameters.length, 1) - center = map.toCoordinate(Qt.point((map.width - 1) / 2.0, (map.height - 1) / 2.0)) + center = mapPar.toCoordinate(Qt.point((mapPar.width - 1) / 2.0, (mapPar.height - 1) / 2.0)) fuzzyCompare(center.latitude, -33, 0.1) fuzzyCompare(center.longitude, -47, 0.1) - map.addMapParameter(testParameter) - compare(map.mapParameters.length, 1) + mapPar.addMapParameter(testParameter) + compare(mapPar.mapParameters.length, 1) - map.removeMapParameter(testParameter) - compare(map.mapParameters.length, 0) + mapPar.removeMapParameter(testParameter) + compare(mapPar.mapParameters.length, 0) - center = map.toCoordinate(Qt.point((map.width - 1) / 2.0, (map.height - 1) / 2.0)) + center = mapPar.toCoordinate(Qt.point((mapPar.width - 1) / 2.0, (mapPar.height - 1) / 2.0)) fuzzyCompare(center.latitude, -33, 0.1) fuzzyCompare(center.longitude, -47, 0.1) - testParameter.center = map.center - map.addMapParameter(testParameter) - compare(map.mapParameters.length, 1) + testParameter.center = mapPar.center + mapPar.addMapParameter(testParameter) + compare(mapPar.mapParameters.length, 1) - var center = map.toCoordinate(Qt.point((map.width - 1) / 2.0, (map.height - 1) / 2.0)) + var center = mapPar.toCoordinate(Qt.point((mapPar.width - 1) / 2.0, (mapPar.height - 1) / 2.0)) fuzzyCompare(center.latitude, 10, 0.1) fuzzyCompare(center.longitude, 11, 0.1) testParameter.center = QtPositioning.coordinate(-33.0, -47.0) - center = map.toCoordinate(Qt.point((map.width - 1) / 2.0, (map.height - 1) / 2.0)) + center = mapPar.toCoordinate(Qt.point((mapPar.width - 1) / 2.0, (mapPar.height - 1) / 2.0)) fuzzyCompare(center.latitude, -33, 0.1) fuzzyCompare(center.longitude, -47, 0.1) - map.removeMapParameter(testParameter) - compare(map.mapParameters.length, 0) + mapPar.removeMapParameter(testParameter) + compare(mapPar.mapParameters.length, 0) } function test_map_clamp() |