Skip to content

Commit e4b3c75

Browse files
authoredMay 2, 2018
Merge pull request #6524 from wallw-bits/fix-projection-checks
Check projection instead of tiling scheme
2 parents ee522d7 + e3c7ca8 commit e4b3c75

7 files changed

+24
-17
lines changed
 

‎CHANGES.md

+1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ Change Log
6868
* Improved rendering of glTF models that don't contain normals with a temporary unlit shader workaround. [#6501](https://github.com/AnalyticalGraphicsInc/cesium/pull/6501)
6969
* Fixed rendering of glTF models with emissive-only materials. [#6501](https://github.com/AnalyticalGraphicsInc/cesium/pull/6501)
7070
* Fixed a bug in shader modification for glTF 1.0 quantized attributes and Draco quantized attributes. [#6523](https://github.com/AnalyticalGraphicsInc/cesium/pull/6523)
71+
* Fixed a bug causing custom TilingScheme classes to not be able to use a GeographicProjection. [#6524](https://github.com/AnalyticalGraphicsInc/cesium/pull/6524)
7172
7273
### 1.44 - 2018-04-02
7374

‎Source/Core/HeightmapTerrainData.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ define([
44
'./defined',
55
'./defineProperties',
66
'./DeveloperError',
7-
'./GeographicTilingScheme',
7+
'./GeographicProjection',
88
'./HeightmapTessellator',
99
'./Math',
1010
'./Rectangle',
@@ -18,7 +18,7 @@ define([
1818
defined,
1919
defineProperties,
2020
DeveloperError,
21-
GeographicTilingScheme,
21+
GeographicProjection,
2222
HeightmapTessellator,
2323
CesiumMath,
2424
Rectangle,
@@ -222,7 +222,7 @@ define([
222222
relativeToCenter : center,
223223
ellipsoid : ellipsoid,
224224
skirtHeight : this._skirtHeight,
225-
isGeographic : tilingScheme instanceof GeographicTilingScheme,
225+
isGeographic : tilingScheme.projection instanceof GeographicProjection,
226226
exaggeration : exaggeration
227227
});
228228

‎Source/Scene/ArcGisMapServerImageryProvider.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ define([
88
'../Core/defineProperties',
99
'../Core/DeveloperError',
1010
'../Core/Event',
11+
'../Core/GeographicProjection',
1112
'../Core/GeographicTilingScheme',
1213
'../Core/Math',
1314
'../Core/Rectangle',
@@ -30,6 +31,7 @@ define([
3031
defineProperties,
3132
DeveloperError,
3233
Event,
34+
GeographicProjection,
3335
GeographicTilingScheme,
3436
CesiumMath,
3537
Rectangle,
@@ -259,7 +261,7 @@ define([
259261
f: 'image'
260262
};
261263

262-
if (imageryProvider._tilingScheme instanceof GeographicTilingScheme) {
264+
if (imageryProvider._tilingScheme.projection instanceof GeographicProjection) {
263265
query.bboxSR = 4326;
264266
query.imageSR = 4326;
265267
} else {
@@ -622,7 +624,7 @@ define([
622624
var horizontal;
623625
var vertical;
624626
var sr;
625-
if (this._tilingScheme instanceof GeographicTilingScheme) {
627+
if (this._tilingScheme.projection instanceof GeographicProjection) {
626628
horizontal = CesiumMath.toDegrees(longitude);
627629
vertical = CesiumMath.toDegrees(latitude);
628630
sr = '4326';

‎Source/Scene/ImageryLayer.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ define([
77
'../Core/destroyObject',
88
'../Core/DeveloperError',
99
'../Core/FeatureDetection',
10+
'../Core/GeographicProjection',
1011
'../Core/GeographicTilingScheme',
1112
'../Core/IndexDatatype',
1213
'../Core/Math',
@@ -48,6 +49,7 @@ define([
4849
destroyObject,
4950
DeveloperError,
5051
FeatureDetection,
52+
GeographicProjection,
5153
GeographicTilingScheme,
5254
IndexDatatype,
5355
CesiumMath,
@@ -480,7 +482,7 @@ define([
480482
// Use Web Mercator for our texture coordinate computations if this imagery layer uses
481483
// that projection and the terrain tile falls entirely inside the valid bounds of the
482484
// projection.
483-
var useWebMercatorT = imageryProvider.tilingScheme instanceof WebMercatorTilingScheme &&
485+
var useWebMercatorT = imageryProvider.tilingScheme.projection instanceof WebMercatorProjection &&
484486
tile.rectangle.north < WebMercatorProjection.MaximumLatitude &&
485487
tile.rectangle.south > -WebMercatorProjection.MaximumLatitude;
486488

@@ -847,7 +849,7 @@ define([
847849
});
848850
}
849851

850-
if (imageryProvider.tilingScheme instanceof WebMercatorTilingScheme) {
852+
if (imageryProvider.tilingScheme.projection instanceof WebMercatorProjection) {
851853
imagery.textureWebMercator = texture;
852854
} else {
853855
imagery.texture = texture;
@@ -932,7 +934,7 @@ define([
932934
// avoids precision problems in the reprojection transformation while making
933935
// no noticeable difference in the georeferencing of the image.
934936
if (needGeographicProjection &&
935-
!(this._imageryProvider.tilingScheme instanceof GeographicTilingScheme) &&
937+
!(this._imageryProvider.tilingScheme.projection instanceof GeographicProjection) &&
936938
rectangle.width / texture.width > 1e-5) {
937939
var that = this;
938940
imagery.addReference();
@@ -1210,7 +1212,7 @@ define([
12101212
var imageryProvider = layer._imageryProvider;
12111213
var tilingScheme = imageryProvider.tilingScheme;
12121214
var ellipsoid = tilingScheme.ellipsoid;
1213-
var latitudeFactor = !(layer._imageryProvider.tilingScheme instanceof GeographicTilingScheme) ? Math.cos(latitudeClosestToEquator) : 1.0;
1215+
var latitudeFactor = !(layer._imageryProvider.tilingScheme.projection instanceof GeographicProjection) ? Math.cos(latitudeClosestToEquator) : 1.0;
12141216
var tilingSchemeRectangle = tilingScheme.rectangle;
12151217
var levelZeroMaximumTexelSpacing = ellipsoid.maximumRadius * tilingSchemeRectangle.width * latitudeFactor / (imageryProvider.tileWidth * tilingScheme.getNumberOfXTilesAtLevel(0));
12161218

‎Source/Scene/UrlTemplateImageryProvider.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ define([
99
'../Core/defineProperties',
1010
'../Core/DeveloperError',
1111
'../Core/Event',
12-
'../Core/GeographicTilingScheme',
12+
'../Core/GeographicProjection',
1313
'../Core/isArray',
1414
'../Core/Math',
1515
'../Core/Rectangle',
@@ -28,7 +28,7 @@ define([
2828
defineProperties,
2929
DeveloperError,
3030
Event,
31-
GeographicTilingScheme,
31+
GeographicProjection,
3232
isArray,
3333
CesiumMath,
3434
Rectangle,
@@ -961,7 +961,7 @@ define([
961961
return;
962962
}
963963

964-
if (imageryProvider.tilingScheme instanceof GeographicTilingScheme) {
964+
if (imageryProvider.tilingScheme.projection instanceof GeographicProjection) {
965965
longitudeLatitudeProjectedScratch.x = CesiumMath.toDegrees(longitude);
966966
longitudeLatitudeProjectedScratch.y = CesiumMath.toDegrees(latitude);
967967
} else {

‎Source/Scene/WebMapServiceImageryProvider.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ define([
66
'../Core/freezeObject',
77
'../Core/GeographicTilingScheme',
88
'../Core/Resource',
9-
'../Core/WebMercatorTilingScheme',
9+
'../Core/WebMercatorProjection',
1010
'./GetFeatureInfoFormat',
1111
'./UrlTemplateImageryProvider'
1212
], function(
@@ -17,7 +17,7 @@ define([
1717
freezeObject,
1818
GeographicTilingScheme,
1919
Resource,
20-
WebMercatorTilingScheme,
20+
WebMercatorProjection,
2121
GetFeatureInfoFormat,
2222
UrlTemplateImageryProvider) {
2323
'use strict';
@@ -118,10 +118,10 @@ define([
118118
// Use CRS with 1.3.0 and going forward.
119119
// For GeographicTilingScheme, use CRS:84 vice EPSG:4326 to specify lon, lat (x, y) ordering for
120120
// bbox requests.
121-
parameters.crs = defaultValue(options.crs, options.tilingScheme instanceof WebMercatorTilingScheme ? 'EPSG:3857' : 'CRS:84');
121+
parameters.crs = defaultValue(options.crs, options.tilingScheme && options.tilingScheme.projection instanceof WebMercatorProjection ? 'EPSG:3857' : 'CRS:84');
122122
} else {
123123
// SRS for WMS 1.1.0 or 1.1.1.
124-
parameters.srs = defaultValue(options.srs, options.tilingScheme instanceof WebMercatorTilingScheme ? 'EPSG:3857' : 'EPSG:4326');
124+
parameters.srs = defaultValue(options.srs, options.tilingScheme && options.tilingScheme.projection instanceof WebMercatorProjection ? 'EPSG:3857' : 'EPSG:4326');
125125
}
126126

127127
resource.setQueryParameters(parameters, true);

‎Source/Scene/createTileMapServiceImageryProvider.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ define([
44
'../Core/defaultValue',
55
'../Core/defined',
66
'../Core/DeveloperError',
7+
'../Core/GeographicProjection',
78
'../Core/GeographicTilingScheme',
89
'../Core/Rectangle',
910
'../Core/Resource',
@@ -18,6 +19,7 @@ define([
1819
defaultValue,
1920
defined,
2021
DeveloperError,
22+
GeographicProjection,
2123
GeographicTilingScheme,
2224
Rectangle,
2325
Resource,
@@ -198,7 +200,7 @@ define([
198200
// 'global-mercator' and 'global-geodetic' profiles. In the gdal2Tiles case, X and Y are always in
199201
// geodetic degrees.
200202
var isGdal2tiles = tilingSchemeName === 'geodetic' || tilingSchemeName === 'mercator';
201-
if (tilingScheme instanceof GeographicTilingScheme || isGdal2tiles) {
203+
if (tilingScheme.projection instanceof GeographicProjection || isGdal2tiles) {
202204
sw = Cartographic.fromDegrees(swXY.x, swXY.y);
203205
ne = Cartographic.fromDegrees(neXY.x, neXY.y);
204206
} else {

0 commit comments

Comments
 (0)
Please sign in to comment.