Changeset 29769 in osm
- Timestamp:
- 2013-07-24T18:01:58+02:00 (11 years ago)
- Location:
- applications/editors/josm/plugins
- Files:
-
- 6 added
- 55 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/CommandLine/src/CommandLine/AnyAction.java
r29505 r29769 107 107 } 108 108 109 @Override 109 110 public void eventDispatched(AWTEvent arg0) { 110 111 112 111 if (!(arg0 instanceof KeyEvent)) 112 return; 113 KeyEvent ev = (KeyEvent) arg0; 113 114 isCtrlDown = (ev.getModifiersEx() & KeyEvent.CTRL_DOWN_MASK) != 0; 114 115 if (ev.getKeyCode() == KeyEvent.VK_ESCAPE && ev.getID() == KeyEvent.KEY_PRESSED) { … … 142 143 // We invoke this to prevent strange things from happening 143 144 EventQueue.invokeLater(new Runnable() { 145 @Override 144 146 public void run() { 145 147 // Don't change cursor when mode has changed already -
applications/editors/josm/plugins/CommandLine/src/CommandLine/CommandLine.java
r29566 r29769 190 190 191 191 if ( Main.main.menu != null ) { 192 commandMenu = Main.main.menu.addMenu(marktr("Commands") , KeyEvent.VK_M, Main.main.menu.defaultMenuPos, ht("/Plugin/CommandLine")); 193 MainMenu.add(Main.main.menu.toolsMenu, new CommandLineAction(this)); 192 boolean oldMenu = org.openstreetmap.josm.data.Version.getInstance().getVersion() < 6082; 193 commandMenu = Main.main.menu.addMenu(marktr("Commands") , oldMenu?KeyEvent.VK_M : KeyEvent.VK_O, Main.main.menu.defaultMenuPos, ht("/Plugin/CommandLine")); 194 MainMenu.add(commandMenu, new CommandLineAction(this)); 194 195 } 195 196 loadCommands(); -
applications/editors/josm/plugins/CommandLine/src/CommandLine/DummyAction.java
r29505 r29769 18 18 19 19 public class DummyAction extends MapMode implements AWTEventListener { 20 20 private CommandLine parentPlugin; 21 21 22 23 24 25 22 public DummyAction(MapFrame mapFrame, CommandLine parentPlugin) { 23 super(null, "addsegment.png", null, mapFrame, ImageProvider.getCursor("normal", null)); 24 this.parentPlugin = parentPlugin; 25 } 26 26 27 public void eventDispatched(AWTEvent arg0) { 28 if (!(arg0 instanceof KeyEvent)) 29 return; 30 KeyEvent ev = (KeyEvent) arg0; 27 @Override 28 public void eventDispatched(AWTEvent arg0) { 29 if (!(arg0 instanceof KeyEvent)) 30 return; 31 KeyEvent ev = (KeyEvent) arg0; 31 32 if (ev.getKeyCode() == KeyEvent.VK_ESCAPE && ev.getID() == KeyEvent.KEY_PRESSED) { 32 33 ev.consume(); -
applications/editors/josm/plugins/CommandLine/src/CommandLine/Loader.java
r29505 r29769 67 67 } 68 68 69 @Override 69 70 public void startElement(String namespaceURI, String localName, String rawName, Attributes attrs) { 70 71 int len = attrs.getLength(); … … 125 126 } 126 127 128 @Override 127 129 public void characters(char ch[], int start, int length) 128 130 { … … 165 167 } 166 168 169 @Override 167 170 public void warning(SAXParseException ex) { 168 171 System.err.println("Warning in command xml file " + currentFile + ": " + ex.getMessage()); 169 172 } 170 173 174 @Override 171 175 public void error(SAXParseException ex) { 172 176 System.err.println("Error in command xml file " + currentFile + ": " + ex.getMessage()); 173 177 } 174 178 179 @Override 175 180 public void fatalError(SAXParseException ex) throws SAXException { 176 181 System.err.println("Error in command xml file " + currentFile + ": " + ex.getMessage()); -
applications/editors/josm/plugins/CommandLine/src/CommandLine/NodeAction.java
r29505 r29769 109 109 } 110 110 111 @Override 111 112 public void eventDispatched(AWTEvent arg0) { 112 113 114 113 if (!(arg0 instanceof KeyEvent)) 114 return; 115 KeyEvent ev = (KeyEvent) arg0; 115 116 isCtrlDown = (ev.getModifiersEx() & KeyEvent.CTRL_DOWN_MASK) != 0; 116 117 if (ev.getKeyCode() == KeyEvent.VK_ESCAPE && ev.getID() == KeyEvent.KEY_PRESSED) { … … 144 145 // We invoke this to prevent strange things from happening 145 146 EventQueue.invokeLater(new Runnable() { 147 @Override 146 148 public void run() { 147 149 // Don't change cursor when mode has changed already -
applications/editors/josm/plugins/CommandLine/src/CommandLine/PointAction.java
r29505 r29769 120 120 } 121 121 122 @Override 122 123 public void eventDispatched(AWTEvent arg0) { 123 124 if (!(arg0 instanceof KeyEvent)) … … 157 158 // We invoke this to prevent strange things from happening 158 159 EventQueue.invokeLater(new Runnable() { 160 @Override 159 161 public void run() { 160 162 // Don't change cursor when mode has changed already -
applications/editors/josm/plugins/CommandLine/src/CommandLine/RelationAction.java
r29505 r29769 25 25 } 26 26 27 @Override 27 28 public void eventDispatched(AWTEvent arg0) { 28 29 if (!(arg0 instanceof KeyEvent)) -
applications/editors/josm/plugins/CommandLine/src/CommandLine/WayAction.java
r29505 r29769 130 130 } 131 131 132 @Override 132 133 public void eventDispatched(AWTEvent arg0) { 133 134 135 134 if (!(arg0 instanceof KeyEvent)) 135 return; 136 KeyEvent ev = (KeyEvent) arg0; 136 137 isCtrlDown = (ev.getModifiersEx() & KeyEvent.CTRL_DOWN_MASK) != 0; 137 138 if (ev.getKeyCode() == KeyEvent.VK_ESCAPE && ev.getID() == KeyEvent.KEY_PRESSED) { … … 143 144 private void updCursor() { 144 145 if (mousePos != null) { 145 146 147 148 149 150 151 152 153 154 146 if (!Main.isDisplayingMapView()) 147 return; 148 nearestWay = Main.map.mapView.getNearestWay(mousePos, OsmPrimitive.isUsablePredicate); 149 if (nearestWay != null) { 150 setCursor(cursorActive); 151 } 152 else { 153 setCursor(cursorNormal); 154 } 155 } 155 156 } 156 157 157 158 159 158 private void processMouseEvent(MouseEvent e) { 159 if (e != null) { mousePos = e.getPoint(); } 160 } 160 161 161 162 private void setCursor(final Cursor c) { … … 165 166 // We invoke this to prevent strange things from happening 166 167 EventQueue.invokeLater(new Runnable() { 168 @Override 167 169 public void run() { 168 170 // Don't change cursor when mode has changed already -
applications/editors/josm/plugins/imagerycache/nbproject/project.xml
r29484 r29769 17 17 </source-folder> 18 18 <source-folder> 19 <label>src</label> 20 <type>java</type> 21 <location>src</location> 22 <encoding>UTF-8</encoding> 19 <label>F:\Java\josm\core\src</label> 20 <location>F:\Java\josm\core\src</location> 23 21 </source-folder> 24 22 <source-folder> … … 27 25 <location>F:\Java\josm\core\src</location> 28 26 <encoding>UTF-8</encoding> 29 </source-folder>30 <source-folder>31 <label>F:\Java\josm\core\src</label>32 <location>F:\Java\josm\core\src</location>33 27 </source-folder> 34 28 </folders> … … 54 48 <items> 55 49 <source-folder style="packages"> 56 <label>src</label>57 <location>src</location>58 </source-folder>59 <source-folder style="packages">60 50 <label>F:\Java\josm\core\src</label> 61 51 <location>F:\Java\josm\core\src</location> … … 77 67 <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/3"> 78 68 <compilation-unit> 79 <package-root> src</package-root>69 <package-root>F:\Java\josm\core\src</package-root> 80 70 <classpath mode="compile">../../core/src</classpath> 81 <source-level>1.6</source-level>82 </compilation-unit>83 <compilation-unit>84 <package-root>F:\Java\josm\core\src</package-root>85 71 <source-level>1.6</source-level> 86 72 </compilation-unit> -
applications/editors/josm/plugins/imagerycache/src/org/openstreetmap/josm/plugins/imagerycache/OsmDBTilesLoader.java
r29690 r29769 14 14 import org.openstreetmap.gui.jmapviewer.OsmTileLoader; 15 15 import org.openstreetmap.gui.jmapviewer.Tile; 16 import org.openstreetmap.gui.jmapviewer.interfaces.CachedTileLoader; 17 import org.openstreetmap.gui.jmapviewer.interfaces.TileClearController; 16 18 import org.openstreetmap.gui.jmapviewer.interfaces.TileJob; 17 19 import org.openstreetmap.gui.jmapviewer.interfaces.TileLoaderListener; … … 24 26 * @author Alexei Kasatkin, based on OsmFileCacheTileLoader by @author Jan Peter Stotz, @author Stefan Zeller 25 27 */ 26 class OsmDBTilesLoader extends OsmTileLoader {28 class OsmDBTilesLoader extends OsmTileLoader implements CachedTileLoader { 27 29 28 30 … … 49 51 } 50 52 53 @Override 54 public void clearCache(TileSource source) { 55 clearCache(source, null); 56 } 57 58 @Override 59 public void clearCache(TileSource source, TileClearController controller) { 60 dao.cleanStorage(source.getName()); 61 } 62 51 63 protected class DatabaseLoadJob implements TileJob { 52 64 -
applications/editors/josm/plugins/imagerycache/src/org/openstreetmap/josm/plugins/imagerycache/TileDAOMapDB.java
r29690 r29769 6 6 import org.mapdb.DB; 7 7 import org.mapdb.DBMaker; 8 import org.openstreetmap.josm.Main; 8 9 import org.openstreetmap.josm.data.preferences.BooleanProperty; 9 10 … … 186 187 } 187 188 189 public void cleanStorage(String name) { 190 Main.info("Cleaning storage: {0}", name); 191 dbs.get(name).close(); 192 for (int t=0; t<20; t++) { 193 try { 194 String fname = getDBFileName(name, t); 195 File f = new File(cacheFolder, fname); 196 if (!f.exists() || !f.canWrite()) continue; 197 f.delete(); 198 } catch (Exception e) { 199 Main.warn("Can not delete file"); 200 } 201 } 202 } 188 203 } -
applications/editors/josm/plugins/livegps/src/livegps/AppendableGpxTrackSegment.java
r23191 r29769 19 19 private double length; 20 20 21 @Override 21 22 public Bounds getBounds() { 22 23 return bounds; 23 24 } 24 25 26 @Override 25 27 public Collection<WayPoint> getWayPoints() { 26 28 return new CopyList<WayPoint>(wayPoints, size); … … 51 53 } 52 54 55 @Override 53 56 public double length() { 54 57 return length; -
applications/editors/josm/plugins/livegps/src/livegps/LiveGpsAcquirer.java
r27021 r29769 3 3 import static org.openstreetmap.josm.tools.I18n.tr; 4 4 5 import java.lang.Float;6 5 7 6 import java.beans.PropertyChangeEvent; … … 16 15 17 16 import org.openstreetmap.josm.Main; 18 import org.openstreetmap.josm.data.coor.LatLon;19 17 20 18 import org.json.JSONObject; … … 118 116 } 119 117 118 @Override 120 119 public void run() { 121 120 LiveGpsData oldGpsData = null; … … 133 132 Thread.sleep(1000); 134 133 } catch (InterruptedException ignore) {} 135 } ;134 } 136 135 } 137 136 … … 167 166 try { 168 167 Thread.sleep(1000); 169 } catch (InterruptedException ignore) {} ;168 } catch (InterruptedException ignore) {} 170 169 // send warning to layer 171 170 } … … 235 234 Watch.put("enable", true); 236 235 Watch.put("json", true); 237 } catch (JSONException je) {} ;236 } catch (JSONException je) {} 238 237 239 238 String Request = "?WATCH=" + Watch.toString() + ";\n"; -
applications/editors/josm/plugins/livegps/src/livegps/LiveGpsDialog.java
r27852 r29769 6 6 import static org.openstreetmap.josm.tools.I18n.tr; 7 7 8 import java.awt.BorderLayout;9 8 import java.awt.Color; 10 9 import java.awt.GridLayout; … … 15 14 import javax.swing.JLabel; 16 15 import javax.swing.JPanel; 17 import javax.swing.JScrollPane;18 16 19 17 import org.openstreetmap.josm.gui.MapFrame; -
applications/editors/josm/plugins/livegps/src/livegps/LiveGpsPlugin.java
r27852 r29769 52 52 } 53 53 54 @Override 54 55 public void actionPerformed(ActionEvent e) { 55 56 enableTracking(lgpscapture.isSelected()); … … 66 67 } 67 68 69 @Override 68 70 public void actionPerformed(ActionEvent e) { 69 71 if (lgpslayer != null) { … … 84 86 } 85 87 88 @Override 86 89 public void actionPerformed(ActionEvent e) { 87 90 if (lgpslayer != null) { … … 91 94 } 92 95 96 @Override 93 97 public void activeLayerChange(Layer oldLayer, Layer newLayer) { 94 98 } 95 99 100 @Override 96 101 public void layerAdded(Layer newLayer) { 97 102 } 98 103 104 @Override 99 105 public void layerRemoved(Layer oldLayer) { 100 106 if (oldLayer != lgpslayer) … … 110 116 super(info); 111 117 MainMenu menu = Main.main.menu; 112 lgpsmenu = menu.addMenu(marktr("LiveGPS"), KeyEvent.VK_G, 113 menu.defaultMenuPos, ht("/Plugin/LiveGPS")); 114 118 boolean oldMenu = org.openstreetmap.josm.data.Version.getInstance().getVersion() < 6082; 119 lgpsmenu = oldMenu ? 120 menu.addMenu(marktr("LiveGPS"), KeyEvent.VK_G, menu.defaultMenuPos, ht("/Plugin/LiveGPS")) 121 : menu.gpsMenu; 122 if (lgpsmenu.getItemCount()>0) { 123 lgpsmenu.addSeparator(); 124 } 125 115 126 JosmAction captureAction = new CaptureAction(); 116 127 lgpscapture = new JCheckBoxMenuItem(captureAction); -
applications/editors/josm/plugins/livegps/src/livegps/SingleSegmentGpxTrack.java
r29222 r29769 20 20 21 21 22 @Override 22 23 public Map<String, Object> getAttributes() { 23 24 return attr; 24 25 } 25 26 27 @Override 26 28 public Bounds getBounds() { 27 29 return trackSegment.getBounds(); 28 30 } 29 31 32 @Override 30 33 public Collection<GpxTrackSegment> getSegments() { 31 34 return Collections.singleton(trackSegment); 32 35 } 33 36 37 @Override 34 38 public double length() { 35 39 return trackSegment.length(); -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/OdPlugin.java
r29680 r29769 96 96 loadModules(); 97 97 // Add menu 98 menu = Main.main.menu.addMenu(marktr("Open Data"), KeyEvent.VK_O, Main.main.menu.defaultMenuPos, ht("/Plugin/OpenData")); 98 boolean oldMenu = org.openstreetmap.josm.data.Version.getInstance().getVersion() < 6082; 99 100 menu = oldMenu? 101 Main.main.menu.addMenu(marktr("Open Data"), KeyEvent.VK_O, Main.main.menu.defaultMenuPos, ht("/Plugin/OpenData")) 102 : Main.main.menu.dataMenu; 99 103 buildMenu(); 100 104 // Add download task -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/actions/OpenPreferencesActions.java
r28050 r29769 31 31 public OpenPreferencesActions() { 32 32 super(false); 33 putValue(NAME, tr(" Preferences"));33 putValue(NAME, tr("OpenData preferences")); 34 34 putValue(SMALL_ICON, ImageProvider.get("dialogs", ICON_CORE_24)); 35 35 putValue("toolbar", "opendata_open_preferences"); -
applications/editors/josm/plugins/reverter/nbproject/project.xml
r25429 r29769 41 41 <target>dist</target> 42 42 </action> 43 <action name="run"> 44 <script>${ant.script}</script> 45 <target>runjosm</target> 46 </action> 43 47 </ide-actions> 44 48 <export> … … 62 66 <ide-action name="rebuild"/> 63 67 <ide-action name="clean"/> 68 <ide-action name="run"/> 64 69 </context-menu> 65 70 </view> -
applications/editors/josm/plugins/reverter/src/reverter/ObjectsHistoryAction.java
r27852 r29769 20 20 setEnabled(false); 21 21 } 22 @Override 22 23 public void actionPerformed(ActionEvent arg0) { 23 24 new ObjectsHistoryDialog().setVisible(true); -
applications/editors/josm/plugins/reverter/src/reverter/RevertChangesetAction.java
r29353 r29769 23 23 } 24 24 25 @Override 25 26 public void actionPerformed(ActionEvent arg0) { 26 27 final ChangesetIdQuery dlg = new ChangesetIdQuery(); -
applications/editors/josm/plugins/reverter/src/reverter/ReverterPlugin.java
r27766 r29769 19 19 public ReverterPlugin(PluginInformation info) { 20 20 super(info); 21 JMenu historyMenu = Main.main.menu.addMenu(marktr("History"), KeyEvent.VK_Y, 22 Main.main.menu.defaultMenuPos,ht("/Plugin/Reverter")); 21 boolean oldMenu = org.openstreetmap.josm.data.Version.getInstance().getVersion() < 6082; 22 JMenu historyMenu = oldMenu? 23 Main.main.menu.addMenu(marktr("History"), KeyEvent.VK_Y, Main.main.menu.defaultMenuPos, ht("/Plugin/Reverter")) 24 : Main.main.menu.dataMenu; 23 25 //MainMenu.add(historyMenu, new ObjectsHistoryAction()); 24 26 MainMenu.add(historyMenu, new RevertChangesetAction()); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/UtilsPlugin2.java
r29742 r29769 71 71 public UtilsPlugin2(PluginInformation info) { 72 72 super(info); 73 74 JMenu toolsMenu = Main.main.menu.addMenu(marktr("More tools"), KeyEvent.VK_Q, 4, "help"); 75 unglueRelation = MainMenu.add(toolsMenu, new UnGlueRelationAction()); 73 boolean oldMenu = org.openstreetmap.josm.data.Version.getInstance().getVersion() < 6082; 74 JMenu toolsMenu = oldMenu 75 ? Main.main.menu.addMenu(marktr("More tools"), KeyEvent.VK_Q, 4, "help") 76 : Main.main.menu.moreToolsMenu; 77 78 JMenu dataMenu = oldMenu ? toolsMenu: Main.main.menu.dataMenu; 79 76 80 addIntersections = MainMenu.add(toolsMenu, new AddIntersectionsAction()); 77 81 splitObject = MainMenu.add(toolsMenu, new SplitObjectAction()); 78 82 alignWayNodes = MainMenu.add(toolsMenu, new AlignWayNodesAction()); 83 symmetry = MainMenu.add(toolsMenu, new SymmetryAction()); 84 splitOnIntersections = MainMenu.add(toolsMenu, new SplitOnIntersectionsAction()); 85 unglueRelation = MainMenu.add(toolsMenu, new UnGlueRelationAction()); 79 86 toolsMenu.addSeparator(); 80 87 replaceGeometry = MainMenu.add(toolsMenu, new ReplaceGeometryAction()); 88 extractPoint = MainMenu.add(toolsMenu, new ExtractPointAction()); 81 89 tagBuffer = MainMenu.add(toolsMenu, new TagBufferAction()); 82 90 sourceTag = MainMenu.add(toolsMenu, new TagSourceAction()); 83 91 pasteRelations = MainMenu.add(toolsMenu, new PasteRelationsAction()); 84 alignWayNodes = MainMenu.add(toolsMenu, new AlignWayNodesAction()); 85 splitOnIntersections = MainMenu.add(toolsMenu, new SplitOnIntersectionsAction()); 86 extractPoint = MainMenu.add(toolsMenu, new ExtractPointAction()); 87 symmetry = MainMenu.add(toolsMenu, new SymmetryAction()); 88 wiki = MainMenu.add(toolsMenu, new OpenPageAction()); 92 wiki = MainMenu.add(dataMenu, new OpenPageAction()); 89 93 latlon = MainMenu.add(toolsMenu, new LatLonAction()); 90 91 JMenu selectionMenu = Main.main.menu.addMenu(marktr("Selection"), KeyEvent.VK_N, Main.main.menu.defaultMenuPos, "help"); 94 drawArc = MainMenu.add(toolsMenu, new CurveAction()); 95 96 JMenu selectionMenu; 97 if (oldMenu) { 98 selectionMenu = Main.main.menu.addMenu(marktr("Selection"), KeyEvent.VK_N, 4, "help"); 99 } else { 100 selectionMenu = Main.main.menu.selectionMenu; 101 selectionMenu.addSeparator(); 102 } 103 92 104 selectWayNodes = MainMenu.add(selectionMenu, new SelectWayNodesAction()); 93 105 adjNodes = MainMenu.add(selectionMenu, new AdjacentNodesAction()); … … 105 117 selectAreaBoundary = MainMenu.add(selectionMenu, new SelectBoundaryAction()); 106 118 107 selectURL = MainMenu.add(toolsMenu, new ChooseURLAction()); 108 drawArc = MainMenu.add(toolsMenu, new CurveAction()); 109 119 selectURL = MainMenu.add(dataMenu, new ChooseURLAction()); 120 110 121 // register search operators 111 122 SearchCompiler.addMatchFactory(new UtilsUnaryMatchFactory()); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/ExtractPointAction.java
r28028 r29769 2 2 package org.openstreetmap.josm.plugins.utilsplugin2.actions; 3 3 4 import java.awt.MouseInfo;5 4 import java.awt.Point; 6 5 import static org.openstreetmap.josm.gui.help.HelpUtil.ht; -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/PasteRelationsAction.java
r28028 r29769 24 24 } 25 25 26 @Override 26 27 public void actionPerformed( ActionEvent e ) { 27 28 Collection<OsmPrimitive> selection = getCurrentDataSet().getSelected(); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/SplitOnIntersectionsAction.java
r28028 r29769 30 30 } 31 31 32 @Override 32 33 public void actionPerformed( ActionEvent e ) { 33 34 List<Command> list = new ArrayList<Command>(); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/SymmetryAction.java
r28028 r29769 40 40 } 41 41 42 @Override 42 43 public void actionPerformed(ActionEvent e) { 43 44 Collection<OsmPrimitive> sel = getCurrentDataSet().getSelected(); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/TagBufferAction.java
r29672 r29769 28 28 } 29 29 30 @Override 30 31 public void actionPerformed( ActionEvent e ) { 31 32 Collection<OsmPrimitive> selection = getCurrentDataSet().getSelected(); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/TagSourceAction.java
r28028 r29769 29 29 } 30 30 31 @Override 31 32 public void actionPerformed( ActionEvent e ) { 32 33 Collection<OsmPrimitive> selection = getCurrentDataSet().getSelected(); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/UnGlueRelationAction.java
r29391 r29769 46 46 * Called when the action is executed. 47 47 */ 48 @Override 48 49 public void actionPerformed(ActionEvent e) { 49 50 -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/customurl/ChooseURLAction.java
r28028 r29769 2 2 3 3 import java.awt.GridBagLayout; 4 import java.awt.event.ItemEvent;5 4 import java.util.List; 6 import java.util.logging.Level;7 import java.util.logging.Logger;8 import javax.swing.JComboBox;9 5 import javax.swing.JPanel; 10 6 import javax.swing.event.ListSelectionEvent; … … 13 9 import org.openstreetmap.josm.Main; 14 10 import java.awt.event.ActionEvent; 15 import java.awt.event.ItemListener;16 import java.awt.event.KeyEvent;17 11 import javax.swing.JCheckBox; 18 12 import javax.swing.JLabel; … … 22 16 import javax.swing.event.ListSelectionListener; 23 17 import org.openstreetmap.josm.actions.JosmAction; 24 import org.openstreetmap.josm.gui.SelectionManager;25 18 import static org.openstreetmap.josm.tools.I18n.tr; 26 19 -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/customurl/OpenPageAction.java
r28028 r29769 40 40 } 41 41 42 @Override 42 43 public void actionPerformed(ActionEvent e) { 43 44 Collection<OsmPrimitive> sel = getCurrentDataSet().getSelected(); … … 62 63 try { 63 64 while (m.find()) { 64 key=m.group(1); val=null; 65 if (key.equals("#id")) { 66 if (p!=null) val=Long.toString(p.getId()); ; 67 } else if (key.equals("#type")) { 68 if (p!=null) val = OsmPrimitiveType.from(p).getAPIName(); ; 69 } else if (key.equals("#lat")) { 70 val = Double.toString(center.lat()); 71 } else if (key.equals("#lon")) { 72 val = Double.toString(center.lon()); 65 key=m.group(1); val=null; 66 if (key.equals("#id")) { 67 if (p!=null) val=Long.toString(p.getId()); 68 } else if (key.equals("#type")) { 69 if (p!=null) val = OsmPrimitiveType.from(p).getAPIName(); 70 } else if (key.equals("#lat")) { 71 val = Double.toString(center.lat()); 72 } else if (key.equals("#lon")) { 73 val = Double.toString(center.lon()); 74 } 75 else { 76 if (p!=null) { 77 val =p.get(key); 78 if (val!=null) val =URLEncoder.encode(p.get(key), "UTF-8"); else return; 73 79 } 74 else { 75 if (p!=null) { 76 val =p.get(key); 77 if (val!=null) val =URLEncoder.encode(p.get(key), "UTF-8"); else return; 78 } 79 } 80 keys[i]=m.group(); 81 if (val!=null) vals[i]=val; 82 else vals[i]=""; 83 i++; 80 } 81 keys[i]=m.group(); 82 if (val!=null) vals[i]=val; 83 else vals[i]=""; 84 i++; 84 85 } 85 86 } catch (UnsupportedEncodingException ex) { -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/customurl/UtilsPluginPreferences.java
r28523 r29769 48 48 resetButton = new JButton(tr("Reset")); 49 49 resetButton.addActionListener(new ActionListener() { 50 @Override 50 51 public void actionPerformed(ActionEvent e) { 51 52 fillRows(URLList.resetURLList()); … … 55 56 saveButton = new JButton(tr("Save to file")); 56 57 saveButton.addActionListener(new ActionListener() { 58 @Override 57 59 public void actionPerformed(ActionEvent e) { 58 60 URLList.saveURLList(readItemsFromTable()); … … 62 64 loadButton = new JButton(tr("Load from file")); 63 65 loadButton.addActionListener(new ActionListener() { 66 @Override 64 67 public void actionPerformed(ActionEvent e) { 65 68 fillRows(URLList.loadURLList()); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/latlon/LatLonAction.java
r28028 r29769 35 35 } 36 36 37 @Override 37 38 public void actionPerformed(ActionEvent e) { 38 39 if (!isEnabled()) -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/latlon/LatLonDialog.java
r28028 r29769 7 7 import java.awt.Component; 8 8 import java.awt.GridBagLayout; 9 import java.awt.event.ActionEvent;10 9 import java.awt.event.FocusEvent; 11 10 import java.awt.event.FocusListener; 12 import java.awt.event.WindowAdapter;13 import java.awt.event.WindowEvent;14 11 import java.text.NumberFormat; 15 12 import java.text.ParsePosition; … … 20 17 import java.util.regex.Pattern; 21 18 22 import javax.swing.AbstractAction;23 19 import javax.swing.BorderFactory; 24 20 import javax.swing.JLabel; … … 27 23 import javax.swing.JTabbedPane; 28 24 29 import javax.swing.text.Document;30 25 import javax.swing.JTextArea; 31 26 import javax.swing.JScrollPane; … … 45 40 import org.openstreetmap.josm.gui.widgets.HtmlPanel; 46 41 import org.openstreetmap.josm.tools.GBC; 47 import org.openstreetmap.josm.tools.ImageProvider;48 42 import org.openstreetmap.josm.tools.WindowGeometry; 49 43 … … 288 282 289 283 class LatLonInputVerifier implements DocumentListener { 290 public void changedUpdate(DocumentEvent e) {284 @Override public void changedUpdate(DocumentEvent e) { 291 285 parseLatLonUserInput(); 292 286 } 293 287 294 public void insertUpdate(DocumentEvent e) {288 @Override public void insertUpdate(DocumentEvent e) { 295 289 parseLatLonUserInput(); 296 290 } 297 291 298 public void removeUpdate(DocumentEvent e) {292 @Override public void removeUpdate(DocumentEvent e) { 299 293 parseLatLonUserInput(); 300 294 } … … 302 296 303 297 static class TextFieldFocusHandler implements FocusListener { 298 @Override 304 299 public void focusGained(FocusEvent e) { 305 300 Component c = e.getComponent(); … … 309 304 } 310 305 } 306 @Override 311 307 public void focusLost(FocusEvent e) {} 312 308 } … … 448 444 449 445 private class CoordinateListener implements DocumentListener { 450 public void changedUpdate(DocumentEvent e) {446 @Override public void changedUpdate(DocumentEvent e) { 451 447 //not fired 452 448 } 453 public void insertUpdate(DocumentEvent e) {449 @Override public void insertUpdate(DocumentEvent e) { 454 450 updateButtons(); 455 451 } 456 public void removeUpdate(DocumentEvent e) {452 @Override public void removeUpdate(DocumentEvent e) { 457 453 updateButtons(); 458 454 } -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/AdjacentNodesAction.java
r28028 r29769 31 31 private Set<Way> activeWays = new HashSet<Way>(); 32 32 33 @Override 33 34 public void actionPerformed(ActionEvent e) { 34 35 Collection<OsmPrimitive> selection = getCurrentDataSet().getSelected(); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/AdjacentWaysAction.java
r28028 r29769 30 30 } 31 31 32 @Override 32 33 public void actionPerformed(ActionEvent e) { 33 34 Collection<OsmPrimitive> selection = getCurrentDataSet().getSelected(); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/ConnectedWaysAction.java
r28028 r29769 27 27 } 28 28 29 @Override 29 30 public void actionPerformed(ActionEvent e) { 30 31 Collection<OsmPrimitive> selection = getCurrentDataSet().getSelected(); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/IntersectedWaysAction.java
r28028 r29769 29 29 } 30 30 31 @Override 31 32 public void actionPerformed(ActionEvent e) { 32 33 Set<Way> selectedWays = OsmPrimitive.getFilteredSet(getCurrentDataSet().getSelected(), Way.class); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/IntersectedWaysRecursiveAction.java
r28028 r29769 30 30 } 31 31 32 @Override 32 33 public void actionPerformed(ActionEvent e) { 33 Collection<OsmPrimitive> selection = getCurrentDataSet().getSelected();34 34 35 35 Set<Way> selectedWays = OsmPrimitive.getFilteredSet(getCurrentDataSet().getSelected(), Way.class); … … 41 41 selectedWays, newWays); 42 42 getCurrentDataSet().addSelected(newWays); 43 return;44 43 } else { 45 44 JOptionPane.showMessageDialog(Main.parent, -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/MiddleNodesAction.java
r28028 r29769 33 33 private Set<Way> activeWays = new HashSet<Way>(); 34 34 35 @Override 35 36 public void actionPerformed(ActionEvent e) { 36 37 Collection<OsmPrimitive> selection = getCurrentDataSet().getSelected(); 37 38 Set<Node> selectedNodes = OsmPrimitive.getFilteredSet(selection, Node.class); 38 39 39 Set<Way> selectedWays = OsmPrimitive.getFilteredSet(getCurrentDataSet().getSelected(), Way.class);40 41 40 // if no 2 nodes and no ways are selected, do nothing 42 41 if (selectedNodes.size() != 2) { -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/NodeWayUtils.java
r28222 r29769 181 181 182 182 public static void addWaysIntersectingWaysRecursively 183 (Collection<Way> allWays, Collection<Way> initWays, Set<Way> newWays) 184 { 183 (Collection<Way> allWays, Collection<Way> initWays, Set<Way> newWays) { 185 184 Set<Way> foundWays = new HashSet<Way>(); 186 185 foundWays.addAll(initWays); 187 186 newWays.addAll(initWays); 188 Set<Way> newFoundWays = new HashSet<Way>();187 Set<Way> newFoundWays; 189 188 190 189 int level=0,c; … … 207 206 } 208 207 } while ( c >0 && level < maxLevel ); 209 return;210 208 } 211 209 … … 234 232 } while ( c >0 && level < maxLevel ); 235 233 // System.out.println("time = "+(System.currentTimeMillis()-t)+" ways = "+newWays.size()); 236 return;237 234 } 238 235 … … 269 266 } 270 267 } 271 if (newNodes. size()==0) {268 if (newNodes.isEmpty()) { 272 269 JOptionPane.showMessageDialog(Main.parent, 273 270 tr("Please select two nodes connected by way!"), -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectAllInsideAction.java
r28028 r29769 8 8 import java.awt.event.KeyEvent; 9 9 import java.util.Collection; 10 import java.util.HashSet;11 import java.util.Set;12 10 13 11 import javax.swing.JOptionPane; -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectBoundaryAction.java
r28028 r29769 19 19 import org.openstreetmap.josm.Main; 20 20 import org.openstreetmap.josm.actions.JosmAction; 21 import org.openstreetmap.josm.data.coor.EastNorth;22 21 import org.openstreetmap.josm.data.osm.Node; 23 22 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 40 39 } 41 40 41 @Override 42 42 public void actionPerformed(ActionEvent e) { 43 long t=System.currentTimeMillis();43 //long t=System.currentTimeMillis(); 44 44 Set<Way> selectedWays = OsmPrimitive.getFilteredSet(getCurrentDataSet().getSelected(), Way.class); 45 45 Set<Node> selectedNodes = OsmPrimitive.getFilteredSet(getCurrentDataSet().getSelected(), Node.class); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectModNodesAction.java
r28028 r29769 32 32 } 33 33 34 @Override 34 35 public void actionPerformed(ActionEvent e) { 35 36 Collection<OsmPrimitive> selection = getCurrentDataSet().getSelected(); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectModWaysAction.java
r28028 r29769 32 32 } 33 33 34 @Override 34 35 public void actionPerformed(ActionEvent e) { 35 36 Collection<OsmPrimitive> selection = getCurrentDataSet().getSelected(); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectWayNodesAction.java
r28028 r29769 40 40 * This method does some checking on the selection and calls the matching selectWayNodes method. 41 41 */ 42 @Override 42 43 public void actionPerformed(ActionEvent e) { 43 44 Collection<OsmPrimitive> selection = getCurrentDataSet().getSelected(); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/UndoSelectionAction.java
r28028 r29769 10 10 import java.util.HashSet; 11 11 import java.util.LinkedList; 12 import java.util.List;13 12 import java.util.Set; 14 import org.openstreetmap.josm.Main;15 13 import org.openstreetmap.josm.actions.JosmAction; 16 14 import org.openstreetmap.josm.data.osm.*; … … 34 32 private Collection<OsmPrimitive> lastSel; 35 33 private int index; 34 @Override 36 35 public void actionPerformed(ActionEvent e) { 37 LinkedList<Collection<? extends OsmPrimitive>> history36 LinkedList<Collection<? extends OsmPrimitive>> history 38 37 = getCurrentDataSet().getSelectionHistory(); 38 if (history==null || history.isEmpty()) return; // empty history 39 39 int num=history.size(); 40 if (history==null || num==0) return; // empty history41 40 42 41 Collection<OsmPrimitive> selection = getCurrentDataSet().getSelected(); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/UnselectNodesAction.java
r28028 r29769 28 28 } 29 29 30 @Override 30 31 public void actionPerformed(ActionEvent e) { 31 32 Collection<OsmPrimitive> selection = getCurrentDataSet().getSelected(); -
applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/VideoPlugin.java
r29536 r29769 48 48 //Here we manage properties and start the other classes 49 49 public class VideoPlugin extends Plugin implements LayerChangeListener{ 50 51 52 50 private JMenu VMenu,VDeinterlacer; 51 private JosmAction VAdd,/*VRemove,*/VStart,Vbackward,Vforward,VJump,Vfaster,Vslower,Vloop; 52 private JRadioButtonMenuItem VIntBob,VIntNone,VIntLinear; 53 53 private JCheckBoxMenuItem VCenterIcon,VSubTitles; 54 54 private JMenuItem VJumpLength,VLoopLength; … … 61 61 private Integer jumpLength,loopLength; 62 62 private String mostRecentFolder; 63 private GpxLayer gpsLayer; 64 private VideoPositionLayer videoPositionLayer; 65 private GPSVideoPlayer gpsVideoPlayer; 66 67 public static String VLC_VERSION = "2.0.x"; 68 69 public VideoPlugin(PluginInformation info) { 70 super(info); 71 VideoEngine.setupPlayer(); 72 MapView.addLayerChangeListener(this); 73 createMenusAndShortCuts(); 74 enableVideoControlMenus(false); 75 setDefaults(); 76 loadProperties(); 77 } 78 79 private void createMenusAndShortCuts() { 80 VMenu = Main.main.menu.addMenu(marktr("Video"), KeyEvent.VK_D, Main.main.menu.defaultMenuPos,ht("/Plugin/Videomapping")); 81 VMenu.setEnabled(false); 82 VAdd= new JosmAction(tr("Import Video"),"videomapping",tr("Sync a video against this GPS track"),null,false) { 83 public void actionPerformed(ActionEvent arg0) { 63 private GpxLayer gpsLayer; 64 private VideoPositionLayer videoPositionLayer; 65 private GPSVideoPlayer gpsVideoPlayer; 66 67 public static String VLC_VERSION = "2.0.x"; 68 69 public VideoPlugin(PluginInformation info) { 70 super(info); 71 VideoEngine.setupPlayer(); 72 MapView.addLayerChangeListener(this); 73 createMenusAndShortCuts(); 74 enableVideoControlMenus(false); 75 setDefaults(); 76 loadProperties(); 77 } 78 79 private void createMenusAndShortCuts() { 80 boolean oldMenu = org.openstreetmap.josm.data.Version.getInstance().getVersion() < 6082; 81 VMenu = Main.main.menu.addMenu(marktr("Video"), oldMenu?KeyEvent.VK_D: KeyEvent.VK_Q, Main.main.menu.defaultMenuPos,ht("/Plugin/Videomapping")); 82 VMenu.setEnabled(false); 83 VAdd= new JosmAction(tr("Import Video"),"videomapping",tr("Sync a video against this GPS track"),null,false) { 84 @Override public void actionPerformed(ActionEvent arg0) { 84 85 importVideoFile(); 85 86 } 86 87 }; 87 88 /*VRemove=*/ new JosmAction(tr("Remove Video"),"videomapping",tr("removes current video from layer"),null,false) { 88 public void actionPerformed(ActionEvent arg0) {89 @Override public void actionPerformed(ActionEvent arg0) { 89 90 } 90 91 }; 91 92 VStart = new JosmAction(tr("Play/Pause"), "audio-playpause", tr("starts/pauses video playback"), 92 93 Shortcut.registerShortcut("videomapping:startstop",tr("Video: {0}", tr("Play/Pause")),KeyEvent.VK_NUMPAD5, Shortcut.DIRECT), false, "vm_play_pause",false) { 93 public void actionPerformed(ActionEvent e) {94 @Override public void actionPerformed(ActionEvent e) { 94 95 if (gpsVideoPlayer != null) { 95 96 gpsVideoPlayer.pause(); … … 99 100 Vbackward = new JosmAction(tr("Backward"), "audio-prev", tr("jumps n sec back"), 100 101 Shortcut.registerShortcut("videomapping:backward",tr("Video: {0}", tr("Backward")),KeyEvent.VK_NUMPAD4, Shortcut.DIRECT), false, "vm_prev",false) { 101 public void actionPerformed(ActionEvent e) {102 @Override public void actionPerformed(ActionEvent e) { 102 103 if (gpsVideoPlayer != null) { 103 104 gpsVideoPlayer.backward(); … … 107 108 Vforward= new JosmAction(tr("Forward"), "audio-next", tr("jumps n sec forward"), 108 109 Shortcut.registerShortcut("videomapping:forward",tr("Video: {0}", tr("Forward")),KeyEvent.VK_NUMPAD6, Shortcut.DIRECT), false, "vm_next",false) { 109 public void actionPerformed(ActionEvent e) {110 @Override public void actionPerformed(ActionEvent e) { 110 111 if (gpsVideoPlayer != null) { 111 112 gpsVideoPlayer.forward(); … … 116 117 Shortcut.registerShortcut("videomapping:faster",tr("Video: {0}", tr("Faster")),KeyEvent.VK_NUMPAD8, Shortcut.DIRECT), false, "vm_faster",false) { 117 118 118 public void actionPerformed(ActionEvent e) {119 @Override public void actionPerformed(ActionEvent e) { 119 120 if (gpsVideoPlayer != null) { 120 121 gpsVideoPlayer.setSpeed(gpsVideoPlayer.getSpeed()+20); … … 125 126 Shortcut.registerShortcut("videomapping:slower",tr("Video: {0}", tr("Slower")),KeyEvent.VK_NUMPAD2, Shortcut.DIRECT), false, "vm_slower",false) { 126 127 127 public void actionPerformed(ActionEvent e) {128 @Override public void actionPerformed(ActionEvent e) { 128 129 if (gpsVideoPlayer != null) { 129 130 gpsVideoPlayer.setSpeed(gpsVideoPlayer.getSpeed()-20); … … 132 133 }; 133 134 VJump= new JosmAction(tr("Jump To"), "jumpto", tr("jumps to the entered gps time"),null, false) { 134 public void actionPerformed(ActionEvent e) {135 @Override public void actionPerformed(ActionEvent e) { 135 136 showJumpTo(); 136 137 } … … 140 141 Vloop= new JosmAction(tr("Loop"), "loop", tr("loops n sec around current position"), 141 142 Shortcut.registerShortcut("videomapping:loop",tr("Video: {0}", tr("Loop")),KeyEvent.VK_NUMPAD7, Shortcut.DIRECT), false) { 142 public void actionPerformed(ActionEvent e) {143 @Override public void actionPerformed(ActionEvent e) { 143 144 if (gpsVideoPlayer != null) { 144 145 gpsVideoPlayer.toggleLooping(); … … 149 150 //now the options menu 150 151 VCenterIcon = new JCheckBoxMenuItem(new JosmAction(tr("Keep centered"), (String)null, tr("follows the video icon automaticly"),null, false,"vm_keepcentered",false) { 151 public void actionPerformed(ActionEvent e) {152 @Override public void actionPerformed(ActionEvent e) { 152 153 if (videoPositionLayer != null) { 153 154 videoPositionLayer.setAutoCenter(VCenterIcon.isSelected()); … … 157 158 158 159 VSubTitles = new JCheckBoxMenuItem(new JosmAction(tr("Subtitles"), (String)null, tr("Show subtitles in video"),null, false,"vm_subtitles",false) { 159 public void actionPerformed(ActionEvent e) {160 @Override public void actionPerformed(ActionEvent e) { 160 161 if (gpsVideoPlayer != null) { 161 162 gpsVideoPlayer.setSubtitles(VSubTitles.isSelected()); … … 165 166 166 167 VJumpLength = new JMenuItem(new JosmAction(tr("Jump length"), (String)null, tr("Set the length of a jump"),null, false,"vm_jumplen",false) { 167 public void actionPerformed(ActionEvent e) {168 @Override public void actionPerformed(ActionEvent e) { 168 169 Object[] possibilities = {"200", "500", "1000", "2000", "10000"}; 169 170 String s = (String)JOptionPane.showInputDialog(Main.parent,tr("Jump in video for x ms"),tr("Jump length"),JOptionPane.QUESTION_MESSAGE,null,possibilities,jumpLength); … … 174 175 175 176 VLoopLength = new JMenuItem(new JosmAction(tr("Loop length"), (String)null, tr("Set the length around a looppoint"),null, false,"vm_looplen",false) { 176 public void actionPerformed(ActionEvent e) {177 @Override public void actionPerformed(ActionEvent e) { 177 178 Object[] possibilities = {"500", "1000", "3000", "5000", "10000"}; 178 179 String s = (String)JOptionPane.showInputDialog(Main.parent,tr("Jump in video for x ms"),tr("Loop length"),JOptionPane.QUESTION_MESSAGE,null,possibilities,loopLength); … … 184 185 VDeinterlacer= new JMenu("Deinterlacer"); 185 186 VIntNone= new JRadioButtonMenuItem(new JosmAction(tr("none"), (String)null, tr("no deinterlacing"),null, false,"vm_deinterlacer",false) { 186 public void actionPerformed(ActionEvent e) {187 @Override public void actionPerformed(ActionEvent e) { 187 188 if (gpsVideoPlayer != null) { 188 189 gpsVideoPlayer.setDeinterlacer(null); … … 191 192 }); 192 193 VIntBob= new JRadioButtonMenuItem(new JosmAction("bob", (String)null, tr("deinterlacing using line doubling"),null, false,"vm_bobdeinterlace",false) { 193 public void actionPerformed(ActionEvent e) {194 @Override public void actionPerformed(ActionEvent e) { 194 195 if (gpsVideoPlayer != null) { 195 196 gpsVideoPlayer.setDeinterlacer(DeinterlaceMode.BOB); … … 198 199 }); 199 200 VIntLinear= new JRadioButtonMenuItem(new JosmAction("linear", (String)null, tr("deinterlacing using linear interpolation"),null, false,"vm_lineardeinterlace",false) { 200 public void actionPerformed(ActionEvent e) {201 @Override public void actionPerformed(ActionEvent e) { 201 202 if (gpsVideoPlayer != null) { 202 203 gpsVideoPlayer.setDeinterlacer(DeinterlaceMode.LINEAR); … … 223 224 } 224 225 225 226 226 protected void importVideoFile() { 227 JFileChooser fc = new JFileChooser(mostRecentFolder); 227 228 fc.setSelectedFile(new File(mostRecentFolder)); 228 229 if (fc.showOpenDialog(Main.parent) != JFileChooser.CANCEL_OPTION) { 229 230 231 232 233 234 235 236 237 238 239 240 230 mostRecentFolder=fc.getSelectedFile().getAbsolutePath(); 231 saveProperties(); 232 if (videoPositionLayer == null && gpsLayer != null) { 233 videoPositionLayer = new VideoPositionLayer(gpsLayer); 234 gpsVideoPlayer = new GPSVideoPlayer(new SimpleDateFormat("hh:mm:ss") ,videoPositionLayer); 235 gpsVideoPlayer.setJumpLength(jumpLength); 236 gpsVideoPlayer.setLoopLength(loopLength); 237 enableVideoControlMenus(true); 238 } 239 if (gpsVideoPlayer != null && gpsVideoPlayer.isCorrectlyInitiliazed()) { 240 gpsVideoPlayer.addVideo(fc.getSelectedFile()); 241 } else { 241 242 JOptionPane.showMessageDialog(Main.parent, 242 tr("VLC library is not correctly initialized."+ 243 " Please check that VLC {0} is correctly installed on your system."+ 244 " Its architecture (32/64 bits) must also be the same as the JRE that runs JOSM.", VLC_VERSION), 245 tr("Error"), JOptionPane.ERROR_MESSAGE 246 ); 247 } 243 tr("VLC library is not correctly initialized."+ 244 " Please check that VLC {0} is correctly installed on your system."+ 245 " Its architecture (32/64 bits) must also be the same as the JRE that runs JOSM.", VLC_VERSION), 246 tr("Error"), JOptionPane.ERROR_MESSAGE); 247 } 248 248 } 249 250 251 252 249 } 250 251 private void enableVideoControlMenus(boolean b) { 252 VStart.setEnabled(b); 253 253 Vbackward.setEnabled(b); 254 254 Vforward.setEnabled(b); … … 257 257 Vslower.setEnabled(b); 258 258 VJump.setEnabled(b); 259 259 } 260 260 261 262 261 private void setDefaults() { 262 autoCenter=false; 263 263 // deinterlacer=""; 264 265 266 267 264 jumpLength=1000; 265 loopLength=6000; 266 mostRecentFolder=System.getProperty("user.home"); 267 } 268 268 269 269 private void loadProperties() { 270 270 String temp; 271 271 temp=Main.pref.get(PROP_AUTOCENTER); … … 283 283 } 284 284 285 285 private void saveProperties(){ 286 286 Main.pref.put(PROP_AUTOCENTER, autoCenter); 287 287 Main.pref.put(PROP_JUMPLENGTH, jumpLength.toString()); … … 290 290 } 291 291 292 private void showJumpTo() 293 294 try {295 JOptionPane d=new JOptionPane(tr("Jump to"), JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION); 296 SimpleDateFormat gpsTimeFormat= new SimpleDateFormat("HH:mm:ss");297 String timerange=gpsTimeFormat.format(videoPositionLayer.getFirstWayPoint().getTime())+" - ";298 timerange=timerange+gpsTimeFormat.format(videoPositionLayer.getLastWayPoint().getTime()); 299 d.add(new JLabel(timerange)); //TODO for some reason this doesn't work -> use dialog 300 final JFormattedTextField inp = new JFormattedTextField(new MaskFormatter("##:##:##"));301 inp.setText(gpsTimeFormat.format( videoPositionLayer.getGPSDate())); 302 inp.setInputVerifier(new InputVerifier() { 303 @Override 304 public boolean verify(JComponent input) { 305 return false; 306 } 307 }); 308 //hack to set the focus 309 SwingUtilities.invokeLater(new Runnable() { 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 292 private void showJumpTo() { 293 try { 294 JOptionPane d=new JOptionPane(tr("Jump to"), JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION); 295 SimpleDateFormat gpsTimeFormat= new SimpleDateFormat("HH:mm:ss"); 296 String timerange=gpsTimeFormat.format(videoPositionLayer.getFirstWayPoint().getTime())+" - "; 297 timerange=timerange+gpsTimeFormat.format(videoPositionLayer.getLastWayPoint().getTime()); 298 d.add(new JLabel(timerange)); //TODO for some reason this doesn't work -> use dialog 299 final JFormattedTextField inp = new JFormattedTextField(new MaskFormatter("##:##:##")); 300 inp.setText(gpsTimeFormat.format( videoPositionLayer.getGPSDate())); 301 inp.setInputVerifier(new InputVerifier() { 302 @Override 303 public boolean verify(JComponent input) { 304 return false; 305 } 306 }); 307 //hack to set the focus 308 SwingUtilities.invokeLater(new Runnable() { 309 @Override 310 public void run() { 311 inp.requestFocus(); 312 inp.setCaretPosition(0); 313 } 314 }); 315 if (JOptionPane.showConfirmDialog(Main.panel,inp, tr("Jump to GPS time"),JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) 316 { 317 //add the day to the time 318 Date t = gpsTimeFormat.parse(inp.getText()); 319 Calendar time = Calendar.getInstance(); 320 Calendar date = Calendar.getInstance(); 321 time.setTime(t); 322 date.setTime(videoPositionLayer.getFirstWayPoint().getTime()); 323 time.set(date.get(Calendar.YEAR), date.get(Calendar.MONTH), date.get(Calendar.DATE)); 324 if (t!=null) 325 { 326 videoPositionLayer.jump(time.getTime()); 327 } 328 } 329 329 } catch (ParseException e1) { 330 330 e1.printStackTrace(); 331 331 } 332 333 334 335 332 } 333 334 @Override 335 public void activeLayerChange(Layer oldLayer, Layer newLayer) { 336 336 VMenu.setEnabled(true); 337 337 if (newLayer instanceof GpxLayer) … … 343 343 } 344 344 345 public void layerAdded(Layer arg0) { 346 activeLayerChange(null,arg0); 347 348 349 350 public void layerRemoved(Layer arg0) { 351 if(arg0 instanceof VideoPositionLayer) 352 enableVideoControlMenus(false); 353 activeLayerChange(null,arg0);354 355 345 @Override 346 public void layerAdded(Layer arg0) { 347 activeLayerChange(null,arg0); 348 } 349 350 @Override 351 public void layerRemoved(Layer arg0) { 352 if(arg0 instanceof VideoPositionLayer) 353 enableVideoControlMenus(false); 354 activeLayerChange(null,arg0); 355 } 356 356 } -
applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/video/GPSVideoPlayer.java
r28949 r29769 42 42 syncButton.setBackground(Color.RED); 43 43 syncButton.addActionListener(new ActionListener() { 44 @Override 44 45 public void actionPerformed(ActionEvent e) { 45 46 resync(e); -
applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/video/VideoEngine.java
r28924 r29769 319 319 } 320 320 321 public void backward(MediaPlayer arg0) { 322 323 } 321 @Override 322 public void backward(MediaPlayer arg0) { } 324 323 /* 325 324 public void buffering(MediaPlayer arg0) { … … 327 326 } 328 327 */ 329 public void error(MediaPlayer arg0) { 330 331 } 332 333 public void finished(MediaPlayer arg0) { 334 335 } 336 337 public void forward(MediaPlayer arg0) { 338 339 } 340 341 public void lengthChanged(MediaPlayer arg0, long arg1) { 342 343 } 328 @Override 329 public void error(MediaPlayer arg0) { } 330 331 @Override 332 public void finished(MediaPlayer arg0) { } 333 334 @Override 335 public void forward(MediaPlayer arg0) { } 336 337 @Override 338 public void lengthChanged(MediaPlayer arg0, long arg1) { } 344 339 /* 345 340 public void mediaChanged(MediaPlayer arg0) { … … 353 348 } 354 349 */ 355 public void opening(MediaPlayer arg0) { 356 357 } 358 359 public void pausableChanged(MediaPlayer arg0, int arg1) { 360 361 } 362 363 public void paused(MediaPlayer arg0) { 364 365 } 366 367 public void playing(MediaPlayer arg0) { 368 369 } 370 371 public void positionChanged(MediaPlayer arg0, float arg1) { 372 373 } 374 375 public void seekableChanged(MediaPlayer arg0, int arg1) { 376 377 } 378 379 public void snapshotTaken(MediaPlayer arg0, String arg1) { 380 381 } 382 383 public void stopped(MediaPlayer arg0) { 384 385 } 386 387 public void timeChanged(MediaPlayer arg0, long arg1) { 388 389 } 390 391 public void titleChanged(MediaPlayer arg0, int arg1) { 392 393 } 350 @Override 351 public void opening(MediaPlayer arg0) { } 352 353 @Override 354 public void pausableChanged(MediaPlayer arg0, int arg1) { } 355 356 @Override 357 public void paused(MediaPlayer arg0) { } 358 359 @Override 360 public void playing(MediaPlayer arg0) { } 361 362 @Override 363 public void positionChanged(MediaPlayer arg0, float arg1) { } 364 365 @Override 366 public void seekableChanged(MediaPlayer arg0, int arg1) { } 367 368 @Override 369 public void snapshotTaken(MediaPlayer arg0, String arg1) { } 370 371 @Override 372 public void stopped(MediaPlayer arg0) { } 373 374 @Override 375 public void timeChanged(MediaPlayer arg0, long arg1) { } 376 377 @Override 378 public void titleChanged(MediaPlayer arg0, int arg1) { } 394 379 395 380 public boolean isNoVideoPlaying() { -
applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/video/VideoPlayer.java
r29536 r29769 30 30 import uk.co.caprica.vlcj.player.DeinterlaceMode; 31 31 32 //basic UI of a videoplayer for multiple videos incl. notifications 32 /** basic UI of a videoplayer for multiple videos incl. notifications 33 */ 33 34 public class VideoPlayer extends JFrame implements WindowListener, VideosObserver, VideoPlayerObserver { 34 35 private static final int notificationIntervall = 500; … … 205 206 206 207 play.addActionListener(new ActionListener() { 207 public void actionPerformed(ActionEvent arg0) {208 @Override public void actionPerformed(ActionEvent arg0) { 208 209 pause(); 209 210 } … … 212 213 back.addActionListener(new ActionListener() { 213 214 214 public void actionPerformed(ActionEvent arg0) {215 @Override public void actionPerformed(ActionEvent arg0) { 215 216 backward(); 216 217 } … … 219 220 forward.addActionListener(new ActionListener() { 220 221 221 public void actionPerformed(ActionEvent arg0) {222 @Override public void actionPerformed(ActionEvent arg0) { 222 223 forward(); 223 224 } … … 226 227 loop.addActionListener(new ActionListener() { 227 228 228 public void actionPerformed(ActionEvent arg0) {229 @Override public void actionPerformed(ActionEvent arg0) { 229 230 toggleLooping(); 230 231 } … … 233 234 mute.addActionListener(new ActionListener() { 234 235 235 public void actionPerformed(ActionEvent arg0) {236 @Override public void actionPerformed(ActionEvent arg0) { 236 237 mute(); 237 238 } … … 239 240 240 241 timeline.addChangeListener(new ChangeListener() { 242 @Override 241 243 public void stateChanged(ChangeEvent e) { 242 244 //skip events, fired by this sliede, one cycle ago … … 252 254 253 255 speed.addChangeListener(new ChangeListener() { 256 @Override 254 257 public void stateChanged(ChangeEvent arg0) { 255 258 if(!speed.getValueIsAdjusting()) … … 311 314 } 312 315 313 public void windowActivated(WindowEvent arg0) { 314 // TODO Auto-generated method stub 315 316 } 317 318 public void windowClosed(WindowEvent arg0) { 319 320 } 321 316 @Override 317 public void windowActivated(WindowEvent arg0) { } 318 319 @Override 320 public void windowClosed(WindowEvent arg0) { } 321 322 @Override 322 323 public void windowClosing(WindowEvent arg0) { 323 324 videoengine.unload(); 324 325 } 325 326 326 public void windowDeactivated(WindowEvent arg0) { 327 // TODO Auto-generated method stub 328 329 } 330 331 public void windowDeiconified(WindowEvent arg0) { 332 // TODO Auto-generated method stub 333 334 } 335 336 public void windowIconified(WindowEvent arg0) { 337 // TODO Auto-generated method stub 338 339 } 340 341 public void windowOpened(WindowEvent arg0) { 342 // TODO Auto-generated method stub 343 344 } 345 327 @Override 328 public void windowDeactivated(WindowEvent arg0) { } 329 330 @Override 331 public void windowDeiconified(WindowEvent arg0) { } 332 333 @Override 334 public void windowIconified(WindowEvent arg0) { } 335 336 @Override 337 public void windowOpened(WindowEvent arg0) { } 338 339 @Override 346 340 public void update(VideoObserversEvents event) { 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 341 switch (event) 342 { 343 case resizing: 344 { 345 pack(); 346 break; 347 } 348 case speeding: 349 { 350 speed.setValue(videoengine.getSpeed()); 351 break; 352 } 353 case jumping: 354 { 355 break; 356 } 357 } 364 358 } 365 359 366 360 //keep internal controls up to date during playback 361 @Override 367 362 public void update_plays() { 368 363 timeline.setValue(videoengine.getPosition()); -
applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/video/VideoPlayerObserver.java
r25896 r29769 1 1 package org.openstreetmap.josm.plugins.videomapping.video; 2 2 3 //update mechanism for GPS position, title bar,... 3 /** Update mechanism for GPS position, title bar,... 4 */ 4 5 public interface VideoPlayerObserver { 5 6 public void update_plays(); 6 7 7 } -
applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/video/VideosObserver.java
r25896 r29769 1 1 package org.openstreetmap.josm.plugins.videomapping.video; 2 2 3 //getting basic control informations per video 3 /** Getting basic control informations per video 4 */ 4 5 public interface VideosObserver { 5 6 6 void update(VideoObserversEvents event); 7 8 7 }
Note:
See TracChangeset
for help on using the changeset viewer.