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

Check projection instead of tiling scheme #6524

Merged
merged 3 commits into from
May 2, 2018
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 @@ -56,6 +56,7 @@ Change Log
* Improved rendering of glTF models that don't contain normals with a temporary unlit shader workaround. [#6501](https://github.com/AnalyticalGraphicsInc/cesium/pull/6501)
* Fixed rendering of glTF models with emissive-only materials. [#6501](https://github.com/AnalyticalGraphicsInc/cesium/pull/6501)
* Fixed a bug in shader modification for glTF 1.0 quantized attributes and Draco quantized attributes. [#6523](https://github.com/AnalyticalGraphicsInc/cesium/pull/6523)
* Fixed a bug causing custom TilingScheme classes to not be able to use a GeographicProjection. [#6524](https://github.com/AnalyticalGraphicsInc/cesium/pull/6524)

### 1.44 - 2018-04-02

Expand Down
6 changes: 3 additions & 3 deletions Source/Core/HeightmapTerrainData.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ define([
'./defined',
'./defineProperties',
'./DeveloperError',
'./GeographicTilingScheme',
'./GeographicProjection',
'./HeightmapTessellator',
'./Math',
'./Rectangle',
Expand All @@ -18,7 +18,7 @@ define([
defined,
defineProperties,
DeveloperError,
GeographicTilingScheme,
GeographicProjection,
HeightmapTessellator,
CesiumMath,
Rectangle,
Expand Down Expand Up @@ -222,7 +222,7 @@ define([
relativeToCenter : center,
ellipsoid : ellipsoid,
skirtHeight : this._skirtHeight,
isGeographic : tilingScheme instanceof GeographicTilingScheme,
isGeographic : tilingScheme.projection instanceof GeographicProjection,
exaggeration : exaggeration
});

Expand Down
6 changes: 4 additions & 2 deletions Source/Scene/ArcGisMapServerImageryProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ define([
'../Core/defineProperties',
'../Core/DeveloperError',
'../Core/Event',
'../Core/GeographicProjection',
'../Core/GeographicTilingScheme',
'../Core/Math',
'../Core/Rectangle',
Expand All @@ -30,6 +31,7 @@ define([
defineProperties,
DeveloperError,
Event,
GeographicProjection,
GeographicTilingScheme,
CesiumMath,
Rectangle,
Expand Down Expand Up @@ -259,7 +261,7 @@ define([
f: 'image'
};

if (imageryProvider._tilingScheme instanceof GeographicTilingScheme) {
if (imageryProvider._tilingScheme.projection instanceof GeographicProjection) {
query.bboxSR = 4326;
query.imageSR = 4326;
} else {
Expand Down Expand Up @@ -622,7 +624,7 @@ define([
var horizontal;
var vertical;
var sr;
if (this._tilingScheme instanceof GeographicTilingScheme) {
if (this._tilingScheme.projection instanceof GeographicProjection) {
horizontal = CesiumMath.toDegrees(longitude);
vertical = CesiumMath.toDegrees(latitude);
sr = '4326';
Expand Down
10 changes: 6 additions & 4 deletions Source/Scene/ImageryLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ define([
'../Core/destroyObject',
'../Core/DeveloperError',
'../Core/FeatureDetection',
'../Core/GeographicProjection',
'../Core/GeographicTilingScheme',
'../Core/IndexDatatype',
'../Core/Math',
Expand Down Expand Up @@ -48,6 +49,7 @@ define([
destroyObject,
DeveloperError,
FeatureDetection,
GeographicProjection,
GeographicTilingScheme,
IndexDatatype,
CesiumMath,
Expand Down Expand Up @@ -480,7 +482,7 @@ define([
// Use Web Mercator for our texture coordinate computations if this imagery layer uses
// that projection and the terrain tile falls entirely inside the valid bounds of the
// projection.
var useWebMercatorT = imageryProvider.tilingScheme instanceof WebMercatorTilingScheme &&
var useWebMercatorT = imageryProvider.tilingScheme.projection instanceof WebMercatorProjection &&
tile.rectangle.north < WebMercatorProjection.MaximumLatitude &&
tile.rectangle.south > -WebMercatorProjection.MaximumLatitude;

Expand Down Expand Up @@ -847,7 +849,7 @@ define([
});
}

if (imageryProvider.tilingScheme instanceof WebMercatorTilingScheme) {
if (imageryProvider.tilingScheme.projection instanceof WebMercatorProjection) {
imagery.textureWebMercator = texture;
} else {
imagery.texture = texture;
Expand Down Expand Up @@ -932,7 +934,7 @@ define([
// avoids precision problems in the reprojection transformation while making
// no noticeable difference in the georeferencing of the image.
if (needGeographicProjection &&
!(this._imageryProvider.tilingScheme instanceof GeographicTilingScheme) &&
!(this._imageryProvider.tilingScheme.projection instanceof GeographicProjection) &&
rectangle.width / texture.width > 1e-5) {
var that = this;
imagery.addReference();
Expand Down Expand Up @@ -1210,7 +1212,7 @@ define([
var imageryProvider = layer._imageryProvider;
var tilingScheme = imageryProvider.tilingScheme;
var ellipsoid = tilingScheme.ellipsoid;
var latitudeFactor = !(layer._imageryProvider.tilingScheme instanceof GeographicTilingScheme) ? Math.cos(latitudeClosestToEquator) : 1.0;
var latitudeFactor = !(layer._imageryProvider.tilingScheme.projection instanceof GeographicProjection) ? Math.cos(latitudeClosestToEquator) : 1.0;
var tilingSchemeRectangle = tilingScheme.rectangle;
var levelZeroMaximumTexelSpacing = ellipsoid.maximumRadius * tilingSchemeRectangle.width * latitudeFactor / (imageryProvider.tileWidth * tilingScheme.getNumberOfXTilesAtLevel(0));

Expand Down
6 changes: 3 additions & 3 deletions Source/Scene/UrlTemplateImageryProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ define([
'../Core/defineProperties',
'../Core/DeveloperError',
'../Core/Event',
'../Core/GeographicTilingScheme',
'../Core/GeographicProjection',
'../Core/isArray',
'../Core/Math',
'../Core/Rectangle',
Expand All @@ -28,7 +28,7 @@ define([
defineProperties,
DeveloperError,
Event,
GeographicTilingScheme,
GeographicProjection,
isArray,
CesiumMath,
Rectangle,
Expand Down Expand Up @@ -961,7 +961,7 @@ define([
return;
}

if (imageryProvider.tilingScheme instanceof GeographicTilingScheme) {
if (imageryProvider.tilingScheme.projection instanceof GeographicProjection) {
longitudeLatitudeProjectedScratch.x = CesiumMath.toDegrees(longitude);
longitudeLatitudeProjectedScratch.y = CesiumMath.toDegrees(latitude);
} else {
Expand Down
8 changes: 4 additions & 4 deletions Source/Scene/WebMapServiceImageryProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ define([
'../Core/freezeObject',
'../Core/GeographicTilingScheme',
'../Core/Resource',
'../Core/WebMercatorTilingScheme',
'../Core/WebMercatorProjection',
'./GetFeatureInfoFormat',
'./UrlTemplateImageryProvider'
], function(
Expand All @@ -17,7 +17,7 @@ define([
freezeObject,
GeographicTilingScheme,
Resource,
WebMercatorTilingScheme,
WebMercatorProjection,
GetFeatureInfoFormat,
UrlTemplateImageryProvider) {
'use strict';
Expand Down Expand Up @@ -118,10 +118,10 @@ define([
// Use CRS with 1.3.0 and going forward.
// For GeographicTilingScheme, use CRS:84 vice EPSG:4326 to specify lon, lat (x, y) ordering for
// bbox requests.
parameters.crs = defaultValue(options.crs, options.tilingScheme instanceof WebMercatorTilingScheme ? 'EPSG:3857' : 'CRS:84');
parameters.crs = defaultValue(options.crs, options.tilingScheme && options.tilingScheme.projection instanceof WebMercatorProjection ? 'EPSG:3857' : 'CRS:84');
} else {
// SRS for WMS 1.1.0 or 1.1.1.
parameters.srs = defaultValue(options.srs, options.tilingScheme instanceof WebMercatorTilingScheme ? 'EPSG:3857' : 'EPSG:4326');
parameters.srs = defaultValue(options.srs, options.tilingScheme && options.tilingScheme.projection instanceof WebMercatorProjection ? 'EPSG:3857' : 'EPSG:4326');
}

resource.setQueryParameters(parameters, true);
Expand Down
4 changes: 3 additions & 1 deletion Source/Scene/createTileMapServiceImageryProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ define([
'../Core/defaultValue',
'../Core/defined',
'../Core/DeveloperError',
'../Core/GeographicProjection',
'../Core/GeographicTilingScheme',
'../Core/Rectangle',
'../Core/Resource',
Expand All @@ -18,6 +19,7 @@ define([
defaultValue,
defined,
DeveloperError,
GeographicProjection,
GeographicTilingScheme,
Rectangle,
Resource,
Expand Down Expand Up @@ -198,7 +200,7 @@ define([
// 'global-mercator' and 'global-geodetic' profiles. In the gdal2Tiles case, X and Y are always in
// geodetic degrees.
var isGdal2tiles = tilingSchemeName === 'geodetic' || tilingSchemeName === 'mercator';
if (tilingScheme instanceof GeographicTilingScheme || isGdal2tiles) {
if (tilingScheme.projection instanceof GeographicProjection || isGdal2tiles) {
sw = Cartographic.fromDegrees(swXY.x, swXY.y);
ne = Cartographic.fromDegrees(neXY.x, neXY.y);
} else {
Expand Down