Changeset 6709 in osm for applications/editors/josm/plugins/livegps
- Timestamp:
- 2008-01-29T19:15:15+01:00 (17 years ago)
- Location:
- applications/editors/josm/plugins/livegps
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/livegps/build.xml
r6162 r6709 10 10 11 11 <!-- compilation properties --> 12 <property name="josm.build.dir" value="../../core"/> 12 <!--<property name="josm.build.dir" value="../../JOSM/"/> --> 13 <property name="josm.build.dir" value="../../core/"/> 13 14 <property name="josm.plugins.dir" value="${josm.home.dir}/plugins"/> 15 <!-- <property name="josm" location="../../JOSM/dist/josm-custom.jar" /> --> 14 16 <property name="josm" location="../../core/dist/josm-custom.jar" /> 15 17 <property name="plugin.build.dir" value="build"/> … … 39 41 <copy todir="${plugin.build.dir}/images"> 40 42 <fileset dir="images" /> 41 </copy> 43 </copy> 42 44 43 45 <!-- create jar file --> … … 59 61 <pathelement path="${josm.build.dir}/build"/> 60 62 <fileset dir="${josm.build.dir}/lib"> 63 <include name="/usr/lib/josm/josm.jar"/> 61 64 <include name="**/*.jar"/> 62 65 </fileset> … … 68 71 <target name="install" depends="dist"> 69 72 <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/> 73 <copy file="liveGPS.conf" todir="${josm.plugins.dir}/livegps/" /> 70 74 </target> 71 75 -
applications/editors/josm/plugins/livegps/livegps/LiveGpsAcquirer.java
r6417 r6709 5 5 import java.beans.PropertyChangeListener; 6 6 import java.io.BufferedReader; 7 import java.io.FileInputStream; 8 import java.io.FileNotFoundException; 7 9 import java.io.IOException; 8 10 import java.io.InputStreamReader; … … 11 13 import java.util.ArrayList; 12 14 import java.util.List; 15 import java.util.Properties; 13 16 14 17 import org.openstreetmap.josm.data.coor.LatLon; … … 20 23 String gpsdHost = "localhost"; 21 24 int gpsdPort = 2947; 25 String configFile = "liveGPS.conf"; 22 26 boolean shutdownFlag = false; 23 27 private List<PropertyChangeListener> propertyChangeListener = new ArrayList<PropertyChangeListener>(); … … 25 29 private PropertyChangeEvent lastDataEvent; 26 30 27 public LiveGpsAcquirer() { 31 public LiveGpsAcquirer(String pluginDir) { 32 33 Properties liveGPSconfig = new Properties(); 34 35 FileInputStream fis = null; 36 37 try { 38 fis = new FileInputStream(pluginDir + configFile); 39 } catch (FileNotFoundException e) { 40 System.err.println("No liveGPS.conf found, using defaults"); 41 } 42 43 if(fis != null) 44 { 45 try { 46 liveGPSconfig.load(fis); 47 this.gpsdHost = liveGPSconfig.getProperty("host"); 48 this.gpsdPort = Integer.parseInt(liveGPSconfig.getProperty("port")); 49 50 } catch (IOException e) { 51 System.err.println("Error while loading liveGPS.conf, using defaults"); 52 } 53 54 if(this.gpsdHost == null || this.gpsdPort == 0) 55 { 56 System.err.println("Error in liveGPS.conf, using defaults"); 57 this.gpsdHost = "localhost"; 58 this.gpsdPort = 2947; 59 } 60 } 28 61 29 62 } -
applications/editors/josm/plugins/livegps/livegps/LiveGpsDialog.java
r3741 r6709 73 73 latLabel.setText(data.getLatitude() + "deg"); 74 74 longLabel.setText(data.getLongitude() + "deg"); 75 speedLabel.setText((data.getSpeed() * 3.6f) + "km/h"); // m(s to km/h 75 double mySpeed = data.getSpeed() * 3.6f; 76 speedLabel.setText((Math.round(mySpeed*100)/100) + "km/h"); // m(s to km/h 76 77 courseLabel.setText(data.getCourse() + "deg"); 77 78 -
applications/editors/josm/plugins/livegps/livegps/LiveGpsPlugin.java
r6161 r6709 30 30 private LiveGpsDialog lgpsdialog; 31 31 List<PropertyChangeListener>listenerQueue; 32 32 33 33 private GpxData data = new GpxData(); 34 34 private LiveGpsLayer lgpslayer; … … 125 125 { 126 126 if (acquirer == null) { 127 acquirer = new LiveGpsAcquirer( );127 acquirer = new LiveGpsAcquirer(getPluginDir()); 128 128 if (lgpslayer == null) { 129 129 lgpslayer = new LiveGpsLayer(data);
Note:
See TracChangeset
for help on using the changeset viewer.