Changeset 10910 in josm
- Timestamp:
- 2016-08-28T19:00:16+02:00 (8 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/DownloadOsmInViewAction.java
r10848 r10910 44 44 45 45 private static class DownloadOsmInViewTask extends DownloadOsmTask { 46 publicFuture<?> download(Bounds downloadArea) {46 Future<?> download(Bounds downloadArea) { 47 47 return download(new DownloadTask(false, new BoundingBoxDownloader(downloadArea), null, false), downloadArea); 48 48 } -
trunk/src/org/openstreetmap/josm/data/Bounds.java
r10806 r10910 89 89 } 90 90 91 /** 92 * Constructs bounds out of two points. 93 * @param min min lat/lon 94 * @param max max lat/lon 95 * @param roundToOsmPrecision defines if lat/lon will be rounded 96 */ 91 97 public Bounds(LatLon min, LatLon max, boolean roundToOsmPrecision) { 92 98 this(min.lat(), min.lon(), max.lat(), max.lon(), roundToOsmPrecision); … … 94 100 95 101 /** 96 * Constructs bounds out a single point. 102 * Constructs bounds out a single point. Coords will be rounded. 97 103 * @param b lat/lon 98 104 */ … … 134 140 } 135 141 142 /** 143 * Constructs bounds out of two points. Coords will be rounded. 144 * @param minlat min lat 145 * @param minlon min lon 146 * @param maxlat max lat 147 * @param maxlon max lon 148 */ 136 149 public Bounds(double minlat, double minlon, double maxlat, double maxlon) { 137 150 this(minlat, minlon, maxlat, maxlon, true); 138 151 } 139 152 153 /** 154 * Constructs bounds out of two points. 155 * @param minlat min lat 156 * @param minlon min lon 157 * @param maxlat max lat 158 * @param maxlon max lon 159 * @param roundToOsmPrecision defines if lat/lon will be rounded 160 */ 140 161 public Bounds(double minlat, double minlon, double maxlat, double maxlon, boolean roundToOsmPrecision) { 141 162 if (roundToOsmPrecision) { … … 152 173 } 153 174 175 /** 176 * Constructs bounds out of two points. Coords will be rounded. 177 * @param coords exactly 4 values: min lat, min lon, max lat, max lon 178 * @throws IllegalArgumentException if coords does not contain 4 double values 179 */ 154 180 public Bounds(double ... coords) { 155 181 this(coords, true); 156 182 } 157 183 184 /** 185 * Constructs bounds out of two points. 186 * @param coords exactly 4 values: min lat, min lon, max lat, max lon 187 * @param roundToOsmPrecision defines if lat/lon will be rounded 188 * @throws IllegalArgumentException if coords does not contain 4 double values 189 */ 158 190 public Bounds(double[] coords, boolean roundToOsmPrecision) { 159 191 CheckParameterUtil.ensureParameterNotNull(coords, "coords"); … … 232 264 } 233 265 266 /** 267 * Creates new {@code Bounds} from a rectangle. 268 * @param rect The rectangle 269 */ 234 270 public Bounds(Rectangle2D rect) { 235 271 this(rect.getMinY(), rect.getMinX(), rect.getMaxY(), rect.getMaxX()); -
trunk/src/org/openstreetmap/josm/gui/MapViewState.java
r10875 r10910 264 264 } 265 265 266 /** 267 * Returns the area for the given bounds. 268 * @param bounds bounds 269 * @return the area for the given bounds 270 */ 266 271 public Area getArea(Bounds bounds) { 267 272 Path2D area = new Path2D.Double(); -
trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
r10861 r10910 388 388 /** 389 389 * The list model for the list of relations displayed in the relation list dialog. 390 *391 390 */ 392 391 private class RelationListModel extends AbstractListModel<Relation> { … … 400 399 } 401 400 401 /** 402 * Clears the model. 403 */ 402 404 public void clear() { 403 405 relations.clear(); … … 407 409 } 408 410 411 /** 412 * Sorts the model using {@link DefaultNameFormatter} relation comparator. 413 */ 409 414 public void sort() { 410 415 relations.sort(DefaultNameFormatter.getInstance().getRelationComparator()); -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ConditionFactory.java
r10837 r10910 332 332 final Pattern pattern; 333 333 334 /** 335 * Constructs a new {@code KeyValueRegexpCondition}. 336 * @param k key 337 * @param v value 338 * @param op operation 339 * @param considerValAsKey must be false 340 */ 334 341 public KeyValueRegexpCondition(String k, String v, Op op, boolean considerValAsKey) { 335 342 super(k, v, op, considerValAsKey); … … 361 368 public static class RegexpKeyValueRegexpCondition extends KeyValueRegexpCondition { 362 369 363 publicfinal Pattern keyPattern;370 final Pattern keyPattern; 364 371 365 372 /** … … 386 393 387 394 public static class RoleCondition implements Condition { 388 public final String role; 389 public final Op op; 390 395 final String role; 396 final Op op; 397 398 /** 399 * Constructs a new {@code RoleCondition}. 400 * @param role role 401 * @param op operation 402 */ 391 403 public RoleCondition(String role, Op op) { 392 404 this.role = role; … … 403 415 404 416 public static class IndexCondition implements Condition { 405 public final String index; 406 public final Op op; 407 417 final String index; 418 final Op op; 419 420 /** 421 * Constructs a new {@code IndexCondition}. 422 * @param index index 423 * @param op operation 424 */ 408 425 public IndexCondition(String index, Op op) { 409 426 this.index = index; … … 548 565 549 566 public final String id; 550 publicfinal boolean not;567 final boolean not; 551 568 552 569 public ClassCondition(String id, boolean not) { … … 740 757 public static class PseudoClassCondition implements Condition { 741 758 742 publicfinal Method method;743 publicfinal boolean not;759 final Method method; 760 final boolean not; 744 761 745 762 protected PseudoClassCondition(Method method, boolean not) { … … 810 827 public static class ExpressionCondition implements Condition { 811 828 812 privatefinal Expression e;829 final Expression e; 813 830 814 831 /** -
trunk/test/unit/org/openstreetmap/josm/data/BoundsTest.java
r10758 r10910 5 5 import static org.junit.Assert.assertFalse; 6 6 import static org.junit.Assert.assertTrue; 7 8 import java.awt.geom.Rectangle2D; 7 9 8 10 import org.junit.Test; … … 47 49 assertEquals(b3, new Bounds(0, 0, 90, -170)); 48 50 } 51 52 private static void doTestConstructorNominal(Bounds b) { 53 double eps = 1e-7; 54 assertEquals(1d, b.getMinLat(), eps); 55 assertEquals(2d, b.getMinLon(), eps); 56 assertEquals(3d, b.getMaxLat(), eps); 57 assertEquals(4d, b.getMaxLon(), eps); 58 } 59 60 private static void doTestConstructorPoint(Bounds b) { 61 double eps = 1e-7; 62 assertEquals(1d, b.getMinLat(), eps); 63 assertEquals(2d, b.getMinLon(), eps); 64 assertEquals(1d, b.getMaxLat(), eps); 65 assertEquals(2d, b.getMaxLon(), eps); 66 } 67 68 /** 69 * Unit tests for {@link Bounds#Bounds} - nominal cases. 70 */ 71 @Test 72 public void testConstructorNominalCases() { 73 doTestConstructorNominal(new Bounds(new LatLon(1d, 2d), new LatLon(3d, 4d))); 74 doTestConstructorNominal(new Bounds(new LatLon(1d, 2d), new LatLon(3d, 4d), true)); 75 doTestConstructorNominal(new Bounds(1d, 2d, 3d, 4d)); 76 doTestConstructorNominal(new Bounds(1d, 2d, 3d, 4d, true)); 77 doTestConstructorNominal(new Bounds(new double[]{1d, 2d, 3d, 4d})); 78 doTestConstructorNominal(new Bounds(new double[]{1d, 2d, 3d, 4d}, true)); 79 doTestConstructorNominal(new Bounds(new Bounds(1d, 2d, 3d, 4d))); 80 doTestConstructorNominal(new Bounds(new Rectangle2D.Double(2d, 1d, 2d, 2d))); 81 } 82 83 /** 84 * Unit tests for {@link Bounds#Bounds} - single point cases. 85 */ 86 @Test 87 public void testConstructorSinglePointCases() { 88 doTestConstructorPoint(new Bounds(new LatLon(1d, 2d))); 89 doTestConstructorPoint(new Bounds(new LatLon(1d, 2d), true)); 90 doTestConstructorPoint(new Bounds(1d, 2d, true)); 91 } 49 92 }
Note:
See TracChangeset
for help on using the changeset viewer.