I am using a custom OpenLayers control to change the style of the icon on a feature. It looks something like this:
StyleFeature = OpenLayers.Class(OpenLayers.Control, {
layer = null,
style = null,
initialize: function (layer, style, options) {
OpenLayers.Control.prototype.initialize.apply(this, [options]);
this.layer = layer;
this.style = style;
},
activate: function() {
this.layer.styleMap.styles["default"] = this.style;
this.layer.styleMap.styles["temporary"] = this.style;
this.layer.styleMap.styles["select"] = this.style;
return OpenLayers.Control.prototype.activate.apply(this, arguments);
},
CLASS_NAME: "OpenLayers.Control.StyleFeature"
});
This works well, but I'd like to use the externalGraphic from the style I'm passing in to put an image tag on the OpenLayers control itself. My only styling options seem to be through css at the moment.
Any ideas?