2016-12-05 69 views
0

drawGeometry方法不會將點樣式應用於多邊形。這是有道理的,但我有一個要求,多邊形功能應表現爲適合該功能的筆畫+填充樣式以及點樣式,IMO,不太適合該功能。如何渲染多邊形作爲點要素?

例如: rendered parcel feature

使用的多邊形和點特徵樣式的組合:

[ 
{ 
    "fill": { 
    "pattern": { 
    "orientation": "diagonal", 
    "color": "rgba(230,113,26,1)", 
    "spacing": 3, 
    "repitition": "repeat" 
    } 
    } 
}, 
{ 
    "circle": { 
    "fill": { "color": "blue" }, 
    "opacity": 1, 
    "stroke": { 
    "color": "rgba(0,255,0,1)", 
    "width": 1 
    }, 
    "radius": 20 
    } 
}, 
{ 
    "image": { 
    "anchor": [ 
    16, 
    48 
    ], 
    "imgSize": [ 
    32, 
    48 
    ], 
    "anchorXUnits": "pixels", 
    "anchorYUnits": "pixels", 
    "src": "http://openlayers.org/en/v3.17.1/examples/data/icon.png" 
    } 
} 
] 

一個解決方案,我想出了是更換drawGeometry同時調用drawPolygon和drawPoint:

drawGeometry code

但似乎支持渲染AP應該以其他方式支持使用點樣式的olygon。也許在drawPolygon實現中,它應該檢測點樣式並作出相應的反應?

回答