我正在使用自定义 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 实现的。
有任何想法吗?