Add Feature.createMarker method. Not complete yet.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@212 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -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 += "<div style='height: 1.5em; overflow: hidden'>"
|
||||
contentHTML += "<span style='font-size: 1.2em; font-weight: bold'>"
|
||||
contentHTML += this.data['title'];
|
||||
contentHTML += this.data.title;
|
||||
contentHTML += "</span>"
|
||||
contentHTML += "</div>"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user