Class ReverseWayTagCorrector
- java.lang.Object
-
- org.openstreetmap.josm.actions.corrector.TagCorrector<Way>
-
- org.openstreetmap.josm.actions.corrector.ReverseWayTagCorrector
-
public class ReverseWayTagCorrector extends TagCorrector<Way>
A ReverseWayTagCorrector handles necessary corrections of tags when a way is reversed. E.g. oneway=yes needs to be changed to oneway=-1 and vice versa. The Corrector offers the automatic resolution in an dialog for the user to confirm.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static interface
ReverseWayTagCorrector.IStringSwitcher
private static class
ReverseWayTagCorrector.StringSwitcher
static class
ReverseWayTagCorrector.TagSwitcher
Reverses a given tag.
-
Field Summary
Fields Modifier and Type Field Description private static ReverseWayTagCorrector.IStringSwitcher
COMBINED_SWITCHERS
private static ReverseWayTagCorrector.StringSwitcher
FORWARD_BACKWARD
private static Collection<Pattern>
IGNORED_KEYS
private static String
SEPARATOR
private static ReverseWayTagCorrector.StringSwitcher
UP_DOWN
-
Constructor Summary
Constructors Constructor Description ReverseWayTagCorrector()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<Command>
execute(Way oldway, Way way)
Executes the tag correction.private static Pattern
getPatternFor(String s)
private static Pattern
getPatternFor(String s, boolean exactMatch)
(package private) static List<RoleCorrection>
getRoleCorrections(Way oldway)
(package private) static List<TagCorrection>
getTagCorrections(Tagged way)
(package private) static Map<OsmPrimitive,List<TagCorrection>>
getTagCorrectionsMap(Way way)
private static boolean
ignoreKeyForCorrection(String key)
static String
invertNumber(String value)
Inverts sign of a numeric value and converts decimal number to use decimal point.static List<Way>
irreversibleWays(List<Way> ways)
Returns the subset of irreversible ways.static boolean
isReversible(Way way)
Tests whether way can be reversed without semantic change, i.e., whether tags have to be changed.-
Methods inherited from class org.openstreetmap.josm.actions.corrector.TagCorrector
applyCorrections
-
-
-
-
Field Detail
-
SEPARATOR
private static final String SEPARATOR
- See Also:
- Constant Field Values
-
IGNORED_KEYS
private static final Collection<Pattern> IGNORED_KEYS
-
FORWARD_BACKWARD
private static final ReverseWayTagCorrector.StringSwitcher FORWARD_BACKWARD
-
UP_DOWN
private static final ReverseWayTagCorrector.StringSwitcher UP_DOWN
-
COMBINED_SWITCHERS
private static final ReverseWayTagCorrector.IStringSwitcher COMBINED_SWITCHERS
-
-
Constructor Detail
-
ReverseWayTagCorrector
public ReverseWayTagCorrector()
-
-
Method Detail
-
getPatternFor
private static Pattern getPatternFor(String s)
-
getPatternFor
private static Pattern getPatternFor(String s, boolean exactMatch)
-
isReversible
public static boolean isReversible(Way way)
Tests whether way can be reversed without semantic change, i.e., whether tags have to be changed. Looks for keys like oneway, oneway:bicycle, cycleway:right:oneway, left/right. Also tests the nodes, e.g. a highway=stop with direction, see #20013.- Parameters:
way
- way to test- Returns:
- false if tags should be changed to keep semantic, true otherwise.
-
irreversibleWays
public static List<Way> irreversibleWays(List<Way> ways)
Returns the subset of irreversible ways.- Parameters:
ways
- all ways- Returns:
- the subset of irreversible ways
- See Also:
isReversible(Way)
-
invertNumber
public static String invertNumber(String value)
Inverts sign of a numeric value and converts decimal number to use decimal point. Also removes sign from null value.- Parameters:
value
- numeric value- Returns:
- opposite numeric value
-
getTagCorrections
static List<TagCorrection> getTagCorrections(Tagged way)
-
getRoleCorrections
static List<RoleCorrection> getRoleCorrections(Way oldway)
-
getTagCorrectionsMap
static Map<OsmPrimitive,List<TagCorrection>> getTagCorrectionsMap(Way way)
-
execute
public Collection<Command> execute(Way oldway, Way way) throws UserCancelException
Description copied from class:TagCorrector
Executes the tag correction.- Specified by:
execute
in classTagCorrector<Way>
- Parameters:
oldway
- old primitiveway
- new primitive- Returns:
- A list of commands
- Throws:
UserCancelException
- If the user canceled- See Also:
TagCorrector.applyCorrections(DataSet, Map, Map, String)
-
ignoreKeyForCorrection
private static boolean ignoreKeyForCorrection(String key)
-
-