Merge pull request #494 from twpayne/use-goog-base

Use Closure type identification functions
This commit is contained in:
Tom Payne
2013-04-08 10:16:52 -07:00
5 changed files with 12 additions and 12 deletions
+4 -4
View File
@@ -326,12 +326,12 @@ ol.layer.Vector.prototype.parseFeatures = function(data, parser, projection) {
var callback = function(feature, type) { var callback = function(feature, type) {
return lookup[type]; return lookup[type];
}; };
if (typeof data === 'string') { if (goog.isString(data)) {
goog.asserts.assert(typeof parser.readFeaturesFromString === 'function', goog.asserts.assert(goog.isFunction(parser.readFeaturesFromString),
'Expected a parser with readFeaturesFromString method.'); 'Expected a parser with readFeaturesFromString method.');
features = parser.readFeaturesFromString(data, {callback: callback}); features = parser.readFeaturesFromString(data, {callback: callback});
} else if (typeof data === 'object') { } else if (goog.isObject(data)) {
goog.asserts.assert(typeof parser.readFeaturesFromObject === 'function', goog.asserts.assert(goog.isFunction(parser.readFeaturesFromObject),
'Expected a parser with a readFeaturesFromObject method.'); 'Expected a parser with a readFeaturesFromObject method.');
features = parser.readFeaturesFromObject(data, {callback: callback}); features = parser.readFeaturesFromObject(data, {callback: callback});
} else { } else {
+1 -1
View File
@@ -84,7 +84,7 @@ goog.inherits(ol.parser.ogc.ExceptionReport, ol.parser.XML);
* @return {Object} Information about the exceptions that occurred. * @return {Object} Information about the exceptions that occurred.
*/ */
ol.parser.ogc.ExceptionReport.prototype.read = function(data) { ol.parser.ogc.ExceptionReport.prototype.read = function(data) {
if (typeof data == 'string') { if (goog.isString(data)) {
data = goog.dom.xml.loadXml(data); data = goog.dom.xml.loadXml(data);
} }
var exceptionInfo = {}; var exceptionInfo = {};
+3 -3
View File
@@ -14,12 +14,12 @@ ol.parser.ogc.Versioned = function(opt_options) {
this.defaultVersion = options.defaultVersion || null; this.defaultVersion = options.defaultVersion || null;
this.version = options.version; this.version = options.version;
this.profile = options.profile; this.profile = options.profile;
if (options.allowFallback !== undefined) { if (goog.isDef(options.allowFallback)) {
this.allowFallback = options.allowFallback; this.allowFallback = options.allowFallback;
} else { } else {
this.allowFallback = false; this.allowFallback = false;
} }
if (options.stringifyOutput !== undefined) { if (goog.isDef(options.stringifyOutput)) {
this.stringifyOutput = options.stringifyOutput; this.stringifyOutput = options.stringifyOutput;
} else { } else {
this.stringifyOutput = false; this.stringifyOutput = false;
@@ -103,7 +103,7 @@ ol.parser.ogc.Versioned.prototype.write = function(obj, opt_options) {
* @return {Object} An object representing the document. * @return {Object} An object representing the document.
*/ */
ol.parser.ogc.Versioned.prototype.read = function(data, opt_options) { ol.parser.ogc.Versioned.prototype.read = function(data, opt_options) {
if (typeof data == 'string') { if (goog.isString(data)) {
data = goog.dom.xml.loadXml(data); data = goog.dom.xml.loadXml(data);
} }
var root = data.documentElement; var root = data.documentElement;
+3 -3
View File
@@ -230,10 +230,10 @@ ol.parser.ogc.WMSCapabilities_v1 = function() {
layer['prefix'] = parts[0]; layer['prefix'] = parts[0];
} }
capability['layers'].push(layer); capability['layers'].push(layer);
if (layer['formats'] === undefined) { if (!goog.isDef(layer['formats'])) {
layer['formats'] = request['getmap']['formats']; layer['formats'] = request['getmap']['formats'];
} }
if (layer['infoFormats'] === undefined && gfi) { if (!goog.isDef(layer['infoFormats']) && gfi) {
layer['infoFormats'] = gfi['formats']; layer['infoFormats'] = gfi['formats'];
} }
} }
@@ -303,7 +303,7 @@ goog.inherits(ol.parser.ogc.WMSCapabilities_v1, ol.parser.XML);
* @return {Object} An object representing the document. * @return {Object} An object representing the document.
*/ */
ol.parser.ogc.WMSCapabilities_v1.prototype.read = function(data) { ol.parser.ogc.WMSCapabilities_v1.prototype.read = function(data) {
if (typeof data == 'string') { if (goog.isString(data)) {
data = goog.dom.xml.loadXml(data); data = goog.dom.xml.loadXml(data);
} }
if (data && data.nodeType == 9) { if (data && data.nodeType == 9) {
+1 -1
View File
@@ -154,7 +154,7 @@ goog.inherits(ol.parser.ogc.WMTSCapabilities_v1_0_0, ol.parser.XML);
* @return {Object} An object representing the document. * @return {Object} An object representing the document.
*/ */
ol.parser.ogc.WMTSCapabilities_v1_0_0.prototype.read = function(data) { ol.parser.ogc.WMTSCapabilities_v1_0_0.prototype.read = function(data) {
if (typeof data == 'string') { if (goog.isString(data)) {
data = goog.dom.xml.loadXml(data); data = goog.dom.xml.loadXml(data);
} }
if (data && data.nodeType == 9) { if (data && data.nodeType == 9) {