Skip to content
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

Use all url templates provided by terrain config file #3038

Merged
merged 1 commit into from
Sep 22, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Change Log
* Added a workaround for Chrome 45, where the first character in a label with a small font size would not appear. [#3011](https://github.com/AnalyticalGraphicsInc/cesium/pull/3011)
* Fixed issues causing the terrain and sky to disappear when the camera is near the surface. [#2415](https://github.com/AnalyticalGraphicsInc/cesium/issues/2415) and [#2271](https://github.com/AnalyticalGraphicsInc/cesium/issues/2271)
* Changed the `ScreenSpaceCameraController.minimumZoomDistance` default from `20.0` to `1.0`.
* Used all the template urls defined in the CesiumTerrain provider.[#3038](https://github.com/AnalyticalGraphicsInc/cesium/pull/3038)

### 1.13 - 2015-09-01

Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,6 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
* [Stéphane Lozier](https://github.com/slozier)
* [Adam Cole](https://github.com/adamdavidcole)
* [Tiffany Lu](https://github.com/tiffanylu)
* [Olivier Terral](https://github.com/oterral)

Also see [our contributors page](http://cesiumjs.org/contributors.html) for more information.
3 changes: 1 addition & 2 deletions Source/Core/CesiumTerrainProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -494,8 +494,7 @@ define([

var tmsY = (yTiles - y - 1);

// Use the first URL template. In the future we should use them all.
var url = urlTemplates[0].replace('{z}', level).replace('{x}', x).replace('{y}', tmsY);
var url = urlTemplates[(x + tmsY + level) % urlTemplates.length].replace('{z}', level).replace('{x}', x).replace('{y}', tmsY);

var proxy = this._proxy;
if (defined(proxy)) {
Expand Down
23 changes: 23 additions & 0 deletions Specs/Core/CesiumTerrainProviderSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,29 @@ defineSuite([
});

describe('requestTileGeometry', function() {

it('uses multiple urls specified in layer.json', function() {
returnTileJson('Data/CesiumTerrainTileJson/MultipleUrls.tile.json');

var provider = new CesiumTerrainProvider({
url : 'made/up/url'
});

return pollToPromise(function() {
return provider.ready;
}).then(function() {
spyOn(loadWithXhr, 'load');
provider.requestTileGeometry(0, 0, 0);
expect(loadWithXhr.load.calls.mostRecent().args[0]).toContain('foo0.com');
provider.requestTileGeometry(1, 0, 0);
expect(loadWithXhr.load.calls.mostRecent().args[0]).toContain('foo1.com');
provider.requestTileGeometry(1, -1, 0);
expect(loadWithXhr.load.calls.mostRecent().args[0]).toContain('foo2.com');
provider.requestTileGeometry(1, 0, 1);
expect(loadWithXhr.load.calls.mostRecent().args[0]).toContain('foo3.com');
});
});

it('uses the proxy if one is supplied', function() {
var baseUrl = 'made/up/url';

Expand Down
12 changes: 12 additions & 0 deletions Specs/Data/CesiumTerrainTileJson/MultipleUrls.tile.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"tilejson": "2.1.0",
"format" : "heightmap-1.0",
"version" : "1.0.0",
"scheme" : "tms",
"tiles" : [
"//foo0.com/bar/{z}/{x}/{y}.terrain?v={version}",
"//foo1.com/bar/{z}/{x}/{y}.terrain?v={version}",
"//foo2.com/bar/{z}/{x}/{y}.terrain?v={version}",
"//foo3.com/bar/{z}/{x}/{y}.terrain?v={version}"
]
}