Skip to content

Commit

Permalink
Use all url templates provided by terrain config file
Browse files Browse the repository at this point in the history
  • Loading branch information
Kogis IWI committed Sep 18, 2015
1 parent 0836231 commit 3345721
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.ch');
provider.requestTileGeometry(1, 0, 0);
expect(loadWithXhr.load.calls.mostRecent().args[0]).toContain('foo1.ch');
provider.requestTileGeometry(1, 1, 0);
expect(loadWithXhr.load.calls.mostRecent().args[0]).toContain('foo2.ch');
provider.requestTileGeometry(1, 1, 1);
expect(loadWithXhr.load.calls.mostRecent().args[0]).toContain('foo3.ch');
});
});

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 3345721

Please sign in to comment.