Changeset 13638 in josm for trunk


Ignore:
Timestamp:
2018-04-15T19:27:46+02:00 (19 months ago)
Author:
Don-vip
Message:

use interfaces in Geometry

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/Geometry.java

    r12742 r13638  
    2222import org.openstreetmap.josm.command.Command;
    2323import org.openstreetmap.josm.data.coor.EastNorth;
     24import org.openstreetmap.josm.data.coor.ILatLon;
    2425import org.openstreetmap.josm.data.osm.BBox;
    2526import org.openstreetmap.josm.data.osm.DataSet;
     27import org.openstreetmap.josm.data.osm.IPrimitive;
    2628import org.openstreetmap.josm.data.osm.MultipolygonBuilder;
    2729import org.openstreetmap.josm.data.osm.MultipolygonBuilder.JoinedPolygon;
    2830import org.openstreetmap.josm.data.osm.Node;
    2931import org.openstreetmap.josm.data.osm.NodePositionComparator;
    30 import org.openstreetmap.josm.data.osm.OsmPrimitive;
    3132import org.openstreetmap.josm.data.osm.Relation;
    3233import org.openstreetmap.josm.data.osm.Way;
     
    527528     * @param path2d path to add to; can be null, then a new path is created
    528529     * @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) {
    531533        Path2D path = path2d != null ? path2d : new Path2D.Double();
    532534        boolean begin = true;
    533         for (Node n : polygon) {
     535        for (ILatLon n : polygon) {
    534536            if (begin) {
    535537                path.moveTo(n.lon(), n.lat());
     
    701703     * @param osm the primitive to measure
    702704     * @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) {
    705708        if (osm instanceof Way && ((Way) osm).isClosed()) {
    706709            return closedWayArea((Way) osm);
     
    10121015     * @param projection the projection to use for the calculation, {@code null} defaults to {@link Main#getProjection()}
    10131016     * @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) {
    10161020        CheckParameterUtil.ensureParameterNotNull(nodes, "nodes");
    10171021        double area = 0;
     
    10241028            EastNorth p1 = nodes.get(0).getEastNorth(useProjection);
    10251029            for (int i = 1; i <= numSegments; i++) {
    1026                 final Node node = nodes.get(i == numSegments ? 0 : i);
     1030                final ILatLon node = nodes.get(i == numSegments ? 0 : i);
    10271031                final EastNorth p2 = node.getEastNorth(useProjection);
    10281032                if (p1 != null && p2 != null) {
Note: See TracChangeset for help on using the changeset viewer.