Changeset 15953 in osm
- Timestamp:
- 2009-06-16T20:31:02+02:00 (16 years ago)
- Location:
- applications/editors/josm/plugins/measurement
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/measurement/build.xml
r14015 r15953 25 25 <attribute name="Plugin-Date" value="${version.entry.commit.date}"/> 26 26 <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="1 465"/>27 <attribute name="Plugin-Mainversion" value="1640"/> 28 28 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/> 29 29 </manifest> -
applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementDialog.java
r13497 r15953 13 13 import java.util.Collection; 14 14 15 import javax.swing.JButton;16 15 import javax.swing.JLabel; 17 16 import javax.swing.JPanel; 18 17 19 18 import org.openstreetmap.josm.data.SelectionChangedListener; 19 import org.openstreetmap.josm.data.osm.DataSet; 20 import org.openstreetmap.josm.data.osm.Node; 20 21 import org.openstreetmap.josm.data.osm.OsmPrimitive; 21 22 import org.openstreetmap.josm.data.osm.Way; 22 import org.openstreetmap.josm. data.osm.Node;23 import org.openstreetmap.josm.gui.SideButton; 23 24 import org.openstreetmap.josm.gui.dialogs.ToggleDialog; 24 import org.openstreetmap.josm.gui.SideButton;25 import org.openstreetmap.josm.tools.ImageProvider;26 25 import org.openstreetmap.josm.tools.Shortcut; 27 import org.openstreetmap.josm.Main;28 26 29 27 /** … … 107 105 //TODO: is this enough? 108 106 109 Main.ds.selListeners.add(new SelectionChangedListener(){107 DataSet.selListeners.add(new SelectionChangedListener(){ 110 108 111 109 public void selectionChanged(Collection<? extends OsmPrimitive> arg0) { … … 120 118 lastNode = n; 121 119 }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()); 124 122 lastNode = n; 125 123 } … … 129 127 for(Node n: w.nodes){ 130 128 if(lastN != null){ 131 length += MeasurementLayer.calcDistance(lastN. coor, n.coor);129 length += MeasurementLayer.calcDistance(lastN.getCoor(), n.getCoor()); 132 130 //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())); 135 133 } 136 134 lastN = n; -
applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementLayer.java
r13497 r15953 14 14 import java.util.Collection; 15 15 16 import javax.swing.AbstractAction; 16 17 import javax.swing.Box; 17 import javax.swing.AbstractAction; 18 import javax.swing.DefaultListCellRenderer; 19 import javax.swing.DefaultListModel; 18 20 import javax.swing.Icon; 19 21 import javax.swing.ImageIcon; 20 import javax.swing.JMenuItem;21 22 import javax.swing.JCheckBox; 22 import javax.swing.JSeparator;23 import javax.swing.DefaultListCellRenderer;24 import javax.swing.DefaultListModel;25 import javax.swing.JButton;26 23 import javax.swing.JDialog; 27 import javax.swing.JOptionPane;28 24 import javax.swing.JLabel; 29 25 import 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; 26 import javax.swing.JMenuItem; 27 import javax.swing.JOptionPane; 28 import javax.swing.JSeparator; 36 29 37 30 import org.openstreetmap.josm.Main; 31 import org.openstreetmap.josm.data.coor.LatLon; 32 import org.openstreetmap.josm.data.gpx.GpxTrack; 33 import org.openstreetmap.josm.data.gpx.WayPoint; 34 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; 35 import org.openstreetmap.josm.gui.MapView; 36 import org.openstreetmap.josm.gui.dialogs.LayerListDialog; 37 import org.openstreetmap.josm.gui.dialogs.LayerListPopup; 38 import org.openstreetmap.josm.gui.layer.GpxLayer; 39 import org.openstreetmap.josm.gui.layer.Layer; 38 40 import 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;49 41 50 42 … … 214 206 double lat1, lon1, lat2, lon2; 215 207 double dlon; 216 double heading;217 208 218 209 lat1 = p1.lat() * Math.PI / 180.0; … … 257 248 private class GPXLayerImportAction extends AbstractAction { 258 249 259 private MeasurementLayer layer;260 261 250 /** 262 251 * The data model for the list component. … … 269 258 public GPXLayerImportAction(MeasurementLayer layer) { 270 259 super(tr("Import path from GPX layer"), ImageProvider.get("dialogs", "edit")); // TODO: find better image 271 this.layer = layer;272 260 } 273 261 -
applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementPlugin.java
r13497 r15953 36 36 currentLayer = new MeasurementLayer(tr("Measurements")); 37 37 Main.main.addLayer(currentLayer); 38 currentLayer.listeners.add(new LayerChangeListener(){38 Layer.listeners.add(new LayerChangeListener(){ 39 39 public void activeLayerChange(final Layer oldLayer, final Layer newLayer) { 40 40 if(newLayer instanceof MeasurementLayer)
Note:
See TracChangeset
for help on using the changeset viewer.