diff --git a/lib/OpenLayers/Feature.js b/lib/OpenLayers/Feature.js index 6ebf057a8f..c1f09e4e06 100644 --- a/lib/OpenLayers/Feature.js +++ b/lib/OpenLayers/Feature.js @@ -19,6 +19,23 @@ OpenLayers.Feature.prototype= { }, + createMarker: function(layer) { + if (this.lonlat && this.data.iconURL + && this.data.iconW + && this.data.iconH) { + var size = new OpenLayers.Size(this.data.iconW, this.data.iconH); + var icon = new OpenLayers.Icon(this.data.iconURL, size); + var marker = new OpenLayers.Marker(icon,this.lonlat); + if (this.title) { + var popup = new OpenLayers.Popup(this.latlon, + this.getContentHTML()); + marker.events.register('click', this, popup.open()); + } + this.marker = marker; + layer.addMarker(marker); + } + }, + /** html content based on feature information * * ret(str): @@ -31,7 +48,7 @@ OpenLayers.Feature.prototype= { contentHTML += "
" contentHTML += "" - contentHTML += this.data['title']; + contentHTML += this.data.title; contentHTML += "" contentHTML += "
"