diff --git a/src/ol/format/GML2.js b/src/ol/format/GML2.js index a35088f0fe..a6baf61c32 100644 --- a/src/ol/format/GML2.js +++ b/src/ol/format/GML2.js @@ -59,156 +59,6 @@ class GML2 extends GMLBase { this.schemaLocation = options.schemaLocation ? options.schemaLocation : schemaLocation; - /** - * @const - * @type {Object.>} - * @private - */ - this.GEOMETRY_FLAT_COORDINATES_PARSERS_ = { - 'http://www.opengis.net/gml': { - 'coordinates': makeReplacer(this.readFlatCoordinates_) - } - }; - - /** - * @const - * @type {Object.>} - * @private - */ - this.FLAT_LINEAR_RINGS_PARSERS_ = { - 'http://www.opengis.net/gml': { - 'innerBoundaryIs': this.innerBoundaryIsParser_, - 'outerBoundaryIs': this.outerBoundaryIsParser_ - } - }; - - /** - * @const - * @type {Object.>} - * @private - */ - this.BOX_PARSERS_ = { - 'http://www.opengis.net/gml': { - 'coordinates': makeArrayPusher( - this.readFlatCoordinates_) - } - }; - - /** - * @const - * @type {Object.>} - * @private - */ - this.GEOMETRY_PARSERS_ = { - 'http://www.opengis.net/gml': { - 'Point': makeReplacer(this.readPoint), - 'MultiPoint': makeReplacer( - this.readMultiPoint), - 'LineString': makeReplacer( - this.readLineString), - 'MultiLineString': makeReplacer( - this.readMultiLineString), - 'LinearRing': makeReplacer( - this.readLinearRing), - 'Polygon': makeReplacer(this.readPolygon), - 'MultiPolygon': makeReplacer( - this.readMultiPolygon), - 'Box': makeReplacer(this.readBox_) - } - }; - - /** - * @const - * @type {Object.>} - * @private - */ - this.GEOMETRY_SERIALIZERS_ = { - 'http://www.opengis.net/gml': { - 'Curve': makeChildAppender( - this.writeCurveOrLineString_), - 'MultiCurve': makeChildAppender( - this.writeMultiCurveOrLineString_), - 'Point': makeChildAppender(this.writePoint_), - 'MultiPoint': makeChildAppender( - this.writeMultiPoint_), - 'LineString': makeChildAppender( - this.writeCurveOrLineString_), - 'MultiLineString': makeChildAppender( - this.writeMultiCurveOrLineString_), - 'LinearRing': makeChildAppender( - this.writeLinearRing_), - 'Polygon': makeChildAppender( - this.writeSurfaceOrPolygon_), - 'MultiPolygon': makeChildAppender( - this.writeMultiSurfaceOrPolygon_), - 'Surface': makeChildAppender( - this.writeSurfaceOrPolygon_), - 'MultiSurface': makeChildAppender( - this.writeMultiSurfaceOrPolygon_), - 'Envelope': makeChildAppender( - this.writeEnvelope) - } - }; - - /** - * @type {Object.>} - * @private - */ - this.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = { - 'http://www.opengis.net/gml': { - 'lineStringMember': makeChildAppender( - this.writeLineStringOrCurveMember_), - 'curveMember': makeChildAppender( - this.writeLineStringOrCurveMember_) - } - }; - - /** - * @type {Object.>} - * @private - */ - this.RING_SERIALIZERS_ = { - 'http://www.opengis.net/gml': { - 'outerBoundaryIs': makeChildAppender(this.writeRing_), - 'innerBoundaryIs': makeChildAppender(this.writeRing_) - } - }; - - /** - * @type {Object.>} - * @private - */ - this.POINTMEMBER_SERIALIZERS_ = { - 'http://www.opengis.net/gml': { - 'pointMember': makeChildAppender( - this.writePointMember_) - } - }; - - /** - * @const - * @type {Object.>} - * @private - */ - this.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = { - 'http://www.opengis.net/gml': { - 'surfaceMember': makeChildAppender( - this.writeSurfaceOrPolygonMember_), - 'polygonMember': makeChildAppender( - this.writeSurfaceOrPolygonMember_) - } - }; - - /** - * @type {Object.>} - * @private - */ - this.ENVELOPE_SERIALIZERS_ = { - 'http://www.opengis.net/gml': { - 'lowerCorner': makeChildAppender(writeStringTextNode), - 'upperCorner': makeChildAppender(writeStringTextNode) - } - }; } /** @@ -735,4 +585,155 @@ class GML2 extends GMLBase { } } +/** + * @const + * @type {Object.>} + * @private + */ +GML2.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS_ = { + 'http://www.opengis.net/gml': { + 'coordinates': makeReplacer(GML2.prototype.readFlatCoordinates_) + } +}; + +/** + * @const + * @type {Object.>} + * @private + */ +GML2.prototype.FLAT_LINEAR_RINGS_PARSERS_ = { + 'http://www.opengis.net/gml': { + 'innerBoundaryIs': GML2.prototype.innerBoundaryIsParser_, + 'outerBoundaryIs': GML2.prototype.outerBoundaryIsParser_ + } +}; + +/** + * @const + * @type {Object.>} + * @private + */ +GML2.prototype.BOX_PARSERS_ = { + 'http://www.opengis.net/gml': { + 'coordinates': makeArrayPusher( + GML2.prototype.readFlatCoordinates_) + } +}; + +/** + * @const + * @type {Object.>} + * @private + */ +GML2.prototype.GEOMETRY_PARSERS_ = { + 'http://www.opengis.net/gml': { + 'Point': makeReplacer(GMLBase.prototype.readPoint), + 'MultiPoint': makeReplacer( + GMLBase.prototype.readMultiPoint), + 'LineString': makeReplacer( + GMLBase.prototype.readLineString), + 'MultiLineString': makeReplacer( + GMLBase.prototype.readMultiLineString), + 'LinearRing': makeReplacer( + GMLBase.prototype.readLinearRing), + 'Polygon': makeReplacer(GMLBase.prototype.readPolygon), + 'MultiPolygon': makeReplacer( + GMLBase.prototype.readMultiPolygon), + 'Box': makeReplacer(GML2.prototype.readBox_) + } +}; + +/** + * @const + * @type {Object.>} + * @private + */ +GML2.prototype.GEOMETRY_SERIALIZERS_ = { + 'http://www.opengis.net/gml': { + 'Curve': makeChildAppender( + GML2.prototype.writeCurveOrLineString_), + 'MultiCurve': makeChildAppender( + GML2.prototype.writeMultiCurveOrLineString_), + 'Point': makeChildAppender(GML2.prototype.writePoint_), + 'MultiPoint': makeChildAppender( + GML2.prototype.writeMultiPoint_), + 'LineString': makeChildAppender( + GML2.prototype.writeCurveOrLineString_), + 'MultiLineString': makeChildAppender( + GML2.prototype.writeMultiCurveOrLineString_), + 'LinearRing': makeChildAppender( + GML2.prototype.writeLinearRing_), + 'Polygon': makeChildAppender( + GML2.prototype.writeSurfaceOrPolygon_), + 'MultiPolygon': makeChildAppender( + GML2.prototype.writeMultiSurfaceOrPolygon_), + 'Surface': makeChildAppender( + GML2.prototype.writeSurfaceOrPolygon_), + 'MultiSurface': makeChildAppender( + GML2.prototype.writeMultiSurfaceOrPolygon_), + 'Envelope': makeChildAppender( + GML2.prototype.writeEnvelope) + } +}; + +/** + * @type {Object.>} + * @private + */ +GML2.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = { + 'http://www.opengis.net/gml': { + 'lineStringMember': makeChildAppender( + GML2.prototype.writeLineStringOrCurveMember_), + 'curveMember': makeChildAppender( + GML2.prototype.writeLineStringOrCurveMember_) + } +}; + +/** + * @type {Object.>} + * @private + */ +GML2.prototype.RING_SERIALIZERS_ = { + 'http://www.opengis.net/gml': { + 'outerBoundaryIs': makeChildAppender(GML2.prototype.writeRing_), + 'innerBoundaryIs': makeChildAppender(GML2.prototype.writeRing_) + } +}; + +/** + * @type {Object.>} + * @private + */ +GML2.prototype.POINTMEMBER_SERIALIZERS_ = { + 'http://www.opengis.net/gml': { + 'pointMember': makeChildAppender( + GML2.prototype.writePointMember_) + } +}; + +/** + * @const + * @type {Object.>} + * @private + */ +GML2.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = { + 'http://www.opengis.net/gml': { + 'surfaceMember': makeChildAppender( + GML2.prototype.writeSurfaceOrPolygonMember_), + 'polygonMember': makeChildAppender( + GML2.prototype.writeSurfaceOrPolygonMember_) + } +}; + +/** + * @type {Object.>} + * @private + */ +GML2.prototype.ENVELOPE_SERIALIZERS_ = { + 'http://www.opengis.net/gml': { + 'lowerCorner': makeChildAppender(writeStringTextNode), + 'upperCorner': makeChildAppender(writeStringTextNode) + } +}; + export default GML2; diff --git a/src/ol/format/GML3.js b/src/ol/format/GML3.js index a1f7600233..5fd31cfae0 100644 --- a/src/ol/format/GML3.js +++ b/src/ol/format/GML3.js @@ -99,292 +99,6 @@ class GML3 extends GMLBase { this.hasZ = options.hasZ !== undefined ? options.hasZ : false; - /** - * @const - * @type {Object.>} - * @private - */ - this.GEOMETRY_FLAT_COORDINATES_PARSERS_ = { - 'http://www.opengis.net/gml': { - 'pos': makeReplacer(this.readFlatPos_), - 'posList': makeReplacer(this.readFlatPosList_) - } - }; - - - /** - * @const - * @type {Object.>} - * @private - */ - this.FLAT_LINEAR_RINGS_PARSERS_ = { - 'http://www.opengis.net/gml': { - 'interior': this.interiorParser_, - 'exterior': this.exteriorParser_ - } - }; - - - /** - * @const - * @type {Object.>} - * @private - */ - this.GEOMETRY_PARSERS_ = { - 'http://www.opengis.net/gml': { - 'Point': makeReplacer(this.readPoint), - 'MultiPoint': makeReplacer( - this.readMultiPoint), - 'LineString': makeReplacer( - this.readLineString), - 'MultiLineString': makeReplacer( - this.readMultiLineString), - 'LinearRing': makeReplacer( - this.readLinearRing), - 'Polygon': makeReplacer(this.readPolygon), - 'MultiPolygon': makeReplacer( - this.readMultiPolygon), - 'Surface': makeReplacer(this.readSurface_), - 'MultiSurface': makeReplacer( - this.readMultiSurface_), - 'Curve': makeReplacer(this.readCurve_), - 'MultiCurve': makeReplacer( - this.readMultiCurve_), - 'Envelope': makeReplacer(this.readEnvelope_) - } - }; - - - /** - * @const - * @type {Object.>} - * @private - */ - this.MULTICURVE_PARSERS_ = { - 'http://www.opengis.net/gml': { - 'curveMember': makeArrayPusher( - this.curveMemberParser_), - 'curveMembers': makeArrayPusher( - this.curveMemberParser_) - } - }; - - - /** - * @const - * @type {Object.>} - * @private - */ - this.MULTISURFACE_PARSERS_ = { - 'http://www.opengis.net/gml': { - 'surfaceMember': makeArrayPusher( - this.surfaceMemberParser_), - 'surfaceMembers': makeArrayPusher( - this.surfaceMemberParser_) - } - }; - - - /** - * @const - * @type {Object.>} - * @private - */ - this.CURVEMEMBER_PARSERS_ = { - 'http://www.opengis.net/gml': { - 'LineString': makeArrayPusher( - this.readLineString), - 'Curve': makeArrayPusher(this.readCurve_) - } - }; - - - /** - * @const - * @type {Object.>} - * @private - */ - this.SURFACEMEMBER_PARSERS_ = { - 'http://www.opengis.net/gml': { - 'Polygon': makeArrayPusher(this.readPolygon), - 'Surface': makeArrayPusher(this.readSurface_) - } - }; - - - /** - * @const - * @type {Object.>} - * @private - */ - this.SURFACE_PARSERS_ = { - 'http://www.opengis.net/gml': { - 'patches': makeReplacer(this.readPatch_) - } - }; - - - /** - * @const - * @type {Object.>} - * @private - */ - this.CURVE_PARSERS_ = { - 'http://www.opengis.net/gml': { - 'segments': makeReplacer(this.readSegment_) - } - }; - - - /** - * @const - * @type {Object.>} - * @private - */ - this.ENVELOPE_PARSERS_ = { - 'http://www.opengis.net/gml': { - 'lowerCorner': makeArrayPusher( - this.readFlatPosList_), - 'upperCorner': makeArrayPusher( - this.readFlatPosList_) - } - }; - - - /** - * @const - * @type {Object.>} - * @private - */ - this.PATCHES_PARSERS_ = { - 'http://www.opengis.net/gml': { - 'PolygonPatch': makeReplacer( - this.readPolygonPatch_) - } - }; - - - /** - * @const - * @type {Object.>} - * @private - */ - this.SEGMENTS_PARSERS_ = { - 'http://www.opengis.net/gml': { - 'LineStringSegment': makeReplacer( - this.readLineStringSegment_) - } - }; - - - /** - * Encode an array of features in GML 3.1.1 Simple Features. - * - * @function - * @param {Array.} features Features. - * @param {module:ol/format/Feature~WriteOptions=} opt_options Options. - * @return {string} Result. - * @api - */ - this.writeFeatures; - - - /** - * @type {Object.>} - * @private - */ - this.RING_SERIALIZERS_ = { - 'http://www.opengis.net/gml': { - 'exterior': makeChildAppender(this.writeRing_), - 'interior': makeChildAppender(this.writeRing_) - } - }; - - - /** - * @type {Object.>} - * @private - */ - this.ENVELOPE_SERIALIZERS_ = { - 'http://www.opengis.net/gml': { - 'lowerCorner': makeChildAppender(writeStringTextNode), - 'upperCorner': makeChildAppender(writeStringTextNode) - } - }; - - - /** - * @type {Object.>} - * @private - */ - this.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = { - 'http://www.opengis.net/gml': { - 'surfaceMember': makeChildAppender( - this.writeSurfaceOrPolygonMember_), - 'polygonMember': makeChildAppender( - this.writeSurfaceOrPolygonMember_) - } - }; - - - /** - * @type {Object.>} - * @private - */ - this.POINTMEMBER_SERIALIZERS_ = { - 'http://www.opengis.net/gml': { - 'pointMember': makeChildAppender( - this.writePointMember_) - } - }; - - - /** - * @type {Object.>} - * @private - */ - this.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = { - 'http://www.opengis.net/gml': { - 'lineStringMember': makeChildAppender( - this.writeLineStringOrCurveMember_), - 'curveMember': makeChildAppender( - this.writeLineStringOrCurveMember_) - } - }; - - - /** - * @type {Object.>} - * @private - */ - this.GEOMETRY_SERIALIZERS_ = { - 'http://www.opengis.net/gml': { - 'Curve': makeChildAppender( - this.writeCurveOrLineString_), - 'MultiCurve': makeChildAppender( - this.writeMultiCurveOrLineString_), - 'Point': makeChildAppender(this.writePoint_), - 'MultiPoint': makeChildAppender( - this.writeMultiPoint_), - 'LineString': makeChildAppender( - this.writeCurveOrLineString_), - 'MultiLineString': makeChildAppender( - this.writeMultiCurveOrLineString_), - 'LinearRing': makeChildAppender( - this.writeLinearRing_), - 'Polygon': makeChildAppender( - this.writeSurfaceOrPolygon_), - 'MultiPolygon': makeChildAppender( - this.writeMultiSurfaceOrPolygon_), - 'Surface': makeChildAppender( - this.writeSurfaceOrPolygon_), - 'MultiSurface': makeChildAppender( - this.writeMultiSurfaceOrPolygon_), - 'Envelope': makeChildAppender( - this.writeEnvelope) - } - }; - } /** @@ -1204,4 +918,290 @@ class GML3 extends GMLBase { } } +/** + * @const + * @type {Object.>} + * @private + */ +GML3.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS_ = { + 'http://www.opengis.net/gml': { + 'pos': makeReplacer(GML3.prototype.readFlatPos_), + 'posList': makeReplacer(GML3.prototype.readFlatPosList_) + } +}; + + +/** + * @const + * @type {Object.>} + * @private + */ +GML3.prototype.FLAT_LINEAR_RINGS_PARSERS_ = { + 'http://www.opengis.net/gml': { + 'interior': GML3.prototype.interiorParser_, + 'exterior': GML3.prototype.exteriorParser_ + } +}; + + +/** + * @const + * @type {Object.>} + * @private + */ +GML3.prototype.GEOMETRY_PARSERS_ = { + 'http://www.opengis.net/gml': { + 'Point': makeReplacer(GMLBase.prototype.readPoint), + 'MultiPoint': makeReplacer( + GMLBase.prototype.readMultiPoint), + 'LineString': makeReplacer( + GMLBase.prototype.readLineString), + 'MultiLineString': makeReplacer( + GMLBase.prototype.readMultiLineString), + 'LinearRing': makeReplacer( + GMLBase.prototype.readLinearRing), + 'Polygon': makeReplacer(GMLBase.prototype.readPolygon), + 'MultiPolygon': makeReplacer( + GMLBase.prototype.readMultiPolygon), + 'Surface': makeReplacer(GML3.prototype.readSurface_), + 'MultiSurface': makeReplacer( + GML3.prototype.readMultiSurface_), + 'Curve': makeReplacer(GML3.prototype.readCurve_), + 'MultiCurve': makeReplacer( + GML3.prototype.readMultiCurve_), + 'Envelope': makeReplacer(GML3.prototype.readEnvelope_) + } +}; + + +/** + * @const + * @type {Object.>} + * @private + */ +GML3.prototype.MULTICURVE_PARSERS_ = { + 'http://www.opengis.net/gml': { + 'curveMember': makeArrayPusher( + GML3.prototype.curveMemberParser_), + 'curveMembers': makeArrayPusher( + GML3.prototype.curveMemberParser_) + } +}; + + +/** + * @const + * @type {Object.>} + * @private + */ +GML3.prototype.MULTISURFACE_PARSERS_ = { + 'http://www.opengis.net/gml': { + 'surfaceMember': makeArrayPusher( + GML3.prototype.surfaceMemberParser_), + 'surfaceMembers': makeArrayPusher( + GML3.prototype.surfaceMemberParser_) + } +}; + + +/** + * @const + * @type {Object.>} + * @private + */ +GML3.prototype.CURVEMEMBER_PARSERS_ = { + 'http://www.opengis.net/gml': { + 'LineString': makeArrayPusher( + GMLBase.prototype.readLineString), + 'Curve': makeArrayPusher(GML3.prototype.readCurve_) + } +}; + + +/** + * @const + * @type {Object.>} + * @private + */ +GML3.prototype.SURFACEMEMBER_PARSERS_ = { + 'http://www.opengis.net/gml': { + 'Polygon': makeArrayPusher(GMLBase.prototype.readPolygon), + 'Surface': makeArrayPusher(GML3.prototype.readSurface_) + } +}; + + +/** + * @const + * @type {Object.>} + * @private + */ +GML3.prototype.SURFACE_PARSERS_ = { + 'http://www.opengis.net/gml': { + 'patches': makeReplacer(GML3.prototype.readPatch_) + } +}; + + +/** + * @const + * @type {Object.>} + * @private + */ +GML3.prototype.CURVE_PARSERS_ = { + 'http://www.opengis.net/gml': { + 'segments': makeReplacer(GML3.prototype.readSegment_) + } +}; + + +/** + * @const + * @type {Object.>} + * @private + */ +GML3.prototype.ENVELOPE_PARSERS_ = { + 'http://www.opengis.net/gml': { + 'lowerCorner': makeArrayPusher( + GML3.prototype.readFlatPosList_), + 'upperCorner': makeArrayPusher( + GML3.prototype.readFlatPosList_) + } +}; + + +/** + * @const + * @type {Object.>} + * @private + */ +GML3.prototype.PATCHES_PARSERS_ = { + 'http://www.opengis.net/gml': { + 'PolygonPatch': makeReplacer( + GML3.prototype.readPolygonPatch_) + } +}; + + +/** + * @const + * @type {Object.>} + * @private + */ +GML3.prototype.SEGMENTS_PARSERS_ = { + 'http://www.opengis.net/gml': { + 'LineStringSegment': makeReplacer( + GML3.prototype.readLineStringSegment_) + } +}; + + +/** + * Encode an array of features in GML 3.1.1 Simple Features. + * + * @function + * @param {Array.} features Features. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Options. + * @return {string} Result. + * @api + */ +GML3.prototype.writeFeatures; + + +/** + * @type {Object.>} + * @private + */ +GML3.prototype.RING_SERIALIZERS_ = { + 'http://www.opengis.net/gml': { + 'exterior': makeChildAppender(GML3.prototype.writeRing_), + 'interior': makeChildAppender(GML3.prototype.writeRing_) + } +}; + + +/** + * @type {Object.>} + * @private + */ +GML3.prototype.ENVELOPE_SERIALIZERS_ = { + 'http://www.opengis.net/gml': { + 'lowerCorner': makeChildAppender(writeStringTextNode), + 'upperCorner': makeChildAppender(writeStringTextNode) + } +}; + + +/** + * @type {Object.>} + * @private + */ +GML3.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = { + 'http://www.opengis.net/gml': { + 'surfaceMember': makeChildAppender( + GML3.prototype.writeSurfaceOrPolygonMember_), + 'polygonMember': makeChildAppender( + GML3.prototype.writeSurfaceOrPolygonMember_) + } +}; + + +/** + * @type {Object.>} + * @private + */ +GML3.prototype.POINTMEMBER_SERIALIZERS_ = { + 'http://www.opengis.net/gml': { + 'pointMember': makeChildAppender( + GML3.prototype.writePointMember_) + } +}; + + +/** + * @type {Object.>} + * @private + */ +GML3.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = { + 'http://www.opengis.net/gml': { + 'lineStringMember': makeChildAppender( + GML3.prototype.writeLineStringOrCurveMember_), + 'curveMember': makeChildAppender( + GML3.prototype.writeLineStringOrCurveMember_) + } +}; + + +/** + * @type {Object.>} + * @private + */ +GML3.prototype.GEOMETRY_SERIALIZERS_ = { + 'http://www.opengis.net/gml': { + 'Curve': makeChildAppender( + GML3.prototype.writeCurveOrLineString_), + 'MultiCurve': makeChildAppender( + GML3.prototype.writeMultiCurveOrLineString_), + 'Point': makeChildAppender(GML3.prototype.writePoint_), + 'MultiPoint': makeChildAppender( + GML3.prototype.writeMultiPoint_), + 'LineString': makeChildAppender( + GML3.prototype.writeCurveOrLineString_), + 'MultiLineString': makeChildAppender( + GML3.prototype.writeMultiCurveOrLineString_), + 'LinearRing': makeChildAppender( + GML3.prototype.writeLinearRing_), + 'Polygon': makeChildAppender( + GML3.prototype.writeSurfaceOrPolygon_), + 'MultiPolygon': makeChildAppender( + GML3.prototype.writeMultiSurfaceOrPolygon_), + 'Surface': makeChildAppender( + GML3.prototype.writeSurfaceOrPolygon_), + 'MultiSurface': makeChildAppender( + GML3.prototype.writeMultiSurfaceOrPolygon_), + 'Envelope': makeChildAppender( + GML3.prototype.writeEnvelope) + } +}; + export default GML3; diff --git a/src/ol/format/GMLBase.js b/src/ol/format/GMLBase.js index 44f62826e9..2892f23f52 100644 --- a/src/ol/format/GMLBase.js +++ b/src/ol/format/GMLBase.js @@ -127,93 +127,6 @@ class GMLBase extends XMLFeature { 'featureMembers': makeReplacer(this.readFeaturesInternal) }; - /** - * @const - * @type {Object.>} - * @private - */ - this.MULTIPOINT_PARSERS_ = { - 'http://www.opengis.net/gml': { - 'pointMember': makeArrayPusher(this.pointMemberParser_), - 'pointMembers': makeArrayPusher(this.pointMemberParser_) - } - }; - - - /** - * @const - * @type {Object.>} - * @private - */ - this.MULTILINESTRING_PARSERS_ = { - 'http://www.opengis.net/gml': { - 'lineStringMember': makeArrayPusher(this.lineStringMemberParser_), - 'lineStringMembers': makeArrayPusher(this.lineStringMemberParser_) - } - }; - - - /** - * @const - * @type {Object.>} - * @private - */ - this.MULTIPOLYGON_PARSERS_ = { - 'http://www.opengis.net/gml': { - 'polygonMember': makeArrayPusher(this.polygonMemberParser_), - 'polygonMembers': makeArrayPusher(this.polygonMemberParser_) - } - }; - - - /** - * @const - * @type {Object.>} - * @private - */ - this.POINTMEMBER_PARSERS_ = { - 'http://www.opengis.net/gml': { - 'Point': makeArrayPusher(this.readFlatCoordinatesFromNode_) - } - }; - - - /** - * @const - * @type {Object.>} - * @private - */ - this.LINESTRINGMEMBER_PARSERS_ = { - 'http://www.opengis.net/gml': { - 'LineString': makeArrayPusher(this.readLineString) - } - }; - - - /** - * @const - * @type {Object.>} - * @private - */ - this.POLYGONMEMBER_PARSERS_ = { - 'http://www.opengis.net/gml': { - 'Polygon': makeArrayPusher(this.readPolygon) - } - }; - - - /** - * @const - * @type {Object.>} - * @protected - */ - this.RING_PARSERS = { - 'http://www.opengis.net/gml': { - 'LinearRing': makeReplacer(this.readFlatLinearRing_) - } - }; - - } /** @@ -556,4 +469,90 @@ class GMLBase extends XMLFeature { } } +/** + * @const + * @type {Object.>} + * @private + */ +GMLBase.prototype.MULTIPOINT_PARSERS_ = { + 'http://www.opengis.net/gml': { + 'pointMember': makeArrayPusher(GMLBase.prototype.pointMemberParser_), + 'pointMembers': makeArrayPusher(GMLBase.prototype.pointMemberParser_) + } +}; + + +/** + * @const + * @type {Object.>} + * @private + */ +GMLBase.prototype.MULTILINESTRING_PARSERS_ = { + 'http://www.opengis.net/gml': { + 'lineStringMember': makeArrayPusher(GMLBase.prototype.lineStringMemberParser_), + 'lineStringMembers': makeArrayPusher(GMLBase.prototype.lineStringMemberParser_) + } +}; + + +/** + * @const + * @type {Object.>} + * @private + */ +GMLBase.prototype.MULTIPOLYGON_PARSERS_ = { + 'http://www.opengis.net/gml': { + 'polygonMember': makeArrayPusher(GMLBase.prototype.polygonMemberParser_), + 'polygonMembers': makeArrayPusher(GMLBase.prototype.polygonMemberParser_) + } +}; + + +/** + * @const + * @type {Object.>} + * @private + */ +GMLBase.prototype.POINTMEMBER_PARSERS_ = { + 'http://www.opengis.net/gml': { + 'Point': makeArrayPusher(GMLBase.prototype.readFlatCoordinatesFromNode_) + } +}; + + +/** + * @const + * @type {Object.>} + * @private + */ +GMLBase.prototype.LINESTRINGMEMBER_PARSERS_ = { + 'http://www.opengis.net/gml': { + 'LineString': makeArrayPusher(GMLBase.prototype.readLineString) + } +}; + + +/** + * @const + * @type {Object.>} + * @private + */ +GMLBase.prototype.POLYGONMEMBER_PARSERS_ = { + 'http://www.opengis.net/gml': { + 'Polygon': makeArrayPusher(GMLBase.prototype.readPolygon) + } +}; + + +/** + * @const + * @type {Object.>} + * @protected + */ +GMLBase.prototype.RING_PARSERS = { + 'http://www.opengis.net/gml': { + 'LinearRing': makeReplacer(GMLBase.prototype.readFlatLinearRing_) + } +}; + export default GMLBase; diff --git a/src/ol/format/WFS.js b/src/ol/format/WFS.js index 2fbcbc7911..7354da25d6 100644 --- a/src/ol/format/WFS.js +++ b/src/ol/format/WFS.js @@ -1,7 +1,6 @@ /** * @module ol/format/WFS */ -import {inherits} from '../util.js'; import {assert} from '../asserts.js'; import GML2 from '../format/GML2.js'; import GML3 from '../format/GML3.js'; @@ -201,15 +200,16 @@ const DEFAULT_VERSION = '1.1.0'; * as option if you want to read a WFS that contains GML2 (WFS 1.0.0). * Also see {@link module:ol/format/GMLBase~GMLBase} which is used by this format. * - * @extends {module:ol/format/XMLFeature} * @api */ -class WFS { +class WFS extends XMLFeature { /** * @param {module:ol/format/WFS~Options=} opt_options Optional configuration object. */ constructor(opt_options) { + super(); + const options = opt_options ? opt_options : {}; /** @@ -237,8 +237,6 @@ class WFS { */ this.schemaLocation_ = options.schemaLocation ? options.schemaLocation : SCHEMA_LOCATIONS[DEFAULT_VERSION]; - - XMLFeature.call(this); } /** @@ -537,20 +535,6 @@ class WFS { } } -inherits(WFS, XMLFeature); - - -/** - * Read all features from a WFS FeatureCollection. - * - * @function - * @param {Document|Node|Object|string} source Source. - * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. - * @return {Array.} Features. - * @api - */ -WFS.prototype.readFeatures; - /** * @param {Node} node Node. @@ -1100,15 +1084,4 @@ function writeGetFeature(node, featureTypes, objectStack) { } -/** - * Read the projection from a WFS source. - * - * @function - * @param {Document|Node|Object|string} source Source. - * @return {?module:ol/proj/Projection} Projection. - * @api - */ -WFS.prototype.readProjection; - - export default WFS;