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

Minor tweaks to reverseZ code. #2961

Merged
merged 5 commits into from
Aug 23, 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 @@ -14,6 +14,7 @@ Change Log
* Added support for `GroundPrimitive` which works much like `Primitive` but it drapes the geometry over terrain. Valid geometries that can be draped on terrain are `CircleGeometry`, `CorridorGeometry`, `EllipseGeometry`, `PolygonGeometry`, and `RectangleGeometry`.
* Added `BoundingSphere.isOccluded` and `OrientedBoundingBox.isOccluded` to determine if the volumes are occluded by an `Occluder`.
* Added `distanceSquaredTo` and `computePlaneDistances` functions to `OrientedBoundingBox`.
* Added `reverseZ` tag to `UrlTemplateImageryProvider`.

### 1.12 - 2015-08-03

Expand Down
8 changes: 8 additions & 0 deletions Source/Scene/UrlTemplateImageryProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ define([
* <li><code>{s}</code>: One of the available subdomains, used to overcome browser limits on the number of simultaneous requests per host.</li>
* <li><code>{reverseX}</code>: The tile X coordinate in the tiling scheme, where 0 is the Easternmost tile.</li>
* <li><code>{reverseY}</code>: The tile Y coordinate in the tiling scheme, where 0 is the Southernmost tile.</li>
* <li><code>{reverseZ}</code>: The level of the tile in the tiling scheme, where level zero is the maximum level of the quadtree pyramid. In order to use reverseZ, maximumLevel must be defined.</li>
* <li><code>{westDegrees}</code>: The Western edge of the tile in geodetic degrees.</li>
* <li><code>{southDegrees}</code>: The Southern edge of the tile in geodetic degrees.</li>
* <li><code>{eastDegrees}</code>: The Eastern edge of the tile in geodetic degrees.</li>
Expand Down Expand Up @@ -201,6 +202,7 @@ define([
* <li> <code>{s}</code>: One of the available subdomains, used to overcome browser limits on the number of simultaneous requests per host.</li>
* <li> <code>{reverseX}</code>: The tile X coordinate in the tiling scheme, where 0 is the Easternmost tile.</li>
* <li> <code>{reverseY}</code>: The tile Y coordinate in the tiling scheme, where 0 is the Southernmost tile.</li>
* <li> <code>{reverseZ}</code>: The level of the tile in the tiling scheme, where level zero is the maximum level of the quadtree pyramid. In order to use reverseZ, maximumLevel must be defined.</li>
* <li> <code>{westDegrees}</code>: The Western edge of the tile in geodetic degrees.</li>
* <li> <code>{southDegrees}</code>: The Southern edge of the tile in geodetic degrees.</li>
* <li> <code>{eastDegrees}</code>: The Eastern edge of the tile in geodetic degrees.</li>
Expand Down Expand Up @@ -598,6 +600,11 @@ define([
return imageryProvider.tilingScheme.getNumberOfYTilesAtLevel(level) - y - 1;
}

function reverseZTag(imageryProvider, x, y, level) {
var maximumLevel = imageryProvider.maximumLevel;
return defined(maximumLevel) && level < maximumLevel ? maximumLevel - level - 1 : level;
}

function zTag(imageryProvider, x, y, level) {
return level;
}
Expand Down Expand Up @@ -777,6 +784,7 @@ define([
'{s}': sTag,
'{reverseX}': reverseXTag,
'{reverseY}': reverseYTag,
'{reverseZ}': reverseZTag,
'{westDegrees}': westDegreesTag,
'{southDegrees}': southDegreesTag,
'{eastDegrees}': eastDegreesTag,
Expand Down
9 changes: 5 additions & 4 deletions Specs/Scene/UrlTemplateImageryProviderSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,17 +223,18 @@ defineSuite([
});
});

it('evaluation of pattern X Y reverseX reverseY Z', function() {
it('evaluation of pattern X Y reverseX reverseY Z reverseZ', function() {
var provider = new UrlTemplateImageryProvider({
url: 'made/up/tms/server/{z}/{reverseY}/{y}/{reverseX}/{x}.PNG',
tilingScheme: new GeographicTilingScheme()
url: 'made/up/tms/server/{z}/{reverseZ}/{reverseY}/{y}/{reverseX}/{x}.PNG',
tilingScheme: new GeographicTilingScheme(),
maximumLevel: 6
});

return pollToPromise(function() {
return provider.ready;
}).then(function() {
spyOn(loadImage, 'createImage').and.callFake(function(url, crossOrigin, deferred) {
expect(url).toEqual('made/up/tms/server/2/2/1/4/3.PNG');
expect(url).toEqual('made/up/tms/server/2/3/2/1/4/3.PNG');

// Just return any old image.
loadImage.defaultCreateImage('Data/Images/Red16x16.png', crossOrigin, deferred);
Expand Down