add ability to write out a WFS Transaction without a geometry, r=tschaub (closes #2033)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@10033 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -226,9 +226,11 @@ OpenLayers.Format.WFST.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// add in geometry
|
// add in geometry
|
||||||
this.writeNode(
|
if (this.geometryName !== null) {
|
||||||
"Property", {name: this.geometryName, value: feature}, node
|
this.writeNode(
|
||||||
);
|
"Property", {name: this.geometryName, value: feature}, node
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// add in attributes
|
// add in attributes
|
||||||
for(var key in feature.attributes) {
|
for(var key in feature.attributes) {
|
||||||
|
|||||||
@@ -63,6 +63,32 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function test_write_no_geometry(t) {
|
||||||
|
var format = new OpenLayers.Format.WFST({
|
||||||
|
featureNS: "http://www.openplans.org/topp",
|
||||||
|
featureType: "states",
|
||||||
|
featurePrefix: "topp",
|
||||||
|
geometryName: null
|
||||||
|
});
|
||||||
|
|
||||||
|
var feature = new OpenLayers.Feature.Vector(null, {foo: "bar"});
|
||||||
|
feature.state = OpenLayers.State.UPDATE;
|
||||||
|
feature.fid = "fid.36";
|
||||||
|
|
||||||
|
t.plan(1);
|
||||||
|
var snippets = {
|
||||||
|
"UpdateNoGeometry": feature
|
||||||
|
}
|
||||||
|
|
||||||
|
var arg;
|
||||||
|
for(var snippet in snippets) {
|
||||||
|
arg = snippets[snippet]
|
||||||
|
var expected = readXML(snippet);
|
||||||
|
var got = format.writers["wfs"]["Update"].apply(format, [arg]);
|
||||||
|
t.xml_eq(got, expected, snippet + " request without geometry created correctly");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function readXML(id) {
|
function readXML(id) {
|
||||||
var xml = document.getElementById(id).firstChild.nodeValue;
|
var xml = document.getElementById(id).firstChild.nodeValue;
|
||||||
return new OpenLayers.Format.XML().read(xml).documentElement;
|
return new OpenLayers.Format.XML().read(xml).documentElement;
|
||||||
@@ -166,5 +192,16 @@
|
|||||||
</ogc:Filter>
|
</ogc:Filter>
|
||||||
</wfs:Delete>
|
</wfs:Delete>
|
||||||
--></div>
|
--></div>
|
||||||
|
<div id="UpdateNoGeometry"><!--
|
||||||
|
<wfs:Update xmlns:wfs="http://www.opengis.net/wfs" typeName="topp:states" xmlns:topp="http://www.openplans.org/topp">
|
||||||
|
<wfs:Property>
|
||||||
|
<wfs:Name>foo</wfs:Name>
|
||||||
|
<wfs:Value>bar</wfs:Value>
|
||||||
|
</wfs:Property>
|
||||||
|
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
|
||||||
|
<ogc:FeatureId fid="fid.36"/>
|
||||||
|
</ogc:Filter>
|
||||||
|
</wfs:Update>
|
||||||
|
--></div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user