Skip to content

Commit

Permalink
Merge branch 'master' into pick-ray-2
Browse files Browse the repository at this point in the history
  • Loading branch information
lilleyse committed Sep 13, 2018
2 parents 3001c5b + d5f1337 commit e111e3f
Show file tree
Hide file tree
Showing 39 changed files with 2,135 additions and 1,924 deletions.
87 changes: 87 additions & 0 deletions Apps/Sandcastle/gallery/Cartographic Limit Rectangle.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<meta name="description" content="Limit terrain and imagery to a cartographic Rectangle area.">
<meta name="cesium-sandcastle-labels" content="Showcases">
<title>Cesium Demo</title>
<script type="text/javascript" src="../Sandcastle-header.js"></script>
<script type="text/javascript" src="../../../ThirdParty/requirejs-2.1.20/require.js"></script>
<script type="text/javascript">
if(typeof require === 'function') {
require.config({
baseUrl : '../../../Source',
waitSeconds : 120
});
}
</script>
</head>
<body class="sandcastle-loading" data-sandcastle-bucket="bucket-requirejs.html">
<style>
@import url(../templates/bucket.css);
</style>
<div id="cesiumContainer" class="fullSize"></div>
<div id="loadingOverlay"><h1>Loading...</h1></div>
<div id="toolbar"></div>
<script id="cesium_sandcastle_script">
function startup(Cesium) {
'use strict';
//Sandcastle_Begin
var viewer = new Cesium.Viewer('cesiumContainer', {
terrainProvider: Cesium.createWorldTerrain()
});

// Tropics of Cancer and Capricorn
var coffeeBeltRectangle = Cesium.Rectangle.fromDegrees(-180.0, -23.43687, 180.0, 23.43687);

viewer.scene.globe.cartographicLimitRectangle = coffeeBeltRectangle;
viewer.scene.skyAtmosphere.show = false;

// Add rectangles to show bounds
var rectangles = [];

for (var i = 0; i < 10; i++) {
rectangles.push(viewer.entities.add({
rectangle : {
coordinates : coffeeBeltRectangle,
material : Cesium.Color.WHITE.withAlpha(0.0),
height : i * 5000.0,
outline : true,
outlineWidth : 4.0,
outlineColor : Cesium.Color.WHITE
}
}));
}

Sandcastle.addToolbarButton('Show/Hide Bounds', function() {
var rectanglesLength = rectangles.length;
for (var i = 0; i < rectanglesLength; i++) {
var rectangleEntity = rectangles[i];
rectangleEntity.show = !rectangleEntity.show;
}
});

var limited = true;
Sandcastle.addToolbarButton('Enable/Disable Limiter', function() {
if (limited) {
viewer.scene.globe.cartographicLimitRectangle = Cesium.Rectangle.MAX_VALUE;
limited = false;
} else {
viewer.scene.globe.cartographicLimitRectangle = coffeeBeltRectangle;
limited = true;
}
});

//Sandcastle_End
Sandcastle.finishedLoading();
}
if (typeof Cesium !== 'undefined') {
startup(Cesium);
} else if (typeof require === 'function') {
require(['Cesium'], startup);
}
</script>
</body>
</html>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 10 additions & 4 deletions Apps/Sandcastle/gallery/Terrain.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
<script type="text/javascript" src="../Sandcastle-header.js"></script>
<script type="text/javascript" src="../../../ThirdParty/requirejs-2.1.20/require.js"></script>
<script type="text/javascript">
require.config({
baseUrl : '../../../Source',
waitSeconds : 60
});
if(typeof require === 'function') {
require.config({
baseUrl : '../../../Source',
waitSeconds : 120
});
}
</script>
</head>
<body class="sandcastle-loading" data-sandcastle-bucket="bucket-requirejs.html">
Expand Down Expand Up @@ -191,6 +193,10 @@
}, 'sampleButtons');

Sandcastle.addToolbarButton('Sample Most Detailed Everest Terrain', function() {
if (!Cesium.defined(viewer.terrainProvider.availability)) {
console.log('sampleTerrainMostDetailed is not supported for the selected terrain provider');
return;
}
var terrainSamplePositions = createGrid(0.0005);
Cesium.when(Cesium.sampleTerrainMostDetailed(viewer.terrainProvider, terrainSamplePositions), sampleTerrainSuccess);
lookAtMtEverest();
Expand Down
10 changes: 10 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
Change Log
==========

### 1.50 - 2018-10-01

##### Additions :tada:
* Added `cartographicLimitRectangle` to `Globe`. Use this to limit terrain and imagery to a specific `Rectangle` area. [#6987](https://github.com/AnalyticalGraphicsInc/cesium/pull/6987)
* Added `OpenCageGeocoderService`, which provides geocoding via [OpenCage](https://opencagedata.com/). [#7015](https://github.com/AnalyticalGraphicsInc/cesium/pull/7015)

##### Fixes :wrench:
* Fixed an issue in the 3D Tiles traversal where empty tiles would be selected instead of their nearest loaded ancestors. [#7011](https://github.com/AnalyticalGraphicsInc/cesium/pull/7011)
* Fixed bug where credits weren't displaying correctly if more than one viewer was initialized [#6965](expect(https://github.com/AnalyticalGraphicsInc/cesium/issues/6965)

### 1.49 - 2018-09-04

##### Breaking Changes :mega:
Expand Down
2 changes: 2 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
* [Jeremy Marzano](https://github.com/JeremyMarzano-ISPA/)
* [Orbit Logic](http://www.orbitlogic.com)
* [Roderick Green](https://github.com/roderickgreen/)
* [Hexastack](https://www.hexastack.com)
* [Mohamed Marrouchi](https://github.com/marrouchi/)

## [Individual CLA](Documentation/Contributors/CLAs/individual-cla-agi-v1.0.txt)
* [Victor Berchet](https://github.com/vicb)
Expand Down
39 changes: 18 additions & 21 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -746,33 +746,30 @@ https://github.com/google/draco
>License for the specific language governing permissions and limitations under
>the License.
### JSXSS
### DOMPUrify

https://github.com/leizongmin/js-xss
https://github.com/cure53/DOMPurify

> Copyright (c) 2012-2017 Zongmin Lei(雷宗民) <[email protected]>
> http://ucdok.com
>DOMPurify
>Copyright 2015 Mario Heiderich
>
> The MIT License
>DOMPurify is free software; you can redistribute it and/or modify it under the
>terms of either:
>
> Permission is hereby granted, free of charge, to any person obtaining
> a copy of this software and associated documentation files (the
> "Software"), to deal in the Software without restriction, including
> without limitation the rights to use, copy, modify, merge, publish,
> distribute, sublicense, and/or sell copies of the Software, and to
> permit persons to whom the Software is furnished to do so, subject to
> the following conditions:
>a) the Apache License Version 2.0, or
>b) the Mozilla Public License Version 2.0
>
> The above copyright notice and this permission notice shall be
> included in all copies or substantial portions of the Software.
>Licensed under the Apache License, Version 2.0 (the "License");
>you may not use this file except in compliance with the License.
>You may obtain a copy of the License at
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
> LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
> OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
> WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
> http://www.apache.org/licenses/LICENSE-2.0
>
> Unless required by applicable law or agreed to in writing, software
> distributed under the License is distributed on an "AS IS" BASIS,
> WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> See the License for the specific language governing permissions and
> limitations under the License.
Tests
=====
Expand Down
31 changes: 24 additions & 7 deletions Source/Core/Credit.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,38 @@
define([
'../ThirdParty/xss',
'../ThirdParty/purify',
'./defaultValue',
'./defined',
'./defineProperties'
'./defineProperties',
'./Check'
], function(
xss,
DOMPurify,
defaultValue,
defined,
defineProperties) {
defineProperties,
Check) {
'use strict';

var nextCreditId = 0;
var creditToId = {};

/**
* A credit contains data pertaining to how to display attributions/credits for certain content on the screen.
* @param {String} html An string representing an html code snippet (can be text only)
* @param {String} html An string representing an html code snippet
* @param {Boolean} [showOnScreen=false] If true, the credit will be visible in the main credit container. Otherwise, it will appear in a popover
*
* @alias Credit
* @constructor
*
* @exception {DeveloperError} options.text, options.imageUrl, or options.link is required.
* @exception {DeveloperError} html is required.
*
* @example
* //Create a credit with a tooltip, image and link
* var credit = new Cesium.Credit('<a href="https://cesiumjs.org/" target="_blank"><img src="/images/cesium_logo.png" title="Cesium"/></a>');
*/
function Credit(html, showOnScreen) {
//>>includeStart('debug', pragmas.debug);
Check.typeOf.string('html', html);
//>>includeEnd('debug');
var id;
var key = html;

Expand Down Expand Up @@ -94,7 +99,7 @@ define([
element: {
get: function() {
if (!defined(this._element)) {
var html = xss(this._html);
var html = DOMPurify.sanitize(this._html);

var div = document.createElement('div');
div._creditId = this._id;
Expand Down Expand Up @@ -150,5 +155,17 @@ define([
return credit;
};

/**
* Duplicates a Credit instance.
*
* @param {Credit} [credit] The Credit to duplicate.
* @returns {Credit} A new Credit instance that is a duplicate of the one provided. (Returns undefined if the credit is undefined)
*/
Credit.clone = function(credit) {
if (defined(credit)) {
return new Credit(credit.html, credit.showOnScreen);
}
};

return Credit;
});
1 change: 1 addition & 0 deletions Source/Core/GeocoderService.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ define([
*
* @see BingMapsGeocoderService
* @see PeliasGeocoderService
* @see OpenCageGeocoderService
*/
function GeocoderService() {
}
Expand Down
4 changes: 3 additions & 1 deletion Source/Core/IonGeocoderService.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
define([
'./Check',
'./Credit',
'./defaultValue',
'./defined',
'./defineProperties',
Expand All @@ -9,6 +10,7 @@ define([
'./Resource'
], function (
Check,
Credit,
defaultValue,
defined,
defineProperties,
Expand Down Expand Up @@ -44,7 +46,7 @@ define([

var defaultTokenCredit = Ion.getDefaultTokenCredit(accessToken);
if (defined(defaultTokenCredit)) {
options.scene.frameState.creditDisplay.addDefaultCredit(defaultTokenCredit);
options.scene.frameState.creditDisplay.addDefaultCredit(Credit.clone(defaultTokenCredit));
}

var searchEndpoint = server.getDerivedResource({
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/IonResource.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ define([
var credits = endpoint.attributions.map(Credit.getIonCredit);
var defaultTokenCredit = Ion.getDefaultTokenCredit(endpointResource.queryParameters.access_token);
if (defined(defaultTokenCredit)) {
credits.push(defaultTokenCredit);
credits.push(Credit.clone(defaultTokenCredit));
}
return credits;
};
Expand Down
Loading

0 comments on commit e111e3f

Please sign in to comment.