Merge pull request #6677 from Jenselme/wfst-3D
Add an option to writeTransaction to support 3D geometries
This commit is contained in:
@@ -2299,6 +2299,7 @@ olx.format.WFSWriteGetFeatureOptions.prototype.resultType;
|
|||||||
* featureType: string,
|
* featureType: string,
|
||||||
* srsName: (string|undefined),
|
* srsName: (string|undefined),
|
||||||
* handle: (string|undefined),
|
* handle: (string|undefined),
|
||||||
|
* hasZ: (boolean|undefined),
|
||||||
* nativeElements: Array.<Object>,
|
* nativeElements: Array.<Object>,
|
||||||
* gmlOptions: (olx.format.GMLOptions|undefined),
|
* gmlOptions: (olx.format.GMLOptions|undefined),
|
||||||
* version: (string|undefined)}}
|
* version: (string|undefined)}}
|
||||||
@@ -2347,6 +2348,15 @@ olx.format.WFSWriteTransactionOptions.prototype.srsName;
|
|||||||
olx.format.WFSWriteTransactionOptions.prototype.handle;
|
olx.format.WFSWriteTransactionOptions.prototype.handle;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Must be set to true if the transaction is for a 3D layer. This will allow
|
||||||
|
* the Z coordinate to be included in the transaction.
|
||||||
|
* @type {boolean|undefined}
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
olx.format.WFSWriteTransactionOptions.prototype.hasZ;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Native elements. Currently not supported.
|
* Native elements. Currently not supported.
|
||||||
* @type {Array.<Object>}
|
* @type {Array.<Object>}
|
||||||
|
|||||||
@@ -352,6 +352,7 @@ ol.format.GML2.prototype.createCoordinatesNode_ = function(namespaceURI) {
|
|||||||
*/
|
*/
|
||||||
ol.format.GML2.prototype.writeCoordinates_ = function(node, value, objectStack) {
|
ol.format.GML2.prototype.writeCoordinates_ = function(node, value, objectStack) {
|
||||||
var context = objectStack[objectStack.length - 1];
|
var context = objectStack[objectStack.length - 1];
|
||||||
|
var hasZ = context['hasZ'];
|
||||||
var srsName = context['srsName'];
|
var srsName = context['srsName'];
|
||||||
// only 2d for simple features profile
|
// only 2d for simple features profile
|
||||||
var points = value.getCoordinates();
|
var points = value.getCoordinates();
|
||||||
@@ -360,7 +361,7 @@ ol.format.GML2.prototype.writeCoordinates_ = function(node, value, objectStack)
|
|||||||
var point;
|
var point;
|
||||||
for (var i = 0; i < len; ++i) {
|
for (var i = 0; i < len; ++i) {
|
||||||
point = points[i];
|
point = points[i];
|
||||||
parts[i] = this.getCoords_(point, srsName);
|
parts[i] = this.getCoords_(point, srsName, hasZ);
|
||||||
}
|
}
|
||||||
ol.format.XSD.writeStringTextNode(node, parts.join(' '));
|
ol.format.XSD.writeStringTextNode(node, parts.join(' '));
|
||||||
};
|
};
|
||||||
@@ -388,6 +389,7 @@ ol.format.GML2.prototype.writeCurveSegments_ = function(node, line, objectStack)
|
|||||||
*/
|
*/
|
||||||
ol.format.GML2.prototype.writeSurfaceOrPolygon_ = function(node, geometry, objectStack) {
|
ol.format.GML2.prototype.writeSurfaceOrPolygon_ = function(node, geometry, objectStack) {
|
||||||
var context = objectStack[objectStack.length - 1];
|
var context = objectStack[objectStack.length - 1];
|
||||||
|
var hasZ = context['hasZ'];
|
||||||
var srsName = context['srsName'];
|
var srsName = context['srsName'];
|
||||||
if (node.nodeName !== 'PolygonPatch' && srsName) {
|
if (node.nodeName !== 'PolygonPatch' && srsName) {
|
||||||
node.setAttribute('srsName', srsName);
|
node.setAttribute('srsName', srsName);
|
||||||
@@ -395,7 +397,7 @@ ol.format.GML2.prototype.writeSurfaceOrPolygon_ = function(node, geometry, objec
|
|||||||
if (node.nodeName === 'Polygon' || node.nodeName === 'PolygonPatch') {
|
if (node.nodeName === 'Polygon' || node.nodeName === 'PolygonPatch') {
|
||||||
var rings = geometry.getLinearRings();
|
var rings = geometry.getLinearRings();
|
||||||
ol.xml.pushSerializeAndPop(
|
ol.xml.pushSerializeAndPop(
|
||||||
{node: node, srsName: srsName},
|
{node: node, hasZ: hasZ, srsName: srsName},
|
||||||
ol.format.GML2.RING_SERIALIZERS_,
|
ol.format.GML2.RING_SERIALIZERS_,
|
||||||
this.RING_NODE_FACTORY_,
|
this.RING_NODE_FACTORY_,
|
||||||
rings, objectStack, undefined, this);
|
rings, objectStack, undefined, this);
|
||||||
@@ -456,17 +458,25 @@ ol.format.GML2.prototype.writeRing_ = function(node, ring, objectStack) {
|
|||||||
/**
|
/**
|
||||||
* @param {Array.<number>} point Point geometry.
|
* @param {Array.<number>} point Point geometry.
|
||||||
* @param {string=} opt_srsName Optional srsName
|
* @param {string=} opt_srsName Optional srsName
|
||||||
|
* @param {boolean=} opt_hasZ whether the geometry has a Z coordinate (is 3D) or not.
|
||||||
* @return {string} The coords string.
|
* @return {string} The coords string.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.format.GML2.prototype.getCoords_ = function(point, opt_srsName) {
|
ol.format.GML2.prototype.getCoords_ = function(point, opt_srsName, opt_hasZ) {
|
||||||
var axisOrientation = 'enu';
|
var axisOrientation = 'enu';
|
||||||
if (opt_srsName) {
|
if (opt_srsName) {
|
||||||
axisOrientation = ol.proj.get(opt_srsName).getAxisOrientation();
|
axisOrientation = ol.proj.get(opt_srsName).getAxisOrientation();
|
||||||
}
|
}
|
||||||
return ((axisOrientation.substr(0, 2) === 'en') ?
|
var coords = ((axisOrientation.substr(0, 2) === 'en') ?
|
||||||
point[0] + ',' + point[1] :
|
point[0] + ',' + point[1] :
|
||||||
point[1] + ',' + point[0]);
|
point[1] + ',' + point[0]);
|
||||||
|
if (opt_hasZ) {
|
||||||
|
// For newly created points, Z can be undefined.
|
||||||
|
var z = point[2] || 0;
|
||||||
|
coords += ',' + z;
|
||||||
|
}
|
||||||
|
|
||||||
|
return coords;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -478,13 +488,14 @@ ol.format.GML2.prototype.getCoords_ = function(point, opt_srsName) {
|
|||||||
*/
|
*/
|
||||||
ol.format.GML2.prototype.writeMultiCurveOrLineString_ = function(node, geometry, objectStack) {
|
ol.format.GML2.prototype.writeMultiCurveOrLineString_ = function(node, geometry, objectStack) {
|
||||||
var context = objectStack[objectStack.length - 1];
|
var context = objectStack[objectStack.length - 1];
|
||||||
|
var hasZ = context['hasZ'];
|
||||||
var srsName = context['srsName'];
|
var srsName = context['srsName'];
|
||||||
var curve = context['curve'];
|
var curve = context['curve'];
|
||||||
if (srsName) {
|
if (srsName) {
|
||||||
node.setAttribute('srsName', srsName);
|
node.setAttribute('srsName', srsName);
|
||||||
}
|
}
|
||||||
var lines = geometry.getLineStrings();
|
var lines = geometry.getLineStrings();
|
||||||
ol.xml.pushSerializeAndPop({node: node, srsName: srsName, curve: curve},
|
ol.xml.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName, curve: curve},
|
||||||
ol.format.GML2.LINESTRINGORCURVEMEMBER_SERIALIZERS_,
|
ol.format.GML2.LINESTRINGORCURVEMEMBER_SERIALIZERS_,
|
||||||
this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, lines,
|
this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, lines,
|
||||||
objectStack, undefined, this);
|
objectStack, undefined, this);
|
||||||
@@ -499,6 +510,7 @@ ol.format.GML2.prototype.writeMultiCurveOrLineString_ = function(node, geometry,
|
|||||||
*/
|
*/
|
||||||
ol.format.GML2.prototype.writePoint_ = function(node, geometry, objectStack) {
|
ol.format.GML2.prototype.writePoint_ = function(node, geometry, objectStack) {
|
||||||
var context = objectStack[objectStack.length - 1];
|
var context = objectStack[objectStack.length - 1];
|
||||||
|
var hasZ = context['hasZ'];
|
||||||
var srsName = context['srsName'];
|
var srsName = context['srsName'];
|
||||||
if (srsName) {
|
if (srsName) {
|
||||||
node.setAttribute('srsName', srsName);
|
node.setAttribute('srsName', srsName);
|
||||||
@@ -506,7 +518,7 @@ ol.format.GML2.prototype.writePoint_ = function(node, geometry, objectStack) {
|
|||||||
var coordinates = this.createCoordinatesNode_(node.namespaceURI);
|
var coordinates = this.createCoordinatesNode_(node.namespaceURI);
|
||||||
node.appendChild(coordinates);
|
node.appendChild(coordinates);
|
||||||
var point = geometry.getCoordinates();
|
var point = geometry.getCoordinates();
|
||||||
var coord = this.getCoords_(point, srsName);
|
var coord = this.getCoords_(point, srsName, hasZ);
|
||||||
ol.format.XSD.writeStringTextNode(coordinates, coord);
|
ol.format.XSD.writeStringTextNode(coordinates, coord);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -520,12 +532,13 @@ ol.format.GML2.prototype.writePoint_ = function(node, geometry, objectStack) {
|
|||||||
ol.format.GML2.prototype.writeMultiPoint_ = function(node, geometry,
|
ol.format.GML2.prototype.writeMultiPoint_ = function(node, geometry,
|
||||||
objectStack) {
|
objectStack) {
|
||||||
var context = objectStack[objectStack.length - 1];
|
var context = objectStack[objectStack.length - 1];
|
||||||
|
var hasZ = context['hasZ'];
|
||||||
var srsName = context['srsName'];
|
var srsName = context['srsName'];
|
||||||
if (srsName) {
|
if (srsName) {
|
||||||
node.setAttribute('srsName', srsName);
|
node.setAttribute('srsName', srsName);
|
||||||
}
|
}
|
||||||
var points = geometry.getPoints();
|
var points = geometry.getPoints();
|
||||||
ol.xml.pushSerializeAndPop({node: node, srsName: srsName},
|
ol.xml.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName},
|
||||||
ol.format.GML2.POINTMEMBER_SERIALIZERS_,
|
ol.format.GML2.POINTMEMBER_SERIALIZERS_,
|
||||||
ol.xml.makeSimpleNodeFactory('pointMember'), points,
|
ol.xml.makeSimpleNodeFactory('pointMember'), points,
|
||||||
objectStack, undefined, this);
|
objectStack, undefined, this);
|
||||||
@@ -586,13 +599,14 @@ ol.format.GML2.prototype.writeLinearRing_ = function(node, geometry, objectStack
|
|||||||
*/
|
*/
|
||||||
ol.format.GML2.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry, objectStack) {
|
ol.format.GML2.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry, objectStack) {
|
||||||
var context = objectStack[objectStack.length - 1];
|
var context = objectStack[objectStack.length - 1];
|
||||||
|
var hasZ = context['hasZ'];
|
||||||
var srsName = context['srsName'];
|
var srsName = context['srsName'];
|
||||||
var surface = context['surface'];
|
var surface = context['surface'];
|
||||||
if (srsName) {
|
if (srsName) {
|
||||||
node.setAttribute('srsName', srsName);
|
node.setAttribute('srsName', srsName);
|
||||||
}
|
}
|
||||||
var polygons = geometry.getPolygons();
|
var polygons = geometry.getPolygons();
|
||||||
ol.xml.pushSerializeAndPop({node: node, srsName: srsName, surface: surface},
|
ol.xml.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName, surface: surface},
|
||||||
ol.format.GML2.SURFACEORPOLYGONMEMBER_SERIALIZERS_,
|
ol.format.GML2.SURFACEORPOLYGONMEMBER_SERIALIZERS_,
|
||||||
this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, polygons,
|
this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, polygons,
|
||||||
objectStack, undefined, this);
|
objectStack, undefined, this);
|
||||||
|
|||||||
@@ -565,6 +565,7 @@ ol.format.GML3.prototype.SEGMENTS_PARSERS_ = {
|
|||||||
*/
|
*/
|
||||||
ol.format.GML3.prototype.writePos_ = function(node, value, objectStack) {
|
ol.format.GML3.prototype.writePos_ = function(node, value, objectStack) {
|
||||||
var context = objectStack[objectStack.length - 1];
|
var context = objectStack[objectStack.length - 1];
|
||||||
|
var hasZ = context['hasZ'];
|
||||||
var srsName = context['srsName'];
|
var srsName = context['srsName'];
|
||||||
var axisOrientation = 'enu';
|
var axisOrientation = 'enu';
|
||||||
if (srsName) {
|
if (srsName) {
|
||||||
@@ -578,6 +579,11 @@ ol.format.GML3.prototype.writePos_ = function(node, value, objectStack) {
|
|||||||
} else {
|
} else {
|
||||||
coords = (point[1] + ' ' + point[0]);
|
coords = (point[1] + ' ' + point[0]);
|
||||||
}
|
}
|
||||||
|
if (hasZ) {
|
||||||
|
// For newly created points, Z can be undefined.
|
||||||
|
var z = point[2] || 0;
|
||||||
|
coords += ' ' + z;
|
||||||
|
}
|
||||||
ol.format.XSD.writeStringTextNode(node, coords);
|
ol.format.XSD.writeStringTextNode(node, coords);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -585,17 +591,25 @@ ol.format.GML3.prototype.writePos_ = function(node, value, objectStack) {
|
|||||||
/**
|
/**
|
||||||
* @param {Array.<number>} point Point geometry.
|
* @param {Array.<number>} point Point geometry.
|
||||||
* @param {string=} opt_srsName Optional srsName
|
* @param {string=} opt_srsName Optional srsName
|
||||||
|
* @param {boolean=} opt_hasZ whether the geometry has a Z coordinate (is 3D) or not.
|
||||||
* @return {string} The coords string.
|
* @return {string} The coords string.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.format.GML3.prototype.getCoords_ = function(point, opt_srsName) {
|
ol.format.GML3.prototype.getCoords_ = function(point, opt_srsName, opt_hasZ) {
|
||||||
var axisOrientation = 'enu';
|
var axisOrientation = 'enu';
|
||||||
if (opt_srsName) {
|
if (opt_srsName) {
|
||||||
axisOrientation = ol.proj.get(opt_srsName).getAxisOrientation();
|
axisOrientation = ol.proj.get(opt_srsName).getAxisOrientation();
|
||||||
}
|
}
|
||||||
return ((axisOrientation.substr(0, 2) === 'en') ?
|
var coords = ((axisOrientation.substr(0, 2) === 'en') ?
|
||||||
point[0] + ' ' + point[1] :
|
point[0] + ' ' + point[1] :
|
||||||
point[1] + ' ' + point[0]);
|
point[1] + ' ' + point[0]);
|
||||||
|
if (opt_hasZ) {
|
||||||
|
// For newly created points, Z can be undefined.
|
||||||
|
var z = point[2] || 0;
|
||||||
|
coords += ' ' + z;
|
||||||
|
}
|
||||||
|
|
||||||
|
return coords;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -607,6 +621,7 @@ ol.format.GML3.prototype.getCoords_ = function(point, opt_srsName) {
|
|||||||
*/
|
*/
|
||||||
ol.format.GML3.prototype.writePosList_ = function(node, value, objectStack) {
|
ol.format.GML3.prototype.writePosList_ = function(node, value, objectStack) {
|
||||||
var context = objectStack[objectStack.length - 1];
|
var context = objectStack[objectStack.length - 1];
|
||||||
|
var hasZ = context['hasZ'];
|
||||||
var srsName = context['srsName'];
|
var srsName = context['srsName'];
|
||||||
// only 2d for simple features profile
|
// only 2d for simple features profile
|
||||||
var points = value.getCoordinates();
|
var points = value.getCoordinates();
|
||||||
@@ -615,7 +630,7 @@ ol.format.GML3.prototype.writePosList_ = function(node, value, objectStack) {
|
|||||||
var point;
|
var point;
|
||||||
for (var i = 0; i < len; ++i) {
|
for (var i = 0; i < len; ++i) {
|
||||||
point = points[i];
|
point = points[i];
|
||||||
parts[i] = this.getCoords_(point, srsName);
|
parts[i] = this.getCoords_(point, srsName, hasZ);
|
||||||
}
|
}
|
||||||
ol.format.XSD.writeStringTextNode(node, parts.join(' '));
|
ol.format.XSD.writeStringTextNode(node, parts.join(' '));
|
||||||
};
|
};
|
||||||
@@ -717,6 +732,7 @@ ol.format.GML3.prototype.RING_NODE_FACTORY_ = function(value, objectStack, opt_n
|
|||||||
*/
|
*/
|
||||||
ol.format.GML3.prototype.writeSurfaceOrPolygon_ = function(node, geometry, objectStack) {
|
ol.format.GML3.prototype.writeSurfaceOrPolygon_ = function(node, geometry, objectStack) {
|
||||||
var context = objectStack[objectStack.length - 1];
|
var context = objectStack[objectStack.length - 1];
|
||||||
|
var hasZ = context['hasZ'];
|
||||||
var srsName = context['srsName'];
|
var srsName = context['srsName'];
|
||||||
if (node.nodeName !== 'PolygonPatch' && srsName) {
|
if (node.nodeName !== 'PolygonPatch' && srsName) {
|
||||||
node.setAttribute('srsName', srsName);
|
node.setAttribute('srsName', srsName);
|
||||||
@@ -724,7 +740,7 @@ ol.format.GML3.prototype.writeSurfaceOrPolygon_ = function(node, geometry, objec
|
|||||||
if (node.nodeName === 'Polygon' || node.nodeName === 'PolygonPatch') {
|
if (node.nodeName === 'Polygon' || node.nodeName === 'PolygonPatch') {
|
||||||
var rings = geometry.getLinearRings();
|
var rings = geometry.getLinearRings();
|
||||||
ol.xml.pushSerializeAndPop(
|
ol.xml.pushSerializeAndPop(
|
||||||
{node: node, srsName: srsName},
|
{node: node, hasZ: hasZ, srsName: srsName},
|
||||||
ol.format.GML3.RING_SERIALIZERS_,
|
ol.format.GML3.RING_SERIALIZERS_,
|
||||||
this.RING_NODE_FACTORY_,
|
this.RING_NODE_FACTORY_,
|
||||||
rings, objectStack, undefined, this);
|
rings, objectStack, undefined, this);
|
||||||
@@ -771,13 +787,14 @@ ol.format.GML3.prototype.writeCurveOrLineString_ = function(node, geometry, obje
|
|||||||
*/
|
*/
|
||||||
ol.format.GML3.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry, objectStack) {
|
ol.format.GML3.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry, objectStack) {
|
||||||
var context = objectStack[objectStack.length - 1];
|
var context = objectStack[objectStack.length - 1];
|
||||||
|
var hasZ = context['hasZ'];
|
||||||
var srsName = context['srsName'];
|
var srsName = context['srsName'];
|
||||||
var surface = context['surface'];
|
var surface = context['surface'];
|
||||||
if (srsName) {
|
if (srsName) {
|
||||||
node.setAttribute('srsName', srsName);
|
node.setAttribute('srsName', srsName);
|
||||||
}
|
}
|
||||||
var polygons = geometry.getPolygons();
|
var polygons = geometry.getPolygons();
|
||||||
ol.xml.pushSerializeAndPop({node: node, srsName: srsName, surface: surface},
|
ol.xml.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName, surface: surface},
|
||||||
ol.format.GML3.SURFACEORPOLYGONMEMBER_SERIALIZERS_,
|
ol.format.GML3.SURFACEORPOLYGONMEMBER_SERIALIZERS_,
|
||||||
this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, polygons,
|
this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, polygons,
|
||||||
objectStack, undefined, this);
|
objectStack, undefined, this);
|
||||||
@@ -794,11 +811,12 @@ ol.format.GML3.prototype.writeMultiPoint_ = function(node, geometry,
|
|||||||
objectStack) {
|
objectStack) {
|
||||||
var context = objectStack[objectStack.length - 1];
|
var context = objectStack[objectStack.length - 1];
|
||||||
var srsName = context['srsName'];
|
var srsName = context['srsName'];
|
||||||
|
var hasZ = context['hasZ'];
|
||||||
if (srsName) {
|
if (srsName) {
|
||||||
node.setAttribute('srsName', srsName);
|
node.setAttribute('srsName', srsName);
|
||||||
}
|
}
|
||||||
var points = geometry.getPoints();
|
var points = geometry.getPoints();
|
||||||
ol.xml.pushSerializeAndPop({node: node, srsName: srsName},
|
ol.xml.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName},
|
||||||
ol.format.GML3.POINTMEMBER_SERIALIZERS_,
|
ol.format.GML3.POINTMEMBER_SERIALIZERS_,
|
||||||
ol.xml.makeSimpleNodeFactory('pointMember'), points,
|
ol.xml.makeSimpleNodeFactory('pointMember'), points,
|
||||||
objectStack, undefined, this);
|
objectStack, undefined, this);
|
||||||
@@ -813,13 +831,14 @@ ol.format.GML3.prototype.writeMultiPoint_ = function(node, geometry,
|
|||||||
*/
|
*/
|
||||||
ol.format.GML3.prototype.writeMultiCurveOrLineString_ = function(node, geometry, objectStack) {
|
ol.format.GML3.prototype.writeMultiCurveOrLineString_ = function(node, geometry, objectStack) {
|
||||||
var context = objectStack[objectStack.length - 1];
|
var context = objectStack[objectStack.length - 1];
|
||||||
|
var hasZ = context['hasZ'];
|
||||||
var srsName = context['srsName'];
|
var srsName = context['srsName'];
|
||||||
var curve = context['curve'];
|
var curve = context['curve'];
|
||||||
if (srsName) {
|
if (srsName) {
|
||||||
node.setAttribute('srsName', srsName);
|
node.setAttribute('srsName', srsName);
|
||||||
}
|
}
|
||||||
var lines = geometry.getLineStrings();
|
var lines = geometry.getLineStrings();
|
||||||
ol.xml.pushSerializeAndPop({node: node, srsName: srsName, curve: curve},
|
ol.xml.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName, curve: curve},
|
||||||
ol.format.GML3.LINESTRINGORCURVEMEMBER_SERIALIZERS_,
|
ol.format.GML3.LINESTRINGORCURVEMEMBER_SERIALIZERS_,
|
||||||
this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, lines,
|
this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, lines,
|
||||||
objectStack, undefined, this);
|
objectStack, undefined, this);
|
||||||
@@ -1168,7 +1187,7 @@ ol.format.GML3.prototype.GEOMETRY_NODE_FACTORY_ = function(value, objectStack, o
|
|||||||
ol.format.GML3.prototype.writeGeometryNode = function(geometry, opt_options) {
|
ol.format.GML3.prototype.writeGeometryNode = function(geometry, opt_options) {
|
||||||
opt_options = this.adaptOptions(opt_options);
|
opt_options = this.adaptOptions(opt_options);
|
||||||
var geom = ol.xml.createElementNS('http://www.opengis.net/gml', 'geom');
|
var geom = ol.xml.createElementNS('http://www.opengis.net/gml', 'geom');
|
||||||
var context = {node: geom, srsName: this.srsName,
|
var context = {node: geom, hasZ: this.hasZ, srsName: this.srsName,
|
||||||
curve: this.curve_, surface: this.surface_,
|
curve: this.curve_, surface: this.surface_,
|
||||||
multiSurface: this.multiSurface_, multiCurve: this.multiCurve_};
|
multiSurface: this.multiSurface_, multiCurve: this.multiCurve_};
|
||||||
if (opt_options) {
|
if (opt_options) {
|
||||||
@@ -1208,6 +1227,7 @@ ol.format.GML3.prototype.writeFeaturesNode = function(features, opt_options) {
|
|||||||
'xsi:schemaLocation', this.schemaLocation);
|
'xsi:schemaLocation', this.schemaLocation);
|
||||||
var context = {
|
var context = {
|
||||||
srsName: this.srsName,
|
srsName: this.srsName,
|
||||||
|
hasZ: this.hasZ,
|
||||||
curve: this.curve_,
|
curve: this.curve_,
|
||||||
surface: this.surface_,
|
surface: this.surface_,
|
||||||
multiSurface: this.multiSurface_,
|
multiSurface: this.multiSurface_,
|
||||||
|
|||||||
@@ -469,7 +469,7 @@ ol.format.WFS.writeUpdate_ = function(node, feature, objectStack) {
|
|||||||
}
|
}
|
||||||
ol.xml.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ (
|
ol.xml.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ (
|
||||||
{'gmlVersion': context['gmlVersion'], node: node,
|
{'gmlVersion': context['gmlVersion'], node: node,
|
||||||
'srsName': context['srsName']}),
|
'hasZ': context['hasZ'], 'srsName': context['srsName']}),
|
||||||
ol.format.WFS.TRANSACTION_SERIALIZERS_,
|
ol.format.WFS.TRANSACTION_SERIALIZERS_,
|
||||||
ol.xml.makeSimpleNodeFactory('Property'), values,
|
ol.xml.makeSimpleNodeFactory('Property'), values,
|
||||||
objectStack);
|
objectStack);
|
||||||
@@ -934,7 +934,7 @@ ol.format.WFS.prototype.writeTransaction = function(inserts, updates, deletes,
|
|||||||
if (inserts) {
|
if (inserts) {
|
||||||
obj = {node: node, 'featureNS': options.featureNS,
|
obj = {node: node, 'featureNS': options.featureNS,
|
||||||
'featureType': options.featureType, 'featurePrefix': options.featurePrefix,
|
'featureType': options.featureType, 'featurePrefix': options.featurePrefix,
|
||||||
'gmlVersion': gmlVersion, 'srsName': options.srsName};
|
'gmlVersion': gmlVersion, 'hasZ': options.hasZ, 'srsName': options.srsName};
|
||||||
ol.obj.assign(obj, baseObj);
|
ol.obj.assign(obj, baseObj);
|
||||||
ol.xml.pushSerializeAndPop(obj,
|
ol.xml.pushSerializeAndPop(obj,
|
||||||
ol.format.WFS.TRANSACTION_SERIALIZERS_,
|
ol.format.WFS.TRANSACTION_SERIALIZERS_,
|
||||||
@@ -944,7 +944,7 @@ ol.format.WFS.prototype.writeTransaction = function(inserts, updates, deletes,
|
|||||||
if (updates) {
|
if (updates) {
|
||||||
obj = {node: node, 'featureNS': options.featureNS,
|
obj = {node: node, 'featureNS': options.featureNS,
|
||||||
'featureType': options.featureType, 'featurePrefix': options.featurePrefix,
|
'featureType': options.featureType, 'featurePrefix': options.featurePrefix,
|
||||||
'gmlVersion': gmlVersion, 'srsName': options.srsName};
|
'gmlVersion': gmlVersion, 'hasZ': options.hasZ, 'srsName': options.srsName};
|
||||||
ol.obj.assign(obj, baseObj);
|
ol.obj.assign(obj, baseObj);
|
||||||
ol.xml.pushSerializeAndPop(obj,
|
ol.xml.pushSerializeAndPop(obj,
|
||||||
ol.format.WFS.TRANSACTION_SERIALIZERS_,
|
ol.format.WFS.TRANSACTION_SERIALIZERS_,
|
||||||
|
|||||||
@@ -880,6 +880,86 @@ describe('ol.format.WFS', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('when writing out a transaction request', function() {
|
||||||
|
var text;
|
||||||
|
var filename = 'spec/ol/format/wfs/TransactionMultiVersion100_3D.xml';
|
||||||
|
before(function(done) {
|
||||||
|
afterLoadText(filename, function(xml) {
|
||||||
|
text = xml;
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('handles 3D in WFS 1.0.0', function() {
|
||||||
|
var format = new ol.format.WFS();
|
||||||
|
var insertFeature = new ol.Feature({
|
||||||
|
the_geom: new ol.geom.LineString([[1.1, 2, 4], [3, 4.2, 5]]),
|
||||||
|
foo: 'bar',
|
||||||
|
nul: null
|
||||||
|
});
|
||||||
|
insertFeature.setGeometryName('the_geom');
|
||||||
|
var inserts = [insertFeature];
|
||||||
|
var updateFeature = new ol.Feature({
|
||||||
|
the_geom: new ol.geom.LineString([[1.1, 2, 6], [3, 4.2, 7]]),
|
||||||
|
foo: 'bar',
|
||||||
|
// null value gets Property element with no Value
|
||||||
|
nul: null,
|
||||||
|
// undefined value means don't create a Property element
|
||||||
|
unwritten: undefined
|
||||||
|
});
|
||||||
|
updateFeature.setId('fid.42');
|
||||||
|
var updates = [updateFeature];
|
||||||
|
|
||||||
|
var serialized = format.writeTransaction(inserts, updates, null, {
|
||||||
|
featureNS: 'http://www.openplans.org/topp',
|
||||||
|
featureType: 'states',
|
||||||
|
featurePrefix: 'topp',
|
||||||
|
hasZ: true,
|
||||||
|
version: '1.0.0'
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(serialized).to.xmleql(ol.xml.parse(text));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('when writing out a Transaction request', function() {
|
||||||
|
var text;
|
||||||
|
before(function(done) {
|
||||||
|
afterLoadText('spec/ol/format/wfs/TransactionMulti_3D.xml', function(xml) {
|
||||||
|
text = xml;
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('handles 3D in WFS 1.1.0', function() {
|
||||||
|
var format = new ol.format.WFS();
|
||||||
|
var insertFeature = new ol.Feature({
|
||||||
|
the_geom: new ol.geom.MultiPoint([[1, 2, 3]]),
|
||||||
|
foo: 'bar',
|
||||||
|
nul: null
|
||||||
|
});
|
||||||
|
insertFeature.setGeometryName('the_geom');
|
||||||
|
var inserts = [insertFeature];
|
||||||
|
var updateFeature = new ol.Feature({
|
||||||
|
the_geom: new ol.geom.MultiPoint([[1, 2, 3]]),
|
||||||
|
foo: 'bar',
|
||||||
|
// null value gets Property element with no Value
|
||||||
|
nul: null,
|
||||||
|
// undefined value means don't create a Property element
|
||||||
|
unwritten: undefined
|
||||||
|
});
|
||||||
|
updateFeature.setId('fid.42');
|
||||||
|
var updates = [updateFeature];
|
||||||
|
|
||||||
|
var serialized = format.writeTransaction(inserts, updates, null, {
|
||||||
|
featureNS: 'http://www.openplans.org/topp',
|
||||||
|
featureType: 'states',
|
||||||
|
hasZ: true,
|
||||||
|
featurePrefix: 'topp'
|
||||||
|
});
|
||||||
|
expect(serialized).to.xmleql(ol.xml.parse(text));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('when writing out a GetFeature request', function() {
|
describe('when writing out a GetFeature request', function() {
|
||||||
var text;
|
var text;
|
||||||
|
|||||||
32
test/spec/ol/format/wfs/TransactionMultiVersion100_3D.xml
Normal file
32
test/spec/ol/format/wfs/TransactionMultiVersion100_3D.xml
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<Transaction xmlns="http://www.opengis.net/wfs" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" service="WFS" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/wfs.xsd">
|
||||||
|
<Insert>
|
||||||
|
<states xmlns="http://www.openplans.org/topp">
|
||||||
|
<the_geom>
|
||||||
|
<LineString xmlns="http://www.opengis.net/gml">
|
||||||
|
<coordinates decimal="." cs="," ts=" ">1.1,2,4 3,4.2,5</coordinates>
|
||||||
|
</LineString>
|
||||||
|
</the_geom>
|
||||||
|
<foo>bar</foo>
|
||||||
|
</states>
|
||||||
|
</Insert>
|
||||||
|
<Update xmlns:wfs="http://www.opengis.net/wfs" typeName="topp:states" xmlns:topp="http://www.openplans.org/topp">
|
||||||
|
<Property>
|
||||||
|
<Name>the_geom</Name>
|
||||||
|
<Value>
|
||||||
|
<LineString xmlns="http://www.opengis.net/gml">
|
||||||
|
<coordinates decimal="." cs="," ts=" ">1.1,2,6 3,4.2,7</coordinates>
|
||||||
|
</LineString>
|
||||||
|
</Value>
|
||||||
|
</Property>
|
||||||
|
<Property>
|
||||||
|
<Name>foo</Name>
|
||||||
|
<Value>bar</Value>
|
||||||
|
</Property>
|
||||||
|
<Property>
|
||||||
|
<Name>nul</Name>
|
||||||
|
</Property>
|
||||||
|
<Filter xmlns="http://www.opengis.net/ogc">
|
||||||
|
<FeatureId fid="fid.42"/>
|
||||||
|
</Filter>
|
||||||
|
</Update>
|
||||||
|
</Transaction>
|
||||||
40
test/spec/ol/format/wfs/TransactionMulti_3D.xml
Normal file
40
test/spec/ol/format/wfs/TransactionMulti_3D.xml
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" service="WFS" version="1.1.0" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">
|
||||||
|
<wfs:Insert>
|
||||||
|
<feature:states xmlns:feature="http://www.openplans.org/topp">
|
||||||
|
<feature:the_geom>
|
||||||
|
<gml:MultiPoint xmlns:gml="http://www.opengis.net/gml">
|
||||||
|
<gml:pointMember>
|
||||||
|
<gml:Point>
|
||||||
|
<gml:pos>1 2 3</gml:pos>
|
||||||
|
</gml:Point>
|
||||||
|
</gml:pointMember>
|
||||||
|
</gml:MultiPoint>
|
||||||
|
</feature:the_geom>
|
||||||
|
<feature:foo>bar</feature:foo>
|
||||||
|
</feature:states>
|
||||||
|
</wfs:Insert>
|
||||||
|
<wfs:Update xmlns:wfs="http://www.opengis.net/wfs" typeName="topp:states" xmlns:topp="http://www.openplans.org/topp">
|
||||||
|
<wfs:Property>
|
||||||
|
<wfs:Name>the_geom</wfs:Name>
|
||||||
|
<wfs:Value>
|
||||||
|
<gml:MultiPoint xmlns:gml="http://www.opengis.net/gml">
|
||||||
|
<gml:pointMember>
|
||||||
|
<gml:Point>
|
||||||
|
<gml:pos>1 2 3</gml:pos>
|
||||||
|
</gml:Point>
|
||||||
|
</gml:pointMember>
|
||||||
|
</gml:MultiPoint>
|
||||||
|
</wfs:Value>
|
||||||
|
</wfs:Property>
|
||||||
|
<wfs:Property>
|
||||||
|
<wfs:Name>foo</wfs:Name>
|
||||||
|
<wfs:Value>bar</wfs:Value>
|
||||||
|
</wfs:Property>
|
||||||
|
<wfs:Property>
|
||||||
|
<wfs:Name>nul</wfs:Name>
|
||||||
|
</wfs:Property>
|
||||||
|
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
|
||||||
|
<ogc:FeatureId fid="fid.42"/>
|
||||||
|
</ogc:Filter>
|
||||||
|
</wfs:Update>
|
||||||
|
</wfs:Transaction>
|
||||||
Reference in New Issue
Block a user