Ignore:
Timestamp:
2011-06-23T17:50:32+02:00 (13 years ago)
Author:
stoecker
Message:

fix i18n

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/public_transport/src/public_transport/TrackSuggestStopsCommand.java

    r23192 r26168  
    11package public_transport;
     2
     3import static org.openstreetmap.josm.tools.I18n.tr;
    24
    35import java.util.Collection;
     
    5860      Node node = stoplistTM.nodeAt(i);
    5961      if (node == null)
    60     continue;
     62        continue;
    6163      Main.main.getCurrentDataSet().removePrimitive(node);
    6264      node.setDeleted(true);
     
    7072      Iterator< WayPoint > witer = siter.next().getWayPoints().iterator();
    7173      while (witer.hasNext())
    72     wayPoints.add(witer.next());
     74        wayPoints.add(witer.next());
    7375    }
    7476    Vector< Double > wayPointsDist = new Vector< Double >(wayPoints.size());
     
    8082    {
    8183      if (wayPoints.elementAt(i).getString("time") != null)
    82     time = StopImporterDialog.parseTime(wayPoints.elementAt(i)
    83         .getString("time").substring(11,19));
     84        time = StopImporterDialog.parseTime(wayPoints.elementAt(i)
     85            .getString("time").substring(11,19));
    8486      if (time < dGpsStartTime)
    85     time += 24*60*60;
     87        time += 24*60*60;
    8688      wayPointsDist.add(Double.valueOf(Double.POSITIVE_INFINITY));
    8789      ++i;
     
    9395      while ((j > 0) && (time - timeWindow/2 < time2))
    9496      {
    95     --j;
    96     if (wayPoints.elementAt(j).getString("time") != null)
    97       time2 = StopImporterDialog.parseTime(wayPoints.elementAt(j)
    98           .getString("time").substring(11,19));
    99     if (time2 < dGpsStartTime)
    100       time2 += 24*60*60;
     97        --j;
     98        if (wayPoints.elementAt(j).getString("time") != null)
     99          time2 = StopImporterDialog.parseTime(wayPoints.elementAt(j)
     100              .getString("time").substring(11,19));
     101        if (time2 < dGpsStartTime)
     102          time2 += 24*60*60;
    101103      }
    102104      int k = i + 1;
     
    104106      while ((k < wayPoints.size()) && (time + timeWindow/2 > time2))
    105107      {
    106     if (wayPoints.elementAt(k).getString("time") != null)
    107       time2 = StopImporterDialog.parseTime(wayPoints.elementAt(k)
    108           .getString("time").substring(11,19));
    109     if (time2 < dGpsStartTime)
    110       time2 += 24*60*60;
    111     ++k;
     108        if (wayPoints.elementAt(k).getString("time") != null)
     109          time2 = StopImporterDialog.parseTime(wayPoints.elementAt(k)
     110              .getString("time").substring(11,19));
     111        if (time2 < dGpsStartTime)
     112          time2 += 24*60*60;
     113        ++k;
    112114      }
    113115
    114116      if (j < k)
    115117      {
    116     double dist = 0;
    117     LatLon latLonI = wayPoints.elementAt(i).getCoor();
    118     for (int l = j; l < k; ++l)
    119     {
    120       double distL = latLonI.greatCircleDistance(wayPoints.elementAt(l).getCoor());
    121       if (distL > dist)
    122         dist = distL;
    123     }
    124     wayPointsDist.add(Double.valueOf(dist));
     118        double dist = 0;
     119        LatLon latLonI = wayPoints.elementAt(i).getCoor();
     120        for (int l = j; l < k; ++l)
     121        {
     122          double distL = latLonI.greatCircleDistance(wayPoints.elementAt(l).getCoor());
     123          if (distL > dist)
     124            dist = distL;
     125        }
     126        wayPointsDist.add(Double.valueOf(dist));
    125127      }
    126128      else
    127     wayPointsDist.add(Double.valueOf(Double.POSITIVE_INFINITY));
     129        wayPointsDist.add(Double.valueOf(Double.POSITIVE_INFINITY));
    128130
    129131      if (wayPoints.elementAt(i).getString("time") != null)
    130     time = StopImporterDialog.parseTime(wayPoints.elementAt(i)
    131         .getString("time").substring(11,19));
     132        time = StopImporterDialog.parseTime(wayPoints.elementAt(i)
     133            .getString("time").substring(11,19));
    132134      if (time < dGpsStartTime)
    133     time += 24*60*60;
     135        time += 24*60*60;
    134136      ++i;
    135137    }
     
    139141    {
    140142      if (wayPointsDist.elementAt(i).doubleValue() >= threshold)
    141     continue;
     143        continue;
    142144      if ((wayPointsDist.elementAt(i).compareTo(wayPointsDist.elementAt(i-1)) != -1)
    143145       || (wayPointsDist.elementAt(i).compareTo(wayPointsDist.elementAt(i+1)) != -1))
    144     continue;
     146        continue;
    145147
    146148      LatLon latLon = wayPoints.elementAt(i).getCoor();
    147149      if ((lastStopCoor != null) &&  (lastStopCoor.greatCircleDistance(latLon) < threshold))
    148     continue;
     150        continue;
    149151
    150152      if (wayPoints.elementAt(i).getString("time") != null)
    151153      {
    152     time = StopImporterDialog.parseTime(wayPoints.elementAt(i)
    153         .getString("time").substring(11,19));
    154     double gpsSyncTime = StopImporterDialog.parseTime(this.gpsSyncTime);
    155     if (gpsSyncTime < dGpsStartTime - 12*60*60)
    156       gpsSyncTime += 24*60*60;
    157     double timeDelta = gpsSyncTime - StopImporterDialog.parseTime(stopwatchStart);
    158     time -= timeDelta;
    159     Node node = StopImporterAction.createNode(latLon, type, "");
    160     stoplistTM.insertRow(-1, node, StopImporterAction.timeOf(time), "", "");
     154        time = StopImporterDialog.parseTime(wayPoints.elementAt(i)
     155            .getString("time").substring(11,19));
     156        double gpsSyncTime = StopImporterDialog.parseTime(this.gpsSyncTime);
     157        if (gpsSyncTime < dGpsStartTime - 12*60*60)
     158          gpsSyncTime += 24*60*60;
     159        double timeDelta = gpsSyncTime - StopImporterDialog.parseTime(stopwatchStart);
     160        time -= timeDelta;
     161        Node node = StopImporterAction.createNode(latLon, type, "");
     162        stoplistTM.insertRow(-1, node, StopImporterAction.timeOf(time), "", new TransText(null));
    161163      }
    162164
     
    175177      Node node = stoplistTM.nodeAt(i);
    176178      if (node == null)
    177     continue;
     179        continue;
    178180      Main.main.getCurrentDataSet().removePrimitive(node);
    179181      node.setDeleted(true);
     
    188190      Node node = stoplistTM.nodeAt(i);
    189191      if (node == null)
    190     continue;
     192        continue;
    191193      node.setDeleted(false);
    192194      Main.main.getCurrentDataSet().addPrimitive(node);
     
    202204  @Override public JLabel getDescription()
    203205  {
    204     return new JLabel("public_transport.TrackStoplist.SuggestStops");
     206    return new JLabel(tr("Public Transport: Suggest stops"));
    205207  }
    206208
     
    223225      double time = StopImporterDialog.parseTime(this.time);
    224226      if (time - startTime > 12*60*60)
    225     time -= 24*60*60;
     227        time -= 24*60*60;
    226228
    227229      double nseTime = StopImporterDialog.parseTime(nse.time);
    228230      if (nseTime - startTime > 12*60*60)
    229     nseTime -= 24*60*60;
     231        nseTime -= 24*60*60;
    230232
    231233      if (time < nseTime)
    232     return -1;
     234        return -1;
    233235      else if (time > nseTime)
    234     return 1;
     236        return 1;
    235237      else
    236     return 0;
     238        return 0;
    237239    }
    238240  };
Note: See TracChangeset for help on using the changeset viewer.