Remove opt_ prefix

This commit is contained in:
Tim Schaub
2022-08-11 17:46:31 -06:00
committed by Tim Schaub
parent dd1edc37ca
commit 99612e7f9a
183 changed files with 1918 additions and 2079 deletions
+45 -50
View File
@@ -78,10 +78,10 @@ const GEOMETRY_WRITERS = {
*/
class EsriJSON extends JSONFeature {
/**
* @param {Options} [opt_options] Options.
* @param {Options} [options] Options.
*/
constructor(opt_options) {
const options = opt_options ? opt_options : {};
constructor(options) {
options = options ? options : {};
super();
@@ -95,14 +95,14 @@ class EsriJSON extends JSONFeature {
/**
* @param {Object} object Object.
* @param {import("./Feature.js").ReadOptions} [opt_options] Read options.
* @param {string} [opt_idField] Name of the field where to get the id from.
* @param {import("./Feature.js").ReadOptions} [options] Read options.
* @param {string} [idField] Name of the field where to get the id from.
* @protected
* @return {import("../Feature.js").default} Feature.
*/
readFeatureFromObject(object, opt_options, opt_idField) {
readFeatureFromObject(object, options, idField) {
const esriJSONFeature = /** @type {EsriJSONFeature} */ (object);
const geometry = readGeometry(esriJSONFeature.geometry, opt_options);
const geometry = readGeometry(esriJSONFeature.geometry, options);
const feature = new Feature();
if (this.geometryName_) {
feature.setGeometryName(this.geometryName_);
@@ -110,7 +110,7 @@ class EsriJSON extends JSONFeature {
feature.setGeometry(geometry);
if (esriJSONFeature.attributes) {
feature.setProperties(esriJSONFeature.attributes, true);
const id = esriJSONFeature.attributes[opt_idField];
const id = esriJSONFeature.attributes[idField];
if (id !== undefined) {
feature.setId(/** @type {number} */ (id));
}
@@ -120,12 +120,12 @@ class EsriJSON extends JSONFeature {
/**
* @param {Object} object Object.
* @param {import("./Feature.js").ReadOptions} [opt_options] Read options.
* @param {import("./Feature.js").ReadOptions} [options] Read options.
* @protected
* @return {Array<Feature>} Features.
*/
readFeaturesFromObject(object, opt_options) {
const options = opt_options ? opt_options : {};
readFeaturesFromObject(object, options) {
options = options ? options : {};
if (object['features']) {
const esriJSONFeatureSet = /** @type {EsriJSONFeatureSet} */ (object);
/** @type {Array<import("../Feature.js").default>} */
@@ -148,12 +148,12 @@ class EsriJSON extends JSONFeature {
/**
* @param {EsriJSONGeometry} object Object.
* @param {import("./Feature.js").ReadOptions} [opt_options] Read options.
* @param {import("./Feature.js").ReadOptions} [options] Read options.
* @protected
* @return {import("../geom/Geometry.js").default} Geometry.
*/
readGeometryFromObject(object, opt_options) {
return readGeometry(object, opt_options);
readGeometryFromObject(object, options) {
return readGeometry(object, options);
}
/**
@@ -180,24 +180,24 @@ class EsriJSON extends JSONFeature {
* Encode a geometry as a EsriJSON object.
*
* @param {import("../geom/Geometry.js").default} geometry Geometry.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @return {EsriJSONGeometry} Object.
* @api
*/
writeGeometryObject(geometry, opt_options) {
return writeGeometry(geometry, this.adaptOptions(opt_options));
writeGeometryObject(geometry, options) {
return writeGeometry(geometry, this.adaptOptions(options));
}
/**
* Encode a feature as a esriJSON Feature object.
*
* @param {import("../Feature.js").default} feature Feature.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @return {Object} Object.
* @api
*/
writeFeatureObject(feature, opt_options) {
opt_options = this.adaptOptions(opt_options);
writeFeatureObject(feature, options) {
options = this.adaptOptions(options);
const object = {};
if (!feature.hasProperties()) {
object['attributes'] = {};
@@ -206,10 +206,9 @@ class EsriJSON extends JSONFeature {
const properties = feature.getProperties();
const geometry = feature.getGeometry();
if (geometry) {
object['geometry'] = writeGeometry(geometry, opt_options);
object['geometry'] = writeGeometry(geometry, options);
const projection =
opt_options &&
(opt_options.dataProjection || opt_options.featureProjection);
options && (options.dataProjection || options.featureProjection);
if (projection) {
object['geometry']['spatialReference'] =
/** @type {EsriJSONSpatialReferenceWkid} */ ({
@@ -230,15 +229,15 @@ class EsriJSON extends JSONFeature {
* Encode an array of features as a EsriJSON object.
*
* @param {Array<import("../Feature.js").default>} features Features.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @return {EsriJSONFeatureSet} EsriJSON Object.
* @api
*/
writeFeaturesObject(features, opt_options) {
opt_options = this.adaptOptions(opt_options);
writeFeaturesObject(features, options) {
options = this.adaptOptions(options);
const objects = [];
for (let i = 0, ii = features.length; i < ii; ++i) {
objects.push(this.writeFeatureObject(features[i], opt_options));
objects.push(this.writeFeatureObject(features[i], options));
}
return {
'features': objects,
@@ -248,10 +247,10 @@ class EsriJSON extends JSONFeature {
/**
* @param {EsriJSONGeometry} object Object.
* @param {import("./Feature.js").ReadOptions} [opt_options] Read options.
* @param {import("./Feature.js").ReadOptions} [options] Read options.
* @return {import("../geom/Geometry.js").default} Geometry.
*/
function readGeometry(object, opt_options) {
function readGeometry(object, options) {
if (!object) {
return null;
}
@@ -281,11 +280,7 @@ function readGeometry(object, opt_options) {
}
}
const geometryReader = GEOMETRY_READERS[type];
return transformGeometryWithOptions(
geometryReader(object),
false,
opt_options
);
return transformGeometryWithOptions(geometryReader(object), false, options);
}
/**
@@ -426,10 +421,10 @@ function readPolygonGeometry(object) {
/**
* @param {import("../geom/Point.js").default} geometry Geometry.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @return {EsriJSONPoint} EsriJSON geometry.
*/
function writePointGeometry(geometry, opt_options) {
function writePointGeometry(geometry, options) {
const coordinates = geometry.getCoordinates();
/** @type {EsriJSONPoint} */
let esriJSON;
@@ -478,10 +473,10 @@ function getHasZM(geometry) {
/**
* @param {import("../geom/LineString.js").default} lineString Geometry.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @return {EsriJSONPolyline} EsriJSON geometry.
*/
function writeLineStringGeometry(lineString, opt_options) {
function writeLineStringGeometry(lineString, options) {
const hasZM = getHasZM(lineString);
return {
hasZ: hasZM.hasZ,
@@ -494,10 +489,10 @@ function writeLineStringGeometry(lineString, opt_options) {
/**
* @param {import("../geom/Polygon.js").default} polygon Geometry.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @return {EsriJSONPolygon} EsriJSON geometry.
*/
function writePolygonGeometry(polygon, opt_options) {
function writePolygonGeometry(polygon, options) {
// Esri geometries use the left-hand rule
const hasZM = getHasZM(polygon);
return {
@@ -511,10 +506,10 @@ function writePolygonGeometry(polygon, opt_options) {
/**
* @param {import("../geom/MultiLineString.js").default} multiLineString Geometry.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @return {EsriJSONPolyline} EsriJSON geometry.
*/
function writeMultiLineStringGeometry(multiLineString, opt_options) {
function writeMultiLineStringGeometry(multiLineString, options) {
const hasZM = getHasZM(multiLineString);
return {
hasZ: hasZM.hasZ,
@@ -527,10 +522,10 @@ function writeMultiLineStringGeometry(multiLineString, opt_options) {
/**
* @param {import("../geom/MultiPoint.js").default} multiPoint Geometry.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @return {EsriJSONMultipoint} EsriJSON geometry.
*/
function writeMultiPointGeometry(multiPoint, opt_options) {
function writeMultiPointGeometry(multiPoint, options) {
const hasZM = getHasZM(multiPoint);
return {
hasZ: hasZM.hasZ,
@@ -543,10 +538,10 @@ function writeMultiPointGeometry(multiPoint, opt_options) {
/**
* @param {import("../geom/MultiPolygon.js").default} geometry Geometry.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @return {EsriJSONPolygon} EsriJSON geometry.
*/
function writeMultiPolygonGeometry(geometry, opt_options) {
function writeMultiPolygonGeometry(geometry, options) {
const hasZM = getHasZM(geometry);
const coordinates = geometry.getCoordinates(false);
const output = [];
@@ -564,14 +559,14 @@ function writeMultiPolygonGeometry(geometry, opt_options) {
/**
* @param {import("../geom/Geometry.js").default} geometry Geometry.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @return {EsriJSONGeometry} EsriJSON geometry.
*/
function writeGeometry(geometry, opt_options) {
function writeGeometry(geometry, options) {
const geometryWriter = GEOMETRY_WRITERS[geometry.getType()];
return geometryWriter(
transformGeometryWithOptions(geometry, true, opt_options),
opt_options
transformGeometryWithOptions(geometry, true, options),
options
);
}
+33 -41
View File
@@ -89,27 +89,26 @@ class FeatureFormat {
/**
* Adds the data projection to the read options.
* @param {Document|Element|Object|string} source Source.
* @param {ReadOptions} [opt_options] Options.
* @param {ReadOptions} [options] Options.
* @return {ReadOptions|undefined} Options.
* @protected
*/
getReadOptions(source, opt_options) {
let options;
if (opt_options) {
let dataProjection = opt_options.dataProjection
? getProjection(opt_options.dataProjection)
getReadOptions(source, options) {
if (options) {
let dataProjection = options.dataProjection
? getProjection(options.dataProjection)
: this.readProjection(source);
if (
opt_options.extent &&
options.extent &&
dataProjection &&
dataProjection.getUnits() === 'tile-pixels'
) {
dataProjection = getProjection(dataProjection);
dataProjection.setWorldExtent(opt_options.extent);
dataProjection.setWorldExtent(options.extent);
}
options = {
dataProjection: dataProjection,
featureProjection: opt_options.featureProjection,
featureProjection: options.featureProjection,
};
}
return this.adaptOptions(options);
@@ -147,10 +146,10 @@ class FeatureFormat {
*
* @abstract
* @param {Document|Element|Object|string} source Source.
* @param {ReadOptions} [opt_options] Read options.
* @param {ReadOptions} [options] Read options.
* @return {import("../Feature.js").FeatureLike} Feature.
*/
readFeature(source, opt_options) {
readFeature(source, options) {
return abstract();
}
@@ -159,10 +158,10 @@ class FeatureFormat {
*
* @abstract
* @param {Document|Element|ArrayBuffer|Object|string} source Source.
* @param {ReadOptions} [opt_options] Read options.
* @param {ReadOptions} [options] Read options.
* @return {Array<import("../Feature.js").FeatureLike>} Features.
*/
readFeatures(source, opt_options) {
readFeatures(source, options) {
return abstract();
}
@@ -171,10 +170,10 @@ class FeatureFormat {
*
* @abstract
* @param {Document|Element|Object|string} source Source.
* @param {ReadOptions} [opt_options] Read options.
* @param {ReadOptions} [options] Read options.
* @return {import("../geom/Geometry.js").default} Geometry.
*/
readGeometry(source, opt_options) {
readGeometry(source, options) {
return abstract();
}
@@ -194,10 +193,10 @@ class FeatureFormat {
*
* @abstract
* @param {import("../Feature.js").default} feature Feature.
* @param {WriteOptions} [opt_options] Write options.
* @param {WriteOptions} [options] Write options.
* @return {string|ArrayBuffer} Result.
*/
writeFeature(feature, opt_options) {
writeFeature(feature, options) {
return abstract();
}
@@ -206,10 +205,10 @@ class FeatureFormat {
*
* @abstract
* @param {Array<import("../Feature.js").default>} features Features.
* @param {WriteOptions} [opt_options] Write options.
* @param {WriteOptions} [options] Write options.
* @return {string|ArrayBuffer} Result.
*/
writeFeatures(features, opt_options) {
writeFeatures(features, options) {
return abstract();
}
@@ -218,10 +217,10 @@ class FeatureFormat {
*
* @abstract
* @param {import("../geom/Geometry.js").default} geometry Geometry.
* @param {WriteOptions} [opt_options] Write options.
* @param {WriteOptions} [options] Write options.
* @return {string|ArrayBuffer} Result.
*/
writeGeometry(geometry, opt_options) {
writeGeometry(geometry, options) {
return abstract();
}
}
@@ -231,16 +230,14 @@ export default FeatureFormat;
/**
* @param {import("../geom/Geometry.js").default} geometry Geometry.
* @param {boolean} write Set to true for writing, false for reading.
* @param {WriteOptions|ReadOptions} [opt_options] Options.
* @param {WriteOptions|ReadOptions} [options] Options.
* @return {import("../geom/Geometry.js").default} Transformed geometry.
*/
export function transformGeometryWithOptions(geometry, write, opt_options) {
const featureProjection = opt_options
? getProjection(opt_options.featureProjection)
: null;
const dataProjection = opt_options
? getProjection(opt_options.dataProjection)
export function transformGeometryWithOptions(geometry, write, options) {
const featureProjection = options
? getProjection(options.featureProjection)
: null;
const dataProjection = options ? getProjection(options.dataProjection) : null;
let transformed;
if (
@@ -257,13 +254,10 @@ export function transformGeometryWithOptions(geometry, write, opt_options) {
}
if (
write &&
opt_options &&
/** @type {WriteOptions} */ (opt_options).decimals !== undefined
options &&
/** @type {WriteOptions} */ (options).decimals !== undefined
) {
const power = Math.pow(
10,
/** @type {WriteOptions} */ (opt_options).decimals
);
const power = Math.pow(10, /** @type {WriteOptions} */ (options).decimals);
// if decimals option on write, round each coordinate appropriately
/**
* @param {Array<number>} coordinates Coordinates.
@@ -285,16 +279,14 @@ export function transformGeometryWithOptions(geometry, write, opt_options) {
/**
* @param {import("../extent.js").Extent} extent Extent.
* @param {ReadOptions} [opt_options] Read options.
* @param {ReadOptions} [options] Read options.
* @return {import("../extent.js").Extent} Transformed extent.
*/
export function transformExtentWithOptions(extent, opt_options) {
const featureProjection = opt_options
? getProjection(opt_options.featureProjection)
: null;
const dataProjection = opt_options
? getProjection(opt_options.dataProjection)
export function transformExtentWithOptions(extent, options) {
const featureProjection = options
? getProjection(options.featureProjection)
: null;
const dataProjection = options ? getProjection(options.dataProjection) : null;
if (
featureProjection &&
+3 -3
View File
@@ -9,7 +9,7 @@ import GML3 from './GML3.js';
* Currently only supports GML 3.1.1 Simple Features profile.
*
* @class
* @param {import("./GMLBase.js").Options} [opt_options]
* @param {import("./GMLBase.js").Options} [options]
* Optional configuration object.
* @api
*/
@@ -20,7 +20,7 @@ const GML = GML3;
*
* @function
* @param {Array<import("../Feature.js").default>} features Features.
* @param {import("./Feature.js").WriteOptions} [opt_options] Options.
* @param {import("./Feature.js").WriteOptions} [options] Options.
* @return {string} Result.
* @api
*/
@@ -31,7 +31,7 @@ GML.prototype.writeFeatures;
*
* @function
* @param {Array<import("../Feature.js").default>} features Features.
* @param {import("./Feature.js").WriteOptions} [opt_options] Options.
* @param {import("./Feature.js").WriteOptions} [options] Options.
* @return {Node} Node.
* @api
*/
+15 -18
View File
@@ -48,12 +48,10 @@ const MULTIGEOMETRY_TO_MEMBER_NODENAME = {
*/
class GML2 extends GMLBase {
/**
* @param {import("./GMLBase.js").Options} [opt_options] Optional configuration object.
* @param {import("./GMLBase.js").Options} [options] Optional configuration object.
*/
constructor(opt_options) {
const options =
/** @type {import("./GMLBase.js").Options} */
(opt_options ? opt_options : {});
constructor(options) {
options = options ? options : {};
super(options);
@@ -171,16 +169,15 @@ class GML2 extends GMLBase {
* @const
* @param {*} value Value.
* @param {Array<*>} objectStack Object stack.
* @param {string} [opt_nodeName] Node name.
* @param {string} [nodeName] Node name.
* @return {Element|undefined} Node.
* @private
*/
GEOMETRY_NODE_FACTORY_(value, objectStack, opt_nodeName) {
GEOMETRY_NODE_FACTORY_(value, objectStack, nodeName) {
const context = objectStack[objectStack.length - 1];
const multiSurface = context['multiSurface'];
const surface = context['surface'];
const multiCurve = context['multiCurve'];
let nodeName;
if (!Array.isArray(value)) {
nodeName = /** @type {import("../geom/Geometry.js").default} */ (
value
@@ -436,11 +433,11 @@ class GML2 extends GMLBase {
/**
* @param {*} value Value.
* @param {Array<*>} objectStack Object stack.
* @param {string} [opt_nodeName] Node name.
* @param {string} [nodeName] Node name.
* @return {Node} Node.
* @private
*/
RING_NODE_FACTORY_(value, objectStack, opt_nodeName) {
RING_NODE_FACTORY_(value, objectStack, nodeName) {
const context = objectStack[objectStack.length - 1];
const parentNode = context.node;
const exteriorWritten = context['exteriorWritten'];
@@ -478,21 +475,21 @@ class GML2 extends GMLBase {
/**
* @param {Array<number>} point Point geometry.
* @param {string} [opt_srsName] Optional srsName
* @param {boolean} [opt_hasZ] whether the geometry has a Z coordinate (is 3D) or not.
* @param {string} [srsName] Optional srsName
* @param {boolean} [hasZ] whether the geometry has a Z coordinate (is 3D) or not.
* @return {string} The coords string.
* @private
*/
getCoords_(point, opt_srsName, opt_hasZ) {
getCoords_(point, srsName, hasZ) {
let axisOrientation = 'enu';
if (opt_srsName) {
axisOrientation = getProjection(opt_srsName).getAxisOrientation();
if (srsName) {
axisOrientation = getProjection(srsName).getAxisOrientation();
}
let coords =
axisOrientation.substr(0, 2) === 'en'
? point[0] + ',' + point[1]
: point[1] + ',' + point[0];
if (opt_hasZ) {
if (hasZ) {
// For newly created points, Z can be undefined.
const z = point[2] || 0;
coords += ',' + z;
@@ -638,11 +635,11 @@ class GML2 extends GMLBase {
* @const
* @param {*} value Value.
* @param {Array<*>} objectStack Object stack.
* @param {string} [opt_nodeName] Node name.
* @param {string} [nodeName] Node name.
* @return {Node|undefined} Node.
* @private
*/
MULTIGEOMETRY_MEMBER_NODE_FACTORY_(value, objectStack, opt_nodeName) {
MULTIGEOMETRY_MEMBER_NODE_FACTORY_(value, objectStack, nodeName) {
const parentNode = objectStack[objectStack.length - 1].node;
return createElementNS(
'http://www.opengis.net/gml',
+26 -29
View File
@@ -61,12 +61,10 @@ const MULTIGEOMETRY_TO_MEMBER_NODENAME = {
*/
class GML3 extends GMLBase {
/**
* @param {import("./GMLBase.js").Options} [opt_options] Optional configuration object.
* @param {import("./GMLBase.js").Options} [options] Optional configuration object.
*/
constructor(opt_options) {
const options =
/** @type {import("./GMLBase.js").Options} */
(opt_options ? opt_options : {});
constructor(options) {
options = options ? options : {};
super(options);
@@ -480,21 +478,21 @@ class GML3 extends GMLBase {
/**
* @param {Array<number>} point Point geometry.
* @param {string} [opt_srsName] Optional srsName
* @param {boolean} [opt_hasZ] whether the geometry has a Z coordinate (is 3D) or not.
* @param {string} [srsName] Optional srsName
* @param {boolean} [hasZ] whether the geometry has a Z coordinate (is 3D) or not.
* @return {string} The coords string.
* @private
*/
getCoords_(point, opt_srsName, opt_hasZ) {
getCoords_(point, srsName, hasZ) {
let axisOrientation = 'enu';
if (opt_srsName) {
axisOrientation = getProjection(opt_srsName).getAxisOrientation();
if (srsName) {
axisOrientation = getProjection(srsName).getAxisOrientation();
}
let coords =
axisOrientation.substr(0, 2) === 'en'
? point[0] + ' ' + point[1]
: point[1] + ' ' + point[0];
if (opt_hasZ) {
if (hasZ) {
// For newly created points, Z can be undefined.
const z = point[2] || 0;
coords += ' ' + z;
@@ -587,11 +585,11 @@ class GML3 extends GMLBase {
/**
* @param {*} value Value.
* @param {Array<*>} objectStack Object stack.
* @param {string} [opt_nodeName] Node name.
* @param {string} [nodeName] Node name.
* @return {Node} Node.
* @private
*/
RING_NODE_FACTORY_(value, objectStack, opt_nodeName) {
RING_NODE_FACTORY_(value, objectStack, nodeName) {
const context = objectStack[objectStack.length - 1];
const parentNode = context.node;
const exteriorWritten = context['exteriorWritten'];
@@ -933,11 +931,11 @@ class GML3 extends GMLBase {
* @const
* @param {*} value Value.
* @param {Array<*>} objectStack Object stack.
* @param {string} [opt_nodeName] Node name.
* @param {string} [nodeName] Node name.
* @return {Node|undefined} Node.
* @private
*/
MULTIGEOMETRY_MEMBER_NODE_FACTORY_(value, objectStack, opt_nodeName) {
MULTIGEOMETRY_MEMBER_NODE_FACTORY_(value, objectStack, nodeName) {
const parentNode = objectStack[objectStack.length - 1].node;
return createElementNS(
this.namespace,
@@ -949,17 +947,16 @@ class GML3 extends GMLBase {
* @const
* @param {*} value Value.
* @param {Array<*>} objectStack Object stack.
* @param {string} [opt_nodeName] Node name.
* @param {string} [nodeName] Node name.
* @return {Element|undefined} Node.
* @private
*/
GEOMETRY_NODE_FACTORY_(value, objectStack, opt_nodeName) {
GEOMETRY_NODE_FACTORY_(value, objectStack, nodeName) {
const context = objectStack[objectStack.length - 1];
const multiSurface = context['multiSurface'];
const surface = context['surface'];
const curve = context['curve'];
const multiCurve = context['multiCurve'];
let nodeName;
if (!Array.isArray(value)) {
nodeName = /** @type {import("../geom/Geometry.js").default} */ (
value
@@ -983,12 +980,12 @@ class GML3 extends GMLBase {
* Encode a geometry in GML 3.1.1 Simple Features.
*
* @param {import("../geom/Geometry.js").default} geometry Geometry.
* @param {import("./Feature.js").WriteOptions} [opt_options] Options.
* @param {import("./Feature.js").WriteOptions} [options] Options.
* @return {Node} Node.
* @api
*/
writeGeometryNode(geometry, opt_options) {
opt_options = this.adaptOptions(opt_options);
writeGeometryNode(geometry, options) {
options = this.adaptOptions(options);
const geom = createElementNS(this.namespace, 'geom');
const context = {
node: geom,
@@ -999,8 +996,8 @@ class GML3 extends GMLBase {
multiSurface: this.multiSurface_,
multiCurve: this.multiCurve_,
};
if (opt_options) {
Object.assign(context, opt_options);
if (options) {
Object.assign(context, options);
}
this.writeGeometryElement(geom, geometry, [context]);
return geom;
@@ -1010,12 +1007,12 @@ class GML3 extends GMLBase {
* Encode an array of features in the GML 3.1.1 format as an XML node.
*
* @param {Array<import("../Feature.js").default>} features Features.
* @param {import("./Feature.js").WriteOptions} [opt_options] Options.
* @param {import("./Feature.js").WriteOptions} [options] Options.
* @return {Element} Node.
* @api
*/
writeFeaturesNode(features, opt_options) {
opt_options = this.adaptOptions(opt_options);
writeFeaturesNode(features, options) {
options = this.adaptOptions(options);
const node = createElementNS(this.namespace, 'featureMembers');
node.setAttributeNS(
XML_SCHEMA_INSTANCE_URI,
@@ -1032,8 +1029,8 @@ class GML3 extends GMLBase {
featureNS: this.featureNS,
featureType: this.featureType,
};
if (opt_options) {
Object.assign(context, opt_options);
if (options) {
Object.assign(context, options);
}
this.writeFeatureMembers_(node, features, [context]);
return node;
@@ -1197,7 +1194,7 @@ GMLBase.prototype.RING_PARSERS = {
*
* @function
* @param {Array<import("../Feature.js").default>} features Features.
* @param {import("./Feature.js").WriteOptions} [opt_options] Options.
* @param {import("./Feature.js").WriteOptions} [options] Options.
* @return {string} Result.
* @api
*/
+3 -5
View File
@@ -19,12 +19,10 @@ import {writeStringTextNode} from '../format/xsd.js';
*/
class GML32 extends GML3 {
/**
* @param {import("./GMLBase.js").Options} [opt_options] Optional configuration object.
* @param {import("./GMLBase.js").Options} [options] Optional configuration object.
*/
constructor(opt_options) {
const options = /** @type {import("./GMLBase.js").Options} */ (
opt_options ? opt_options : {}
);
constructor(options) {
options = options ? options : {};
super(options);
+14 -14
View File
@@ -61,7 +61,7 @@ const ONLY_WHITESPACE_RE = /^\s*$/;
* So for instance there might be a featureType item `topp:states` and then
* there will be a key named `topp` in the featureNS object with value
* `http://www.openplans.org/topp`.
* @property {string} srsName srsName to use when writing geometries.
* @property {string} [srsName] srsName to use when writing geometries.
* @property {boolean} [surface=false] Write gml:Surface instead of gml:Polygon
* elements. This also affects the elements in multi-part geometries.
* @property {boolean} [curve=false] Write gml:Curve instead of gml:LineString
@@ -88,12 +88,12 @@ const ONLY_WHITESPACE_RE = /^\s*$/;
*/
class GMLBase extends XMLFeature {
/**
* @param {Options} [opt_options] Optional configuration object.
* @param {Options} [options] Optional configuration object.
*/
constructor(opt_options) {
constructor(options) {
super();
const options = /** @type {Options} */ (opt_options ? opt_options : {});
options = options ? options : {};
/**
* @protected
@@ -109,7 +109,7 @@ class GMLBase extends XMLFeature {
/**
* @protected
* @type {string}
* @type {string|undefined}
*/
this.srsName = options.srsName;
@@ -542,31 +542,31 @@ class GMLBase extends XMLFeature {
/**
* @param {Element} node Node.
* @param {import("./Feature.js").ReadOptions} [opt_options] Options.
* @param {import("./Feature.js").ReadOptions} [options] Options.
* @protected
* @return {import("../geom/Geometry.js").default} Geometry.
*/
readGeometryFromNode(node, opt_options) {
readGeometryFromNode(node, options) {
const geometry = this.readGeometryElement(node, [
this.getReadOptions(node, opt_options ? opt_options : {}),
this.getReadOptions(node, options ? options : {}),
]);
return geometry ? geometry : null;
}
/**
* @param {Element} node Node.
* @param {import("./Feature.js").ReadOptions} [opt_options] Options.
* @param {import("./Feature.js").ReadOptions} [options] Options.
* @return {Array<import("../Feature.js").default>} Features.
*/
readFeaturesFromNode(node, opt_options) {
const options = {
readFeaturesFromNode(node, options) {
const internalOptions = {
featureType: this.featureType,
featureNS: this.featureNS,
};
if (opt_options) {
Object.assign(options, this.getReadOptions(node, opt_options));
if (internalOptions) {
Object.assign(internalOptions, this.getReadOptions(node, options));
}
const features = this.readFeaturesInternal(node, [options]);
const features = this.readFeaturesInternal(node, [internalOptions]);
return features || [];
}
+15 -17
View File
@@ -128,12 +128,12 @@ const GPX_SERIALIZERS = makeStructureNS(NAMESPACE_URIS, {
*/
class GPX extends XMLFeature {
/**
* @param {Options} [opt_options] Options.
* @param {Options} [options] Options.
*/
constructor(opt_options) {
constructor(options) {
super();
const options = opt_options ? opt_options : {};
options = options ? options : {};
/**
* @type {import("../proj/Projection.js").default}
@@ -167,10 +167,10 @@ class GPX extends XMLFeature {
/**
* @param {Element} node Node.
* @param {import("./Feature.js").ReadOptions} [opt_options] Options.
* @param {import("./Feature.js").ReadOptions} [options] Options.
* @return {import("../Feature.js").default} Feature.
*/
readFeatureFromNode(node, opt_options) {
readFeatureFromNode(node, options) {
if (!NAMESPACE_URIS.includes(node.namespaceURI)) {
return null;
}
@@ -178,9 +178,7 @@ class GPX extends XMLFeature {
if (!featureReader) {
return null;
}
const feature = featureReader(node, [
this.getReadOptions(node, opt_options),
]);
const feature = featureReader(node, [this.getReadOptions(node, options)]);
if (!feature) {
return null;
}
@@ -190,17 +188,17 @@ class GPX extends XMLFeature {
/**
* @param {Element} node Node.
* @param {import("./Feature.js").ReadOptions} [opt_options] Options.
* @param {import("./Feature.js").ReadOptions} [options] Options.
* @return {Array<import("../Feature.js").default>} Features.
*/
readFeaturesFromNode(node, opt_options) {
readFeaturesFromNode(node, options) {
if (!NAMESPACE_URIS.includes(node.namespaceURI)) {
return [];
}
if (node.localName == 'gpx') {
/** @type {Array<Feature>} */
const features = pushParseAndPop([], GPX_PARSERS, node, [
this.getReadOptions(node, opt_options),
this.getReadOptions(node, options),
]);
if (features) {
this.handleReadExtensions_(features);
@@ -218,12 +216,12 @@ class GPX extends XMLFeature {
* as tracks (`<trk>`).
*
* @param {Array<Feature>} features Features.
* @param {import("./Feature.js").WriteOptions} [opt_options] Options.
* @param {import("./Feature.js").WriteOptions} [options] Options.
* @return {Node} Node.
* @api
*/
writeFeaturesNode(features, opt_options) {
opt_options = this.adaptOptions(opt_options);
writeFeaturesNode(features, options) {
options = this.adaptOptions(options);
//FIXME Serialize metadata
const gpx = createElementNS('http://www.topografix.com/GPX/1/1', 'gpx');
const xmlnsUri = 'http://www.w3.org/2000/xmlns/';
@@ -242,7 +240,7 @@ class GPX extends XMLFeature {
GPX_SERIALIZERS,
GPX_NODE_FACTORY,
features,
[opt_options]
[options]
);
return gpx;
}
@@ -505,10 +503,10 @@ const GEOMETRY_TYPE_TO_NODENAME = {
/**
* @param {*} value Value.
* @param {Array<*>} objectStack Object stack.
* @param {string} [opt_nodeName] Node name.
* @param {string} [nodeName] Node name.
* @return {Node|undefined} Node.
*/
function GPX_NODE_FACTORY(value, objectStack, opt_nodeName) {
function GPX_NODE_FACTORY(value, objectStack, nodeName) {
const geometry = /** @type {Feature} */ (value).getGeometry();
if (geometry) {
const nodeName = GEOMETRY_TYPE_TO_NODENAME[geometry.getType()];
+60 -65
View File
@@ -50,10 +50,10 @@ import {transformGeometryWithOptions} from './Feature.js';
*/
class GeoJSON extends JSONFeature {
/**
* @param {Options} [opt_options] Options.
* @param {Options} [options] Options.
*/
constructor(opt_options) {
const options = opt_options ? opt_options : {};
constructor(options) {
options = options ? options : {};
super();
@@ -93,11 +93,11 @@ class GeoJSON extends JSONFeature {
/**
* @param {Object} object Object.
* @param {import("./Feature.js").ReadOptions} [opt_options] Read options.
* @param {import("./Feature.js").ReadOptions} [options] Read options.
* @protected
* @return {import("../Feature.js").default} Feature.
*/
readFeatureFromObject(object, opt_options) {
readFeatureFromObject(object, options) {
/**
* @type {GeoJSONFeature}
*/
@@ -112,7 +112,7 @@ class GeoJSON extends JSONFeature {
};
}
const geometry = readGeometry(geoJSONFeature['geometry'], opt_options);
const geometry = readGeometry(geoJSONFeature['geometry'], options);
const feature = new Feature();
if (this.geometryName_) {
feature.setGeometryName(this.geometryName_);
@@ -136,11 +136,11 @@ class GeoJSON extends JSONFeature {
/**
* @param {Object} object Object.
* @param {import("./Feature.js").ReadOptions} [opt_options] Read options.
* @param {import("./Feature.js").ReadOptions} [options] Read options.
* @protected
* @return {Array<Feature>} Features.
*/
readFeaturesFromObject(object, opt_options) {
readFeaturesFromObject(object, options) {
const geoJSONObject = /** @type {GeoJSONObject} */ (object);
/** @type {Array<import("../Feature.js").default>} */
let features = null;
@@ -151,24 +151,22 @@ class GeoJSON extends JSONFeature {
features = [];
const geoJSONFeatures = geoJSONFeatureCollection['features'];
for (let i = 0, ii = geoJSONFeatures.length; i < ii; ++i) {
features.push(
this.readFeatureFromObject(geoJSONFeatures[i], opt_options)
);
features.push(this.readFeatureFromObject(geoJSONFeatures[i], options));
}
} else {
features = [this.readFeatureFromObject(object, opt_options)];
features = [this.readFeatureFromObject(object, options)];
}
return features;
}
/**
* @param {GeoJSONGeometry} object Object.
* @param {import("./Feature.js").ReadOptions} [opt_options] Read options.
* @param {import("./Feature.js").ReadOptions} [options] Read options.
* @protected
* @return {import("../geom/Geometry.js").default} Geometry.
*/
readGeometryFromObject(object, opt_options) {
return readGeometry(object, opt_options);
readGeometryFromObject(object, options) {
return readGeometry(object, options);
}
/**
@@ -197,12 +195,12 @@ class GeoJSON extends JSONFeature {
* Encode a feature as a GeoJSON Feature object.
*
* @param {import("../Feature.js").default} feature Feature.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @return {GeoJSONFeature} Object.
* @api
*/
writeFeatureObject(feature, opt_options) {
opt_options = this.adaptOptions(opt_options);
writeFeatureObject(feature, options) {
options = this.adaptOptions(options);
/** @type {GeoJSONFeature} */
const object = {
@@ -223,7 +221,7 @@ class GeoJSON extends JSONFeature {
const properties = feature.getProperties();
const geometry = feature.getGeometry();
if (geometry) {
object.geometry = writeGeometry(geometry, opt_options);
object.geometry = writeGeometry(geometry, options);
delete properties[feature.getGeometryName()];
}
@@ -239,15 +237,15 @@ class GeoJSON extends JSONFeature {
* Encode an array of features as a GeoJSON object.
*
* @param {Array<import("../Feature.js").default>} features Features.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @return {GeoJSONFeatureCollection} GeoJSON Object.
* @api
*/
writeFeaturesObject(features, opt_options) {
opt_options = this.adaptOptions(opt_options);
writeFeaturesObject(features, options) {
options = this.adaptOptions(options);
const objects = [];
for (let i = 0, ii = features.length; i < ii; ++i) {
objects.push(this.writeFeatureObject(features[i], opt_options));
objects.push(this.writeFeatureObject(features[i], options));
}
return {
type: 'FeatureCollection',
@@ -259,21 +257,21 @@ class GeoJSON extends JSONFeature {
* Encode a geometry as a GeoJSON object.
*
* @param {import("../geom/Geometry.js").default} geometry Geometry.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @return {GeoJSONGeometry|GeoJSONGeometryCollection} Object.
* @api
*/
writeGeometryObject(geometry, opt_options) {
return writeGeometry(geometry, this.adaptOptions(opt_options));
writeGeometryObject(geometry, options) {
return writeGeometry(geometry, this.adaptOptions(options));
}
}
/**
* @param {GeoJSONGeometry|GeoJSONGeometryCollection} object Object.
* @param {import("./Feature.js").ReadOptions} [opt_options] Read options.
* @param {import("./Feature.js").ReadOptions} [options] Read options.
* @return {import("../geom/Geometry.js").default} Geometry.
*/
function readGeometry(object, opt_options) {
function readGeometry(object, options) {
if (!object) {
return null;
}
@@ -325,22 +323,22 @@ function readGeometry(object, opt_options) {
throw new Error('Unsupported GeoJSON type: ' + object['type']);
}
}
return transformGeometryWithOptions(geometry, false, opt_options);
return transformGeometryWithOptions(geometry, false, options);
}
/**
* @param {GeoJSONGeometryCollection} object Object.
* @param {import("./Feature.js").ReadOptions} [opt_options] Read options.
* @param {import("./Feature.js").ReadOptions} [options] Read options.
* @return {GeometryCollection} Geometry collection.
*/
function readGeometryCollectionGeometry(object, opt_options) {
function readGeometryCollectionGeometry(object, options) {
const geometries = object['geometries'].map(
/**
* @param {GeoJSONGeometry} geometry Geometry.
* @return {import("../geom/Geometry.js").default} geometry Geometry.
*/
function (geometry) {
return readGeometry(geometry, opt_options);
return readGeometry(geometry, options);
}
);
return new GeometryCollection(geometries);
@@ -396,62 +394,59 @@ function readPolygonGeometry(object) {
/**
* @param {import("../geom/Geometry.js").default} geometry Geometry.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @return {GeoJSONGeometry} GeoJSON geometry.
*/
function writeGeometry(geometry, opt_options) {
geometry = transformGeometryWithOptions(geometry, true, opt_options);
function writeGeometry(geometry, options) {
geometry = transformGeometryWithOptions(geometry, true, options);
const type = geometry.getType();
/** @type {GeoJSONGeometry} */
let geoJSON;
switch (type) {
case 'Point': {
geoJSON = writePointGeometry(
/** @type {Point} */ (geometry),
opt_options
);
geoJSON = writePointGeometry(/** @type {Point} */ (geometry), options);
break;
}
case 'LineString': {
geoJSON = writeLineStringGeometry(
/** @type {LineString} */ (geometry),
opt_options
options
);
break;
}
case 'Polygon': {
geoJSON = writePolygonGeometry(
/** @type {Polygon} */ (geometry),
opt_options
options
);
break;
}
case 'MultiPoint': {
geoJSON = writeMultiPointGeometry(
/** @type {MultiPoint} */ (geometry),
opt_options
options
);
break;
}
case 'MultiLineString': {
geoJSON = writeMultiLineStringGeometry(
/** @type {MultiLineString} */ (geometry),
opt_options
options
);
break;
}
case 'MultiPolygon': {
geoJSON = writeMultiPolygonGeometry(
/** @type {MultiPolygon} */ (geometry),
opt_options
options
);
break;
}
case 'GeometryCollection': {
geoJSON = writeGeometryCollectionGeometry(
/** @type {GeometryCollection} */ (geometry),
opt_options
options
);
break;
}
@@ -471,13 +466,13 @@ function writeGeometry(geometry, opt_options) {
/**
* @param {GeometryCollection} geometry Geometry.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @return {GeoJSONGeometryCollection} GeoJSON geometry collection.
*/
function writeGeometryCollectionGeometry(geometry, opt_options) {
function writeGeometryCollectionGeometry(geometry, options) {
options = Object.assign({}, options);
delete options.featureProjection;
const geometries = geometry.getGeometriesArray().map(function (geometry) {
const options = Object.assign({}, opt_options);
delete options.featureProjection;
return writeGeometry(geometry, options);
});
return {
@@ -488,10 +483,10 @@ function writeGeometryCollectionGeometry(geometry, opt_options) {
/**
* @param {LineString} geometry Geometry.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @return {GeoJSONGeometry} GeoJSON geometry.
*/
function writeLineStringGeometry(geometry, opt_options) {
function writeLineStringGeometry(geometry, options) {
return {
type: 'LineString',
coordinates: geometry.getCoordinates(),
@@ -500,10 +495,10 @@ function writeLineStringGeometry(geometry, opt_options) {
/**
* @param {MultiLineString} geometry Geometry.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @return {GeoJSONGeometry} GeoJSON geometry.
*/
function writeMultiLineStringGeometry(geometry, opt_options) {
function writeMultiLineStringGeometry(geometry, options) {
return {
type: 'MultiLineString',
coordinates: geometry.getCoordinates(),
@@ -512,10 +507,10 @@ function writeMultiLineStringGeometry(geometry, opt_options) {
/**
* @param {MultiPoint} geometry Geometry.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @return {GeoJSONGeometry} GeoJSON geometry.
*/
function writeMultiPointGeometry(geometry, opt_options) {
function writeMultiPointGeometry(geometry, options) {
return {
type: 'MultiPoint',
coordinates: geometry.getCoordinates(),
@@ -524,13 +519,13 @@ function writeMultiPointGeometry(geometry, opt_options) {
/**
* @param {MultiPolygon} geometry Geometry.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @return {GeoJSONGeometry} GeoJSON geometry.
*/
function writeMultiPolygonGeometry(geometry, opt_options) {
function writeMultiPolygonGeometry(geometry, options) {
let right;
if (opt_options) {
right = opt_options.rightHanded;
if (options) {
right = options.rightHanded;
}
return {
type: 'MultiPolygon',
@@ -540,10 +535,10 @@ function writeMultiPolygonGeometry(geometry, opt_options) {
/**
* @param {Point} geometry Geometry.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @return {GeoJSONGeometry} GeoJSON geometry.
*/
function writePointGeometry(geometry, opt_options) {
function writePointGeometry(geometry, options) {
return {
type: 'Point',
coordinates: geometry.getCoordinates(),
@@ -552,13 +547,13 @@ function writePointGeometry(geometry, opt_options) {
/**
* @param {Polygon} geometry Geometry.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @return {GeoJSONGeometry} GeoJSON geometry.
*/
function writePolygonGeometry(geometry, opt_options) {
function writePolygonGeometry(geometry, options) {
let right;
if (opt_options) {
right = opt_options.rightHanded;
if (options) {
right = options.rightHanded;
}
return {
type: 'Polygon',
+9 -9
View File
@@ -57,12 +57,12 @@ const NEWLINE_RE = /\r\n|\r|\n/;
*/
class IGC extends TextFeature {
/**
* @param {Options} [opt_options] Options.
* @param {Options} [options] Options.
*/
constructor(opt_options) {
constructor(options) {
super();
const options = opt_options ? opt_options : {};
options = options ? options : {};
/**
* @type {import("../proj/Projection.js").default}
@@ -79,10 +79,10 @@ class IGC extends TextFeature {
/**
* @protected
* @param {string} text Text.
* @param {import("./Feature.js").ReadOptions} [opt_options] Read options.
* @param {import("./Feature.js").ReadOptions} [options] Read options.
* @return {import("../Feature.js").default} Feature.
*/
readFeatureFromText(text, opt_options) {
readFeatureFromText(text, options) {
const altitudeMode = this.altitudeMode_;
const lines = text.split(NEWLINE_RE);
/** @type {Object<string, string>} */
@@ -150,7 +150,7 @@ class IGC extends TextFeature {
const layout = altitudeMode == 'none' ? 'XYM' : 'XYZM';
const lineString = new LineString(flatCoordinates, layout);
const feature = new Feature(
transformGeometryWithOptions(lineString, false, opt_options)
transformGeometryWithOptions(lineString, false, options)
);
feature.setProperties(properties, true);
return feature;
@@ -158,12 +158,12 @@ class IGC extends TextFeature {
/**
* @param {string} text Text.
* @param {import("./Feature.js").ReadOptions} [opt_options] Read options.
* @param {import("./Feature.js").ReadOptions} [options] Read options.
* @protected
* @return {Array<Feature>} Features.
*/
readFeaturesFromText(text, opt_options) {
const feature = this.readFeatureFromText(text, opt_options);
readFeaturesFromText(text, options) {
const feature = this.readFeatureFromText(text, options);
if (feature) {
return [feature];
} else {
+3 -3
View File
@@ -437,12 +437,12 @@ class IIIFInfo {
}
/**
* @param {PreferredOptions} [opt_preferredOptions] Optional options for preferred format and quality.
* @param {PreferredOptions} [preferredOptions] Optional options for preferred format and quality.
* @return {import("../source/IIIF.js").Options} IIIF tile source ready constructor options.
* @api
*/
getTileSourceOptions(opt_preferredOptions) {
const options = opt_preferredOptions || {},
getTileSourceOptions(preferredOptions) {
const options = preferredOptions || {},
version = this.getImageApiVersion();
if (version === undefined) {
return;
+30 -30
View File
@@ -29,14 +29,14 @@ class JSONFeature extends FeatureFormat {
* read a feature collection.
*
* @param {ArrayBuffer|Document|Element|Object|string} source Source.
* @param {import("./Feature.js").ReadOptions} [opt_options] Read options.
* @param {import("./Feature.js").ReadOptions} [options] Read options.
* @return {import("../Feature.js").default} Feature.
* @api
*/
readFeature(source, opt_options) {
readFeature(source, options) {
return this.readFeatureFromObject(
getObject(source),
this.getReadOptions(source, opt_options)
this.getReadOptions(source, options)
);
}
@@ -45,36 +45,36 @@ class JSONFeature extends FeatureFormat {
* collection.
*
* @param {ArrayBuffer|Document|Element|Object|string} source Source.
* @param {import("./Feature.js").ReadOptions} [opt_options] Read options.
* @param {import("./Feature.js").ReadOptions} [options] Read options.
* @return {Array<import("../Feature.js").default>} Features.
* @api
*/
readFeatures(source, opt_options) {
readFeatures(source, options) {
return this.readFeaturesFromObject(
getObject(source),
this.getReadOptions(source, opt_options)
this.getReadOptions(source, options)
);
}
/**
* @abstract
* @param {Object} object Object.
* @param {import("./Feature.js").ReadOptions} [opt_options] Read options.
* @param {import("./Feature.js").ReadOptions} [options] Read options.
* @protected
* @return {import("../Feature.js").default} Feature.
*/
readFeatureFromObject(object, opt_options) {
readFeatureFromObject(object, options) {
return abstract();
}
/**
* @abstract
* @param {Object} object Object.
* @param {import("./Feature.js").ReadOptions} [opt_options] Read options.
* @param {import("./Feature.js").ReadOptions} [options] Read options.
* @protected
* @return {Array<import("../Feature.js").default>} Features.
*/
readFeaturesFromObject(object, opt_options) {
readFeaturesFromObject(object, options) {
return abstract();
}
@@ -82,25 +82,25 @@ class JSONFeature extends FeatureFormat {
* Read a geometry.
*
* @param {ArrayBuffer|Document|Element|Object|string} source Source.
* @param {import("./Feature.js").ReadOptions} [opt_options] Read options.
* @param {import("./Feature.js").ReadOptions} [options] Read options.
* @return {import("../geom/Geometry.js").default} Geometry.
* @api
*/
readGeometry(source, opt_options) {
readGeometry(source, options) {
return this.readGeometryFromObject(
getObject(source),
this.getReadOptions(source, opt_options)
this.getReadOptions(source, options)
);
}
/**
* @abstract
* @param {Object} object Object.
* @param {import("./Feature.js").ReadOptions} [opt_options] Read options.
* @param {import("./Feature.js").ReadOptions} [options] Read options.
* @protected
* @return {import("../geom/Geometry.js").default} Geometry.
*/
readGeometryFromObject(object, opt_options) {
readGeometryFromObject(object, options) {
return abstract();
}
@@ -129,21 +129,21 @@ class JSONFeature extends FeatureFormat {
* Encode a feature as string.
*
* @param {import("../Feature.js").default} feature Feature.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @return {string} Encoded feature.
* @api
*/
writeFeature(feature, opt_options) {
return JSON.stringify(this.writeFeatureObject(feature, opt_options));
writeFeature(feature, options) {
return JSON.stringify(this.writeFeatureObject(feature, options));
}
/**
* @abstract
* @param {import("../Feature.js").default} feature Feature.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @return {Object} Object.
*/
writeFeatureObject(feature, opt_options) {
writeFeatureObject(feature, options) {
return abstract();
}
@@ -151,21 +151,21 @@ class JSONFeature extends FeatureFormat {
* Encode an array of features as string.
*
* @param {Array<import("../Feature.js").default>} features Features.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @return {string} Encoded features.
* @api
*/
writeFeatures(features, opt_options) {
return JSON.stringify(this.writeFeaturesObject(features, opt_options));
writeFeatures(features, options) {
return JSON.stringify(this.writeFeaturesObject(features, options));
}
/**
* @abstract
* @param {Array<import("../Feature.js").default>} features Features.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @return {Object} Object.
*/
writeFeaturesObject(features, opt_options) {
writeFeaturesObject(features, options) {
return abstract();
}
@@ -173,21 +173,21 @@ class JSONFeature extends FeatureFormat {
* Encode a geometry as string.
*
* @param {import("../geom/Geometry.js").default} geometry Geometry.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @return {string} Encoded geometry.
* @api
*/
writeGeometry(geometry, opt_options) {
return JSON.stringify(this.writeGeometryObject(geometry, opt_options));
writeGeometry(geometry, options) {
return JSON.stringify(this.writeGeometryObject(geometry, options));
}
/**
* @abstract
* @param {import("../geom/Geometry.js").default} geometry Geometry.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @return {Object} Object.
*/
writeGeometryObject(geometry, opt_options) {
writeGeometryObject(geometry, options) {
return abstract();
}
}
+22 -22
View File
@@ -423,12 +423,12 @@ function defaultIconUrlFunction(href) {
*/
class KML extends XMLFeature {
/**
* @param {Options} [opt_options] Options.
* @param {Options} [options] Options.
*/
constructor(opt_options) {
constructor(options) {
super();
const options = opt_options ? opt_options : {};
options = options ? options : {};
if (!DEFAULT_STYLE_ARRAY) {
createStyleDefaults();
@@ -624,15 +624,15 @@ class KML extends XMLFeature {
/**
* @param {Element} node Node.
* @param {import("./Feature.js").ReadOptions} [opt_options] Options.
* @param {import("./Feature.js").ReadOptions} [options] Options.
* @return {import("../Feature.js").default} Feature.
*/
readFeatureFromNode(node, opt_options) {
readFeatureFromNode(node, options) {
if (!NAMESPACE_URIS.includes(node.namespaceURI)) {
return null;
}
const feature = this.readPlacemark_(node, [
this.getReadOptions(node, opt_options),
this.getReadOptions(node, options),
]);
if (feature) {
return feature;
@@ -644,10 +644,10 @@ class KML extends XMLFeature {
/**
* @protected
* @param {Element} node Node.
* @param {import("./Feature.js").ReadOptions} [opt_options] Options.
* @param {import("./Feature.js").ReadOptions} [options] Options.
* @return {Array<import("../Feature.js").default>} Features.
*/
readFeaturesFromNode(node, opt_options) {
readFeaturesFromNode(node, options) {
if (!NAMESPACE_URIS.includes(node.namespaceURI)) {
return [];
}
@@ -655,7 +655,7 @@ class KML extends XMLFeature {
const localName = node.localName;
if (localName == 'Document' || localName == 'Folder') {
features = this.readDocumentOrFolder_(node, [
this.getReadOptions(node, opt_options),
this.getReadOptions(node, options),
]);
if (features) {
return features;
@@ -664,7 +664,7 @@ class KML extends XMLFeature {
}
} else if (localName == 'Placemark') {
const feature = this.readPlacemark_(node, [
this.getReadOptions(node, opt_options),
this.getReadOptions(node, options),
]);
if (feature) {
return [feature];
@@ -674,7 +674,7 @@ class KML extends XMLFeature {
} else if (localName == 'kml') {
features = [];
for (let n = node.firstElementChild; n; n = n.nextElementSibling) {
const fs = this.readFeaturesFromNode(n, opt_options);
const fs = this.readFeaturesFromNode(n, options);
if (fs) {
extend(features, fs);
}
@@ -886,12 +886,12 @@ class KML extends XMLFeature {
* MultiPoints, MultiLineStrings, and MultiPolygons are output as MultiGeometries.
*
* @param {Array<Feature>} features Features.
* @param {import("./Feature.js").WriteOptions} [opt_options] Options.
* @param {import("./Feature.js").WriteOptions} [options] Options.
* @return {Node} Node.
* @api
*/
writeFeaturesNode(features, opt_options) {
opt_options = this.adaptOptions(opt_options);
writeFeaturesNode(features, options) {
options = this.adaptOptions(options);
const kml = createElementNS(NAMESPACE_URIS[4], 'kml');
const xmlnsUri = 'http://www.w3.org/2000/xmlns/';
kml.setAttributeNS(xmlnsUri, 'xmlns:gx', GX_NAMESPACE_URIS[0]);
@@ -919,7 +919,7 @@ class KML extends XMLFeature {
KML_SERIALIZERS,
OBJECT_PROPERTY_NODE_FACTORY,
values,
[opt_options],
[options],
orderedKeys,
this
);
@@ -2444,10 +2444,10 @@ const DOCUMENT_SERIALIZERS = makeStructureNS(NAMESPACE_URIS, {
* @const
* @param {*} value Value.
* @param {Array<*>} objectStack Object stack.
* @param {string} [opt_nodeName] Node name.
* @param {string} [nodeName] Node name.
* @return {Node|undefined} Node.
*/
const DOCUMENT_NODE_FACTORY = function (value, objectStack, opt_nodeName) {
const DOCUMENT_NODE_FACTORY = function (value, objectStack, nodeName) {
const parentNode = objectStack[objectStack.length - 1].node;
return createElementNS(parentNode.namespaceURI, 'Placemark');
};
@@ -2533,11 +2533,11 @@ const ICON_SERIALIZERS = makeStructureNS(
* @const
* @param {*} value Value.
* @param {Array<*>} objectStack Object stack.
* @param {string} [opt_nodeName] Node name.
* @param {string} [nodeName] Node name.
* @return {Node|undefined} Node.
*/
const GX_NODE_FACTORY = function (value, objectStack, opt_nodeName) {
return createElementNS(GX_NAMESPACE_URIS[0], 'gx:' + opt_nodeName);
const GX_NODE_FACTORY = function (value, objectStack, nodeName) {
return createElementNS(GX_NAMESPACE_URIS[0], 'gx:' + nodeName);
};
/**
@@ -2780,10 +2780,10 @@ const GEOMETRY_TYPE_TO_NODENAME = {
* @const
* @param {*} value Value.
* @param {Array<*>} objectStack Object stack.
* @param {string} [opt_nodeName] Node name.
* @param {string} [nodeName] Node name.
* @return {Node|undefined} Node.
*/
const GEOMETRY_NODE_FACTORY = function (value, objectStack, opt_nodeName) {
const GEOMETRY_NODE_FACTORY = function (value, objectStack, nodeName) {
if (value) {
const parentNode = objectStack[objectStack.length - 1].node;
return createElementNS(
+7 -9
View File
@@ -34,17 +34,17 @@ import {inflateEnds} from '../geom/flat/orient.js';
* @classdesc
* Feature format for reading data in the Mapbox MVT format.
*
* @param {Options} [opt_options] Options.
* @param {Options} [options] Options.
* @api
*/
class MVT extends FeatureFormat {
/**
* @param {Options} [opt_options] Options.
* @param {Options} [options] Options.
*/
constructor(opt_options) {
constructor(options) {
super();
const options = opt_options ? opt_options : {};
options = options ? options : {};
/**
* @type {Projection}
@@ -245,15 +245,13 @@ class MVT extends FeatureFormat {
* Read all features.
*
* @param {ArrayBuffer} source Source.
* @param {import("./Feature.js").ReadOptions} [opt_options] Read options.
* @param {import("./Feature.js").ReadOptions} [options] Read options.
* @return {Array<import("../Feature.js").FeatureLike>} Features.
* @api
*/
readFeatures(source, opt_options) {
readFeatures(source, options) {
const layers = this.layers_;
const options = /** @type {import("./Feature.js").ReadOptions} */ (
this.adaptOptions(opt_options)
);
options = this.adaptOptions(options);
const dataProjection = get(options.dataProjection);
dataProjection.setWorldExtent(options.extent);
options.dataProjection = dataProjection;
+3 -3
View File
@@ -59,11 +59,11 @@ class OSMXML extends XMLFeature {
/**
* @protected
* @param {Element} node Node.
* @param {import("./Feature.js").ReadOptions} [opt_options] Options.
* @param {import("./Feature.js").ReadOptions} [options] Options.
* @return {Array<import("../Feature.js").default>} Features.
*/
readFeaturesFromNode(node, opt_options) {
const options = this.getReadOptions(node, opt_options);
readFeaturesFromNode(node, options) {
options = this.getReadOptions(node, options);
if (node.localName == 'osm') {
const state = pushParseAndPop(
{
+33 -37
View File
@@ -34,12 +34,12 @@ import {transformGeometryWithOptions} from './Feature.js';
*/
class Polyline extends TextFeature {
/**
* @param {Options} [opt_options] Optional configuration object.
* @param {Options} [options] Optional configuration object.
*/
constructor(opt_options) {
constructor(options) {
super();
const options = opt_options ? opt_options : {};
options = options ? options : {};
/**
* @type {import("../proj/Projection.js").default}
@@ -64,32 +64,32 @@ class Polyline extends TextFeature {
/**
* @protected
* @param {string} text Text.
* @param {import("./Feature.js").ReadOptions} [opt_options] Read options.
* @param {import("./Feature.js").ReadOptions} [options] Read options.
* @return {import("../Feature.js").default} Feature.
*/
readFeatureFromText(text, opt_options) {
const geometry = this.readGeometryFromText(text, opt_options);
readFeatureFromText(text, options) {
const geometry = this.readGeometryFromText(text, options);
return new Feature(geometry);
}
/**
* @param {string} text Text.
* @param {import("./Feature.js").ReadOptions} [opt_options] Read options.
* @param {import("./Feature.js").ReadOptions} [options] Read options.
* @protected
* @return {Array<Feature>} Features.
*/
readFeaturesFromText(text, opt_options) {
const feature = this.readFeatureFromText(text, opt_options);
readFeaturesFromText(text, options) {
const feature = this.readFeatureFromText(text, options);
return [feature];
}
/**
* @param {string} text Text.
* @param {import("./Feature.js").ReadOptions} [opt_options] Read options.
* @param {import("./Feature.js").ReadOptions} [options] Read options.
* @protected
* @return {import("../geom/Geometry.js").default} Geometry.
*/
readGeometryFromText(text, opt_options) {
readGeometryFromText(text, options) {
const stride = getStrideForLayout(this.geometryLayout_);
const flatCoordinates = decodeDeltas(text, stride, this.factor_);
flipXY(flatCoordinates, 0, flatCoordinates.length, stride, flatCoordinates);
@@ -104,20 +104,20 @@ class Polyline extends TextFeature {
return transformGeometryWithOptions(
lineString,
false,
this.adaptOptions(opt_options)
this.adaptOptions(options)
);
}
/**
* @param {import("../Feature.js").default<LineString>} feature Features.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @protected
* @return {string} Text.
*/
writeFeatureText(feature, opt_options) {
writeFeatureText(feature, options) {
const geometry = feature.getGeometry();
if (geometry) {
return this.writeGeometryText(geometry, opt_options);
return this.writeGeometryText(geometry, options);
} else {
assert(false, 40); // Expected `feature` to have a geometry
return '';
@@ -126,29 +126,25 @@ class Polyline extends TextFeature {
/**
* @param {Array<import("../Feature.js").default<LineString>>} features Features.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @protected
* @return {string} Text.
*/
writeFeaturesText(features, opt_options) {
return this.writeFeatureText(features[0], opt_options);
writeFeaturesText(features, options) {
return this.writeFeatureText(features[0], options);
}
/**
* @param {LineString} geometry Geometry.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @protected
* @return {string} Text.
*/
writeGeometryText(geometry, opt_options) {
writeGeometryText(geometry, options) {
geometry =
/** @type {LineString} */
(
transformGeometryWithOptions(
geometry,
true,
this.adaptOptions(opt_options)
)
transformGeometryWithOptions(geometry, true, this.adaptOptions(options))
);
const flatCoordinates = geometry.getFlatCoordinates();
const stride = geometry.getStride();
@@ -164,14 +160,14 @@ class Polyline extends TextFeature {
*
* @param {Array<number>} numbers A list of n-dimensional points.
* @param {number} stride The number of dimension of the points in the list.
* @param {number} [opt_factor] The factor by which the numbers will be
* @param {number} [factor] The factor by which the numbers will be
* multiplied. The remaining decimal places will get rounded away.
* Default is `1e5`.
* @return {string} The encoded string.
* @api
*/
export function encodeDeltas(numbers, stride, opt_factor) {
const factor = opt_factor ? opt_factor : 1e5;
export function encodeDeltas(numbers, stride, factor) {
factor = factor ? factor : 1e5;
let d;
const lastNumbers = new Array(stride);
@@ -198,13 +194,13 @@ export function encodeDeltas(numbers, stride, opt_factor) {
* @param {string} encoded An encoded string.
* @param {number} stride The number of dimension of the points in the
* encoded string.
* @param {number} [opt_factor] The factor by which the resulting numbers will
* @param {number} [factor] The factor by which the resulting numbers will
* be divided. Default is `1e5`.
* @return {Array<number>} A list of n-dimensional points.
* @api
*/
export function decodeDeltas(encoded, stride, opt_factor) {
const factor = opt_factor ? opt_factor : 1e5;
export function decodeDeltas(encoded, stride, factor) {
factor = factor ? factor : 1e5;
let d;
/** @type {Array<number>} */
@@ -232,14 +228,14 @@ export function decodeDeltas(encoded, stride, opt_factor) {
* Attention: This function will modify the passed array!
*
* @param {Array<number>} numbers A list of floating point numbers.
* @param {number} [opt_factor] The factor by which the numbers will be
* @param {number} [factor] The factor by which the numbers will be
* multiplied. The remaining decimal places will get rounded away.
* Default is `1e5`.
* @return {string} The encoded string.
* @api
*/
export function encodeFloats(numbers, opt_factor) {
const factor = opt_factor ? opt_factor : 1e5;
export function encodeFloats(numbers, factor) {
factor = factor ? factor : 1e5;
for (let i = 0, ii = numbers.length; i < ii; ++i) {
numbers[i] = Math.round(numbers[i] * factor);
}
@@ -251,13 +247,13 @@ export function encodeFloats(numbers, opt_factor) {
* Decode a list of floating point numbers from an encoded string
*
* @param {string} encoded An encoded string.
* @param {number} [opt_factor] The factor by which the result will be divided.
* @param {number} [factor] The factor by which the result will be divided.
* Default is `1e5`.
* @return {Array<number>} A list of floating point numbers.
* @api
*/
export function decodeFloats(encoded, opt_factor) {
const factor = opt_factor ? opt_factor : 1e5;
export function decodeFloats(encoded, factor) {
factor = factor ? factor : 1e5;
const numbers = decodeSignedIntegers(encoded);
for (let i = 0, ii = numbers.length; i < ii; ++i) {
numbers[i] /= factor;
+30 -30
View File
@@ -28,25 +28,25 @@ class TextFeature extends FeatureFormat {
* Read the feature from the source.
*
* @param {Document|Element|Object|string} source Source.
* @param {import("./Feature.js").ReadOptions} [opt_options] Read options.
* @param {import("./Feature.js").ReadOptions} [options] Read options.
* @return {import("../Feature.js").default} Feature.
* @api
*/
readFeature(source, opt_options) {
readFeature(source, options) {
return this.readFeatureFromText(
getText(source),
this.adaptOptions(opt_options)
this.adaptOptions(options)
);
}
/**
* @abstract
* @param {string} text Text.
* @param {import("./Feature.js").ReadOptions} [opt_options] Read options.
* @param {import("./Feature.js").ReadOptions} [options] Read options.
* @protected
* @return {import("../Feature.js").default} Feature.
*/
readFeatureFromText(text, opt_options) {
readFeatureFromText(text, options) {
return abstract();
}
@@ -54,25 +54,25 @@ class TextFeature extends FeatureFormat {
* Read the features from the source.
*
* @param {Document|Element|Object|string} source Source.
* @param {import("./Feature.js").ReadOptions} [opt_options] Read options.
* @param {import("./Feature.js").ReadOptions} [options] Read options.
* @return {Array<import("../Feature.js").default>} Features.
* @api
*/
readFeatures(source, opt_options) {
readFeatures(source, options) {
return this.readFeaturesFromText(
getText(source),
this.adaptOptions(opt_options)
this.adaptOptions(options)
);
}
/**
* @abstract
* @param {string} text Text.
* @param {import("./Feature.js").ReadOptions} [opt_options] Read options.
* @param {import("./Feature.js").ReadOptions} [options] Read options.
* @protected
* @return {Array<import("../Feature.js").default>} Features.
*/
readFeaturesFromText(text, opt_options) {
readFeaturesFromText(text, options) {
return abstract();
}
@@ -80,25 +80,25 @@ class TextFeature extends FeatureFormat {
* Read the geometry from the source.
*
* @param {Document|Element|Object|string} source Source.
* @param {import("./Feature.js").ReadOptions} [opt_options] Read options.
* @param {import("./Feature.js").ReadOptions} [options] Read options.
* @return {import("../geom/Geometry.js").default} Geometry.
* @api
*/
readGeometry(source, opt_options) {
readGeometry(source, options) {
return this.readGeometryFromText(
getText(source),
this.adaptOptions(opt_options)
this.adaptOptions(options)
);
}
/**
* @abstract
* @param {string} text Text.
* @param {import("./Feature.js").ReadOptions} [opt_options] Read options.
* @param {import("./Feature.js").ReadOptions} [options] Read options.
* @protected
* @return {import("../geom/Geometry.js").default} Geometry.
*/
readGeometryFromText(text, opt_options) {
readGeometryFromText(text, options) {
return abstract();
}
@@ -126,22 +126,22 @@ class TextFeature extends FeatureFormat {
* Encode a feature as a string.
*
* @param {import("../Feature.js").default} feature Feature.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @return {string} Encoded feature.
* @api
*/
writeFeature(feature, opt_options) {
return this.writeFeatureText(feature, this.adaptOptions(opt_options));
writeFeature(feature, options) {
return this.writeFeatureText(feature, this.adaptOptions(options));
}
/**
* @abstract
* @param {import("../Feature.js").default} feature Features.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @protected
* @return {string} Text.
*/
writeFeatureText(feature, opt_options) {
writeFeatureText(feature, options) {
return abstract();
}
@@ -149,22 +149,22 @@ class TextFeature extends FeatureFormat {
* Encode an array of features as string.
*
* @param {Array<import("../Feature.js").default>} features Features.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @return {string} Encoded features.
* @api
*/
writeFeatures(features, opt_options) {
return this.writeFeaturesText(features, this.adaptOptions(opt_options));
writeFeatures(features, options) {
return this.writeFeaturesText(features, this.adaptOptions(options));
}
/**
* @abstract
* @param {Array<import("../Feature.js").default>} features Features.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @protected
* @return {string} Text.
*/
writeFeaturesText(features, opt_options) {
writeFeaturesText(features, options) {
return abstract();
}
@@ -172,22 +172,22 @@ class TextFeature extends FeatureFormat {
* Write a single geometry.
*
* @param {import("../geom/Geometry.js").default} geometry Geometry.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @return {string} Geometry.
* @api
*/
writeGeometry(geometry, opt_options) {
return this.writeGeometryText(geometry, this.adaptOptions(opt_options));
writeGeometry(geometry, options) {
return this.writeGeometryText(geometry, this.adaptOptions(options));
}
/**
* @abstract
* @param {import("../geom/Geometry.js").default} geometry Geometry.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @protected
* @return {string} Text.
*/
writeGeometryText(geometry, opt_options) {
writeGeometryText(geometry, options) {
return abstract();
}
}
+13 -13
View File
@@ -56,12 +56,12 @@ import {transformGeometryWithOptions} from './Feature.js';
*/
class TopoJSON extends JSONFeature {
/**
* @param {Options} [opt_options] Options.
* @param {Options} [options] Options.
*/
constructor(opt_options) {
constructor(options) {
super();
const options = opt_options ? opt_options : {};
options = options ? options : {};
/**
* @private
@@ -85,11 +85,11 @@ class TopoJSON extends JSONFeature {
/**
* @param {Object} object Object.
* @param {import("./Feature.js").ReadOptions} [opt_options] Read options.
* @param {import("./Feature.js").ReadOptions} [options] Read options.
* @protected
* @return {Array<Feature>} Features.
*/
readFeaturesFromObject(object, opt_options) {
readFeaturesFromObject(object, options) {
if (object.type == 'Topology') {
const topoJSONTopology = /** @type {TopoJSONTopology} */ (object);
let transform,
@@ -126,7 +126,7 @@ class TopoJSON extends JSONFeature {
translate,
property,
objectName,
opt_options
options
)
);
} else {
@@ -141,7 +141,7 @@ class TopoJSON extends JSONFeature {
translate,
property,
objectName,
opt_options
options
)
);
}
@@ -319,7 +319,7 @@ function readMultiPolygonGeometry(object, arcs) {
* @param {string|undefined} property Property to set the `GeometryCollection`'s parent
* object to.
* @param {string} name Name of the `Topology`'s child object.
* @param {import("./Feature.js").ReadOptions} [opt_options] Read options.
* @param {import("./Feature.js").ReadOptions} [options] Read options.
* @return {Array<Feature>} Array of features.
*/
function readFeaturesFromGeometryCollection(
@@ -329,7 +329,7 @@ function readFeaturesFromGeometryCollection(
translate,
property,
name,
opt_options
options
) {
const geometries = collection['geometries'];
const features = [];
@@ -341,7 +341,7 @@ function readFeaturesFromGeometryCollection(
translate,
property,
name,
opt_options
options
);
}
return features;
@@ -357,7 +357,7 @@ function readFeaturesFromGeometryCollection(
* @param {string|undefined} property Property to set the `GeometryCollection`'s parent
* object to.
* @param {string} name Name of the `Topology`'s child object.
* @param {import("./Feature.js").ReadOptions} [opt_options] Read options.
* @param {import("./Feature.js").ReadOptions} [options] Read options.
* @return {Feature} Feature.
*/
function readFeatureFromGeometry(
@@ -367,7 +367,7 @@ function readFeatureFromGeometry(
translate,
property,
name,
opt_options
options
) {
let geometry = null;
const type = object.type;
@@ -378,7 +378,7 @@ function readFeatureFromGeometry(
} else {
geometry = geometryReader(object, arcs);
}
geometry = transformGeometryWithOptions(geometry, false, opt_options);
geometry = transformGeometryWithOptions(geometry, false, options);
}
const feature = new Feature({geometry: geometry});
if (object.id !== undefined) {
+15 -18
View File
@@ -265,12 +265,12 @@ const DEFAULT_VERSION = '1.1.0';
*/
class WFS extends XMLFeature {
/**
* @param {Options} [opt_options] Optional configuration object.
* @param {Options} [options] Optional configuration object.
*/
constructor(opt_options) {
constructor(options) {
super();
const options = opt_options ? opt_options : {};
options = options ? options : {};
/**
* @private
@@ -324,10 +324,10 @@ class WFS extends XMLFeature {
/**
* @protected
* @param {Element} node Node.
* @param {import("./Feature.js").ReadOptions} [opt_options] Options.
* @param {import("./Feature.js").ReadOptions} [options] Options.
* @return {Array<import("../Feature.js").default>} Features.
*/
readFeaturesFromNode(node, opt_options) {
readFeaturesFromNode(node, options) {
/** @type {import("../xml.js").NodeStackItem} */
const context = {
node,
@@ -337,10 +337,7 @@ class WFS extends XMLFeature {
'featureNS': this.featureNS_,
});
Object.assign(
context,
this.getReadOptions(node, opt_options ? opt_options : {})
);
Object.assign(context, this.getReadOptions(node, options ? options : {}));
const objectStack = [context];
let featuresNS;
if (this.version_ === '2.0.0') {
@@ -565,16 +562,16 @@ class WFS extends XMLFeature {
*
* @param {!string} geometryName Geometry name to use.
* @param {!import("../extent.js").Extent} extent Extent.
* @param {string} [opt_srsName] SRS name. No srsName attribute will be
* @param {string} [srsName] SRS name. No srsName attribute will be
* set on geometries when this is not provided.
* @param {import("./filter/Filter.js").default} [opt_filter] Filter condition.
* @param {import("./filter/Filter.js").default} [filter] Filter condition.
* @return {import("./filter/Filter.js").default} The filter.
*/
combineBboxAndFilter(geometryName, extent, opt_srsName, opt_filter) {
const bboxFilter = bboxFilterFn(geometryName, extent, opt_srsName);
if (opt_filter) {
combineBboxAndFilter(geometryName, extent, srsName, filter) {
const bboxFilter = bboxFilterFn(geometryName, extent, srsName);
if (filter) {
// if bbox and filter are both set, combine the two into a single filter
return andFilterFn(opt_filter, bboxFilter);
return andFilterFn(filter, bboxFilter);
}
return bboxFilter;
}
@@ -1324,12 +1321,12 @@ function writeTimeInstant(node, time) {
* Encode filter as WFS `Filter` and return the Node.
*
* @param {import("./filter/Filter.js").default} filter Filter.
* @param {string} opt_version WFS version. If not provided defaults to '1.1.0'
* @param {string} version WFS version. If not provided defaults to '1.1.0'
* @return {Node} Result.
* @api
*/
export function writeFilter(filter, opt_version) {
const version = opt_version || '1.1.0';
export function writeFilter(filter, version) {
version = version || '1.1.0';
const child = createElementNS(getFilterNS(version), 'Filter');
const context = {
node: child,
+21 -21
View File
@@ -700,12 +700,12 @@ class WkbWriter {
*/
class WKB extends FeatureFormat {
/**
* @param {Options} [opt_options] Optional configuration object.
* @param {Options} [options] Optional configuration object.
*/
constructor(opt_options) {
constructor(options) {
super();
const options = opt_options ? opt_options : {};
options = options ? options : {};
this.splitCollection = Boolean(options.splitCollection);
@@ -733,13 +733,13 @@ class WKB extends FeatureFormat {
* Read a single feature from a source.
*
* @param {string|ArrayBuffer|ArrayBufferView} source Source.
* @param {import("./Feature.js").ReadOptions} [opt_options] Read options.
* @param {import("./Feature.js").ReadOptions} [options] Read options.
* @return {import("../Feature.js").default} Feature.
* @api
*/
readFeature(source, opt_options) {
readFeature(source, options) {
return new Feature({
geometry: this.readGeometry(source, opt_options),
geometry: this.readGeometry(source, options),
});
}
@@ -747,13 +747,13 @@ class WKB extends FeatureFormat {
* Read all features from a source.
*
* @param {string|ArrayBuffer|ArrayBufferView} source Source.
* @param {import("./Feature.js").ReadOptions} [opt_options] Read options.
* @param {import("./Feature.js").ReadOptions} [options] Read options.
* @return {Array<import("../Feature.js").default>} Features.
* @api
*/
readFeatures(source, opt_options) {
readFeatures(source, options) {
let geometries = [];
const geometry = this.readGeometry(source, opt_options);
const geometry = this.readGeometry(source, options);
if (this.splitCollection && geometry instanceof GeometryCollection) {
geometries = geometry.getGeometriesArray();
} else {
@@ -766,11 +766,11 @@ class WKB extends FeatureFormat {
* Read a single geometry from a source.
*
* @param {string|ArrayBuffer|ArrayBufferView} source Source.
* @param {import("./Feature.js").ReadOptions} [opt_options] Read options.
* @param {import("./Feature.js").ReadOptions} [options] Read options.
* @return {import("../geom/Geometry.js").default} Geometry.
* @api
*/
readGeometry(source, opt_options) {
readGeometry(source, options) {
const view = getDataView(source);
if (!view) {
return null;
@@ -780,7 +780,7 @@ class WKB extends FeatureFormat {
const geometry = reader.readGeometry();
this.viewCache_ = view; // cache for internal subsequent call of readProjection()
const options = this.getReadOptions(source, opt_options);
options = this.getReadOptions(source, options);
this.viewCache_ = null; // release
return transformGeometryWithOptions(geometry, false, options);
@@ -812,26 +812,26 @@ class WKB extends FeatureFormat {
* Encode a feature in this format.
*
* @param {import("../Feature.js").default} feature Feature.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @return {string|ArrayBuffer} Result.
* @api
*/
writeFeature(feature, opt_options) {
return this.writeGeometry(feature.getGeometry(), opt_options);
writeFeature(feature, options) {
return this.writeGeometry(feature.getGeometry(), options);
}
/**
* Encode an array of features in this format.
*
* @param {Array<import("../Feature.js").default>} features Features.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @return {string|ArrayBuffer} Result.
* @api
*/
writeFeatures(features, opt_options) {
writeFeatures(features, options) {
return this.writeGeometry(
new GeometryCollection(features.map((f) => f.getGeometry())),
opt_options
options
);
}
@@ -839,12 +839,12 @@ class WKB extends FeatureFormat {
* Write a single geometry in this format.
*
* @param {import("../geom/Geometry.js").default} geometry Geometry.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @return {string|ArrayBuffer} Result.
* @api
*/
writeGeometry(geometry, opt_options) {
const options = this.adaptOptions(opt_options);
writeGeometry(geometry, options) {
options = this.adaptOptions(options);
const writer = new WkbWriter({
layout: this.layout_,
+25 -25
View File
@@ -121,13 +121,13 @@ class Lexer {
/**
* @param {string} c Character.
* @param {boolean} [opt_decimal] Whether the string number
* @param {boolean} [decimal] Whether the string number
* contains a dot, i.e. is a decimal number.
* @return {boolean} Whether the character is numeric.
* @private
*/
isNumeric_(c, opt_decimal) {
const decimal = opt_decimal !== undefined ? opt_decimal : false;
isNumeric_(c, decimal) {
decimal = decimal !== undefined ? decimal : false;
return (c >= '0' && c <= '9') || (c == '.' && !decimal);
}
@@ -601,12 +601,12 @@ class Parser {
*/
class WKT extends TextFeature {
/**
* @param {Options} [opt_options] Options.
* @param {Options} [options] Options.
*/
constructor(opt_options) {
constructor(options) {
super();
const options = opt_options ? opt_options : {};
options = options ? options : {};
/**
* Split GeometryCollection into multiple features.
@@ -633,11 +633,11 @@ class WKT extends TextFeature {
/**
* @protected
* @param {string} text Text.
* @param {import("./Feature.js").ReadOptions} [opt_options] Read options.
* @param {import("./Feature.js").ReadOptions} [options] Read options.
* @return {import("../Feature.js").default} Feature.
*/
readFeatureFromText(text, opt_options) {
const geom = this.readGeometryFromText(text, opt_options);
readFeatureFromText(text, options) {
const geom = this.readGeometryFromText(text, options);
const feature = new Feature();
feature.setGeometry(geom);
return feature;
@@ -645,13 +645,13 @@ class WKT extends TextFeature {
/**
* @param {string} text Text.
* @param {import("./Feature.js").ReadOptions} [opt_options] Read options.
* @param {import("./Feature.js").ReadOptions} [options] Read options.
* @protected
* @return {Array<Feature>} Features.
*/
readFeaturesFromText(text, opt_options) {
readFeaturesFromText(text, options) {
let geometries = [];
const geometry = this.readGeometryFromText(text, opt_options);
const geometry = this.readGeometryFromText(text, options);
if (this.splitCollection_ && geometry.getType() == 'GeometryCollection') {
geometries = /** @type {GeometryCollection} */ (
geometry
@@ -670,55 +670,55 @@ class WKT extends TextFeature {
/**
* @param {string} text Text.
* @param {import("./Feature.js").ReadOptions} [opt_options] Read options.
* @param {import("./Feature.js").ReadOptions} [options] Read options.
* @protected
* @return {import("../geom/Geometry.js").default} Geometry.
*/
readGeometryFromText(text, opt_options) {
readGeometryFromText(text, options) {
const geometry = this.parse_(text);
return transformGeometryWithOptions(geometry, false, opt_options);
return transformGeometryWithOptions(geometry, false, options);
}
/**
* @param {import("../Feature.js").default} feature Features.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @protected
* @return {string} Text.
*/
writeFeatureText(feature, opt_options) {
writeFeatureText(feature, options) {
const geometry = feature.getGeometry();
if (geometry) {
return this.writeGeometryText(geometry, opt_options);
return this.writeGeometryText(geometry, options);
}
return '';
}
/**
* @param {Array<import("../Feature.js").default>} features Features.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @protected
* @return {string} Text.
*/
writeFeaturesText(features, opt_options) {
writeFeaturesText(features, options) {
if (features.length == 1) {
return this.writeFeatureText(features[0], opt_options);
return this.writeFeatureText(features[0], options);
}
const geometries = [];
for (let i = 0, ii = features.length; i < ii; ++i) {
geometries.push(features[i].getGeometry());
}
const collection = new GeometryCollection(geometries);
return this.writeGeometryText(collection, opt_options);
return this.writeGeometryText(collection, options);
}
/**
* @param {import("../geom/Geometry.js").default} geometry Geometry.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @protected
* @return {string} Text.
*/
writeGeometryText(geometry, opt_options) {
return encode(transformGeometryWithOptions(geometry, true, opt_options));
writeGeometryText(geometry, options) {
return encode(transformGeometryWithOptions(geometry, true, options));
}
}
+9 -9
View File
@@ -32,12 +32,12 @@ const layerIdentifier = '_layer';
*/
class WMSGetFeatureInfo extends XMLFeature {
/**
* @param {Options} [opt_options] Options.
* @param {Options} [options] Options.
*/
constructor(opt_options) {
constructor(options) {
super();
const options = opt_options ? opt_options : {};
options = options ? options : {};
/**
* @private
@@ -150,15 +150,15 @@ class WMSGetFeatureInfo extends XMLFeature {
/**
* @protected
* @param {Element} node Node.
* @param {import("./Feature.js").ReadOptions} [opt_options] Options.
* @param {import("./Feature.js").ReadOptions} [options] Options.
* @return {Array<import("../Feature.js").default>} Features.
*/
readFeaturesFromNode(node, opt_options) {
const options = {};
if (opt_options) {
Object.assign(options, this.getReadOptions(node, opt_options));
readFeaturesFromNode(node, options) {
const internalOptions = {};
if (options) {
Object.assign(internalOptions, this.getReadOptions(node, options));
}
return this.readFeatures_(node, [options]);
return this.readFeatures_(node, [internalOptions]);
}
}
+44 -47
View File
@@ -36,36 +36,33 @@ class XMLFeature extends FeatureFormat {
* Read a single feature.
*
* @param {Document|Element|Object|string} source Source.
* @param {import("./Feature.js").ReadOptions} [opt_options] Read options.
* @param {import("./Feature.js").ReadOptions} [options] Read options.
* @return {import("../Feature.js").default} Feature.
* @api
*/
readFeature(source, opt_options) {
readFeature(source, options) {
if (!source) {
return null;
} else if (typeof source === 'string') {
const doc = parse(source);
return this.readFeatureFromDocument(doc, opt_options);
return this.readFeatureFromDocument(doc, options);
} else if (isDocument(source)) {
return this.readFeatureFromDocument(
/** @type {Document} */ (source),
opt_options
options
);
} else {
return this.readFeatureFromNode(
/** @type {Element} */ (source),
opt_options
);
return this.readFeatureFromNode(/** @type {Element} */ (source), options);
}
}
/**
* @param {Document} doc Document.
* @param {import("./Feature.js").ReadOptions} [opt_options] Options.
* @param {import("./Feature.js").ReadOptions} [options] Options.
* @return {import("../Feature.js").default} Feature.
*/
readFeatureFromDocument(doc, opt_options) {
const features = this.readFeaturesFromDocument(doc, opt_options);
readFeatureFromDocument(doc, options) {
const features = this.readFeaturesFromDocument(doc, options);
if (features.length > 0) {
return features[0];
} else {
@@ -75,10 +72,10 @@ class XMLFeature extends FeatureFormat {
/**
* @param {Element} node Node.
* @param {import("./Feature.js").ReadOptions} [opt_options] Options.
* @param {import("./Feature.js").ReadOptions} [options] Options.
* @return {import("../Feature.js").default} Feature.
*/
readFeatureFromNode(node, opt_options) {
readFeatureFromNode(node, options) {
return null; // not implemented
}
@@ -86,43 +83,43 @@ class XMLFeature extends FeatureFormat {
* Read all features from a feature collection.
*
* @param {Document|Element|Object|string} source Source.
* @param {import("./Feature.js").ReadOptions} [opt_options] Options.
* @param {import("./Feature.js").ReadOptions} [options] Options.
* @return {Array<import("../Feature.js").default>} Features.
* @api
*/
readFeatures(source, opt_options) {
readFeatures(source, options) {
if (!source) {
return [];
} else if (typeof source === 'string') {
const doc = parse(source);
return this.readFeaturesFromDocument(doc, opt_options);
return this.readFeaturesFromDocument(doc, options);
} else if (isDocument(source)) {
return this.readFeaturesFromDocument(
/** @type {Document} */ (source),
opt_options
options
);
} else {
return this.readFeaturesFromNode(
/** @type {Element} */ (source),
opt_options
options
);
}
}
/**
* @param {Document} doc Document.
* @param {import("./Feature.js").ReadOptions} [opt_options] Options.
* @param {import("./Feature.js").ReadOptions} [options] Options.
* @protected
* @return {Array<import("../Feature.js").default>} Features.
*/
readFeaturesFromDocument(doc, opt_options) {
readFeaturesFromDocument(doc, options) {
/** @type {Array<import("../Feature.js").default>} */
const features = [];
for (let n = doc.firstChild; n; n = n.nextSibling) {
if (n.nodeType == Node.ELEMENT_NODE) {
extend(
features,
this.readFeaturesFromNode(/** @type {Element} */ (n), opt_options)
this.readFeaturesFromNode(/** @type {Element} */ (n), options)
);
}
}
@@ -132,11 +129,11 @@ class XMLFeature extends FeatureFormat {
/**
* @abstract
* @param {Element} node Node.
* @param {import("./Feature.js").ReadOptions} [opt_options] Options.
* @param {import("./Feature.js").ReadOptions} [options] Options.
* @protected
* @return {Array<import("../Feature.js").default>} Features.
*/
readFeaturesFromNode(node, opt_options) {
readFeaturesFromNode(node, options) {
return abstract();
}
@@ -144,45 +141,45 @@ class XMLFeature extends FeatureFormat {
* Read a single geometry from a source.
*
* @param {Document|Element|Object|string} source Source.
* @param {import("./Feature.js").ReadOptions} [opt_options] Read options.
* @param {import("./Feature.js").ReadOptions} [options] Read options.
* @return {import("../geom/Geometry.js").default} Geometry.
*/
readGeometry(source, opt_options) {
readGeometry(source, options) {
if (!source) {
return null;
} else if (typeof source === 'string') {
const doc = parse(source);
return this.readGeometryFromDocument(doc, opt_options);
return this.readGeometryFromDocument(doc, options);
} else if (isDocument(source)) {
return this.readGeometryFromDocument(
/** @type {Document} */ (source),
opt_options
options
);
} else {
return this.readGeometryFromNode(
/** @type {Element} */ (source),
opt_options
options
);
}
}
/**
* @param {Document} doc Document.
* @param {import("./Feature.js").ReadOptions} [opt_options] Options.
* @param {import("./Feature.js").ReadOptions} [options] Options.
* @protected
* @return {import("../geom/Geometry.js").default} Geometry.
*/
readGeometryFromDocument(doc, opt_options) {
readGeometryFromDocument(doc, options) {
return null; // not implemented
}
/**
* @param {Element} node Node.
* @param {import("./Feature.js").ReadOptions} [opt_options] Options.
* @param {import("./Feature.js").ReadOptions} [options] Options.
* @protected
* @return {import("../geom/Geometry.js").default} Geometry.
*/
readGeometryFromNode(node, opt_options) {
readGeometryFromNode(node, options) {
return null; // not implemented
}
@@ -228,21 +225,21 @@ class XMLFeature extends FeatureFormat {
* Encode a feature as string.
*
* @param {import("../Feature.js").default} feature Feature.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @return {string} Encoded feature.
*/
writeFeature(feature, opt_options) {
const node = this.writeFeatureNode(feature, opt_options);
writeFeature(feature, options) {
const node = this.writeFeatureNode(feature, options);
return this.xmlSerializer_.serializeToString(node);
}
/**
* @param {import("../Feature.js").default} feature Feature.
* @param {import("./Feature.js").WriteOptions} [opt_options] Options.
* @param {import("./Feature.js").WriteOptions} [options] Options.
* @protected
* @return {Node} Node.
*/
writeFeatureNode(feature, opt_options) {
writeFeatureNode(feature, options) {
return null; // not implemented
}
@@ -250,21 +247,21 @@ class XMLFeature extends FeatureFormat {
* Encode an array of features as string.
*
* @param {Array<import("../Feature.js").default>} features Features.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @return {string} Result.
* @api
*/
writeFeatures(features, opt_options) {
const node = this.writeFeaturesNode(features, opt_options);
writeFeatures(features, options) {
const node = this.writeFeaturesNode(features, options);
return this.xmlSerializer_.serializeToString(node);
}
/**
* @param {Array<import("../Feature.js").default>} features Features.
* @param {import("./Feature.js").WriteOptions} [opt_options] Options.
* @param {import("./Feature.js").WriteOptions} [options] Options.
* @return {Node} Node.
*/
writeFeaturesNode(features, opt_options) {
writeFeaturesNode(features, options) {
return null; // not implemented
}
@@ -272,20 +269,20 @@ class XMLFeature extends FeatureFormat {
* Encode a geometry as string.
*
* @param {import("../geom/Geometry.js").default} geometry Geometry.
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
* @param {import("./Feature.js").WriteOptions} [options] Write options.
* @return {string} Encoded geometry.
*/
writeGeometry(geometry, opt_options) {
const node = this.writeGeometryNode(geometry, opt_options);
writeGeometry(geometry, options) {
const node = this.writeGeometryNode(geometry, options);
return this.xmlSerializer_.serializeToString(node);
}
/**
* @param {import("../geom/Geometry.js").default} geometry Geometry.
* @param {import("./Feature.js").WriteOptions} [opt_options] Options.
* @param {import("./Feature.js").WriteOptions} [options] Options.
* @return {Node} Node.
*/
writeGeometryNode(geometry, opt_options) {
writeGeometryNode(geometry, options) {
return null; // not implemented
}
}
+36 -36
View File
@@ -63,13 +63,13 @@ export function not(condition) {
*
* @param {!string} geometryName Geometry name to use.
* @param {!import("../extent.js").Extent} extent Extent.
* @param {string} [opt_srsName] SRS name. No srsName attribute will be
* @param {string} [srsName] SRS name. No srsName attribute will be
* set on geometries when this is not provided.
* @return {!Bbox} `<BBOX>` operator.
* @api
*/
export function bbox(geometryName, extent, opt_srsName) {
return new Bbox(geometryName, extent, opt_srsName);
export function bbox(geometryName, extent, srsName) {
return new Bbox(geometryName, extent, srsName);
}
/**
@@ -78,13 +78,13 @@ export function bbox(geometryName, extent, opt_srsName) {
*
* @param {!string} geometryName Geometry name to use.
* @param {!import("../geom/Geometry.js").default} geometry Geometry.
* @param {string} [opt_srsName] SRS name. No srsName attribute will be
* @param {string} [srsName] SRS name. No srsName attribute will be
* set on geometries when this is not provided.
* @return {!Contains} `<Contains>` operator.
* @api
*/
export function contains(geometryName, geometry, opt_srsName) {
return new Contains(geometryName, geometry, opt_srsName);
export function contains(geometryName, geometry, srsName) {
return new Contains(geometryName, geometry, srsName);
}
/**
@@ -93,13 +93,13 @@ export function contains(geometryName, geometry, opt_srsName) {
*
* @param {!string} geometryName Geometry name to use.
* @param {!import("../geom/Geometry.js").default} geometry Geometry.
* @param {string} [opt_srsName] SRS name. No srsName attribute will be
* @param {string} [srsName] SRS name. No srsName attribute will be
* set on geometries when this is not provided.
* @return {!Intersects} `<Intersects>` operator.
* @api
*/
export function intersects(geometryName, geometry, opt_srsName) {
return new Intersects(geometryName, geometry, opt_srsName);
export function intersects(geometryName, geometry, srsName) {
return new Intersects(geometryName, geometry, srsName);
}
/**
@@ -108,13 +108,13 @@ export function intersects(geometryName, geometry, opt_srsName) {
*
* @param {!string} geometryName Geometry name to use.
* @param {!import("../geom/Geometry.js").default} geometry Geometry.
* @param {string} [opt_srsName] SRS name. No srsName attribute will be
* @param {string} [srsName] SRS name. No srsName attribute will be
* set on geometries when this is not provided.
* @return {!Disjoint} `<Disjoint>` operator.
* @api
*/
export function disjoint(geometryName, geometry, opt_srsName) {
return new Disjoint(geometryName, geometry, opt_srsName);
export function disjoint(geometryName, geometry, srsName) {
return new Disjoint(geometryName, geometry, srsName);
}
/**
@@ -123,13 +123,13 @@ export function disjoint(geometryName, geometry, opt_srsName) {
*
* @param {!string} geometryName Geometry name to use.
* @param {!import("../geom/Geometry.js").default} geometry Geometry.
* @param {string} [opt_srsName] SRS name. No srsName attribute will be
* @param {string} [srsName] SRS name. No srsName attribute will be
* set on geometries when this is not provided.
* @return {!Within} `<Within>` operator.
* @api
*/
export function within(geometryName, geometry, opt_srsName) {
return new Within(geometryName, geometry, opt_srsName);
export function within(geometryName, geometry, srsName) {
return new Within(geometryName, geometry, srsName);
}
/**
@@ -140,13 +140,13 @@ export function within(geometryName, geometry, opt_srsName) {
* @param {!import("../geom/Geometry.js").default} geometry Geometry.
* @param {!number} distance Distance.
* @param {!string} unit Unit.
* @param {string} [opt_srsName] SRS name. No srsName attribute will be
* @param {string} [srsName] SRS name. No srsName attribute will be
* set on geometries when this is not provided.
* @return {!DWithin} `<DWithin>` operator.
* @api
*/
export function dwithin(geometryName, geometry, distance, unit, opt_srsName) {
return new DWithin(geometryName, geometry, distance, unit, opt_srsName);
export function dwithin(geometryName, geometry, distance, unit, srsName) {
return new DWithin(geometryName, geometry, distance, unit, srsName);
}
/**
@@ -154,12 +154,12 @@ export function dwithin(geometryName, geometry, distance, unit, opt_srsName) {
*
* @param {!string} propertyName Name of the context property to compare.
* @param {!(string|number)} expression The value to compare.
* @param {boolean} [opt_matchCase] Case-sensitive?
* @param {boolean} [matchCase] Case-sensitive?
* @return {!EqualTo} `<PropertyIsEqualTo>` operator.
* @api
*/
export function equalTo(propertyName, expression, opt_matchCase) {
return new EqualTo(propertyName, expression, opt_matchCase);
export function equalTo(propertyName, expression, matchCase) {
return new EqualTo(propertyName, expression, matchCase);
}
/**
@@ -167,12 +167,12 @@ export function equalTo(propertyName, expression, opt_matchCase) {
*
* @param {!string} propertyName Name of the context property to compare.
* @param {!(string|number)} expression The value to compare.
* @param {boolean} [opt_matchCase] Case-sensitive?
* @param {boolean} [matchCase] Case-sensitive?
* @return {!NotEqualTo} `<PropertyIsNotEqualTo>` operator.
* @api
*/
export function notEqualTo(propertyName, expression, opt_matchCase) {
return new NotEqualTo(propertyName, expression, opt_matchCase);
export function notEqualTo(propertyName, expression, matchCase) {
return new NotEqualTo(propertyName, expression, matchCase);
}
/**
@@ -255,31 +255,31 @@ export function between(propertyName, lowerBoundary, upperBoundary) {
*
* @param {!string} propertyName Name of the context property to compare.
* @param {!string} pattern Text pattern.
* @param {string} [opt_wildCard] Pattern character which matches any sequence of
* @param {string} [wildCard] Pattern character which matches any sequence of
* zero or more string characters. Default is '*'.
* @param {string} [opt_singleChar] pattern character which matches any single
* @param {string} [singleChar] pattern character which matches any single
* string character. Default is '.'.
* @param {string} [opt_escapeChar] Escape character which can be used to escape
* @param {string} [escapeChar] Escape character which can be used to escape
* the pattern characters. Default is '!'.
* @param {boolean} [opt_matchCase] Case-sensitive?
* @param {boolean} [matchCase] Case-sensitive?
* @return {!IsLike} `<PropertyIsLike>` operator.
* @api
*/
export function like(
propertyName,
pattern,
opt_wildCard,
opt_singleChar,
opt_escapeChar,
opt_matchCase
wildCard,
singleChar,
escapeChar,
matchCase
) {
return new IsLike(
propertyName,
pattern,
opt_wildCard,
opt_singleChar,
opt_escapeChar,
opt_matchCase
wildCard,
singleChar,
escapeChar,
matchCase
);
}
+3 -3
View File
@@ -14,10 +14,10 @@ class Bbox extends Filter {
/**
* @param {!string} geometryName Geometry name to use.
* @param {!import("../../extent.js").Extent} extent Extent.
* @param {string} [opt_srsName] SRS name. No srsName attribute will be set
* @param {string} [srsName] SRS name. No srsName attribute will be set
* on geometries when this is not provided.
*/
constructor(geometryName, extent, opt_srsName) {
constructor(geometryName, extent, srsName) {
super('BBOX');
/**
@@ -38,7 +38,7 @@ class Bbox extends Filter {
/**
* @type {string|undefined}
*/
this.srsName = opt_srsName;
this.srsName = srsName;
}
}
+3 -3
View File
@@ -15,9 +15,9 @@ class ComparisonBinary extends Comparison {
* @param {!string} tagName The XML tag name for this filter.
* @param {!string} propertyName Name of the context property to compare.
* @param {!(string|number)} expression The value to compare.
* @param {boolean} [opt_matchCase] Case-sensitive?
* @param {boolean} [matchCase] Case-sensitive?
*/
constructor(tagName, propertyName, expression, opt_matchCase) {
constructor(tagName, propertyName, expression, matchCase) {
super(tagName, propertyName);
/**
@@ -28,7 +28,7 @@ class ComparisonBinary extends Comparison {
/**
* @type {boolean|undefined}
*/
this.matchCase = opt_matchCase;
this.matchCase = matchCase;
}
}
+3 -3
View File
@@ -13,11 +13,11 @@ class Contains extends Spatial {
/**
* @param {!string} geometryName Geometry name to use.
* @param {!import("../../geom/Geometry.js").default} geometry Geometry.
* @param {string} [opt_srsName] SRS name. No srsName attribute will be
* @param {string} [srsName] SRS name. No srsName attribute will be
* set on geometries when this is not provided.
*/
constructor(geometryName, geometry, opt_srsName) {
super('Contains', geometryName, geometry, opt_srsName);
constructor(geometryName, geometry, srsName) {
super('Contains', geometryName, geometry, srsName);
}
}
+3 -3
View File
@@ -15,11 +15,11 @@ class DWithin extends Spatial {
* @param {!import("../../geom/Geometry.js").default} geometry Geometry.
* @param {!number} distance Distance.
* @param {!string} unit Unit.
* @param {string} [opt_srsName] SRS name. No srsName attribute will be
* @param {string} [srsName] SRS name. No srsName attribute will be
* set on geometries when this is not provided.
*/
constructor(geometryName, geometry, distance, unit, opt_srsName) {
super('DWithin', geometryName, geometry, opt_srsName);
constructor(geometryName, geometry, distance, unit, srsName) {
super('DWithin', geometryName, geometry, srsName);
/**
* @public
+3 -3
View File
@@ -13,11 +13,11 @@ class Disjoint extends Spatial {
/**
* @param {!string} geometryName Geometry name to use.
* @param {!import("../../geom/Geometry.js").default} geometry Geometry.
* @param {string} [opt_srsName] SRS name. No srsName attribute will be
* @param {string} [srsName] SRS name. No srsName attribute will be
* set on geometries when this is not provided.
*/
constructor(geometryName, geometry, opt_srsName) {
super('Disjoint', geometryName, geometry, opt_srsName);
constructor(geometryName, geometry, srsName) {
super('Disjoint', geometryName, geometry, srsName);
}
}
+3 -3
View File
@@ -12,10 +12,10 @@ class EqualTo extends ComparisonBinary {
/**
* @param {!string} propertyName Name of the context property to compare.
* @param {!(string|number)} expression The value to compare.
* @param {boolean} [opt_matchCase] Case-sensitive?
* @param {boolean} [matchCase] Case-sensitive?
*/
constructor(propertyName, expression, opt_matchCase) {
super('PropertyIsEqualTo', propertyName, expression, opt_matchCase);
constructor(propertyName, expression, matchCase) {
super('PropertyIsEqualTo', propertyName, expression, matchCase);
}
}
+3 -3
View File
@@ -13,11 +13,11 @@ class Intersects extends Spatial {
/**
* @param {!string} geometryName Geometry name to use.
* @param {!import("../../geom/Geometry.js").default} geometry Geometry.
* @param {string} [opt_srsName] SRS name. No srsName attribute will be
* @param {string} [srsName] SRS name. No srsName attribute will be
* set on geometries when this is not provided.
*/
constructor(geometryName, geometry, opt_srsName) {
super('Intersects', geometryName, geometry, opt_srsName);
constructor(geometryName, geometry, srsName) {
super('Intersects', geometryName, geometry, srsName);
}
}
+12 -12
View File
@@ -13,21 +13,21 @@ class IsLike extends Comparison {
* [constructor description]
* @param {!string} propertyName Name of the context property to compare.
* @param {!string} pattern Text pattern.
* @param {string} [opt_wildCard] Pattern character which matches any sequence of
* @param {string} [wildCard] Pattern character which matches any sequence of
* zero or more string characters. Default is '*'.
* @param {string} [opt_singleChar] pattern character which matches any single
* @param {string} [singleChar] pattern character which matches any single
* string character. Default is '.'.
* @param {string} [opt_escapeChar] Escape character which can be used to escape
* @param {string} [escapeChar] Escape character which can be used to escape
* the pattern characters. Default is '!'.
* @param {boolean} [opt_matchCase] Case-sensitive?
* @param {boolean} [matchCase] Case-sensitive?
*/
constructor(
propertyName,
pattern,
opt_wildCard,
opt_singleChar,
opt_escapeChar,
opt_matchCase
wildCard,
singleChar,
escapeChar,
matchCase
) {
super('PropertyIsLike', propertyName);
@@ -39,22 +39,22 @@ class IsLike extends Comparison {
/**
* @type {!string}
*/
this.wildCard = opt_wildCard !== undefined ? opt_wildCard : '*';
this.wildCard = wildCard !== undefined ? wildCard : '*';
/**
* @type {!string}
*/
this.singleChar = opt_singleChar !== undefined ? opt_singleChar : '.';
this.singleChar = singleChar !== undefined ? singleChar : '.';
/**
* @type {!string}
*/
this.escapeChar = opt_escapeChar !== undefined ? opt_escapeChar : '!';
this.escapeChar = escapeChar !== undefined ? escapeChar : '!';
/**
* @type {boolean|undefined}
*/
this.matchCase = opt_matchCase;
this.matchCase = matchCase;
}
}
+3 -3
View File
@@ -12,10 +12,10 @@ class NotEqualTo extends ComparisonBinary {
/**
* @param {!string} propertyName Name of the context property to compare.
* @param {!(string|number)} expression The value to compare.
* @param {boolean} [opt_matchCase] Case-sensitive?
* @param {boolean} [matchCase] Case-sensitive?
*/
constructor(propertyName, expression, opt_matchCase) {
super('PropertyIsNotEqualTo', propertyName, expression, opt_matchCase);
constructor(propertyName, expression, matchCase) {
super('PropertyIsNotEqualTo', propertyName, expression, matchCase);
}
}
+3 -3
View File
@@ -16,10 +16,10 @@ class Spatial extends Filter {
* @param {!string} tagName The XML tag name for this filter.
* @param {!string} geometryName Geometry name to use.
* @param {!import("../../geom/Geometry.js").default} geometry Geometry.
* @param {string} [opt_srsName] SRS name. No srsName attribute will be
* @param {string} [srsName] SRS name. No srsName attribute will be
* set on geometries when this is not provided.
*/
constructor(tagName, geometryName, geometry, opt_srsName) {
constructor(tagName, geometryName, geometry, srsName) {
super(tagName);
/**
@@ -35,7 +35,7 @@ class Spatial extends Filter {
/**
* @type {string|undefined}
*/
this.srsName = opt_srsName;
this.srsName = srsName;
}
}
+3 -3
View File
@@ -13,11 +13,11 @@ class Within extends Spatial {
/**
* @param {!string} geometryName Geometry name to use.
* @param {!import("../../geom/Geometry.js").default} geometry Geometry.
* @param {string} [opt_srsName] SRS name. No srsName attribute will be
* @param {string} [srsName] SRS name. No srsName attribute will be
* set on geometries when this is not provided.
*/
constructor(geometryName, geometry, opt_srsName) {
super('Within', geometryName, geometry, opt_srsName);
constructor(geometryName, geometry, srsName) {
super('Within', geometryName, geometry, srsName);
}
}