Changeset 34529 in osm
- Timestamp:
- 2018-08-18T18:47:48+02:00 (6 years ago)
- Location:
- applications/editors/josm/plugins/measurement
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/measurement/build.xml
r33760 r34529 4 4 <property name="commit.message" value="recompile dure to core change"/> 5 5 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 6 <property name="plugin.main.version" value="1 2636"/>6 <property name="plugin.main.version" value="14153"/> 7 7 <property name="plugin.canloadatruntime" value="true"/> 8 8 -
applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementDialog.java
r33760 r34529 16 16 import javax.swing.JPanel; 17 17 18 import org.openstreetmap.josm.data.SelectionChangedListener;19 18 import org.openstreetmap.josm.data.SystemOfMeasurement; 20 19 import org.openstreetmap.josm.data.SystemOfMeasurement.SoMChangeListener; 20 import org.openstreetmap.josm.data.osm.DataSelectionListener; 21 21 import org.openstreetmap.josm.data.osm.DataSet; 22 22 import org.openstreetmap.josm.data.osm.Node; … … 30 30 import org.openstreetmap.josm.data.osm.event.PrimitivesRemovedEvent; 31 31 import org.openstreetmap.josm.data.osm.event.RelationMembersChangedEvent; 32 import org.openstreetmap.josm.data.osm.event.SelectionEventManager; 32 33 import org.openstreetmap.josm.data.osm.event.TagsChangedEvent; 33 34 import org.openstreetmap.josm.data.osm.event.WayNodesChangedEvent; … … 46 47 * @author ramack 47 48 */ 48 public class MeasurementDialog extends ToggleDialog implements SelectionChangedListener, DataSetListener, SoMChangeListener {49 public class MeasurementDialog extends ToggleDialog implements DataSelectionListener, DataSetListener, SoMChangeListener { 49 50 private static final long serialVersionUID = 4708541586297950021L; 50 51 … … 142 143 })); 143 144 144 DataSet.addSelectionListener(this);145 SelectionEventManager.getInstance().addSelectionListener(this); 145 146 SystemOfMeasurement.addSoMChangeListener(this); 146 147 } … … 170 171 171 172 @Override 172 public void selectionChanged( Collection<? extends OsmPrimitive> newSelection) {173 refresh( newSelection);173 public void selectionChanged(SelectionChangeEvent event) { 174 refresh(event.getSelection()); 174 175 } 175 176 … … 262 263 super.destroy(); 263 264 SystemOfMeasurement.removeSoMChangeListener(this); 264 DataSet.removeSelectionListener(this);265 SelectionEventManager.getInstance().removeSelectionListener(this); 265 266 if (ds != null) { 266 267 ds.removeDataSetListener(this); -
applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementLayer.java
r33760 r34529 27 27 import javax.swing.JOptionPane; 28 28 29 import org.openstreetmap.josm.Main;30 29 import org.openstreetmap.josm.data.Bounds; 31 30 import org.openstreetmap.josm.data.coor.LatLon; … … 103 102 public Action[] getMenuEntries() { 104 103 return new Action[]{ 105 LayerListDialog.getInstance().createShowHideLayerAction(),106 // TODO: implement new JMenuItem(new LayerListDialog.DeleteLayerAction(this)),107 SeparatorLayerAction.INSTANCE,108 new GPXLayerImportAction(this),109 SeparatorLayerAction.INSTANCE,110 new LayerListPopup.InfoAction(this)};104 LayerListDialog.getInstance().createShowHideLayerAction(), 105 // TODO: implement new JMenuItem(new LayerListDialog.DeleteLayerAction(this)), 106 SeparatorLayerAction.INSTANCE, 107 new GPXLayerImportAction(this), 108 SeparatorLayerAction.INSTANCE, 109 new LayerListPopup.InfoAction(this)}; 111 110 } 112 111 … … 186 185 187 186 return (180 * Math.atan2(coslat2 * Math.sin(dlon), 188 189 190 187 (Math.cos(lat1) * Math.sin(lat2) 188 - 189 Math.sin(lat1) * coslat2 * Math.cos(dlon)))) / Math.PI; 191 190 } 192 191 … … 207 206 double d = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); 208 207 heading = Math.acos((Math.sin(lat2) - Math.sin(lat1) * Math.cos(d)) 209 208 / (Math.sin(d) * Math.cos(lat1))); 210 209 if (Math.sin(lon2 - lon1) < 0) { 211 210 heading = 2 * Math.PI - heading; … … 253 252 Layer layer = (Layer)value; 254 253 JLabel label = (JLabel)super.getListCellRendererComponent(list, 255 254 layer.getName(), index, isSelected, cellHasFocus); 256 255 Icon icon = layer.getIcon(); 257 256 label.setIcon(icon); … … 267 266 268 267 final JOptionPane optionPane = new JOptionPane(panel, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION){ 269 270 271 272 273 274 final JDialog dlg = optionPane.createDialog(Main .parent, tr("Import path from GPX layer"));268 @Override 269 public void selectInitialValue() { 270 layerList.requestFocusInWindow(); 271 } 272 }; 273 final JDialog dlg = optionPane.createDialog(MainApplication.getMainFrame(), tr("Import path from GPX layer")); 275 274 dlg.setVisible(true); 276 275 277 276 Object answer = optionPane.getValue(); 278 277 if (answer == null || answer == JOptionPane.UNINITIALIZED_VALUE || 279 (answer instanceof Integer && (Integer)answer != JOptionPane.OK_OPTION)) {278 (answer instanceof Integer && (Integer)answer != JOptionPane.OK_OPTION)) { 280 279 return; 281 280 } … … 297 296 // TODO: register a listener and show menu entry only if gps layers are available 298 297 // no gps layer 299 JOptionPane.showMessageDialog(Main .parent,tr("No GPX data layer found."));298 JOptionPane.showMessageDialog(MainApplication.getMainFrame(),tr("No GPX data layer found.")); 300 299 } 301 300 } -
applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementMode.java
r33760 r34529 9 9 import javax.swing.JOptionPane; 10 10 11 import org.openstreetmap.josm.Main;12 11 import org.openstreetmap.josm.actions.mapmode.MapMode; 13 12 import org.openstreetmap.josm.data.coor.LatLon; … … 49 48 LatLon coor = MainApplication.getMap().mapView.getLatLon(e.getX(), e.getY()); 50 49 if (coor.isOutSideWorld()) { 51 JOptionPane.showMessageDialog(Main .parent,tr("Can not draw outside of the world."));50 JOptionPane.showMessageDialog(MainApplication.getMainFrame(),tr("Can not draw outside of the world.")); 52 51 return; 53 52 }
Note:
See TracChangeset
for help on using the changeset viewer.