Ignore:
Timestamp:
2022-06-15T20:10:48+02:00 (2 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/public_transport
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/public_transport/build.xml

    r35221 r35978  
    55    <property name="commit.message" value="Commit message"/>
    66    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    7     <property name="plugin.main.version" value="15502"/>
     7    <property name="plugin.main.version" value="18494"/>
    88
    99    <property name="plugin.author" value="Roland M. Olbricht"/>
  • applications/editors/josm/plugins/public_transport/src/org/openstreetmap/josm/plugins/public_transport/PublicTransportAStar.java

    r34718 r35978  
    7070            double totalDistance = 0;
    7171            for (int i = min; i < max; ++i) {
    72                 totalDistance += way.getNode(i).getCoor().greatCircleDistance(way.getNode(i + 1).getCoor());
     72                totalDistance += way.getNode(i).greatCircleDistance(way.getNode(i + 1));
    7373            }
    7474            return totalDistance;
     
    138138    public double estimateDistance(AStarAlgorithm.Vertex vertex) {
    139139        NodeVertex nodeVertex = (NodeVertex) vertex;
    140         return ((NodeVertex) super.end).node.getCoor()
    141                 .greatCircleDistance(nodeVertex.node.getCoor());
     140        return ((NodeVertex) super.end).node
     141                .greatCircleDistance(nodeVertex.node);
    142142    }
    143143}
  • applications/editors/josm/plugins/public_transport/src/org/openstreetmap/josm/plugins/public_transport/commands/TrackSuggestStopsCommand.java

    r35219 r35978  
    99
    1010import org.openstreetmap.josm.command.Command;
     11import org.openstreetmap.josm.data.coor.ILatLon;
    1112import org.openstreetmap.josm.data.coor.LatLon;
    1213import org.openstreetmap.josm.data.gpx.IGpxTrackSegment;
     
    121122            if (j < k) {
    122123                double dist = 0;
    123                 LatLon latLonI = wayPoints.elementAt(i).getCoor();
     124                ILatLon latLonI = wayPoints.elementAt(i).getCoor();
    124125                for (int l = j; l < k; ++l) {
    125                     double distL = latLonI.greatCircleDistance(wayPoints.elementAt(l).getCoor());
     126                    double distL = latLonI.greatCircleDistance(wayPoints.elementAt(l));
    126127                    if (distL > dist)
    127128                        dist = distL;
     
    148149
    149150            LatLon latLon = wayPoints.elementAt(i).getCoor();
    150             if ((lastStopCoor != null) && (lastStopCoor.greatCircleDistance(latLon) < threshold))
     151            if ((lastStopCoor != null) && (lastStopCoor.greatCircleDistance((ILatLon) latLon) < threshold))
    151152                continue;
    152153
  • applications/editors/josm/plugins/public_transport/src/org/openstreetmap/josm/plugins/public_transport/models/GTFSStopTableModel.java

    r34718 r35978  
    180180        while (iter.hasNext()) {
    181181            Node node = iter.next();
    182             if (coor.greatCircleDistance(node.getCoor()) < 1000) {
     182            if (coor.greatCircleDistance(node) < 1000) {
    183183                nearBusStop = true;
    184184                break;
Note: See TracChangeset for help on using the changeset viewer.