Fix TypeScript errors in ol/format/GML

This commit is contained in:
Kevin Schmidt
2018-09-25 14:12:00 -06:00
parent d6aced3e43
commit d308288eed
5 changed files with 64 additions and 30 deletions
+15 -14
View File
@@ -183,7 +183,7 @@ class GML3 extends GMLBase {
*/
readPolygonPatch_(node, objectStack) {
return pushParseAndPop([null],
this.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack, this);
this.FLAT_LINEAR_RINGS_PARSERS, node, objectStack, this);
}
/**
@@ -194,7 +194,7 @@ class GML3 extends GMLBase {
*/
readLineStringSegment_(node, objectStack) {
return pushParseAndPop([null],
this.GEOMETRY_FLAT_COORDINATES_PARSERS_,
this.GEOMETRY_FLAT_COORDINATES_PARSERS,
node, objectStack, this);
}
@@ -357,9 +357,9 @@ class GML3 extends GMLBase {
} else if (node.getAttribute('dimension')) {
dim = readNonNegativeIntegerString(
node.getAttribute('dimension'));
} else if (node.parentNode.getAttribute('srsDimension')) {
} else if (/** @type {Element} */ (node.parentNode).getAttribute('srsDimension')) {
dim = readNonNegativeIntegerString(
node.parentNode.getAttribute('srsDimension'));
/** @type {Element} */ (node.parentNode).getAttribute('srsDimension'));
} else if (contextDimension) {
dim = readNonNegativeIntegerString(contextDimension);
}
@@ -387,7 +387,7 @@ class GML3 extends GMLBase {
writePos_(node, value, objectStack) {
const context = objectStack[objectStack.length - 1];
const hasZ = context['hasZ'];
const srsDimension = hasZ ? 3 : 2;
const srsDimension = hasZ ? '3' : '2';
node.setAttribute('srsDimension', srsDimension);
const srsName = context['srsName'];
let axisOrientation = 'enu';
@@ -443,7 +443,7 @@ class GML3 extends GMLBase {
writePosList_(node, value, objectStack) {
const context = objectStack[objectStack.length - 1];
const hasZ = context['hasZ'];
const srsDimension = hasZ ? 3 : 2;
const srsDimension = hasZ ? '3' : '2';
node.setAttribute('srsDimension', srsDimension);
const srsName = context['srsName'];
// only 2d for simple features profile
@@ -731,7 +731,7 @@ class GML3 extends GMLBase {
writeGeometryElement(node, geometry, objectStack) {
const context = /** @type {import("./Feature.js").WriteOptions} */ (objectStack[objectStack.length - 1]);
const item = assign({}, context);
item.node = node;
item['node'] = node;
let value;
if (Array.isArray(geometry)) {
if (context.dataProjection) {
@@ -757,7 +757,7 @@ class GML3 extends GMLBase {
writeFeatureElement(node, feature, objectStack) {
const fid = feature.getId();
if (fid) {
node.setAttribute('fid', fid);
node.setAttribute('fid', /** @type {string} */ (fid));
}
const context = /** @type {Object} */ (objectStack[objectStack.length - 1]);
const featureNS = context['featureNS'];
@@ -805,6 +805,7 @@ class GML3 extends GMLBase {
const context = /** @type {Object} */ (objectStack[objectStack.length - 1]);
const featureType = context['featureType'];
const featureNS = context['featureNS'];
/** @type {Object<string, Object<string, import("../xml.js").Serializer>>} */
const serializers = {};
serializers[featureNS] = {};
serializers[featureNS][featureType] = makeChildAppender(
@@ -921,9 +922,9 @@ class GML3 extends GMLBase {
/**
* @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @private
* @protected
*/
GML3.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS_ = {
GML3.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS = {
'http://www.opengis.net/gml': {
'pos': makeReplacer(GML3.prototype.readFlatPos_),
'posList': makeReplacer(GML3.prototype.readFlatPosList_)
@@ -934,9 +935,9 @@ GML3.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS_ = {
/**
* @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @private
* @protected
*/
GML3.prototype.FLAT_LINEAR_RINGS_PARSERS_ = {
GML3.prototype.FLAT_LINEAR_RINGS_PARSERS = {
'http://www.opengis.net/gml': {
'interior': GML3.prototype.interiorParser_,
'exterior': GML3.prototype.exteriorParser_
@@ -947,9 +948,9 @@ GML3.prototype.FLAT_LINEAR_RINGS_PARSERS_ = {
/**
* @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @private
* @protected
*/
GML3.prototype.GEOMETRY_PARSERS_ = {
GML3.prototype.GEOMETRY_PARSERS = {
'http://www.opengis.net/gml': {
'Point': makeReplacer(GMLBase.prototype.readPoint),
'MultiPoint': makeReplacer(