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/indoor_sweepline/src/indoor_sweepline
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/indoor_sweepline/src/indoor_sweepline/CorridorGeography.java

    r32601 r35978  
    44import java.util.Vector;
    55
     6import org.openstreetmap.josm.data.coor.ILatLon;
    67import org.openstreetmap.josm.data.coor.LatLon;
    78import org.openstreetmap.josm.data.osm.DataSet;
     
    1718    private static final double MIN_LENGTH = 10.;
    1819
    19     private void setExtraElements(CorridorPart.ReachableSide side, LatLon from, LatLon to,
     20    private void setExtraElements(CorridorPart.ReachableSide side, ILatLon from, ILatLon to,
    2021            boolean extraWayUp, double minLength) {
    2122        LatLon middleCoor = new LatLon((from.lat() + to.lat())/2.,
     
    2728            middleNode.setCoor(middleCoor);
    2829
    29         LatLon start = from;
     30        ILatLon start = from;
    3031        if (side == CorridorPart.ReachableSide.LEFT) {
    3132            if (middleCoor.lat() < start.lat())
     
    7172
    7273    public void appendNodes(CorridorPart.Type type, CorridorPart.ReachableSide side, String level,
    73             LatLon from, LatLon to, ModelGeography target) {
     74            ILatLon from, ILatLon to, ModelGeography target) {
    7475        if (type == CorridorPart.Type.STAIRS_UP || type == CorridorPart.Type.STAIRS_DOWN) {
    7576            setExtraElements(side, from, to, type == CorridorPart.Type.STAIRS_UP, MIN_LENGTH);
  • applications/editors/josm/plugins/indoor_sweepline/src/indoor_sweepline/ModelGeography.java

    r32601 r35978  
    8585
    8686    public void finishWay(Strip strip, int partIndex, boolean isOuter, String level) {
    87         if (nodes.size() > 0) {
     87        if (!nodes.isEmpty()) {
    8888            CorridorPart part = strip.partAt(partIndex);
    8989            strip.geographyAt(partIndex).appendNodes(part.getType(), part.getSide(), level,
    90                     nodes.elementAt(nodes.size()-1).getCoor(), nodes.elementAt(0).getCoor(), this);
     90                    nodes.elementAt(nodes.size()-1), nodes.elementAt(0), this);
    9191            nodes.add(nodes.elementAt(0));
    9292        }
     
    9898    public void appendCorridorPart(CorridorPart part, CorridorGeography partGeography, int beamIndex, int partIndex,
    9999            String level) {
    100         if (nodes.size() > 0)
     100        if (!nodes.isEmpty())
    101101            partGeography.appendNodes(part.getType(), part.getSide(), level,
    102                     nodes.elementAt(nodes.size()-1).getCoor(),
     102                    nodes.elementAt(nodes.size()-1),
    103103                    beamsGeography.elementAt(beamIndex).coorAt(partIndex), this);
    104104    }
     
    113113                    0, strip.width / 2.));
    114114
    115         if (nodes.size() > 0) {
     115        if (!nodes.isEmpty()) {
    116116            CorridorPart part = strip.partAt(partIndex);
    117117            strip.geographyAt(partIndex).appendNodes(part.getType(), part.getSide(), level,
    118                     nodes.elementAt(nodes.size()-1).getCoor(), nodePool.elementAt(nodePoolCount).getCoor(), this);
     118                    nodes.elementAt(nodes.size()-1), nodePool.elementAt(nodePoolCount), this);
    119119        }
    120120        nodes.add(nodePool.elementAt(nodePoolCount));
     
    183183    private void adjustMultipolygonRelation(IndoorSweeplineModel.Type type, String level) {
    184184        if (members.size() > 1) {
    185             if (wayPool.size() > 0)
     185            if (!wayPool.isEmpty())
    186186                wayPool.elementAt(0).removeAll();
    187187
Note: See TracChangeset for help on using the changeset viewer.