From 367fc8feaa2ec140f29e549c1d6eedcf86131d14 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Tue, 15 Dec 2015 16:14:27 +0100 Subject: [PATCH 1/3] Port to Cesium 1.16 --- CHANGES.md | 5 +++++ cesium | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index cbe11a958..c8193b75d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,10 @@ # Changelog +## v1.11 + +* Changes + * Port to Cesium 1.16. + ## v1.10 - 2015-11-30 * Breaking changes diff --git a/cesium b/cesium index 75c1e8b6b..cc86e3189 160000 --- a/cesium +++ b/cesium @@ -1 +1 @@ -Subproject commit 75c1e8b6bdfc469ae43a9a19bde16e2c883496a0 +Subproject commit cc86e318964dc0ea92f2b6e6db5368be1d7a28eb From c3c84664fec7b1052a2d3bc813c89250202d3d18 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Tue, 15 Dec 2015 16:14:39 +0100 Subject: [PATCH 2/3] Port to OpenLayers 3.12.0 --- CHANGES.md | 1 + ol3 | 2 +- package.json | 22 +++++++++++----------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index c8193b75d..e7b898f25 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,6 +4,7 @@ * Changes * Port to Cesium 1.16. + * Port to OL 3.12.0 ## v1.10 - 2015-11-30 diff --git a/ol3 b/ol3 index eb5607544..5d64762bc 160000 --- a/ol3 +++ b/ol3 @@ -1 +1 @@ -Subproject commit eb5607544c71f9445dcb3bcac27d0db62cff18d0 +Subproject commit 5d64762bcb676d7fccd5bb3c12c055d51d50c9f2 diff --git a/package.json b/package.json index 30ee54e65..5046db89c 100644 --- a/package.json +++ b/package.json @@ -12,18 +12,18 @@ "url": "https://github.com/openlayers/ol3-cesium/issues" }, "dependencies": { - "async": "~0.2.10", - "htmlparser2": "~3.7.1" + "async": "1.5.0", + "htmlparser2": "3.7.1" }, "devDependencies": { - "closure-util": "1.8.0", - "geojsonhint": "^1.0.0", - "fs-extra": "~0.8.1", - "graceful-fs": "~3.0.2", - "jsdoc": "~3.3.0-alpha7", - "jshint": "~2.5.1", - "nomnom": "~1.6.2", - "temp": "~0.7.0", - "walk": "~2.3.3" + "closure-util": "1.9.0", + "geojsonhint": "1.0.0", + "fs-extra": "0.26.2", + "graceful-fs": "4.1.2", + "jsdoc": "~3.4.0", + "jshint": "2.8.0", + "nomnom": "1.8.1", + "temp": "0.8.3", + "walk": "2.3.9" } } From 211e08987089cdc81bc447c0ad28e1cfdeaad607 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Tue, 15 Dec 2015 16:49:19 +0100 Subject: [PATCH 3/3] Handle change in style function API OL3 changed its style functions to allow returning a single style instead of an array. This commit adapts OL3-Cesium code. Closes: #300. --- src/featureconverter.js | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/src/featureconverter.js b/src/featureconverter.js index ca985c43e..373a89f8e 100644 --- a/src/featureconverter.js +++ b/src/featureconverter.js @@ -783,33 +783,41 @@ olcs.FeatureConverter.prototype.olStyleToCesium = * Evaluates style function, blend arrays, get default style. * @param {ol.layer.Vector|ol.layer.Image} layer * @param {!ol.Feature} feature - * @param {ol.style.StyleFunction|undefined} fallbackStyle + * @param {ol.style.StyleFunction|undefined} fallbackStyleFunction * @param {number} resolution * @return {ol.style.Style} null if no style is available * @api */ olcs.FeatureConverter.prototype.computePlainStyle = - function(layer, feature, fallbackStyle, resolution) { - var featureStyle = feature.getStyleFunction(); - var style; - if (goog.isDef(featureStyle)) { - style = featureStyle.call(feature, resolution); + function(layer, feature, fallbackStyleFunction, resolution) { + /** + * @type {ol.FeatureStyleFunction|undefined} + */ + var featureStyleFunction = feature.getStyleFunction(); + + /** + * @type {ol.style.Style|Array.} + */ + var style = null; + + if (featureStyleFunction) { + style = featureStyleFunction.call(feature, resolution); } - if (!goog.isDefAndNotNull(style) && goog.isDefAndNotNull(fallbackStyle)) { - style = fallbackStyle(feature, resolution); + + if (!style && fallbackStyleFunction) { + style = fallbackStyleFunction(feature, resolution); } - if (!goog.isDef(style)) { + if (!style) { // The feature must not be displayed return null; } - goog.asserts.assert(Array.isArray(style)); // FIXME combine materials as in cesium-materials-pack? // then this function must return a custom material // More simply, could blend the colors like described in // http://en.wikipedia.org/wiki/Alpha_compositing - return style[0]; + return Array.isArray(style) ? style[0] : style; }; @@ -935,6 +943,9 @@ olcs.FeatureConverter.prototype.olVectorLayerToCesium = if (!goog.isDefAndNotNull(feature)) { continue; } + /** + * @type {ol.style.StyleFunction|undefined} + */ var layerStyle; if (olLayer instanceof ol.layer.Image) { var imageSource = olLayer.getSource(); @@ -977,6 +988,9 @@ olcs.FeatureConverter.prototype.convert = return null; } + /** + * @type {ol.style.StyleFunction|undefined} + */ var layerStyle; if (layer instanceof ol.layer.Image) { var imageSource = layer.getSource();