Create literal with feature or geometry type

This commit is contained in:
Tim Schaub
2013-08-15 08:08:10 -04:00
parent c36ceab2a0
commit d5d0262b4c
13 changed files with 156 additions and 116 deletions

View File

@@ -31,11 +31,12 @@ describe('ol.style.Fill', function() {
var feature = new ol.Feature({
value: 42,
fillAttr: '#ff0000'
fillAttr: '#ff0000',
geometry: new ol.geom.Polygon(
[[[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]]])
});
var literal = symbolizer.createLiteral(ol.geom.GeometryType.POLYGON,
feature);
var literal = symbolizer.createLiteral(feature);
expect(literal).to.be.a(ol.style.PolygonLiteral);
expect(literal.fillOpacity).to.be(42 / 100);
expect(literal.fillColor).to.be('#ff0000');
@@ -158,5 +159,6 @@ goog.require('ol.Feature');
goog.require('ol.expr');
goog.require('ol.expr.Literal');
goog.require('ol.geom.GeometryType');
goog.require('ol.geom.Polygon');
goog.require('ol.style.Fill');
goog.require('ol.style.PolygonLiteral');

View File

@@ -48,8 +48,7 @@ describe('ol.style.Icon', function() {
geometry: new ol.geom.Point([1, 2])
});
var literal = symbolizer.createLiteral(ol.geom.GeometryType.POINT,
feature);
var literal = symbolizer.createLiteral(feature);
expect(literal).to.be.a(ol.style.IconLiteral);
expect(literal.height).to.be(42);
expect(literal.width).to.be(.42);

View File

@@ -43,8 +43,7 @@ describe('ol.style.Shape', function() {
geometry: new ol.geom.Point([1, 2])
});
var literal = symbolizer.createLiteral(ol.geom.GeometryType.POINT,
feature);
var literal = symbolizer.createLiteral(feature);
expect(literal).to.be.a(ol.style.ShapeLiteral);
expect(literal.size).to.be(42);
expect(literal.fillOpacity).to.be(0.4);

View File

@@ -32,11 +32,11 @@ describe('ol.style.Stroke', function() {
var feature = new ol.Feature({
value: 42,
widthAttr: 1.5
widthAttr: 1.5,
geometry: new ol.geom.LineString([[1, 2], [3, 4]])
});
var literal = symbolizer.createLiteral(ol.geom.GeometryType.LINESTRING,
feature);
var literal = symbolizer.createLiteral(feature);
expect(literal).to.be.a(ol.style.LineLiteral);
expect(literal.strokeOpacity).to.be(42 / 100);
expect(literal.strokeWidth).to.be(1.5);

View File

@@ -47,8 +47,7 @@ describe('ol.style.Text', function() {
opacityAttr: 0.4
});
var literal = symbolizer.createLiteral(ol.geom.GeometryType.POINT,
feature);
var literal = symbolizer.createLiteral(feature);
expect(literal).to.be.a(ol.style.TextLiteral);
expect(literal.color).to.be('#ff0000');
expect(literal.fontFamily).to.be('Dingbats');