Revert "protect for in loops with hasOwnProperty"

This reverts commit e3cc96dbfb.
This commit is contained in:
Éric Lemoine
2012-03-03 22:35:39 +01:00
parent 161b54b6f1
commit 9a116b21b9
31 changed files with 267 additions and 386 deletions
+32 -38
View File
@@ -140,35 +140,33 @@ OpenLayers.Format.OSM = OpenLayers.Class(OpenLayers.Format.XML, {
feat_list[i] = feat;
}
for (var node_id in nodes) {
if (nodes.hasOwnProperty(node_id)) {
var node = nodes[node_id];
if (!node.used || this.checkTags) {
var tags = null;
var node = nodes[node_id];
if (!node.used || this.checkTags) {
var tags = null;
if (this.checkTags) {
var result = this.getTags(node.node, true);
if (node.used && !result[1]) {
continue;
}
tags = result[0];
} else {
tags = this.getTags(node.node);
}
if (this.checkTags) {
var result = this.getTags(node.node, true);
if (node.used && !result[1]) {
continue;
}
tags = result[0];
} else {
tags = this.getTags(node.node);
}
var feat = new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.Point(node['lon'], node['lat']),
tags);
if (this.internalProjection && this.externalProjection) {
feat.geometry.transform(this.externalProjection,
this.internalProjection);
}
feat.osm_id = parseInt(node_id);
feat.fid = "node." + feat.osm_id;
feat_list.push(feat);
}
// Memory cleanup
node.node = null;
}
var feat = new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.Point(node['lon'], node['lat']),
tags);
if (this.internalProjection && this.externalProjection) {
feat.geometry.transform(this.externalProjection,
this.internalProjection);
}
feat.osm_id = parseInt(node_id);
feat.fid = "node." + feat.osm_id;
feat_list.push(feat);
}
// Memory cleanup
node.node = null;
}
return feat_list;
},
@@ -275,11 +273,9 @@ OpenLayers.Format.OSM = OpenLayers.Class(OpenLayers.Format.XML, {
}
if (this.checkTags) {
for(var key in way.tags) {
if (way.tags.hasOwnProperty(key)) {
if (this.areaTags[key]) {
poly_tags = true;
break;
}
if (this.areaTags[key]) {
poly_tags = true;
break;
}
}
}
@@ -434,12 +430,10 @@ OpenLayers.Format.OSM = OpenLayers.Class(OpenLayers.Format.XML, {
*/
serializeTags: function(feature, node) {
for (var key in feature.attributes) {
if (feature.attributes.hasOwnProperty(key)) {
var tag = this.createElementNS(null, "tag");
tag.setAttribute("k", key);
tag.setAttribute("v", feature.attributes[key]);
node.appendChild(tag);
}
var tag = this.createElementNS(null, "tag");
tag.setAttribute("k", key);
tag.setAttribute("v", feature.attributes[key]);
node.appendChild(tag);
}
},