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:
+16
-31
@@ -19,9 +19,6 @@ OpenLayers.Feature.prototype= {
|
|||||||
/** @type Object */
|
/** @type Object */
|
||||||
data:null,
|
data:null,
|
||||||
|
|
||||||
/** @type OpenLayers.Icon */
|
|
||||||
icon: null,
|
|
||||||
|
|
||||||
/** @type OpenLayers.Marker */
|
/** @type OpenLayers.Marker */
|
||||||
marker: null,
|
marker: null,
|
||||||
|
|
||||||
@@ -40,7 +37,7 @@ OpenLayers.Feature.prototype= {
|
|||||||
this.layer = layer;
|
this.layer = layer;
|
||||||
this.lonlat = lonlat;
|
this.lonlat = lonlat;
|
||||||
this.data = (data != null) ? data : new Object();
|
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() {
|
createMarker: function() {
|
||||||
|
|
||||||
var imgLocation = OpenLayers.Util.getImagesLocation();
|
var marker = null;
|
||||||
|
|
||||||
if (this.lonlat != null) {
|
if (this.lonlat != null) {
|
||||||
|
this.marker = new OpenLayers.Marker(this.lonlat, this.data.icon);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
return this.marker;
|
return this.marker;
|
||||||
},
|
},
|
||||||
@@ -84,16 +71,14 @@ OpenLayers.Feature.prototype= {
|
|||||||
|
|
||||||
if (this.lonlat != null) {
|
if (this.lonlat != null) {
|
||||||
|
|
||||||
if (this.marker) {
|
var id = this.id + "_popup";
|
||||||
var anchorSize = this.marker.icon.size;
|
var anchor = (this.marker) ? this.marker.icon : null;
|
||||||
}
|
|
||||||
|
this.popup = new OpenLayers.Popup.AnchoredBubble(id,
|
||||||
this.popup =
|
this.lonlat,
|
||||||
new OpenLayers.Popup.AnchoredBubble(this.id + "_popup",
|
this.data.popupSize,
|
||||||
this.lonlat,
|
this.data.popupContentHTML,
|
||||||
this.data.popupSize,
|
anchor);
|
||||||
this.data.popupContentHTML,
|
|
||||||
anchorSize);
|
|
||||||
}
|
}
|
||||||
return this.popup;
|
return this.popup;
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user