Changeset 6566 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2013-12-30T10:17:44+01:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/command/TransformNodesCommand.java
r6173 r6566 128 128 * Get the center of the nodes under modification. 129 129 * It's just the barycenter. 130 * @see {@link org.openstreetmap.josm.tools.Geometry#getCentroid(java.util.List)} 130 131 */ 131 132 public EastNorth getNodesCenter() { -
trunk/src/org/openstreetmap/josm/data/coor/LatLon.java
r6500 r6566 14 14 import java.text.DecimalFormat; 15 15 import java.text.NumberFormat; 16 import java.util.Arrays; 16 17 import java.util.Locale; 17 18 18 19 import org.openstreetmap.josm.Main; 19 20 import org.openstreetmap.josm.data.Bounds; 21 import org.openstreetmap.josm.tools.Utils; 20 22 21 23 /** … … 314 316 } 315 317 318 /** 319 * Returns this lat/lon pair in human-readable format separated by {@code separator}. 320 * @return String in the format {@code "1.23456[separator]2.34567"} 321 */ 322 public String toStringCSV(String separator) { 323 return Utils.join(separator, Arrays.asList( 324 latToString(CoordinateFormat.DECIMAL_DEGREES), 325 lonToString(CoordinateFormat.DECIMAL_DEGREES) 326 )); 327 } 328 316 329 public LatLon interpolate(LatLon ll2, double proportion) { 317 330 return new LatLon(this.lat() + proportion * (ll2.lat() - this.lat()), -
trunk/src/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDialog.java
r6406 r6566 48 48 import org.openstreetmap.josm.tools.DateUtils; 49 49 import org.openstreetmap.josm.tools.GBC; 50 import org.openstreetmap.josm.tools.Geometry; 50 51 import org.openstreetmap.josm.tools.WindowGeometry; 51 52 … … 241 242 } else if (o instanceof Way) { 242 243 addBbox(o); 244 add(tr("Centroid: "), Main.getProjection().eastNorth2latlon( 245 Geometry.getCentroid(((Way) o).getNodes())).toStringCSV(", ")); 243 246 addWayNodes((Way) o); 244 247 } else if (o instanceof Relation) { … … 278 281 Double.toString(bottomRigth.east()), ", ", 279 282 Double.toString(topLeft.north())); 283 add(tr("Center of bounding box: "), bbox.getCenter().toStringCSV(", ")); 280 284 } 281 285 } -
trunk/src/org/openstreetmap/josm/tools/Geometry.java
r6362 r6566 660 660 661 661 /** 662 * Compute the centroid of nodes662 * Compute the centroid/barycenter of nodes 663 663 * @param nodes Nodes for which the centroid is wanted 664 664 * @return the centroid of nodes
Note:
See TracChangeset
for help on using the changeset viewer.