首页 / 浏览问题 / 云GIS / 问题详情
绘制多个要素时怎么采用不同的样式
6EXP 2019年03月05日

通过DrawFeature绘制要素点时,通过featureadded和beforefeatureadded事件,修改了feature的style属性,但是并没有按照我设置的颜色进行绘制

function drawCompleted(eventArgs) {
    drawPoint.deactivate();
    var f = eventArgs.feature;
    console.log(f);
    //f.style = style;
}
function drawbefore(eventArgs){
    var f = eventArgs.feature;
    f.style = style;
    f.style.fillColor = fillColor;
    console.log(f);
}
style = {
    fillColor:"red",
    fillOpacity: 1,
    hoverFillColor: "white",
    hoverFillOpacity: 0.8,
    strokeColor: "#ee9900",
    strokeOpacity: 1,
    strokeWidth: 1,
    strokeLinecap: "round",
    strokeDashstyle: "solid",
    hoverStrokeOpacity: 1,
    hoverStrokeWidth: 0.2,
    pointRadius: 6,
    hoverPointRadius: 1,
    hoverPointUnit: "%",
    pointerEvents: "visiblePainted",
    cursor: "inherit",
    fontColor: "#000000",
    labelAlign: "cm",
    labelOutlineColor: "white",
    labelOutlineWidth: 3
};

2 个回答

你好 

你可以参考http://iclient.supermap.io/examples/classic/editor.html#overlay_vectorLayerData这个例子中为矢量要素附上颜色

3,352EXP 2019年03月05日
直接绘制是可以改变的,但是通过鼠标绘制的,需要缩放才能按设置的设置的颜色显示
直接绘制是可以改变的,但是通过鼠标绘制的,需要缩放才能按设置的设置的颜色显示
6EXP 2019年03月07日
...