我使用自定义OpenLayers控件来更改功能上图标的样式。它看起来像这样:
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"
});
这很好用,但是我想从我传入的样式中使用externalGraphic来在OpenLayers控件本身上放置一个图像标记。我目前唯一的造型选择似乎是通过CSS。
有什么想法吗?