Always add first segment when appending coordinates
When we have only a single point, we want to make sure it gets added (fixes #1821). Because this code doesn't differentiate coordinates that are part of a linestring or linearring from those that are independent points, we always add the first segment (or pair of points). In addition, coordinates for segments are appended whenever they represent a change in relationship with respect to the extent. This keeps the code simpler for handling fills and properly capturing intersection points for linestrings. This could be modified to save a few extra coordinates, but it provides for simpler code at a very minimal cost.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
// FIXME add option to apply snapToPixel to all coordinates?
|
||||
// FIXME can eliminate empty set styles and strokes (when all geoms skipped)
|
||||
|
||||
goog.provide('ol.render.canvas.Replay');
|
||||
goog.provide('ol.render.canvas.ReplayGroup');
|
||||
|
||||
goog.require('goog.array');
|
||||
@@ -166,6 +167,12 @@ ol.render.canvas.Replay.prototype.appendFlatCoordinates =
|
||||
lastRel = nextRel;
|
||||
}
|
||||
|
||||
// handle case where there is only one point to append
|
||||
if (i === offset + stride) {
|
||||
this.coordinates[myEnd++] = lastCoord[0];
|
||||
this.coordinates[myEnd++] = lastCoord[1];
|
||||
}
|
||||
|
||||
if (close) {
|
||||
this.coordinates[myEnd++] = flatCoordinates[offset];
|
||||
this.coordinates[myEnd++] = flatCoordinates[offset + 1];
|
||||
|
||||
Reference in New Issue
Block a user