Add clone methods to styles
This commit is contained in:
committed by
Simon Seyock
parent
f61a43b3c6
commit
c561f1587b
@@ -71,6 +71,26 @@ ol.style.Style = function(opt_options) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Clones the style.
|
||||
* @return {ol.style.Style} The cloned style.
|
||||
* @api
|
||||
*/
|
||||
ol.style.Style.prototype.clone = function() {
|
||||
var geometry = this.getGeometry();
|
||||
if (geometry && geometry.clone) {
|
||||
geometry = geometry.clone();
|
||||
}
|
||||
return new ol.style.Style({
|
||||
geometry: geometry,
|
||||
fill: this.getFill() ? this.getFill().clone() : undefined,
|
||||
stroke: this.getStroke() ? this.getStroke().clone() : undefined,
|
||||
text: this.getText() ? this.getText().clone() : undefined,
|
||||
zIndex: this.getZIndex()
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Get the geometry to be rendered.
|
||||
* @return {string|ol.geom.Geometry|ol.StyleGeometryFunction}
|
||||
|
||||
Reference in New Issue
Block a user