git-svn-id: http://svn.openlayers.org/trunk/openlayers@89 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
46 lines
1.3 KiB
JavaScript
46 lines
1.3 KiB
JavaScript
OpenLayers.Marker = Class.create();
|
|
OpenLayers.Marker.prototype = {
|
|
|
|
// icon: {OpenLayers.Icon} for marker
|
|
icon: null,
|
|
|
|
// latlon: {OpenLayers.LatLon} location of object
|
|
latlon: null,
|
|
|
|
|
|
/** the data object associated with the marker
|
|
* @type Object */
|
|
data: null,
|
|
|
|
// events
|
|
events: null,
|
|
|
|
// map
|
|
map: null,
|
|
|
|
initialize: function(icon, latlon) {
|
|
this.icon = icon;
|
|
this.latlon = latlon;
|
|
},
|
|
|
|
draw: function() {
|
|
var resolution = this.map.getResolution();
|
|
var extent = this.map.getExtent();
|
|
if (this.latlon.lat > extent.minlat &&
|
|
this.latlon.lat < extent.maxlat &&
|
|
this.lonlon.lon > extent.minlon &&
|
|
this.lonlon.lon < extent.maxlon) {
|
|
var pixel = new OpenLayers.Pixel(
|
|
resolution * (this.latlon.lon - extent.minlon),
|
|
resolution * (extent.maxlat - this.latlon.lat)
|
|
);
|
|
// need to account for how much layer has moved...
|
|
/* Psuedocode:
|
|
div = map.markersDiv;
|
|
marker = OpenLayers.Util.createDiv('marker'+rand(), pixel, this.icon.size, null, this.icon.url);
|
|
div.appendChild(marker);
|
|
*/
|
|
}
|
|
}
|
|
}
|