diff --git a/externs/olx.js b/externs/olx.js index 5fb451c4d9..b18745825c 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -5,758 +5,6 @@ let olx; -/** - * @typedef {{dataProjection: ol.ProjectionLike, - * extent: (ol.Extent|undefined), - * featureProjection: ol.ProjectionLike, - * rightHanded: (boolean|undefined)}} - */ -olx.format.ReadOptions; - - -/** - * Projection of the data we are reading. If not provided, the projection will - * be derived from the data (where possible) or the `defaultDataProjection` of - * the format is assigned (where set). If the projection can not be derived from - * the data and if no `defaultDataProjection` is set for a format, the features - * will not be reprojected. - * @type {ol.ProjectionLike} - * @api - */ -olx.format.ReadOptions.prototype.dataProjection; - - -/** - * Tile extent of the tile being read. This is only used and required for - * {@link ol.format.MVT}. - * @type {ol.Extent} - * @api - */ -olx.format.ReadOptions.prototype.extent; - - -/** - * Projection of the feature geometries created by the format reader. If not - * provided, features will be returned in the `dataProjection`. - * @type {ol.ProjectionLike} - * @api - */ -olx.format.ReadOptions.prototype.featureProjection; - - -/** - * @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, - * geometryName: (string|undefined), - * extractGeometryName: (boolean|undefined), - * featureProjection: ol.ProjectionLike}} - */ -olx.format.GeoJSONOptions; - - -/** - * Default data projection. Default is `EPSG:4326`. - * @type {ol.ProjectionLike} - * @api - */ -olx.format.GeoJSONOptions.prototype.defaultDataProjection; - - -/** - * Projection for features read or written by the format. Options passed to - * read or write methods will take precedence. - * @type {ol.ProjectionLike} - * @api - */ -olx.format.GeoJSONOptions.prototype.featureProjection; - - -/** - * Geometry name to use when creating features. - * @type {string|undefined} - * @api - */ -olx.format.GeoJSONOptions.prototype.geometryName; - - -/** - * Certain GeoJSON providers include the geometry_name field in the feature - * geoJSON. If set to `true` the geoJSON reader will look for that field to - * set the geometry name. If both this field is set to `true` and a - * `geometryName` is provided, the `geometryName` will take precedence. - * Default is `false`. - * @type {boolean|undefined} - * @api - */ -olx.format.GeoJSONOptions.prototype.extractGeometryName; - - -/** - * @typedef {{geometryName: (string|undefined)}} - */ -olx.format.EsriJSONOptions; - - -/** - * Geometry name to use when creating features. - * @type {string|undefined} - * @api - */ -olx.format.EsriJSONOptions.prototype.geometryName; - - -/** - * @typedef {{featureClass: (function((ol.geom.Geometry|Object.)=)| - * function(ol.geom.GeometryType,Array., - * (Array.|Array.>),Object.)| - * undefined), - * geometryName: (string|undefined), - * layers: (Array.|undefined), - * layerName: (string|undefined)}} - */ -olx.format.MVTOptions; - - -/** - * Class for features returned by {@link ol.format.MVT#readFeatures}. Set to - * {@link ol.Feature} to get full editing and geometry support at the cost of - * decreased rendering performance. The default is {@link ol.render.Feature}, - * which is optimized for rendering and hit detection. - * @type {undefined|function((ol.geom.Geometry|Object.)=)| - * function(ol.geom.GeometryType,Array., - * (Array.|Array.>),Object.,number)} - * @api - */ -olx.format.MVTOptions.prototype.featureClass; - - -/** - * Geometry name to use when creating features. Default is 'geometry'. - * @type {string|undefined} - * @api - */ -olx.format.MVTOptions.prototype.geometryName; - - -/** - * Name of the feature attribute that holds the layer name. Default is 'layer'. - * @type {string|undefined} - * @api - */ -olx.format.MVTOptions.prototype.layerName; - - -/** - * Layers to read features from. If not provided, features will be read from all - * layers. - * @type {Array.|undefined} - * @api - */ -olx.format.MVTOptions.prototype.layers; - - -/** - * @typedef {{factor: (number|undefined), - * geometryLayout: (ol.geom.GeometryLayout|undefined)}} - */ -olx.format.PolylineOptions; - - -/** - * The factor by which the coordinates values will be scaled. - * Default is `1e5`. - * @type {number|undefined} - * @api - */ -olx.format.PolylineOptions.prototype.factor; - - -/** - * Layout of the feature geometries created by the format reader. - * Default is `ol.geom.GeometryLayout.XY`. - * @type {ol.geom.GeometryLayout|undefined} - * @api - */ -olx.format.PolylineOptions.prototype.geometryLayout; - - -/** - * @typedef {{ - * defaultDataProjection: ol.ProjectionLike, - * layerName: (string|undefined), - * layers: (Array.|undefined) - * }} - */ -olx.format.TopoJSONOptions; - - -/** - * Default data projection. Default is `EPSG:4326`. - * @type {ol.ProjectionLike} - * @api - */ -olx.format.TopoJSONOptions.prototype.defaultDataProjection; - - -/** - * Set the name of the TopoJSON topology `objects`'s children as feature - * property with the specified name. This means that when set to `'layer'`, a - * topology like - * ``` - * { - * "type": "Topology", - * "objects": { - * "example": { - * "type": "GeometryCollection", - * "geometries": [] - * } - * } - * } - * ``` - * will result in features that have a property `'layer'` set to `'example'`. - * When not set, no property will be added to features. - * @type {string|undefined} - * @api - */ -olx.format.TopoJSONOptions.prototype.layerName; - - -/** - * Names of the TopoJSON topology's `objects`'s children to read features from. - * If not provided, features will be read from all children. - * @type {Array.|undefined} - * @api - */ -olx.format.TopoJSONOptions.prototype.layers; - - -/** - * @typedef {{altitudeMode: (IGCZ|string|undefined)}} - */ -olx.format.IGCOptions; - - -/** - * Altitude mode. Possible values are `barometric`, `gps`, and `none`. Default - * is `none`. - * @type {IGCZ|string|undefined} - * @api - */ -olx.format.IGCOptions.prototype.altitudeMode; - - -/** - * @typedef {{extractStyles: (boolean|undefined), - * defaultStyle: (Array.|undefined), - * showPointNames: (boolean|undefined), - * writeStyles: (boolean|undefined)}} - */ -olx.format.KMLOptions; - - -/** - * Extract styles from the KML. Default is `true`. - * @type {boolean|undefined} - * @api - */ -olx.format.KMLOptions.prototype.extractStyles; - - -/** - * Show names as labels for placemarks which contain points. Default is `true`. - * @type {boolean|undefined} - * @api - */ -olx.format.KMLOptions.prototype.showPointNames; - - -/** - * Default style. The default default style is the same as Google Earth. - * @type {Array.|undefined} - * @api - */ -olx.format.KMLOptions.prototype.defaultStyle; - - -/** - * Write styles into KML. Default is `true`. - * @type {boolean|undefined} - * @api - */ -olx.format.KMLOptions.prototype.writeStyles; - - -/** - * @typedef {{featureNS: (Object.|string|undefined), - * featureType: (Array.|string|undefined), - * srsName: string, - * surface: (boolean|undefined), - * curve: (boolean|undefined), - * multiCurve: (boolean|undefined), - * multiSurface: (boolean|undefined), - * schemaLocation: (string|undefined)}} - */ -olx.format.GMLOptions; - - -/** - * Feature namespace. If not defined will be derived from GML. If multiple - * feature types have been configured which come from different feature - * namespaces, this will be an object with the keys being the prefixes used - * in the entries of featureType array. The values of the object will be the - * feature namespaces themselves. So for instance there might be a featureType - * item `topp:states` in the `featureType` array and then there will be a key - * `topp` in the featureNS object with value `http://www.openplans.org/topp`. - * @type {Object.|string|undefined} - * @api - */ -olx.format.GMLOptions.prototype.featureNS; - - -/** - * Feature type(s) to parse. If multiple feature types need to be configured - * which come from different feature namespaces, `featureNS` will be an object - * with the keys being the prefixes used in the entries of featureType array. - * The values of the object will be the feature namespaces themselves. - * 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`. - * @type {Array.|string|undefined} - * @api - */ -olx.format.GMLOptions.prototype.featureType; - - -/** - * srsName to use when writing geometries. - * @type {string} - * @api - */ -olx.format.GMLOptions.prototype.srsName; - - -/** - * Write gml:Surface instead of gml:Polygon elements. This also affects the - * elements in multi-part geometries. Default is `false`. - * @type {boolean|undefined} - * @api - */ -olx.format.GMLOptions.prototype.surface; - - -/** - * Write gml:Curve instead of gml:LineString elements. This also affects the - * elements in multi-part geometries. Default is `false`. - * @type {boolean|undefined} - * @api - */ -olx.format.GMLOptions.prototype.curve; - - -/** - * Write gml:MultiCurve instead of gml:MultiLineString. Since the latter is - * deprecated in GML 3, the default is `true`. - * @type {boolean|undefined} - * @api - */ -olx.format.GMLOptions.prototype.multiCurve; - - -/** - * Write gml:multiSurface instead of gml:MultiPolygon. Since the latter is - * deprecated in GML 3, the default is `true`. - * @type {boolean|undefined} - * @api - */ -olx.format.GMLOptions.prototype.multiSurface; - - -/** - * Optional schemaLocation to use when writing out the GML, this will override - * the default provided. - * @type {string|undefined} - * @api - */ -olx.format.GMLOptions.prototype.schemaLocation; - - -/** - * @typedef {{readExtensions: (function(ol.Feature, Node)|undefined)}} - */ -olx.format.GPXOptions; - - -/** - * Callback function to process `extensions` nodes. - * To prevent memory leaks, this callback function must - * not store any references to the node. Note that the `extensions` - * node is not allowed in GPX 1.0. Moreover, only `extensions` - * nodes from `wpt`, `rte` and `trk` can be processed, as those are - * directly mapped to a feature. - * @type {function(ol.Feature, Node)|undefined} - * @api - */ -olx.format.GPXOptions.prototype.readExtensions; - - -/** - * @typedef {{featureNS: (Object.|string|undefined), - * featureType: (Array.|string|undefined), - * gmlFormat: (ol.format.GMLBase|undefined), - * schemaLocation: (string|undefined)}} - */ -olx.format.WFSOptions; - - -/** - * The namespace URI used for features. - * @type {Object.|string|undefined} - * @api - */ -olx.format.WFSOptions.prototype.featureNS; - - -/** - * The feature type to parse. Only used for read operations. - * @type {Array.|string|undefined} - * @api - */ -olx.format.WFSOptions.prototype.featureType; - - -/** - * The GML format to use to parse the response. Default is `ol.format.GML3`. - * @type {ol.format.GMLBase|undefined} - * @api - */ -olx.format.WFSOptions.prototype.gmlFormat; - - -/** - * Optional schemaLocation to use for serialization, this will override the - * default. - * @type {string|undefined} - * @api - */ -olx.format.WFSOptions.prototype.schemaLocation; - - -/** - * @typedef {{featureNS: string, - * featurePrefix: string, - * featureTypes: Array., - * srsName: (string|undefined), - * handle: (string|undefined), - * outputFormat: (string|undefined), - * maxFeatures: (number|undefined), - * geometryName: (string|undefined), - * propertyNames: (Array.|undefined), - * startIndex: (number|undefined), - * count: (number|undefined), - * bbox: (ol.Extent|undefined), - * filter: (ol.format.filter.Filter|undefined), - * resultType: (string|undefined)}} - */ -olx.format.WFSWriteGetFeatureOptions; - - -/** - * The namespace URI used for features. - * @type {string} - * @api - */ -olx.format.WFSWriteGetFeatureOptions.prototype.featureNS; - - -/** - * The prefix for the feature namespace. - * @type {string} - * @api - */ -olx.format.WFSWriteGetFeatureOptions.prototype.featurePrefix; - - -/** - * The feature type names. - * @type {Array.} - * @api - */ -olx.format.WFSWriteGetFeatureOptions.prototype.featureTypes; - - -/** - * SRS name. No srsName attribute will be set on geometries when this is not - * provided. - * @type {string|undefined} - * @api - */ -olx.format.WFSWriteGetFeatureOptions.prototype.srsName; - - -/** - * Handle. - * @type {string|undefined} - * @api - */ -olx.format.WFSWriteGetFeatureOptions.prototype.handle; - - -/** - * Output format. - * @type {string|undefined} - * @api - */ -olx.format.WFSWriteGetFeatureOptions.prototype.outputFormat; - - -/** - * Maximum number of features to fetch. - * @type {number|undefined} - * @api - */ -olx.format.WFSWriteGetFeatureOptions.prototype.maxFeatures; - - -/** - * Geometry name to use in a BBOX filter. - * @type {string|undefined} - * @api - */ -olx.format.WFSWriteGetFeatureOptions.prototype.geometryName; - - -/** - * Optional list of property names to serialize. - * @type {Array.|undefined} - * @api - */ -olx.format.WFSWriteGetFeatureOptions.prototype.propertyNames; - - -/** - * Start index to use for WFS paging. This is a WFS 2.0 feature backported to - * WFS 1.1.0 by some Web Feature Services. - * @type {number|undefined} - * @api - */ -olx.format.WFSWriteGetFeatureOptions.prototype.startIndex; - - -/** - * Number of features to retrieve when paging. This is a WFS 2.0 feature - * backported to WFS 1.1.0 by some Web Feature Services. Please note that some - * Web Feature Services have repurposed `maxfeatures` instead. - * @type {number|undefined} - * @api - */ -olx.format.WFSWriteGetFeatureOptions.prototype.count; - - -/** - * Extent to use for the BBOX filter. - * @type {ol.Extent|undefined} - * @api - */ -olx.format.WFSWriteGetFeatureOptions.prototype.bbox; - - -/** - * Filter condition. See {@link ol.format.filter} for more information. - * @type {ol.format.filter.Filter|undefined} - * @api - */ -olx.format.WFSWriteGetFeatureOptions.prototype.filter; - - -/** - * Indicates what response should be returned, E.g. `hits` only includes the - * `numberOfFeatures` attribute in the response and no features. - * @type {string|undefined} - * @api - */ -olx.format.WFSWriteGetFeatureOptions.prototype.resultType; - - -/** - * @typedef {{featureNS: string, - * featurePrefix: string, - * featureType: string, - * srsName: (string|undefined), - * handle: (string|undefined), - * hasZ: (boolean|undefined), - * nativeElements: Array., - * gmlOptions: (olx.format.GMLOptions|undefined), - * version: (string|undefined)}} - */ -olx.format.WFSWriteTransactionOptions; - - -/** - * The namespace URI used for features. - * @type {string} - * @api - */ -olx.format.WFSWriteTransactionOptions.prototype.featureNS; - - -/** - * The prefix for the feature namespace. - * @type {string} - * @api - */ -olx.format.WFSWriteTransactionOptions.prototype.featurePrefix; - - -/** - * The feature type name. - * @type {string} - * @api - */ -olx.format.WFSWriteTransactionOptions.prototype.featureType; - - -/** - * SRS name. No srsName attribute will be set on geometries when this is not - * provided. - * @type {string|undefined} - * @api - */ -olx.format.WFSWriteTransactionOptions.prototype.srsName; - - -/** - * Handle. - * @type {string|undefined} - * @api - */ -olx.format.WFSWriteTransactionOptions.prototype.handle; - - -/** - * Must be set to true if the transaction is for a 3D layer. This will allow - * the Z coordinate to be included in the transaction. - * @type {boolean|undefined} - * @api - */ -olx.format.WFSWriteTransactionOptions.prototype.hasZ; - - -/** - * Native elements. Currently not supported. - * @type {Array.} - * @api - */ -olx.format.WFSWriteTransactionOptions.prototype.nativeElements; - - -/** - * GML options for the WFS transaction writer. - * @type {olx.format.GMLOptions|undefined} - * @api - */ -olx.format.WFSWriteTransactionOptions.prototype.gmlOptions; - - -/** - * WFS version to use for the transaction. Can be either `1.0.0` or `1.1.0`. - * Default is `1.1.0`. - * @type {string|undefined} - * @api - */ -olx.format.WFSWriteTransactionOptions.prototype.version; - - -/** - * @typedef {{splitCollection: (boolean|undefined)}} - */ -olx.format.WKTOptions; - - -/** - * Whether to split GeometryCollections into - * multiple features on reading. Default is `false`. - * @type {boolean|undefined} - * @api - */ -olx.format.WKTOptions.prototype.splitCollection; - - -/** - * @typedef {{ - * layers: (Array.|undefined) - * }} - */ -olx.format.WMSGetFeatureInfoOptions; - - -/** - * If set, only features of the given layers will be returned by the format - * when read. - * @type {Array.|undefined} - * @api - */ -olx.format.WMSGetFeatureInfoOptions.prototype.layers; - - /** * @typedef {{duration: (number|undefined), * delta: (number|undefined)}} diff --git a/externs/xol.js b/externs/xol.js index 3869f024f6..b3e1c6091c 100644 --- a/externs/xol.js +++ b/externs/xol.js @@ -1,236 +1,4 @@ -/** - * @typedef {Object} format_ReadOptions - * @property {ol.ProjectionLike} dataProjection Projection of the data we are reading. If not provided, the projection will - * be derived from the data (where possible) or the `defaultDataProjection` of - * the format is assigned (where set). If the projection can not be derived from - * the data and if no `defaultDataProjection` is set for a format, the features - * will not be reprojected. - * @property {ol.Extent} extent Tile extent of the tile being read. This is only used and required for - * {@link ol.format.MVT}. - * @property {ol.ProjectionLike} featureProjection Projection of the feature geometries created by the format reader. If not - * provided, features will be returned in the `dataProjection`. - */ - - -/** - * @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 - * @property {ol.ProjectionLike} defaultDataProjection Default data projection. Default is `EPSG:4326`. - * @property {ol.ProjectionLike} featureProjection Projection for features read or written by the format. Options passed to - * read or write methods will take precedence. - * @property {string|undefined} geometryName Geometry name to use when creating features. - * @property {boolean|undefined} extractGeometryName Certain GeoJSON providers include the geometry_name field in the feature - * geoJSON. If set to `true` the geoJSON reader will look for that field to - * set the geometry name. If both this field is set to `true` and a - * `geometryName` is provided, the `geometryName` will take precedence. - * Default is `false`. - */ - - -/** - * @typedef {Object} format_EsriJSONOptions - * @property {string|undefined} geometryName Geometry name to use when creating features. - */ - - -/** - * @typedef {Object} format_MVTOptions - * @property {undefined|function((ol.geom.Geometry|Object.)=)| function(ol.geom.GeometryType,Array., - (Array.|Array.>),Object.,number)} - featureClass Class for features returned by {@link ol.format.MVT#readFeatures}. Set to - * {@link ol.Feature} to get full editing and geometry support at the cost of - * decreased rendering performance. The default is {@link ol.render.Feature}, - * which is optimized for rendering and hit detection. - * @property {string|undefined} geometryName Geometry name to use when creating features. Default is 'geometry'. - * @property {string|undefined} layerName Name of the feature attribute that holds the layer name. Default is 'layer'. - * @property {Array.|undefined} layers Layers to read features from. If not provided, features will be read from all - * layers. - */ - - -/** - * @typedef {Object} format_PolylineOptions - * @property {number|undefined} factor The factor by which the coordinates values will be scaled. - * Default is `1e5`. - * @property {ol.geom.GeometryLayout|undefined} geometryLayout Layout of the feature geometries created by the format reader. - * Default is `ol.geom.GeometryLayout.XY`. - */ - - -/** - * @typedef {Object} format_TopoJSONOptions - * @property {ol.ProjectionLike} defaultDataProjection Default data projection. Default is `EPSG:4326`. - * @property {string|undefined} layerName Set the name of the TopoJSON topology `objects`'s children as feature - * property with the specified name. This means that when set to `'layer'`, a - * topology like - * ``` - * { - * "type": "Topology", - * "objects": { - * "example": { - * "type": "GeometryCollection", - * "geometries": [] - * } - * } - * } - * ``` - * will result in features that have a property `'layer'` set to `'example'`. - * When not set, no property will be added to features. - * @property {Array.|undefined} layers Names of the TopoJSON topology's `objects`'s children to read features from. - * If not provided, features will be read from all children. - */ - - -/** - * @typedef {Object} format_IGCOptions - * @property {IGCZ|string|undefined} altitudeMode Altitude mode. Possible values are `barometric`, `gps`, and `none`. Default - * is `none`. - */ - - -/** - * @typedef {Object} format_KMLOptions - * @property {boolean|undefined} extractStyles Extract styles from the KML. Default is `true`. - * @property {boolean|undefined} showPointNames Show names as labels for placemarks which contain points. Default is `true`. - * @property {Array.|undefined} defaultStyle Default style. The default default style is the same as Google Earth. - * @property {boolean|undefined} writeStyles Write styles into KML. Default is `true`. - */ - - -/** - * @typedef {Object} format_GMLOptions - * @property {Object.|string|undefined} featureNS Feature namespace. If not defined will be derived from GML. If multiple - * feature types have been configured which come from different feature - * namespaces, this will be an object with the keys being the prefixes used - * in the entries of featureType array. The values of the object will be the - * feature namespaces themselves. So for instance there might be a featureType - * item `topp:states` in the `featureType` array and then there will be a key - * `topp` in the featureNS object with value `http://www.openplans.org/topp`. - * @property {Array.|string|undefined} featureType Feature type(s) to parse. If multiple feature types need to be configured - * which come from different feature namespaces, `featureNS` will be an object - * with the keys being the prefixes used in the entries of featureType array. - * The values of the object will be the feature namespaces themselves. - * 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 {boolean|undefined} surface Write gml:Surface instead of gml:Polygon elements. This also affects the - * elements in multi-part geometries. Default is `false`. - * @property {boolean|undefined} curve Write gml:Curve instead of gml:LineString elements. This also affects the - * elements in multi-part geometries. Default is `false`. - * @property {boolean|undefined} multiCurve Write gml:MultiCurve instead of gml:MultiLineString. Since the latter is - * deprecated in GML 3, the default is `true`. - * @property {boolean|undefined} multiSurface Write gml:multiSurface instead of gml:MultiPolygon. Since the latter is - * deprecated in GML 3, the default is `true`. - * @property {string|undefined} schemaLocation Optional schemaLocation to use when writing out the GML, this will override - * the default provided. - */ - - -/** - * @typedef {Object} format_GPXOptions - * @property {function(ol.Feature, Node)|undefined} readExtensions Callback function to process `extensions` nodes. - * To prevent memory leaks, this callback function must - * not store any references to the node. Note that the `extensions` - * node is not allowed in GPX 1.0. Moreover, only `extensions` - * nodes from `wpt`, `rte` and `trk` can be processed, as those are - * directly mapped to a feature. - */ - - -/** - * @typedef {Object} format_WFSOptions - * @property {Object.|string|undefined} featureNS The namespace URI used for features. - * @property {Array.|string|undefined} featureType The feature type to parse. Only used for read operations. - * @property {ol.format.GMLBase|undefined} gmlFormat The GML format to use to parse the response. Default is `ol.format.GML3`. - * @property {string|undefined} schemaLocation Optional schemaLocation to use for serialization, this will override the - * default. - */ - - -/** - * @typedef {Object} format_WFSWriteGetFeatureOptions - * @property {string} featureNS The namespace URI used for features. - * @property {string} featurePrefix The prefix for the feature namespace. - * @property {Array.} featureTypes The feature type names. - * @property {string|undefined} srsName SRS name. No srsName attribute will be set on geometries when this is not - * provided. - * @property {string|undefined} handle Handle. - * @property {string|undefined} outputFormat Output format. - * @property {number|undefined} maxFeatures Maximum number of features to fetch. - * @property {string|undefined} geometryName Geometry name to use in a BBOX filter. - * @property {Array.|undefined} propertyNames Optional list of property names to serialize. - * @property {number|undefined} startIndex Start index to use for WFS paging. This is a WFS 2.0 feature backported to - * WFS 1.1.0 by some Web Feature Services. - * @property {number|undefined} count Number of features to retrieve when paging. This is a WFS 2.0 feature - * backported to WFS 1.1.0 by some Web Feature Services. Please note that some - * Web Feature Services have repurposed `maxfeatures` instead. - * @property {ol.Extent|undefined} bbox Extent to use for the BBOX filter. - * @property {ol.format.filter.Filter|undefined} filter Filter condition. See {@link ol.format.filter} for more information. - * @property {string|undefined} resultType Indicates what response should be returned, E.g. `hits` only includes the - * `numberOfFeatures` attribute in the response and no features. - */ - - -/** - * @typedef {Object} format_WFSWriteTransactionOptions - * @property {string} featureNS The namespace URI used for features. - * @property {string} featurePrefix The prefix for the feature namespace. - * @property {string} featureType The feature type name. - * @property {string|undefined} srsName SRS name. No srsName attribute will be set on geometries when this is not - * provided. - * @property {string|undefined} handle Handle. - * @property {boolean|undefined} hasZ Must be set to true if the transaction is for a 3D layer. This will allow - * the Z coordinate to be included in the transaction. - * @property {Array.} nativeElements Native elements. Currently not supported. - * @property {olx.format.GMLOptions|undefined} gmlOptions GML options for the WFS transaction writer. - * @property {string|undefined} version WFS version to use for the transaction. Can be either `1.0.0` or `1.1.0`. - * Default is `1.1.0`. - */ - - -/** - * @typedef {Object} format_WKTOptions - * @property {boolean|undefined} splitCollection Whether to split GeometryCollections into - * multiple features on reading. Default is `false`. - */ - - -/** - * @typedef {Object} format_WMSGetFeatureInfoOptions - * @property {Array.|undefined} layers If set, only features of the given layers will be returned by the format - * when read. - */ - - /** * @typedef {Object} interaction_DoubleClickZoomOptions * @property {number|undefined} duration Animation duration in milliseconds. Default is `250`. diff --git a/src/ol/format/EsriJSON.js b/src/ol/format/EsriJSON.js index a0afd0c536..5ad0bab99e 100644 --- a/src/ol/format/EsriJSON.js +++ b/src/ol/format/EsriJSON.js @@ -37,7 +37,7 @@ GEOMETRY_READERS[GeometryType.MULTI_POLYGON] = readMultiPolygonGeometry; /** * @const - * @type {Object.} + * @type {Object.} */ const GEOMETRY_WRITERS = {}; GEOMETRY_WRITERS[GeometryType.POINT] = writePointGeometry; @@ -48,13 +48,19 @@ GEOMETRY_WRITERS[GeometryType.MULTI_LINE_STRING] = writeMultiLineStringGeometry; GEOMETRY_WRITERS[GeometryType.MULTI_POLYGON] = writeMultiPolygonGeometry; +/** + * @typedef {Object} Options + * @property {string|undefined} geometryName Geometry name to use when creating features. + */ + + /** * @classdesc * Feature format for reading and writing data in the EsriJSON format. * * @constructor * @extends {ol.format.JSONFeature} - * @param {olx.format.EsriJSONOptions=} opt_options Options. + * @param {module:ol/format/EsriJSON~Options=} opt_options Options. * @api */ const EsriJSON = function(opt_options) { @@ -77,7 +83,7 @@ inherits(EsriJSON, JSONFeature); /** * @param {EsriJSONGeometry} object Object. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {ol.geom.Geometry} Geometry. */ function readGeometry(object, opt_options) { @@ -261,7 +267,7 @@ function readPolygonGeometry(object) { /** * @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. */ function writePointGeometry(geometry, opt_options) { @@ -316,7 +322,7 @@ function getHasZM(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. */ function writeLineStringGeometry(geometry, opt_options) { @@ -333,7 +339,7 @@ function writeLineStringGeometry(geometry, opt_options) { /** * @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. */ function writePolygonGeometry(geometry, opt_options) { @@ -349,7 +355,7 @@ function writePolygonGeometry(geometry, opt_options) { /** * @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. */ function writeMultiLineStringGeometry(geometry, opt_options) { @@ -364,7 +370,7 @@ function writeMultiLineStringGeometry(geometry, opt_options) { /** * @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. */ function writeMultiPointGeometry(geometry, opt_options) { @@ -379,7 +385,7 @@ function writeMultiPointGeometry(geometry, opt_options) { /** * @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. */ function writeMultiPolygonGeometry(geometry, opt_options) { @@ -405,7 +411,7 @@ function writeMultiPolygonGeometry(geometry, opt_options) { * * @function * @param {ArrayBuffer|Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {ol.Feature} Feature. * @api */ @@ -418,7 +424,7 @@ EsriJSON.prototype.readFeature; * * @function * @param {ArrayBuffer|Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {Array.} Features. * @api */ @@ -474,7 +480,7 @@ EsriJSON.prototype.readFeaturesFromObject = function(object, opt_options) { * * @function * @param {ArrayBuffer|Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {ol.geom.Geometry} Geometry. * @api */ @@ -516,7 +522,7 @@ EsriJSON.prototype.readProjectionFromObject = function(object) { /** * @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. */ function writeGeometry(geometry, opt_options) { @@ -531,7 +537,7 @@ function writeGeometry(geometry, opt_options) { * * @function * @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. * @api */ @@ -542,7 +548,7 @@ EsriJSON.prototype.writeGeometry; * Encode a geometry as a EsriJSON object. * * @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. * @override * @api @@ -557,7 +563,7 @@ EsriJSON.prototype.writeGeometryObject = function(geometry, opt_options) { * * @function * @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. * @api */ @@ -568,7 +574,7 @@ EsriJSON.prototype.writeFeature; * Encode a feature as a esriJSON Feature object. * * @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. * @override * @api @@ -601,7 +607,7 @@ EsriJSON.prototype.writeFeatureObject = function(feature, opt_options) { * * @function * @param {Array.} features Features. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {string} EsriJSON. * @api */ @@ -612,7 +618,7 @@ EsriJSON.prototype.writeFeatures; * Encode an array of features as a EsriJSON object. * * @param {Array.} features Features. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {Object} EsriJSON Object. * @override * @api diff --git a/src/ol/format/Feature.js b/src/ol/format/Feature.js index b28acc098d..225487e5b5 100644 --- a/src/ol/format/Feature.js +++ b/src/ol/format/Feature.js @@ -5,6 +5,48 @@ import Geometry from '../geom/Geometry.js'; import {assign} from '../obj.js'; import {get as getProjection, equivalent as equivalentProjection, transformExtent} from '../proj.js'; + +/** + * @typedef {Object} ReadOptions + * @property {ol.ProjectionLike} dataProjection Projection of the data we are reading. + * If not provided, the projection will be derived from the data (where possible) or + * the `defaultDataProjection` of the format is assigned (where set). If the projection + * can not be derived from the data and if no `defaultDataProjection` is set for a format, + * the features will not be reprojected. + * @property {ol.Extent} extent Tile extent of the tile being read. This is only used and + * required for {@link ol.format.MVT}. + * @property {ol.ProjectionLike} featureProjection Projection of the feature geometries + * created by the format reader. If not provided, features will be returned in the + * `dataProjection`. + */ + + +/** + * @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 * Abstract base class; normally only used for creating subclasses and not @@ -38,8 +80,8 @@ const FeatureFormat = function() { /** * Adds the data projection to the read options. * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Options. - * @return {olx.format.ReadOptions|undefined} Options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Options. + * @return {module:ol/format/Feature~ReadOptions|undefined} Options. * @protected */ FeatureFormat.prototype.getReadOptions = function(source, opt_options) { @@ -58,10 +100,10 @@ FeatureFormat.prototype.getReadOptions = function(source, opt_options) { /** * Sets the `defaultDataProjection` on the options, if no `dataProjection` * is set. - * @param {olx.format.WriteOptions|olx.format.ReadOptions|undefined} options + * @param {module:ol/format/Feature~WriteOptions|module:ol/format/Feature~ReadOptions|undefined} options * Options. * @protected - * @return {olx.format.WriteOptions|olx.format.ReadOptions|undefined} + * @return {module:ol/format/Feature~WriteOptions|module:ol/format/Feature~ReadOptions|undefined} * Updated options. */ FeatureFormat.prototype.adaptOptions = function(options) { @@ -93,7 +135,7 @@ FeatureFormat.prototype.getType = function() {}; * * @abstract * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {ol.Feature} Feature. */ FeatureFormat.prototype.readFeature = function(source, opt_options) {}; @@ -104,7 +146,7 @@ FeatureFormat.prototype.readFeature = function(source, opt_options) {}; * * @abstract * @param {Document|Node|ArrayBuffer|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {Array.} Features. */ FeatureFormat.prototype.readFeatures = function(source, opt_options) {}; @@ -115,7 +157,7 @@ FeatureFormat.prototype.readFeatures = function(source, opt_options) {}; * * @abstract * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {ol.geom.Geometry} Geometry. */ FeatureFormat.prototype.readGeometry = function(source, opt_options) {}; @@ -136,7 +178,7 @@ FeatureFormat.prototype.readProjection = function(source) {}; * * @abstract * @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. */ FeatureFormat.prototype.writeFeature = function(feature, opt_options) {}; @@ -147,7 +189,7 @@ FeatureFormat.prototype.writeFeature = function(feature, opt_options) {}; * * @abstract * @param {Array.} features Features. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {string} Result. */ FeatureFormat.prototype.writeFeatures = function(features, opt_options) {}; @@ -158,7 +200,7 @@ FeatureFormat.prototype.writeFeatures = function(features, opt_options) {}; * * @abstract * @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. */ FeatureFormat.prototype.writeGeometry = function(geometry, opt_options) {}; @@ -168,7 +210,7 @@ export default FeatureFormat; /** * @param {ol.geom.Geometry|module:ol/extent~Extent} geometry Geometry. * @param {boolean} write Set to true for writing, false for reading. - * @param {(olx.format.WriteOptions|olx.format.ReadOptions)=} opt_options + * @param {(module:ol/format/Feature~WriteOptions|module:ol/format/Feature~ReadOptions)=} opt_options * Options. * @return {ol.geom.Geometry|module:ol/extent~Extent} Transformed geometry. */ diff --git a/src/ol/format/GML.js b/src/ol/format/GML.js index 88a8913ddc..c03e9b88af 100644 --- a/src/ol/format/GML.js +++ b/src/ol/format/GML.js @@ -10,7 +10,7 @@ import GML3 from '../format/GML3.js'; * Currently only supports GML 3.1.1 Simple Features profile. * * @constructor - * @param {olx.format.GMLOptions=} opt_options + * @param {module:ol/format/GMLBase~Options=} opt_options * Optional configuration object. * @extends {ol.format.GMLBase} * @api @@ -23,7 +23,7 @@ const GML = GML3; * * @function * @param {Array.} features Features. - * @param {olx.format.WriteOptions=} opt_options Options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Options. * @return {string} Result. * @api */ @@ -35,7 +35,7 @@ GML.prototype.writeFeatures; * * @function * @param {Array.} features Features. - * @param {olx.format.WriteOptions=} opt_options Options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Options. * @return {Node} Node. * @api */ diff --git a/src/ol/format/GML2.js b/src/ol/format/GML2.js index 0d1b58a6c0..fc6483a087 100644 --- a/src/ol/format/GML2.js +++ b/src/ol/format/GML2.js @@ -26,12 +26,12 @@ const schemaLocation = GMLNS + ' http://schemas.opengis.net/gml/2.1.2/feature.xs * version 2.1.2. * * @constructor - * @param {olx.format.GMLOptions=} opt_options Optional configuration object. + * @param {module:ol/format/GMLBase~Options=} opt_options Optional configuration object. * @extends {ol.format.GMLBase} * @api */ const GML2 = function(opt_options) { - const options = /** @type {olx.format.GMLOptions} */ + const options = /** @type {module:ol/format/GMLBase~Options} */ (opt_options ? opt_options : {}); GMLBase.call(this, options); @@ -282,7 +282,7 @@ GML2.prototype.writeMultiCurveOrLineString_ = function(node, geometry, objectSta * @param {Array.<*>} objectStack Node stack. */ 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); item.node = node; let value; diff --git a/src/ol/format/GML3.js b/src/ol/format/GML3.js index de128fb730..d89d9db184 100644 --- a/src/ol/format/GML3.js +++ b/src/ol/format/GML3.js @@ -37,13 +37,13 @@ const schemaLocation = GMLNS + * Currently only supports GML 3.1.1 Simple Features profile. * * @constructor - * @param {olx.format.GMLOptions=} opt_options + * @param {module:ol/format/GMLBase~Options=} opt_options * Optional configuration object. * @extends {ol.format.GMLBase} * @api */ const GML3 = function(opt_options) { - const options = /** @type {olx.format.GMLOptions} */ + const options = /** @type {module:ol/format/GMLBase~Options} */ (opt_options ? opt_options : {}); GMLBase.call(this, options); @@ -940,7 +940,7 @@ GML3.prototype.writeCurveSegments_ = function(node, line, objectStack) { * @param {Array.<*>} objectStack Node stack. */ 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); item.node = node; 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. * * @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. * @override * @api @@ -1121,7 +1121,7 @@ GML3.prototype.writeGeometryNode = function(geometry, opt_options) { * * @function * @param {Array.} features Features. - * @param {olx.format.WriteOptions=} opt_options Options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Options. * @return {string} Result. * @api */ @@ -1132,7 +1132,7 @@ GML3.prototype.writeFeatures; * Encode an array of features in the GML 3.1.1 format as an XML node. * * @param {Array.} features Features. - * @param {olx.format.WriteOptions=} opt_options Options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Options. * @return {Node} Node. * @override * @api diff --git a/src/ol/format/GMLBase.js b/src/ol/format/GMLBase.js index ccee933ae3..4833c5e112 100644 --- a/src/ol/format/GMLBase.js +++ b/src/ol/format/GMLBase.js @@ -29,6 +29,38 @@ import {getAllTextContent, getAttributeNS, makeArrayPusher, makeReplacer, parseN export const GMLNS = 'http://www.opengis.net/gml'; +/** + * @typedef {Object} Options + * @property {Object.|string|undefined} featureNS Feature + * namespace. If not defined will be derived from GML. If multiple + * feature types have been configured which come from different feature + * namespaces, this will be an object with the keys being the prefixes used + * in the entries of featureType array. The values of the object will be the + * feature namespaces themselves. So for instance there might be a featureType + * item `topp:states` in the `featureType` array and then there will be a key + * `topp` in the featureNS object with value `http://www.openplans.org/topp`. + * @property {Array.|string|undefined} featureType Feature type(s) to parse. + * If multiple feature types need to be configured + * which come from different feature namespaces, `featureNS` will be an object + * with the keys being the prefixes used in the entries of featureType array. + * The values of the object will be the feature namespaces themselves. + * 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 {boolean|undefined} surface Write gml:Surface instead of gml:Polygon + * elements. This also affects the elements in multi-part geometries. Default is `false`. + * @property {boolean|undefined} curve Write gml:Curve instead of gml:LineString + * elements. This also affects the elements in multi-part geometries. Default is `false`. + * @property {boolean|undefined} multiCurve Write gml:MultiCurve instead of gml:MultiLineString. + * Since the latter is deprecated in GML 3, the default is `true`. + * @property {boolean|undefined} multiSurface Write gml:multiSurface instead of + * gml:MultiPolygon. Since the latter is deprecated in GML 3, the default is `true`. + * @property {string|undefined} schemaLocation Optional schemaLocation to use when + * writing out the GML, this will override the default provided. + */ + + /** * @classdesc * Abstract base class; normally only used for creating subclasses and not @@ -40,12 +72,12 @@ export const GMLNS = 'http://www.opengis.net/gml'; * * @constructor * @abstract - * @param {olx.format.GMLOptions=} opt_options + * @param {module:ol/format/GMLBase~Options=} opt_options * Optional configuration object. * @extends {ol.format.XMLFeature} */ const GMLBase = function(opt_options) { - const options = /** @type {olx.format.GMLOptions} */ (opt_options ? opt_options : {}); + const options = /** @type {module:ol/format/GMLBase~Options} */ (opt_options ? opt_options : {}); /** * @protected @@ -540,7 +572,7 @@ GMLBase.prototype.readGeometryFromNode = function(node, opt_options) { * * @function * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Options. * @return {Array.} Features. * @api */ diff --git a/src/ol/format/GPX.js b/src/ol/format/GPX.js index d363cfc62d..27aafd3962 100644 --- a/src/ol/format/GPX.js +++ b/src/ol/format/GPX.js @@ -17,13 +17,25 @@ import {createElementNS, makeArrayPusher, makeArraySerializer, makeChildAppender OBJECT_PROPERTY_NODE_FACTORY, parseNode, pushParseAndPop, pushSerializeAndPop, setAttributeNS} from '../xml.js'; + +/** + * @typedef {Object} Options + * @property {function(ol.Feature, Node)|undefined} readExtensions Callback function + * to process `extensions` nodes. To prevent memory leaks, this callback function must + * not store any references to the node. Note that the `extensions` + * node is not allowed in GPX 1.0. Moreover, only `extensions` + * nodes from `wpt`, `rte` and `trk` can be processed, as those are + * directly mapped to a feature. + */ + + /** * @classdesc * Feature format for reading and writing data in the GPX format. * * @constructor * @extends {ol.format.XMLFeature} - * @param {olx.format.GPXOptions=} opt_options Options. + * @param {module:ol/format/GPX~Options=} opt_options Options. * @api */ const GPX = function(opt_options) { @@ -522,7 +534,7 @@ function parseTrkSeg(node, objectStack) { * @return {ol.Feature|undefined} Track. */ function readRte(node, objectStack) { - const options = /** @type {olx.format.ReadOptions} */ (objectStack[0]); + const options = /** @type {module:ol/format/Feature~ReadOptions} */ (objectStack[0]); const values = pushParseAndPop({ 'flatCoordinates': [], 'layoutOptions': {} @@ -551,7 +563,7 @@ function readRte(node, objectStack) { * @return {ol.Feature|undefined} Track. */ function readTrk(node, objectStack) { - const options = /** @type {olx.format.ReadOptions} */ (objectStack[0]); + const options = /** @type {module:ol/format/Feature~ReadOptions} */ (objectStack[0]); const values = pushParseAndPop({ 'flatCoordinates': [], 'ends': [], @@ -583,7 +595,7 @@ function readTrk(node, objectStack) { * @return {ol.Feature|undefined} Waypoint. */ function readWpt(node, objectStack) { - const options = /** @type {olx.format.ReadOptions} */ (objectStack[0]); + const options = /** @type {module:ol/format/Feature~ReadOptions} */ (objectStack[0]); const values = pushParseAndPop({}, WPT_PARSERS, node, objectStack); if (!values) { return undefined; @@ -625,7 +637,7 @@ GPX.prototype.handleReadExtensions_ = function(features) { * * @function * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {ol.Feature} Feature. * @api */ @@ -659,7 +671,7 @@ GPX.prototype.readFeatureFromNode = function(node, opt_options) { * * @function * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {Array.} Features. * @api */ @@ -768,7 +780,7 @@ function writeWptType(node, coordinate, objectStack) { * @param {Array.<*>} objectStack Object stack. */ 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 context = {node: node, 'properties': properties}; let geometry = feature.getGeometry(); @@ -792,7 +804,7 @@ function writeRte(node, feature, objectStack) { * @param {Array.<*>} objectStack Object stack. */ 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(); /** @type {module:ol/xml~NodeStackItem} */ const context = {node: node, 'properties': properties}; @@ -832,7 +844,7 @@ function writeTrkSeg(node, lineString, objectStack) { * @param {Array.<*>} objectStack Object stack. */ 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]; context['properties'] = feature.getProperties(); let geometry = feature.getGeometry(); @@ -852,7 +864,7 @@ function writeWpt(node, feature, objectStack) { * * @function * @param {Array.} features Features. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {string} Result. * @api */ @@ -865,7 +877,7 @@ GPX.prototype.writeFeatures; * as tracks (``). * * @param {Array.} features Features. - * @param {olx.format.WriteOptions=} opt_options Options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Options. * @return {Node} Node. * @override * @api diff --git a/src/ol/format/GeoJSON.js b/src/ol/format/GeoJSON.js index 3a1a0aa423..a1ff628aac 100644 --- a/src/ol/format/GeoJSON.js +++ b/src/ol/format/GeoJSON.js @@ -19,13 +19,29 @@ import Polygon from '../geom/Polygon.js'; import {assign, isEmpty} from '../obj.js'; import {get as getProjection} from '../proj.js'; + +/** + * @typedef {Object} Options + * @property {ol.ProjectionLike} defaultDataProjection Default data projection. + * Default is `EPSG:4326`. + * @property {ol.ProjectionLike} featureProjection Projection for features read or + * written by the format. Options passed to read or write methods will take precedence. + * @property {string|undefined} geometryName Geometry name to use when creating features. + * @property {boolean|undefined} extractGeometryName Certain GeoJSON providers include + * the geometry_name field in the feature GeoJSON. If set to `true` the GeoJSON reader + * will look for that field to set the geometry name. If both this field is set to `true` + * and a `geometryName` is provided, the `geometryName` will take precedence. + * Default is `false`. + */ + + /** * @classdesc * Feature format for reading and writing data in the GeoJSON format. * * @constructor * @extends {ol.format.JSONFeature} - * @param {olx.format.GeoJSONOptions=} opt_options Options. + * @param {module:ol/format/GeoJSON~Options=} opt_options Options. * @api */ const GeoJSON = function(opt_options) { @@ -82,7 +98,7 @@ const GEOMETRY_READERS = { /** * @const - * @type {Object.} + * @type {Object.} */ const GEOMETRY_WRITERS = { 'Point': writePointGeometry, @@ -98,7 +114,7 @@ const GEOMETRY_WRITERS = { /** * @param {GeoJSONGeometry|GeoJSONGeometryCollection} object Object. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {ol.geom.Geometry} Geometry. */ function readGeometry(object, opt_options) { @@ -114,7 +130,7 @@ function readGeometry(object, opt_options) { /** * @param {GeoJSONGeometryCollection} object Object. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {ol.geom.GeometryCollection} Geometry collection. */ function readGeometryCollectionGeometry(object, opt_options) { @@ -186,7 +202,7 @@ function readPolygonGeometry(object) { /** * @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. */ function writeGeometry(geometry, opt_options) { @@ -210,7 +226,7 @@ function writeEmptyGeometryCollectionGeometry(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. */ function writeGeometryCollectionGeometry(geometry, opt_options) { @@ -228,7 +244,7 @@ function writeGeometryCollectionGeometry(geometry, opt_options) { /** * @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. */ function writeLineStringGeometry(geometry, opt_options) { @@ -241,7 +257,7 @@ function writeLineStringGeometry(geometry, opt_options) { /** * @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. */ function writeMultiLineStringGeometry(geometry, opt_options) { @@ -254,7 +270,7 @@ function writeMultiLineStringGeometry(geometry, opt_options) { /** * @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. */ function writeMultiPointGeometry(geometry, opt_options) { @@ -267,7 +283,7 @@ function writeMultiPointGeometry(geometry, opt_options) { /** * @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. */ function writeMultiPolygonGeometry(geometry, opt_options) { @@ -284,7 +300,7 @@ function writeMultiPolygonGeometry(geometry, opt_options) { /** * @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. */ function writePointGeometry(geometry, opt_options) { @@ -297,7 +313,7 @@ function writePointGeometry(geometry, opt_options) { /** * @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. */ function writePolygonGeometry(geometry, opt_options) { @@ -320,7 +336,7 @@ function writePolygonGeometry(geometry, opt_options) { * * @function * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {ol.Feature} Feature. * @api */ @@ -334,7 +350,7 @@ GeoJSON.prototype.readFeature; * * @function * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {Array.} Features. * @api */ @@ -402,7 +418,7 @@ GeoJSON.prototype.readFeaturesFromObject = function(object, opt_options) { * * @function * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {ol.geom.Geometry} Geometry. * @api */ @@ -453,7 +469,7 @@ GeoJSON.prototype.readProjectionFromObject = function(object) { * * @function * @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. * @override * @api @@ -465,7 +481,7 @@ GeoJSON.prototype.writeFeature; * Encode a feature as a GeoJSON Feature object. * * @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. * @override * @api @@ -502,7 +518,7 @@ GeoJSON.prototype.writeFeatureObject = function(feature, opt_options) { * * @function * @param {Array.} features Features. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {string} GeoJSON. * @api */ @@ -513,7 +529,7 @@ GeoJSON.prototype.writeFeatures; * Encode an array of features as a GeoJSON object. * * @param {Array.} features Features. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {GeoJSONFeatureCollection} GeoJSON Object. * @override * @api @@ -536,7 +552,7 @@ GeoJSON.prototype.writeFeaturesObject = function(features, opt_options) { * * @function * @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. * @api */ @@ -547,7 +563,7 @@ GeoJSON.prototype.writeGeometry; * Encode a geometry as a GeoJSON object. * * @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. * @override * @api diff --git a/src/ol/format/IGC.js b/src/ol/format/IGC.js index 04174e8f9c..ab0a1edac7 100644 --- a/src/ol/format/IGC.js +++ b/src/ol/format/IGC.js @@ -19,13 +19,22 @@ const IGCZ = { NONE: 'none' }; + +/** + * @typedef {Object} Options + * @property {IGCZ|string|undefined} altitudeMode Altitude mode. Possible + * values are `'barometric'`, `'gps'`, and `'none'`. Default + * is `'none'`. + */ + + /** * @classdesc * Feature format for `*.igc` flight recording files. * * @constructor * @extends {ol.format.TextFeature} - * @param {olx.format.IGCOptions=} opt_options Options. + * @param {module:ol/format/IGC~Options=} opt_options Options. * @api */ const IGC = function(opt_options) { @@ -85,7 +94,7 @@ const NEWLINE_RE = /\r\n|\r|\n/; * * @function * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {ol.Feature} Feature. * @api */ @@ -175,7 +184,7 @@ IGC.prototype.readFeatureFromText = function(text, opt_options) { * * @function * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {Array.} Features. * @api */ diff --git a/src/ol/format/JSONFeature.js b/src/ol/format/JSONFeature.js index a51a1d923e..fc77ed6c33 100644 --- a/src/ol/format/JSONFeature.js +++ b/src/ol/format/JSONFeature.js @@ -67,7 +67,7 @@ JSONFeature.prototype.readFeatures = function(source, opt_options) { /** * @abstract * @param {Object} object Object. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @protected * @return {ol.Feature} Feature. */ @@ -77,7 +77,7 @@ JSONFeature.prototype.readFeatureFromObject = function(object, opt_options) {}; /** * @abstract * @param {Object} object Object. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @protected * @return {Array.} Features. */ @@ -96,7 +96,7 @@ JSONFeature.prototype.readGeometry = function(source, opt_options) { /** * @abstract * @param {Object} object Object. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @protected * @return {ol.geom.Geometry} Geometry. */ @@ -131,7 +131,7 @@ JSONFeature.prototype.writeFeature = function(feature, opt_options) { /** * @abstract * @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. */ JSONFeature.prototype.writeFeatureObject = function(feature, opt_options) {}; @@ -148,7 +148,7 @@ JSONFeature.prototype.writeFeatures = function(features, opt_options) { /** * @abstract * @param {Array.} features Features. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {Object} Object. */ JSONFeature.prototype.writeFeaturesObject = function(features, opt_options) {}; @@ -165,7 +165,7 @@ JSONFeature.prototype.writeGeometry = function(geometry, opt_options) { /** * @abstract * @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. */ JSONFeature.prototype.writeGeometryObject = function(geometry, opt_options) {}; diff --git a/src/ol/format/KML.js b/src/ol/format/KML.js index 10ff2878eb..bd06287317 100644 --- a/src/ol/format/KML.js +++ b/src/ol/format/KML.js @@ -227,6 +227,19 @@ function createStyleDefaults() { } + +/** + * @typedef {Object} Options + * @property {boolean|undefined} extractStyles Extract styles from the KML. + * Default is `true`. + * @property {boolean|undefined} showPointNames Show names as labels for placemarks + * which contain points. Default is `true`. + * @property {Array.|undefined} defaultStyle Default style. The + * default default style is the same as Google Earth. + * @property {boolean|undefined} writeStyles Write styles into KML. Default is `true`. + */ + + /** * @classdesc * Feature format for reading and writing data in the KML format. @@ -236,7 +249,7 @@ function createStyleDefaults() { * * @constructor * @extends {ol.format.XMLFeature} - * @param {olx.format.KMLOptions=} opt_options Options. + * @param {module:ol/format/KML~Options=} opt_options Options. * @api */ const KML = function(opt_options) { @@ -1678,7 +1691,7 @@ KML.prototype.readPlacemark_ = function(node, objectStack) { if (id !== null) { feature.setId(id); } - const options = /** @type {olx.format.ReadOptions} */ (objectStack[0]); + const options = /** @type {module:ol/format/Feature~ReadOptions} */ (objectStack[0]); const geometry = object['geometry']; if (geometry) { @@ -1768,7 +1781,7 @@ KML.prototype.readSharedStyleMap_ = function(node, objectStack) { * * @function * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {ol.Feature} Feature. * @api */ @@ -1799,7 +1812,7 @@ KML.prototype.readFeatureFromNode = function(node, opt_options) { * * @function * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {Array.} Features. * @api */ @@ -2698,7 +2711,7 @@ function writePlacemark(node, feature, objectStack) { OBJECT_PROPERTY_NODE_FACTORY, values, objectStack, orderedKeys); // serialize geometry - const options = /** @type {olx.format.WriteOptions} */ (objectStack[0]); + const options = /** @type {module:ol/format/Feature~WriteOptions} */ (objectStack[0]); let geometry = feature.getGeometry(); if (geometry) { geometry = transformWithOptions(geometry, true, options); @@ -2940,7 +2953,7 @@ const KML_SERIALIZERS = makeStructureNS( * * @function * @param {Array.} features Features. - * @param {olx.format.WriteOptions=} opt_options Options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Options. * @return {string} Result. * @api */ @@ -2952,7 +2965,7 @@ KML.prototype.writeFeatures; * MultiPoints, MultiLineStrings, and MultiPolygons are output as MultiGeometries. * * @param {Array.} features Features. - * @param {olx.format.WriteOptions=} opt_options Options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Options. * @return {Node} Node. * @override * @api diff --git a/src/ol/format/MVT.js b/src/ol/format/MVT.js index 9047aa2d09..db8ed9854c 100644 --- a/src/ol/format/MVT.js +++ b/src/ol/format/MVT.js @@ -21,13 +21,30 @@ import Projection from '../proj/Projection.js'; import Units from '../proj/Units.js'; import RenderFeature from '../render/Feature.js'; + +/** + * @typedef {Object} Options + * @property {undefined|function((ol.geom.Geometry|Object.)=)|function(ol.geom.GeometryType,Array.,(Array.|Array.>),Object.,number)} featureClass + * Class for features returned by {@link ol.format.MVT#readFeatures}. Set to + * {@link ol.Feature} to get full editing and geometry support at the cost of + * decreased rendering performance. The default is {@link ol.render.Feature}, + * which is optimized for rendering and hit detection. + * @property {string|undefined} geometryName Geometry name to use when creating + * features. Default is `'geometry'`. + * @property {string|undefined} layerName Name of the feature attribute that + * holds the layer name. Default is `'layer'`. + * @property {Array.|undefined} layers Layers to read features from. If not + * provided, features will be read from all layers. + */ + + /** * @classdesc * Feature format for reading data in the Mapbox MVT format. * * @constructor * @extends {ol.format.Feature} - * @param {olx.format.MVTOptions=} opt_options Options. + * @param {module:ol/format/MVT~Options=} opt_options Options. * @api */ const MVT = function(opt_options) { @@ -279,7 +296,7 @@ function getGeometryType(type, numEnds) { * @private * @param {ol.ext.PBF} pbf PBF * @param {Object} rawFeature Raw Mapbox feature. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {ol.Feature|ol.render.Feature} Feature. */ MVT.prototype.createFeature_ = function(pbf, rawFeature, opt_options) { diff --git a/src/ol/format/OSMXML.js b/src/ol/format/OSMXML.js index 0469f03563..353935ae0e 100644 --- a/src/ol/format/OSMXML.js +++ b/src/ol/format/OSMXML.js @@ -80,7 +80,7 @@ const NODE_PARSERS = makeStructureNS( * @param {Array.<*>} objectStack Object stack. */ function readNode(node, objectStack) { - const options = /** @type {olx.format.ReadOptions} */ (objectStack[0]); + const options = /** @type {module:ol/format/Feature~ReadOptions} */ (objectStack[0]); const state = /** @type {Object} */ (objectStack[objectStack.length - 1]); const id = node.getAttribute('id'); /** @type {module:ol/coordinate~Coordinate} */ @@ -145,7 +145,7 @@ function readTag(node, objectStack) { * * @function * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {Array.} Features. * @api */ diff --git a/src/ol/format/Polyline.js b/src/ol/format/Polyline.js index d185b33d9d..0b25153cae 100644 --- a/src/ol/format/Polyline.js +++ b/src/ol/format/Polyline.js @@ -13,6 +13,16 @@ import {flipXY} from '../geom/flat/flip.js'; import {inflateCoordinates} from '../geom/flat/inflate.js'; import {get as getProjection} from '../proj.js'; + +/** + * @typedef {Object} Options + * @property {number|undefined} factor The factor by which the coordinates + * values will be scaled. Default is `1e5`. + * @property {ol.geom.GeometryLayout|undefined} geometryLayout Layout of the + * feature geometries created by the format reader. Default is `ol.geom.GeometryLayout.XY`. + */ + + /** * @classdesc * Feature format for reading and writing data in the Encoded @@ -20,8 +30,7 @@ import {get as getProjection} from '../proj.js'; * * @constructor * @extends {ol.format.TextFeature} - * @param {olx.format.PolylineOptions=} opt_options - * Optional configuration object. + * @param {module:ol/format/Polyline~Options=} opt_options Optional configuration object. * @api */ const Polyline = function(opt_options) { @@ -262,7 +271,7 @@ export function encodeUnsignedInteger(num) { * * @function * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {ol.Feature} Feature. * @api */ @@ -284,7 +293,7 @@ Polyline.prototype.readFeatureFromText = function(text, opt_options) { * * @function * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {Array.} Features. * @api */ @@ -305,7 +314,7 @@ Polyline.prototype.readFeaturesFromText = function(text, opt_options) { * * @function * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {ol.geom.Geometry} Geometry. * @api */ @@ -366,7 +375,7 @@ Polyline.prototype.writeFeaturesText = function(features, opt_options) { * * @function * @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. * @api */ diff --git a/src/ol/format/TextFeature.js b/src/ol/format/TextFeature.js index d2fdbe117d..145e4128e2 100644 --- a/src/ol/format/TextFeature.js +++ b/src/ol/format/TextFeature.js @@ -54,7 +54,7 @@ TextFeature.prototype.readFeature = function(source, opt_options) { /** * @abstract * @param {string} text Text. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @protected * @return {ol.Feature} Feature. */ @@ -72,7 +72,7 @@ TextFeature.prototype.readFeatures = function(source, opt_options) { /** * @abstract * @param {string} text Text. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @protected * @return {Array.} Features. */ @@ -90,7 +90,7 @@ TextFeature.prototype.readGeometry = function(source, opt_options) { /** * @abstract * @param {string} text Text. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @protected * @return {ol.geom.Geometry} Geometry. */ @@ -126,7 +126,7 @@ TextFeature.prototype.writeFeature = function(feature, opt_options) { /** * @abstract * @param {ol.Feature} feature Features. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @protected * @return {string} Text. */ @@ -144,7 +144,7 @@ TextFeature.prototype.writeFeatures = function(features, opt_options) { /** * @abstract * @param {Array.} features Features. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @protected * @return {string} Text. */ @@ -162,7 +162,7 @@ TextFeature.prototype.writeGeometry = function(geometry, opt_options) { /** * @abstract * @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 * @return {string} Text. */ diff --git a/src/ol/format/TopoJSON.js b/src/ol/format/TopoJSON.js index f061718d04..2fc3c52ff8 100644 --- a/src/ol/format/TopoJSON.js +++ b/src/ol/format/TopoJSON.js @@ -13,13 +13,40 @@ import Point from '../geom/Point.js'; import Polygon from '../geom/Polygon.js'; import {get as getProjection} from '../proj.js'; + +/** + * @typedef {Object} Options + * @property {ol.ProjectionLike} defaultDataProjection Default data projection. + * Default is `EPSG:4326`. + * @property {string|undefined} layerName Set the name of the TopoJSON topology + * `objects`'s children as feature property with the specified name. This means + * that when set to `'layer'`, a topology like + * ``` + * { + * "type": "Topology", + * "objects": { + * "example": { + * "type": "GeometryCollection", + * "geometries": [] + * } + * } + * } + * ``` + * will result in features that have a property `'layer'` set to `'example'`. + * When not set, no property will be added to features. + * @property {Array.|undefined} layers Names of the TopoJSON topology's + * `objects`'s children to read features from. If not provided, features will + * be read from all children. + */ + + /** * @classdesc * Feature format for reading data in the TopoJSON format. * * @constructor * @extends {ol.format.JSONFeature} - * @param {olx.format.TopoJSONOptions=} opt_options Options. + * @param {module:ol/format/TopoJSON~Options=} opt_options Options. * @api */ const TopoJSON = function(opt_options) { @@ -216,7 +243,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 {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {Array.} Array of features. */ function readFeaturesFromGeometryCollection(collection, arcs, scale, translate, property, name, opt_options) { @@ -240,7 +267,7 @@ function readFeaturesFromGeometryCollection(collection, arcs, scale, translate, * @param {string|undefined} property Property to set the `GeometryCollection`'s parent * object to. * @param {string} name Name of the `Topology`'s child object. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {ol.Feature} Feature. */ function readFeatureFromGeometry(object, arcs, scale, translate, property, name, opt_options) { diff --git a/src/ol/format/WFS.js b/src/ol/format/WFS.js index 30dafcbf97..295e982db8 100644 --- a/src/ol/format/WFS.js +++ b/src/ol/format/WFS.js @@ -17,6 +17,62 @@ import {createElementNS, isDocument, isNode, makeArrayPusher, makeChildAppender, pushParseAndPop, pushSerializeAndPop, setAttributeNS} from '../xml.js'; +/** + * @typedef {Object} Options + * @property {Object.|string|undefined} featureNS The namespace + * URI used for features. + * @property {Array.|string|undefined} featureType The feature type to parse. + * Only used for read operations. + * @property {ol.format.GMLBase|undefined} gmlFormat The GML format to use to parse + * the response. Default is `ol.format.GML3`. + * @property {string|undefined} schemaLocation Optional schemaLocation to use for + * serialization, this will override the default. + */ + + +/** + * @typedef {Object} WriteGetFeatureOptions + * @property {string} featureNS The namespace URI used for features. + * @property {string} featurePrefix The prefix for the feature namespace. + * @property {Array.} featureTypes The feature type names. + * @property {string|undefined} srsName SRS name. No srsName attribute will be set on + * geometries when this is not provided. + * @property {string|undefined} handle Handle. + * @property {string|undefined} outputFormat Output format. + * @property {number|undefined} maxFeatures Maximum number of features to fetch. + * @property {string|undefined} geometryName Geometry name to use in a BBOX filter. + * @property {Array.|undefined} propertyNames Optional list of property names to serialize. + * @property {number|undefined} startIndex Start index to use for WFS paging. This is a + * WFS 2.0 feature backported to WFS 1.1.0 by some Web Feature Services. + * @property {number|undefined} count Number of features to retrieve when paging. This is a + * WFS 2.0 feature backported to WFS 1.1.0 by some Web Feature Services. Please note that some + * Web Feature Services have repurposed `maxfeatures` instead. + * @property {ol.Extent|undefined} bbox Extent to use for the BBOX filter. + * @property {ol.format.filter.Filter|undefined} filter Filter condition. See + * {@link ol.format.filter} for more information. + * @property {string|undefined} resultType Indicates what response should be returned, + * E.g. `hits` only includes the `numberOfFeatures` attribute in the response and no features. + */ + + +/** + * @typedef {Object} WriteTransactionOptions + * @property {string} featureNS The namespace URI used for features. + * @property {string} featurePrefix The prefix for the feature namespace. + * @property {string} featureType The feature type name. + * @property {string|undefined} srsName SRS name. No srsName attribute will be set on + * geometries when this is not provided. + * @property {string|undefined} handle Handle. + * @property {boolean|undefined} hasZ Must be set to true if the transaction is for + * a 3D layer. This will allow the Z coordinate to be included in the transaction. + * @property {Array.} nativeElements Native elements. Currently not supported. + * @property {module:ol/format/GMLBase~Options|undefined} gmlOptions GML options for + * the WFS transaction writer. + * @property {string|undefined} version WFS version to use for the transaction. Can be + * either `1.0.0` or `1.1.0`. Default is `1.1.0`. + */ + + /** * @type {string} */ @@ -71,8 +127,7 @@ const DEFAULT_VERSION = '1.1.0'; * Also see {@link ol.format.GMLBase} which is used by this format. * * @constructor - * @param {olx.format.WFSOptions=} opt_options - * Optional configuration object. + * @param {module:ol/format/WFS~Options=} opt_options Optional configuration object. * @extends {ol.format.XMLFeature} * @api */ @@ -132,7 +187,7 @@ WFS.prototype.setFeatureType = function(featureType) { * * @function * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {Array.} Features. * @api */ @@ -878,7 +933,7 @@ function writeGetFeature(node, featureTypes, objectStack) { /** * Encode format as WFS `GetFeature` and return the Node. * - * @param {olx.format.WFSWriteGetFeatureOptions} options Options. + * @param {module:ol/format/WFS~WriteGetFeatureOptions} options Options. * @return {Node} Result. * @api */ @@ -945,7 +1000,7 @@ WFS.prototype.writeGetFeature = function(options) { * @param {Array.} inserts The features to insert. * @param {Array.} updates The features to update. * @param {Array.} deletes The features to delete. - * @param {olx.format.WFSWriteTransactionOptions} options Write options. + * @param {module:ol/format/WFS~WriteTransactionOptions} options Write options. * @return {Node} Result. * @api */ diff --git a/src/ol/format/WKT.js b/src/ol/format/WKT.js index aff1f9948a..e07deec019 100644 --- a/src/ol/format/WKT.js +++ b/src/ol/format/WKT.js @@ -17,6 +17,13 @@ import Polygon from '../geom/Polygon.js'; import SimpleGeometry from '../geom/SimpleGeometry.js'; +/** + * @typedef {Object} Options + * @property {boolean|undefined} splitCollection Whether to split GeometryCollections into + * multiple features on reading. Default is `false`. + */ + + /** * @const * @type {string} @@ -526,7 +533,7 @@ Parser.prototype.formatErrorMessage_ = function() { * * @constructor * @extends {ol.format.TextFeature} - * @param {olx.format.WKTOptions=} opt_options Options. + * @param {module:ol/format/WKT~Options=} opt_options Options. * @api */ const WKT = function(opt_options) { @@ -718,7 +725,7 @@ WKT.prototype.parse_ = function(wkt) { * * @function * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {ol.Feature} Feature. * @api */ @@ -744,7 +751,7 @@ WKT.prototype.readFeatureFromText = function(text, opt_options) { * * @function * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {Array.} Features. * @api */ @@ -779,7 +786,7 @@ WKT.prototype.readFeaturesFromText = function(text, opt_options) { * * @function * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {ol.geom.Geometry} Geometry. * @api */ @@ -856,7 +863,7 @@ Parser.prototype.parseGeometry_ = function() { * * @function * @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. * @api */ @@ -880,7 +887,7 @@ WKT.prototype.writeFeatureText = function(feature, opt_options) { * * @function * @param {Array.} features Features. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {string} WKT string. * @api */ @@ -908,7 +915,7 @@ WKT.prototype.writeFeaturesText = function(features, opt_options) { * * @function * @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. * @api */ diff --git a/src/ol/format/WMSGetFeatureInfo.js b/src/ol/format/WMSGetFeatureInfo.js index 79e47e3fd1..cc7e393cc1 100644 --- a/src/ol/format/WMSGetFeatureInfo.js +++ b/src/ol/format/WMSGetFeatureInfo.js @@ -8,6 +8,14 @@ import XMLFeature from '../format/XMLFeature.js'; import {assign} from '../obj.js'; import {makeArrayPusher, makeStructureNS, pushParseAndPop} from '../xml.js'; + +/** + * @typedef {Object} Options + * @property {Array.|undefined} layers If set, only features of the + * given layers will be returned by the format when read. + */ + + /** * @classdesc * Format for reading WMSGetFeatureInfo format. It uses @@ -15,7 +23,7 @@ import {makeArrayPusher, makeStructureNS, pushParseAndPop} from '../xml.js'; * * @constructor * @extends {ol.format.XMLFeature} - * @param {olx.format.WMSGetFeatureInfoOptions=} opt_options Options. + * @param {module:ol/format/WMSGetFeatureInfo~Options=} opt_options Options. * @api */ const WMSGetFeatureInfo = function(opt_options) { @@ -143,7 +151,7 @@ WMSGetFeatureInfo.prototype.readFeatures_ = function(node, objectStack) { * * @function * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Options. * @return {Array.} Features. * @api */ diff --git a/src/ol/format/XMLFeature.js b/src/ol/format/XMLFeature.js index 33efdf772e..d7d7aae2f5 100644 --- a/src/ol/format/XMLFeature.js +++ b/src/ol/format/XMLFeature.js @@ -58,7 +58,7 @@ XMLFeature.prototype.readFeature = function(source, opt_options) { /** * @param {Document} doc Document. - * @param {olx.format.ReadOptions=} opt_options Options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Options. * @return {ol.Feature} Feature. */ XMLFeature.prototype.readFeatureFromDocument = function(doc, opt_options) { @@ -73,7 +73,7 @@ XMLFeature.prototype.readFeatureFromDocument = function(doc, opt_options) { /** * @param {Node} node Node. - * @param {olx.format.ReadOptions=} opt_options Options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Options. * @return {ol.Feature} Feature. */ XMLFeature.prototype.readFeatureFromNode = function(node, opt_options) { @@ -101,7 +101,7 @@ XMLFeature.prototype.readFeatures = function(source, opt_options) { /** * @param {Document} doc Document. - * @param {olx.format.ReadOptions=} opt_options Options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Options. * @protected * @return {Array.} Features. */ @@ -120,7 +120,7 @@ XMLFeature.prototype.readFeaturesFromDocument = function(doc, opt_options) { /** * @abstract * @param {Node} node Node. - * @param {olx.format.ReadOptions=} opt_options Options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Options. * @protected * @return {Array.} Features. */ @@ -147,7 +147,7 @@ XMLFeature.prototype.readGeometry = function(source, opt_options) { /** * @param {Document} doc Document. - * @param {olx.format.ReadOptions=} opt_options Options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Options. * @protected * @return {ol.geom.Geometry} Geometry. */ @@ -158,7 +158,7 @@ XMLFeature.prototype.readGeometryFromDocument = function(doc, opt_options) { /** * @param {Node} node Node. - * @param {olx.format.ReadOptions=} opt_options Options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Options. * @protected * @return {ol.geom.Geometry} Geometry. */ @@ -215,7 +215,7 @@ XMLFeature.prototype.writeFeature = function(feature, opt_options) { /** * @param {ol.Feature} feature Feature. - * @param {olx.format.WriteOptions=} opt_options Options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Options. * @protected * @return {Node} Node. */ @@ -235,7 +235,7 @@ XMLFeature.prototype.writeFeatures = function(features, opt_options) { /** * @param {Array.} features Features. - * @param {olx.format.WriteOptions=} opt_options Options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Options. * @return {Node} Node. */ 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 {olx.format.WriteOptions=} opt_options Options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Options. * @return {Node} Node. */ XMLFeature.prototype.writeGeometryNode = function(geometry, opt_options) { diff --git a/src/ol/interaction/DragAndDrop.js b/src/ol/interaction/DragAndDrop.js index ee20fb4e1a..4160e2d633 100644 --- a/src/ol/interaction/DragAndDrop.js +++ b/src/ol/interaction/DragAndDrop.js @@ -236,7 +236,7 @@ DragAndDrop.prototype.setMap = function(map) { /** * @param {ol.format.Feature} format Format. * @param {string} text Text. - * @param {olx.format.ReadOptions} options Read options. + * @param {module:ol/format/Feature~ReadOptions} options Read options. * @private * @return {Array.} Features. */