have the 'data' property just set an OpenLayers.Icon object. Remove default marker image loading code as it has been bubbled down into OpenLayers.Marker.

git-svn-id: http://svn.openlayers.org/trunk/openlayers@441 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-05-29 09:50:56 +00:00
parent 1d60e57e58
commit b8d6aaed64

View File

@@ -19,9 +19,6 @@ OpenLayers.Feature.prototype= {
/** @type Object */
data:null,
/** @type OpenLayers.Icon */
icon: null,
/** @type OpenLayers.Marker */
marker: null,
@@ -40,7 +37,7 @@ OpenLayers.Feature.prototype= {
this.layer = layer;
this.lonlat = lonlat;
this.data = (data != null) ? data : new Object();
this.id = (id ? id : 'f'+Math.random());
this.id = (id ? id : 'f' + Math.random());
},
/**
@@ -52,27 +49,17 @@ OpenLayers.Feature.prototype= {
/**
*
* @returns A Marker Object created from the 'lonlat' and 'icon' properties
* set in this.data. If no 'lonlat' is set, returns null. If no
* 'icon' is set, OpenLayers.Marker() will load the default image
* @type OpenLayers.Marker
*/
createMarker: function() {
var imgLocation = OpenLayers.Util.getImagesLocation();
var marker = null;
if (this.lonlat != null) {
var imgURL = (this.data.iconURL) ? this.data.iconURL
: imgLocation + "marker.png";
var imgSize = (this.data.iconSize) ? this.data.iconSize
: new OpenLayers.Size(21, 25);
var imgOffset = (this.data.iconOffset) ? this.data.iconOffset
: null;
this.icon = new OpenLayers.Icon(imgURL, imgSize, imgOffset);
this.marker = new OpenLayers.Marker(this.lonlat,
this.icon);
this.marker = new OpenLayers.Marker(this.lonlat, this.data.icon);
}
return this.marker;
},
@@ -84,16 +71,14 @@ OpenLayers.Feature.prototype= {
if (this.lonlat != null) {
if (this.marker) {
var anchorSize = this.marker.icon.size;
}
this.popup =
new OpenLayers.Popup.AnchoredBubble(this.id + "_popup",
this.lonlat,
this.data.popupSize,
this.data.popupContentHTML,
anchorSize);
var id = this.id + "_popup";
var anchor = (this.marker) ? this.marker.icon : null;
this.popup = new OpenLayers.Popup.AnchoredBubble(id,
this.lonlat,
this.data.popupSize,
this.data.popupContentHTML,
anchor);
}
return this.popup;
},