2016-12-05 68 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实现中,它应该检测点样式并作出相应的反应?

回答