Skip to content

Commit

Permalink
Merge pull request #3038 from oterral/multiurl
Browse files Browse the repository at this point in the history
Use all url templates provided by terrain config file
  • Loading branch information
kring committed Sep 22, 2015
2 parents 0836231 + 11613e0 commit bcbdc7a
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 2 deletions.
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}"
]
}

0 comments on commit bcbdc7a

Please sign in to comment.