Changeset 13638 in josm
- Timestamp:
- 2018-04-15T19:27:46+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/Geometry.java
r12742 r13638 22 22 import org.openstreetmap.josm.command.Command; 23 23 import org.openstreetmap.josm.data.coor.EastNorth; 24 import org.openstreetmap.josm.data.coor.ILatLon; 24 25 import org.openstreetmap.josm.data.osm.BBox; 25 26 import org.openstreetmap.josm.data.osm.DataSet; 27 import org.openstreetmap.josm.data.osm.IPrimitive; 26 28 import org.openstreetmap.josm.data.osm.MultipolygonBuilder; 27 29 import org.openstreetmap.josm.data.osm.MultipolygonBuilder.JoinedPolygon; 28 30 import org.openstreetmap.josm.data.osm.Node; 29 31 import org.openstreetmap.josm.data.osm.NodePositionComparator; 30 import org.openstreetmap.josm.data.osm.OsmPrimitive;31 32 import org.openstreetmap.josm.data.osm.Relation; 32 33 import org.openstreetmap.josm.data.osm.Way; … … 527 528 * @param path2d path to add to; can be null, then a new path is created 528 529 * @return the path (LatLon coordinates) 529 */ 530 public static Path2D buildPath2DLatLon(List<Node> polygon, Path2D path2d) { 530 * @since 13638 (signature) 531 */ 532 public static Path2D buildPath2DLatLon(List<? extends ILatLon> polygon, Path2D path2d) { 531 533 Path2D path = path2d != null ? path2d : new Path2D.Double(); 532 534 boolean begin = true; 533 for ( Noden : polygon) {535 for (ILatLon n : polygon) { 534 536 if (begin) { 535 537 path.moveTo(n.lon(), n.lat()); … … 701 703 * @param osm the primitive to measure 702 704 * @return area of the primitive, or {@code null} 703 */ 704 public static Double computeArea(OsmPrimitive osm) { 705 * @since 13638 (signature) 706 */ 707 public static Double computeArea(IPrimitive osm) { 705 708 if (osm instanceof Way && ((Way) osm).isClosed()) { 706 709 return closedWayArea((Way) osm); … … 1012 1015 * @param projection the projection to use for the calculation, {@code null} defaults to {@link Main#getProjection()} 1013 1016 * @return area and perimeter 1014 */ 1015 public static AreaAndPerimeter getAreaAndPerimeter(List<Node> nodes, Projection projection) { 1017 * @since 13638 (signature) 1018 */ 1019 public static AreaAndPerimeter getAreaAndPerimeter(List<? extends ILatLon> nodes, Projection projection) { 1016 1020 CheckParameterUtil.ensureParameterNotNull(nodes, "nodes"); 1017 1021 double area = 0; … … 1024 1028 EastNorth p1 = nodes.get(0).getEastNorth(useProjection); 1025 1029 for (int i = 1; i <= numSegments; i++) { 1026 final Nodenode = nodes.get(i == numSegments ? 0 : i);1030 final ILatLon node = nodes.get(i == numSegments ? 0 : i); 1027 1031 final EastNorth p2 = node.getEastNorth(useProjection); 1028 1032 if (p1 != null && p2 != null) {
Note:
See TracChangeset
for help on using the changeset viewer.