diff --git a/CHANGES.md b/CHANGES.md index eda12f8a2..b9453e0ad 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,7 @@ * Changes * Enable googshift eslint rules to prepare for ES6 modules migration; move source to the olcs directory and fix filenames. + * Add basic support for clustered sources: see https://github.com/openlayers/ol-cesium/pull/496. # v 1.31 - 2017-09-06 diff --git a/src/olcs/featureconverter.js b/src/olcs/featureconverter.js index 8f03179c2..8a6a661e1 100644 --- a/src/olcs/featureconverter.js +++ b/src/olcs/featureconverter.js @@ -4,6 +4,7 @@ goog.require('ol.geom.Geometry'); goog.require('ol.source.ImageVector'); goog.require('ol.style.Icon'); goog.require('ol.source.Vector'); +goog.require('ol.source.Cluster'); goog.require('goog.asserts'); goog.require('ol'); @@ -993,6 +994,9 @@ olcs.FeatureConverter.prototype.olVectorLayerToCesium = function(olLayer, olView return new olcs.core.VectorLayerCounterpart(proj, this.scene); } } + if (source instanceof ol.source.Cluster) { + source = source.getSource(); + } goog.asserts.assertInstanceof(source, ol.source.Vector); const features = source.getFeatures(); diff --git a/src/olcs/vectorsynchronizer.js b/src/olcs/vectorsynchronizer.js index 47488c733..3ce3543ad 100644 --- a/src/olcs/vectorsynchronizer.js +++ b/src/olcs/vectorsynchronizer.js @@ -2,6 +2,7 @@ goog.provide('olcs.VectorSynchronizer'); goog.require('ol.source.Vector'); goog.require('ol.layer.Layer'); goog.require('ol.source.ImageVector'); +goog.require('ol.source.Cluster'); goog.require('ol.layer.Image'); goog.require('goog.asserts'); @@ -98,6 +99,9 @@ olcs.VectorSynchronizer.prototype.createSingleLayerCounterparts = function(olLay if (source instanceof ol.source.ImageVector) { source = source.getSource(); } + if (source instanceof ol.source.Cluster) { + source = source.getSource(); + } goog.asserts.assertInstanceof(source, ol.source.Vector); goog.asserts.assert(this.view);