Changeset 12257 in osm for applications
- Timestamp:
- 2008-12-08T00:46:41+01:00 (16 years ago)
- Location:
- applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/OSMValidatorPlugin.java
r11974 r12257 26 26 import org.openstreetmap.josm.actions.UploadAction; 27 27 import org.openstreetmap.josm.actions.UploadAction.UploadHook; 28 import org.openstreetmap.josm.data.projection.Epsg4326; 29 import org.openstreetmap.josm.data.projection.Lambert; 30 import org.openstreetmap.josm.data.projection.Mercator; 28 31 import org.openstreetmap.josm.gui.MapFrame; 29 32 import org.openstreetmap.josm.gui.layer.Layer; … … 40 43 import org.openstreetmap.josm.plugins.validator.tests.SelfIntersectingWay; 41 44 import org.openstreetmap.josm.plugins.validator.tests.SimilarNamedWays; 42 import org.openstreetmap.josm.plugins.validator.tests.TagChecker;43 45 import org.openstreetmap.josm.plugins.validator.tests.UnclosedWays; 44 46 import org.openstreetmap.josm.plugins.validator.tests.UnconnectedWays; … … 68 70 /** The list of errors per layer*/ 69 71 Map<Layer, List<TestError>> layerErrors = new HashMap<Layer, List<TestError>>(); 72 73 /** Grid detail, multiplier of east,north values for valuable cell sizing */ 74 public static double griddetail; 70 75 71 76 public Collection<String> ignoredErrors = new TreeSet<String>(); … … 96 101 public OSMValidatorPlugin() { 97 102 plugin = this; 103 initializeGridDetail(); 98 104 initializeTests(getTests()); 99 105 loadIgnoredErrors(); … … 226 232 227 233 /** 234 * Initialize grid details based on current projection system. Values based on 235 * the original value fixed for EPSG:4326 (10000) using heuristics (that is, test&error 236 * until most bugs were discovered while keeping the processing time reasonable) 237 */ 238 public void initializeGridDetail() { 239 if (Main.proj.toString().equals(new Epsg4326().toString())) 240 OSMValidatorPlugin.griddetail = 10000; 241 else if (Main.proj.toString().equals(new Mercator().toString())) 242 OSMValidatorPlugin.griddetail = 100000; 243 else if (Main.proj.toString().equals(new Lambert().toString())) 244 OSMValidatorPlugin.griddetail = 0.1; 245 } 246 247 /** 228 248 * Initializes all tests 229 249 * @param allTests The tests to initialize -
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/CrossingWays.java
r11530 r12257 15 15 import org.openstreetmap.josm.data.osm.Way; 16 16 import org.openstreetmap.josm.data.osm.WaySegment; 17 import org.openstreetmap.josm.plugins.validator.OSMValidatorPlugin; 17 18 import org.openstreetmap.josm.plugins.validator.Severity; 18 19 import org.openstreetmap.josm.plugins.validator.Test; … … 138 139 { 139 140 List<List<ExtendedSegment>> cells = new ArrayList<List<ExtendedSegment>>(); 140 for( Point2D cell : Util.getSegmentCells(n1, n2, 10000) )141 for( Point2D cell : Util.getSegmentCells(n1, n2, OSMValidatorPlugin.griddetail) ) 141 142 { 142 143 List<ExtendedSegment> segments = cellSegments.get( cell ); -
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/util/Util.java
r11530 r12257 13 13 import org.openstreetmap.josm.data.osm.Way; 14 14 import org.openstreetmap.josm.plugins.PluginInformation; 15 import org.openstreetmap.josm.plugins.validator.OSMValidatorPlugin; 15 16 16 17 /** … … 87 88 88 89 // First, round coordinates 89 long x0 = Math.round(n1.eastNorth.east() * 10000);90 long y0 = Math.round(n1.eastNorth.north() * 10000);91 long x1 = Math.round(n2.eastNorth.east() * 10000);92 long y1 = Math.round(n2.eastNorth.north() * 10000);90 long x0 = Math.round(n1.eastNorth.east() * OSMValidatorPlugin.griddetail); 91 long y0 = Math.round(n1.eastNorth.north() * OSMValidatorPlugin.griddetail); 92 long x1 = Math.round(n2.eastNorth.east() * OSMValidatorPlugin.griddetail); 93 long y1 = Math.round(n2.eastNorth.north() * OSMValidatorPlugin.griddetail); 93 94 94 95 // Start of the way … … 118 119 119 120 // Then floor coordinates, in case the way is in the border of the cell. 120 x0 = (long)Math.floor(n1.eastNorth.east() * 10000);121 y0 = (long)Math.floor(n1.eastNorth.north() * 10000);122 x1 = (long)Math.floor(n2.eastNorth.east() * 10000);123 y1 = (long)Math.floor(n2.eastNorth.north() * 10000);121 x0 = (long)Math.floor(n1.eastNorth.east() * OSMValidatorPlugin.griddetail); 122 y0 = (long)Math.floor(n1.eastNorth.north() * OSMValidatorPlugin.griddetail); 123 x1 = (long)Math.floor(n2.eastNorth.east() * OSMValidatorPlugin.griddetail); 124 y1 = (long)Math.floor(n2.eastNorth.north() * OSMValidatorPlugin.griddetail); 124 125 125 126 // Start of the way … … 164 165 * @return A list with the coordinates of all cells 165 166 */ 166 public static List<Point2D> getSegmentCells(Node n1, Node n2, intgridDetail)167 public static List<Point2D> getSegmentCells(Node n1, Node n2, double gridDetail) 167 168 { 168 169 List<Point2D> cells = new ArrayList<Point2D>();
Note:
See TracChangeset
for help on using the changeset viewer.