need the ability to set axisOrientation

We need to be able to set axisOrientation on the underlying GML parser of the Filter subparser of ol.parser.WFS*, also only options and no properties on the instance anymore
This commit is contained in:
Bart van den Eijnden
2013-10-23 13:15:16 +02:00
parent 3184fb02e5
commit 4df848fae0
8 changed files with 87 additions and 48 deletions

View File

@@ -22,8 +22,7 @@ describe('ol.parser.ogc.WFS_v1_0_0', function() {
it('handles writing Query with BBOX Filter', function(done) {
var url = 'spec/ol/parser/ogc/xml/wfs_v1_0_0/query0.xml';
afterLoadXml(url, function(xml) {
var p = new ol.parser.ogc.WFS_v1_0_0({featureTypes: ['states'],
featurePrefix: 'topp', featureNS: 'http://www.openplans.org/topp'});
var p = new ol.parser.ogc.WFS_v1_0_0();
var filter = new ol.expr.Call(
new ol.expr.Identifier(ol.expr.functions.EXTENT),
[new ol.expr.Literal(1), new ol.expr.Literal(2),
@@ -31,7 +30,12 @@ describe('ol.parser.ogc.WFS_v1_0_0', function() {
undefined,
new ol.expr.Identifier('the_geom')]);
var output = p.writers[p.defaultNamespaceURI]['Query'].apply(
p, [{filter: filter, featureType: 'states'}]);
p, [{
filter: filter,
featureType: 'states',
featureNS: 'http://www.openplans.org/topp',
featurePrefix: 'topp'
}]);
expect(goog.dom.xml.loadXml(p.serialize(output))).to.xmleql(xml);
done();
});
@@ -40,12 +44,16 @@ describe('ol.parser.ogc.WFS_v1_0_0', function() {
it('handles writing GetFeature with PropertyName', function(done) {
var url = 'spec/ol/parser/ogc/xml/wfs_v1_0_0/getfeature0.xml';
afterLoadXml(url, function(xml) {
var p = new ol.parser.ogc.WFS_v1_0_0({featureTypes: ['states'],
featurePrefix: 'topp', featureNS: 'http://www.openplans.org/topp'});
var p = new ol.parser.ogc.WFS_v1_0_0();
var output = p.writers[p.defaultNamespaceURI]['GetFeature'].apply(
p, [{propertyNames: [new ol.expr.Identifier('STATE_NAME'),
new ol.expr.Identifier('STATE_FIPS'),
new ol.expr.Identifier('STATE_ABBR')]}]);
p, [{
propertyNames: [new ol.expr.Identifier('STATE_NAME'),
new ol.expr.Identifier('STATE_FIPS'),
new ol.expr.Identifier('STATE_ABBR')],
featureNS: 'http://www.openplans.org/topp',
featurePrefix: 'topp',
featureTypes: ['states']
}]);
expect(goog.dom.xml.loadXml(p.serialize(output))).to.xmleql(xml);
done();
});

View File

@@ -44,10 +44,40 @@ describe('ol.parser.ogc.WFS_v1_1_0', function() {
});
});
it('handles writing Query with BBOX Filter', function(done) {
var url = 'spec/ol/parser/ogc/xml/wfs_v1_1_0/query0.xml';
afterLoadXml(url, function(xml) {
var p = new ol.parser.ogc.WFS_v1_1_0();
var srs = 'urn:ogc:def:crs:EPSG::4326';
var filter = new ol.expr.Call(
new ol.expr.Identifier(ol.expr.functions.EXTENT),
[new ol.expr.Literal(1), new ol.expr.Literal(2),
new ol.expr.Literal(3), new ol.expr.Literal(4),
new ol.expr.Literal(srs),
new ol.expr.Identifier('the_geom')]);
p.getFilterParser().getGmlParser().axisOrientation =
ol.proj.get(srs).getAxisOrientation();
var output = p.writers[p.defaultNamespaceURI]['Query'].apply(
p, [{
srsName: srs,
filter: filter,
featureType: 'states',
featureNS: 'http://www.openplans.org/topp',
featurePrefix: 'topp'
}]);
expect(goog.dom.xml.loadXml(p.serialize(output))).to.xmleql(xml);
done();
});
});
});
});
goog.require('goog.dom.xml');
goog.require('ol.expr.Call');
goog.require('ol.expr.Identifier');
goog.require('ol.expr.Literal');
goog.require('ol.parser.ogc.WFS');
goog.require('ol.parser.ogc.WFS_v1_1_0');
goog.require('ol.proj');

View File

@@ -0,0 +1,11 @@
<wfs:Query xmlns:wfs="http://www.opengis.net/wfs" typeName="topp:states" srsName="urn:ogc:def:crs:EPSG::4326" xmlns:topp="http://www.openplans.org/topp">
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
<ogc:BBOX>
<ogc:PropertyName>the_geom</ogc:PropertyName>
<gml:Envelope xmlns:gml="http://www.opengis.net/gml" srsName="urn:ogc:def:crs:EPSG::4326">
<gml:lowerCorner>1 2</gml:lowerCorner>
<gml:upperCorner>3 4</gml:upperCorner>
</gml:Envelope>
</ogc:BBOX>
</ogc:Filter>
</wfs:Query>