Move Options to ol/format/GMLBase

This commit is contained in:
Tim Schaub
2018-03-11 22:15:11 -06:00
parent 458383c7d3
commit 2091629922
6 changed files with 42 additions and 134 deletions

View File

@@ -5,100 +5,6 @@
let olx; let olx;
/**
* @typedef {{featureNS: (Object.<string, string>|string|undefined),
* featureType: (Array.<string>|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, string>|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>|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)}} * @typedef {{readExtensions: (function(ol.Feature, Node)|undefined)}}
*/ */
@@ -304,7 +210,7 @@ olx.format.WFSWriteGetFeatureOptions.prototype.resultType;
* handle: (string|undefined), * handle: (string|undefined),
* hasZ: (boolean|undefined), * hasZ: (boolean|undefined),
* nativeElements: Array.<Object>, * nativeElements: Array.<Object>,
* gmlOptions: (olx.format.GMLOptions|undefined), * gmlOptions: (module:ol/format/GMLBase~Options|undefined),
* version: (string|undefined)}} * version: (string|undefined)}}
*/ */
olx.format.WFSWriteTransactionOptions; olx.format.WFSWriteTransactionOptions;
@@ -370,7 +276,7 @@ olx.format.WFSWriteTransactionOptions.prototype.nativeElements;
/** /**
* GML options for the WFS transaction writer. * GML options for the WFS transaction writer.
* @type {olx.format.GMLOptions|undefined} * @type {module:ol/format/GMLBase~Options|undefined}
* @api * @api
*/ */
olx.format.WFSWriteTransactionOptions.prototype.gmlOptions; olx.format.WFSWriteTransactionOptions.prototype.gmlOptions;

View File

@@ -1,34 +1,4 @@
/**
* @typedef {Object} format_GMLOptions
* @property {Object.<string, string>|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>|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 * @typedef {Object} format_GPXOptions
* @property {function(ol.Feature, Node)|undefined} readExtensions Callback function to process `extensions` nodes. * @property {function(ol.Feature, Node)|undefined} readExtensions Callback function to process `extensions` nodes.
@@ -85,7 +55,7 @@
* @property {boolean|undefined} hasZ Must be set to true if the transaction is for a 3D layer. This will allow * @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. * the Z coordinate to be included in the transaction.
* @property {Array.<Object>} nativeElements Native elements. Currently not supported. * @property {Array.<Object>} nativeElements Native elements. Currently not supported.
* @property {olx.format.GMLOptions|undefined} gmlOptions GML options for the WFS transaction writer. * @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`. * @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`. * Default is `1.1.0`.
*/ */

View File

@@ -10,7 +10,7 @@ import GML3 from '../format/GML3.js';
* Currently only supports GML 3.1.1 Simple Features profile. * Currently only supports GML 3.1.1 Simple Features profile.
* *
* @constructor * @constructor
* @param {olx.format.GMLOptions=} opt_options * @param {module:ol/format/GMLBase~Options=} opt_options
* Optional configuration object. * Optional configuration object.
* @extends {ol.format.GMLBase} * @extends {ol.format.GMLBase}
* @api * @api

View File

@@ -26,12 +26,12 @@ const schemaLocation = GMLNS + ' http://schemas.opengis.net/gml/2.1.2/feature.xs
* version 2.1.2. * version 2.1.2.
* *
* @constructor * @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} * @extends {ol.format.GMLBase}
* @api * @api
*/ */
const GML2 = function(opt_options) { const GML2 = function(opt_options) {
const options = /** @type {olx.format.GMLOptions} */ const options = /** @type {module:ol/format/GMLBase~Options} */
(opt_options ? opt_options : {}); (opt_options ? opt_options : {});
GMLBase.call(this, options); GMLBase.call(this, options);

View File

@@ -37,13 +37,13 @@ const schemaLocation = GMLNS +
* Currently only supports GML 3.1.1 Simple Features profile. * Currently only supports GML 3.1.1 Simple Features profile.
* *
* @constructor * @constructor
* @param {olx.format.GMLOptions=} opt_options * @param {module:ol/format/GMLBase~Options=} opt_options
* Optional configuration object. * Optional configuration object.
* @extends {ol.format.GMLBase} * @extends {ol.format.GMLBase}
* @api * @api
*/ */
const GML3 = function(opt_options) { const GML3 = function(opt_options) {
const options = /** @type {olx.format.GMLOptions} */ const options = /** @type {module:ol/format/GMLBase~Options} */
(opt_options ? opt_options : {}); (opt_options ? opt_options : {});
GMLBase.call(this, options); GMLBase.call(this, options);

View File

@@ -29,6 +29,38 @@ import {getAllTextContent, getAttributeNS, makeArrayPusher, makeReplacer, parseN
export const GMLNS = 'http://www.opengis.net/gml'; export const GMLNS = 'http://www.opengis.net/gml';
/**
* @typedef {Object} Options
* @property {Object.<string, string>|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>|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 * @classdesc
* Abstract base class; normally only used for creating subclasses and not * Abstract base class; normally only used for creating subclasses and not
@@ -40,12 +72,12 @@ export const GMLNS = 'http://www.opengis.net/gml';
* *
* @constructor * @constructor
* @abstract * @abstract
* @param {olx.format.GMLOptions=} opt_options * @param {module:ol/format/GMLBase~Options=} opt_options
* Optional configuration object. * Optional configuration object.
* @extends {ol.format.XMLFeature} * @extends {ol.format.XMLFeature}
*/ */
const GMLBase = function(opt_options) { 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 * @protected