Fill out more of Icon and Marker classes. In the XP world, supposedly we test first -- and I actually did in this case. Kind of a nifty trick: you work out what the function is supposed to do solely from the tests you want to write, and then you go and actually write the code that does it.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@87 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -6,8 +6,35 @@ OpenLayers.Marker.prototype = {
|
||||
|
||||
// latlon: {OpenLayers.LatLon} location of object
|
||||
latlon: null,
|
||||
|
||||
// events
|
||||
events: null,
|
||||
|
||||
// map
|
||||
map: null,
|
||||
|
||||
initialize: function(icon, latlon) {
|
||||
this.icon = icon;
|
||||
this.latlon = latlon;
|
||||
},
|
||||
|
||||
initialize: function() {
|
||||
|
||||
}
|
||||
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);
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user