Remove goog.isDef from formats

This commit is contained in:
Tim Schaub
2015-09-21 05:51:45 +09:00
parent 5350e9ba37
commit 1fceb4a709
11 changed files with 138 additions and 141 deletions
+6 -7
View File
@@ -26,7 +26,7 @@ goog.require('ol.proj');
*/
ol.format.TopoJSON = function(opt_options) {
var options = goog.isDef(opt_options) ? opt_options : {};
var options = opt_options ? opt_options : {};
goog.base(this);
@@ -251,8 +251,7 @@ ol.format.TopoJSON.readFeatureFromGeometry_ = function(object, arcs,
var geometry;
var type = object.type;
var geometryReader = ol.format.TopoJSON.GEOMETRY_READERS_[type];
goog.asserts.assert(goog.isDef(geometryReader),
'geometryReader should be defined');
goog.asserts.assert(geometryReader, 'geometryReader should be defined');
if ((type === 'Point') || (type === 'MultiPoint')) {
geometry = geometryReader(object, scale, translate);
} else {
@@ -261,10 +260,10 @@ ol.format.TopoJSON.readFeatureFromGeometry_ = function(object, arcs,
var feature = new ol.Feature();
feature.setGeometry(/** @type {ol.geom.Geometry} */ (
ol.format.Feature.transformWithOptions(geometry, false, opt_options)));
if (goog.isDef(object.id)) {
if (object.id) {
feature.setId(object.id);
}
if (goog.isDef(object.properties)) {
if (object.properties) {
feature.setProperties(object.properties);
}
return feature;
@@ -290,13 +289,13 @@ ol.format.TopoJSON.prototype.readFeaturesFromObject = function(
if (object.type == 'Topology') {
var topoJSONTopology = /** @type {TopoJSONTopology} */ (object);
var transform, scale = null, translate = null;
if (goog.isDef(topoJSONTopology.transform)) {
if (topoJSONTopology.transform) {
transform = topoJSONTopology.transform;
scale = transform.scale;
translate = transform.translate;
}
var arcs = topoJSONTopology.arcs;
if (goog.isDef(transform)) {
if (transform) {
ol.format.TopoJSON.transformArcs_(arcs, scale, translate);
}
/** @type {Array.<ol.Feature>} */