Skip to content

Commit

Permalink
Merge pull request #2961 from AnalyticalGraphicsInc/reverseZ
Browse files Browse the repository at this point in the history
Minor tweaks to reverseZ code.
  • Loading branch information
kring committed Aug 23, 2015
2 parents 3f439ee + 110f8c6 commit 294cb0c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
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

0 comments on commit 294cb0c

Please sign in to comment.