Remove special write-only handling for dates

This commit is contained in:
Tim Schaub
2013-08-14 11:26:01 -04:00
parent 824c950824
commit 2d95488906
4 changed files with 1 additions and 49 deletions

View File

@@ -346,12 +346,8 @@ ol.parser.ogc.Filter_v1 = function() {
},
'Literal': function(expr) {
goog.asserts.assert(expr instanceof ol.expr.Literal);
var value = expr.getValue();
if (value instanceof Date) {
value = value.toISOString();
}
var node = this.createElementNS('ogc:Literal');
node.appendChild(this.createTextNode(value));
node.appendChild(this.createTextNode(expr.getValue()));
return node;
},
'LowerBoundary': function(expr) {

View File

@@ -234,28 +234,6 @@ describe('ol.parser.ogc.Filter_v1_0_0', function() {
});
describe('#date', function() {
it('date writing works as expected', function(done) {
var url = 'spec/ol/parser/ogc/xml/filter_v1_0_0/betweendates.xml';
afterLoadXml(url, function(xml) {
// ISO 8601: 2010-11-27T18:19:15.123Z
var start = new Date(Date.UTC(2010, 10, 27, 18, 19, 15, 123));
// ISO 8601: 2011-12-27T18:19:15.123Z
var end = new Date(Date.UTC(2011, 11, 27, 18, 19, 15, 123));
var filter = new ol.expr.Logical(ol.expr.LogicalOp.AND,
new ol.expr.Comparison(ol.expr.ComparisonOp.GTE,
new ol.expr.Identifier('when'), new ol.expr.Literal(start)),
new ol.expr.Comparison(ol.expr.ComparisonOp.LTE,
new ol.expr.Identifier('when'), new ol.expr.Literal(end)));
var output = parser.write(filter);
expect(goog.dom.xml.loadXml(output)).to.xmleql(xml);
done();
});
});
});
describe('_expression reader works as expected', function() {
it('_expression reader handles combined propertyname and literal',
function() {

View File

@@ -1,11 +0,0 @@
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/ogc http://schemas.opengis.net/filter/1.0.0/filter.xsd">
<ogc:PropertyIsBetween>
<ogc:PropertyName>when</ogc:PropertyName>
<ogc:LowerBoundary>
<ogc:Literal>2010-11-27T18:19:15.123Z</ogc:Literal>
</ogc:LowerBoundary>
<ogc:UpperBoundary>
<ogc:Literal>2011-12-27T18:19:15.123Z</ogc:Literal>
</ogc:UpperBoundary>
</ogc:PropertyIsBetween>
</ogc:Filter>

View File

@@ -1,11 +0,0 @@
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
<ogc:PropertyIsBetween>
<ogc:PropertyName>when</ogc:PropertyName>
<ogc:LowerBoundary>
<ogc:Literal>2010-11-27</ogc:Literal>
</ogc:LowerBoundary>
<ogc:UpperBoundary>
<ogc:Literal>2011-12-27</ogc:Literal>
</ogc:UpperBoundary>
</ogc:PropertyIsBetween>
</ogc:Filter>