Opened 9 years ago
Closed 9 years ago
#12571 closed defect (fixed)
JMapViewer.getLatOffset bug
Reported by: | Owned by: | team | |
---|---|---|---|
Priority: | major | Milestone: | 16.02 |
Component: | JMapViewer | Version: | |
Keywords: | regression | Cc: | wiktorn |
Description
The current implementation of JMapViewer.getLatOffset contains a bug. This is a regression. The current implementation is as follows:
public Integer getLatOffset(double lat, double lon, double offset, boolean checkOutside) { Point p = tileSource.latLonToXY(lat, lon, zoom); int y = p.y - center.y - getHeight() / 2; if (checkOutside && (y < 0 || y > getHeight())) { return null; } return y; }
If we look at the implementation in July 2015 it was as follows:
public Integer getLatOffset(double lat, double offset, boolean checkOutside) { int y = tileSource.latToY(lat + offset, zoom); y -= center.y - getHeight() / 2; if (checkOutside) { if (y < 0 || y > getHeight()) return null; } return y; }
We see that in the new version, the offset is no longer used, and there should be brackets around the calculation on the second line of the method. The correct implementation is as follows:
public Integer getLatOffset(double lat, double lon, double offset, boolean checkOutside) { Point p = tileSource.latLonToXY(lat + offset, lon, zoom); int y = p.y - (center.y - getHeight() / 2); if (checkOutside && (y < 0 || y > getHeight())) { return null; } return y; } }
Attachments (0)
Change History (3)
comment:1 by , 9 years ago
comment:2 by , 9 years ago
Cc: | added |
---|---|
Keywords: | regression added |
Milestone: | → 16.02 |
Regression from [o31301].
comment:3 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Fixed in [o32083]. Good catch, thanks.
Note that the effect of this bug is visible in the Demo app. The MapMarkerCircles that are created in the app are way to big.