Changeset 8444 in josm for trunk/src/org/openstreetmap/josm/data
- Timestamp:
- 2015-06-02T16:41:37+02:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data
- Files:
-
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/coor/LatLon.java
r8308 r8444 69 69 70 70 private static final String cDms60 = cDmsSecondFormatter.format(60.0); 71 private static final String cDms00 = cDmsSecondFormatter.format( 71 private static final String cDms00 = cDmsSecondFormatter.format(0.0); 72 72 private static final String cDm60 = cDmMinuteFormatter.format(60.0); 73 private static final String cDm00 = cDmMinuteFormatter.format( 73 private static final String cDm00 = cDmMinuteFormatter.format(0.0); 74 74 75 75 /** -
trunk/src/org/openstreetmap/josm/data/imagery/ImageryLayerInfo.java
r8418 r8444 150 150 for (ImageryInfo def : defaultLayers) { 151 151 // temporary migration code, so all user preferences will get updated with new settings from JOSM site (can be removed ~Dez. 2015) 152 if (def.getNoTileHeaders() != null || def.getTileSize() > 0 || def.getMetadataHeaders() != null 152 if (def.getNoTileHeaders() != null || def.getTileSize() > 0 || def.getMetadataHeaders() != null) { 153 153 for (ImageryInfo i: layers) { 154 154 if (isSimilar(def, i)) { -
trunk/src/org/openstreetmap/josm/data/osm/ChangesetCache.java
r8338 r8444 134 134 DefaultChangesetCacheEvent e = new DefaultChangesetCacheEvent(this); 135 135 remove(id, e); 136 if (! 136 if (!e.isEmpty()) { 137 137 fireChangesetCacheEvent(e); 138 138 } … … 160 160 remove(cs.getId(), evt); 161 161 } 162 if (! 162 if (!evt.isEmpty()) { 163 163 fireChangesetCacheEvent(evt); 164 164 } -
trunk/src/org/openstreetmap/josm/data/osm/DataSetMerger.java
r8338 r8444 79 79 */ 80 80 protected void mergePrimitive(OsmPrimitive source, Collection<? extends OsmPrimitive> candidates) { 81 if (!source.isNew() 81 if (!source.isNew()) { 82 82 // try to merge onto a matching primitive with the same defined id 83 83 // … … 319 319 throw new DataIntegrityProblemException(tr("Conflict in ''visible'' attribute for object of type {0} with id {1}", 320 320 target.getType(), target.getId())); 321 else if (target.isDeleted() && ! 321 else if (target.isDeleted() && !source.isDeleted() && target.getVersion() == source.getVersion()) { 322 322 // same version, but target is deleted. Assume target takes precedence 323 323 // otherwise too many conflicts when refreshing from the server … … 331 331 } 332 332 } 333 } else if (! 333 } else if (!target.isModified() && source.isDeleted()) { 334 334 // target not modified. We can assume that source is the most recent version, 335 335 // so mark it to be deleted. 336 336 // 337 337 objectsToDelete.add(target); 338 } else if (! 338 } else if (!target.isModified() && source.isModified()) { 339 339 // target not modified. We can assume that source is the most recent version. 340 340 // clone it into target. 341 341 target.mergeFrom(source); 342 342 objectsWithChildrenToMerge.add(source.getPrimitiveId()); 343 } else if (! 343 } else if (!target.isModified() && !source.isModified() && target.getVersion() == source.getVersion()) { 344 344 // both not modified. Merge nevertheless. 345 345 // This helps when updating "empty" relations, see #4295 346 346 target.mergeFrom(source); 347 347 objectsWithChildrenToMerge.add(source.getPrimitiveId()); 348 } else if (! 348 } else if (!target.isModified() && !source.isModified() && target.getVersion() < source.getVersion()) { 349 349 // my not modified but other is newer. clone other onto mine. 350 350 // 351 351 target.mergeFrom(source); 352 352 objectsWithChildrenToMerge.add(source.getPrimitiveId()); 353 } else if (target.isModified() && ! 353 } else if (target.isModified() && !source.isModified() && target.getVersion() == source.getVersion()) { 354 354 // target is same as source but target is modified 355 355 // => keep target and reset modified flag if target and source are semantically equal … … 362 362 // 363 363 addConflict(target,source); 364 } else if (! 364 } else if (!target.hasEqualSemanticAttributes(source)) { 365 365 // target is modified and is not semantically equal with source. Can't automatically 366 366 // resolve the differences -
trunk/src/org/openstreetmap/josm/data/osm/Node.java
r8365 r8444 281 281 if (!(other instanceof Node)) 282 282 return false; 283 if (! 283 if (!super.hasEqualSemanticAttributes(other)) 284 284 return false; 285 285 Node n = (Node)other; -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r8419 r8444 966 966 } else if (referrers instanceof OsmPrimitive) { 967 967 if (referrers != referrer) { 968 referrers = new OsmPrimitive[] { (OsmPrimitive)referrers, referrer};968 referrers = new OsmPrimitive[] {(OsmPrimitive)referrers, referrer}; 969 969 } 970 970 } else { … … 1144 1144 if (other.isNew() ^ isNew()) 1145 1145 throw new DataIntegrityProblemException(tr("Cannot merge because either of the participating primitives is new and the other is not")); 1146 if (! 1146 if (!other.isNew() && other.getId() != id) 1147 1147 throw new DataIntegrityProblemException(tr("Cannot merge primitives with different ids. This id is {0}, the other is {1}", id, other.getId())); 1148 1148 -
trunk/src/org/openstreetmap/josm/data/osm/Relation.java
r8390 r8444 292 292 if (!(other instanceof Relation)) 293 293 return false; 294 if (! 294 if (!super.hasEqualSemanticAttributes(other)) 295 295 return false; 296 296 Relation r = (Relation)other; -
trunk/src/org/openstreetmap/josm/data/osm/TagCollection.java
r8415 r8444 341 341 continue; 342 342 } 343 if (! 343 if (!containsKey(key)) return false; 344 344 } 345 345 return true; … … 399 399 if (key == null) return false; 400 400 Set<String> values = getTagsFor(key).getValues(); 401 return values.size() == 1 && ! 401 return values.size() == 1 && !values.contains(""); 402 402 } 403 403 … … 607 607 public void applyTo(Tagged primitive) { 608 608 if (primitive == null) return; 609 if (! 609 if (!isApplicableToPrimitive()) 610 610 throw new IllegalStateException(tr("Tag collection cannot be applied to a primitive because there are keys with multiple values.")); 611 611 for (Tag tag: tags) { … … 628 628 public void applyTo(Collection<? extends Tagged> primitives) { 629 629 if (primitives == null) return; 630 if (! 630 if (!isApplicableToPrimitive()) 631 631 throw new IllegalStateException(tr("Tag collection cannot be applied to a primitive because there are keys with multiple values.")); 632 632 for (Tagged primitive: primitives) { … … 645 645 public void replaceTagsOf(Tagged primitive) { 646 646 if (primitive == null) return; 647 if (! 647 if (!isApplicableToPrimitive()) 648 648 throw new IllegalStateException(tr("Tag collection cannot be applied to a primitive because there are keys with multiple values.")); 649 649 primitive.removeAll(); … … 663 663 public void replaceTagsOf(Collection<? extends Tagged> primitives) { 664 664 if (primitives == null) return; 665 if (! 665 if (!isApplicableToPrimitive()) 666 666 throw new IllegalStateException(tr("Tag collection cannot be applied to a primitive because there are keys with multiple values.")); 667 667 for (Tagged primitive: primitives) { -
trunk/src/org/openstreetmap/josm/data/osm/User.java
r8395 r8444 213 213 @Override 214 214 public boolean equals(Object obj) { 215 if (! 215 if (!(obj instanceof User)) 216 216 return false; 217 217 User other = (User) obj; -
trunk/src/org/openstreetmap/josm/data/osm/Way.java
r8419 r8444 336 336 if (!(other instanceof Way)) 337 337 return false; 338 if (! 338 if (!super.hasEqualSemanticAttributes(other)) 339 339 return false; 340 340 Way w = (Way)other; 341 341 if (getNodesCount() != w.getNodesCount()) return false; 342 for (int i=0; i<getNodesCount();i++) {343 if (! 342 for (int i=0; i<getNodesCount(); i++) { 343 if (!getNode(i).hasEqualSemanticAttributes(w.getNode(i))) 344 344 return false; 345 345 } -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/LineClip.java
r8419 r8444 60 60 * @return true, if line is visible in the given clip region 61 61 */ 62 private boolean cohenSutherland( 62 private boolean cohenSutherland(long x1, long y1, long x2, long y2, long xmin, long ymin, long xmax, long ymax) { 63 63 int outcode0, outcode1, outcodeOut; 64 64 boolean accept = false; … … 69 69 70 70 do { 71 if ((outcode0 | outcode1) == 0 71 if ((outcode0 | outcode1) == 0) { 72 72 accept = true; 73 73 done = true; 74 } else if ( (outcode0 & outcode1) > 0) {74 } else if ((outcode0 & outcode1) > 0) { 75 75 done = true; 76 76 } else { 77 77 long x = 0, y = 0; 78 78 outcodeOut = outcode0 != 0 ? outcode0: outcode1; 79 if ( (outcodeOut & OUT_TOP) > 0) {79 if ((outcodeOut & OUT_TOP) > 0) { 80 80 x = x1 + (x2 - x1) * (ymax - y1)/(y2 - y1); 81 81 y = ymax; 82 } else if ((outcodeOut & OUT_BOTTOM) > 0 82 } else if ((outcodeOut & OUT_BOTTOM) > 0) { 83 83 x = x1 + (x2 - x1) * (ymin - y1)/(y2 - y1); 84 84 y = ymin; -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/MapRendererFactory.java
r8415 r8444 127 127 Main.error(tr("Activating the standard map renderer instead.")); 128 128 activateDefault(); 129 } else if (! 129 } else if (!AbstractMapRenderer.class.isAssignableFrom(c)) { 130 130 Main.error(tr("Can''t activate map renderer class ''{0}'', because it isn''t a subclass of ''{1}''.", rendererClassName, AbstractMapRenderer.class.getName())); 131 131 Main.error(tr("Activating the standard map renderer instead.")); … … 133 133 } else { 134 134 Class<? extends AbstractMapRenderer> renderer = c.asSubclass(AbstractMapRenderer.class); 135 if (! 135 if (!isRegistered(renderer)) { 136 136 Main.error(tr("Can''t activate map renderer class ''{0}'', because it isn''t registered as map renderer.", rendererClassName)); 137 137 Main.error(tr("Activating the standard map renderer instead.")); -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
r8419 r8444 591 591 x -= textWidth / 2; 592 592 } else if (bs.hAlign == HorizontalTextAlignment.LEFT) { 593 x -= - 593 x -= -box.x + 4 + textWidth; 594 594 } else throw new AssertionError(); 595 595 } … … 643 643 break; 644 644 case CENTER: 645 dy1 = - 645 dy1 = -imgHeight / 2; 646 646 dy2 = imgHeight + dy1; 647 647 break; … … 1341 1341 1342 1342 // scale such that border is 1 px 1343 final double fac = - 1343 final double fac = -(onewayReversed ? -1 : 1) * onewaySize * (1 + sinPHI) / (sinPHI * cosPHI); 1344 1344 final double sx = nx * fac; 1345 1345 final double sy = ny * fac; -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/WireframeMapRenderer.java
r8419 r8444 433 433 434 434 path.lineTo(p2.x + (int) Math.round(cosPHI * sx - sinPHI * sy), p2.y + (int) Math.round(sinPHI * sx + cosPHI * sy)); 435 path.moveTo(p2.x + (int) Math.round(cosPHI * sx + sinPHI * sy), p2.y + (int) Math.round(- 435 path.moveTo(p2.x + (int) Math.round(cosPHI * sx + sinPHI * sy), p2.y + (int) Math.round(-sinPHI * sx + cosPHI * sy)); 436 436 path.lineTo(p2.x, p2.y); 437 437 } -
trunk/src/org/openstreetmap/josm/data/projection/datum/SevenParameterDatum.java
r6069 r8444 50 50 double y = dy + xyz[1]*(1+s) + xyz[0]*rz - xyz[2]*rx; 51 51 double z = dz + xyz[2]*(1+s) + xyz[1]*rx - xyz[0]*ry; 52 return Ellipsoid.WGS84.cart2LatLon(new double[] { x, y, z});52 return Ellipsoid.WGS84.cart2LatLon(new double[] {x, y, z}); 53 53 } 54 54 … … 59 59 double y = (1-s)*(-dy + xyz[1] + ((-dx+xyz[0])*(-rz) - (-dz+xyz[2])*(-rx))); 60 60 double z = (1-s)*(-dz + xyz[2] + ((-dy+xyz[1])*(-rx) - (-dx+xyz[0])*(-ry))); 61 return this.ellps.cart2LatLon(new double[] { x, y, z});61 return this.ellps.cart2LatLon(new double[] {x, y, z}); 62 62 } 63 64 63 } -
trunk/src/org/openstreetmap/josm/data/projection/proj/LambertConformalConic.java
r8346 r8444 153 153 public double[] project(double phi, double lambda) { 154 154 double sinphi = sin(phi); 155 double L= (0.5*log((1+sinphi)/(1-sinphi))) - e/2*log((1+e*sinphi)/(1-e*sinphi));156 double r = f*exp(-n* L);155 double l = (0.5*log((1+sinphi)/(1-sinphi))) - e/2*log((1+e*sinphi)/(1-e*sinphi)); 156 double r = f*exp(-n*l); 157 157 double gamma = n*lambda; 158 double X= r*sin(gamma);159 double Y= r0 - r*cos(gamma);160 return new double[] { X, Y};158 double x = r*sin(gamma); 159 double y = r0 - r*cos(gamma); 160 return new double[] {x, y}; 161 161 } 162 162 … … 168 168 double latIso = (-1/n) * log(abs(r/f)); 169 169 double phi = ellps.latitude(latIso, e, epsilon); 170 return new double[] { phi, lambda};170 return new double[] {phi, lambda}; 171 171 } 172 172 -
trunk/src/org/openstreetmap/josm/data/projection/proj/LonLat.java
r7937 r8444 30 30 @Override 31 31 public double[] project(double lat_rad, double lon_rad) { 32 return new double[] { Math.toDegrees(lon_rad) / a, Math.toDegrees(lat_rad) / a};32 return new double[] {Math.toDegrees(lon_rad) / a, Math.toDegrees(lat_rad) / a}; 33 33 } 34 34 35 35 @Override 36 36 public double[] invproject(double east, double north) { 37 return new double[] { Math.toRadians(north * a), Math.toRadians(east * a)};37 return new double[] {Math.toRadians(north * a), Math.toRadians(east * a)}; 38 38 } 39 39 } -
trunk/src/org/openstreetmap/josm/data/projection/proj/Mercator.java
r6362 r8444 32 32 @Override 33 33 public double[] project(double lat_rad, double lon_rad) { 34 return new double[] { lon_rad, log(tan(PI/4 + lat_rad/2))};34 return new double[] {lon_rad, log(tan(PI/4 + lat_rad/2))}; 35 35 } 36 36 37 37 @Override 38 38 public double[] invproject(double east, double north) { 39 return new double[] { atan(sinh(north)), east};39 return new double[] {atan(sinh(north)), east}; 40 40 } 41 42 41 } -
trunk/src/org/openstreetmap/josm/data/projection/proj/SwissObliqueMercator.java
r8378 r8444 81 81 double x = kR / 2 * log((1 + sin(bb)) / (1 - sin(bb))); 82 82 83 return new double[] { y, x};83 return new double[] {y, x}; 84 84 } 85 85 … … 107 107 phi = 2 * atan(exp(s)) - PI / 2; 108 108 } 109 return new double[] { phi, lambda};109 return new double[] {phi, lambda}; 110 110 } 111 111 } -
trunk/src/org/openstreetmap/josm/data/validation/PaintVisitor.java
r8380 r8444 162 162 int deg = (int) Math.toDegrees(t); 163 163 if (selected) { 164 int[] x = new int[] { 165 (int) (p2.x - cosT), (int) (p1.x - cosT)};166 int[] y = new int[] { 167 (int) (p2.y + sinT), (int) (p1.y + sinT)};164 int[] x = new int[] {(int) (p1.x + cosT), (int) (p2.x + cosT), 165 (int) (p2.x - cosT), (int) (p1.x - cosT)}; 166 int[] y = new int[] {(int) (p1.y - sinT), (int) (p2.y - sinT), 167 (int) (p2.y + sinT), (int) (p1.y + sinT)}; 168 168 g.fillPolygon(x, y, 4); 169 169 g.fillArc(p1.x - 5, p1.y - 5, 10, 10, deg, 180); -
trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateRelation.java
r8378 r8444 195 195 if (duplicated.size() > 1) { 196 196 TestError testError = new TestError(this, Severity.ERROR, tr("Duplicated relations"), DUPLICATE_RELATION, duplicated); 197 errors.add( testError);197 errors.add(testError); 198 198 } 199 199 } … … 202 202 if (duplicated.size() > 1) { 203 203 TestError testError = new TestError(this, Severity.WARNING, tr("Relations with same members"), SAME_RELATION, duplicated); 204 errors.add( testError);204 errors.add(testError); 205 205 } 206 206 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/OverlappingWays.java
r8382 r8444 69 69 private boolean parentMultipolygonConcernsArea(OsmPrimitive p) { 70 70 for (Relation r : OsmPrimitive.getFilteredList(p.getReferrers(), Relation.class)) { 71 if (r.concernsArea() 71 if (r.concernsArea()) { 72 72 return true; 73 73 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java
r8438 r8444 248 248 249 249 if (errorSources.length() > 0) 250 throw new IOException( tr("Could not access data file(s):\n{0}", errorSources));250 throw new IOException(tr("Could not access data file(s):\n{0}", errorSources)); 251 251 } 252 252 -
trunk/src/org/openstreetmap/josm/data/validation/tests/UntaggedWay.java
r8378 r8444 44 44 public static final Set<String> NAMED_WAYS = new HashSet<>(); 45 45 static { 46 NAMED_WAYS.add( "motorway");47 NAMED_WAYS.add( "trunk");48 NAMED_WAYS.add( "primary");49 NAMED_WAYS.add( "secondary");50 NAMED_WAYS.add( "tertiary");51 NAMED_WAYS.add( "residential");52 NAMED_WAYS.add( "pedestrian");46 NAMED_WAYS.add("motorway"); 47 NAMED_WAYS.add("trunk"); 48 NAMED_WAYS.add("primary"); 49 NAMED_WAYS.add("secondary"); 50 NAMED_WAYS.add("tertiary"); 51 NAMED_WAYS.add("residential"); 52 NAMED_WAYS.add("pedestrian"); 53 53 } 54 54 … … 56 56 public static final Set<String> WHITELIST = new HashSet<>(); 57 57 static { 58 WHITELIST.add( "outer");59 WHITELIST.add( "inner");60 WHITELIST.add( "perimeter");61 WHITELIST.add( "edge");62 WHITELIST.add( "outline");58 WHITELIST.add("outer"); 59 WHITELIST.add("inner"); 60 WHITELIST.add("perimeter"); 61 WHITELIST.add("edge"); 62 WHITELIST.add("outline"); 63 63 } 64 64 -
trunk/src/org/openstreetmap/josm/data/validation/util/ValUtil.java
r8378 r8444 64 64 if (!cellNodes.contains(cell)) { 65 65 cellNodes.add(cell); 66 ways = cellWays.get( cell);66 ways = cellWays.get(cell); 67 67 if (ways == null) { 68 68 ways = new ArrayList<>(); … … 157 157 long maxSteps = (gridX1 - gridX0) + Math.abs(gridY1 - gridY0) + 1; 158 158 while ((gridX0 <= gridX1 && (gridY0 - gridY1)*stepY <= 0) && maxSteps-- > 0) { 159 cells.add( 159 cells.add(new Point2D.Double(gridX0, gridY0)); 160 160 161 161 // Is the cross between the segment and next vertical line nearer than the cross with next horizontal line?
Note:
See TracChangeset
for help on using the changeset viewer.