Modify

Opened 8 years ago

Last modified 8 years ago

#14804 new defect

Unify case handling for boolean tag values

Reported by: michael2402 Owned by: team
Priority: normal Milestone:
Component: Core Version:
Keywords: Cc:

Description

We currently have:

  • OsmUtils#getOsmBoolean() accepting all cases for true, yes, 1, on
  • OsmUtils#isTrue(), OsmUtils#isFalse() accepting lower case true, yes, 1, on
  • OsmPrimitive#isKeyTrue(key) accepting lower case true, yes, 1, on
  • OsmPrimitive#hasAreaTags() accepts only yes
  • Way#isOneway() accepting all cases for true, yes, 1, on and -1, but not reverse
  • Relation map painting respects oneway=-1, but not reverse
  • ReverseWayTagCorrector only accepting lower case, but accepting -1 and reverse

In tests:

  • Highway#testWrongRoundabout: accepting all cases for true, yes, 1, on for oneway, but none of the reversed.
  • UntaggedWay test accepts only noname=yes

That's what I found so far. We should unify this and decide on a common policy here.

Attachments (0)

Change History (1)

comment:1 by stoecker, 8 years ago

  • as input we may accept more, e.g. getOsmBoolean() is base for tag dialogs, which accept many types, but always output yes or no.
  • getOsmBoolean() is the generic function and should be used generally.
  • otherwise we may accept only yes and no in many places (e.g. in drawing and for validity tests).
  • oneway=reverse does not exist. Support of reverse is again one of the "accept many inputs"
  • Why does ReverseWayTagCorrector only accept lower case? It calls OsmUtils#getOsmBoolean()?
  • Generally true/false and on/off aren't really used anymore.

Conclusion:

  • Use OsmUtils.
  • Add an isReversedStrict() which does not accept "reverse"
  • Way#isOneway() and painting should use OsmUtils#isReversedStrict()
  • Places using only "yes" and "no" need not necessarily be changed.
  • Maybe add also OsmUtils#getOsmBooleanStrict() only accepting "yes" and "no" (oneway=1 is used thought)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain team.
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from team to the specified user.
Next status will be 'needinfo'. The owner will be changed from team to michael2402.
as duplicate The resolution will be set to duplicate. Next status will be 'closed'. The specified ticket will be cross-referenced with this ticket.
The owner will be changed from team to anonymous. Next status will be 'assigned'.

Add Comment


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