git-svn-id: http://svn.openlayers.org/trunk/openlayers@215 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
58 lines
1.4 KiB
JavaScript
58 lines
1.4 KiB
JavaScript
OpenLayers.Marker = Class.create();
|
||
OpenLayers.Marker.prototype = {
|
||
|
||
/** @type OpenLayers.Icon */
|
||
icon: null,
|
||
|
||
/** location of object
|
||
* @type OpenLayers.LonLat */
|
||
lonlat: null,
|
||
|
||
/** the data object associated with the marker
|
||
* @type Object */
|
||
data: null,
|
||
|
||
/** @type */
|
||
events: null,
|
||
|
||
/** @type OpenLayers.Map */
|
||
map: null,
|
||
|
||
object: null,
|
||
|
||
events:null,
|
||
|
||
/**
|
||
* @param {OpenLayers.Icon} icon
|
||
* @param {OpenLayers.LonLat lonlat
|
||
*/
|
||
initialize: function(lonlat, icon) {
|
||
this.icon = icon;
|
||
this.lonlat = lonlat;
|
||
this.object = OpenLayers.Util.createImage(
|
||
this.icon.url,
|
||
this.icon.size
|
||
);
|
||
this.events = new OpenLayers.Events(this, this.object, null);
|
||
},
|
||
|
||
/**
|
||
* @param {OpenLayers.Pixel} pixel
|
||
*
|
||
* @return A new DOM Image with this marker´s icon set at the
|
||
* location passed-in
|
||
* @type DOMElement
|
||
*/
|
||
generateMarker: function(pixel) {
|
||
// Create a div here, and set the location to the pixel above modified
|
||
// by the icon size.
|
||
this.object.style.top = (pixel.y+this.icon.offset.y) + "px"
|
||
this.object.style.left = (pixel.x+this.icon.offset.x) + "px";
|
||
this.object.style.position = "absolute";
|
||
return this.object;
|
||
},
|
||
|
||
/** @final @type String */
|
||
CLASS_NAME: "OpenLayers.Marker"
|
||
}
|