不同颜色的边框底部在 ol.style.stroke.
Different color border-bottom in ol.style.stroke
在OpenLayers 3中,可以更改选择中的边框颜色:
style = new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'blue',
width: 2
})
});
但是可以只更改边框底部吗?
像这样:
style = new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'blue',
width: 2,
border-bottom: 2px dotted #ff9900
})
});
当然,由于可用的大量OL 3资源,您可以使用第二种样式来(模拟)边框底部。使用ol.style#GeometryFunction
.灵感来自这个例子。
http://jsfiddle.net/jonataswalker/k11bxma2/
有点不同 - http://jsfiddle.net/jonataswalker/n73gm0u9/
var style = [
new ol.style.Style({
fill: new ol.style.Fill({
color: 'rgba(255, 255, 255, 0.2)'
}),
stroke: new ol.style.Stroke({
color: 'red',
width: 2
})
}),
new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'green',
width: 2
}),
geometry: function(feature) {
var geom = feature.getGeometry();
var extent = geom.getExtent();
var bottomLeft = ol.extent.getBottomLeft(extent);
var bottomRight = ol.extent.getBottomRight(extent);
// return a linestring with the second style
return new ol.geom.LineString([bottomLeft, bottomRight]);
}
})
];
相关文章:
- document.getElementById.style.backgroundImage not working
- 为什么我可以'不要使用xx[this.index].style.display?它's说“;无法读取属性
- HEAD中LINK和STYLE元素的求值顺序
- 如何让firefox使用style['attribute name']=设置样式属性
- 更改SVG'style'元素
- "无法获取属性'的值;style'"当试图在IE中更改样式时
- placeHolder id未使用style.display显示
- 重置transform:rotate()而不调用-webkit transition:style
- 更改每个<李>元素在<ol>
- 编辑输出字符串函数ol.control.MouseControl
- 如何使主体采用等同于 style=“background-color: returnBlue()” 的样式属性,其中 r
- Vue.js-插值错误-如何将样式修改为v-bind:style
- Javascript style.background在IE中不起作用
- 为什么当我分配给element.style时,我的元素的样式没有改变
- 将运行时中的最大缩放选项更改为 ol.在开放层 3 中查看
- Greasemonkey:当style=“display: none;”发生变化时如何做某事
- 什么's D3.js中selection.style和selection.attr之间的区别
- javascript无法读取属性'style'为null
- 不同颜色的边框底部在 ol.style.stroke.
- 如何偏移ol.style.Circle或ol.style.RegularShape