Skip to content

Commit

Permalink
Merge pull request #301 from openlayers/port_ol3_cesium
Browse files Browse the repository at this point in the history
Port to latest OL3 and Cesium versions
  • Loading branch information
gberaudo committed Dec 15, 2015
2 parents 34ba285 + 211e089 commit 306bd5d
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 24 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## v1.11

* Changes
* Port to Cesium 1.16.
* Port to OL 3.12.0

## v1.10 - 2015-11-30

* Breaking changes
Expand Down
2 changes: 1 addition & 1 deletion cesium
2 changes: 1 addition & 1 deletion ol3
Submodule ol3 updated from eb5607 to 5d6476
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
36 changes: 25 additions & 11 deletions src/featureconverter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.<ol.style.Style>}
*/
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;
};


Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 306bd5d

Please sign in to comment.