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

code cleanup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.