OpenLayers 3中风风格

Fat*_*tAl 6 styles stroke openlayers-3

我想修改方法select的样式.我能够改变这种方法的风格,但我无法复制蓝色笔划的白色边框.

有人能够用笔划设置矢量样式并为笔划设置边框吗?

请参阅此示例,了解我在说什么:http: //openlayers.org/en/v3.4.0/examples/select-features.html

tsa*_*ein 12

诀窍是你有两种风格.第一种风格是绘制白色线条,第二种风格是顶部更细的蓝线:

var width = 3;
var styles = [
  new ol.style.Style({
    stroke: new ol.style.Stroke({
      color: 'white',
      width: width + 2
    })
  }),
  new ol.style.Style({
    stroke: new ol.style.Stroke({
      color: 'blue',
      width: width
    })
  })
];
Run Code Online (Sandbox Code Playgroud)