Skip to content

Commit

Permalink
Merge pull request #533 from oterral/teo_imgvector
Browse files Browse the repository at this point in the history
Remove management of ol.source.ImageVector
  • Loading branch information
gberaudo authored Dec 7, 2017
2 parents 9fcabdb + fa457b6 commit 9bc1bd7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 42 deletions.
3 changes: 2 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
* Changes
* Animate olcs.contrib.Manager#toggle3d.
* Add support for Overlay synchronization, see example Overlays.
* Port to Cesium 1.39.
* Port to OpenLayers 4.6.2 and Cesium 1.39.
* Restore OpenLayers events propagation.
* Workaround camera sinking under the terrain and finally jumping above it.
See https://github.com/AnalyticalGraphicsInc/cesium/issues/5999. The
workaround requires the Camptocamp version of Cesium (otherwise it has no effect).
* Add preliminary work for an ES6 package https://www.npmjs.com/package/olcs.
* Remove management of ol.source.ImageVector. This class is deprecated in OpenLayers 4.6.2.


# v 1.32 - 2017-10-26
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"googshift": "0.9.2",
"jsdoc": "3.5.5",
"nomnom": "1.8.1",
"openlayers": "4.5.0",
"openlayers": "4.6.2",
"temp": "0.8.3",
"walk": "2.3.9"
}
Expand Down
36 changes: 3 additions & 33 deletions src/olcs/featureconverter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
goog.provide('olcs.FeatureConverter');
goog.require('ol.layer.Image');
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');
Expand Down Expand Up @@ -587,10 +585,7 @@ olcs.FeatureConverter.prototype.olPointGeometryToCesium = function(layer, featur
if (image instanceof Image && !isImageLoaded(image)) {
// Cesium requires the image to be loaded
let cancelled = false;
let source = layer.getSource();
if (source instanceof ol.source.ImageVector) {
source = source.getSource();
}
const source = layer.getSource();
const canceller = function() {
cancelled = true;
};
Expand Down Expand Up @@ -1007,14 +1002,6 @@ olcs.FeatureConverter.prototype.olVectorLayerToCesium = function(olLayer, olView
}

let source = olLayer.getSource();
if (olLayer instanceof ol.layer.Image) {
if (source instanceof ol.source.ImageVector) {
source = source.getSource();
} else {
// Not supported
return new olcs.core.VectorLayerCounterpart(proj, this.scene);
}
}
if (source instanceof ol.source.Cluster) {
source = source.getSource();
}
Expand All @@ -1031,14 +1018,7 @@ olcs.FeatureConverter.prototype.olVectorLayerToCesium = function(olLayer, olView
/**
* @type {ol.StyleFunction|undefined}
*/
let layerStyle;
if (olLayer instanceof ol.layer.Image) {
const imageSource = olLayer.getSource();
goog.asserts.assertInstanceof(imageSource, ol.source.ImageVector);
layerStyle = imageSource.getStyleFunction();
} else {
layerStyle = olLayer.getStyleFunction();
}
const layerStyle = olLayer.getStyleFunction();
const styles = this.computePlainStyle(olLayer, feature, layerStyle,
resolution);
if (!styles || !styles.length) {
Expand Down Expand Up @@ -1095,17 +1075,7 @@ olcs.FeatureConverter.prototype.convert = function(layer, view, feature, context
/**
* @type {ol.StyleFunction|undefined}
*/
let layerStyle;
if (layer instanceof ol.layer.Image) {
const imageSource = layer.getSource();
if (imageSource instanceof ol.source.ImageVector) {
layerStyle = imageSource.getStyleFunction();
} else {
return null;
}
} else {
layerStyle = layer.getStyleFunction();
}
const layerStyle = layer.getStyleFunction();

const styles = this.computePlainStyle(layer, feature, layerStyle, resolution);

Expand Down
8 changes: 1 addition & 7 deletions src/olcs/vectorsynchronizer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
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');

Expand Down Expand Up @@ -106,17 +105,12 @@ olcs.VectorSynchronizer.prototype.updateLayerVisibility = function(olLayerWithPa
*/
olcs.VectorSynchronizer.prototype.createSingleLayerCounterparts = function(olLayerWithParents) {
const olLayer = olLayerWithParents.layer;
if (!(olLayer instanceof ol.layer.Vector) &&
!(olLayer instanceof ol.layer.Image &&
olLayer.getSource() instanceof ol.source.ImageVector)) {
if (!(olLayer instanceof ol.layer.Vector)) {
return null;
}
goog.asserts.assertInstanceof(olLayer, ol.layer.Layer);

let source = olLayer.getSource();
if (source instanceof ol.source.ImageVector) {
source = source.getSource();
}
if (source instanceof ol.source.Cluster) {
source = source.getSource();
}
Expand Down

0 comments on commit 9bc1bd7

Please sign in to comment.