Changeset 15953 in osm


Ignore:
Timestamp:
2009-06-16T20:31:02+02:00 (15 years ago)
Author:
jttt
Message:

Use getter for Node.coor, fix warnings

Location:
applications/editors/josm/plugins/measurement
Files:
2 added
4 edited

Legend:

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

    r14015 r15953  
    2525                <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
    2626                <attribute name="Plugin-Description" value="Provide a measurement dialog and a layer to measure length and angle of segments, area surrounded by a (simple) closed way and create measurement paths (which also can be imported from a gps layer)."/>
    27                 <attribute name="Plugin-Mainversion" value="1465"/>
     27                <attribute name="Plugin-Mainversion" value="1640"/>
    2828                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
    2929            </manifest>
  • applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementDialog.java

    r13497 r15953  
    1313import java.util.Collection;
    1414
    15 import javax.swing.JButton;
    1615import javax.swing.JLabel;
    1716import javax.swing.JPanel;
    1817
    1918import org.openstreetmap.josm.data.SelectionChangedListener;
     19import org.openstreetmap.josm.data.osm.DataSet;
     20import org.openstreetmap.josm.data.osm.Node;
    2021import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2122import org.openstreetmap.josm.data.osm.Way;
    22 import org.openstreetmap.josm.data.osm.Node;
     23import org.openstreetmap.josm.gui.SideButton;
    2324import org.openstreetmap.josm.gui.dialogs.ToggleDialog;
    24 import org.openstreetmap.josm.gui.SideButton;
    25 import org.openstreetmap.josm.tools.ImageProvider;
    2625import org.openstreetmap.josm.tools.Shortcut;
    27 import org.openstreetmap.josm.Main;
    2826
    2927/**
     
    107105       //TODO: is this enough?
    108106
    109         Main.ds.selListeners.add(new SelectionChangedListener(){
     107        DataSet.selListeners.add(new SelectionChangedListener(){
    110108
    111109            public void selectionChanged(Collection<? extends OsmPrimitive> arg0) {
     
    120118                                            lastNode = n;
    121119                                        }else{
    122                                             length += MeasurementLayer.calcDistance(lastNode.coor, n.coor);
    123                                             segAngle = MeasurementLayer.angleBetween(lastNode.coor, n.coor);
     120                                            length += MeasurementLayer.calcDistance(lastNode.getCoor(), n.getCoor());
     121                                            segAngle = MeasurementLayer.angleBetween(lastNode.getCoor(), n.getCoor());
    124122                                            lastNode = n;
    125123                                        }
     
    129127                                        for(Node n: w.nodes){
    130128                                            if(lastN != null){
    131                                                 length += MeasurementLayer.calcDistance(lastN.coor, n.coor);
     129                                                length += MeasurementLayer.calcDistance(lastN.getCoor(), n.getCoor());
    132130                                                //http://local.wasp.uwa.edu.au/~pbourke/geometry/polyarea/
    133                                                 area += (MeasurementLayer.calcX(n.coor) * MeasurementLayer.calcY(lastN.coor))
    134                               - (MeasurementLayer.calcY(n.coor) * MeasurementLayer.calcX(lastN.coor));
     131                                                area += (MeasurementLayer.calcX(n.getCoor()) * MeasurementLayer.calcY(lastN.getCoor()))
     132                              - (MeasurementLayer.calcY(n.getCoor()) * MeasurementLayer.calcX(lastN.getCoor()));
    135133                                            }
    136134                                            lastN = n;
  • applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementLayer.java

    r13497 r15953  
    1414import java.util.Collection;
    1515
     16import javax.swing.AbstractAction;
    1617import javax.swing.Box;
    17 import javax.swing.AbstractAction;
     18import javax.swing.DefaultListCellRenderer;
     19import javax.swing.DefaultListModel;
    1820import javax.swing.Icon;
    1921import javax.swing.ImageIcon;
    20 import javax.swing.JMenuItem;
    2122import javax.swing.JCheckBox;
    22 import javax.swing.JSeparator;
    23 import javax.swing.DefaultListCellRenderer;
    24 import javax.swing.DefaultListModel;
    25 import javax.swing.JButton;
    2623import javax.swing.JDialog;
    27 import javax.swing.JOptionPane;
    2824import javax.swing.JLabel;
    2925import javax.swing.JList;
    30 import javax.swing.JPanel;
    31 import javax.swing.JScrollPane;
    32 import javax.swing.ListSelectionModel;
    33 import javax.swing.UIManager;
    34 import javax.swing.event.ListSelectionEvent;
    35 import javax.swing.event.ListSelectionListener;
     26import javax.swing.JMenuItem;
     27import javax.swing.JOptionPane;
     28import javax.swing.JSeparator;
    3629
    3730import org.openstreetmap.josm.Main;
     31import org.openstreetmap.josm.data.coor.LatLon;
     32import org.openstreetmap.josm.data.gpx.GpxTrack;
     33import org.openstreetmap.josm.data.gpx.WayPoint;
     34import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
     35import org.openstreetmap.josm.gui.MapView;
     36import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
     37import org.openstreetmap.josm.gui.dialogs.LayerListPopup;
     38import org.openstreetmap.josm.gui.layer.GpxLayer;
     39import org.openstreetmap.josm.gui.layer.Layer;
    3840import org.openstreetmap.josm.tools.ImageProvider;
    39 import org.openstreetmap.josm.data.coor.LatLon;
    40 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
    41 import org.openstreetmap.josm.data.gpx.WayPoint;
    42 import org.openstreetmap.josm.data.gpx.GpxData;
    43 import org.openstreetmap.josm.data.gpx.GpxTrack;
    44 import org.openstreetmap.josm.gui.MapView;
    45 import org.openstreetmap.josm.gui.dialogs.LayerListPopup;
    46 import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
    47 import org.openstreetmap.josm.gui.layer.Layer;
    48 import org.openstreetmap.josm.gui.layer.GpxLayer;
    4941
    5042
     
    214206        double lat1, lon1, lat2, lon2;
    215207        double dlon;
    216         double heading;
    217208
    218209        lat1 = p1.lat() * Math.PI / 180.0;
     
    257248    private class GPXLayerImportAction extends AbstractAction {
    258249
    259     private MeasurementLayer layer;
    260 
    261250    /**
    262251     * The data model for the list component.
     
    269258    public GPXLayerImportAction(MeasurementLayer layer) {
    270259        super(tr("Import path from GPX layer"), ImageProvider.get("dialogs", "edit")); // TODO: find better image
    271         this.layer = layer;
    272260    }
    273261
  • applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementPlugin.java

    r13497 r15953  
    3636            currentLayer = new MeasurementLayer(tr("Measurements"));
    3737            Main.main.addLayer(currentLayer);
    38             currentLayer.listeners.add(new LayerChangeListener(){
     38            Layer.listeners.add(new LayerChangeListener(){
    3939                public void activeLayerChange(final Layer oldLayer, final Layer newLayer) {
    4040                    if(newLayer instanceof MeasurementLayer)
Note: See TracChangeset for help on using the changeset viewer.