Allow literal from symbolizer without feature
This commit is contained in:
@@ -94,8 +94,12 @@ goog.inherits(ol.style.Line, ol.style.Symbolizer);
|
|||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
* @return {ol.style.LineLiteral} Literal line symbolizer.
|
* @return {ol.style.LineLiteral} Literal line symbolizer.
|
||||||
*/
|
*/
|
||||||
ol.style.Line.prototype.createLiteral = function(feature) {
|
ol.style.Line.prototype.createLiteral = function(opt_feature) {
|
||||||
var attrs = feature.getAttributes();
|
var attrs,
|
||||||
|
feature = opt_feature;
|
||||||
|
if (goog.isDef(feature)) {
|
||||||
|
attrs = feature.getAttributes();
|
||||||
|
}
|
||||||
|
|
||||||
var strokeStyle = this.strokeStyle_.evaluate(feature, attrs);
|
var strokeStyle = this.strokeStyle_.evaluate(feature, attrs);
|
||||||
goog.asserts.assertString(strokeStyle, 'strokeStyle must be a string');
|
goog.asserts.assertString(strokeStyle, 'strokeStyle must be a string');
|
||||||
|
|||||||
@@ -109,8 +109,12 @@ goog.inherits(ol.style.Polygon, ol.style.Symbolizer);
|
|||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
* @return {ol.style.PolygonLiteral} Literal shape symbolizer.
|
* @return {ol.style.PolygonLiteral} Literal shape symbolizer.
|
||||||
*/
|
*/
|
||||||
ol.style.Polygon.prototype.createLiteral = function(feature) {
|
ol.style.Polygon.prototype.createLiteral = function(opt_feature) {
|
||||||
var attrs = feature.getAttributes();
|
var attrs,
|
||||||
|
feature = opt_feature;
|
||||||
|
if (goog.isDef(feature)) {
|
||||||
|
attrs = feature.getAttributes();
|
||||||
|
}
|
||||||
|
|
||||||
var fillStyle = this.fillStyle_.evaluate(feature, attrs);
|
var fillStyle = this.fillStyle_.evaluate(feature, attrs);
|
||||||
goog.asserts.assertString(fillStyle, 'fillStyle must be a string');
|
goog.asserts.assertString(fillStyle, 'fillStyle must be a string');
|
||||||
|
|||||||
@@ -143,8 +143,12 @@ ol.style.Shape = function(options) {
|
|||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
* @return {ol.style.ShapeLiteral} Literal shape symbolizer.
|
* @return {ol.style.ShapeLiteral} Literal shape symbolizer.
|
||||||
*/
|
*/
|
||||||
ol.style.Shape.prototype.createLiteral = function(feature) {
|
ol.style.Shape.prototype.createLiteral = function(opt_feature) {
|
||||||
var attrs = feature.getAttributes();
|
var attrs,
|
||||||
|
feature = opt_feature;
|
||||||
|
if (goog.isDef(feature)) {
|
||||||
|
attrs = feature.getAttributes();
|
||||||
|
}
|
||||||
|
|
||||||
var size = this.size_.evaluate(feature, attrs);
|
var size = this.size_.evaluate(feature, attrs);
|
||||||
goog.asserts.assertNumber(size, 'size must be a number');
|
goog.asserts.assertNumber(size, 'size must be a number');
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ ol.style.Symbolizer = function() {};
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {ol.Feature} feature Feature for evaluating expressions.
|
* @param {ol.Feature=} opt_feature Feature for evaluating expressions.
|
||||||
* @return {ol.style.SymbolizerLiteral} Literal symbolizer.
|
* @return {ol.style.SymbolizerLiteral} Literal symbolizer.
|
||||||
*/
|
*/
|
||||||
ol.style.Symbolizer.prototype.createLiteral = goog.abstractMethod;
|
ol.style.Symbolizer.prototype.createLiteral = goog.abstractMethod;
|
||||||
|
|||||||
Reference in New Issue
Block a user