Skip to content

Commit

Permalink
[giscore] Bounding of a MapPolyline is too big when it is a wide poly…
Browse files Browse the repository at this point in the history
…line.

The bounding box of a polyline is expanded with 2 times the width of the
polyline. It should be one time. This commit fixes this issue.

Signed-off-by: Stéphane Galland <galland@arakhne.org>
  • Loading branch information
gallandarakhneorg committed Nov 23, 2017
1 parent d037fcb commit c3fea57
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -637,14 +637,14 @@ public final void toPath2D(Path2d path, double startPosition, double endPosition
@Pure
protected Rectangle2d calcBounds() {
final Rectangle2d bounds = super.calcBounds().toBoundingBox();
if (bounds != null && this.isWidePolyline) {
if (bounds != null && isWidePolyline()) {
final double w = getWidth();
final double mx = bounds.getMinX();
final double my = bounds.getMinY();
final double xx = bounds.getMaxX();
final double xy = bounds.getMaxY();
bounds.add(mx - w, my - w);
bounds.add(xx + w, xy + w);
final double dw = w / 2.;
bounds.setFromCorners(mx - dw, my - dw, xx + dw, xy + dw);
}
return bounds;
}
Expand Down

0 comments on commit c3fea57

Please sign in to comment.