Changeset 8372 in josm for trunk/src


Ignore:
Timestamp:
2015-05-17T02:24:13+02:00 (9 years ago)
Author:
Don-vip
Message:

code cleanup

Location:
trunk/src/org/openstreetmap/josm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/mapmode/ImproveWayAccuracyHelper.java

    r7937 r8372  
    5757        }
    5858
    59         candidate = Main.map.mapView.getNearestWay(p,
    60                 OsmPrimitive.isSelectablePredicate);
    61 
    62         return candidate;
     59        return Main.map.mapView.getNearestWay(p, OsmPrimitive.isSelectablePredicate);
    6360    }
    6461
     
    145142            EastNorth a = wpp.a.getEastNorth();
    146143            EastNorth b = wpp.b.getEastNorth();
    147            
     144
    148145            // Finding intersection of the segment with its altitude from p
    149146            EastNorth altitudeIntersection = Geometry.closestPointToSegment(a, b, pEN);
    150147            currentDistance = pEN.distance(altitudeIntersection);
    151            
     148
    152149            if (!altitudeIntersection.equals(a) && !altitudeIntersection.equals(b)) {
    153150                // If the segment intersects with the altitude from p,
  • trunk/src/org/openstreetmap/josm/gui/history/CoordinateInfoViewer.java

    r8308 r8372  
    100100
    101101    /**
    102      *
     102     * Constructs a new {@code CoordinateInfoViewer}.
    103103     * @param model the model. Must not be null.
    104104     * @throws IllegalArgumentException if model is null
     
    173173        private transient HistoryBrowserModel model;
    174174        private PointInTimeType role;
     175
     176        protected LatLon coord;
     177        protected LatLon oppositeCoord;
    175178
    176179        protected HistoryOsmPrimitive getPrimitive() {
     
    249252        }
    250253
    251         protected void refresh() {
     254        protected final boolean prepareRefresh() {
    252255            HistoryOsmPrimitive p = getPrimitive();
    253256            HistoryOsmPrimitive  opposite = getOppositePrimitive();
    254             if (!(p instanceof HistoryNode)) return;
    255             if (!(opposite instanceof HistoryNode)) return;
     257            if (!(p instanceof HistoryNode)) return false;
     258            if (!(opposite instanceof HistoryNode)) return false;
    256259            HistoryNode node = (HistoryNode)p;
    257260            HistoryNode oppositeNode = (HistoryNode) opposite;
    258261
    259             LatLon coord = node.getCoords();
    260             LatLon oppositeCoord = oppositeNode.getCoords();
     262            coord = node.getCoords();
     263            oppositeCoord = oppositeNode.getCoords();
     264            return true;
     265        }
     266
     267        protected void refresh() {
     268            if (!prepareRefresh()) return;
    261269
    262270            // display the coordinates
     
    323331        @Override
    324332        protected void refresh() {
    325             HistoryOsmPrimitive p = getPrimitive();
    326             HistoryOsmPrimitive opposite = getOppositePrimitive();
    327             if (!(p instanceof HistoryNode)) return;
    328             if (!(opposite instanceof HistoryNode)) return;
    329             HistoryNode node = (HistoryNode) p;
    330             HistoryNode oppositeNode = (HistoryNode) opposite;
    331 
    332             LatLon coord = node.getCoords();
    333             LatLon oppositeCoord = oppositeNode.getCoords();
     333            if (!prepareRefresh()) return;
    334334
    335335            // update distance
  • trunk/src/org/openstreetmap/josm/tools/date/PrimaryDateParser.java

    r7299 r8372  
    183183
    184184    private Date parseShortStandardDate(String date) {
    185         int year;
    186         int month;
    187         int day;
    188         int hour;
    189         int minute;
    190         int second;
    191 
    192         year = Integer.parseInt(date.substring(0, 4));
    193         month = Integer.parseInt(date.substring(5, 7));
    194         day = Integer.parseInt(date.substring(8, 10));
    195         hour = Integer.parseInt(date.substring(11, 13));
    196         minute = Integer.parseInt(date.substring(14, 16));
    197         second = Integer.parseInt(date.substring(17, 19));
     185        int year = Integer.parseInt(date.substring(0, 4));
     186        int month = Integer.parseInt(date.substring(5, 7));
     187        int day = Integer.parseInt(date.substring(8, 10));
     188        int hour = Integer.parseInt(date.substring(11, 13));
     189        int minute = Integer.parseInt(date.substring(14, 16));
     190        int second = Integer.parseInt(date.substring(17, 19));
    198191
    199192        calendar.clear();
     
    209202
    210203    private Date parseLongStandardDate(String date) {
    211         int year;
    212         int month;
    213         int day;
    214         int hour;
    215         int minute;
    216         int second;
    217         int millisecond;
    218 
    219         year = Integer.parseInt(date.substring(0, 4));
    220         month = Integer.parseInt(date.substring(5, 7));
    221         day = Integer.parseInt(date.substring(8, 10));
    222         hour = Integer.parseInt(date.substring(11, 13));
    223         minute = Integer.parseInt(date.substring(14, 16));
    224         second = Integer.parseInt(date.substring(17, 19));
    225         millisecond = Integer.parseInt(date.substring(20, 23));
     204        int year = Integer.parseInt(date.substring(0, 4));
     205        int month = Integer.parseInt(date.substring(5, 7));
     206        int day = Integer.parseInt(date.substring(8, 10));
     207        int hour = Integer.parseInt(date.substring(11, 13));
     208        int minute = Integer.parseInt(date.substring(14, 16));
     209        int second = Integer.parseInt(date.substring(17, 19));
     210        int millisecond = Integer.parseInt(date.substring(20, 23));
    226211
    227212        calendar.clear();
Note: See TracChangeset for help on using the changeset viewer.