Skip to content

Commit

Permalink
Merge pull request #1443 from AnalyticalGraphicsInc/bingHttps
Browse files Browse the repository at this point in the history
Use HTTPS for Bing services and tiles when the document is HTTPS.
  • Loading branch information
kring committed Feb 8, 2014
2 parents d587737 + a18b679 commit edc3667
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Apps/Sandcastle/gallery/Camera Tutorial.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@

// Bing Maps
var bing = new Cesium.BingMapsImageryProvider({
url : 'http://dev.virtualearth.net',
url : '//dev.virtualearth.net',
mapStyle : Cesium.BingMapsStyle.AERIAL,
// Some versions of Safari support WebGL, but don't correctly implement
// cross-origin image loading, so we need to load Bing imagery using a proxy.
Expand Down
2 changes: 1 addition & 1 deletion Apps/Sandcastle/gallery/Imagery Layers Manipulation.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
addBaseLayerOption(
'Bing Maps Road',
new Cesium.BingMapsImageryProvider({
url: 'http://dev.virtualearth.net',
url: '//dev.virtualearth.net',
mapStyle: Cesium.BingMapsStyle.ROAD,
// Some versions of Safari support WebGL, but don't correctly implement
// cross-origin image loading, so we need to load Bing imagery using a proxy.
Expand Down
5 changes: 3 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ Beta Releases
* Added `Intersections2D` class containing operations on 2D triangles.
* Fixed viewing an extent. [#1431](https://github.com/AnalyticalGraphicsInc/cesium/issues/1431)
* Use `performance.now()` instead of `Date.now()`, when available, to limit time spent loading terrain and imagery tiles. This results in more consistent frame rates while loading tiles on some systems.
* Added the ability for imagery providers to specify view-dependent attribution to be display in the `CreditDisplay`.
* View-dependent imagery source attribution is now added to the `CreditDisplay` by the `BingMapsImageryProvider`.
* Added the ability for imagery providers to specify view-dependent attribution to be display in the `CreditDisplay`.
* View-dependent imagery source attribution is now added to the `CreditDisplay` by the `BingMapsImageryProvider`.
* `BingMapsImageryProvider` now uses HTTPS by default for metadata and tiles when the document is loaded over HTTPS.

### b25 - 2014-02-03

Expand Down
12 changes: 12 additions & 0 deletions Source/Scene/BingMapsImageryProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ define([
* written to the console reminding you that you must create and supply a Bing Maps
* key as soon as possible. Please do not deploy an application that uses
* Bing Maps imagery without creating a separate key for your application.
* @param {String} [description.tileProtocol] The protocol to use when loading tiles, e.g. 'http:' or 'https:'.
* By default, tiles are loaded using the same protocol as the page.
* @param {Enumeration} [description.mapStyle=BingMapsStyle.AERIAL] The type of Bing Maps
* imagery to load.
* @param {TileDiscardPolicy} [description.tileDiscardPolicy] The policy that determines if a tile
Expand Down Expand Up @@ -93,6 +95,7 @@ define([
this._key = BingMapsApi.getKey(description.key);

this._url = description.url;
this._tileProtocol = description.tileProtocol;
this._mapStyle = defaultValue(description.mapStyle, BingMapsStyle.AERIAL);
this._tileDiscardPolicy = description.tileDiscardPolicy;
this._proxy = description.proxy;
Expand Down Expand Up @@ -140,6 +143,15 @@ define([
that._imageUrlSubdomains = resource.imageUrlSubdomains;
that._imageUrlTemplate = resource.imageUrl.replace('{culture}', '');

var tileProtocol = that._tileProtocol;
if (!defined(tileProtocol)) {
// use the document's protocol, unless it's not http or https
var documentProtocol = document.location.protocol;
tileProtocol = /^http/.test(documentProtocol) ? documentProtocol : 'http:';
}

that._imageUrlTemplate = that._imageUrlTemplate.replace(/^http:/, tileProtocol);

// Install the default tile discard policy if none has been supplied.
if (!defined(that._tileDiscardPolicy)) {
that._tileDiscardPolicy = new DiscardMissingTileImagePolicy({
Expand Down
6 changes: 3 additions & 3 deletions Source/Widgets/BaseLayerPicker/createDefaultBaseLayers.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ define([
tooltip : 'Bing Maps aerial imagery \nhttp://www.bing.com/maps',
creationFunction : function() {
return new BingMapsImageryProvider({
url : 'http://dev.virtualearth.net',
url : '//dev.virtualearth.net',
mapStyle : BingMapsStyle.AERIAL,
proxy : proxyIfNeeded
});
Expand All @@ -49,7 +49,7 @@ define([
tooltip : 'Bing Maps aerial imagery with label overlays \nhttp://www.bing.com/maps',
creationFunction : function() {
return new BingMapsImageryProvider({
url : 'http://dev.virtualearth.net',
url : '//dev.virtualearth.net',
mapStyle : BingMapsStyle.AERIAL_WITH_LABELS,
proxy : proxyIfNeeded
});
Expand All @@ -62,7 +62,7 @@ define([
tooltip : 'Bing Maps standard road maps\nhttp://www.bing.com/maps',
creationFunction : function() {
return new BingMapsImageryProvider({
url : 'http://dev.virtualearth.net',
url : '//dev.virtualearth.net',
mapStyle : BingMapsStyle.ROAD,
proxy : proxyIfNeeded
});
Expand Down
2 changes: 1 addition & 1 deletion Source/Widgets/CesiumWidget/CesiumWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ define([
var imageryProvider = options.imageryProvider;
if (!defined(imageryProvider)) {
imageryProvider = new BingMapsImageryProvider({
url : 'http://dev.virtualearth.net',
url : '//dev.virtualearth.net',
// Some versions of Safari support WebGL, but don't correctly implement
// cross-origin image loading, so we need to load Bing imagery using a proxy.
proxy: FeatureDetection.supportsCrossOriginImagery() ? undefined : new DefaultProxy('http://cesiumjs.org/proxy/')
Expand Down
2 changes: 1 addition & 1 deletion Source/Widgets/Geocoder/GeocoderViewModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ define([
}
//>>includeEnd('debug');

this._url = defaultValue(description.url, 'http://dev.virtualearth.net/');
this._url = defaultValue(description.url, '//dev.virtualearth.net/');
if (this._url.length > 0 && this._url[this._url.length - 1] !== '/') {
this._url += '/';
}
Expand Down

0 comments on commit edc3667

Please sign in to comment.