Changeset 30353 in osm for applications/editors


Ignore:
Timestamp:
2014-03-24T22:03:31+01:00 (10 years ago)
Author:
donvip
Message:

[josm_measurement] code cleanup

Location:
applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementDialog.java

    r30104 r30353  
    8888
    8989        resetButton = new SideButton(new AbstractAction() {
    90                 {
    91                         putValue(NAME, tr("Reset"));
    92                         putValue(SMALL_ICON,ImageProvider.get("dialogs", "select"));
    93                         putValue(SHORT_DESCRIPTION, tr("Reset current measurement results and delete measurement path."));
    94                         putValue("help", HelpUtil.ht("/Dialog/Measurement#Reset"));
    95                 }
     90            {
     91                putValue(NAME, tr("Reset"));
     92                putValue(SMALL_ICON,ImageProvider.get("dialogs", "select"));
     93                putValue(SHORT_DESCRIPTION, tr("Reset current measurement results and delete measurement path."));
     94                putValue("help", HelpUtil.ht("/Dialog/Measurement#Reset"));
     95            }
    9696            @Override
    9797            public void actionPerformed(ActionEvent e)
    9898            {
    99                 resetValues();
     99                resetValues();
    100100            }
    101101        });
     
    222222            ds = currentDs;
    223223        }
    224         }
    225 
    226         @Override
    227         public void destroy() {
    228                 super.destroy();
    229                 NavigatableComponent.removeSoMChangeListener(this);
    230                 DataSet.removeSelectionListener(this);
    231                 if (ds != null) {
    232                     ds.removeDataSetListener(this);
    233                     ds = null;
    234                 }
    235         }
    236 
    237         private boolean waysContain(Node n) {
    238             if (ways != null) {
    239                 for (Way w : ways) {
    240                     if (w.containsNode(n)) {
    241                         return true;
    242                     }
    243                 }
    244             }
    245             return false;
    246         }
    247        
     224    }
     225
     226    @Override
     227    public void destroy() {
     228        super.destroy();
     229        NavigatableComponent.removeSoMChangeListener(this);
     230        DataSet.removeSelectionListener(this);
     231        if (ds != null) {
     232            ds.removeDataSetListener(this);
     233            ds = null;
     234        }
     235    }
     236
     237    private boolean waysContain(Node n) {
     238        if (ways != null) {
     239            for (Way w : ways) {
     240                if (w.containsNode(n)) {
     241                    return true;
     242                }
     243            }
     244        }
     245        return false;
     246    }
     247   
    248248    @Override public void nodeMoved(NodeMovedEvent event) {
    249249        Node n = event.getNode();
     
    262262    @Override public void dataChanged(DataChangedEvent event) {}
    263263
    264         @Override
    265         public void systemOfMeasurementChanged(String oldSoM, String newSoM) {
    266                 // Refresh selection to take into account new system of measurement
    267                 selectionChanged(Main.main.getCurrentDataSet().getSelected());
    268         }
     264    @Override
     265    public void systemOfMeasurementChanged(String oldSoM, String newSoM) {
     266        // Refresh selection to take into account new system of measurement
     267        selectionChanged(Main.main.getCurrentDataSet().getSelected());
     268    }
    269269}
  • applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementLayer.java

    r29578 r30353  
    144144    }
    145145   
    146         /*
     146    /*
    147147     * Use an equal area sinusoidal projection to improve accuracy and so we can still use normal polygon area calculation
    148      * http://stackoverflow.com/questions/4681737/how-to-calculate-the-area-of-a-polygon-on-the-earths-surface-using-python
     148     * https://stackoverflow.com/questions/4681737/how-to-calculate-the-area-of-a-polygon-on-the-earths-surface-using-python
    149149     */
    150150    public static double calcX(LatLon p1){
    151151        return p1.lat() * Math.PI * 6367000 / 180;
    152         }
     152    }
    153153
    154154    public static double calcY(LatLon p1){
  • applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementPlugin.java

    r28624 r30353  
    3232            newFrame.addMapMode(btn);
    3333        } else {
    34                 btn = null;
    35                 mode = null;
    36                 measurementDialog = null;
     34            btn = null;
     35            mode = null;
     36            measurementDialog = null;
    3737        }
    3838    }
Note: See TracChangeset for help on using the changeset viewer.