Rename ol.expression to ol.expr

This commit is contained in:
Tim Schaub
2013-06-21 17:29:16 -06:00
parent 9928730bd3
commit 2577d3f7d6
28 changed files with 1550 additions and 1548 deletions
+25 -25
View File
@@ -3,9 +3,9 @@ goog.provide('ol.style.IconLiteral');
goog.provide('ol.style.IconType');
goog.require('goog.asserts');
goog.require('ol.expression');
goog.require('ol.expression.Expression');
goog.require('ol.expression.Literal');
goog.require('ol.expr');
goog.require('ol.expr.Expression');
goog.require('ol.expr.Literal');
goog.require('ol.style.Point');
goog.require('ol.style.PointLiteral');
@@ -70,47 +70,47 @@ ol.style.Icon = function(options) {
goog.asserts.assert(options.url, 'url must be set');
/**
* @type {ol.expression.Expression}
* @type {ol.expr.Expression}
* @private
*/
this.url_ = (options.url instanceof ol.expression.Expression) ?
options.url : new ol.expression.Literal(options.url);
this.url_ = (options.url instanceof ol.expr.Expression) ?
options.url : new ol.expr.Literal(options.url);
/**
* @type {ol.expression.Expression}
* @type {ol.expr.Expression}
* @private
*/
this.width_ = !goog.isDef(options.width) ?
null :
(options.width instanceof ol.expression.Expression) ?
options.width : new ol.expression.Literal(options.width);
(options.width instanceof ol.expr.Expression) ?
options.width : new ol.expr.Literal(options.width);
/**
* @type {ol.expression.Expression}
* @type {ol.expr.Expression}
* @private
*/
this.height_ = !goog.isDef(options.height) ?
null :
(options.height instanceof ol.expression.Expression) ?
options.height : new ol.expression.Literal(options.height);
(options.height instanceof ol.expr.Expression) ?
options.height : new ol.expr.Literal(options.height);
/**
* @type {ol.expression.Expression}
* @type {ol.expr.Expression}
* @private
*/
this.opacity_ = !goog.isDef(options.opacity) ?
new ol.expression.Literal(ol.style.IconDefaults.opacity) :
(options.opacity instanceof ol.expression.Expression) ?
options.opacity : new ol.expression.Literal(options.opacity);
new ol.expr.Literal(ol.style.IconDefaults.opacity) :
(options.opacity instanceof ol.expr.Expression) ?
options.opacity : new ol.expr.Literal(options.opacity);
/**
* @type {ol.expression.Expression}
* @type {ol.expr.Expression}
* @private
*/
this.rotation_ = !goog.isDef(options.rotation) ?
new ol.expression.Literal(ol.style.IconDefaults.rotation) :
(options.rotation instanceof ol.expression.Expression) ?
options.rotation : new ol.expression.Literal(options.rotation);
new ol.expr.Literal(ol.style.IconDefaults.rotation) :
(options.rotation instanceof ol.expr.Expression) ?
options.rotation : new ol.expr.Literal(options.rotation);
};
@@ -121,26 +121,26 @@ ol.style.Icon = function(options) {
*/
ol.style.Icon.prototype.createLiteral = function(opt_feature) {
var url = ol.expression.evaluateFeature(this.url_, opt_feature);
var url = ol.expr.evaluateFeature(this.url_, opt_feature);
goog.asserts.assertString(url, 'url must be a string');
goog.asserts.assert(url != '#', 'url must not be "#"');
var width;
if (!goog.isNull(this.width_)) {
width = ol.expression.evaluateFeature(this.width_, opt_feature);
width = ol.expr.evaluateFeature(this.width_, opt_feature);
goog.asserts.assertNumber(width, 'width must be a number');
}
var height;
if (!goog.isNull(this.height_)) {
height = ol.expression.evaluateFeature(this.height_, opt_feature);
height = ol.expr.evaluateFeature(this.height_, opt_feature);
goog.asserts.assertNumber(height, 'height must be a number');
}
var opacity = ol.expression.evaluateFeature(this.opacity_, opt_feature);
var opacity = ol.expr.evaluateFeature(this.opacity_, opt_feature);
goog.asserts.assertNumber(opacity, 'opacity must be a number');
var rotation = ol.expression.evaluateFeature(this.rotation_, opt_feature);
var rotation = ol.expr.evaluateFeature(this.rotation_, opt_feature);
goog.asserts.assertNumber(rotation, 'rotation must be a number');
return new ol.style.IconLiteral({
+18 -18
View File
@@ -2,9 +2,9 @@ goog.provide('ol.style.Line');
goog.provide('ol.style.LineLiteral');
goog.require('goog.asserts');
goog.require('ol.expression');
goog.require('ol.expression.Expression');
goog.require('ol.expression.Literal');
goog.require('ol.expr');
goog.require('ol.expr.Expression');
goog.require('ol.expr.Literal');
goog.require('ol.style.Symbolizer');
goog.require('ol.style.SymbolizerLiteral');
@@ -64,31 +64,31 @@ ol.style.Line = function(options) {
goog.base(this);
/**
* @type {ol.expression.Expression}
* @type {ol.expr.Expression}
* @private
*/
this.strokeColor_ = !goog.isDef(options.strokeColor) ?
new ol.expression.Literal(ol.style.LineDefaults.strokeColor) :
(options.strokeColor instanceof ol.expression.Expression) ?
options.strokeColor : new ol.expression.Literal(options.strokeColor);
new ol.expr.Literal(ol.style.LineDefaults.strokeColor) :
(options.strokeColor instanceof ol.expr.Expression) ?
options.strokeColor : new ol.expr.Literal(options.strokeColor);
/**
* @type {ol.expression.Expression}
* @type {ol.expr.Expression}
* @private
*/
this.strokeWidth_ = !goog.isDef(options.strokeWidth) ?
new ol.expression.Literal(ol.style.LineDefaults.strokeWidth) :
(options.strokeWidth instanceof ol.expression.Expression) ?
options.strokeWidth : new ol.expression.Literal(options.strokeWidth);
new ol.expr.Literal(ol.style.LineDefaults.strokeWidth) :
(options.strokeWidth instanceof ol.expr.Expression) ?
options.strokeWidth : new ol.expr.Literal(options.strokeWidth);
/**
* @type {ol.expression.Expression}
* @type {ol.expr.Expression}
* @private
*/
this.opacity_ = !goog.isDef(options.opacity) ?
new ol.expression.Literal(ol.style.LineDefaults.opacity) :
(options.opacity instanceof ol.expression.Expression) ?
options.opacity : new ol.expression.Literal(options.opacity);
new ol.expr.Literal(ol.style.LineDefaults.opacity) :
(options.opacity instanceof ol.expr.Expression) ?
options.opacity : new ol.expr.Literal(options.opacity);
};
goog.inherits(ol.style.Line, ol.style.Symbolizer);
@@ -100,15 +100,15 @@ goog.inherits(ol.style.Line, ol.style.Symbolizer);
*/
ol.style.Line.prototype.createLiteral = function(opt_feature) {
var strokeColor = ol.expression.evaluateFeature(
var strokeColor = ol.expr.evaluateFeature(
this.strokeColor_, opt_feature);
goog.asserts.assertString(strokeColor, 'strokeColor must be a string');
var strokeWidth = ol.expression.evaluateFeature(
var strokeWidth = ol.expr.evaluateFeature(
this.strokeWidth_, opt_feature);
goog.asserts.assertNumber(strokeWidth, 'strokeWidth must be a number');
var opacity = ol.expression.evaluateFeature(this.opacity_, opt_feature);
var opacity = ol.expr.evaluateFeature(this.opacity_, opt_feature);
goog.asserts.assertNumber(opacity, 'opacity must be a number');
return new ol.style.LineLiteral({
+22 -22
View File
@@ -2,9 +2,9 @@ goog.provide('ol.style.Polygon');
goog.provide('ol.style.PolygonLiteral');
goog.require('goog.asserts');
goog.require('ol.expression');
goog.require('ol.expression.Expression');
goog.require('ol.expression.Literal');
goog.require('ol.expr');
goog.require('ol.expr.Expression');
goog.require('ol.expr.Literal');
goog.require('ol.style.Symbolizer');
goog.require('ol.style.SymbolizerLiteral');
@@ -81,13 +81,13 @@ ol.style.Polygon = function(options) {
goog.base(this);
/**
* @type {ol.expression.Expression}
* @type {ol.expr.Expression}
* @private
*/
this.fillColor_ = !goog.isDefAndNotNull(options.fillColor) ?
null :
(options.fillColor instanceof ol.expression.Expression) ?
options.fillColor : new ol.expression.Literal(options.fillColor);
(options.fillColor instanceof ol.expr.Expression) ?
options.fillColor : new ol.expr.Literal(options.fillColor);
// stroke handling - if any stroke property is supplied, use defaults
var strokeColor = null,
@@ -97,32 +97,32 @@ ol.style.Polygon = function(options) {
goog.isDefAndNotNull(options.strokeWidth)) {
if (goog.isDefAndNotNull(options.strokeColor)) {
strokeColor = (options.strokeColor instanceof ol.expression.Expression) ?
strokeColor = (options.strokeColor instanceof ol.expr.Expression) ?
options.strokeColor :
new ol.expression.Literal(options.strokeColor);
new ol.expr.Literal(options.strokeColor);
} else {
strokeColor = new ol.expression.Literal(
strokeColor = new ol.expr.Literal(
/** @type {string} */ (ol.style.PolygonDefaults.strokeColor));
}
if (goog.isDefAndNotNull(options.strokeWidth)) {
strokeWidth = (options.strokeWidth instanceof ol.expression.Expression) ?
strokeWidth = (options.strokeWidth instanceof ol.expr.Expression) ?
options.strokeWidth :
new ol.expression.Literal(options.strokeWidth);
new ol.expr.Literal(options.strokeWidth);
} else {
strokeWidth = new ol.expression.Literal(
strokeWidth = new ol.expr.Literal(
/** @type {number} */ (ol.style.PolygonDefaults.strokeWidth));
}
}
/**
* @type {ol.expression.Expression}
* @type {ol.expr.Expression}
* @private
*/
this.strokeColor_ = strokeColor;
/**
* @type {ol.expression.Expression}
* @type {ol.expr.Expression}
* @private
*/
this.strokeWidth_ = strokeWidth;
@@ -133,13 +133,13 @@ ol.style.Polygon = function(options) {
'Stroke or fill properties must be provided');
/**
* @type {ol.expression.Expression}
* @type {ol.expr.Expression}
* @private
*/
this.opacity_ = !goog.isDef(options.opacity) ?
new ol.expression.Literal(ol.style.PolygonDefaults.opacity) :
(options.opacity instanceof ol.expression.Expression) ?
options.opacity : new ol.expression.Literal(options.opacity);
new ol.expr.Literal(ol.style.PolygonDefaults.opacity) :
(options.opacity instanceof ol.expr.Expression) ?
options.opacity : new ol.expr.Literal(options.opacity);
};
goog.inherits(ol.style.Polygon, ol.style.Symbolizer);
@@ -153,19 +153,19 @@ ol.style.Polygon.prototype.createLiteral = function(opt_feature) {
var fillColor;
if (!goog.isNull(this.fillColor_)) {
fillColor = ol.expression.evaluateFeature(this.fillColor_, opt_feature);
fillColor = ol.expr.evaluateFeature(this.fillColor_, opt_feature);
goog.asserts.assertString(fillColor, 'fillColor must be a string');
}
var strokeColor;
if (!goog.isNull(this.strokeColor_)) {
strokeColor = ol.expression.evaluateFeature(this.strokeColor_, opt_feature);
strokeColor = ol.expr.evaluateFeature(this.strokeColor_, opt_feature);
goog.asserts.assertString(strokeColor, 'strokeColor must be a string');
}
var strokeWidth;
if (!goog.isNull(this.strokeWidth_)) {
strokeWidth = ol.expression.evaluateFeature(this.strokeWidth_, opt_feature);
strokeWidth = ol.expr.evaluateFeature(this.strokeWidth_, opt_feature);
goog.asserts.assertNumber(strokeWidth, 'strokeWidth must be a number');
}
@@ -174,7 +174,7 @@ ol.style.Polygon.prototype.createLiteral = function(opt_feature) {
(goog.isDef(strokeColor) && goog.isDef(strokeWidth)),
'either fillColor or strokeColor and strokeWidth must be defined');
var opacity = ol.expression.evaluateFeature(this.opacity_, opt_feature);
var opacity = ol.expr.evaluateFeature(this.opacity_, opt_feature);
goog.asserts.assertNumber(opacity, 'opacity must be a number');
return new ol.style.PolygonLiteral({
+6 -6
View File
@@ -3,8 +3,8 @@ goog.provide('ol.style.Rule');
goog.require('goog.asserts');
goog.require('ol.Feature');
goog.require('ol.expression');
goog.require('ol.expression.Expression');
goog.require('ol.expr');
goog.require('ol.expr.Expression');
goog.require('ol.style.Symbolizer');
@@ -19,15 +19,15 @@ ol.style.Rule = function(options) {
var filter = null;
if (goog.isDef(options.filter)) {
if (goog.isString(options.filter)) {
filter = ol.expression.parse(options.filter);
filter = ol.expr.parse(options.filter);
} else {
goog.asserts.assert(options.filter instanceof ol.expression.Expression);
goog.asserts.assert(options.filter instanceof ol.expr.Expression);
filter = options.filter;
}
}
/**
* @type {ol.expression.Expression}
* @type {ol.expr.Expression}
* @private
*/
this.filter_ = filter;
@@ -48,7 +48,7 @@ ol.style.Rule = function(options) {
*/
ol.style.Rule.prototype.applies = function(feature) {
return goog.isNull(this.filter_) ?
true : !!ol.expression.evaluateFeature(this.filter_, feature);
true : !!ol.expr.evaluateFeature(this.filter_, feature);
};
+27 -27
View File
@@ -3,9 +3,9 @@ goog.provide('ol.style.ShapeLiteral');
goog.provide('ol.style.ShapeType');
goog.require('goog.asserts');
goog.require('ol.expression');
goog.require('ol.expression.Expression');
goog.require('ol.expression.Literal');
goog.require('ol.expr');
goog.require('ol.expr.Expression');
goog.require('ol.expr.Literal');
goog.require('ol.style.Point');
goog.require('ol.style.PointLiteral');
@@ -107,22 +107,22 @@ ol.style.Shape = function(options) {
options.type : ol.style.ShapeDefaults.type);
/**
* @type {ol.expression.Expression}
* @type {ol.expr.Expression}
* @private
*/
this.size_ = !goog.isDef(options.size) ?
new ol.expression.Literal(ol.style.ShapeDefaults.size) :
(options.size instanceof ol.expression.Expression) ?
options.size : new ol.expression.Literal(options.size);
new ol.expr.Literal(ol.style.ShapeDefaults.size) :
(options.size instanceof ol.expr.Expression) ?
options.size : new ol.expr.Literal(options.size);
/**
* @type {ol.expression.Expression}
* @type {ol.expr.Expression}
* @private
*/
this.fillColor_ = !goog.isDefAndNotNull(options.fillColor) ?
null :
(options.fillColor instanceof ol.expression.Expression) ?
options.fillColor : new ol.expression.Literal(options.fillColor);
(options.fillColor instanceof ol.expr.Expression) ?
options.fillColor : new ol.expr.Literal(options.fillColor);
// stroke handling - if any stroke property is supplied, use defaults
var strokeColor = null,
@@ -132,33 +132,33 @@ ol.style.Shape = function(options) {
goog.isDefAndNotNull(options.strokeWidth)) {
if (goog.isDefAndNotNull(options.strokeColor)) {
strokeColor = (options.strokeColor instanceof ol.expression.Expression) ?
strokeColor = (options.strokeColor instanceof ol.expr.Expression) ?
options.strokeColor :
new ol.expression.Literal(options.strokeColor);
new ol.expr.Literal(options.strokeColor);
} else {
strokeColor = new ol.expression.Literal(
strokeColor = new ol.expr.Literal(
/** @type {string} */ (ol.style.ShapeDefaults.strokeColor));
}
if (goog.isDefAndNotNull(options.strokeWidth)) {
strokeWidth = (options.strokeWidth instanceof ol.expression.Expression) ?
strokeWidth = (options.strokeWidth instanceof ol.expr.Expression) ?
options.strokeWidth :
new ol.expression.Literal(options.strokeWidth);
new ol.expr.Literal(options.strokeWidth);
} else {
strokeWidth = new ol.expression.Literal(
strokeWidth = new ol.expr.Literal(
/** @type {number} */ (ol.style.ShapeDefaults.strokeWidth));
}
}
/**
* @type {ol.expression.Expression}
* @type {ol.expr.Expression}
* @private
*/
this.strokeColor_ = strokeColor;
/**
* @type {ol.expression.Expression}
* @type {ol.expr.Expression}
* @private
*/
this.strokeWidth_ = strokeWidth;
@@ -169,13 +169,13 @@ ol.style.Shape = function(options) {
'Stroke or fill properties must be provided');
/**
* @type {ol.expression.Expression}
* @type {ol.expr.Expression}
* @private
*/
this.opacity_ = !goog.isDef(options.opacity) ?
new ol.expression.Literal(ol.style.ShapeDefaults.opacity) :
(options.opacity instanceof ol.expression.Expression) ?
options.opacity : new ol.expression.Literal(options.opacity);
new ol.expr.Literal(ol.style.ShapeDefaults.opacity) :
(options.opacity instanceof ol.expr.Expression) ?
options.opacity : new ol.expr.Literal(options.opacity);
};
@@ -186,24 +186,24 @@ ol.style.Shape = function(options) {
*/
ol.style.Shape.prototype.createLiteral = function(opt_feature) {
var size = ol.expression.evaluateFeature(this.size_, opt_feature);
var size = ol.expr.evaluateFeature(this.size_, opt_feature);
goog.asserts.assertNumber(size, 'size must be a number');
var fillColor;
if (!goog.isNull(this.fillColor_)) {
fillColor = ol.expression.evaluateFeature(this.fillColor_, opt_feature);
fillColor = ol.expr.evaluateFeature(this.fillColor_, opt_feature);
goog.asserts.assertString(fillColor, 'fillColor must be a string');
}
var strokeColor;
if (!goog.isNull(this.strokeColor_)) {
strokeColor = ol.expression.evaluateFeature(this.strokeColor_, opt_feature);
strokeColor = ol.expr.evaluateFeature(this.strokeColor_, opt_feature);
goog.asserts.assertString(strokeColor, 'strokeColor must be a string');
}
var strokeWidth;
if (!goog.isNull(this.strokeWidth_)) {
strokeWidth = ol.expression.evaluateFeature(this.strokeWidth_, opt_feature);
strokeWidth = ol.expr.evaluateFeature(this.strokeWidth_, opt_feature);
goog.asserts.assertNumber(strokeWidth, 'strokeWidth must be a number');
}
@@ -212,7 +212,7 @@ ol.style.Shape.prototype.createLiteral = function(opt_feature) {
(goog.isDef(strokeColor) && goog.isDef(strokeWidth)),
'either fillColor or strokeColor and strokeWidth must be defined');
var opacity = ol.expression.evaluateFeature(this.opacity_, opt_feature);
var opacity = ol.expr.evaluateFeature(this.opacity_, opt_feature);
goog.asserts.assertNumber(opacity, 'opacity must be a number');
return new ol.style.ShapeLiteral({
+27 -27
View File
@@ -2,9 +2,9 @@ goog.provide('ol.style.Text');
goog.provide('ol.style.TextLiteral');
goog.require('goog.asserts');
goog.require('ol.expression');
goog.require('ol.expression.Expression');
goog.require('ol.expression.Literal');
goog.require('ol.expr');
goog.require('ol.expr.Expression');
goog.require('ol.expr.Literal');
goog.require('ol.style.Symbolizer');
goog.require('ol.style.SymbolizerLiteral');
@@ -71,47 +71,47 @@ ol.style.TextLiteral.prototype.equals = function(textLiteral) {
ol.style.Text = function(options) {
/**
* @type {ol.expression.Expression}
* @type {ol.expr.Expression}
* @private
*/
this.color_ = !goog.isDef(options.color) ?
new ol.expression.Literal(ol.style.TextDefaults.color) :
(options.color instanceof ol.expression.Expression) ?
options.color : new ol.expression.Literal(options.color);
new ol.expr.Literal(ol.style.TextDefaults.color) :
(options.color instanceof ol.expr.Expression) ?
options.color : new ol.expr.Literal(options.color);
/**
* @type {ol.expression.Expression}
* @type {ol.expr.Expression}
* @private
*/
this.fontFamily_ = !goog.isDef(options.fontFamily) ?
new ol.expression.Literal(ol.style.TextDefaults.fontFamily) :
(options.fontFamily instanceof ol.expression.Expression) ?
options.fontFamily : new ol.expression.Literal(options.fontFamily);
new ol.expr.Literal(ol.style.TextDefaults.fontFamily) :
(options.fontFamily instanceof ol.expr.Expression) ?
options.fontFamily : new ol.expr.Literal(options.fontFamily);
/**
* @type {ol.expression.Expression}
* @type {ol.expr.Expression}
* @private
*/
this.fontSize_ = !goog.isDef(options.fontSize) ?
new ol.expression.Literal(ol.style.TextDefaults.fontSize) :
(options.fontSize instanceof ol.expression.Expression) ?
options.fontSize : new ol.expression.Literal(options.fontSize);
new ol.expr.Literal(ol.style.TextDefaults.fontSize) :
(options.fontSize instanceof ol.expr.Expression) ?
options.fontSize : new ol.expr.Literal(options.fontSize);
/**
* @type {ol.expression.Expression}
* @type {ol.expr.Expression}
* @private
*/
this.text_ = (options.text instanceof ol.expression.Expression) ?
options.text : new ol.expression.Literal(options.text);
this.text_ = (options.text instanceof ol.expr.Expression) ?
options.text : new ol.expr.Literal(options.text);
/**
* @type {ol.expression.Expression}
* @type {ol.expr.Expression}
* @private
*/
this.opacity_ = !goog.isDef(options.opacity) ?
new ol.expression.Literal(ol.style.TextDefaults.opacity) :
(options.opacity instanceof ol.expression.Expression) ?
options.opacity : new ol.expression.Literal(options.opacity);
new ol.expr.Literal(ol.style.TextDefaults.opacity) :
(options.opacity instanceof ol.expr.Expression) ?
options.opacity : new ol.expr.Literal(options.opacity);
};
goog.inherits(ol.style.Text, ol.style.Symbolizer);
@@ -123,19 +123,19 @@ goog.inherits(ol.style.Text, ol.style.Symbolizer);
*/
ol.style.Text.prototype.createLiteral = function(opt_feature) {
var color = ol.expression.evaluateFeature(this.color_, opt_feature);
var color = ol.expr.evaluateFeature(this.color_, opt_feature);
goog.asserts.assertString(color, 'color must be a string');
var fontFamily = ol.expression.evaluateFeature(this.fontFamily_, opt_feature);
var fontFamily = ol.expr.evaluateFeature(this.fontFamily_, opt_feature);
goog.asserts.assertString(fontFamily, 'fontFamily must be a string');
var fontSize = ol.expression.evaluateFeature(this.fontSize_, opt_feature);
var fontSize = ol.expr.evaluateFeature(this.fontSize_, opt_feature);
goog.asserts.assertNumber(fontSize, 'fontSize must be a number');
var text = ol.expression.evaluateFeature(this.text_, opt_feature);
var text = ol.expr.evaluateFeature(this.text_, opt_feature);
goog.asserts.assertString(text, 'text must be a string');
var opacity = ol.expression.evaluateFeature(this.opacity_, opt_feature);
var opacity = ol.expr.evaluateFeature(this.opacity_, opt_feature);
goog.asserts.assertNumber(opacity, 'opacity must be a number');
return new ol.style.TextLiteral({