回答:
レイヤーを定義するときに、styleMapsも指定できます。
_layer = new OpenLayers.Layer.Vector("My Layer Name", {
styleMap: new OpenLayers.StyleMap({
"default": new OpenLayers.Style({
strokeColor: "#ff0000",
strokeOpacity: .7,
strokeWidth: 1,
fillColor: "#ff0000",
fillOpacity: 0,
cursor: "pointer"
}),
"temporary": new OpenLayers.Style({
strokeColor: "#ffff33",
strokeOpacity: .9,
strokeWidth: 2,
fillColor: "#ffff33",
fillOpacity: .3,
cursor: "pointer"
}),
"select": new OpenLayers.Style({
strokeColor: "#0033ff",
strokeOpacity: .7,
strokeWidth: 2,
fillColor: "#0033ff",
fillOpacity: 0,
graphicZIndex: 2,
cursor: "pointer"
})
})
});
次にあなたを指定してくださいrenderintent
:
_highlightControl = new OpenLayers.Control.SelectFeature(layer, {
hover: true,
highlightOnly: true,
renderIntent: "temporary"
});