Modify

Opened 3 years ago

Closed 3 years ago

#21646 closed defect (fixed)

[PATCH][RFC] Round new points in org.openstreetmap.josm.data.imagery.Shape or modify equals

Reported by: taylor.smock Owned by: Don-vip
Priority: normal Milestone: 21.12
Component: Core imagery Version:
Keywords: Cc:

Description

This is one of those "fun" double things.

The double representation of 0.2575799 * 1e7 is 2575798.9999999995. Directly casting to int will round down to 2575798. This particular number can be found in the boundaries.osm file used for Territories.
See (9.42696, 0.2575799) (this is on the border between Ghana and Togo).

Right now, neither Togo nor Ghana has any national imagery layers. However, if they existed, they would always be reset/updated, as the comparison between the "default" and the "changed" ImageryInfo would always fail.

Solutions:
1) When checking equality using equalsPref, when comparing bounds/bound shapes, use Utils.equalsEpsilon
2) Correct for double issues by rounding then casting to int

Attachments (2)

21646.round.patch (3.6 KB ) - added by taylor.smock 3 years ago.
Round on coordinate add
21646.equality.patch (2.9 KB ) - added by taylor.smock 3 years ago.
Modify equality to use MAX_SERVER_PRECISION as epsilon for coordinate differences

Download all attachments as: .zip

Change History (4)

by taylor.smock, 3 years ago

Attachment: 21646.round.patch added

Round on coordinate add

by taylor.smock, 3 years ago

Attachment: 21646.equality.patch added

Modify equality to use MAX_SERVER_PRECISION as epsilon for coordinate differences

comment:1 by Don-vip, 3 years ago

Component: CoreCore imagery
Milestone: 21.12
Owner: changed from team to Don-vip
Status: newassigned

comment:2 by Don-vip, 3 years ago

Resolution: fixed
Status: assignedclosed

In 18341/josm:

fix #21646 - Round new points in imagery.Shape (patch by taylor.smock)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Don-vip.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.