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

View File

@@ -326,12 +326,12 @@ ol.layer.Vector.prototype.parseFeatures = function(data, parser, projection) {
var callback = function(feature, type) {
return lookup[type];
};
if (typeof data === 'string') {
goog.asserts.assert(typeof parser.readFeaturesFromString === 'function',
if (goog.isString(data)) {
goog.asserts.assert(goog.isFunction(parser.readFeaturesFromString),
'Expected a parser with readFeaturesFromString method.');
features = parser.readFeaturesFromString(data, {callback: callback});
} else if (typeof data === 'object') {
goog.asserts.assert(typeof parser.readFeaturesFromObject === 'function',
} else if (goog.isObject(data)) {
goog.asserts.assert(goog.isFunction(parser.readFeaturesFromObject),
'Expected a parser with a readFeaturesFromObject method.');
features = parser.readFeaturesFromObject(data, {callback: callback});
} else {

View File

@@ -84,7 +84,7 @@ goog.inherits(ol.parser.ogc.ExceptionReport, ol.parser.XML);
* @return {Object} Information about the exceptions that occurred.
*/
ol.parser.ogc.ExceptionReport.prototype.read = function(data) {
if (typeof data == 'string') {
if (goog.isString(data)) {
data = goog.dom.xml.loadXml(data);
}
var exceptionInfo = {};

View File

@@ -14,12 +14,12 @@ ol.parser.ogc.Versioned = function(opt_options) {
this.defaultVersion = options.defaultVersion || null;
this.version = options.version;
this.profile = options.profile;
if (options.allowFallback !== undefined) {
if (goog.isDef(options.allowFallback)) {
this.allowFallback = options.allowFallback;
} else {
this.allowFallback = false;
}
if (options.stringifyOutput !== undefined) {
if (goog.isDef(options.stringifyOutput)) {
this.stringifyOutput = options.stringifyOutput;
} else {
this.stringifyOutput = false;
@@ -103,7 +103,7 @@ ol.parser.ogc.Versioned.prototype.write = function(obj, opt_options) {
* @return {Object} An object representing the document.
*/
ol.parser.ogc.Versioned.prototype.read = function(data, opt_options) {
if (typeof data == 'string') {
if (goog.isString(data)) {
data = goog.dom.xml.loadXml(data);
}
var root = data.documentElement;

View File

@@ -230,10 +230,10 @@ ol.parser.ogc.WMSCapabilities_v1 = function() {
layer['prefix'] = parts[0];
}
capability['layers'].push(layer);
if (layer['formats'] === undefined) {
if (!goog.isDef(layer['formats'])) {
layer['formats'] = request['getmap']['formats'];
}
if (layer['infoFormats'] === undefined && gfi) {
if (!goog.isDef(layer['infoFormats']) && gfi) {
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.
*/
ol.parser.ogc.WMSCapabilities_v1.prototype.read = function(data) {
if (typeof data == 'string') {
if (goog.isString(data)) {
data = goog.dom.xml.loadXml(data);
}
if (data && data.nodeType == 9) {

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.
*/
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);
}
if (data && data.nodeType == 9) {