diff --git a/src/org/openstreetmap/josm/data/validation/tests/SharpAngles.java b/src/org/openstreetmap/josm/data/validation/tests/SharpAngles.java
index 676eb47f10..1c6353ff35 100644
|
a
|
b
|
import org.openstreetmap.josm.data.preferences.sources.ValidatorPrefHelper;
|
| 16 | 16 | import org.openstreetmap.josm.data.validation.Severity; |
| 17 | 17 | import org.openstreetmap.josm.data.validation.Test; |
| 18 | 18 | import org.openstreetmap.josm.data.validation.TestError; |
| | 19 | import org.openstreetmap.josm.spi.preferences.Config; |
| 19 | 20 | import org.openstreetmap.josm.tools.Geometry; |
| 20 | 21 | import org.openstreetmap.josm.tools.bugreport.BugReport; |
| 21 | 22 | |
| … |
… |
public class SharpAngles extends Test {
|
| 28 | 29 | private static final int SHARPANGLESCODE = 3800; |
| 29 | 30 | /** The code for a sharp angle */ |
| 30 | 31 | private static final int SHARP_ANGLES = SHARPANGLESCODE + 0; |
| 31 | | /** The maximum angle for sharp angles */ |
| 32 | | private double maxAngle = 45.0; // degrees |
| 33 | | /** The length that at least one way segment must be shorter than */ |
| 34 | | private double maxLength = 10.0; // meters |
| | 32 | /** The maximum angle for sharp angles (degrees) */ |
| | 33 | private double maxAngle; |
| | 34 | /** The length that at least one way segment must be shorter than (meters) */ |
| | 35 | private double maxLength; |
| 35 | 36 | /** Specific highway types to ignore */ |
| 36 | 37 | private final Collection<String> ignoreHighways = new TreeSet<>( |
| 37 | 38 | Arrays.asList("platform", "rest_area", "services", "via_ferrata")); |
| | 39 | /** Specific railway types to ignore */ |
| | 40 | private final Collection<String> ignoreRailway = new TreeSet<>(); |
| 38 | 41 | |
| 39 | 42 | /** |
| 40 | 43 | * Construct a new {@code IntersectionIssues} object |
| 41 | 44 | */ |
| 42 | 45 | public SharpAngles() { |
| 43 | | super(tr("Sharp angles"), tr("Check for sharp angles on roads")); |
| | 46 | super(tr("Sharp angles"), tr("Check for sharp angles on man made transportation ways")); |
| | 47 | this.maxLength = Config.getPref().getDouble("validator.sharpangles.maxlength", 10.0); // meters |
| | 48 | this.maxAngle = Config.getPref().getDouble("validator.sharpangles.maxlength", 45.0); // degrees |
| 44 | 49 | } |
| 45 | 50 | |
| 46 | 51 | @Override |
| … |
… |
public class SharpAngles extends Test {
|
| 61 | 66 | * @return {@code true} if the way should be checked. |
| 62 | 67 | */ |
| 63 | 68 | public boolean shouldBeTestedForSharpAngles(Way way) { |
| 64 | | return (way.hasKey("highway") && !way.hasTag("area", "yes") && !way.hasKey("via_ferrata_scale") && |
| 65 | | !ignoreHighways.contains(way.get("highway"))); |
| | 69 | return !way.hasTag("area", "yes") && |
| | 70 | ((way.hasKey("highway") && !way.hasKey("via_ferrata_scale") && !ignoreHighways.contains(way.get("highway"))) |
| | 71 | || (way.hasKey("railway") && !ignoreRailway.contains(way.get("railway")))); |
| 66 | 72 | } |
| 67 | 73 | |
| 68 | 74 | /** |
| … |
… |
public class SharpAngles extends Test {
|
| 144 | 150 | ignoreHighways.add(highway); |
| 145 | 151 | } |
| 146 | 152 | |
| | 153 | /** |
| | 154 | * Add a railway to ignore |
| | 155 | * @param railway The highway type to ignore (e.g., if you want to ignore miniature railways, use "miniature") |
| | 156 | * @since xxx |
| | 157 | */ |
| | 158 | public void addIgnoredRailway(String railway) { |
| | 159 | ignoreRailway.add(railway); |
| | 160 | } |
| | 161 | |
| 147 | 162 | /** |
| 148 | 163 | * Set the maximum angle |
| 149 | 164 | * @param angle The maximum angle in degrees. |