diff --git a/src/ol/format/GML2.js b/src/ol/format/GML2.js index 912ed2a246..701b460c40 100644 --- a/src/ol/format/GML2.js +++ b/src/ol/format/GML2.js @@ -5,7 +5,7 @@ import {inherits} from '../index.js'; import {createOrUpdate} from '../extent.js'; import FeatureFormat from '../format/Feature.js'; import GMLBase from '../format/GMLBase.js'; -import _ol_format_XSD_ from '../format/XSD.js'; +import XSD from '../format/XSD.js'; import Geometry from '../geom/Geometry.js'; import _ol_obj_ from '../obj.js'; import {get as getProjection, transformExtent} from '../proj.js'; @@ -262,7 +262,7 @@ GML2.prototype.writeFeatureElement = function(node, feature, objectStack) { } else { if (!(key in context.serializers[featureNS])) { context.serializers[featureNS][key] = _ol_xml_.makeChildAppender( - _ol_format_XSD_.writeStringTextNode); + XSD.writeStringTextNode); } } } @@ -365,7 +365,7 @@ GML2.prototype.writeCoordinates_ = function(node, value, objectStack) { point = points[i]; parts[i] = this.getCoords_(point, srsName, hasZ); } - _ol_format_XSD_.writeStringTextNode(node, parts.join(' ')); + XSD.writeStringTextNode(node, parts.join(' ')); }; @@ -521,7 +521,7 @@ GML2.prototype.writePoint_ = function(node, geometry, objectStack) { node.appendChild(coordinates); var point = geometry.getCoordinates(); var coord = this.getCoords_(point, srsName, hasZ); - _ol_format_XSD_.writeStringTextNode(coordinates, coord); + XSD.writeStringTextNode(coordinates, coord); }; @@ -773,8 +773,8 @@ GML2.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = { */ GML2.ENVELOPE_SERIALIZERS_ = { 'http://www.opengis.net/gml': { - 'lowerCorner': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), - 'upperCorner': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode) + 'lowerCorner': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), + 'upperCorner': _ol_xml_.makeChildAppender(XSD.writeStringTextNode) } }; export default GML2; diff --git a/src/ol/format/GML3.js b/src/ol/format/GML3.js index 1dbbfa6483..2d56b1c552 100644 --- a/src/ol/format/GML3.js +++ b/src/ol/format/GML3.js @@ -6,7 +6,7 @@ import _ol_array_ from '../array.js'; import {createOrUpdate} from '../extent.js'; import FeatureFormat from '../format/Feature.js'; import GMLBase from '../format/GMLBase.js'; -import _ol_format_XSD_ from '../format/XSD.js'; +import XSD from '../format/XSD.js'; import Geometry from '../geom/Geometry.js'; import GeometryLayout from '../geom/GeometryLayout.js'; import LineString from '../geom/LineString.js'; @@ -363,16 +363,16 @@ GML3.prototype.readFlatPosList_ = function(node, objectStack) { // The "dimension" attribute is from the GML 3.0.1 spec. var dim = 2; if (node.getAttribute('srsDimension')) { - dim = _ol_format_XSD_.readNonNegativeIntegerString( + dim = XSD.readNonNegativeIntegerString( node.getAttribute('srsDimension')); } else if (node.getAttribute('dimension')) { - dim = _ol_format_XSD_.readNonNegativeIntegerString( + dim = XSD.readNonNegativeIntegerString( node.getAttribute('dimension')); } else if (node.parentNode.getAttribute('srsDimension')) { - dim = _ol_format_XSD_.readNonNegativeIntegerString( + dim = XSD.readNonNegativeIntegerString( node.parentNode.getAttribute('srsDimension')); } else if (contextDimension) { - dim = _ol_format_XSD_.readNonNegativeIntegerString(contextDimension); + dim = XSD.readNonNegativeIntegerString(contextDimension); } var x, y, z; var flatCoordinates = []; @@ -597,7 +597,7 @@ GML3.prototype.writePos_ = function(node, value, objectStack) { var z = point[2] || 0; coords += ' ' + z; } - _ol_format_XSD_.writeStringTextNode(node, coords); + XSD.writeStringTextNode(node, coords); }; @@ -647,7 +647,7 @@ GML3.prototype.writePosList_ = function(node, value, objectStack) { point = points[i]; parts[i] = this.getCoords_(point, srsName, hasZ); } - _ol_format_XSD_.writeStringTextNode(node, parts.join(' ')); + XSD.writeStringTextNode(node, parts.join(' ')); }; @@ -675,8 +675,8 @@ GML3.prototype.writePoint_ = function(node, geometry, objectStack) { */ GML3.ENVELOPE_SERIALIZERS_ = { 'http://www.opengis.net/gml': { - 'lowerCorner': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), - 'upperCorner': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode) + 'lowerCorner': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), + 'upperCorner': _ol_xml_.makeChildAppender(XSD.writeStringTextNode) } }; @@ -1004,7 +1004,7 @@ GML3.prototype.writeFeatureElement = function(node, feature, objectStack) { } else { if (!(key in context.serializers[featureNS])) { context.serializers[featureNS][key] = _ol_xml_.makeChildAppender( - _ol_format_XSD_.writeStringTextNode); + XSD.writeStringTextNode); } } } diff --git a/src/ol/format/GPX.js b/src/ol/format/GPX.js index c9d399167e..6fccfe8460 100644 --- a/src/ol/format/GPX.js +++ b/src/ol/format/GPX.js @@ -6,7 +6,7 @@ import _ol_Feature_ from '../Feature.js'; import _ol_array_ from '../array.js'; import FeatureFormat from '../format/Feature.js'; import XMLFeature from '../format/XMLFeature.js'; -import _ol_format_XSD_ from '../format/XSD.js'; +import XSD from '../format/XSD.js'; import GeometryLayout from '../geom/GeometryLayout.js'; import LineString from '../geom/LineString.js'; import MultiLineString from '../geom/MultiLineString.js'; @@ -339,9 +339,9 @@ GPX.GPX_PARSERS_ = _ol_xml_.makeStructureNS( GPX.LINK_PARSERS_ = _ol_xml_.makeStructureNS( GPX.NAMESPACE_URIS_, { 'text': - _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString, 'linkText'), + _ol_xml_.makeObjectPropertySetter(XSD.readString, 'linkText'), 'type': - _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString, 'linkType') + _ol_xml_.makeObjectPropertySetter(XSD.readString, 'linkType') }); @@ -352,15 +352,15 @@ GPX.LINK_PARSERS_ = _ol_xml_.makeStructureNS( */ GPX.RTE_PARSERS_ = _ol_xml_.makeStructureNS( GPX.NAMESPACE_URIS_, { - 'name': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'cmt': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'desc': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'src': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), + 'name': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'cmt': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'desc': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'src': _ol_xml_.makeObjectPropertySetter(XSD.readString), 'link': GPX.parseLink_, 'number': - _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readNonNegativeInteger), + _ol_xml_.makeObjectPropertySetter(XSD.readNonNegativeInteger), 'extensions': GPX.parseExtensions_, - 'type': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), + 'type': _ol_xml_.makeObjectPropertySetter(XSD.readString), 'rtept': GPX.parseRtePt_ }); @@ -372,8 +372,8 @@ GPX.RTE_PARSERS_ = _ol_xml_.makeStructureNS( */ GPX.RTEPT_PARSERS_ = _ol_xml_.makeStructureNS( GPX.NAMESPACE_URIS_, { - 'ele': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), - 'time': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDateTime) + 'ele': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal), + 'time': _ol_xml_.makeObjectPropertySetter(XSD.readDateTime) }); @@ -384,14 +384,14 @@ GPX.RTEPT_PARSERS_ = _ol_xml_.makeStructureNS( */ GPX.TRK_PARSERS_ = _ol_xml_.makeStructureNS( GPX.NAMESPACE_URIS_, { - 'name': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'cmt': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'desc': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'src': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), + 'name': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'cmt': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'desc': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'src': _ol_xml_.makeObjectPropertySetter(XSD.readString), 'link': GPX.parseLink_, 'number': - _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readNonNegativeInteger), - 'type': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), + _ol_xml_.makeObjectPropertySetter(XSD.readNonNegativeInteger), + 'type': _ol_xml_.makeObjectPropertySetter(XSD.readString), 'extensions': GPX.parseExtensions_, 'trkseg': GPX.parseTrkSeg_ }); @@ -415,8 +415,8 @@ GPX.TRKSEG_PARSERS_ = _ol_xml_.makeStructureNS( */ GPX.TRKPT_PARSERS_ = _ol_xml_.makeStructureNS( GPX.NAMESPACE_URIS_, { - 'ele': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), - 'time': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDateTime) + 'ele': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal), + 'time': _ol_xml_.makeObjectPropertySetter(XSD.readDateTime) }); @@ -427,27 +427,27 @@ GPX.TRKPT_PARSERS_ = _ol_xml_.makeStructureNS( */ GPX.WPT_PARSERS_ = _ol_xml_.makeStructureNS( GPX.NAMESPACE_URIS_, { - 'ele': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), - 'time': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDateTime), - 'magvar': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), - 'geoidheight': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), - 'name': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'cmt': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'desc': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'src': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), + 'ele': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal), + 'time': _ol_xml_.makeObjectPropertySetter(XSD.readDateTime), + 'magvar': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal), + 'geoidheight': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal), + 'name': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'cmt': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'desc': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'src': _ol_xml_.makeObjectPropertySetter(XSD.readString), 'link': GPX.parseLink_, - 'sym': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'type': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'fix': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), + 'sym': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'type': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'fix': _ol_xml_.makeObjectPropertySetter(XSD.readString), 'sat': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readNonNegativeInteger), - 'hdop': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), - 'vdop': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), - 'pdop': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), + XSD.readNonNegativeInteger), + 'hdop': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal), + 'vdop': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal), + 'pdop': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal), 'ageofdgpsdata': - _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), + _ol_xml_.makeObjectPropertySetter(XSD.readDecimal), 'dgpsid': - _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readNonNegativeInteger), + _ol_xml_.makeObjectPropertySetter(XSD.readNonNegativeInteger), 'extensions': GPX.parseExtensions_ }); @@ -719,8 +719,8 @@ GPX.LINK_SEQUENCE_ = ['text', 'type']; */ GPX.LINK_SERIALIZERS_ = _ol_xml_.makeStructureNS( GPX.NAMESPACE_URIS_, { - 'text': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), - 'type': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode) + 'text': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), + 'type': _ol_xml_.makeChildAppender(XSD.writeStringTextNode) }); @@ -742,14 +742,14 @@ GPX.RTE_SEQUENCE_ = _ol_xml_.makeStructureNS( */ GPX.RTE_SERIALIZERS_ = _ol_xml_.makeStructureNS( GPX.NAMESPACE_URIS_, { - 'name': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), - 'cmt': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), - 'desc': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), - 'src': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), + 'name': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), + 'cmt': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), + 'desc': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), + 'src': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), 'link': _ol_xml_.makeChildAppender(GPX.writeLink_), 'number': _ol_xml_.makeChildAppender( - _ol_format_XSD_.writeNonNegativeIntegerTextNode), - 'type': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), + XSD.writeNonNegativeIntegerTextNode), + 'type': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), 'rtept': _ol_xml_.makeArraySerializer(_ol_xml_.makeChildAppender( GPX.writeWptType_)) }); @@ -784,14 +784,14 @@ GPX.TRK_SEQUENCE_ = _ol_xml_.makeStructureNS( */ GPX.TRK_SERIALIZERS_ = _ol_xml_.makeStructureNS( GPX.NAMESPACE_URIS_, { - 'name': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), - 'cmt': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), - 'desc': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), - 'src': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), + 'name': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), + 'cmt': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), + 'desc': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), + 'src': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), 'link': _ol_xml_.makeChildAppender(GPX.writeLink_), 'number': _ol_xml_.makeChildAppender( - _ol_format_XSD_.writeNonNegativeIntegerTextNode), - 'type': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), + XSD.writeNonNegativeIntegerTextNode), + 'type': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), 'trkseg': _ol_xml_.makeArraySerializer(_ol_xml_.makeChildAppender( GPX.writeTrkSeg_)) }); @@ -835,28 +835,28 @@ GPX.WPT_TYPE_SEQUENCE_ = _ol_xml_.makeStructureNS( */ GPX.WPT_TYPE_SERIALIZERS_ = _ol_xml_.makeStructureNS( GPX.NAMESPACE_URIS_, { - 'ele': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDecimalTextNode), - 'time': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDateTimeTextNode), - 'magvar': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDecimalTextNode), + 'ele': _ol_xml_.makeChildAppender(XSD.writeDecimalTextNode), + 'time': _ol_xml_.makeChildAppender(XSD.writeDateTimeTextNode), + 'magvar': _ol_xml_.makeChildAppender(XSD.writeDecimalTextNode), 'geoidheight': _ol_xml_.makeChildAppender( - _ol_format_XSD_.writeDecimalTextNode), - 'name': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), - 'cmt': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), - 'desc': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), - 'src': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), + XSD.writeDecimalTextNode), + 'name': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), + 'cmt': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), + 'desc': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), + 'src': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), 'link': _ol_xml_.makeChildAppender(GPX.writeLink_), - 'sym': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), - 'type': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), - 'fix': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), + 'sym': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), + 'type': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), + 'fix': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), 'sat': _ol_xml_.makeChildAppender( - _ol_format_XSD_.writeNonNegativeIntegerTextNode), - 'hdop': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDecimalTextNode), - 'vdop': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDecimalTextNode), - 'pdop': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDecimalTextNode), + XSD.writeNonNegativeIntegerTextNode), + 'hdop': _ol_xml_.makeChildAppender(XSD.writeDecimalTextNode), + 'vdop': _ol_xml_.makeChildAppender(XSD.writeDecimalTextNode), + 'pdop': _ol_xml_.makeChildAppender(XSD.writeDecimalTextNode), 'ageofdgpsdata': _ol_xml_.makeChildAppender( - _ol_format_XSD_.writeDecimalTextNode), + XSD.writeDecimalTextNode), 'dgpsid': _ol_xml_.makeChildAppender( - _ol_format_XSD_.writeNonNegativeIntegerTextNode) + XSD.writeNonNegativeIntegerTextNode) }); diff --git a/src/ol/format/KML.js b/src/ol/format/KML.js index bc7942629e..c5087535e9 100644 --- a/src/ol/format/KML.js +++ b/src/ol/format/KML.js @@ -8,7 +8,7 @@ import _ol_asserts_ from '../asserts.js'; import _ol_color_ from '../color.js'; import FeatureFormat from '../format/Feature.js'; import XMLFeature from '../format/XMLFeature.js'; -import _ol_format_XSD_ from '../format/XSD.js'; +import XSD from '../format/XSD.js'; import GeometryCollection from '../geom/GeometryCollection.js'; import GeometryLayout from '../geom/GeometryLayout.js'; import GeometryType from '../geom/GeometryType.js'; @@ -536,7 +536,7 @@ KML.readVec2_ = function(node) { * @return {number|undefined} Scale. */ KML.readScale_ = function(node) { - return _ol_format_XSD_.readDecimal(node); + return XSD.readDecimal(node); }; @@ -1194,7 +1194,7 @@ KML.SchemaDataParser_ = function(node, objectStack) { KML.SimpleDataParser_ = function(node, objectStack) { var name = node.getAttribute('name'); if (name !== null) { - var data = _ol_format_XSD_.readString(node); + var data = XSD.readString(node); var featureObject = /** @type {Object} */ (objectStack[objectStack.length - 1]); featureObject[name] = data; @@ -1310,8 +1310,8 @@ KML.whenParser_ = function(node, objectStack) { */ KML.DATA_PARSERS_ = _ol_xml_.makeStructureNS( KML.NAMESPACE_URIS_, { - 'displayName': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'value': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString) + 'displayName': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'value': _ol_xml_.makeObjectPropertySetter(XSD.readString) }); @@ -1346,13 +1346,13 @@ KML.REGION_PARSERS_ = _ol_xml_.makeStructureNS( */ KML.LAT_LON_ALT_BOX_PARSERS_ = _ol_xml_.makeStructureNS( KML.NAMESPACE_URIS_, { - 'altitudeMode': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'minAltitude': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), - 'maxAltitude': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), - 'north': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), - 'south': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), - 'east': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), - 'west': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal) + 'altitudeMode': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'minAltitude': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal), + 'maxAltitude': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal), + 'north': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal), + 'south': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal), + 'east': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal), + 'west': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal) }); @@ -1363,10 +1363,10 @@ KML.LAT_LON_ALT_BOX_PARSERS_ = _ol_xml_.makeStructureNS( */ KML.LOD_PARSERS_ = _ol_xml_.makeStructureNS( KML.NAMESPACE_URIS_, { - 'minLodPixels': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), - 'maxLodPixels': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), - 'minFadeExtent': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), - 'maxFadeExtent': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal) + 'minLodPixels': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal), + 'maxLodPixels': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal), + 'minFadeExtent': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal), + 'maxFadeExtent': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal) }); @@ -1377,9 +1377,9 @@ KML.LOD_PARSERS_ = _ol_xml_.makeStructureNS( */ KML.EXTRUDE_AND_ALTITUDE_MODE_PARSERS_ = _ol_xml_.makeStructureNS( KML.NAMESPACE_URIS_, { - 'extrude': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readBoolean), - 'tessellate': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readBoolean), - 'altitudeMode': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString) + 'extrude': _ol_xml_.makeObjectPropertySetter(XSD.readBoolean), + 'tessellate': _ol_xml_.makeObjectPropertySetter(XSD.readBoolean), + 'altitudeMode': _ol_xml_.makeObjectPropertySetter(XSD.readString) }); @@ -1441,10 +1441,10 @@ KML.ICON_PARSERS_ = _ol_xml_.makeStructureNS( 'href': _ol_xml_.makeObjectPropertySetter(KML.readURI_) }, _ol_xml_.makeStructureNS( KML.GX_NAMESPACE_URIS_, { - 'x': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), - 'y': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), - 'w': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), - 'h': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal) + 'x': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal), + 'y': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal), + 'w': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal), + 'h': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal) })); @@ -1456,7 +1456,7 @@ KML.ICON_PARSERS_ = _ol_xml_.makeStructureNS( KML.ICON_STYLE_PARSERS_ = _ol_xml_.makeStructureNS( KML.NAMESPACE_URIS_, { 'Icon': _ol_xml_.makeObjectPropertySetter(KML.readIcon_), - 'heading': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), + 'heading': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal), 'hotSpot': _ol_xml_.makeObjectPropertySetter(KML.readVec2_), 'scale': _ol_xml_.makeObjectPropertySetter(KML.readScale_) }); @@ -1493,7 +1493,7 @@ KML.LABEL_STYLE_PARSERS_ = _ol_xml_.makeStructureNS( KML.LINE_STYLE_PARSERS_ = _ol_xml_.makeStructureNS( KML.NAMESPACE_URIS_, { 'color': _ol_xml_.makeObjectPropertySetter(KML.readColor_), - 'width': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal) + 'width': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal) }); @@ -1533,12 +1533,12 @@ KML.NETWORK_LINK_PARSERS_ = _ol_xml_.makeStructureNS( 'ExtendedData': KML.ExtendedDataParser_, 'Region': KML.RegionParser_, 'Link': KML.LinkParser_, - 'address': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'description': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'name': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'open': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readBoolean), - 'phoneNumber': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'visibility': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readBoolean) + 'address': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'description': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'name': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'open': _ol_xml_.makeObjectPropertySetter(XSD.readBoolean), + 'phoneNumber': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'visibility': _ol_xml_.makeObjectPropertySetter(XSD.readBoolean) }); @@ -1572,7 +1572,7 @@ KML.OUTER_BOUNDARY_IS_PARSERS_ = _ol_xml_.makeStructureNS( KML.PAIR_PARSERS_ = _ol_xml_.makeStructureNS( KML.NAMESPACE_URIS_, { 'Style': _ol_xml_.makeObjectPropertySetter(KML.readStyle_), - 'key': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), + 'key': _ol_xml_.makeObjectPropertySetter(XSD.readString), 'styleUrl': _ol_xml_.makeObjectPropertySetter(KML.readURI_) }); @@ -1598,13 +1598,13 @@ KML.PLACEMARK_PARSERS_ = _ol_xml_.makeStructureNS( KML.readPolygon_, 'geometry'), 'Style': _ol_xml_.makeObjectPropertySetter(KML.readStyle_), 'StyleMap': KML.PlacemarkStyleMapParser_, - 'address': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'description': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'name': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'open': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readBoolean), - 'phoneNumber': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), + 'address': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'description': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'name': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'open': _ol_xml_.makeObjectPropertySetter(XSD.readBoolean), + 'phoneNumber': _ol_xml_.makeObjectPropertySetter(XSD.readString), 'styleUrl': _ol_xml_.makeObjectPropertySetter(KML.readURI_), - 'visibility': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readBoolean) + 'visibility': _ol_xml_.makeObjectPropertySetter(XSD.readBoolean) }, _ol_xml_.makeStructureNS( KML.GX_NAMESPACE_URIS_, { 'MultiTrack': _ol_xml_.makeObjectPropertySetter( @@ -1623,8 +1623,8 @@ KML.PLACEMARK_PARSERS_ = _ol_xml_.makeStructureNS( KML.POLY_STYLE_PARSERS_ = _ol_xml_.makeStructureNS( KML.NAMESPACE_URIS_, { 'color': _ol_xml_.makeObjectPropertySetter(KML.readColor_), - 'fill': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readBoolean), - 'outline': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readBoolean) + 'fill': _ol_xml_.makeObjectPropertySetter(XSD.readBoolean), + 'outline': _ol_xml_.makeObjectPropertySetter(XSD.readBoolean) }); @@ -1924,7 +1924,7 @@ KML.prototype.readNameFromNode = function(node) { for (n = node.firstElementChild; n; n = n.nextElementSibling) { if (_ol_array_.includes(KML.NAMESPACE_URIS_, n.namespaceURI) && n.localName == 'name') { - return _ol_format_XSD_.readString(n); + return XSD.readString(n); } } for (n = node.firstElementChild; n; n = n.nextElementSibling) { @@ -2100,7 +2100,7 @@ KML.writeColorTextNode_ = function(node, color) { var hex = parseInt(abgr[i], 10).toString(16); abgr[i] = (hex.length == 1) ? '0' + hex : hex; } - _ol_format_XSD_.writeStringTextNode(node, abgr.join('')); + XSD.writeStringTextNode(node, abgr.join('')); }; @@ -2142,7 +2142,7 @@ KML.writeCoordinatesTextNode_ = function(node, coordinates, objectStack) { } } } - _ol_format_XSD_.writeStringTextNode(node, text); + XSD.writeStringTextNode(node, text); }; @@ -2180,7 +2180,7 @@ KML.writeDataNode_ = function(node, pair, objectStack) { * @private */ KML.writeDataNodeName_ = function(node, name) { - _ol_format_XSD_.writeCDATASection(node, name); + XSD.writeCDATASection(node, name); }; @@ -2190,7 +2190,7 @@ KML.writeDataNodeName_ = function(node, name) { * @private */ KML.writeDataNodeValue_ = function(node, value) { - _ol_format_XSD_.writeStringTextNode(node, value); + XSD.writeStringTextNode(node, value); }; @@ -2540,7 +2540,7 @@ KML.writePolyStyle_ = function(node, style, objectStack) { */ KML.writeScaleTextNode_ = function(node, scale) { // the Math is to remove any excess decimals created by float arithmetic - _ol_format_XSD_.writeDecimalTextNode(node, + XSD.writeDecimalTextNode(node, Math.round(scale * 1e6) / 1e6); }; @@ -2675,13 +2675,13 @@ KML.ICON_SEQUENCE_ = _ol_xml_.makeStructureNS( */ KML.ICON_SERIALIZERS_ = _ol_xml_.makeStructureNS( KML.NAMESPACE_URIS_, { - 'href': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode) + 'href': _ol_xml_.makeChildAppender(XSD.writeStringTextNode) }, _ol_xml_.makeStructureNS( KML.GX_NAMESPACE_URIS_, { - 'x': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDecimalTextNode), - 'y': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDecimalTextNode), - 'w': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDecimalTextNode), - 'h': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDecimalTextNode) + 'x': _ol_xml_.makeChildAppender(XSD.writeDecimalTextNode), + 'y': _ol_xml_.makeChildAppender(XSD.writeDecimalTextNode), + 'w': _ol_xml_.makeChildAppender(XSD.writeDecimalTextNode), + 'h': _ol_xml_.makeChildAppender(XSD.writeDecimalTextNode) })); @@ -2704,7 +2704,7 @@ KML.ICON_STYLE_SEQUENCE_ = _ol_xml_.makeStructureNS( KML.ICON_STYLE_SERIALIZERS_ = _ol_xml_.makeStructureNS( KML.NAMESPACE_URIS_, { 'Icon': _ol_xml_.makeChildAppender(KML.writeIcon_), - 'heading': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDecimalTextNode), + 'heading': _ol_xml_.makeChildAppender(XSD.writeDecimalTextNode), 'hotSpot': _ol_xml_.makeChildAppender(KML.writeVec2_), 'scale': _ol_xml_.makeChildAppender(KML.writeScaleTextNode_) }); @@ -2752,7 +2752,7 @@ KML.LINE_STYLE_SEQUENCE_ = _ol_xml_.makeStructureNS( KML.LINE_STYLE_SERIALIZERS_ = _ol_xml_.makeStructureNS( KML.NAMESPACE_URIS_, { 'color': _ol_xml_.makeChildAppender(KML.writeColorTextNode_), - 'width': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDecimalTextNode) + 'width': _ol_xml_.makeChildAppender(XSD.writeDecimalTextNode) }); @@ -2816,16 +2816,16 @@ KML.PLACEMARK_SERIALIZERS_ = _ol_xml_.makeStructureNS( KML.writePrimitiveGeometry_), 'Polygon': _ol_xml_.makeChildAppender(KML.writePolygon_), 'Style': _ol_xml_.makeChildAppender(KML.writeStyle_), - 'address': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), + 'address': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), 'description': _ol_xml_.makeChildAppender( - _ol_format_XSD_.writeStringTextNode), - 'name': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), - 'open': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeBooleanTextNode), + XSD.writeStringTextNode), + 'name': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), + 'open': _ol_xml_.makeChildAppender(XSD.writeBooleanTextNode), 'phoneNumber': _ol_xml_.makeChildAppender( - _ol_format_XSD_.writeStringTextNode), - 'styleUrl': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), + XSD.writeStringTextNode), + 'styleUrl': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), 'visibility': _ol_xml_.makeChildAppender( - _ol_format_XSD_.writeBooleanTextNode) + XSD.writeBooleanTextNode) }); @@ -2847,9 +2847,9 @@ KML.PRIMITIVE_GEOMETRY_SEQUENCE_ = _ol_xml_.makeStructureNS( */ KML.PRIMITIVE_GEOMETRY_SERIALIZERS_ = _ol_xml_.makeStructureNS( KML.NAMESPACE_URIS_, { - 'extrude': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeBooleanTextNode), - 'tessellate': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeBooleanTextNode), - 'altitudeMode': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), + 'extrude': _ol_xml_.makeChildAppender(XSD.writeBooleanTextNode), + 'tessellate': _ol_xml_.makeChildAppender(XSD.writeBooleanTextNode), + 'altitudeMode': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), 'coordinates': _ol_xml_.makeChildAppender( KML.writeCoordinatesTextNode_) }); diff --git a/src/ol/format/OWS.js b/src/ol/format/OWS.js index 2d90d8d355..ae46fd59d4 100644 --- a/src/ol/format/OWS.js +++ b/src/ol/format/OWS.js @@ -4,7 +4,7 @@ import {inherits} from '../index.js'; import XLink from '../format/XLink.js'; import XML from '../format/XML.js'; -import _ol_format_XSD_ from '../format/XSD.js'; +import XSD from '../format/XSD.js'; import _ol_xml_ from '../xml.js'; /** @@ -226,7 +226,7 @@ OWS.readServiceProvider_ = function(node, objectStack) { * @return {string|undefined} The value. */ OWS.readValue_ = function(node, objectStack) { - return _ol_format_XSD_.readString(node); + return XSD.readString(node); }; @@ -265,14 +265,14 @@ OWS.PARSERS_ = _ol_xml_.makeStructureNS( OWS.ADDRESS_PARSERS_ = _ol_xml_.makeStructureNS( OWS.NAMESPACE_URIS_, { 'DeliveryPoint': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString), - 'City': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), + XSD.readString), + 'City': _ol_xml_.makeObjectPropertySetter(XSD.readString), 'AdministrativeArea': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString), - 'PostalCode': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'Country': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), + XSD.readString), + 'PostalCode': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'Country': _ol_xml_.makeObjectPropertySetter(XSD.readString), 'ElectronicMailAddress': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString) + XSD.readString) }); @@ -363,8 +363,8 @@ OWS.OPERATIONS_METADATA_PARSERS_ = _ol_xml_.makeStructureNS( */ OWS.PHONE_PARSERS_ = _ol_xml_.makeStructureNS( OWS.NAMESPACE_URIS_, { - 'Voice': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'Facsimile': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString) + 'Voice': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'Facsimile': _ol_xml_.makeObjectPropertySetter(XSD.readString) }); @@ -389,8 +389,8 @@ OWS.SERVICE_CONTACT_PARSERS_ = _ol_xml_.makeStructureNS( OWS.NAMESPACE_URIS_, { 'IndividualName': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString), - 'PositionName': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), + XSD.readString), + 'PositionName': _ol_xml_.makeObjectPropertySetter(XSD.readString), 'ContactInfo': _ol_xml_.makeObjectPropertySetter( OWS.readContactInfo_) }); @@ -404,13 +404,13 @@ OWS.SERVICE_CONTACT_PARSERS_ = OWS.SERVICE_IDENTIFICATION_PARSERS_ = _ol_xml_.makeStructureNS( OWS.NAMESPACE_URIS_, { - 'Abstract': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'AccessConstraints': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'Fees': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'Title': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), + 'Abstract': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'AccessConstraints': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'Fees': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'Title': _ol_xml_.makeObjectPropertySetter(XSD.readString), 'ServiceTypeVersion': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString), - 'ServiceType': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString) + XSD.readString), + 'ServiceType': _ol_xml_.makeObjectPropertySetter(XSD.readString) }); @@ -422,7 +422,7 @@ OWS.SERVICE_IDENTIFICATION_PARSERS_ = OWS.SERVICE_PROVIDER_PARSERS_ = _ol_xml_.makeStructureNS( OWS.NAMESPACE_URIS_, { - 'ProviderName': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), + 'ProviderName': _ol_xml_.makeObjectPropertySetter(XSD.readString), 'ProviderSite': _ol_xml_.makeObjectPropertySetter(XLink.readHref), 'ServiceContact': _ol_xml_.makeObjectPropertySetter( OWS.readServiceContact_) diff --git a/src/ol/format/WFS.js b/src/ol/format/WFS.js index 844f250262..ebdad61b0e 100644 --- a/src/ol/format/WFS.js +++ b/src/ol/format/WFS.js @@ -8,7 +8,7 @@ import GML3 from '../format/GML3.js'; import GMLBase from '../format/GMLBase.js'; import _ol_format_filter_ from '../format/filter.js'; import XMLFeature from '../format/XMLFeature.js'; -import _ol_format_XSD_ from '../format/XSD.js'; +import XSD from '../format/XSD.js'; import Geometry from '../geom/Geometry.js'; import _ol_obj_ from '../obj.js'; import {get as getProjection} from '../proj.js'; @@ -250,7 +250,7 @@ WFS.FEATURE_COLLECTION_PARSERS_ = { */ WFS.prototype.readFeatureCollectionMetadataFromNode = function(node) { var result = {}; - var value = _ol_format_XSD_.readNonNegativeIntegerString( + var value = XSD.readNonNegativeIntegerString( node.getAttribute('numberOfFeatures')); result['numberOfFeatures'] = value; return _ol_xml_.pushParseAndPop( @@ -267,11 +267,11 @@ WFS.prototype.readFeatureCollectionMetadataFromNode = function(node) { WFS.TRANSACTION_SUMMARY_PARSERS_ = { 'http://www.opengis.net/wfs': { 'totalInserted': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readNonNegativeInteger), + XSD.readNonNegativeInteger), 'totalUpdated': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readNonNegativeInteger), + XSD.readNonNegativeInteger), 'totalDeleted': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readNonNegativeInteger) + XSD.readNonNegativeInteger) } }; @@ -382,7 +382,7 @@ WFS.prototype.readTransactionResponseFromNode = function(node) { */ WFS.QUERY_SERIALIZERS_ = { 'http://www.opengis.net/wfs': { - 'PropertyName': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode) + 'PropertyName': _ol_xml_.makeChildAppender(XSD.writeStringTextNode) } }; @@ -518,7 +518,7 @@ WFS.writeProperty_ = function(node, pair, objectStack) { var context = objectStack[objectStack.length - 1]; var gmlVersion = context['gmlVersion']; node.appendChild(name); - _ol_format_XSD_.writeStringTextNode(name, pair.name); + XSD.writeStringTextNode(name, pair.name); if (pair.value !== undefined && pair.value !== null) { var value = _ol_xml_.createElementNS(WFS.WFSNS, 'Value'); node.appendChild(value); @@ -531,7 +531,7 @@ WFS.writeProperty_ = function(node, pair, objectStack) { pair.value, objectStack); } } else { - _ol_format_XSD_.writeStringTextNode(value, pair.value); + XSD.writeStringTextNode(value, pair.value); } } }; @@ -552,7 +552,7 @@ WFS.writeNative_ = function(node, nativeElement, objectStack) { node.setAttribute('safeToIgnore', nativeElement.safeToIgnore); } if (nativeElement.value !== undefined) { - _ol_format_XSD_.writeStringTextNode(node, nativeElement.value); + XSD.writeStringTextNode(node, nativeElement.value); } }; @@ -699,7 +699,7 @@ WFS.writeWithinFilter_ = function(node, filter, objectStack) { WFS.writeDuringFilter_ = function(node, filter, objectStack) { var valueReference = _ol_xml_.createElementNS(WFS.FESNS, 'ValueReference'); - _ol_format_XSD_.writeStringTextNode(valueReference, filter.propertyName); + XSD.writeStringTextNode(valueReference, filter.propertyName); node.appendChild(valueReference); var timePeriod = _ol_xml_.createElementNS(GMLBase.GMLNS, 'TimePeriod'); @@ -824,7 +824,7 @@ WFS.writeIsLikeFilter_ = function(node, filter, objectStack) { */ WFS.writeOgcExpression_ = function(tagName, node, value) { var property = _ol_xml_.createElementNS(WFS.OGCNS, tagName); - _ol_format_XSD_.writeStringTextNode(property, value); + XSD.writeStringTextNode(property, value); node.appendChild(property); }; @@ -860,7 +860,7 @@ WFS.writeTimeInstant_ = function(node, time) { var timePosition = _ol_xml_.createElementNS(GMLBase.GMLNS, 'timePosition'); timeInstant.appendChild(timePosition); - _ol_format_XSD_.writeStringTextNode(timePosition, time); + XSD.writeStringTextNode(timePosition, time); }; diff --git a/src/ol/format/WMSCapabilities.js b/src/ol/format/WMSCapabilities.js index 530beeec52..62eb05ce68 100644 --- a/src/ol/format/WMSCapabilities.js +++ b/src/ol/format/WMSCapabilities.js @@ -4,7 +4,7 @@ import {inherits} from '../index.js'; import XLink from '../format/XLink.js'; import XML from '../format/XML.js'; -import _ol_format_XSD_ from '../format/XSD.js'; +import XSD from '../format/XSD.js'; import _ol_xml_ from '../xml.js'; /** @@ -84,15 +84,15 @@ WMSCapabilities.readAttribution_ = function(node, objectStack) { */ WMSCapabilities.readBoundingBox_ = function(node, objectStack) { var extent = [ - _ol_format_XSD_.readDecimalString(node.getAttribute('minx')), - _ol_format_XSD_.readDecimalString(node.getAttribute('miny')), - _ol_format_XSD_.readDecimalString(node.getAttribute('maxx')), - _ol_format_XSD_.readDecimalString(node.getAttribute('maxy')) + XSD.readDecimalString(node.getAttribute('minx')), + XSD.readDecimalString(node.getAttribute('miny')), + XSD.readDecimalString(node.getAttribute('maxx')), + XSD.readDecimalString(node.getAttribute('maxy')) ]; var resolutions = [ - _ol_format_XSD_.readDecimalString(node.getAttribute('resx')), - _ol_format_XSD_.readDecimalString(node.getAttribute('resy')) + XSD.readDecimalString(node.getAttribute('resx')), + XSD.readDecimalString(node.getAttribute('resy')) ]; return { @@ -240,41 +240,41 @@ WMSCapabilities.readLayer_ = function(node, objectStack) { return undefined; } var queryable = - _ol_format_XSD_.readBooleanString(node.getAttribute('queryable')); + XSD.readBooleanString(node.getAttribute('queryable')); if (queryable === undefined) { queryable = parentLayerObject['queryable']; } layerObject['queryable'] = queryable !== undefined ? queryable : false; - var cascaded = _ol_format_XSD_.readNonNegativeIntegerString( + var cascaded = XSD.readNonNegativeIntegerString( node.getAttribute('cascaded')); if (cascaded === undefined) { cascaded = parentLayerObject['cascaded']; } layerObject['cascaded'] = cascaded; - var opaque = _ol_format_XSD_.readBooleanString(node.getAttribute('opaque')); + var opaque = XSD.readBooleanString(node.getAttribute('opaque')); if (opaque === undefined) { opaque = parentLayerObject['opaque']; } layerObject['opaque'] = opaque !== undefined ? opaque : false; var noSubsets = - _ol_format_XSD_.readBooleanString(node.getAttribute('noSubsets')); + XSD.readBooleanString(node.getAttribute('noSubsets')); if (noSubsets === undefined) { noSubsets = parentLayerObject['noSubsets']; } layerObject['noSubsets'] = noSubsets !== undefined ? noSubsets : false; var fixedWidth = - _ol_format_XSD_.readDecimalString(node.getAttribute('fixedWidth')); + XSD.readDecimalString(node.getAttribute('fixedWidth')); if (!fixedWidth) { fixedWidth = parentLayerObject['fixedWidth']; } layerObject['fixedWidth'] = fixedWidth; var fixedHeight = - _ol_format_XSD_.readDecimalString(node.getAttribute('fixedHeight')); + XSD.readDecimalString(node.getAttribute('fixedHeight')); if (!fixedHeight) { fixedHeight = parentLayerObject['fixedHeight']; } @@ -314,12 +314,12 @@ WMSCapabilities.readDimension_ = function(node, objectStack) { 'units': node.getAttribute('units'), 'unitSymbol': node.getAttribute('unitSymbol'), 'default': node.getAttribute('default'), - 'multipleValues': _ol_format_XSD_.readBooleanString( + 'multipleValues': XSD.readBooleanString( node.getAttribute('multipleValues')), - 'nearestValue': _ol_format_XSD_.readBooleanString( + 'nearestValue': XSD.readBooleanString( node.getAttribute('nearestValue')), - 'current': _ol_format_XSD_.readBooleanString(node.getAttribute('current')), - 'values': _ol_format_XSD_.readString(node) + 'current': XSD.readBooleanString(node.getAttribute('current')), + 'values': XSD.readString(node) }; return dimensionObject; }; @@ -397,8 +397,8 @@ WMSCapabilities.readSizedFormatOnlineresource_ = function(node, objectStack) { WMSCapabilities.readFormatOnlineresource_(node, objectStack); if (formatOnlineresource) { var size = [ - _ol_format_XSD_.readNonNegativeIntegerString(node.getAttribute('width')), - _ol_format_XSD_.readNonNegativeIntegerString(node.getAttribute('height')) + XSD.readNonNegativeIntegerString(node.getAttribute('width')), + XSD.readNonNegativeIntegerString(node.getAttribute('height')) ]; formatOnlineresource['size'] = size; return formatOnlineresource; @@ -513,24 +513,24 @@ WMSCapabilities.CAPABILITY_PARSERS_ = _ol_xml_.makeStructureNS( */ WMSCapabilities.SERVICE_PARSERS_ = _ol_xml_.makeStructureNS( WMSCapabilities.NAMESPACE_URIS_, { - 'Name': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'Title': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'Abstract': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), + 'Name': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'Title': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'Abstract': _ol_xml_.makeObjectPropertySetter(XSD.readString), 'KeywordList': _ol_xml_.makeObjectPropertySetter( WMSCapabilities.readKeywordList_), 'OnlineResource': _ol_xml_.makeObjectPropertySetter( XLink.readHref), 'ContactInformation': _ol_xml_.makeObjectPropertySetter( WMSCapabilities.readContactInformation_), - 'Fees': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), + 'Fees': _ol_xml_.makeObjectPropertySetter(XSD.readString), 'AccessConstraints': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString), + XSD.readString), 'LayerLimit': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readNonNegativeInteger), + XSD.readNonNegativeInteger), 'MaxWidth': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readNonNegativeInteger), + XSD.readNonNegativeInteger), 'MaxHeight': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readNonNegativeInteger) + XSD.readNonNegativeInteger) }); @@ -544,15 +544,15 @@ WMSCapabilities.CONTACT_INFORMATION_PARSERS_ = _ol_xml_.makeStructureNS( 'ContactPersonPrimary': _ol_xml_.makeObjectPropertySetter( WMSCapabilities.readContactPersonPrimary_), 'ContactPosition': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString), + XSD.readString), 'ContactAddress': _ol_xml_.makeObjectPropertySetter( WMSCapabilities.readContactAddress_), 'ContactVoiceTelephone': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString), + XSD.readString), 'ContactFacsimileTelephone': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString), + XSD.readString), 'ContactElectronicMailAddress': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString) + XSD.readString) }); @@ -564,9 +564,9 @@ WMSCapabilities.CONTACT_INFORMATION_PARSERS_ = _ol_xml_.makeStructureNS( WMSCapabilities.CONTACT_PERSON_PARSERS_ = _ol_xml_.makeStructureNS( WMSCapabilities.NAMESPACE_URIS_, { 'ContactPerson': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString), + XSD.readString), 'ContactOrganization': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString) + XSD.readString) }); @@ -577,13 +577,13 @@ WMSCapabilities.CONTACT_PERSON_PARSERS_ = _ol_xml_.makeStructureNS( */ WMSCapabilities.CONTACT_ADDRESS_PARSERS_ = _ol_xml_.makeStructureNS( WMSCapabilities.NAMESPACE_URIS_, { - 'AddressType': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'Address': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'City': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), + 'AddressType': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'Address': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'City': _ol_xml_.makeObjectPropertySetter(XSD.readString), 'StateOrProvince': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString), - 'PostCode': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'Country': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString) + XSD.readString), + 'PostCode': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'Country': _ol_xml_.makeObjectPropertySetter(XSD.readString) }); @@ -594,7 +594,7 @@ WMSCapabilities.CONTACT_ADDRESS_PARSERS_ = _ol_xml_.makeStructureNS( */ WMSCapabilities.EXCEPTION_PARSERS_ = _ol_xml_.makeStructureNS( WMSCapabilities.NAMESPACE_URIS_, { - 'Format': _ol_xml_.makeArrayPusher(_ol_format_XSD_.readString) + 'Format': _ol_xml_.makeArrayPusher(XSD.readString) }); @@ -605,12 +605,12 @@ WMSCapabilities.EXCEPTION_PARSERS_ = _ol_xml_.makeStructureNS( */ WMSCapabilities.LAYER_PARSERS_ = _ol_xml_.makeStructureNS( WMSCapabilities.NAMESPACE_URIS_, { - 'Name': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'Title': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'Abstract': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), + 'Name': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'Title': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'Abstract': _ol_xml_.makeObjectPropertySetter(XSD.readString), 'KeywordList': _ol_xml_.makeObjectPropertySetter( WMSCapabilities.readKeywordList_), - 'CRS': _ol_xml_.makeObjectPropertyPusher(_ol_format_XSD_.readString), + 'CRS': _ol_xml_.makeObjectPropertyPusher(XSD.readString), 'EX_GeographicBoundingBox': _ol_xml_.makeObjectPropertySetter( WMSCapabilities.readEXGeographicBoundingBox_), 'BoundingBox': _ol_xml_.makeObjectPropertyPusher( @@ -621,7 +621,7 @@ WMSCapabilities.LAYER_PARSERS_ = _ol_xml_.makeStructureNS( WMSCapabilities.readAttribution_), 'AuthorityURL': _ol_xml_.makeObjectPropertyPusher( WMSCapabilities.readAuthorityURL_), - 'Identifier': _ol_xml_.makeObjectPropertyPusher(_ol_format_XSD_.readString), + 'Identifier': _ol_xml_.makeObjectPropertyPusher(XSD.readString), 'MetadataURL': _ol_xml_.makeObjectPropertyPusher( WMSCapabilities.readMetadataURL_), 'DataURL': _ol_xml_.makeObjectPropertyPusher( @@ -631,9 +631,9 @@ WMSCapabilities.LAYER_PARSERS_ = _ol_xml_.makeStructureNS( 'Style': _ol_xml_.makeObjectPropertyPusher( WMSCapabilities.readStyle_), 'MinScaleDenominator': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readDecimal), + XSD.readDecimal), 'MaxScaleDenominator': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readDecimal), + XSD.readDecimal), 'Layer': _ol_xml_.makeObjectPropertyPusher( WMSCapabilities.readLayer_) }); @@ -646,7 +646,7 @@ WMSCapabilities.LAYER_PARSERS_ = _ol_xml_.makeStructureNS( */ WMSCapabilities.ATTRIBUTION_PARSERS_ = _ol_xml_.makeStructureNS( WMSCapabilities.NAMESPACE_URIS_, { - 'Title': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), + 'Title': _ol_xml_.makeObjectPropertySetter(XSD.readString), 'OnlineResource': _ol_xml_.makeObjectPropertySetter( XLink.readHref), 'LogoURL': _ol_xml_.makeObjectPropertySetter( @@ -662,13 +662,13 @@ WMSCapabilities.ATTRIBUTION_PARSERS_ = _ol_xml_.makeStructureNS( WMSCapabilities.EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS_ = _ol_xml_.makeStructureNS(WMSCapabilities.NAMESPACE_URIS_, { 'westBoundLongitude': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readDecimal), + XSD.readDecimal), 'eastBoundLongitude': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readDecimal), + XSD.readDecimal), 'southBoundLatitude': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readDecimal), + XSD.readDecimal), 'northBoundLatitude': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readDecimal) + XSD.readDecimal) }); @@ -695,7 +695,7 @@ WMSCapabilities.REQUEST_PARSERS_ = _ol_xml_.makeStructureNS( */ WMSCapabilities.OPERATIONTYPE_PARSERS_ = _ol_xml_.makeStructureNS( WMSCapabilities.NAMESPACE_URIS_, { - 'Format': _ol_xml_.makeObjectPropertyPusher(_ol_format_XSD_.readString), + 'Format': _ol_xml_.makeObjectPropertyPusher(XSD.readString), 'DCPType': _ol_xml_.makeObjectPropertyPusher( WMSCapabilities.readDCPType_) }); @@ -734,9 +734,9 @@ WMSCapabilities.HTTP_PARSERS_ = _ol_xml_.makeStructureNS( */ WMSCapabilities.STYLE_PARSERS_ = _ol_xml_.makeStructureNS( WMSCapabilities.NAMESPACE_URIS_, { - 'Name': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'Title': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'Abstract': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), + 'Name': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'Title': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'Abstract': _ol_xml_.makeObjectPropertySetter(XSD.readString), 'LegendURL': _ol_xml_.makeObjectPropertyPusher( WMSCapabilities.readSizedFormatOnlineresource_), 'StyleSheetURL': _ol_xml_.makeObjectPropertySetter( @@ -753,7 +753,7 @@ WMSCapabilities.STYLE_PARSERS_ = _ol_xml_.makeStructureNS( */ WMSCapabilities.FORMAT_ONLINERESOURCE_PARSERS_ = _ol_xml_.makeStructureNS(WMSCapabilities.NAMESPACE_URIS_, { - 'Format': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), + 'Format': _ol_xml_.makeObjectPropertySetter(XSD.readString), 'OnlineResource': _ol_xml_.makeObjectPropertySetter( XLink.readHref) }); @@ -766,6 +766,6 @@ WMSCapabilities.FORMAT_ONLINERESOURCE_PARSERS_ = */ WMSCapabilities.KEYWORDLIST_PARSERS_ = _ol_xml_.makeStructureNS( WMSCapabilities.NAMESPACE_URIS_, { - 'Keyword': _ol_xml_.makeArrayPusher(_ol_format_XSD_.readString) + 'Keyword': _ol_xml_.makeArrayPusher(XSD.readString) }); export default WMSCapabilities; diff --git a/src/ol/format/WMTSCapabilities.js b/src/ol/format/WMTSCapabilities.js index a8ac5d0f3c..2973a0105b 100644 --- a/src/ol/format/WMTSCapabilities.js +++ b/src/ol/format/WMTSCapabilities.js @@ -6,7 +6,7 @@ import {boundingExtent} from '../extent.js'; import OWS from '../format/OWS.js'; import XLink from '../format/XLink.js'; import XML from '../format/XML.js'; -import _ol_format_XSD_ from '../format/XSD.js'; +import XSD from '../format/XSD.js'; import _ol_xml_ from '../xml.js'; /** @@ -211,7 +211,7 @@ _ol_format_WMTSCapabilities_.readLegendUrl_ = function(node, objectStack) { * @return {Object|undefined} Coordinates object. */ _ol_format_WMTSCapabilities_.readCoordinates_ = function(node, objectStack) { - var coordinates = _ol_format_XSD_.readString(node).split(' '); + var coordinates = XSD.readString(node).split(' '); if (!coordinates || coordinates.length != 2) { return undefined; } @@ -320,7 +320,7 @@ _ol_format_WMTSCapabilities_.LAYER_PARSERS_ = _ol_xml_.makeStructureNS( 'Style': _ol_xml_.makeObjectPropertyPusher( _ol_format_WMTSCapabilities_.readStyle_), 'Format': _ol_xml_.makeObjectPropertyPusher( - _ol_format_XSD_.readString), + XSD.readString), 'TileMatrixSetLink': _ol_xml_.makeObjectPropertyPusher( _ol_format_WMTSCapabilities_.readTileMatrixSetLink_), 'Dimension': _ol_xml_.makeObjectPropertyPusher( @@ -329,13 +329,13 @@ _ol_format_WMTSCapabilities_.LAYER_PARSERS_ = _ol_xml_.makeStructureNS( _ol_format_WMTSCapabilities_.readResourceUrl_) }, _ol_xml_.makeStructureNS(_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, { 'Title': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString), + XSD.readString), 'Abstract': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString), + XSD.readString), 'WGS84BoundingBox': _ol_xml_.makeObjectPropertySetter( _ol_format_WMTSCapabilities_.readWgs84BoundingBox_), 'Identifier': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString) + XSD.readString) })); @@ -350,9 +350,9 @@ _ol_format_WMTSCapabilities_.STYLE_PARSERS_ = _ol_xml_.makeStructureNS( _ol_format_WMTSCapabilities_.readLegendUrl_) }, _ol_xml_.makeStructureNS(_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, { 'Title': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString), + XSD.readString), 'Identifier': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString) + XSD.readString) })); @@ -364,7 +364,7 @@ _ol_format_WMTSCapabilities_.STYLE_PARSERS_ = _ol_xml_.makeStructureNS( _ol_format_WMTSCapabilities_.TMS_LINKS_PARSERS_ = _ol_xml_.makeStructureNS( _ol_format_WMTSCapabilities_.NAMESPACE_URIS_, { 'TileMatrixSet': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString), + XSD.readString), 'TileMatrixSetLimits': _ol_xml_.makeObjectPropertySetter( _ol_format_WMTSCapabilities_.readTileMatrixLimitsList_) }); @@ -389,15 +389,15 @@ _ol_format_WMTSCapabilities_.TMS_LIMITS_LIST_PARSERS_ = _ol_xml_.makeStructureNS _ol_format_WMTSCapabilities_.TMS_LIMITS_PARSERS_ = _ol_xml_.makeStructureNS( _ol_format_WMTSCapabilities_.NAMESPACE_URIS_, { 'TileMatrix': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString), + XSD.readString), 'MinTileRow': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readNonNegativeInteger), + XSD.readNonNegativeInteger), 'MaxTileRow': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readNonNegativeInteger), + XSD.readNonNegativeInteger), 'MinTileCol': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readNonNegativeInteger), + XSD.readNonNegativeInteger), 'MaxTileCol': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readNonNegativeInteger) + XSD.readNonNegativeInteger) }); @@ -409,12 +409,12 @@ _ol_format_WMTSCapabilities_.TMS_LIMITS_PARSERS_ = _ol_xml_.makeStructureNS( _ol_format_WMTSCapabilities_.DIMENSION_PARSERS_ = _ol_xml_.makeStructureNS( _ol_format_WMTSCapabilities_.NAMESPACE_URIS_, { 'Default': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString), + XSD.readString), 'Value': _ol_xml_.makeObjectPropertyPusher( - _ol_format_XSD_.readString) + XSD.readString) }, _ol_xml_.makeStructureNS(_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, { 'Identifier': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString) + XSD.readString) })); @@ -440,14 +440,14 @@ _ol_format_WMTSCapabilities_.WGS84_BBOX_READERS_ = _ol_xml_.makeStructureNS( _ol_format_WMTSCapabilities_.TMS_PARSERS_ = _ol_xml_.makeStructureNS( _ol_format_WMTSCapabilities_.NAMESPACE_URIS_, { 'WellKnownScaleSet': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString), + XSD.readString), 'TileMatrix': _ol_xml_.makeObjectPropertyPusher( _ol_format_WMTSCapabilities_.readTileMatrix_) }, _ol_xml_.makeStructureNS(_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, { 'SupportedCRS': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString), + XSD.readString), 'Identifier': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString) + XSD.readString) })); @@ -461,17 +461,17 @@ _ol_format_WMTSCapabilities_.TM_PARSERS_ = _ol_xml_.makeStructureNS( 'TopLeftCorner': _ol_xml_.makeObjectPropertySetter( _ol_format_WMTSCapabilities_.readCoordinates_), 'ScaleDenominator': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readDecimal), + XSD.readDecimal), 'TileWidth': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readNonNegativeInteger), + XSD.readNonNegativeInteger), 'TileHeight': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readNonNegativeInteger), + XSD.readNonNegativeInteger), 'MatrixWidth': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readNonNegativeInteger), + XSD.readNonNegativeInteger), 'MatrixHeight': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readNonNegativeInteger) + XSD.readNonNegativeInteger) }, _ol_xml_.makeStructureNS(_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, { 'Identifier': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString) + XSD.readString) })); export default _ol_format_WMTSCapabilities_; diff --git a/src/ol/format/XSD.js b/src/ol/format/XSD.js index e93c1ae933..94ed677f86 100644 --- a/src/ol/format/XSD.js +++ b/src/ol/format/XSD.js @@ -3,23 +3,23 @@ */ import _ol_xml_ from '../xml.js'; import _ol_string_ from '../string.js'; -var _ol_format_XSD_ = {}; +var XSD = {}; /** * @const * @type {string} */ -_ol_format_XSD_.NAMESPACE_URI = 'http://www.w3.org/2001/XMLSchema'; +XSD.NAMESPACE_URI = 'http://www.w3.org/2001/XMLSchema'; /** * @param {Node} node Node. * @return {boolean|undefined} Boolean. */ -_ol_format_XSD_.readBoolean = function(node) { +XSD.readBoolean = function(node) { var s = _ol_xml_.getAllTextContent(node, false); - return _ol_format_XSD_.readBooleanString(s); + return XSD.readBooleanString(s); }; @@ -27,7 +27,7 @@ _ol_format_XSD_.readBoolean = function(node) { * @param {string} string String. * @return {boolean|undefined} Boolean. */ -_ol_format_XSD_.readBooleanString = function(string) { +XSD.readBooleanString = function(string) { var m = /^\s*(true|1)|(false|0)\s*$/.exec(string); if (m) { return m[1] !== undefined || false; @@ -41,7 +41,7 @@ _ol_format_XSD_.readBooleanString = function(string) { * @param {Node} node Node. * @return {number|undefined} DateTime in seconds. */ -_ol_format_XSD_.readDateTime = function(node) { +XSD.readDateTime = function(node) { var s = _ol_xml_.getAllTextContent(node, false); var dateTime = Date.parse(s); return isNaN(dateTime) ? undefined : dateTime / 1000; @@ -52,9 +52,9 @@ _ol_format_XSD_.readDateTime = function(node) { * @param {Node} node Node. * @return {number|undefined} Decimal. */ -_ol_format_XSD_.readDecimal = function(node) { +XSD.readDecimal = function(node) { var s = _ol_xml_.getAllTextContent(node, false); - return _ol_format_XSD_.readDecimalString(s); + return XSD.readDecimalString(s); }; @@ -62,7 +62,7 @@ _ol_format_XSD_.readDecimal = function(node) { * @param {string} string String. * @return {number|undefined} Decimal. */ -_ol_format_XSD_.readDecimalString = function(string) { +XSD.readDecimalString = function(string) { // FIXME check spec var m = /^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*$/i.exec(string); if (m) { @@ -77,9 +77,9 @@ _ol_format_XSD_.readDecimalString = function(string) { * @param {Node} node Node. * @return {number|undefined} Non negative integer. */ -_ol_format_XSD_.readNonNegativeInteger = function(node) { +XSD.readNonNegativeInteger = function(node) { var s = _ol_xml_.getAllTextContent(node, false); - return _ol_format_XSD_.readNonNegativeIntegerString(s); + return XSD.readNonNegativeIntegerString(s); }; @@ -87,7 +87,7 @@ _ol_format_XSD_.readNonNegativeInteger = function(node) { * @param {string} string String. * @return {number|undefined} Non negative integer. */ -_ol_format_XSD_.readNonNegativeIntegerString = function(string) { +XSD.readNonNegativeIntegerString = function(string) { var m = /^\s*(\d+)\s*$/.exec(string); if (m) { return parseInt(m[1], 10); @@ -101,7 +101,7 @@ _ol_format_XSD_.readNonNegativeIntegerString = function(string) { * @param {Node} node Node. * @return {string|undefined} String. */ -_ol_format_XSD_.readString = function(node) { +XSD.readString = function(node) { return _ol_xml_.getAllTextContent(node, false).trim(); }; @@ -110,8 +110,8 @@ _ol_format_XSD_.readString = function(node) { * @param {Node} node Node to append a TextNode with the boolean to. * @param {boolean} bool Boolean. */ -_ol_format_XSD_.writeBooleanTextNode = function(node, bool) { - _ol_format_XSD_.writeStringTextNode(node, (bool) ? '1' : '0'); +XSD.writeBooleanTextNode = function(node, bool) { + XSD.writeStringTextNode(node, (bool) ? '1' : '0'); }; @@ -119,7 +119,7 @@ _ol_format_XSD_.writeBooleanTextNode = function(node, bool) { * @param {Node} node Node to append a CDATA Section with the string to. * @param {string} string String. */ -_ol_format_XSD_.writeCDATASection = function(node, string) { +XSD.writeCDATASection = function(node, string) { node.appendChild(_ol_xml_.DOCUMENT.createCDATASection(string)); }; @@ -128,7 +128,7 @@ _ol_format_XSD_.writeCDATASection = function(node, string) { * @param {Node} node Node to append a TextNode with the dateTime to. * @param {number} dateTime DateTime in seconds. */ -_ol_format_XSD_.writeDateTimeTextNode = function(node, dateTime) { +XSD.writeDateTimeTextNode = function(node, dateTime) { var date = new Date(dateTime * 1000); var string = date.getUTCFullYear() + '-' + _ol_string_.padNumber(date.getUTCMonth() + 1, 2) + '-' + @@ -144,7 +144,7 @@ _ol_format_XSD_.writeDateTimeTextNode = function(node, dateTime) { * @param {Node} node Node to append a TextNode with the decimal to. * @param {number} decimal Decimal. */ -_ol_format_XSD_.writeDecimalTextNode = function(node, decimal) { +XSD.writeDecimalTextNode = function(node, decimal) { var string = decimal.toPrecision(); node.appendChild(_ol_xml_.DOCUMENT.createTextNode(string)); }; @@ -154,7 +154,7 @@ _ol_format_XSD_.writeDecimalTextNode = function(node, decimal) { * @param {Node} node Node to append a TextNode with the decimal to. * @param {number} nonNegativeInteger Non negative integer. */ -_ol_format_XSD_.writeNonNegativeIntegerTextNode = function(node, nonNegativeInteger) { +XSD.writeNonNegativeIntegerTextNode = function(node, nonNegativeInteger) { var string = nonNegativeInteger.toString(); node.appendChild(_ol_xml_.DOCUMENT.createTextNode(string)); }; @@ -164,7 +164,7 @@ _ol_format_XSD_.writeNonNegativeIntegerTextNode = function(node, nonNegativeInte * @param {Node} node Node to append a TextNode with the string to. * @param {string} string String. */ -_ol_format_XSD_.writeStringTextNode = function(node, string) { +XSD.writeStringTextNode = function(node, string) { node.appendChild(_ol_xml_.DOCUMENT.createTextNode(string)); }; -export default _ol_format_XSD_; +export default XSD; diff --git a/test/spec/ol/format/xsd.test.js b/test/spec/ol/format/xsd.test.js index e4a6a0546a..614358632d 100644 --- a/test/spec/ol/format/xsd.test.js +++ b/test/spec/ol/format/xsd.test.js @@ -1,4 +1,4 @@ -import _ol_format_XSD_ from '../../../../src/ol/format/XSD.js'; +import XSD from '../../../../src/ol/format/XSD.js'; describe('ol.format.XSD', function() { @@ -7,7 +7,7 @@ describe('ol.format.XSD', function() { it('can handle non-Zulu time zones', function() { var node = document.createElement('time'); node.textContent = '2016-07-12T15:00:00+03:00'; - expect(new Date(_ol_format_XSD_.readDateTime(node) * 1000).toISOString()).to.eql('2016-07-12T12:00:00.000Z'); + expect(new Date(XSD.readDateTime(node) * 1000).toISOString()).to.eql('2016-07-12T12:00:00.000Z'); }); });