Changeset 3962 in osm
- Timestamp:
- 2007-08-05T21:54:03+02:00 (17 years ago)
- Location:
- applications/editors/josm/plugins/surveyor
- Files:
-
- 6 added
- 1 deleted
- 2 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/surveyor/build.xml
r3790 r3962 10 10 11 11 <!-- plugin meta data (enter new version number if anything changed!) --> 12 <property name="plugin.version" value="1. 2"/>12 <property name="plugin.version" value="1.3.1"/> 13 13 <property name="plugin.description" value="Allow adding markers/nodes on current gps positions (V${plugin.version})."/> 14 14 <property name="plugin.stage" value="60"/> … … 24 24 <target name="dist" depends="compile,site"> 25 25 <!-- images --> 26 <copy todir="${plugin.build.dir}/images"> 27 <fileset dir="src/images" /> 28 </copy> 29 <!-- copy configuration xml files --> 30 <copy todir="${plugin.build.dir}"> 31 <fileset dir="src"> 26 <copy todir="${plugin.build.dir}/"> 27 <fileset dir="resources"> 32 28 <include name="*.xml"/> 33 </fileset> 29 <include name="audio/*"/> 30 </fileset> 34 31 </copy> 35 32 -
applications/editors/josm/plugins/surveyor/resources/surveyor.xml
r3739 r3962 1 1 <?xml version="1.0"?> 2 <surveyor columns="4" width=" 0" height="0">2 <surveyor columns="4" width="1300" height="0"> 3 3 <!-- icons can either be absolute paths or relative paths to the .josm directory --> 4 4 <!-- action class: either fully qualified classnames or if not found, 5 5 package at.dallermassl.josm.plugin.surveyor.action is assumed --> 6 6 <button label="Tunnel Start" hotkey="T" icon="tunnel"> 7 <action class="PlayAudioAction" params="resource://audio/KDE_Window_Iconify.wav"/> 7 8 <action class="SetWaypointAction" params="tunnel start"/> 8 <action class="PlayAudioAction" params="/usr/share/sounds/KDE_Window_Iconify.wav"/>9 9 <!--action class="ConsolePrinterAction" params="tunnel start,tunnel"/--> 10 10 <!--action class="SystemExecuteAction" params="mplayer,-quiet,/usr/share/apps/klettres/de/alpha/x.ogg"/--> 11 11 </button> 12 12 <button label="Bridge" hotkey="B" type="toggle"> 13 <action class="PlayAudioAction" params="resource://audio/KDE_Window_Iconify.wav"/> 13 14 <action class="SetWaypointAction" params="bridge"/> 14 <action class="PlayAudioAction" params="/usr/share/sounds/KDE_Window_Iconify.wav"/>15 15 </button> 16 16 <button label="Village/City" hotkey="V" icon="place"> 17 <action class="PlayAudioAction" params="resource://audio/KDE_Window_Iconify.wav"/> 17 18 <action class="SetWaypointAction" params="village"/> 18 <action class="PlayAudioAction" params="/usr/share/sounds/KDE_Window_Iconify.wav"/>19 19 <!-- 20 20 <action class="SetNodeAction" params=""/> … … 23 23 </button> 24 24 <button label="Parking" hotkey="P" icon="parking"> 25 <action class="SetNodeAction" params="amenity=parking"/> 25 <!--action class="SetNodeAction" params="amenity=parking"/--> 26 <action class="PlayAudioAction" params="resource://audio/KDE_Window_Iconify.wav"/> 26 27 <action class="SetWaypointAction" params="Parking"/> 27 <action class="PlayAudioAction" params="/usr/share/sounds/KDE_Window_Iconify.wav"/>28 28 </button> 29 29 <button label="One Way" hotkey="O" icon="noentry"> 30 <action class="PlayAudioAction" params="resource://audio/KDE_Window_Iconify.wav"/> 30 31 <action class="SetWaypointAction" params="oneway=yes"/> 31 <action class="PlayAudioAction" params="/usr/share/sounds/KDE_Window_Iconify.wav"/>32 32 </button> 33 33 <button label="Church" hotkey="C" icon="church"> 34 <action class="PlayAudioAction" params="resource://audio/KDE_Window_Iconify.wav"/> 34 35 <action class="SetNodeAction" params="amenity=place_of_worship,denomination=christian"/> 35 36 <action class="SetWaypointAction" params="Church"/> 36 <action class="PlayAudioAction" params="/usr/share/sounds/KDE_Window_Iconify.wav"/>37 37 </button> 38 38 <button label="Fuel Station" hotkey="F" icon="fuel"> 39 <action class="SetNodeAction" params="amenity=fuel"/> 39 <!--action class="SetNodeAction" params="amenity=fuel"/--> 40 <action class="PlayAudioAction" params="resource://audio/KDE_Window_Iconify.wav"/> 40 41 <action class="SetWaypointAction" params="Fuel"/> 41 <action class="PlayAudioAction" params="/usr/share/sounds/KDE_Window_Iconify.wav"/>42 42 </button> 43 43 <button label="Hotel" hotkey="H" icon="bed"> 44 <action class="PlayAudioAction" params="resource://audio/KDE_Window_Iconify.wav"/> 44 45 <action class="SetWaypointAction" params="Hotel"/> 45 <action class="PlayAudioAction" params="/usr/share/sounds/KDE_Window_Iconify.wav"/>46 46 </button> 47 47 <button label="Restaurant" hotkey="R" icon="restaurant"> 48 <action class="PlayAudioAction" params="resource://audio/KDE_Window_Iconify.wav"/> 48 49 <action class="SetNodeAction" params="amenity=restaurant"/> 49 50 <action class="SetWaypointAction" params="Restaurant"/> 50 <action class="PlayAudioAction" params="/usr/share/sounds/KDE_Window_Iconify.wav"/> 51 </button> 52 <button label="Shopping" hotkey="S" icon="shopping"> 53 <action class="PlayAudioAction" params="resource://audio/KDE_Window_Iconify.wav"/> 54 <action class="SetWaypointAction" params="Info"/> 55 </button> 56 <button label="WC" hotkey="W" icon="toilet"> 57 <action class="PlayAudioAction" params="resource://audio/KDE_Window_Iconify.wav"/> 58 <action class="SetWaypointAction" params="Info"/> 59 </button> 60 <button label="Camping" hotkey="Z" icon="caravan"> 61 <action class="PlayAudioAction" params="resource://audio/KDE_Window_Iconify.wav"/> 62 <action class="SetWaypointAction" params="Camping"/> 63 </button> 64 <button label="Info" hotkey="I"> 65 <action class="PlayAudioAction" params="resource://audio/KDE_Window_Iconify.wav"/> 66 <action class="SetWaypointAction" params="Info"/> 51 67 </button> 52 68 <button label="Exit" hotkey="E"> 69 <action class="PlayAudioAction" params="resource://audio/KDE_Window_Iconify.wav"/> 53 70 <action class="SetWaypointAction" params="Exit"/> 54 <action class="PlayAudioAction" params="/usr/share/sounds/KDE_Window_Iconify.wav"/>55 71 </button> 56 72 <button label="Motorway" hotkey="1"> 73 <action class="PlayAudioAction" params="resource://audio/KDE_Window_Iconify.wav"/> 57 74 <action class="SetWaypointAction" params="Motorway"/> 58 <action class="PlayAudioAction" params="/usr/share/sounds/KDE_Window_Iconify.wav"/>59 75 </button> 60 76 <button label="Primary" hotkey="2"> 77 <action class="PlayAudioAction" params="resource://audio/KDE_Window_Iconify.wav"/> 61 78 <action class="SetWaypointAction" params="Primary"/> 62 <action class="PlayAudioAction" params="/usr/share/sounds/KDE_Window_Iconify.wav"/>63 79 </button> 64 80 <button label="Secondary" hotkey="3"> 81 <action class="PlayAudioAction" params="resource://audio/KDE_Window_Iconify.wav"/> 65 82 <action class="SetWaypointAction" params="Secondary"/> 66 <action class="PlayAudioAction" params="/usr/share/sounds/KDE_Window_Iconify.wav"/>67 83 </button> 68 84 <button label="Unclassified" hotkey="4"> 85 <action class="PlayAudioAction" params="resource://audio/KDE_Window_Iconify.wav"/> 69 86 <action class="SetWaypointAction" params="Unclassified"/> 70 <action class="PlayAudioAction" params="/usr/share/sounds/KDE_Window_Iconify.wav"/>71 87 </button> 72 88 <button label="Residential" hotkey="5"> 89 <action class="PlayAudioAction" params="resource://audio/KDE_Window_Iconify.wav"/> 73 90 <action class="SetWaypointAction" params="Residential"/> 74 <action class="PlayAudioAction" params="/usr/share/sounds/KDE_Window_Iconify.wav"/> 91 </button> 92 <button label="Test" hotkey="F12"> 93 <action class="PlayAudioAction" params="resource://audio/KDE_Window_Iconify.wav"/> 94 <action class="SetWaypointAction" params="Test"/> 75 95 </button> 76 96 </surveyor> -
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/PlayAudioAction.java
r3348 r3962 4 4 package at.dallermassl.josm.plugin.surveyor.action; 5 5 6 import java.io. File;6 import java.io.BufferedInputStream; 7 7 import java.io.IOException; 8 import java.io.InputStream; 8 9 import java.net.MalformedURLException; 9 10 … … 19 20 20 21 import at.dallermassl.josm.plugin.surveyor.GpsActionEvent; 22 import at.dallermassl.josm.plugin.surveyor.util.ResourceLoader; 21 23 22 24 /** … … 27 29 */ 28 30 public class PlayAudioAction extends AbstractSurveyorAction { 29 private File audioFile = null;31 private String audioSource = null; 30 32 31 33 /* (non-Javadoc) … … 34 36 //@Override 35 37 public void actionPerformed(GpsActionEvent event) { 36 try { 37 if(audioFile == null) { 38 audioFile = new File(getParameters().get(0)); 39 if(!audioFile.exists()) { 40 audioFile = new File(Main.pref.getPreferencesDir(), getParameters().get(0)); 41 if(!audioFile.exists()) { 42 System.err.println("Audio file " + getParameters().get(0) + " not found!"); 43 return; 38 // run as a separate thread 39 Main.worker.execute(new Runnable() { 40 public void run() { 41 try { 42 if(audioSource == null) { 43 audioSource = getParameters().get(0); 44 System.out.println("reading audio from " + audioSource); 44 45 } 46 InputStream in = new BufferedInputStream(ResourceLoader.getInputStream(audioSource)); 47 AudioInputStream stream = AudioSystem.getAudioInputStream(in); 48 49 // From URL 50 // stream = AudioSystem.getAudioInputStream(new URL("http://hostname/audiofile")); 51 52 // At present, ALAW and ULAW encodings must be converted 53 // to PCM_SIGNED before it can be played 54 AudioFormat format = stream.getFormat(); 55 if (format.getEncoding() != AudioFormat.Encoding.PCM_SIGNED) { 56 format = new AudioFormat( 57 AudioFormat.Encoding.PCM_SIGNED, 58 format.getSampleRate(), 59 format.getSampleSizeInBits()*2, 60 format.getChannels(), 61 format.getFrameSize()*2, 62 format.getFrameRate(), 63 true); // big endian 64 stream = AudioSystem.getAudioInputStream(format, stream); 65 } 66 67 // Create the clip 68 DataLine.Info info = new DataLine.Info( 69 Clip.class, stream.getFormat(), ((int)stream.getFrameLength()*format.getFrameSize())); 70 Clip clip = (Clip) AudioSystem.getLine(info); 71 72 // This method does not return until the audio file is completely loaded 73 clip.open(stream); 74 75 // Start playing 76 clip.start(); 77 } catch (MalformedURLException e) { 78 e.printStackTrace(); 79 } catch (IOException e) { 80 e.printStackTrace(); 81 } catch (LineUnavailableException e) { 82 e.printStackTrace(); 83 } catch (UnsupportedAudioFileException e) { 84 e.printStackTrace(); 45 85 } 46 86 } 47 // From file 48 AudioInputStream stream = AudioSystem.getAudioInputStream(audioFile); 49 50 // From URL 51 // stream = AudioSystem.getAudioInputStream(new URL("http://hostname/audiofile")); 52 53 // At present, ALAW and ULAW encodings must be converted 54 // to PCM_SIGNED before it can be played 55 AudioFormat format = stream.getFormat(); 56 if (format.getEncoding() != AudioFormat.Encoding.PCM_SIGNED) { 57 format = new AudioFormat( 58 AudioFormat.Encoding.PCM_SIGNED, 59 format.getSampleRate(), 60 format.getSampleSizeInBits()*2, 61 format.getChannels(), 62 format.getFrameSize()*2, 63 format.getFrameRate(), 64 true); // big endian 65 stream = AudioSystem.getAudioInputStream(format, stream); 66 } 67 68 // Create the clip 69 DataLine.Info info = new DataLine.Info( 70 Clip.class, stream.getFormat(), ((int)stream.getFrameLength()*format.getFrameSize())); 71 Clip clip = (Clip) AudioSystem.getLine(info); 72 73 // This method does not return until the audio file is completely loaded 74 clip.open(stream); 75 76 // Start playing 77 clip.start(); 78 } catch (MalformedURLException e) { 79 e.printStackTrace(); 80 } catch (IOException e) { 81 e.printStackTrace(); 82 } catch (LineUnavailableException e) { 83 e.printStackTrace(); 84 } catch (UnsupportedAudioFileException e) { 85 e.printStackTrace(); 86 } 87 88 }); 87 89 88 90 }
Note:
See TracChangeset
for help on using the changeset viewer.