Ignore:
Timestamp:
2008-01-29T19:15:15+01:00 (16 years ago)
Author:
t2000
Message:

added configfile to livegps to be able to change host and port where gpsd is running on

Location:
applications/editors/josm/plugins/livegps
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/livegps/build.xml

    r6162 r6709  
    1010
    1111  <!-- 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/"/>
    1314  <property name="josm.plugins.dir" value="${josm.home.dir}/plugins"/>
     15  <!-- <property name="josm"                    location="../../JOSM/dist/josm-custom.jar" /> -->
    1416  <property name="josm"                 location="../../core/dist/josm-custom.jar" />
    1517  <property name="plugin.build.dir"     value="build"/>
     
    3941    <copy todir="${plugin.build.dir}/images">
    4042      <fileset dir="images" />
    41     </copy>
     43    </copy>     
    4244   
    4345    <!-- create jar file -->
     
    5961        <pathelement path="${josm.build.dir}/build"/>
    6062        <fileset dir="${josm.build.dir}/lib">
     63          <include name="/usr/lib/josm/josm.jar"/>
    6164          <include name="**/*.jar"/>
    6265        </fileset>
     
    6871  <target name="install" depends="dist">
    6972    <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
     73        <copy file="liveGPS.conf" todir="${josm.plugins.dir}/livegps/" />
    7074  </target>
    7175
  • applications/editors/josm/plugins/livegps/livegps/LiveGpsAcquirer.java

    r6417 r6709  
    55import java.beans.PropertyChangeListener;
    66import java.io.BufferedReader;
     7import java.io.FileInputStream;
     8import java.io.FileNotFoundException;
    79import java.io.IOException;
    810import java.io.InputStreamReader;
     
    1113import java.util.ArrayList;
    1214import java.util.List;
     15import java.util.Properties;
    1316
    1417import org.openstreetmap.josm.data.coor.LatLon;
     
    2023        String gpsdHost = "localhost";
    2124        int gpsdPort = 2947;
     25        String configFile = "liveGPS.conf";
    2226        boolean shutdownFlag = false;
    2327    private List<PropertyChangeListener> propertyChangeListener = new ArrayList<PropertyChangeListener>();
     
    2529    private PropertyChangeEvent lastDataEvent;
    2630       
    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                }
    2861               
    2962        }
  • applications/editors/josm/plugins/livegps/livegps/LiveGpsDialog.java

    r3741 r6709  
    7373                latLabel.setText(data.getLatitude() + "deg");
    7474                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
    7677                courseLabel.setText(data.getCourse() + "deg");
    7778               
  • applications/editors/josm/plugins/livegps/livegps/LiveGpsPlugin.java

    r6161 r6709  
    3030    private LiveGpsDialog lgpsdialog;
    3131    List<PropertyChangeListener>listenerQueue;
    32    
     32       
    3333        private GpxData data = new GpxData();
    3434    private LiveGpsLayer lgpslayer;
     
    125125        {
    126126            if (acquirer == null) {
    127                 acquirer = new LiveGpsAcquirer();
     127                acquirer = new LiveGpsAcquirer(getPluginDir());
    128128                if (lgpslayer == null) {
    129129                    lgpslayer = new LiveGpsLayer(data);
Note: See TracChangeset for help on using the changeset viewer.