Make code prettier
This updates ESLint and our shared eslint-config-openlayers to use Prettier. Most formatting changes were automatically applied with this:
npm run lint -- --fix
A few manual changes were required:
* In `examples/offscreen-canvas.js`, the `//eslint-disable-line` comment needed to be moved to the appropriate line to disable the error about the `'worker-loader!./offscreen-canvas.worker.js'` import.
* In `examples/webpack/exapmle-builder.js`, spaces could not be added after a couple `function`s for some reason. While editing this, I reworked `ExampleBuilder` to be a class.
* In `src/ol/format/WMSGetFeatureInfo.js`, the `// @ts-ignore` comment needed to be moved down one line so it applied to the `parsersNS` argument.
This commit is contained in:
+93
-118
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
import GML3 from './GML3.js';
|
||||
import GMLBase from './GMLBase.js';
|
||||
import {makeArrayPusher, makeReplacer, makeChildAppender} from '../xml.js';
|
||||
import {makeArrayPusher, makeChildAppender, makeReplacer} from '../xml.js';
|
||||
import {writeStringTextNode} from '../format/xsd.js';
|
||||
|
||||
/**
|
||||
@@ -12,21 +12,22 @@ import {writeStringTextNode} from '../format/xsd.js';
|
||||
* @api
|
||||
*/
|
||||
class GML32 extends GML3 {
|
||||
|
||||
/**
|
||||
* @param {import("./GMLBase.js").Options=} opt_options Optional configuration object.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
const options = /** @type {import("./GMLBase.js").Options} */ (opt_options ? opt_options : {});
|
||||
const options = /** @type {import("./GMLBase.js").Options} */ (opt_options
|
||||
? opt_options
|
||||
: {});
|
||||
|
||||
super(options);
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
this.schemaLocation = options.schemaLocation ?
|
||||
options.schemaLocation : this.namespace + ' http://schemas.opengis.net/gml/3.2.1/gml.xsd';
|
||||
|
||||
this.schemaLocation = options.schemaLocation
|
||||
? options.schemaLocation
|
||||
: this.namespace + ' http://schemas.opengis.net/gml/3.2.1/gml.xsd';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,8 +41,8 @@ GML32.prototype.namespace = 'http://www.opengis.net/gml/3.2';
|
||||
GML32.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS = {
|
||||
'http://www.opengis.net/gml/3.2': {
|
||||
'pos': makeReplacer(GML3.prototype.readFlatPos_),
|
||||
'posList': makeReplacer(GML3.prototype.readFlatPosList_)
|
||||
}
|
||||
'posList': makeReplacer(GML3.prototype.readFlatPosList_),
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -52,8 +53,8 @@ GML32.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS = {
|
||||
GML32.prototype.FLAT_LINEAR_RINGS_PARSERS = {
|
||||
'http://www.opengis.net/gml/3.2': {
|
||||
'interior': GML3.prototype.interiorParser_,
|
||||
'exterior': GML3.prototype.exteriorParser_
|
||||
}
|
||||
'exterior': GML3.prototype.exteriorParser_,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -64,25 +65,18 @@ GML32.prototype.FLAT_LINEAR_RINGS_PARSERS = {
|
||||
GML32.prototype.GEOMETRY_PARSERS = {
|
||||
'http://www.opengis.net/gml/3.2': {
|
||||
'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),
|
||||
'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),
|
||||
'MultiPolygon': makeReplacer(GMLBase.prototype.readMultiPolygon),
|
||||
'Surface': makeReplacer(GML32.prototype.readSurface_),
|
||||
'MultiSurface': makeReplacer(
|
||||
GML3.prototype.readMultiSurface_),
|
||||
'MultiSurface': makeReplacer(GML3.prototype.readMultiSurface_),
|
||||
'Curve': makeReplacer(GML32.prototype.readCurve_),
|
||||
'MultiCurve': makeReplacer(
|
||||
GML3.prototype.readMultiCurve_),
|
||||
'Envelope': makeReplacer(GML32.prototype.readEnvelope_)
|
||||
}
|
||||
'MultiCurve': makeReplacer(GML3.prototype.readMultiCurve_),
|
||||
'Envelope': makeReplacer(GML32.prototype.readEnvelope_),
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -92,11 +86,9 @@ GML32.prototype.GEOMETRY_PARSERS = {
|
||||
*/
|
||||
GML32.prototype.MULTICURVE_PARSERS_ = {
|
||||
'http://www.opengis.net/gml/3.2': {
|
||||
'curveMember': makeArrayPusher(
|
||||
GML3.prototype.curveMemberParser_),
|
||||
'curveMembers': makeArrayPusher(
|
||||
GML3.prototype.curveMemberParser_)
|
||||
}
|
||||
'curveMember': makeArrayPusher(GML3.prototype.curveMemberParser_),
|
||||
'curveMembers': makeArrayPusher(GML3.prototype.curveMemberParser_),
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -106,11 +98,9 @@ GML32.prototype.MULTICURVE_PARSERS_ = {
|
||||
*/
|
||||
GML32.prototype.MULTISURFACE_PARSERS_ = {
|
||||
'http://www.opengis.net/gml/3.2': {
|
||||
'surfaceMember': makeArrayPusher(
|
||||
GML3.prototype.surfaceMemberParser_),
|
||||
'surfaceMembers': makeArrayPusher(
|
||||
GML3.prototype.surfaceMemberParser_)
|
||||
}
|
||||
'surfaceMember': makeArrayPusher(GML3.prototype.surfaceMemberParser_),
|
||||
'surfaceMembers': makeArrayPusher(GML3.prototype.surfaceMemberParser_),
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -120,10 +110,9 @@ GML32.prototype.MULTISURFACE_PARSERS_ = {
|
||||
*/
|
||||
GML32.prototype.CURVEMEMBER_PARSERS_ = {
|
||||
'http://www.opengis.net/gml/3.2': {
|
||||
'LineString': makeArrayPusher(
|
||||
GMLBase.prototype.readLineString),
|
||||
'Curve': makeArrayPusher(GML3.prototype.readCurve_)
|
||||
}
|
||||
'LineString': makeArrayPusher(GMLBase.prototype.readLineString),
|
||||
'Curve': makeArrayPusher(GML3.prototype.readCurve_),
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -134,8 +123,8 @@ GML32.prototype.CURVEMEMBER_PARSERS_ = {
|
||||
GML32.prototype.SURFACEMEMBER_PARSERS_ = {
|
||||
'http://www.opengis.net/gml/3.2': {
|
||||
'Polygon': makeArrayPusher(GMLBase.prototype.readPolygon),
|
||||
'Surface': makeArrayPusher(GML3.prototype.readSurface_)
|
||||
}
|
||||
'Surface': makeArrayPusher(GML3.prototype.readSurface_),
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -145,8 +134,8 @@ GML32.prototype.SURFACEMEMBER_PARSERS_ = {
|
||||
*/
|
||||
GML32.prototype.SURFACE_PARSERS_ = {
|
||||
'http://www.opengis.net/gml/3.2': {
|
||||
'patches': makeReplacer(GML3.prototype.readPatch_)
|
||||
}
|
||||
'patches': makeReplacer(GML3.prototype.readPatch_),
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -156,8 +145,8 @@ GML32.prototype.SURFACE_PARSERS_ = {
|
||||
*/
|
||||
GML32.prototype.CURVE_PARSERS_ = {
|
||||
'http://www.opengis.net/gml/3.2': {
|
||||
'segments': makeReplacer(GML3.prototype.readSegment_)
|
||||
}
|
||||
'segments': makeReplacer(GML3.prototype.readSegment_),
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -167,11 +156,9 @@ GML32.prototype.CURVE_PARSERS_ = {
|
||||
*/
|
||||
GML32.prototype.ENVELOPE_PARSERS_ = {
|
||||
'http://www.opengis.net/gml/3.2': {
|
||||
'lowerCorner': makeArrayPusher(
|
||||
GML3.prototype.readFlatPosList_),
|
||||
'upperCorner': makeArrayPusher(
|
||||
GML3.prototype.readFlatPosList_)
|
||||
}
|
||||
'lowerCorner': makeArrayPusher(GML3.prototype.readFlatPosList_),
|
||||
'upperCorner': makeArrayPusher(GML3.prototype.readFlatPosList_),
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -181,9 +168,8 @@ GML32.prototype.ENVELOPE_PARSERS_ = {
|
||||
*/
|
||||
GML32.prototype.PATCHES_PARSERS_ = {
|
||||
'http://www.opengis.net/gml/3.2': {
|
||||
'PolygonPatch': makeReplacer(
|
||||
GML3.prototype.readPolygonPatch_)
|
||||
}
|
||||
'PolygonPatch': makeReplacer(GML3.prototype.readPolygonPatch_),
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -193,9 +179,8 @@ GML32.prototype.PATCHES_PARSERS_ = {
|
||||
*/
|
||||
GML32.prototype.SEGMENTS_PARSERS_ = {
|
||||
'http://www.opengis.net/gml/3.2': {
|
||||
'LineStringSegment': makeReplacer(
|
||||
GML3.prototype.readLineStringSegment_)
|
||||
}
|
||||
'LineStringSegment': makeReplacer(GML3.prototype.readLineStringSegment_),
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -205,11 +190,9 @@ GML32.prototype.SEGMENTS_PARSERS_ = {
|
||||
*/
|
||||
GML32.prototype.MULTIPOINT_PARSERS_ = {
|
||||
'http://www.opengis.net/gml/3.2': {
|
||||
'pointMember': makeArrayPusher(
|
||||
GMLBase.prototype.pointMemberParser_),
|
||||
'pointMembers': makeArrayPusher(
|
||||
GMLBase.prototype.pointMemberParser_)
|
||||
}
|
||||
'pointMember': makeArrayPusher(GMLBase.prototype.pointMemberParser_),
|
||||
'pointMembers': makeArrayPusher(GMLBase.prototype.pointMemberParser_),
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -220,10 +203,12 @@ GML32.prototype.MULTIPOINT_PARSERS_ = {
|
||||
GML32.prototype.MULTILINESTRING_PARSERS_ = {
|
||||
'http://www.opengis.net/gml/3.2': {
|
||||
'lineStringMember': makeArrayPusher(
|
||||
GMLBase.prototype.lineStringMemberParser_),
|
||||
GMLBase.prototype.lineStringMemberParser_
|
||||
),
|
||||
'lineStringMembers': makeArrayPusher(
|
||||
GMLBase.prototype.lineStringMemberParser_)
|
||||
}
|
||||
GMLBase.prototype.lineStringMemberParser_
|
||||
),
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -233,11 +218,9 @@ GML32.prototype.MULTILINESTRING_PARSERS_ = {
|
||||
*/
|
||||
GML32.prototype.MULTIPOLYGON_PARSERS_ = {
|
||||
'http://www.opengis.net/gml/3.2': {
|
||||
'polygonMember': makeArrayPusher(
|
||||
GMLBase.prototype.polygonMemberParser_),
|
||||
'polygonMembers': makeArrayPusher(
|
||||
GMLBase.prototype.polygonMemberParser_)
|
||||
}
|
||||
'polygonMember': makeArrayPusher(GMLBase.prototype.polygonMemberParser_),
|
||||
'polygonMembers': makeArrayPusher(GMLBase.prototype.polygonMemberParser_),
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -247,9 +230,8 @@ GML32.prototype.MULTIPOLYGON_PARSERS_ = {
|
||||
*/
|
||||
GML32.prototype.POINTMEMBER_PARSERS_ = {
|
||||
'http://www.opengis.net/gml/3.2': {
|
||||
'Point': makeArrayPusher(
|
||||
GMLBase.prototype.readFlatCoordinatesFromNode_)
|
||||
}
|
||||
'Point': makeArrayPusher(GMLBase.prototype.readFlatCoordinatesFromNode_),
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -259,9 +241,8 @@ GML32.prototype.POINTMEMBER_PARSERS_ = {
|
||||
*/
|
||||
GML32.prototype.LINESTRINGMEMBER_PARSERS_ = {
|
||||
'http://www.opengis.net/gml/3.2': {
|
||||
'LineString': makeArrayPusher(
|
||||
GMLBase.prototype.readLineString)
|
||||
}
|
||||
'LineString': makeArrayPusher(GMLBase.prototype.readLineString),
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -271,9 +252,8 @@ GML32.prototype.LINESTRINGMEMBER_PARSERS_ = {
|
||||
*/
|
||||
GML32.prototype.POLYGONMEMBER_PARSERS_ = {
|
||||
'http://www.opengis.net/gml/3.2': {
|
||||
'Polygon': makeArrayPusher(
|
||||
GMLBase.prototype.readPolygon)
|
||||
}
|
||||
'Polygon': makeArrayPusher(GMLBase.prototype.readPolygon),
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -283,9 +263,8 @@ GML32.prototype.POLYGONMEMBER_PARSERS_ = {
|
||||
*/
|
||||
GML32.prototype.RING_PARSERS = {
|
||||
'http://www.opengis.net/gml/3.2': {
|
||||
'LinearRing': makeReplacer(
|
||||
GMLBase.prototype.readFlatLinearRing_)
|
||||
}
|
||||
'LinearRing': makeReplacer(GMLBase.prototype.readFlatLinearRing_),
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -295,11 +274,10 @@ GML32.prototype.RING_PARSERS = {
|
||||
GML32.prototype.RING_SERIALIZERS_ = {
|
||||
'http://www.opengis.net/gml/3.2': {
|
||||
'exterior': makeChildAppender(GML3.prototype.writeRing_),
|
||||
'interior': makeChildAppender(GML3.prototype.writeRing_)
|
||||
}
|
||||
'interior': makeChildAppender(GML3.prototype.writeRing_),
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @type {Object<string, Object<string, import("../xml.js").Serializer>>}
|
||||
* @private
|
||||
@@ -307,11 +285,10 @@ GML32.prototype.RING_SERIALIZERS_ = {
|
||||
GML32.prototype.ENVELOPE_SERIALIZERS_ = {
|
||||
'http://www.opengis.net/gml/3.2': {
|
||||
'lowerCorner': makeChildAppender(writeStringTextNode),
|
||||
'upperCorner': makeChildAppender(writeStringTextNode)
|
||||
}
|
||||
'upperCorner': makeChildAppender(writeStringTextNode),
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @type {Object<string, Object<string, import("../xml.js").Serializer>>}
|
||||
* @private
|
||||
@@ -319,25 +296,24 @@ GML32.prototype.ENVELOPE_SERIALIZERS_ = {
|
||||
GML32.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = {
|
||||
'http://www.opengis.net/gml/3.2': {
|
||||
'surfaceMember': makeChildAppender(
|
||||
GML3.prototype.writeSurfaceOrPolygonMember_),
|
||||
GML3.prototype.writeSurfaceOrPolygonMember_
|
||||
),
|
||||
'polygonMember': makeChildAppender(
|
||||
GML3.prototype.writeSurfaceOrPolygonMember_)
|
||||
}
|
||||
GML3.prototype.writeSurfaceOrPolygonMember_
|
||||
),
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @type {Object<string, Object<string, import("../xml.js").Serializer>>}
|
||||
* @private
|
||||
*/
|
||||
GML32.prototype.POINTMEMBER_SERIALIZERS_ = {
|
||||
'http://www.opengis.net/gml/3.2': {
|
||||
'pointMember': makeChildAppender(
|
||||
GML3.prototype.writePointMember_)
|
||||
}
|
||||
'pointMember': makeChildAppender(GML3.prototype.writePointMember_),
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @type {Object<string, Object<string, import("../xml.js").Serializer>>}
|
||||
* @private
|
||||
@@ -345,10 +321,12 @@ GML32.prototype.POINTMEMBER_SERIALIZERS_ = {
|
||||
GML32.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = {
|
||||
'http://www.opengis.net/gml/3.2': {
|
||||
'lineStringMember': makeChildAppender(
|
||||
GML3.prototype.writeLineStringOrCurveMember_),
|
||||
GML3.prototype.writeLineStringOrCurveMember_
|
||||
),
|
||||
'curveMember': makeChildAppender(
|
||||
GML3.prototype.writeLineStringOrCurveMember_)
|
||||
}
|
||||
GML3.prototype.writeLineStringOrCurveMember_
|
||||
),
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -357,30 +335,27 @@ GML32.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = {
|
||||
*/
|
||||
GML32.prototype.GEOMETRY_SERIALIZERS_ = {
|
||||
'http://www.opengis.net/gml/3.2': {
|
||||
'Curve': makeChildAppender(
|
||||
GML3.prototype.writeCurveOrLineString_),
|
||||
'Curve': makeChildAppender(GML3.prototype.writeCurveOrLineString_),
|
||||
'MultiCurve': makeChildAppender(
|
||||
GML3.prototype.writeMultiCurveOrLineString_),
|
||||
GML3.prototype.writeMultiCurveOrLineString_
|
||||
),
|
||||
'Point': makeChildAppender(GML32.prototype.writePoint_),
|
||||
'MultiPoint': makeChildAppender(
|
||||
GML3.prototype.writeMultiPoint_),
|
||||
'LineString': makeChildAppender(
|
||||
GML3.prototype.writeCurveOrLineString_),
|
||||
'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_),
|
||||
GML3.prototype.writeMultiCurveOrLineString_
|
||||
),
|
||||
'LinearRing': makeChildAppender(GML3.prototype.writeLinearRing_),
|
||||
'Polygon': makeChildAppender(GML3.prototype.writeSurfaceOrPolygon_),
|
||||
'MultiPolygon': makeChildAppender(
|
||||
GML3.prototype.writeMultiSurfaceOrPolygon_),
|
||||
'Surface': makeChildAppender(
|
||||
GML3.prototype.writeSurfaceOrPolygon_),
|
||||
GML3.prototype.writeMultiSurfaceOrPolygon_
|
||||
),
|
||||
'Surface': makeChildAppender(GML3.prototype.writeSurfaceOrPolygon_),
|
||||
'MultiSurface': makeChildAppender(
|
||||
GML3.prototype.writeMultiSurfaceOrPolygon_),
|
||||
'Envelope': makeChildAppender(
|
||||
GML3.prototype.writeEnvelope)
|
||||
}
|
||||
GML3.prototype.writeMultiSurfaceOrPolygon_
|
||||
),
|
||||
'Envelope': makeChildAppender(GML3.prototype.writeEnvelope),
|
||||
},
|
||||
};
|
||||
|
||||
export default GML32;
|
||||
|
||||
Reference in New Issue
Block a user