move the typedefs out of objectliterals

This commit is contained in:
Bart van den Eijnden
2013-11-25 14:29:00 +01:00
parent 279c358af2
commit d564b5170c
3 changed files with 28 additions and 28 deletions
-14
View File
@@ -595,20 +595,6 @@
* calculations. * calculations.
*/ */
/**
* @typedef {Object} ol.parser.WFSOptions
* @property {string} featureNS The feature namespace to use.
* @property {string} featurePrefix The prefix for the namespace.
* @property {Array.<string>} featureTypes The feature types to use.
*/
/**
* @typedef {Object} ol.parser.WFSNative
* @property {string} vendorId The vendor id to use.
* @property {boolean} safeToIgnore Is it safe to ignore?
* @property {string} value The value of the Native element.
*/
/** /**
* @typedef {Object} ol.source.BingMapsOptions * @typedef {Object} ol.source.BingMapsOptions
* @property {string|undefined} culture Culture code. Default is `en-us`. * @property {string|undefined} culture Culture code. Default is `en-us`.
+19 -3
View File
@@ -3,6 +3,22 @@ goog.require('goog.dom.xml');
goog.require('ol.parser.XML'); goog.require('ol.parser.XML');
/**
* @typedef {{featureNS: string,
featurePrefix: string,
featureTypes: Array.<string>,
handle: string,
outputFormat: string,
nativeElements: Array.<{
vendorId: string,
safeToIgnore: boolean,
value: string
}>,
maxFeatures: number}}
*/
ol.parser.WFSWriteOptions;
/** /**
* @constructor * @constructor
@@ -21,7 +37,7 @@ ol.parser.ogc.WFS_v1 = function() {
this.writers = {}; this.writers = {};
this.writers[this.defaultNamespaceURI] = { this.writers[this.defaultNamespaceURI] = {
'GetFeature': function(options) { 'GetFeature': function(options) {
options = /** @type {ol.parser.WFSOptions} */(options); options = /** @type {ol.parser.WFSWriteOptions} */(options);
var node = this.createElementNS('wfs:GetFeature'); var node = this.createElementNS('wfs:GetFeature');
node.setAttribute('service', 'WFS'); node.setAttribute('service', 'WFS');
node.setAttribute('version', this.version); node.setAttribute('version', this.version);
@@ -47,7 +63,7 @@ ol.parser.ogc.WFS_v1 = function() {
}, },
'Transaction': function(obj) { 'Transaction': function(obj) {
obj = obj || {}; obj = obj || {};
var options = obj.options || {}; var options = /** {ol.parser.WFSWriteOptions} */(obj.options || {});
var node = this.createElementNS('wfs:Transaction'); var node = this.createElementNS('wfs:Transaction');
node.setAttribute('service', 'WFS'); node.setAttribute('service', 'WFS');
node.setAttribute('version', this.version); node.setAttribute('version', this.version);
@@ -152,7 +168,7 @@ ol.parser.ogc.WFS_v1.prototype.read = function(data) {
/** /**
* @param {Array.<ol.Feature>} features The features to write out. * @param {Array.<ol.Feature>} features The features to write out.
* @param {Object} options Write options. * @param {ol.parser.WFSWriteOptions} options Write options.
* @return {string} A serialized WFS transaction. * @return {string} A serialized WFS transaction.
*/ */
ol.parser.ogc.WFS_v1.prototype.write = function(features, options) { ol.parser.ogc.WFS_v1.prototype.write = function(features, options) {
+9 -11
View File
@@ -52,17 +52,15 @@ describe('ol.parser.ogc.WFS', function() {
var url = 'spec/ol/parser/ogc/xml/wfs_v1/Native.xml'; var url = 'spec/ol/parser/ogc/xml/wfs_v1/Native.xml';
afterLoadXml(url, function(xml) { afterLoadXml(url, function(xml) {
var p = new ol.parser.ogc.WFS_v1_1_0(); var p = new ol.parser.ogc.WFS_v1_1_0();
var output = p.write(null, { var output = p.write(null, {nativeElements: [{
nativeElements: [{ vendorId: 'ORACLE',
vendorId: 'ORACLE', safeToIgnore: true,
safeToIgnore: true, value: 'ALTER SESSION ENABLE PARALLEL DML'
value: 'ALTER SESSION ENABLE PARALLEL DML' }, {
}, { vendorId: 'ORACLE',
vendorId: 'ORACLE', safeToIgnore: false,
safeToIgnore: false, value: 'Another native line goes here'
value: 'Another native line goes here' }]});
}]
});
expect(goog.dom.xml.loadXml(output)).to.xmleql(xml); expect(goog.dom.xml.loadXml(output)).to.xmleql(xml);
done(); done();
}); });