Continued work on Layer.Text, implementing popups. Still has closure issues.

git-svn-id: http://svn.openlayers.org/trunk/openlayers@375 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2006-05-25 23:08:14 +00:00
parent 5f4a8d2b0d
commit fedfaea0bf

View File

@@ -36,7 +36,7 @@ OpenLayers.Layer.Text.prototype =
} else {
var vals = currLine.split('\t');
var location = new OpenLayers.LonLat(0,0);
var name = ""; var description = "";
var title = ""; var description = "";
var icon = new OpenLayers.Icon('http://boston.openguides.org/markers/AQUA.png',new OpenLayers.Size(10,17));
var set = false;
for (var valIndex = 0; valIndex < vals.length; valIndex++) {
@@ -52,22 +52,29 @@ OpenLayers.Layer.Text.prototype =
} else if (columns[valIndex] == 'lon') {
location.lon = parseFloat(vals[valIndex]);
set = true;
} else if (columns[valIndex] == 'locationName')
name = vals[valIndex];
} else if (columns[valIndex] == 'title')
title = vals[valIndex];
else if (columns[valIndex] == 'image')
icon.url = vals[valIndex];
else if (columns[valIndex] == 'title')
location.title = vals[valIndex];
else if (columns[valIndex] == 'description')
location.description = vals[valIndex];
title = vals[valIndex];
else if (columns[valIndex] == 'description') {
description = vals[valIndex];
}
}
}
if (set) {
this.addMarker(new OpenLayers.Marker(location,icon));
var marker = new OpenLayers.Marker(location, icon);
var popup = new OpenLayers.Popup(null, location, null, '<h2>'+title+'</h2><p>'+description+'</p>');
marker.events.register('click', this, function(evt) { this.map.addPopup(popup); Event.stop(evt); } ); //this.map.addPopup(popup); });
this.addMarker(marker);
}
}
}
}
},
testFunction: function() {
alert('tesT');
}
});