Ignore:
Timestamp:
2022-06-15T20:10:48+02:00 (3 years ago)
Author:
taylor.smock
Message:

See #22115: Extract methods from LatLon into ILatLon where they are generally applicable

This uses the extracted methods where possible, and removes unnecessary
Node#getCoor calls.

Location:
applications/editors/josm/plugins/buildings_tools/src/org/openstreetmap/josm/plugins/buildings_tools
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/buildings_tools/src/org/openstreetmap/josm/plugins/buildings_tools/AngleSnap.java

    r34850 r35978  
    2525    public final Double addSnap(Node[] nodes) {
    2626        if (nodes.length == 2) {
    27             EastNorth p1 = latlon2eastNorth(nodes[0].getCoor());
    28             EastNorth p2 = latlon2eastNorth(nodes[1].getCoor());
     27            EastNorth p1 = latlon2eastNorth(nodes[0]);
     28            EastNorth p2 = latlon2eastNorth(nodes[1]);
    2929            double heading = p1.heading(p2);
    3030            addSnap(heading);
     
    3838    public final void addSnap(Way way) {
    3939        for (Pair<Node, Node> pair : way.getNodePairs(false)) {
    40             EastNorth a = latlon2eastNorth(pair.a.getCoor());
    41             EastNorth b = latlon2eastNorth(pair.b.getCoor());
     40            EastNorth a = latlon2eastNorth(pair.a);
     41            EastNorth b = latlon2eastNorth(pair.b);
    4242            double heading = a.heading(b);
    4343            addSnap(heading);
  • applications/editors/josm/plugins/buildings_tools/src/org/openstreetmap/josm/plugins/buildings_tools/BuildingsToolsPlugin.java

    r34572 r35978  
    55
    66import org.openstreetmap.josm.data.coor.EastNorth;
     7import org.openstreetmap.josm.data.coor.ILatLon;
    78import org.openstreetmap.josm.data.coor.LatLon;
    89import org.openstreetmap.josm.data.projection.Projection;
     
    1819    public static final Projection MERCATOR = Projections.getProjectionByCode("EPSG:3857"); // Mercator
    1920
    20     public static EastNorth latlon2eastNorth(LatLon p) {
     21    public static EastNorth latlon2eastNorth(ILatLon p) {
    2122        return MERCATOR.latlon2eastNorth(p);
    2223    }
  • applications/editors/josm/plugins/buildings_tools/src/org/openstreetmap/josm/plugins/buildings_tools/DrawBuildingAction.java

    r35929 r35978  
    210210            Node n = MainApplication.getMap().mapView.getNearestNode(mousePos, OsmPrimitive::isUsable);
    211211            if (n != null)
    212                 return latlon2eastNorth(n.getCoor());
     212                return latlon2eastNorth(n);
    213213            IWaySegment<Node, Way> ws = MainApplication.getMap().mapView.getNearestWaySegment(mousePos,
    214214                    OsmPrimitive::isSelectable);
    215215            if (ws != null && ws.getWay().get("building") != null) {
    216                 EastNorth p1 = latlon2eastNorth(ws.getFirstNode().getCoor());
    217                 EastNorth p2 = latlon2eastNorth(ws.getSecondNode().getCoor());
     216                EastNorth p1 = latlon2eastNorth(ws.getFirstNode());
     217                EastNorth p2 = latlon2eastNorth(ws.getSecondNode());
    218218                EastNorth enX = Geometry.closestPointToSegment(p1, p2,
    219219                        latlon2eastNorth(MainApplication.getMap().mapView.getLatLon(mousePos.x, mousePos.y)));
  • applications/editors/josm/plugins/buildings_tools/src/org/openstreetmap/josm/plugins/buildings_tools/ToolSettings.java

    r35915 r35978  
    9898        } else {
    9999            ToolSettings.shape = Shape.RECTANGLE;
    100             return (Shape.RECTANGLE);
     100            return Shape.RECTANGLE;
    101101        }
    102102    }
Note: See TracChangeset for help on using the changeset viewer.