Allow styles to override feature geometries

With this change, application developers are able to define styles that
render a different geometry than the feature geometry. This can e.g. be
used to render an interior point of a polygon instead of the polygon, or
to render symbols like arrows along lines.
This commit is contained in:
Andreas Hocevar
2014-12-05 13:33:44 +01:00
parent e57ea1e66b
commit 2d12531105
3 changed files with 74 additions and 3 deletions

View File

@@ -123,8 +123,8 @@ ol.renderer.vector.renderFeature = function(
*/
ol.renderer.vector.renderFeature_ = function(
replayGroup, feature, style, squaredTolerance) {
var geometry = feature.getGeometry();
if (!goog.isDefAndNotNull(geometry)) {
var geometry = style.getGeometryFunction()(feature);
if (goog.isNull(geometry)) {
return;
}
var simplifiedGeometry = geometry.getSimplifiedGeometry(squaredTolerance);