Don't rely on ol.geom.Type in GeoJSON example
This commit is contained in:
+4
-4
@@ -15,11 +15,11 @@ goog.require('ol.style.DefaultStyleFunction');
|
|||||||
var image = ol.shape.renderCircle(5, null, {color: 'red', width: 1});
|
var image = ol.shape.renderCircle(5, null, {color: 'red', width: 1});
|
||||||
var styleFunction = function(feature) {
|
var styleFunction = function(feature) {
|
||||||
switch (feature.getGeometry().getType()) {
|
switch (feature.getGeometry().getType()) {
|
||||||
case ol.geom.Type.POINT:
|
case 'Point':
|
||||||
return {
|
return {
|
||||||
image: image
|
image: image
|
||||||
};
|
};
|
||||||
case ol.geom.Type.POLYGON:
|
case 'Polygon':
|
||||||
return {
|
return {
|
||||||
stroke: {
|
stroke: {
|
||||||
color: 'blue',
|
color: 'blue',
|
||||||
@@ -29,14 +29,14 @@ var styleFunction = function(feature) {
|
|||||||
color: 'rgba(0, 0, 255, 0.1)'
|
color: 'rgba(0, 0, 255, 0.1)'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
case ol.geom.Type.MULTI_LINE_STRING:
|
case 'MultiLineString':
|
||||||
return {
|
return {
|
||||||
stroke: {
|
stroke: {
|
||||||
color: 'green',
|
color: 'green',
|
||||||
width: 1
|
width: 1
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
case ol.geom.Type.MULTI_POLYGON:
|
case 'MultiPolygon':
|
||||||
return {
|
return {
|
||||||
stroke: {
|
stroke: {
|
||||||
color: 'yellow',
|
color: 'yellow',
|
||||||
|
|||||||
Reference in New Issue
Block a user