mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-19 15:08:23 +02:00
Use numerical IDs to save memory
This commit is contained in:
+5
-5
@@ -35,7 +35,7 @@ iD.Connection = function() {
|
||||
var nodes = [], nelems = obj.getElementsByTagName('nd');
|
||||
for (var i = 0; i < nelems.length; i++) {
|
||||
var item = nelems[i];
|
||||
nodes.push(item.attributes.ref.nodeValue);
|
||||
nodes.push(+item.attributes.ref.nodeValue);
|
||||
}
|
||||
return nodes;
|
||||
}
|
||||
@@ -55,7 +55,7 @@ iD.Connection = function() {
|
||||
|
||||
for (var i = 0; i < elems.length; i++) {
|
||||
var item = elems[i];
|
||||
var id = item.attributes.ref.nodeValue,
|
||||
var id = +item.attributes.ref.nodeValue,
|
||||
type = item.attributes.type.nodeValue,
|
||||
role = item.attributes.role.nodeValue;
|
||||
|
||||
@@ -74,10 +74,10 @@ iD.Connection = function() {
|
||||
function objectData(obj) {
|
||||
return {
|
||||
type: obj.nodeName,
|
||||
id: obj.attributes.id.nodeValue,
|
||||
id: +obj.attributes.id.nodeValue,
|
||||
tags: getTags(obj),
|
||||
lat: (obj.attributes.lat) ? obj.attributes.lat.nodeValue : null,
|
||||
lon: (obj.attributes.lon) ? obj.attributes.lon.nodeValue : null,
|
||||
lat: (obj.attributes.lat) ? +obj.attributes.lat.nodeValue : null,
|
||||
lon: (obj.attributes.lon) ? +obj.attributes.lon.nodeValue : null,
|
||||
members: getMembers(obj),
|
||||
nodes: getNodes(obj)
|
||||
};
|
||||
|
||||
@@ -3,8 +3,6 @@ iD.Node = function(id, lat, lon, tags, loaded) {
|
||||
this._id = iD.Util.id();
|
||||
this.lat = lat;
|
||||
this.lon = lon;
|
||||
this[0] = lon;
|
||||
this[1] = lat;
|
||||
this.tags = tags || {};
|
||||
this.loaded = (loaded === undefined) ? true : loaded;
|
||||
};
|
||||
|
||||
@@ -113,7 +113,8 @@ iD.Map = function(obj) {
|
||||
|
||||
function nodeline(d) {
|
||||
return linegen(d.children.map(function(n) {
|
||||
return connection.graph().index[n];
|
||||
var node = connection.graph().index[n];
|
||||
return [node.lon, node.lat];
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user