The layer adds the marker to the div. Therefore, some of the code needs to move into the layer: the marker needs to know how to generate an HTML object that will represent it.

git-svn-id: http://svn.openlayers.org/trunk/openlayers@102 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2006-05-17 16:20:08 +00:00
parent 24c4b03d07
commit 1720fee550
2 changed files with 16 additions and 23 deletions

View File

@@ -12,5 +12,16 @@ OpenLayers.Layer.Marker.prototype =
// Implement this. It may not need to do anything usually.
moveTo:function(bounds,zoomChanged) {
}
},
addMarker:function(marker) {
this.markers.append(marker);
var resolution = this.map.getResolution();
var extent = this.map.getExtent();
var pixel = new OpenLayers.Pixel(
resolution * (this.lonlat.lon - extent.minlon),
resolution * (extent.maxlat - this.lonlat.lat)
);
var m = marker.generateMarker(pixel);
this.div.appendChild(m);
},
});