Move WriteOptions to ol/format/Feature

This commit is contained in:
Tim Schaub
2018-03-11 15:55:48 -06:00
parent 4eb6603af7
commit 8eaee5618e
15 changed files with 89 additions and 151 deletions

View File

@@ -5,66 +5,6 @@
let olx; let olx;
/**
* @typedef {{dataProjection: ol.ProjectionLike,
* featureProjection: ol.ProjectionLike,
* rightHanded: (boolean|undefined),
* decimals: (number|undefined)}}
*/
olx.format.WriteOptions;
/**
* Projection of the data we are writing. If not provided, the
* `defaultDataProjection` of the format is assigned (where set). If no
* `defaultDataProjection` is set for a format, the features will be returned
* in the `featureProjection`.
* @type {ol.ProjectionLike}
* @api
*/
olx.format.WriteOptions.prototype.dataProjection;
/**
* Projection of the feature geometries that will be serialized by the format
* writer. If not provided, geometries are assumed to be in the
* `dataProjection` if that is set; in other words, they are not transformed.
* @type {ol.ProjectionLike}
* @api
*/
olx.format.WriteOptions.prototype.featureProjection;
/**
* When writing geometries, follow the right-hand rule for linear ring
* orientation. This means that polygons will have counter-clockwise exterior
* rings and clockwise interior rings. By default, coordinates are serialized
* as they are provided at construction. If `true`, the right-hand rule will
* be applied. If `false`, the left-hand rule will be applied (clockwise for
* exterior and counter-clockwise for interior rings). Note that not all
* formats support this. The GeoJSON format does use this property when writing
* geometries.
*
* @type {boolean|undefined}
* @api
*/
olx.format.WriteOptions.prototype.rightHanded;
/**
* Maximum number of decimal places for coordinates. Coordinates are stored
* internally as floats, but floating-point arithmetic can create coordinates
* with a large number of decimal places, not generally wanted on output.
* Set a number here to round coordinates. Can also be used to ensure that
* coordinates read in can be written back out with the same number of decimals.
* Default is no rounding.
*
* @type {number|undefined}
* @api
*/
olx.format.WriteOptions.prototype.decimals;
/** /**
* @typedef {{defaultDataProjection: ol.ProjectionLike, * @typedef {{defaultDataProjection: ol.ProjectionLike,
* geometryName: (string|undefined), * geometryName: (string|undefined),

View File

@@ -1,32 +1,4 @@
/**
* @typedef {Object} format_WriteOptions
* @property {ol.ProjectionLike} dataProjection Projection of the data we are writing. If not provided, the
* `defaultDataProjection` of the format is assigned (where set). If no
* `defaultDataProjection` is set for a format, the features will be returned
* in the `featureProjection`.
* @property {ol.ProjectionLike} featureProjection Projection of the feature geometries that will be serialized by the format
* writer. If not provided, geometries are assumed to be in the
* `dataProjection` if that is set; in other words, they are not transformed.
* @property {boolean|undefined} rightHanded When writing geometries, follow the right-hand rule for linear ring
* orientation. This means that polygons will have counter-clockwise exterior
* rings and clockwise interior rings. By default, coordinates are serialized
* as they are provided at construction. If `true`, the right-hand rule will
* be applied. If `false`, the left-hand rule will be applied (clockwise for
* exterior and counter-clockwise for interior rings). Note that not all
* formats support this. The GeoJSON format does use this property when writing
* geometries.
*
* @property {number|undefined} decimals Maximum number of decimal places for coordinates. Coordinates are stored
* internally as floats, but floating-point arithmetic can create coordinates
* with a large number of decimal places, not generally wanted on output.
* Set a number here to round coordinates. Can also be used to ensure that
* coordinates read in can be written back out with the same number of decimals.
* Default is no rounding.
*
*/
/** /**
* @typedef {Object} format_GeoJSONOptions * @typedef {Object} format_GeoJSONOptions
* @property {ol.ProjectionLike} defaultDataProjection Default data projection. Default is `EPSG:4326`. * @property {ol.ProjectionLike} defaultDataProjection Default data projection. Default is `EPSG:4326`.

View File

@@ -37,7 +37,7 @@ GEOMETRY_READERS[GeometryType.MULTI_POLYGON] = readMultiPolygonGeometry;
/** /**
* @const * @const
* @type {Object.<string, function(ol.geom.Geometry, olx.format.WriteOptions=): (EsriJSONGeometry)>} * @type {Object.<string, function(ol.geom.Geometry, module:ol/format/Feature~WriteOptions=): (EsriJSONGeometry)>}
*/ */
const GEOMETRY_WRITERS = {}; const GEOMETRY_WRITERS = {};
GEOMETRY_WRITERS[GeometryType.POINT] = writePointGeometry; GEOMETRY_WRITERS[GeometryType.POINT] = writePointGeometry;
@@ -261,7 +261,7 @@ function readPolygonGeometry(object) {
/** /**
* @param {ol.geom.Geometry} geometry Geometry. * @param {ol.geom.Geometry} geometry Geometry.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {EsriJSONGeometry} EsriJSON geometry. * @return {EsriJSONGeometry} EsriJSON geometry.
*/ */
function writePointGeometry(geometry, opt_options) { function writePointGeometry(geometry, opt_options) {
@@ -316,7 +316,7 @@ function getHasZM(geometry) {
/** /**
* @param {ol.geom.Geometry} geometry Geometry. * @param {ol.geom.Geometry} geometry Geometry.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {EsriJSONPolyline} EsriJSON geometry. * @return {EsriJSONPolyline} EsriJSON geometry.
*/ */
function writeLineStringGeometry(geometry, opt_options) { function writeLineStringGeometry(geometry, opt_options) {
@@ -333,7 +333,7 @@ function writeLineStringGeometry(geometry, opt_options) {
/** /**
* @param {ol.geom.Geometry} geometry Geometry. * @param {ol.geom.Geometry} geometry Geometry.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {EsriJSONPolygon} EsriJSON geometry. * @return {EsriJSONPolygon} EsriJSON geometry.
*/ */
function writePolygonGeometry(geometry, opt_options) { function writePolygonGeometry(geometry, opt_options) {
@@ -349,7 +349,7 @@ function writePolygonGeometry(geometry, opt_options) {
/** /**
* @param {ol.geom.Geometry} geometry Geometry. * @param {ol.geom.Geometry} geometry Geometry.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {EsriJSONPolyline} EsriJSON geometry. * @return {EsriJSONPolyline} EsriJSON geometry.
*/ */
function writeMultiLineStringGeometry(geometry, opt_options) { function writeMultiLineStringGeometry(geometry, opt_options) {
@@ -364,7 +364,7 @@ function writeMultiLineStringGeometry(geometry, opt_options) {
/** /**
* @param {ol.geom.Geometry} geometry Geometry. * @param {ol.geom.Geometry} geometry Geometry.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {EsriJSONMultipoint} EsriJSON geometry. * @return {EsriJSONMultipoint} EsriJSON geometry.
*/ */
function writeMultiPointGeometry(geometry, opt_options) { function writeMultiPointGeometry(geometry, opt_options) {
@@ -379,7 +379,7 @@ function writeMultiPointGeometry(geometry, opt_options) {
/** /**
* @param {ol.geom.Geometry} geometry Geometry. * @param {ol.geom.Geometry} geometry Geometry.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {EsriJSONPolygon} EsriJSON geometry. * @return {EsriJSONPolygon} EsriJSON geometry.
*/ */
function writeMultiPolygonGeometry(geometry, opt_options) { function writeMultiPolygonGeometry(geometry, opt_options) {
@@ -516,7 +516,7 @@ EsriJSON.prototype.readProjectionFromObject = function(object) {
/** /**
* @param {ol.geom.Geometry} geometry Geometry. * @param {ol.geom.Geometry} geometry Geometry.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {EsriJSONGeometry} EsriJSON geometry. * @return {EsriJSONGeometry} EsriJSON geometry.
*/ */
function writeGeometry(geometry, opt_options) { function writeGeometry(geometry, opt_options) {
@@ -531,7 +531,7 @@ function writeGeometry(geometry, opt_options) {
* *
* @function * @function
* @param {ol.geom.Geometry} geometry Geometry. * @param {ol.geom.Geometry} geometry Geometry.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {string} EsriJSON. * @return {string} EsriJSON.
* @api * @api
*/ */
@@ -542,7 +542,7 @@ EsriJSON.prototype.writeGeometry;
* Encode a geometry as a EsriJSON object. * Encode a geometry as a EsriJSON object.
* *
* @param {ol.geom.Geometry} geometry Geometry. * @param {ol.geom.Geometry} geometry Geometry.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {EsriJSONGeometry} Object. * @return {EsriJSONGeometry} Object.
* @override * @override
* @api * @api
@@ -557,7 +557,7 @@ EsriJSON.prototype.writeGeometryObject = function(geometry, opt_options) {
* *
* @function * @function
* @param {ol.Feature} feature Feature. * @param {ol.Feature} feature Feature.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {string} EsriJSON. * @return {string} EsriJSON.
* @api * @api
*/ */
@@ -568,7 +568,7 @@ EsriJSON.prototype.writeFeature;
* Encode a feature as a esriJSON Feature object. * Encode a feature as a esriJSON Feature object.
* *
* @param {ol.Feature} feature Feature. * @param {ol.Feature} feature Feature.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {Object} Object. * @return {Object} Object.
* @override * @override
* @api * @api
@@ -601,7 +601,7 @@ EsriJSON.prototype.writeFeatureObject = function(feature, opt_options) {
* *
* @function * @function
* @param {Array.<ol.Feature>} features Features. * @param {Array.<ol.Feature>} features Features.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {string} EsriJSON. * @return {string} EsriJSON.
* @api * @api
*/ */
@@ -612,7 +612,7 @@ EsriJSON.prototype.writeFeatures;
* Encode an array of features as a EsriJSON object. * Encode an array of features as a EsriJSON object.
* *
* @param {Array.<ol.Feature>} features Features. * @param {Array.<ol.Feature>} features Features.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {Object} EsriJSON Object. * @return {Object} EsriJSON Object.
* @override * @override
* @api * @api

View File

@@ -21,6 +21,32 @@ import {get as getProjection, equivalent as equivalentProjection, transformExten
*/ */
/**
* @typedef {Object} WriteOptions
* @property {ol.ProjectionLike} dataProjection Projection of the data we are writing.
* If not provided, the `defaultDataProjection` of the format is assigned (where set).
* If no `defaultDataProjection` is set for a format, the features will be returned
* in the `featureProjection`.
* @property {ol.ProjectionLike} featureProjection Projection of the feature geometries
* that will be serialized by the format writer. If not provided, geometries are assumed
* to be in the `dataProjection` if that is set; in other words, they are not transformed.
* @property {boolean|undefined} rightHanded When writing geometries, follow the right-hand
* rule for linear ring orientation. This means that polygons will have counter-clockwise
* exterior rings and clockwise interior rings. By default, coordinates are serialized
* as they are provided at construction. If `true`, the right-hand rule will
* be applied. If `false`, the left-hand rule will be applied (clockwise for
* exterior and counter-clockwise for interior rings). Note that not all
* formats support this. The GeoJSON format does use this property when writing
* geometries.
* @property {number|undefined} decimals Maximum number of decimal places for coordinates.
* Coordinates are stored internally as floats, but floating-point arithmetic can create
* coordinates with a large number of decimal places, not generally wanted on output.
* Set a number here to round coordinates. Can also be used to ensure that
* coordinates read in can be written back out with the same number of decimals.
* Default is no rounding.
*/
/** /**
* @classdesc * @classdesc
* Abstract base class; normally only used for creating subclasses and not * Abstract base class; normally only used for creating subclasses and not
@@ -74,10 +100,10 @@ FeatureFormat.prototype.getReadOptions = function(source, opt_options) {
/** /**
* Sets the `defaultDataProjection` on the options, if no `dataProjection` * Sets the `defaultDataProjection` on the options, if no `dataProjection`
* is set. * is set.
* @param {olx.format.WriteOptions|module:ol/format/Feature~ReadOptions|undefined} options * @param {module:ol/format/Feature~WriteOptions|module:ol/format/Feature~ReadOptions|undefined} options
* Options. * Options.
* @protected * @protected
* @return {olx.format.WriteOptions|module:ol/format/Feature~ReadOptions|undefined} * @return {module:ol/format/Feature~WriteOptions|module:ol/format/Feature~ReadOptions|undefined}
* Updated options. * Updated options.
*/ */
FeatureFormat.prototype.adaptOptions = function(options) { FeatureFormat.prototype.adaptOptions = function(options) {
@@ -152,7 +178,7 @@ FeatureFormat.prototype.readProjection = function(source) {};
* *
* @abstract * @abstract
* @param {ol.Feature} feature Feature. * @param {ol.Feature} feature Feature.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {string} Result. * @return {string} Result.
*/ */
FeatureFormat.prototype.writeFeature = function(feature, opt_options) {}; FeatureFormat.prototype.writeFeature = function(feature, opt_options) {};
@@ -163,7 +189,7 @@ FeatureFormat.prototype.writeFeature = function(feature, opt_options) {};
* *
* @abstract * @abstract
* @param {Array.<ol.Feature>} features Features. * @param {Array.<ol.Feature>} features Features.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {string} Result. * @return {string} Result.
*/ */
FeatureFormat.prototype.writeFeatures = function(features, opt_options) {}; FeatureFormat.prototype.writeFeatures = function(features, opt_options) {};
@@ -174,7 +200,7 @@ FeatureFormat.prototype.writeFeatures = function(features, opt_options) {};
* *
* @abstract * @abstract
* @param {ol.geom.Geometry} geometry Geometry. * @param {ol.geom.Geometry} geometry Geometry.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {string} Result. * @return {string} Result.
*/ */
FeatureFormat.prototype.writeGeometry = function(geometry, opt_options) {}; FeatureFormat.prototype.writeGeometry = function(geometry, opt_options) {};
@@ -184,7 +210,7 @@ export default FeatureFormat;
/** /**
* @param {ol.geom.Geometry|module:ol/extent~Extent} geometry Geometry. * @param {ol.geom.Geometry|module:ol/extent~Extent} geometry Geometry.
* @param {boolean} write Set to true for writing, false for reading. * @param {boolean} write Set to true for writing, false for reading.
* @param {(olx.format.WriteOptions|module:ol/format/Feature~ReadOptions)=} opt_options * @param {(module:ol/format/Feature~WriteOptions|module:ol/format/Feature~ReadOptions)=} opt_options
* Options. * Options.
* @return {ol.geom.Geometry|module:ol/extent~Extent} Transformed geometry. * @return {ol.geom.Geometry|module:ol/extent~Extent} Transformed geometry.
*/ */

View File

@@ -23,7 +23,7 @@ const GML = GML3;
* *
* @function * @function
* @param {Array.<ol.Feature>} features Features. * @param {Array.<ol.Feature>} features Features.
* @param {olx.format.WriteOptions=} opt_options Options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Options.
* @return {string} Result. * @return {string} Result.
* @api * @api
*/ */
@@ -35,7 +35,7 @@ GML.prototype.writeFeatures;
* *
* @function * @function
* @param {Array.<ol.Feature>} features Features. * @param {Array.<ol.Feature>} features Features.
* @param {olx.format.WriteOptions=} opt_options Options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Options.
* @return {Node} Node. * @return {Node} Node.
* @api * @api
*/ */

View File

@@ -282,7 +282,7 @@ GML2.prototype.writeMultiCurveOrLineString_ = function(node, geometry, objectSta
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
*/ */
GML2.prototype.writeGeometryElement = function(node, geometry, objectStack) { GML2.prototype.writeGeometryElement = function(node, geometry, objectStack) {
const context = /** @type {olx.format.WriteOptions} */ (objectStack[objectStack.length - 1]); const context = /** @type {module:ol/format/Feature~WriteOptions} */ (objectStack[objectStack.length - 1]);
const item = assign({}, context); const item = assign({}, context);
item.node = node; item.node = node;
let value; let value;

View File

@@ -940,7 +940,7 @@ GML3.prototype.writeCurveSegments_ = function(node, line, objectStack) {
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
*/ */
GML3.prototype.writeGeometryElement = function(node, geometry, objectStack) { GML3.prototype.writeGeometryElement = function(node, geometry, objectStack) {
const context = /** @type {olx.format.WriteOptions} */ (objectStack[objectStack.length - 1]); const context = /** @type {module:ol/format/Feature~WriteOptions} */ (objectStack[objectStack.length - 1]);
const item = assign({}, context); const item = assign({}, context);
item.node = node; item.node = node;
let value; let value;
@@ -1097,7 +1097,7 @@ GML3.prototype.GEOMETRY_NODE_FACTORY_ = function(value, objectStack, opt_nodeNam
* Encode a geometry in GML 3.1.1 Simple Features. * Encode a geometry in GML 3.1.1 Simple Features.
* *
* @param {ol.geom.Geometry} geometry Geometry. * @param {ol.geom.Geometry} geometry Geometry.
* @param {olx.format.WriteOptions=} opt_options Options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Options.
* @return {Node} Node. * @return {Node} Node.
* @override * @override
* @api * @api
@@ -1121,7 +1121,7 @@ GML3.prototype.writeGeometryNode = function(geometry, opt_options) {
* *
* @function * @function
* @param {Array.<ol.Feature>} features Features. * @param {Array.<ol.Feature>} features Features.
* @param {olx.format.WriteOptions=} opt_options Options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Options.
* @return {string} Result. * @return {string} Result.
* @api * @api
*/ */
@@ -1132,7 +1132,7 @@ GML3.prototype.writeFeatures;
* Encode an array of features in the GML 3.1.1 format as an XML node. * Encode an array of features in the GML 3.1.1 format as an XML node.
* *
* @param {Array.<ol.Feature>} features Features. * @param {Array.<ol.Feature>} features Features.
* @param {olx.format.WriteOptions=} opt_options Options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Options.
* @return {Node} Node. * @return {Node} Node.
* @override * @override
* @api * @api

View File

@@ -768,7 +768,7 @@ function writeWptType(node, coordinate, objectStack) {
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
*/ */
function writeRte(node, feature, objectStack) { function writeRte(node, feature, objectStack) {
const options = /** @type {olx.format.WriteOptions} */ (objectStack[0]); const options = /** @type {module:ol/format/Feature~WriteOptions} */ (objectStack[0]);
const properties = feature.getProperties(); const properties = feature.getProperties();
const context = {node: node, 'properties': properties}; const context = {node: node, 'properties': properties};
let geometry = feature.getGeometry(); let geometry = feature.getGeometry();
@@ -792,7 +792,7 @@ function writeRte(node, feature, objectStack) {
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
*/ */
function writeTrk(node, feature, objectStack) { function writeTrk(node, feature, objectStack) {
const options = /** @type {olx.format.WriteOptions} */ (objectStack[0]); const options = /** @type {module:ol/format/Feature~WriteOptions} */ (objectStack[0]);
const properties = feature.getProperties(); const properties = feature.getProperties();
/** @type {module:ol/xml~NodeStackItem} */ /** @type {module:ol/xml~NodeStackItem} */
const context = {node: node, 'properties': properties}; const context = {node: node, 'properties': properties};
@@ -832,7 +832,7 @@ function writeTrkSeg(node, lineString, objectStack) {
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
*/ */
function writeWpt(node, feature, objectStack) { function writeWpt(node, feature, objectStack) {
const options = /** @type {olx.format.WriteOptions} */ (objectStack[0]); const options = /** @type {module:ol/format/Feature~WriteOptions} */ (objectStack[0]);
const context = objectStack[objectStack.length - 1]; const context = objectStack[objectStack.length - 1];
context['properties'] = feature.getProperties(); context['properties'] = feature.getProperties();
let geometry = feature.getGeometry(); let geometry = feature.getGeometry();
@@ -852,7 +852,7 @@ function writeWpt(node, feature, objectStack) {
* *
* @function * @function
* @param {Array.<ol.Feature>} features Features. * @param {Array.<ol.Feature>} features Features.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {string} Result. * @return {string} Result.
* @api * @api
*/ */
@@ -865,7 +865,7 @@ GPX.prototype.writeFeatures;
* as tracks (`<trk>`). * as tracks (`<trk>`).
* *
* @param {Array.<ol.Feature>} features Features. * @param {Array.<ol.Feature>} features Features.
* @param {olx.format.WriteOptions=} opt_options Options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Options.
* @return {Node} Node. * @return {Node} Node.
* @override * @override
* @api * @api

View File

@@ -82,7 +82,7 @@ const GEOMETRY_READERS = {
/** /**
* @const * @const
* @type {Object.<string, function(ol.geom.Geometry, olx.format.WriteOptions=): (GeoJSONGeometry|GeoJSONGeometryCollection)>} * @type {Object.<string, function(ol.geom.Geometry, module:ol/format/Feature~WriteOptions=): (GeoJSONGeometry|GeoJSONGeometryCollection)>}
*/ */
const GEOMETRY_WRITERS = { const GEOMETRY_WRITERS = {
'Point': writePointGeometry, 'Point': writePointGeometry,
@@ -186,7 +186,7 @@ function readPolygonGeometry(object) {
/** /**
* @param {ol.geom.Geometry} geometry Geometry. * @param {ol.geom.Geometry} geometry Geometry.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {GeoJSONGeometry|GeoJSONGeometryCollection} GeoJSON geometry. * @return {GeoJSONGeometry|GeoJSONGeometryCollection} GeoJSON geometry.
*/ */
function writeGeometry(geometry, opt_options) { function writeGeometry(geometry, opt_options) {
@@ -210,7 +210,7 @@ function writeEmptyGeometryCollectionGeometry(geometry) {
/** /**
* @param {ol.geom.GeometryCollection} geometry Geometry. * @param {ol.geom.GeometryCollection} geometry Geometry.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {GeoJSONGeometryCollection} GeoJSON geometry collection. * @return {GeoJSONGeometryCollection} GeoJSON geometry collection.
*/ */
function writeGeometryCollectionGeometry(geometry, opt_options) { function writeGeometryCollectionGeometry(geometry, opt_options) {
@@ -228,7 +228,7 @@ function writeGeometryCollectionGeometry(geometry, opt_options) {
/** /**
* @param {ol.geom.LineString} geometry Geometry. * @param {ol.geom.LineString} geometry Geometry.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {GeoJSONGeometry} GeoJSON geometry. * @return {GeoJSONGeometry} GeoJSON geometry.
*/ */
function writeLineStringGeometry(geometry, opt_options) { function writeLineStringGeometry(geometry, opt_options) {
@@ -241,7 +241,7 @@ function writeLineStringGeometry(geometry, opt_options) {
/** /**
* @param {ol.geom.MultiLineString} geometry Geometry. * @param {ol.geom.MultiLineString} geometry Geometry.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {GeoJSONGeometry} GeoJSON geometry. * @return {GeoJSONGeometry} GeoJSON geometry.
*/ */
function writeMultiLineStringGeometry(geometry, opt_options) { function writeMultiLineStringGeometry(geometry, opt_options) {
@@ -254,7 +254,7 @@ function writeMultiLineStringGeometry(geometry, opt_options) {
/** /**
* @param {ol.geom.MultiPoint} geometry Geometry. * @param {ol.geom.MultiPoint} geometry Geometry.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {GeoJSONGeometry} GeoJSON geometry. * @return {GeoJSONGeometry} GeoJSON geometry.
*/ */
function writeMultiPointGeometry(geometry, opt_options) { function writeMultiPointGeometry(geometry, opt_options) {
@@ -267,7 +267,7 @@ function writeMultiPointGeometry(geometry, opt_options) {
/** /**
* @param {ol.geom.MultiPolygon} geometry Geometry. * @param {ol.geom.MultiPolygon} geometry Geometry.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {GeoJSONGeometry} GeoJSON geometry. * @return {GeoJSONGeometry} GeoJSON geometry.
*/ */
function writeMultiPolygonGeometry(geometry, opt_options) { function writeMultiPolygonGeometry(geometry, opt_options) {
@@ -284,7 +284,7 @@ function writeMultiPolygonGeometry(geometry, opt_options) {
/** /**
* @param {ol.geom.Point} geometry Geometry. * @param {ol.geom.Point} geometry Geometry.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {GeoJSONGeometry} GeoJSON geometry. * @return {GeoJSONGeometry} GeoJSON geometry.
*/ */
function writePointGeometry(geometry, opt_options) { function writePointGeometry(geometry, opt_options) {
@@ -297,7 +297,7 @@ function writePointGeometry(geometry, opt_options) {
/** /**
* @param {ol.geom.Polygon} geometry Geometry. * @param {ol.geom.Polygon} geometry Geometry.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {GeoJSONGeometry} GeoJSON geometry. * @return {GeoJSONGeometry} GeoJSON geometry.
*/ */
function writePolygonGeometry(geometry, opt_options) { function writePolygonGeometry(geometry, opt_options) {
@@ -453,7 +453,7 @@ GeoJSON.prototype.readProjectionFromObject = function(object) {
* *
* @function * @function
* @param {ol.Feature} feature Feature. * @param {ol.Feature} feature Feature.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {string} GeoJSON. * @return {string} GeoJSON.
* @override * @override
* @api * @api
@@ -465,7 +465,7 @@ GeoJSON.prototype.writeFeature;
* Encode a feature as a GeoJSON Feature object. * Encode a feature as a GeoJSON Feature object.
* *
* @param {ol.Feature} feature Feature. * @param {ol.Feature} feature Feature.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {GeoJSONFeature} Object. * @return {GeoJSONFeature} Object.
* @override * @override
* @api * @api
@@ -502,7 +502,7 @@ GeoJSON.prototype.writeFeatureObject = function(feature, opt_options) {
* *
* @function * @function
* @param {Array.<ol.Feature>} features Features. * @param {Array.<ol.Feature>} features Features.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {string} GeoJSON. * @return {string} GeoJSON.
* @api * @api
*/ */
@@ -513,7 +513,7 @@ GeoJSON.prototype.writeFeatures;
* Encode an array of features as a GeoJSON object. * Encode an array of features as a GeoJSON object.
* *
* @param {Array.<ol.Feature>} features Features. * @param {Array.<ol.Feature>} features Features.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {GeoJSONFeatureCollection} GeoJSON Object. * @return {GeoJSONFeatureCollection} GeoJSON Object.
* @override * @override
* @api * @api
@@ -536,7 +536,7 @@ GeoJSON.prototype.writeFeaturesObject = function(features, opt_options) {
* *
* @function * @function
* @param {ol.geom.Geometry} geometry Geometry. * @param {ol.geom.Geometry} geometry Geometry.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {string} GeoJSON. * @return {string} GeoJSON.
* @api * @api
*/ */
@@ -547,7 +547,7 @@ GeoJSON.prototype.writeGeometry;
* Encode a geometry as a GeoJSON object. * Encode a geometry as a GeoJSON object.
* *
* @param {ol.geom.Geometry} geometry Geometry. * @param {ol.geom.Geometry} geometry Geometry.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {GeoJSONGeometry|GeoJSONGeometryCollection} Object. * @return {GeoJSONGeometry|GeoJSONGeometryCollection} Object.
* @override * @override
* @api * @api

View File

@@ -131,7 +131,7 @@ JSONFeature.prototype.writeFeature = function(feature, opt_options) {
/** /**
* @abstract * @abstract
* @param {ol.Feature} feature Feature. * @param {ol.Feature} feature Feature.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {Object} Object. * @return {Object} Object.
*/ */
JSONFeature.prototype.writeFeatureObject = function(feature, opt_options) {}; JSONFeature.prototype.writeFeatureObject = function(feature, opt_options) {};
@@ -148,7 +148,7 @@ JSONFeature.prototype.writeFeatures = function(features, opt_options) {
/** /**
* @abstract * @abstract
* @param {Array.<ol.Feature>} features Features. * @param {Array.<ol.Feature>} features Features.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {Object} Object. * @return {Object} Object.
*/ */
JSONFeature.prototype.writeFeaturesObject = function(features, opt_options) {}; JSONFeature.prototype.writeFeaturesObject = function(features, opt_options) {};
@@ -165,7 +165,7 @@ JSONFeature.prototype.writeGeometry = function(geometry, opt_options) {
/** /**
* @abstract * @abstract
* @param {ol.geom.Geometry} geometry Geometry. * @param {ol.geom.Geometry} geometry Geometry.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {Object} Object. * @return {Object} Object.
*/ */
JSONFeature.prototype.writeGeometryObject = function(geometry, opt_options) {}; JSONFeature.prototype.writeGeometryObject = function(geometry, opt_options) {};

View File

@@ -2698,7 +2698,7 @@ function writePlacemark(node, feature, objectStack) {
OBJECT_PROPERTY_NODE_FACTORY, values, objectStack, orderedKeys); OBJECT_PROPERTY_NODE_FACTORY, values, objectStack, orderedKeys);
// serialize geometry // serialize geometry
const options = /** @type {olx.format.WriteOptions} */ (objectStack[0]); const options = /** @type {module:ol/format/Feature~WriteOptions} */ (objectStack[0]);
let geometry = feature.getGeometry(); let geometry = feature.getGeometry();
if (geometry) { if (geometry) {
geometry = transformWithOptions(geometry, true, options); geometry = transformWithOptions(geometry, true, options);
@@ -2940,7 +2940,7 @@ const KML_SERIALIZERS = makeStructureNS(
* *
* @function * @function
* @param {Array.<ol.Feature>} features Features. * @param {Array.<ol.Feature>} features Features.
* @param {olx.format.WriteOptions=} opt_options Options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Options.
* @return {string} Result. * @return {string} Result.
* @api * @api
*/ */
@@ -2952,7 +2952,7 @@ KML.prototype.writeFeatures;
* MultiPoints, MultiLineStrings, and MultiPolygons are output as MultiGeometries. * MultiPoints, MultiLineStrings, and MultiPolygons are output as MultiGeometries.
* *
* @param {Array.<ol.Feature>} features Features. * @param {Array.<ol.Feature>} features Features.
* @param {olx.format.WriteOptions=} opt_options Options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Options.
* @return {Node} Node. * @return {Node} Node.
* @override * @override
* @api * @api

View File

@@ -366,7 +366,7 @@ Polyline.prototype.writeFeaturesText = function(features, opt_options) {
* *
* @function * @function
* @param {ol.geom.Geometry} geometry Geometry. * @param {ol.geom.Geometry} geometry Geometry.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {string} Geometry. * @return {string} Geometry.
* @api * @api
*/ */

View File

@@ -126,7 +126,7 @@ TextFeature.prototype.writeFeature = function(feature, opt_options) {
/** /**
* @abstract * @abstract
* @param {ol.Feature} feature Features. * @param {ol.Feature} feature Features.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @protected * @protected
* @return {string} Text. * @return {string} Text.
*/ */
@@ -144,7 +144,7 @@ TextFeature.prototype.writeFeatures = function(features, opt_options) {
/** /**
* @abstract * @abstract
* @param {Array.<ol.Feature>} features Features. * @param {Array.<ol.Feature>} features Features.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @protected * @protected
* @return {string} Text. * @return {string} Text.
*/ */
@@ -162,7 +162,7 @@ TextFeature.prototype.writeGeometry = function(geometry, opt_options) {
/** /**
* @abstract * @abstract
* @param {ol.geom.Geometry} geometry Geometry. * @param {ol.geom.Geometry} geometry Geometry.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @protected * @protected
* @return {string} Text. * @return {string} Text.
*/ */

View File

@@ -856,7 +856,7 @@ Parser.prototype.parseGeometry_ = function() {
* *
* @function * @function
* @param {ol.Feature} feature Feature. * @param {ol.Feature} feature Feature.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {string} WKT string. * @return {string} WKT string.
* @api * @api
*/ */
@@ -880,7 +880,7 @@ WKT.prototype.writeFeatureText = function(feature, opt_options) {
* *
* @function * @function
* @param {Array.<ol.Feature>} features Features. * @param {Array.<ol.Feature>} features Features.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {string} WKT string. * @return {string} WKT string.
* @api * @api
*/ */
@@ -908,7 +908,7 @@ WKT.prototype.writeFeaturesText = function(features, opt_options) {
* *
* @function * @function
* @param {ol.geom.Geometry} geometry Geometry. * @param {ol.geom.Geometry} geometry Geometry.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {string} WKT string. * @return {string} WKT string.
* @api * @api
*/ */

View File

@@ -215,7 +215,7 @@ XMLFeature.prototype.writeFeature = function(feature, opt_options) {
/** /**
* @param {ol.Feature} feature Feature. * @param {ol.Feature} feature Feature.
* @param {olx.format.WriteOptions=} opt_options Options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Options.
* @protected * @protected
* @return {Node} Node. * @return {Node} Node.
*/ */
@@ -235,7 +235,7 @@ XMLFeature.prototype.writeFeatures = function(features, opt_options) {
/** /**
* @param {Array.<ol.Feature>} features Features. * @param {Array.<ol.Feature>} features Features.
* @param {olx.format.WriteOptions=} opt_options Options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Options.
* @return {Node} Node. * @return {Node} Node.
*/ */
XMLFeature.prototype.writeFeaturesNode = function(features, opt_options) { XMLFeature.prototype.writeFeaturesNode = function(features, opt_options) {
@@ -254,7 +254,7 @@ XMLFeature.prototype.writeGeometry = function(geometry, opt_options) {
/** /**
* @param {ol.geom.Geometry} geometry Geometry. * @param {ol.geom.Geometry} geometry Geometry.
* @param {olx.format.WriteOptions=} opt_options Options. * @param {module:ol/format/Feature~WriteOptions=} opt_options Options.
* @return {Node} Node. * @return {Node} Node.
*/ */
XMLFeature.prototype.writeGeometryNode = function(geometry, opt_options) { XMLFeature.prototype.writeGeometryNode = function(geometry, opt_options) {