Changeset 26168 in osm for applications/editors


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

fix i18n

Location:
applications/editors/josm/plugins/public_transport/src/public_transport
Files:
1 added
27 edited

Legend:

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

    r23192 r26168  
    11package public_transport;
     2
     3import static org.openstreetmap.josm.tools.I18n.tr;
    24
    35import org.openstreetmap.josm.Main;
     
    5759         (String)gtfsStopTM.getValueAt(j, 1));
    5860      gtfsStopTM.nodes.set(j, node);
    59       gtfsStopTM.setValueAt("added", j, 2);
     61      gtfsStopTM.setValueAt(tr("added"), j, 2);
    6062    }
    6163    return true;
     
    8587  @Override public JLabel getDescription()
    8688  {
    87     return new JLabel("public_transport.GTFSStops.Enable");
     89    return new JLabel(tr("Public Transport: Enable GTFSStops"));
    8890  }
    8991};
  • applications/editors/josm/plugins/public_transport/src/public_transport/GTFSCatchCommand.java

    r23192 r26168  
    11package public_transport;
     2
     3import static org.openstreetmap.josm.tools.I18n.tr;
    24
    35import org.openstreetmap.josm.Main;
     
    108110  @Override public JLabel getDescription()
    109111  {
    110     return new JLabel("public_transport.GTFSStops.Catch");
     112    return new JLabel(tr("Public Transport: Catch GTFS stops"));
    111113  }
    112114};
  • applications/editors/josm/plugins/public_transport/src/public_transport/GTFSDeleteCommand.java

    r23192 r26168  
    11package public_transport;
     2
     3import static org.openstreetmap.josm.tools.I18n.tr;
    24
    35import org.openstreetmap.josm.Main;
     
    5961    continue;
    6062      gtfsStopTM.nodes.set(j, null);
    61       gtfsStopTM.setValueAt("skipped", j, 2);
     63      gtfsStopTM.setValueAt(tr("skipped"), j, 2);
    6264      Main.main.getCurrentDataSet().removePrimitive(node);
    6365      node.setDeleted(true);
     
    8991  @Override public JLabel getDescription()
    9092  {
    91     return new JLabel("public_transport.GTFS.Disable");
     93    return new JLabel(tr("Public Transport: Disable GTFS"));
    9294  }
    9395};
  • applications/editors/josm/plugins/public_transport/src/public_transport/GTFSImporterAction.java

    r26147 r26168  
    11package public_transport;
    22
    3 import static org.openstreetmap.josm.tools.I18n.marktr;
    43import static org.openstreetmap.josm.tools.I18n.tr;
    54
     
    115114      if (curDir.equals(""))
    116115      {
    117     curDir = ".";
     116        curDir = ".";
    118117      }
    119118      JFileChooser fc = new JFileChooser(new File(curDir));
    120       fc.setDialogTitle("Select GTFS file (stops.txt)");
     119      fc.setDialogTitle(tr("Select GTFS file (stops.txt)"));
    121120      fc.setMultiSelectionEnabled(false);
    122121
    123122      int answer = fc.showOpenDialog(Main.parent);
    124123      if (answer != JFileChooser.APPROVE_OPTION)
    125     return;
     124        return;
    126125
    127126      if (!fc.getCurrentDirectory().getAbsolutePath().equals(curDir))
    128     Main.pref.put("lastDirectory", fc.getCurrentDirectory().getAbsolutePath());
     127        Main.pref.put("lastDirectory", fc.getCurrentDirectory().getAbsolutePath());
    129128
    130129      importData(fc.getSelectedFile());
     
    216215      if (Main.main.getCurrentDataSet() == null)
    217216      {
    218         JOptionPane.showMessageDialog(null, "There exists no dataset."
    219         + " Try to download data from the server or open an OSM file.",
    220      "No data found", JOptionPane.ERROR_MESSAGE);
    221 
    222         System.out.println("Public Transport: StopInserter: No data found");
     217        JOptionPane.showMessageDialog(null, tr("There exists no dataset."
     218        + " Try to download data from the server or open an OSM file."),
     219        tr("No data found"), JOptionPane.ERROR_MESSAGE);
    223220
    224221        return;
     
    226223      else
    227224      {
    228     Iterator< Node > iter =
     225        Iterator< Node > iter =
    229226        Main.main.getCurrentDataSet().getNodes().iterator();
    230     while (iter.hasNext())
    231     {
    232       Node node = iter.next();
    233       if ("bus_stop".equals(node.get("highway")))
    234         existingStops.add(node);
    235     }
     227        while (iter.hasNext())
     228        {
     229          Node node = iter.next();
     230          if ("bus_stop".equals(node.get("highway")))
     231            existingStops.add(node);
     232        }
    236233      }
    237234
    238235      Iterator< String > iter = data.iterator();
    239236      if (iter.hasNext())
    240     gtfsStopTM = new GTFSStopTableModel(this, iter.next());
     237        gtfsStopTM = new GTFSStopTableModel(this, iter.next());
    241238      else
    242239      {
    243     JOptionPane.showMessageDialog
    244     (null, "The GTFS file was empty.", "No data found",
    245      JOptionPane.ERROR_MESSAGE);
    246 
    247         System.out.println("Public Transport: GTFSImporter: No data found");
     240        JOptionPane.showMessageDialog
     241        (null, tr("The GTFS file was empty."), tr("No data found"),
     242        JOptionPane.ERROR_MESSAGE);
    248243
    249244        return;
     
    252247      while (iter.hasNext())
    253248      {
    254     String s = iter.next();
    255     gtfsStopTM.addRow(s, existingStops);
     249        String s = iter.next();
     250        gtfsStopTM.addRow(s, existingStops);
    256251      }
    257252      dialog.setGTFSStopTableModel(gtfsStopTM);
     
    260255    {
    261256      JOptionPane.showMessageDialog
    262       (null, "The GTFS file was empty.", "No data found",
     257      (null, tr("The GTFS file was empty."), tr("No data found"),
    263258       JOptionPane.ERROR_MESSAGE);
    264 
    265       System.out.println("Public Transport: GTFSImporter: No data found");
    266259    }
    267260  }
     
    298291    if (Main.main.getCurrentDataSet() == null)
    299292    {
    300       JOptionPane.showMessageDialog(null, "There exists no dataset."
    301       + " Try to download data from the server or open an OSM file.",
    302    "No data found", JOptionPane.ERROR_MESSAGE);
    303 
    304       System.out.println("Public Transport: StopInserter: No data found");
     293      JOptionPane.showMessageDialog(null, tr("There exists no dataset."
     294      + " Try to download data from the server or open an OSM file."),
     295      tr("No data found"), JOptionPane.ERROR_MESSAGE);
    305296
    306297      return null;
     
    319310    {
    320311      for (int i = 0; i < selectedLines.length; ++i)
    321     consideredLines.add(selectedLines[i]);
     312        consideredLines.add(selectedLines[i]);
    322313    }
    323314    else
    324315    {
    325316      for (int i = 0; i < table.getRowCount(); ++i)
    326     consideredLines.add(new Integer(i));
     317        consideredLines.add(new Integer(i));
    327318    }
    328319    return consideredLines;
     
    340331    {
    341332      if ((nodes.elementAt(i) != null) &&
    342        (Main.main.getCurrentDataSet().isSelected(nodes.elementAt(i))))
    343     table.addRowSelectionInterval(i, i);
     333      (Main.main.getCurrentDataSet().isSelected(nodes.elementAt(i))))
     334        table.addRowSelectionInterval(i, i);
    344335    }
    345336  }
     
    355346      int j = consideredLines.elementAt(i);
    356347      if (nodes.elementAt(j) != null)
    357     nodes.elementAt(j).visit(box);
     348        nodes.elementAt(j).visit(box);
    358349    }
    359350    if (box.getBounds() == null)
     
    374365      int j = consideredLines.elementAt(i);
    375366      if (nodes.elementAt(j) != null)
    376     Main.main.getCurrentDataSet().addSelected(nodes.elementAt(j));
     367        Main.main.getCurrentDataSet().addSelected(nodes.elementAt(j));
    377368    }
    378369  }
  • applications/editors/josm/plugins/public_transport/src/public_transport/GTFSImporterDialog.java

    r23192 r26168  
    7474  private JTable stoplistTable = null;
    7575  private JTable gtfsStopTable = null;
     76  private final String[] stoptypes = new String[]{marktr("bus"), marktr("tram"), marktr("light_rail"), marktr("subway"), marktr("rail")};
    7677
    7778  public GTFSImporterDialog(GTFSImporterAction controller)
    7879  {
    7980    Frame frame = JOptionPane.getFrameForComponent(Main.parent);
    80     jDialog = new JDialog(frame, "Create Stops from GTFS", false);
     81    jDialog = new JDialog(frame, tr("Create Stops from GTFS"), false);
    8182    tabbedPane = new JTabbedPane();
    8283    JPanel tabSettings = new JPanel();
    83     tabbedPane.addTab(marktr("Settings"), tabSettings);
     84    tabbedPane.addTab(tr("Settings"), tabSettings);
    8485    JPanel tabWaypoints = new JPanel();
    85     tabbedPane.addTab(marktr("GTFS-Stops"), tabWaypoints);
     86    tabbedPane.addTab(tr("GTFS-Stops"), tabWaypoints);
    8687    tabbedPane.setEnabledAt(0, false);
    8788    tabbedPane.setEnabledAt(1, true);
     
    9495    contentPane.setLayout(gridbag);
    9596
    96     JLabel label = new JLabel("Type of stops to add");
     97    JLabel label = new JLabel(tr("Type of stops to add"));
    9798
    9899    layoutCons.gridx = 0;
     
    107108    cbStoptype = new JComboBox();
    108109    cbStoptype.setEditable(false);
    109     cbStoptype.addItem("bus");
    110     cbStoptype.addItem("tram");
    111     cbStoptype.addItem("light_rail");
    112     cbStoptype.addItem("subway");
    113     cbStoptype.addItem("rail");
     110    for(String type : stoptypes)
     111        cbStoptype.addItem(new TransText(type));
    114112    cbStoptype.setActionCommand("gtfsImporter.settingsStoptype");
    115113    cbStoptype.addActionListener(controller);
     
    124122    contentPane.add(cbStoptype);
    125123
    126     label = new JLabel("Time on your GPS device");
     124    label = new JLabel(tr("Time on your GPS device"));
    127125
    128126    layoutCons.gridx = 0;
     
    148146    contentPane.add(tfGPSTimeStart);
    149147
    150     label = new JLabel("HH:MM:SS.sss");
     148    /* I18n: Don't change the time format, you only may translate the letters */
     149    label = new JLabel(tr("HH:MM:SS.sss"));
    151150
    152151    layoutCons.gridx = 1;
     
    159158    contentPane.add(label);
    160159
    161     label = new JLabel("Time on your stopwatch");
     160    label = new JLabel(tr("Time on your stopwatch"));
    162161
    163162    layoutCons.gridx = 0;
     
    183182    contentPane.add(tfStopwatchStart);
    184183
    185     label = new JLabel("HH:MM:SS.sss");
     184    /* I18n: Don't change the time format, you only may translate the letters */
     185    label = new JLabel(tr("HH:MM:SS.sss"));
    186186
    187187    layoutCons.gridx = 1;
     
    194194    contentPane.add(label);
    195195
    196     label = new JLabel("Time window");
     196    label = new JLabel(tr("Time window"));
    197197
    198198    layoutCons.gridx = 0;
     
    218218    contentPane.add(tfTimeWindow);
    219219
    220     label = new JLabel("seconds");
     220    label = new JLabel(tr("seconds"));
    221221
    222222    layoutCons.gridx = 1;
     
    229229    contentPane.add(label);
    230230
    231     label = new JLabel("Move Threshold");
     231    label = new JLabel(tr("Move Threshold"));
    232232
    233233    layoutCons.gridx = 0;
     
    253253    contentPane.add(tfThreshold);
    254254
    255     label = new JLabel("meters");
     255    label = new JLabel(tr("meters"));
    256256
    257257    layoutCons.gridx = 1;
     
    264264    contentPane.add(label);
    265265
    266     JButton bSuggestStops = new JButton("Suggest Stops");
     266    JButton bSuggestStops = new JButton(tr("Suggest Stops"));
    267267    bSuggestStops.setActionCommand("gtfsImporter.settingsSuggestStops");
    268268    bSuggestStops.addActionListener(controller);
     
    319319    contentPane.add(tableSP);
    320320
    321     JButton bFind = new JButton("Find");
     321    JButton bFind = new JButton(tr("Find"));
    322322    bFind.setActionCommand("gtfsImporter.gtfsStopsFind");
    323323    bFind.addActionListener(controller);
     
    332332    contentPane.add(bFind);
    333333
    334     JButton bShow = new JButton("Show");
     334    JButton bShow = new JButton(tr("Show"));
    335335    bShow.setActionCommand("gtfsImporter.gtfsStopsShow");
    336336    bShow.addActionListener(controller);
     
    345345    contentPane.add(bShow);
    346346
    347     JButton bMark = new JButton("Mark");
     347    JButton bMark = new JButton(tr("Mark"));
    348348    bMark.setActionCommand("gtfsImporter.gtfsStopsMark");
    349349    bMark.addActionListener(controller);
     
    359359    contentPane.add(bMark);
    360360
    361     JButton bCatch = new JButton("Catch");
     361    JButton bCatch = new JButton(tr("Catch"));
    362362    bCatch.setActionCommand("gtfsImporter.gtfsStopsCatch");
    363363    bCatch.addActionListener(controller);
     
    373373    contentPane.add(bCatch);
    374374
    375     JButton bJoin = new JButton("Join");
     375    JButton bJoin = new JButton(tr("Join"));
    376376    bJoin.setActionCommand("gtfsImporter.gtfsStopsJoin");
    377377    bJoin.addActionListener(controller);
     
    387387    contentPane.add(bJoin);
    388388
    389     JButton bAdd = new JButton("Enable");
     389    JButton bAdd = new JButton(tr("Enable"));
    390390    bAdd.setActionCommand("gtfsImporter.gtfsStopsAdd");
    391391    bAdd.addActionListener(controller);
     
    401401    contentPane.add(bAdd);
    402402
    403     JButton bDelete = new JButton("Disable");
     403    JButton bDelete = new JButton(tr("Disable"));
    404404    bDelete.setActionCommand("gtfsImporter.gtfsStopsDelete");
    405405    bDelete.addActionListener(controller);
     
    440440  public String getStoptype()
    441441  {
    442     return (String)cbStoptype.getSelectedItem();
     442    return ((TransText)cbStoptype.getSelectedItem()).text;
    443443  }
    444444
     
    452452    {
    453453      JOptionPane.showMessageDialog
    454       (null, "Can't parse a time from this string.", "Invalid value",
     454      (null, tr("Can't parse a time from this string."), tr("Invalid value"),
    455455       JOptionPane.ERROR_MESSAGE);
    456456      return false;
     
    477477    {
    478478      JOptionPane.showMessageDialog
    479       (null, "Can't parse a time from this string.", "Invalid value",
     479      (null, tr("Can't parse a time from this string."), tr("Invalid value"),
    480480       JOptionPane.ERROR_MESSAGE);
    481481      return false;
  • applications/editors/josm/plugins/public_transport/src/public_transport/GTFSJoinCommand.java

    r23192 r26168  
    11package public_transport;
     2
     3import static org.openstreetmap.josm.tools.I18n.tr;
    24
    35import org.openstreetmap.josm.Main;
     
    6668    gtfsStopTM.nodes.set(j, dest);
    6769    type = (String)gtfsStopTM.getValueAt(j, 2);
    68     gtfsStopTM.setValueAt("moved", j, 2);
     70    gtfsStopTM.setValueAt(tr("moved"), j, 2);
    6971
    7072    return true;
     
    106108  @Override public JLabel getDescription()
    107109  {
    108     return new JLabel("public_transport.GTFSStops.Join");
     110    return new JLabel(tr("Public Transport: Join GTFS stops"));
    109111  }
    110112};
  • applications/editors/josm/plugins/public_transport/src/public_transport/GTFSStopTableModel.java

    r25701 r26168  
    11package public_transport;
    22
    3 import static org.openstreetmap.josm.tools.I18n.marktr;
    43import static org.openstreetmap.josm.tools.I18n.tr;
    54
     
    7069
    7170    this.controller = controller;
    72     addColumn("Id");
    73     addColumn("Name");
    74     addColumn("State");
     71    addColumn(tr("Id"));
     72    addColumn(tr("Name"));
     73    addColumn(tr("State"));
    7574    addTableModelListener(this);
    7675  }
     
    138137  public void insertRow(int insPos, String s, Vector< Node > existingStops)
    139138  {
    140     String[] buf = { "", "", "pending" };
     139    String[] buf = { "", "", tr("pending") };
    141140    int pos = tokenize(s, 0);
    142141    int oldPos = 0;
     
    176175      while (iter.hasNext())
    177176      {
    178     if (iter.next().bounds.contains(coor))
    179     {
    180       inside = true;
    181       break;
    182     }
     177        if (iter.next().bounds.contains(coor))
     178        {
     179          inside = true;
     180          break;
     181        }
    183182      }
    184183      if (!inside)
    185     buf[2] = "outside";
     184        buf[2] = tr("outside");
    186185    }
    187186
     
    193192      if (coor.greatCircleDistance(node.getCoor()) < 1000)
    194193      {
    195     nearBusStop = true;
    196     break;
     194        nearBusStop = true;
     195        break;
    197196      }
    198197    }
     
    200199    if (insPos == -1)
    201200    {
    202       if ((nearBusStop) || !("pending".equals(buf[2])))
    203     nodes.addElement(null);
     201      if ((nearBusStop) || !(tr("pending").equals(buf[2])))
     202        nodes.addElement(null);
    204203      else
    205204      {
    206     Node node = GTFSImporterAction.createNode(coor, buf[0], buf[1]);
    207     nodes.addElement(node);
    208     buf[2] = "added";
     205        Node node = GTFSImporterAction.createNode(coor, buf[0], buf[1]);
     206        nodes.addElement(node);
     207        buf[2] = tr("added");
    209208      }
    210209      coors.addElement(coor);
     
    213212    else
    214213    {
    215       if ((nearBusStop) || !("pending".equals(buf[2])))
    216     nodes.insertElementAt(null, insPos);
     214      if ((nearBusStop) || !(tr("pending").equals(buf[2])))
     215        nodes.insertElementAt(null, insPos);
    217216      else
    218217      {
    219     Node node = GTFSImporterAction.createNode(coor, buf[0], buf[1]);
    220     nodes.insertElementAt(node, insPos);
    221     buf[2] = "added";
     218        Node node = GTFSImporterAction.createNode(coor, buf[0], buf[1]);
     219        nodes.insertElementAt(node, insPos);
     220        buf[2] = tr("added");
    222221      }
    223222      coors.insertElementAt(coor, insPos);
  • applications/editors/josm/plugins/public_transport/src/public_transport/ItineraryTableModel.java

    r23192 r26168  
    11package public_transport;
    22
    3 // import static org.openstreetmap.josm.tools.I18n.marktr;
    4 // import static org.openstreetmap.josm.tools.I18n.tr;
    5 //
    6 // import java.awt.BorderLayout;
    7 // import java.awt.Container;
    8 // import java.awt.Dimension;
    9 // import java.awt.Frame;
    10 // import java.awt.GridBagConstraints;
    11 // import java.awt.GridBagLayout;
    12 // import java.awt.event.ActionEvent;
    13 // import java.util.Collection;
    14 // import java.util.Collections;
    15 // import java.util.Iterator;
    16 // import java.util.LinkedList;
    17 // import java.util.List;
    18 // import java.util.ListIterator;
    19 // import java.util.Map;
    20 // import java.util.TreeMap;
    21 // import java.util.TreeSet;
     3import static org.openstreetmap.josm.tools.I18n.tr;
     4
    225import java.util.Vector;
    23 //
    24 // import javax.swing.DefaultCellEditor;
    25 // import javax.swing.DefaultListModel;
    26 // import javax.swing.JButton;
    27 // import javax.swing.JCheckBox;
    28 // import javax.swing.JComboBox;
    29 // import javax.swing.JDialog;
    30 // import javax.swing.JLabel;
    31 // import javax.swing.JList;
    32 // import javax.swing.JOptionPane;
    33 // import javax.swing.JPanel;
    34 // import javax.swing.JScrollPane;
    35 // import javax.swing.JTabbedPane;
    36 // import javax.swing.JTable;
    37 // import javax.swing.JTextField;
    38 // import javax.swing.ListSelectionModel;
    39 // import javax.swing.event.ListSelectionEvent;
    40 // import javax.swing.event.ListSelectionListener;
     6
    417import javax.swing.event.TableModelEvent;
    428import javax.swing.event.TableModelListener;
    439import javax.swing.table.DefaultTableModel;
    44 // import javax.swing.table.TableCellEditor;
    45 //
    46 // import org.openstreetmap.josm.Main;
    47 // import org.openstreetmap.josm.actions.JosmAction;
    48 // import org.openstreetmap.josm.actions.mapmode.DeleteAction;
    49 // import org.openstreetmap.josm.data.osm.DataSet;
     10
    5011import org.openstreetmap.josm.data.osm.Node;
    51 // import org.openstreetmap.josm.data.osm.OsmPrimitive;
    52 // import org.openstreetmap.josm.data.osm.Relation;
    53 // import org.openstreetmap.josm.data.osm.RelationMember;
    5412import org.openstreetmap.josm.data.osm.Way;
    55 // import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
    56 // import org.openstreetmap.josm.gui.ExtendedDialog;
    57 // import org.openstreetmap.josm.tools.GBC;
    58 // import org.openstreetmap.josm.tools.Shortcut;
    59 // import org.openstreetmap.josm.tools.UrlLabel;
    6013
    6114public class ItineraryTableModel extends DefaultTableModel
     
    10457    String curName = way.get("name");
    10558    if (way.isIncomplete())
    106       buf[0] = "[incomplete]";
     59      buf[0] = tr("[incomplete]");
    10760    else if (way.getNodesCount() < 1)
    108       buf[0] = "[empty way]";
     61      buf[0] = tr("[empty way]");
    10962    else if (curName != null)
    11063      buf[0] = curName;
    11164    else
    112       buf[0] = "[ID] " + (new Long(way.getId())).toString();
     65      buf[0] = tr("[ID] {0}", (new Long(way.getId())).toString());
    11366    buf[1] = role;
    11467    if (insPos == -1)
     
    13992      if (ways.elementAt(i) == null)
    14093      {
    141     ++i;
    142     if (i >= getRowCount())
    143       break;
     94        ++i;
     95        if (i >= getRowCount())
     96          break;
    14497      }
    14598      while ((ways.elementAt(i) == null) &&
    146     ((i == 0) || (ways.elementAt(i-1) == null)))
     99      ((i == 0) || (ways.elementAt(i-1) == null)))
    147100      {
    148     ways.removeElementAt(i);
    149     removeRow(i);
    150     if (i >= getRowCount())
    151       break;
     101        ways.removeElementAt(i);
     102        removeRow(i);
     103        if (i >= getRowCount())
     104          break;
    152105      }
    153106      if (i >= getRowCount())
    154     break;
     107        break;
    155108
    156109      boolean gapRequired = gapNecessary
     
    158111      if ((i > 0) && (!gapRequired) && (ways.elementAt(i-1) == null))
    159112      {
    160     ways.removeElementAt(i-1);
    161     removeRow(i-1);
    162     --i;
     113        ways.removeElementAt(i-1);
     114        removeRow(i-1);
     115        --i;
    163116      }
    164117      else if ((i > 0) && gapRequired && (ways.elementAt(i-1) != null))
    165118      {
    166     String[] buf = { "", "" };
    167     buf[0] = "[gap]";
    168     insertRow(i, buf);
    169     ++i;
     119        String[] buf = { "", "" };
     120        buf[0] = tr("[gap]");
     121        insertRow(i, buf);
     122        ++i;
    170123      }
    171124      lastNode = getLastNode(ways.elementAt(i), (String)(getValueAt(i, 1)));
     
    185138    {
    186139      if (inEvent)
    187     return;
     140        return;
    188141      cleanupGaps();
    189142      RoutePatternAction.rebuildWays();
     
    198151    {
    199152      if ("backward".equals(role))
    200       return way.getNode(0);
     153        return way.getNode(0);
    201154      else
    202     return way.getNode(way.getNodesCount() - 1);
     155        return way.getNode(way.getNodesCount() - 1);
    203156    }
    204157  }
     
    210163      Node firstNode = null;
    211164      if ("backward".equals(role))
    212       firstNode = way.getNode(way.getNodesCount() - 1);
     165        firstNode = way.getNode(way.getNodesCount() - 1);
    213166      else
    214     firstNode = way.getNode(0);
     167        firstNode = way.getNode(0);
    215168      if ((lastNode != null) && (!lastNode.equals(firstNode)))
    216     return true;
     169        return true;
    217170    }
    218171    return false;
  • applications/editors/josm/plugins/public_transport/src/public_transport/PublicTransportPlugin.java

    r23192 r26168  
    22
    33import static org.openstreetmap.josm.tools.I18n.marktr;
    4 import static org.openstreetmap.josm.tools.I18n.tr;
    54
    65import java.awt.event.KeyEvent;
  • applications/editors/josm/plugins/public_transport/src/public_transport/RoutePatternAction.java

    r26147 r26168  
    8585      if (route.get("route") != null)
    8686      {
    87     if (rr.route.get("route") == null)
    88       return -1;
    89     int result = route.get("route").compareTo(rr.route.get("route"));
    90     if (result != 0)
     87        if (rr.route.get("route") == null)
     88          return -1;
     89        int result = route.get("route").compareTo(rr.route.get("route"));
     90        if (result != 0)
     91          return result;
     92      }
     93      else if (rr.route.get("route") != null)
     94        return 1;
     95      if (route.get("ref") != null)
     96      {
     97        if (rr.route.get("ref") == null)
     98          return -1;
     99        int result = route.get("ref").compareTo(rr.route.get("ref"));
     100        if (result != 0)
    91101      return result;
    92102      }
    93       else if (rr.route.get("route") != null)
    94     return 1;
    95       if (route.get("ref") != null)
    96       {
    97     if (rr.route.get("ref") == null)
    98       return -1;
    99     int result = route.get("ref").compareTo(rr.route.get("ref"));
    100     if (result != 0)
    101       return result;
    102       }
    103103      else if (rr.route.get("ref") != null)
    104     return 1;
     104        return 1;
    105105      if (route.get("to") != null)
    106106      {
    107     if (rr.route.get("to") == null)
    108       return -1;
    109     int result = route.get("to").compareTo(rr.route.get("to"));
    110     if (result != 0)
    111       return result;
     107        if (rr.route.get("to") == null)
     108          return -1;
     109        int result = route.get("to").compareTo(rr.route.get("to"));
     110        if (result != 0)
     111          return result;
    112112      }
    113113      else if (rr.route.get("to") != null)
    114     return 1;
     114        return 1;
    115115      if (route.get("direction") != null)
    116116      {
    117     if (rr.route.get("direction") == null)
    118       return -1;
    119     int result = route.get("direction").compareTo(rr.route.get("direction"));
    120     if (result != 0)
    121       return result;
     117        if (rr.route.get("direction") == null)
     118          return -1;
     119        int result = route.get("direction").compareTo(rr.route.get("direction"));
     120        if (result != 0)
     121          return result;
    122122      }
    123123      else if (rr.route.get("direction") != null)
    124     return 1;
     124        return 1;
    125125      if (route.getId() < rr.route.getId())
    126     return -1;
     126        return -1;
    127127      else if (route.getId() > rr.route.getId())
    128     return 1;
     128        return 1;
    129129      return 0;
    130130    }
     
    134134      if ((route.get("ref") != null) && (route.get("ref") != ""))
    135135      {
    136     if ((route.get("to") != null) && (route.get("to") != ""))
    137     {
    138       buf += " " + route.get("ref") + ": " + route.get("to");
    139     }
    140     else if ((route.get("direction") != null) && (route.get("direction") != ""))
    141     {
    142       buf += " " + route.get("ref") + ": " + route.get("direction");
    143     }
    144     else
    145     {
    146       buf += " " + route.get("ref");
    147     }
    148       }
    149       buf += " [ID " + Long.toString(route.getId()) + "]";
     136        if ((route.get("to") != null) && (route.get("to") != ""))
     137        {
     138          buf += " " + route.get("ref") + ": " + route.get("to");
     139        }
     140        else if ((route.get("direction") != null) && (route.get("direction") != ""))
     141        {
     142          buf += " " + route.get("ref") + ": " + route.get("direction");
     143        }
     144        else
     145        {
     146          buf += " " + route.get("ref");
     147        }
     148      }
     149      buf += tr(" [ID] {0}", Long.toString(route.getId()));
    150150
    151151      return buf;
     
    164164    public boolean isCellEditable(int row, int column) {
    165165      if ((column == 0) && (hasFixedKeys))
    166     return false;
     166        return false;
    167167      return true;
    168168    }
     
    173173      for (int i = 0; i < getRowCount(); ++i)
    174174      {
    175     String value = rel.get((String)getValueAt(i, 0));
    176     if (value == null)
    177       value = "";
    178     setValueAt(value, i, 1);
     175        String value = rel.get((String)getValueAt(i, 0));
     176        if (value == null)
     177          value = "";
     178        setValueAt(value, i, 1);
    179179      }
    180180    }
     
    188188      while (iter.hasNext())
    189189      {
    190     Map.Entry< String, String > entry = iter.next();
    191     if (!blacklist.contains(entry.getKey()))
    192     {
    193       Vector< String > newRow = new Vector< String >();
    194       newRow.add(entry.getKey());
    195       newRow.add(entry.getValue());
    196       addRow(newRow);
    197     }
     190        Map.Entry< String, String > entry = iter.next();
     191        if (!blacklist.contains(entry.getKey()))
     192        {
     193          Vector< String > newRow = new Vector< String >();
     194          newRow.add(entry.getKey());
     195          newRow.add(entry.getValue());
     196          addRow(newRow);
     197        }
    198198      }
    199199
    200200      for (int i = 0; i < getRowCount(); ++i)
    201201      {
    202     String value = rel.get((String)getValueAt(i, 0));
    203     if (value == null)
    204       value = "";
    205     setValueAt(value, i, 1);
     202        String value = rel.get((String)getValueAt(i, 0));
     203        if (value == null)
     204          value = "";
     205        setValueAt(value, i, 1);
    206206      }
    207207    }
     
    211211      if (e.getType() == TableModelEvent.UPDATE)
    212212      {
    213     relation.setModified(true);
    214 
    215     String key = (String)getValueAt(e.getFirstRow(), 0);
    216     if (key == null)
    217       return;
    218     if ((blacklist == null) || (!blacklist.contains(key)))
    219     {
    220       relation.setModified(true);
    221       if ("".equals(getValueAt(e.getFirstRow(), 1)))
    222         relation.remove(key);
    223       else
    224         relation.put(key, (String)getValueAt(e.getFirstRow(), 1));
    225     }
    226     else
    227     {
    228       if (e.getColumn() == 0)
    229         setValueAt("", e.getFirstRow(), 0);
    230     }
     213        relation.setModified(true);
     214
     215        String key = (String)getValueAt(e.getFirstRow(), 0);
     216        if (key == null)
     217          return;
     218        if ((blacklist == null) || (!blacklist.contains(key)))
     219        {
     220          relation.setModified(true);
     221          if ("".equals(getValueAt(e.getFirstRow(), 1)))
     222            relation.remove(key);
     223          else
     224            relation.put(key, (String)getValueAt(e.getFirstRow(), 1));
     225        }
     226        else
     227        {
     228          if (e.getColumn() == 0)
     229            setValueAt("", e.getFirstRow(), 0);
     230        }
    231231      }
    232232    }
     
    245245      TableCellEditor editor = null;
    246246      if (column == 0)
    247     editor = col1.get(new Integer(row));
     247        editor = col1.get(new Integer(row));
    248248      else
    249     editor = col2.get(new Integer(row));
     249        editor = col2.get(new Integer(row));
    250250      if (editor == null)
    251     return new DefaultCellEditor(new JTextField());
     251        return new DefaultCellEditor(new JTextField());
    252252      else
    253     return editor;
     253        return editor;
    254254    }
    255255
    256256    public void setCellEditor(int row, int column, TableCellEditor editor) {
    257257      if (column == 0)
    258     col1.put(new Integer(row), editor);
     258        col1.put(new Integer(row), editor);
    259259      else
    260     col2.put(new Integer(row), editor);
     260        col2.put(new Integer(row), editor);
    261261    }
    262262  };
     
    293293      else
    294294      {
    295         buf[0] = "[ID] " + (new Long(node.getId())).toString();
     295        buf[0] = tr("[ID] {0}", (new Long(node.getId())).toString());
    296296      }
    297297      String curRef = node.get("ref");
     
    325325      if (e.getType() == TableModelEvent.UPDATE)
    326326      {
    327     rebuildNodes();
     327        rebuildNodes();
    328328      }
    329329    }
     
    427427    if (jDialog == null)
    428428    {
    429       jDialog = new JDialog(frame, "Route Patterns", false);
     429      jDialog = new JDialog(frame, tr("Route Patterns"), false);
    430430      tabbedPane = new JTabbedPane();
    431431      JPanel tabOverview = new JPanel();
    432       tabbedPane.addTab(marktr("Overview"), tabOverview);
     432      tabbedPane.addTab(tr("Overview"), tabOverview);
    433433      JPanel tabTags = new JPanel();
    434       tabbedPane.addTab(marktr("Tags"), tabTags);
     434      tabbedPane.addTab(tr("Tags"), tabTags);
    435435      JPanel tabItinerary = new JPanel();
    436       tabbedPane.addTab(marktr("Itinerary"), tabItinerary);
     436      tabbedPane.addTab(tr("Itinerary"), tabItinerary);
    437437      JPanel tabStoplist = new JPanel();
    438       tabbedPane.addTab(marktr("Stops"), tabStoplist);
     438      tabbedPane.addTab(tr("Stops"), tabStoplist);
    439439      JPanel tabMeta = new JPanel();
    440       tabbedPane.addTab(marktr("Meta"), tabMeta);
     440      tabbedPane.addTab(tr("Meta"), tabMeta);
    441441      tabbedPane.setEnabledAt(0, true);
    442442      tabbedPane.setEnabledAt(1, false);
     
    452452      contentPane.setLayout(gridbag);
    453453
    454       JLabel headline = new JLabel("Existing route patterns:");
     454      JLabel headline = new JLabel(tr("Existing route patterns:"));
    455455
    456456      layoutCons.gridx = 0;
     
    480480      contentPane.add(rpListSP);
    481481
    482       JButton bRefresh = new JButton("Refresh");
     482      JButton bRefresh = new JButton(tr("Refresh"));
    483483      bRefresh.setActionCommand("routePattern.refresh");
    484484      bRefresh.addActionListener(this);
     
    494494      contentPane.add(bRefresh);
    495495
    496       JButton bNew = new JButton("New");
     496      JButton bNew = new JButton(tr("New"));
    497497      bNew.setActionCommand("routePattern.overviewNew");
    498498      bNew.addActionListener(this);
     
    508508      contentPane.add(bNew);
    509509
    510       JButton bDelete = new JButton("Delete");
     510      JButton bDelete = new JButton(tr("Delete"));
    511511      bDelete.setActionCommand("routePattern.overviewDelete");
    512512      bDelete.addActionListener(this);
     
    522522      contentPane.add(bDelete);
    523523
    524       JButton bDuplicate = new JButton("Duplicate");
     524      JButton bDuplicate = new JButton(tr("Duplicate"));
    525525      bDuplicate.setActionCommand("routePattern.overviewDuplicate");
    526526      bDuplicate.addActionListener(this);
     
    536536      contentPane.add(bDuplicate);
    537537
    538       JButton bReflect = new JButton("Reflect");
     538      JButton bReflect = new JButton(tr("Reflect"));
    539539      bReflect.setActionCommand("routePattern.overviewReflect");
    540540      bReflect.addActionListener(this);
     
    556556      contentPane.setLayout(gridbag);
    557557
    558       /*JLabel*/ headline = new JLabel("Required tags:");
     558      /*JLabel*/ headline = new JLabel(tr("Required tags:"));
    559559
    560560      layoutCons.gridx = 0;
     
    568568      requiredTagsTable = new CustomCellEditorTable();
    569569      requiredTagsData = new TagTableModel(true);
    570       requiredTagsData.addColumn("Key");
    571       requiredTagsData.addColumn("Value");
     570      requiredTagsData.addColumn(tr("Key"));
     571      requiredTagsData.addColumn(tr("Value"));
    572572      tagBlacklist = new TreeSet< String >();
    573573      Vector< String > rowContent = new Vector< String >();
     574      /* TODO: keys and values should also be translated using TransText class */
    574575      rowContent.add("type");
    575576      tagBlacklist.add("type");
     
    622623      contentPane.add(tableSP);
    623624
    624       headline = new JLabel("Common tags:");
     625      headline = new JLabel(tr("Common tags:"));
    625626
    626627      layoutCons.gridx = 0;
     
    634635      commonTagsTable = new CustomCellEditorTable();
    635636      commonTagsData = new TagTableModel(true);
    636       commonTagsData.addColumn("Key");
    637       commonTagsData.addColumn("Value");
     637      commonTagsData.addColumn(tr("Key"));
     638      commonTagsData.addColumn(tr("Value"));
    638639      rowContent = new Vector< String >();
    639640      rowContent.add(0, "direction");
     
    676677      contentPane.add(tableSP);
    677678
    678       headline = new JLabel("Additional tags:");
     679      headline = new JLabel(tr("Additional tags:"));
    679680
    680681      layoutCons.gridx = 0;
     
    688689      otherTagsTable = new CustomCellEditorTable();
    689690      otherTagsData = new TagTableModel(false);
    690       otherTagsData.addColumn("Key");
    691       otherTagsData.addColumn("Value");
     691      otherTagsData.addColumn(tr("Key"));
     692      otherTagsData.addColumn(tr("Value"));
    692693      otherTagsTable.setModel(otherTagsData);
    693694      /*JScrollPane*/ tableSP = new JScrollPane(otherTagsTable);
     
    705706      contentPane.add(tableSP);
    706707
    707       JButton bAddTag = new JButton("Add a new Tag");
     708      JButton bAddTag = new JButton(tr("Add a new Tag"));
    708709      bAddTag.setActionCommand("routePattern.tagAddTag");
    709710      bAddTag.addActionListener(this);
     
    726727      itineraryTable = new JTable();
    727728      itineraryData = new ItineraryTableModel();
    728       itineraryData.addColumn("Name/Id");
    729       itineraryData.addColumn("Role");
     729      itineraryData.addColumn(tr("Name/Id"));
     730      itineraryData.addColumn(tr("Role"));
    730731      itineraryTable.setModel(itineraryData);
    731732      /*JScrollPane*/ tableSP = new JScrollPane(itineraryTable);
     
    747748      contentPane.add(tableSP);
    748749
    749       JButton bFind = new JButton("Find");
     750      JButton bFind = new JButton(tr("Find"));
    750751      bFind.setActionCommand("routePattern.itineraryFind");
    751752      bFind.addActionListener(this);
     
    760761      contentPane.add(bFind);
    761762
    762       JButton bShow = new JButton("Show");
     763      JButton bShow = new JButton(tr("Show"));
    763764      bShow.setActionCommand("routePattern.itineraryShow");
    764765      bShow.addActionListener(this);
     
    773774      contentPane.add(bShow);
    774775
    775       JButton bMark = new JButton("Mark");
     776      JButton bMark = new JButton(tr("Mark"));
    776777      bMark.setActionCommand("routePattern.itineraryMark");
    777778      bMark.addActionListener(this);
     
    787788      contentPane.add(bMark);
    788789
    789       JButton bAdd = new JButton("Add");
     790      JButton bAdd = new JButton(tr("Add"));
    790791      bAdd.setActionCommand("routePattern.itineraryAdd");
    791792      bAdd.addActionListener(this);
     
    801802      contentPane.add(bAdd);
    802803
    803       /*JButton*/ bDelete = new JButton("Delete");
     804      /*JButton*/ bDelete = new JButton(tr("Delete"));
    804805      bDelete.setActionCommand("routePattern.itineraryDelete");
    805806      bDelete.addActionListener(this);
     
    814815      contentPane.add(bDelete);
    815816
    816       JButton bSort = new JButton("Sort");
     817      JButton bSort = new JButton(tr("Sort"));
    817818      bSort.setActionCommand("routePattern.itinerarySort");
    818819      bSort.addActionListener(this);
     
    827828      contentPane.add(bSort);
    828829
    829       /*JButton*/ bReflect = new JButton("Reflect");
     830      /*JButton*/ bReflect = new JButton(tr("Reflect"));
    830831      bReflect.setActionCommand("routePattern.itineraryReflect");
    831832      bReflect.addActionListener(this);
     
    848849      stoplistTable = new JTable();
    849850      stoplistData = new StoplistTableModel();
    850       stoplistData.addColumn("Name/Id");
    851       stoplistData.addColumn("Ref");
    852       stoplistData.addColumn("Role");
     851      stoplistData.addColumn(tr("Name/Id"));
     852      stoplistData.addColumn(tr("Ref"));
     853      stoplistData.addColumn(tr("Role"));
    853854      stoplistTable.setModel(stoplistData);
    854855      /*JScrollPane*/ tableSP = new JScrollPane(stoplistTable);
     
    870871      contentPane.add(tableSP);
    871872
    872       /*JButton*/ bFind = new JButton("Find");
     873      /*JButton*/ bFind = new JButton(tr("Find"));
    873874      bFind.setActionCommand("routePattern.stoplistFind");
    874875      bFind.addActionListener(this);
     
    883884      contentPane.add(bFind);
    884885
    885       /*JButton*/ bShow = new JButton("Show");
     886      /*JButton*/ bShow = new JButton(tr("Show"));
    886887      bShow.setActionCommand("routePattern.stoplistShow");
    887888      bShow.addActionListener(this);
     
    896897      contentPane.add(bShow);
    897898
    898       /*JButton*/ bMark = new JButton("Mark");
     899      /*JButton*/ bMark = new JButton(tr("Mark"));
    899900      bMark.setActionCommand("routePattern.stoplistMark");
    900901      bMark.addActionListener(this);
     
    910911      contentPane.add(bMark);
    911912
    912       /*JButton*/ bAdd = new JButton("Add");
     913      /*JButton*/ bAdd = new JButton(tr("Add"));
    913914      bAdd.setActionCommand("routePattern.stoplistAdd");
    914915      bAdd.addActionListener(this);
     
    924925      contentPane.add(bAdd);
    925926
    926       /*JButton*/ bDelete = new JButton("Delete");
     927      /*JButton*/ bDelete = new JButton(tr("Delete"));
    927928      bDelete.setActionCommand("routePattern.stoplistDelete");
    928929      bDelete.addActionListener(this);
     
    937938      contentPane.add(bDelete);
    938939
    939       /*JButton*/ bSort = new JButton("Sort");
     940      /*JButton*/ bSort = new JButton(tr("Sort"));
    940941      bSort.setActionCommand("routePattern.stoplistSort");
    941942      bSort.addActionListener(this);
     
    950951      contentPane.add(bSort);
    951952
    952       /*JButton*/ bReflect = new JButton("Reflect");
     953      /*JButton*/ bReflect = new JButton(tr("Reflect"));
    953954      bReflect.setActionCommand("routePattern.stoplistReflect");
    954955      bReflect.addActionListener(this);
     
    969970      contentPane.setLayout(gridbag);
    970971
    971       JLabel rightleft = new JLabel("Stops are possible on the");
     972      JLabel rightleft = new JLabel(tr("Stops are possible on the"));
    972973
    973974      layoutCons.gridx = 0;
     
    980981      contentPane.add(rightleft);
    981982
    982       cbRight = new JCheckBox("right hand side", true);
     983      cbRight = new JCheckBox(tr("right hand side"), true);
    983984
    984985      layoutCons.gridx = 0;
     
    991992      contentPane.add(cbRight);
    992993
    993       cbLeft = new JCheckBox("left hand side", false);
     994      cbLeft = new JCheckBox(tr("left hand side"), false);
    994995
    995996      layoutCons.gridx = 0;
     
    10021003      contentPane.add(cbLeft);
    10031004
    1004       JLabel maxdist = new JLabel("Maximum distance from route");
     1005      JLabel maxdist = new JLabel(tr("Maximum distance from route"));
    10051006
    10061007      layoutCons.gridx = 0;
     
    10241025      contentPane.add(tfSuggestStopsLimit);
    10251026
    1026       JLabel meters = new JLabel("meters");
     1027      JLabel meters = new JLabel(tr("meters"));
    10271028
    10281029      layoutCons.gridx = 1;
     
    10351036      contentPane.add(meters);
    10361037
    1037       JButton bSuggestStops = new JButton("Suggest Stops");
     1038      JButton bSuggestStops = new JButton(tr("Suggest Stops"));
    10381039      bSuggestStops.setActionCommand("routePattern.metaSuggestStops");
    10391040      bSuggestStops.addActionListener(this);
     
    10991100      for (int i = 0; i < currentRoute.getMembersCount(); ++i)
    11001101      {
    1101     RelationMember item = currentRoute.getMember(i);
    1102 
    1103     if (item.isWay())
    1104     {
    1105       String role = item.getRole();
    1106       if ("backward".equals(role))
    1107         role = "forward";
    1108       else if ("forward".equals(role))
    1109         role = "backward";
    1110       else
    1111         role = "backward";
    1112 
    1113       itemsToReflect.add(new RelationMember(role, item.getWay()));
    1114     }
    1115     else if (item.isNode())
    1116       itemsToReflect.add(item);
    1117     else
    1118       otherItems.add(item);
     1102        RelationMember item = currentRoute.getMember(i);
     1103
     1104        if (item.isWay())
     1105        {
     1106          String role = item.getRole();
     1107          if ("backward".equals(role))
     1108            role = "forward";
     1109          else if ("forward".equals(role))
     1110            role = "backward";
     1111          else
     1112            role = "backward";
     1113
     1114          itemsToReflect.add(new RelationMember(role, item.getWay()));
     1115        }
     1116        else if (item.isNode())
     1117          itemsToReflect.add(item);
     1118        else
     1119          otherItems.add(item);
    11191120      }
    11201121
    11211122      currentRoute.setMembers(null);
    11221123      for (int i = itemsToReflect.size()-1; i >= 0; --i)
    1123     currentRoute.addMember(itemsToReflect.elementAt(i));
     1124        currentRoute.addMember(itemsToReflect.elementAt(i));
    11241125      for (int i = 0; i < otherItems.size(); ++i)
    1125     currentRoute.addMember(otherItems.elementAt(i));
     1126        currentRoute.addMember(otherItems.elementAt(i));
    11261127
    11271128      refreshData();
     
    11291130      for (int i = 0; i < relsListModel.size(); ++i)
    11301131      {
    1131     if (currentRoute == ((RouteReference)relsListModel.elementAt(i)).route)
    1132       relsList.setSelectedIndex(i);
     1132        if (currentRoute == ((RouteReference)relsListModel.elementAt(i)).route)
     1133          relsList.setSelectedIndex(i);
    11331134      }
    11341135    }
     
    11551156    {
    11561157      if (mainDataSet == null)
    1157     return;
     1158        return;
    11581159
    11591160      itineraryTable.clearSelection();
     
    11611162      for (int i = 0; i < itineraryData.getRowCount(); ++i)
    11621163      {
    1163     if ((itineraryData.ways.elementAt(i) != null) &&
    1164         (mainDataSet.isSelected(itineraryData.ways.elementAt(i))))
    1165         itineraryTable.addRowSelectionInterval(i, i);
     1164        if ((itineraryData.ways.elementAt(i) != null) &&
     1165            (mainDataSet.isSelected(itineraryData.ways.elementAt(i))))
     1166            itineraryTable.addRowSelectionInterval(i, i);
    11661167      }
    11671168    }
     
    11711172      if (itineraryTable.getSelectedRowCount() > 0)
    11721173      {
    1173     for (int i = 0; i < itineraryData.getRowCount(); ++i)
    1174     {
    1175       if ((itineraryTable.isRowSelected(i)) && (itineraryData.ways.elementAt(i) != null))
    1176       {
    1177         itineraryData.ways.elementAt(i).visit(box);
    1178       }
    1179     }
     1174        for (int i = 0; i < itineraryData.getRowCount(); ++i)
     1175        {
     1176          if ((itineraryTable.isRowSelected(i)) && (itineraryData.ways.elementAt(i) != null))
     1177          {
     1178            itineraryData.ways.elementAt(i).visit(box);
     1179          }
     1180        }
    11801181      }
    11811182      else
    11821183      {
    1183     for (int i = 0; i < itineraryData.getRowCount(); ++i)
    1184     {
    1185       if (itineraryData.ways.elementAt(i) != null)
    1186       {
    1187         itineraryData.ways.elementAt(i).visit(box);
    1188       }
    1189     }
     1184        for (int i = 0; i < itineraryData.getRowCount(); ++i)
     1185        {
     1186          if (itineraryData.ways.elementAt(i) != null)
     1187          {
     1188            itineraryData.ways.elementAt(i).visit(box);
     1189          }
     1190        }
    11901191      }
    11911192      if (box.getBounds() == null)
    1192     return;
     1193        return;
    11931194      box.enlargeBoundingBox();
    11941195      Main.map.mapView.recalculateCenterScale(box);
     
    12011202      if (itineraryTable.getSelectedRowCount() > 0)
    12021203      {
    1203     for (int i = 0; i < itineraryData.getRowCount(); ++i)
    1204     {
    1205       if ((itineraryTable.isRowSelected(i)) && (itineraryData.ways.elementAt(i) != null))
    1206       {
    1207         mainDataSet.addSelected(itineraryData.ways.elementAt(i));
    1208 
    1209         RelationMember markedWay = new RelationMember
    1210         ((String)(itineraryData.getValueAt(i, 1)), itineraryData.ways.elementAt(i));
    1211         markedWays.addElement(markedWay);
    1212       }
    1213     }
     1204        for (int i = 0; i < itineraryData.getRowCount(); ++i)
     1205        {
     1206          if ((itineraryTable.isRowSelected(i)) && (itineraryData.ways.elementAt(i) != null))
     1207          {
     1208            mainDataSet.addSelected(itineraryData.ways.elementAt(i));
     1209
     1210            RelationMember markedWay = new RelationMember
     1211            ((String)(itineraryData.getValueAt(i, 1)), itineraryData.ways.elementAt(i));
     1212            markedWays.addElement(markedWay);
     1213          }
     1214        }
    12141215      }
    12151216      else
    12161217      {
    1217     for (int i = 0; i < itineraryData.getRowCount(); ++i)
    1218     {
    1219       if (itineraryData.ways.elementAt(i) != null)
    1220       {
    1221         mainDataSet.addSelected(itineraryData.ways.elementAt(i));
    1222 
    1223         RelationMember markedWay = new RelationMember
    1224         ((String)(itineraryData.getValueAt(i, 1)), itineraryData.ways.elementAt(i));
    1225         markedWays.addElement(markedWay);
    1226       }
    1227     }
     1218        for (int i = 0; i < itineraryData.getRowCount(); ++i)
     1219        {
     1220          if (itineraryData.ways.elementAt(i) != null)
     1221          {
     1222            mainDataSet.addSelected(itineraryData.ways.elementAt(i));
     1223
     1224            RelationMember markedWay = new RelationMember
     1225            ((String)(itineraryData.getValueAt(i, 1)), itineraryData.ways.elementAt(i));
     1226            markedWays.addElement(markedWay);
     1227          }
     1228        }
    12281229      }
    12291230    }
     
    12341235      TreeSet<Way> addedWays = new TreeSet<Way>();
    12351236      if (mainDataSet == null)
    1236     return;
     1237        return;
    12371238
    12381239      while (relIter.hasNext())
    12391240      {
    1240     RelationMember curMember = relIter.next();
    1241     if ((curMember.isWay()) && (mainDataSet.isSelected(curMember.getWay())))
    1242     {
    1243       itineraryData.insertRow(insPos, curMember.getWay(), curMember.getRole());
    1244       if (insPos >= 0)
    1245         ++insPos;
    1246 
    1247       addedWays.add(curMember.getWay());
    1248     }
     1241        RelationMember curMember = relIter.next();
     1242        if ((curMember.isWay()) && (mainDataSet.isSelected(curMember.getWay())))
     1243        {
     1244          itineraryData.insertRow(insPos, curMember.getWay(), curMember.getRole());
     1245          if (insPos >= 0)
     1246            ++insPos;
     1247
     1248          addedWays.add(curMember.getWay());
     1249        }
    12491250      }
    12501251
     
    12541255      while (wayIter.hasNext())
    12551256      {
    1256     Way curMember = wayIter.next();
    1257     if (!(addedWays.contains(curMember)))
    1258     {
    1259       itineraryData.insertRow(insPos, curMember, "");
    1260       if (insPos >= 0)
    1261         ++insPos;
    1262     }
     1257        Way curMember = wayIter.next();
     1258        if (!(addedWays.contains(curMember)))
     1259        {
     1260          itineraryData.insertRow(insPos, curMember, "");
     1261          if (insPos >= 0)
     1262            ++insPos;
     1263        }
    12631264      }
    12641265
    12651266      if ((insPos > 0) && (insPos < itineraryData.getRowCount()))
    12661267      {
    1267     while ((insPos < itineraryData.getRowCount())
    1268                && (itineraryData.ways.elementAt(insPos) == null))
    1269       ++insPos;
    1270     itineraryTable.removeRowSelectionInterval(0, itineraryData.getRowCount()-1);
    1271     if (insPos < itineraryData.getRowCount())
    1272       itineraryTable.addRowSelectionInterval(insPos, insPos);
     1268        while ((insPos < itineraryData.getRowCount())
     1269                  && (itineraryData.ways.elementAt(insPos) == null))
     1270          ++insPos;
     1271        itineraryTable.removeRowSelectionInterval(0, itineraryData.getRowCount()-1);
     1272        if (insPos < itineraryData.getRowCount())
     1273          itineraryTable.addRowSelectionInterval(insPos, insPos);
    12731274      }
    12741275
     
    12801281      for (int i = itineraryData.getRowCount()-1; i >=0; --i)
    12811282      {
    1282     if ((itineraryTable.isRowSelected(i)) && (itineraryData.ways.elementAt(i) != null))
    1283     {
    1284       itineraryData.ways.removeElementAt(i);
    1285       itineraryData.removeRow(i);
    1286     }
     1283        if ((itineraryTable.isRowSelected(i)) && (itineraryData.ways.elementAt(i) != null))
     1284        {
     1285          itineraryData.ways.removeElementAt(i);
     1286          itineraryData.removeRow(i);
     1287        }
    12871288      }
    12881289
     
    13031304      if (itineraryTable.getSelectedRowCount() > 0)
    13041305      {
    1305     for (int i = itineraryData.getRowCount()-1; i >=0; --i)
    1306     {
    1307       if ((itineraryTable.isRowSelected(i)) && (itineraryData.ways.elementAt(i) != null))
    1308       {
    1309         if (!(usedWays.contains(itineraryData.ways.elementAt(i))))
    1310         {
    1311           addWayToSortingData
    1312           (itineraryData.ways.elementAt(i), frontNodes, backNodes, loops);
    1313           usedWays.add(itineraryData.ways.elementAt(i));
    1314         }
    1315 
    1316         itineraryData.ways.removeElementAt(i);
    1317         itineraryData.removeRow(i);
    1318       }
    1319     }
     1306        for (int i = itineraryData.getRowCount()-1; i >=0; --i)
     1307        {
     1308          if ((itineraryTable.isRowSelected(i)) && (itineraryData.ways.elementAt(i) != null))
     1309          {
     1310            if (!(usedWays.contains(itineraryData.ways.elementAt(i))))
     1311            {
     1312              addWayToSortingData
     1313              (itineraryData.ways.elementAt(i), frontNodes, backNodes, loops);
     1314              usedWays.add(itineraryData.ways.elementAt(i));
     1315            }
     1316
     1317            itineraryData.ways.removeElementAt(i);
     1318            itineraryData.removeRow(i);
     1319          }
     1320        }
    13201321      }
    13211322      else
    13221323      {
    1323     for (int i = itineraryData.getRowCount()-1; i >=0; --i)
    1324     {
    1325       if (itineraryData.ways.elementAt(i) != null)
    1326       {
    1327         if (!(usedWays.contains(itineraryData.ways.elementAt(i))))
    1328         {
    1329           addWayToSortingData
    1330           (itineraryData.ways.elementAt(i), frontNodes, backNodes, loops);
    1331           usedWays.add(itineraryData.ways.elementAt(i));
    1332         }
    1333       }
    1334     }
    1335 
    1336     itineraryData.clear();
     1324        for (int i = itineraryData.getRowCount()-1; i >=0; --i)
     1325        {
     1326          if (itineraryData.ways.elementAt(i) != null)
     1327          {
     1328            if (!(usedWays.contains(itineraryData.ways.elementAt(i))))
     1329            {
     1330              addWayToSortingData
     1331              (itineraryData.ways.elementAt(i), frontNodes, backNodes, loops);
     1332              usedWays.add(itineraryData.ways.elementAt(i));
     1333            }
     1334          }
     1335        }
     1336
     1337        itineraryData.clear();
    13371338      }
    13381339
     
    13411342      while (entryIter.hasNext())
    13421343      {
    1343     Iterator<RelationMember> relIter = entryIter.next().getValue().iterator();
    1344     while (relIter.hasNext())
    1345     {
    1346       RelationMember curMember = relIter.next();
    1347       itineraryData.insertRow(insPos, curMember.getWay(), curMember.getRole());
    1348       if (insPos >= 0)
    1349         ++insPos;
    1350     }
     1344        Iterator<RelationMember> relIter = entryIter.next().getValue().iterator();
     1345        while (relIter.hasNext())
     1346        {
     1347          RelationMember curMember = relIter.next();
     1348          itineraryData.insertRow(insPos, curMember.getWay(), curMember.getRole());
     1349          if (insPos >= 0)
     1350            ++insPos;
     1351        }
    13511352      }
    13521353
     
    13541355      while (listIter.hasNext())
    13551356      {
    1356     Iterator<RelationMember> relIter = listIter.next().iterator();
    1357     while (relIter.hasNext())
    1358     {
    1359       RelationMember curMember = relIter.next();
    1360       itineraryData.insertRow(insPos, curMember.getWay(), curMember.getRole());
    1361       if (insPos >= 0)
    1362         ++insPos;
    1363     }
     1357        Iterator<RelationMember> relIter = listIter.next().iterator();
     1358        while (relIter.hasNext())
     1359        {
     1360          RelationMember curMember = relIter.next();
     1361          itineraryData.insertRow(insPos, curMember.getWay(), curMember.getRole());
     1362          if (insPos >= 0)
     1363            ++insPos;
     1364        }
    13641365      }
    13651366
     
    13741375      if (itineraryTable.getSelectedRowCount() > 0)
    13751376      {
    1376     for (int i = itineraryData.getRowCount()-1; i >=0; --i)
    1377     {
    1378       if ((itineraryTable.isRowSelected(i)) && (itineraryData.ways.elementAt(i) != null))
    1379       {
    1380         String role = (String)(itineraryData.getValueAt(i, 1));
    1381         if ("backward".equals(role))
    1382           role = "forward";
    1383         else if ("forward".equals(role))
    1384           role = "backward";
    1385         else
    1386           role = "backward";
    1387         RelationMember markedWay = new RelationMember
    1388         (role, itineraryData.ways.elementAt(i));
    1389         itemsToReflect.addElement(markedWay);
    1390 
    1391         itineraryData.ways.removeElementAt(i);
    1392         itineraryData.removeRow(i);
    1393       }
    1394     }
     1377        for (int i = itineraryData.getRowCount()-1; i >=0; --i)
     1378        {
     1379          if ((itineraryTable.isRowSelected(i)) && (itineraryData.ways.elementAt(i) != null))
     1380          {
     1381            String role = (String)(itineraryData.getValueAt(i, 1));
     1382            if ("backward".equals(role))
     1383              role = "forward";
     1384            else if ("forward".equals(role))
     1385              role = "backward";
     1386            else
     1387              role = "backward";
     1388            RelationMember markedWay = new RelationMember
     1389            (role, itineraryData.ways.elementAt(i));
     1390            itemsToReflect.addElement(markedWay);
     1391
     1392            itineraryData.ways.removeElementAt(i);
     1393            itineraryData.removeRow(i);
     1394          }
     1395        }
    13951396      }
    13961397      else
    13971398      {
    1398     for (int i = itineraryData.getRowCount()-1; i >=0; --i)
    1399     {
    1400       if (itineraryData.ways.elementAt(i) != null)
    1401       {
    1402         String role = (String)(itineraryData.getValueAt(i, 1));
    1403         if ("backward".equals(role))
    1404           role = "forward";
    1405         else if ("forward".equals(role))
    1406           role = "backward";
    1407         else
    1408           role = "backward";
    1409         RelationMember markedWay = new RelationMember
    1410         (role, itineraryData.ways.elementAt(i));
    1411         itemsToReflect.addElement(markedWay);
    1412       }
    1413     }
    1414 
    1415     itineraryData.clear();
     1399        for (int i = itineraryData.getRowCount()-1; i >=0; --i)
     1400        {
     1401          if (itineraryData.ways.elementAt(i) != null)
     1402          {
     1403            String role = (String)(itineraryData.getValueAt(i, 1));
     1404            if ("backward".equals(role))
     1405              role = "forward";
     1406            else if ("forward".equals(role))
     1407              role = "backward";
     1408            else
     1409              role = "backward";
     1410            RelationMember markedWay = new RelationMember
     1411            (role, itineraryData.ways.elementAt(i));
     1412            itemsToReflect.addElement(markedWay);
     1413          }
     1414        }
     1415
     1416        itineraryData.clear();
    14161417      }
    14171418
     
    14201421      while (relIter.hasNext())
    14211422      {
    1422     RelationMember curMember = relIter.next();
    1423     if (curMember.isWay())
    1424     {
    1425       itineraryData.insertRow(insPos, curMember.getWay(), curMember.getRole());
     1423        RelationMember curMember = relIter.next();
     1424        if (curMember.isWay())
     1425        {
     1426          itineraryData.insertRow(insPos, curMember.getWay(), curMember.getRole());
     1427          if (insPos >= 0)
     1428            ++insPos;
     1429        }
     1430      }
    14261431      if (insPos >= 0)
    1427         ++insPos;
    1428     }
    1429       }
    1430       if (insPos >= 0)
    1431     itineraryTable.addRowSelectionInterval(startPos, insPos-1);
     1432        itineraryTable.addRowSelectionInterval(startPos, insPos-1);
    14321433
    14331434      itineraryData.cleanupGaps();
     
    14371438    {
    14381439      if (mainDataSet == null)
    1439     return;
     1440        return;
    14401441
    14411442      stoplistTable.clearSelection();
     
    14431444      for (int i = 0; i < stoplistData.getRowCount(); ++i)
    14441445      {
    1445     if ((stoplistData.nodes.elementAt(i) != null) &&
    1446           (mainDataSet.isSelected(stoplistData.nodes.elementAt(i))))
    1447       stoplistTable.addRowSelectionInterval(i, i);
     1446        if ((stoplistData.nodes.elementAt(i) != null) &&
     1447              (mainDataSet.isSelected(stoplistData.nodes.elementAt(i))))
     1448          stoplistTable.addRowSelectionInterval(i, i);
    14481449      }
    14491450    }
     
    14531454      if (stoplistTable.getSelectedRowCount() > 0)
    14541455      {
    1455     for (int i = 0; i < stoplistData.getRowCount(); ++i)
    1456     {
    1457       if (stoplistTable.isRowSelected(i))
    1458       {
    1459         stoplistData.nodes.elementAt(i).visit(box);
    1460       }
    1461     }
     1456        for (int i = 0; i < stoplistData.getRowCount(); ++i)
     1457        {
     1458          if (stoplistTable.isRowSelected(i))
     1459          {
     1460            stoplistData.nodes.elementAt(i).visit(box);
     1461          }
     1462        }
    14621463      }
    14631464      else
    14641465      {
    1465     for (int i = 0; i < stoplistData.getRowCount(); ++i)
    1466     {
    1467       stoplistData.nodes.elementAt(i).visit(box);
    1468     }
     1466        for (int i = 0; i < stoplistData.getRowCount(); ++i)
     1467        {
     1468          stoplistData.nodes.elementAt(i).visit(box);
     1469        }
    14691470      }
    14701471      if (box.getBounds() == null)
    1471     return;
     1472        return;
    14721473      box.enlargeBoundingBox();
    14731474      Main.map.mapView.recalculateCenterScale(box);
     
    14801481      if (stoplistTable.getSelectedRowCount() > 0)
    14811482      {
    1482     for (int i = 0; i < stoplistData.getRowCount(); ++i)
    1483     {
    1484       if (stoplistTable.isRowSelected(i))
    1485       {
    1486         mainDataSet.addSelected(stoplistData.nodes.elementAt(i));
    1487 
    1488         RelationMember markedNode = new RelationMember
    1489         ((String)(stoplistData.getValueAt(i, 1)), stoplistData.nodes.elementAt(i));
    1490         markedNodes.addElement(markedNode);
    1491       }
    1492     }
     1483        for (int i = 0; i < stoplistData.getRowCount(); ++i)
     1484        {
     1485          if (stoplistTable.isRowSelected(i))
     1486          {
     1487            mainDataSet.addSelected(stoplistData.nodes.elementAt(i));
     1488
     1489            RelationMember markedNode = new RelationMember
     1490            ((String)(stoplistData.getValueAt(i, 1)), stoplistData.nodes.elementAt(i));
     1491            markedNodes.addElement(markedNode);
     1492          }
     1493        }
    14931494      }
    14941495      else
    14951496      {
    1496     for (int i = 0; i < stoplistData.getRowCount(); ++i)
    1497     {
    1498       mainDataSet.addSelected(stoplistData.nodes.elementAt(i));
    1499 
    1500       RelationMember markedNode = new RelationMember
    1501           ((String)(stoplistData.getValueAt(i, 1)), stoplistData.nodes.elementAt(i));
    1502       markedNodes.addElement(markedNode);
    1503     }
     1497        for (int i = 0; i < stoplistData.getRowCount(); ++i)
     1498        {
     1499          mainDataSet.addSelected(stoplistData.nodes.elementAt(i));
     1500
     1501          RelationMember markedNode = new RelationMember
     1502              ((String)(stoplistData.getValueAt(i, 1)), stoplistData.nodes.elementAt(i));
     1503          markedNodes.addElement(markedNode);
     1504        }
    15041505      }
    15051506    }
     
    15101511      TreeSet<Node> addedNodes = new TreeSet<Node>();
    15111512      if (mainDataSet == null)
    1512     return;
     1513        return;
    15131514
    15141515      while (relIter.hasNext())
    15151516      {
    1516     RelationMember curMember = relIter.next();
    1517     if ((curMember.isNode()) && (mainDataSet.isSelected(curMember.getNode())))
    1518     {
    1519       stoplistData.insertRow(insPos, curMember.getNode(), curMember.getRole());
    1520       if (insPos >= 0)
    1521         ++insPos;
    1522 
    1523       addedNodes.add(curMember.getNode());
    1524     }
     1517        RelationMember curMember = relIter.next();
     1518        if ((curMember.isNode()) && (mainDataSet.isSelected(curMember.getNode())))
     1519        {
     1520          stoplistData.insertRow(insPos, curMember.getNode(), curMember.getRole());
     1521          if (insPos >= 0)
     1522            ++insPos;
     1523
     1524          addedNodes.add(curMember.getNode());
     1525        }
    15251526      }
    15261527
     
    15301531      while (nodeIter.hasNext())
    15311532      {
    1532     Node curMember = nodeIter.next();
    1533     if (!(addedNodes.contains(curMember)))
    1534     {
    1535       stoplistData.insertRow(insPos, curMember, "");
    1536       if (insPos >= 0)
    1537         ++insPos;
    1538     }
     1533        Node curMember = nodeIter.next();
     1534        if (!(addedNodes.contains(curMember)))
     1535        {
     1536          stoplistData.insertRow(insPos, curMember, "");
     1537          if (insPos >= 0)
     1538            ++insPos;
     1539        }
    15391540      }
    15401541
    15411542      if ((insPos > 0) && (insPos < stoplistData.getRowCount()))
    15421543      {
    1543     while ((insPos < stoplistData.getRowCount())
    1544                && (stoplistData.nodes.elementAt(insPos) == null))
    1545       ++insPos;
    1546     stoplistTable.removeRowSelectionInterval(0, stoplistData.getRowCount()-1);
    1547     if (insPos < stoplistData.getRowCount())
    1548       stoplistTable.addRowSelectionInterval(insPos, insPos);
     1544        while ((insPos < stoplistData.getRowCount())
     1545                  && (stoplistData.nodes.elementAt(insPos) == null))
     1546          ++insPos;
     1547        stoplistTable.removeRowSelectionInterval(0, stoplistData.getRowCount()-1);
     1548        if (insPos < stoplistData.getRowCount())
     1549          stoplistTable.addRowSelectionInterval(insPos, insPos);
    15491550      }
    15501551
     
    15551556      for (int i = stoplistData.getRowCount()-1; i >=0; --i)
    15561557      {
    1557     if (stoplistTable.isRowSelected(i))
    1558     {
    1559       stoplistData.nodes.removeElementAt(i);
    1560       stoplistData.removeRow(i);
    1561     }
     1558        if (stoplistTable.isRowSelected(i))
     1559        {
     1560          stoplistData.nodes.removeElementAt(i);
     1561          stoplistData.removeRow(i);
     1562        }
    15621563      }
    15631564
     
    15711572      for (int i = 0; i < itineraryData.getRowCount(); ++i)
    15721573      {
    1573     if (itineraryData.ways.elementAt(i) != null)
    1574     {
    1575       Way way = itineraryData.ways.elementAt(i);
    1576       if (!(way.isIncomplete()))
    1577       {
    1578         if ("backward".equals((String)(itineraryData.getValueAt(i, 1))))
    1579         {
    1580           for (int j = way.getNodesCount()-2; j >= 0; --j)
     1574        if (itineraryData.ways.elementAt(i) != null)
     1575        {
     1576          Way way = itineraryData.ways.elementAt(i);
     1577          if (!(way.isIncomplete()))
    15811578          {
    1582         SegmentMetric sm = new SegmentMetric
    1583             (way.getNode(j+1).getCoor().lat(), way.getNode(j+1).getCoor().lon(),
    1584              way.getNode(j).getCoor().lat(), way.getNode(j).getCoor().lon());
    1585         segmentMetrics.add(sm);
     1579            if ("backward".equals((String)(itineraryData.getValueAt(i, 1))))
     1580            {
     1581              for (int j = way.getNodesCount()-2; j >= 0; --j)
     1582              {
     1583            SegmentMetric sm = new SegmentMetric
     1584                (way.getNode(j+1).getCoor().lat(), way.getNode(j+1).getCoor().lon(),
     1585                way.getNode(j).getCoor().lat(), way.getNode(j).getCoor().lon());
     1586            segmentMetrics.add(sm);
     1587              }
     1588            }
     1589            else
     1590            {
     1591              for (int j = 0; j < way.getNodesCount()-1; ++j)
     1592              {
     1593            SegmentMetric sm = new SegmentMetric
     1594                (way.getNode(j).getCoor().lat(), way.getNode(j).getCoor().lon(),
     1595                way.getNode(j+1).getCoor().lat(), way.getNode(j+1).getCoor().lon());
     1596            segmentMetrics.add(sm);
     1597              }
     1598            }
    15861599          }
    15871600        }
    15881601        else
    15891602        {
    1590           for (int j = 0; j < way.getNodesCount()-1; ++j)
    1591           {
    1592         SegmentMetric sm = new SegmentMetric
    1593             (way.getNode(j).getCoor().lat(), way.getNode(j).getCoor().lon(),
    1594              way.getNode(j+1).getCoor().lat(), way.getNode(j+1).getCoor().lon());
    1595         segmentMetrics.add(sm);
    1596           }
    1597         }
    1598       }
    1599     }
    1600     else
    1601     {
    1602       segmentMetrics.add(null);
    1603     }
     1603          segmentMetrics.add(null);
     1604        }
    16041605      }
    16051606
     
    16101611        // Determine for each member its position on the itinerary: position means here the
    16111612        // point on the itinerary that has minimal distance to the coor
    1612     for (int i = stoplistData.getRowCount()-1; i >= 0; --i)
    1613     {
    1614       if (stoplistTable.isRowSelected(i))
    1615       {
    1616         StopReference sr = detectMinDistance
    1617         (stoplistData.nodes.elementAt(i), segmentMetrics,
    1618          cbRight.isSelected(), cbLeft.isSelected());
    1619         if (sr != null)
    1620         {
    1621           if (sr.distance <
    1622              Double.parseDouble(tfSuggestStopsLimit.getText()) * 9.0 / 1000000.0 )
     1613        for (int i = stoplistData.getRowCount()-1; i >= 0; --i)
     1614        {
     1615          if (stoplistTable.isRowSelected(i))
    16231616          {
    1624         sr.role = (String)stoplistData.getValueAt(i, 1);
    1625         srm.addElement(sr);
     1617            StopReference sr = detectMinDistance
     1618            (stoplistData.nodes.elementAt(i), segmentMetrics,
     1619            cbRight.isSelected(), cbLeft.isSelected());
     1620            if (sr != null)
     1621            {
     1622              if (sr.distance <
     1623                Double.parseDouble(tfSuggestStopsLimit.getText()) * 9.0 / 1000000.0 )
     1624              {
     1625            sr.role = (String)stoplistData.getValueAt(i, 1);
     1626            srm.addElement(sr);
     1627              }
     1628              else
     1629              {
     1630            sr.role = (String)stoplistData.getValueAt(i, 1);
     1631            sr.index = segmentMetrics.size()*2;
     1632            sr.pos = 0;
     1633            srm.addElement(sr);
     1634              }
     1635
     1636              stoplistData.nodes.removeElementAt(i);
     1637              stoplistData.removeRow(i);
     1638            }
     1639
    16261640          }
    1627           else
     1641        }
     1642      }
     1643      else
     1644      {
     1645        // Determine for each member its position on the itinerary: position means here the
     1646            // point on the itinerary that has minimal distance to the coor
     1647        for (int i = stoplistData.getRowCount()-1; i >= 0; --i)
     1648        {
     1649          StopReference sr = detectMinDistance
     1650              (stoplistData.nodes.elementAt(i), segmentMetrics,
     1651              cbRight.isSelected(), cbLeft.isSelected());
     1652          if (sr != null)
    16281653          {
    1629         sr.role = (String)stoplistData.getValueAt(i, 1);
    1630         sr.index = segmentMetrics.size()*2;
    1631         sr.pos = 0;
    1632         srm.addElement(sr);
     1654            if (sr.distance <
     1655                  Double.parseDouble(tfSuggestStopsLimit.getText()) * 9.0 / 1000000.0 )
     1656            {
     1657              sr.role = (String)stoplistData.getValueAt(i, 1);
     1658              srm.addElement(sr);
     1659            }
     1660            else
     1661            {
     1662              sr.role = (String)stoplistData.getValueAt(i, 1);
     1663              sr.index = segmentMetrics.size()*2;
     1664              sr.pos = 0;
     1665              srm.addElement(sr);
     1666            }
    16331667          }
    1634 
    1635           stoplistData.nodes.removeElementAt(i);
    1636           stoplistData.removeRow(i);
    1637         }
    1638 
    1639       }
    1640     }
    1641       }
    1642       else
    1643       {
    1644     // Determine for each member its position on the itinerary: position means here the
    1645         // point on the itinerary that has minimal distance to the coor
    1646     for (int i = stoplistData.getRowCount()-1; i >= 0; --i)
    1647     {
    1648       StopReference sr = detectMinDistance
    1649           (stoplistData.nodes.elementAt(i), segmentMetrics,
    1650            cbRight.isSelected(), cbLeft.isSelected());
    1651       if (sr != null)
    1652       {
    1653         if (sr.distance <
    1654                Double.parseDouble(tfSuggestStopsLimit.getText()) * 9.0 / 1000000.0 )
    1655         {
    1656           sr.role = (String)stoplistData.getValueAt(i, 1);
    1657           srm.addElement(sr);
    1658         }
    1659         else
    1660         {
    1661           sr.role = (String)stoplistData.getValueAt(i, 1);
    1662           sr.index = segmentMetrics.size()*2;
    1663           sr.pos = 0;
    1664           srm.addElement(sr);
    1665         }
    1666       }
    1667     }
    1668 
    1669     stoplistData.clear();
     1668        }
     1669
     1670        stoplistData.clear();
    16701671      }
    16711672
     
    16741675      for (int i = 0; i < srm.size(); ++i)
    16751676      {
    1676     stoplistData.insertRow(insPos, srm.elementAt(i).node, srm.elementAt(i).role);
    1677     if (insPos >= 0)
    1678       ++insPos;
     1677        stoplistData.insertRow(insPos, srm.elementAt(i).node, srm.elementAt(i).role);
     1678        if (insPos >= 0)
     1679          ++insPos;
    16791680      }
    16801681
     
    16881689      if (stoplistTable.getSelectedRowCount() > 0)
    16891690      {
    1690     for (int i = stoplistData.getRowCount()-1; i >=0; --i)
    1691     {
    1692       if (stoplistTable.isRowSelected(i))
    1693       {
    1694         String role = (String)(stoplistData.getValueAt(i, 1));
    1695         RelationMember markedNode = new RelationMember
    1696         (role, stoplistData.nodes.elementAt(i));
    1697         itemsToReflect.addElement(markedNode);
    1698 
    1699         stoplistData.nodes.removeElementAt(i);
    1700         stoplistData.removeRow(i);
    1701       }
    1702     }
     1691        for (int i = stoplistData.getRowCount()-1; i >=0; --i)
     1692        {
     1693          if (stoplistTable.isRowSelected(i))
     1694          {
     1695            String role = (String)(stoplistData.getValueAt(i, 1));
     1696            RelationMember markedNode = new RelationMember
     1697            (role, stoplistData.nodes.elementAt(i));
     1698            itemsToReflect.addElement(markedNode);
     1699
     1700            stoplistData.nodes.removeElementAt(i);
     1701            stoplistData.removeRow(i);
     1702          }
     1703        }
    17031704      }
    17041705      else
    17051706      {
    1706     for (int i = stoplistData.getRowCount()-1; i >=0; --i)
    1707     {
    1708       String role = (String)(stoplistData.getValueAt(i, 1));
    1709       RelationMember markedNode = new RelationMember
    1710           (role, stoplistData.nodes.elementAt(i));
    1711       itemsToReflect.addElement(markedNode);
    1712     }
    1713 
    1714     stoplistData.clear();
     1707        for (int i = stoplistData.getRowCount()-1; i >=0; --i)
     1708        {
     1709          String role = (String)(stoplistData.getValueAt(i, 1));
     1710          RelationMember markedNode = new RelationMember
     1711              (role, stoplistData.nodes.elementAt(i));
     1712          itemsToReflect.addElement(markedNode);
     1713        }
     1714
     1715        stoplistData.clear();
    17151716      }
    17161717
     
    17191720      while (relIter.hasNext())
    17201721      {
    1721     RelationMember curMember = relIter.next();
    1722     if (curMember.isNode())
    1723     {
    1724       stoplistData.insertRow(insPos, curMember.getNode(), curMember.getRole());
     1722        RelationMember curMember = relIter.next();
     1723        if (curMember.isNode())
     1724        {
     1725          stoplistData.insertRow(insPos, curMember.getNode(), curMember.getRole());
     1726          if (insPos >= 0)
     1727            ++insPos;
     1728        }
     1729      }
    17251730      if (insPos >= 0)
    1726         ++insPos;
    1727     }
    1728       }
    1729       if (insPos >= 0)
    1730     stoplistTable.addRowSelectionInterval(startPos, insPos-1);
     1731        stoplistTable.addRowSelectionInterval(startPos, insPos-1);
    17311732
    17321733      rebuildNodes();
     
    17391740      for (int i = 0; i < itineraryData.getRowCount(); ++i)
    17401741      {
    1741     if (itineraryData.ways.elementAt(i) != null)
    1742     {
    1743       Way way = itineraryData.ways.elementAt(i);
    1744       if (!(way.isIncomplete()))
    1745       {
    1746         if ("backward".equals((String)(itineraryData.getValueAt(i, 1))))
    1747         {
    1748           for (int j = way.getNodesCount()-2; j >= 0; --j)
     1742        if (itineraryData.ways.elementAt(i) != null)
     1743        {
     1744          Way way = itineraryData.ways.elementAt(i);
     1745          if (!(way.isIncomplete()))
    17491746          {
    1750         SegmentMetric sm = new SegmentMetric
    1751             (way.getNode(j+1).getCoor().lat(), way.getNode(j+1).getCoor().lon(),
    1752              way.getNode(j).getCoor().lat(), way.getNode(j).getCoor().lon());
    1753         segmentMetrics.add(sm);
     1747            if ("backward".equals((String)(itineraryData.getValueAt(i, 1))))
     1748            {
     1749              for (int j = way.getNodesCount()-2; j >= 0; --j)
     1750              {
     1751            SegmentMetric sm = new SegmentMetric
     1752                (way.getNode(j+1).getCoor().lat(), way.getNode(j+1).getCoor().lon(),
     1753                way.getNode(j).getCoor().lat(), way.getNode(j).getCoor().lon());
     1754            segmentMetrics.add(sm);
     1755              }
     1756            }
     1757            else
     1758            {
     1759              for (int j = 0; j < way.getNodesCount()-1; ++j)
     1760              {
     1761            SegmentMetric sm = new SegmentMetric
     1762                (way.getNode(j).getCoor().lat(), way.getNode(j).getCoor().lon(),
     1763                way.getNode(j+1).getCoor().lat(), way.getNode(j+1).getCoor().lon());
     1764            segmentMetrics.add(sm);
     1765              }
     1766            }
    17541767          }
    17551768        }
    17561769        else
    17571770        {
    1758           for (int j = 0; j < way.getNodesCount()-1; ++j)
    1759           {
    1760         SegmentMetric sm = new SegmentMetric
    1761             (way.getNode(j).getCoor().lat(), way.getNode(j).getCoor().lon(),
    1762              way.getNode(j+1).getCoor().lat(), way.getNode(j+1).getCoor().lon());
    1763         segmentMetrics.add(sm);
    1764           }
    1765         }
    1766       }
    1767     }
    1768     else
    1769     {
    1770       segmentMetrics.add(null);
    1771     }
     1771          segmentMetrics.add(null);
     1772        }
    17721773      }
    17731774
     
    17781779      if (mainDataSet != null)
    17791780      {
    1780     String stopKey = "";
    1781     String stopValue = "";
    1782     if ("bus".equals(currentRoute.get("route")))
    1783     {
    1784       stopKey = "highway";
    1785       stopValue = "bus_stop";
    1786     }
    1787     else if ("trolleybus".equals(currentRoute.get("route")))
    1788     {
    1789       stopKey = "highway";
    1790       stopValue = "bus_stop";
    1791     }
    1792     else if ("tram".equals(currentRoute.get("route")))
    1793     {
    1794       stopKey = "railway";
    1795       stopValue = "tram_stop";
    1796     }
    1797     else if ("light_rail".equals(currentRoute.get("route")))
    1798     {
    1799       stopKey = "railway";
    1800       stopValue = "station";
    1801     }
    1802     else if ("subway".equals(currentRoute.get("route")))
    1803     {
    1804       stopKey = "railway";
    1805       stopValue = "station";
    1806     }
    1807     else if ("rail".equals(currentRoute.get("route")))
    1808     {
    1809       stopKey = "railway";
    1810       stopValue = "station";
    1811     }
    1812 
    1813     Collection< Node > nodeCollection = mainDataSet.getNodes();
    1814     Iterator< Node > nodeIter = nodeCollection.iterator();
    1815     while (nodeIter.hasNext())
    1816     {
    1817       Node currentNode = nodeIter.next();
    1818       if (!currentNode.isUsable())
    1819         continue;
    1820       if (stopValue.equals(currentNode.get(stopKey)))
    1821       {
    1822         StopReference sr = detectMinDistance
    1823         (currentNode, segmentMetrics,
    1824          cbRight.isSelected(), cbLeft.isSelected());
    1825         if ((sr != null) && (sr.distance <
    1826             Double.parseDouble(tfSuggestStopsLimit.getText()) * 9.0 / 1000000.0 ))
    1827           srm.addElement(sr);
    1828       }
    1829     }
     1781        String stopKey = "";
     1782        String stopValue = "";
     1783        if ("bus".equals(currentRoute.get("route")))
     1784        {
     1785          stopKey = "highway";
     1786          stopValue = "bus_stop";
     1787        }
     1788        else if ("trolleybus".equals(currentRoute.get("route")))
     1789        {
     1790          stopKey = "highway";
     1791          stopValue = "bus_stop";
     1792        }
     1793        else if ("tram".equals(currentRoute.get("route")))
     1794        {
     1795          stopKey = "railway";
     1796          stopValue = "tram_stop";
     1797        }
     1798        else if ("light_rail".equals(currentRoute.get("route")))
     1799        {
     1800          stopKey = "railway";
     1801          stopValue = "station";
     1802        }
     1803        else if ("subway".equals(currentRoute.get("route")))
     1804        {
     1805          stopKey = "railway";
     1806          stopValue = "station";
     1807        }
     1808        else if ("rail".equals(currentRoute.get("route")))
     1809        {
     1810          stopKey = "railway";
     1811          stopValue = "station";
     1812        }
     1813
     1814        Collection< Node > nodeCollection = mainDataSet.getNodes();
     1815        Iterator< Node > nodeIter = nodeCollection.iterator();
     1816        while (nodeIter.hasNext())
     1817        {
     1818          Node currentNode = nodeIter.next();
     1819          if (!currentNode.isUsable())
     1820            continue;
     1821          if (stopValue.equals(currentNode.get(stopKey)))
     1822          {
     1823            StopReference sr = detectMinDistance
     1824            (currentNode, segmentMetrics,
     1825            cbRight.isSelected(), cbLeft.isSelected());
     1826            if ((sr != null) && (sr.distance <
     1827                Double.parseDouble(tfSuggestStopsLimit.getText()) * 9.0 / 1000000.0 ))
     1828              srm.addElement(sr);
     1829          }
     1830        }
    18301831      }
    18311832      else
    18321833      {
    1833     JOptionPane.showMessageDialog(null, "There exists no dataset."
    1834         + " Try to download data from the server or open an OSM file.",
    1835      "No data found", JOptionPane.ERROR_MESSAGE);
    1836 
    1837     System.out.println("Public Transport: RoutePattern: No data found");
    1838       }
    1839 
    1840       for (int i = 0; i < stoplistData.getRowCount(); ++i)
    1841       {
    1842       }
     1834        JOptionPane.showMessageDialog(null, tr("There exists no dataset."
     1835            + " Try to download data from the server or open an OSM file."),
     1836        tr("No data found"), JOptionPane.ERROR_MESSAGE);
     1837      }
     1838
     1839      /*for (int i = 0; i < stoplistData.getRowCount(); ++i)
     1840      {
     1841      }*/
    18431842
    18441843      Collections.sort(srm);
     
    18471846      for (int i = 0; i < srm.size(); ++i)
    18481847      {
    1849     stoplistData.addRow(srm.elementAt(i).node, srm.elementAt(i).role);
     1848        stoplistData.addRow(srm.elementAt(i).node, srm.elementAt(i).role);
    18501849      }
    18511850
     
    18751874      while (relIter.hasNext())
    18761875      {
    1877     Relation currentRel = relIter.next();
    1878     if (!currentRel.isDeleted())
    1879     {
    1880       String routeVal = currentRel.get("route");
    1881       if ("bus".equals(routeVal))
    1882         relRefs.add(new RouteReference(currentRel));
    1883       else if ("trolleybus".equals(routeVal))
    1884         relRefs.add(new RouteReference(currentRel));
    1885       else if ("tram".equals(routeVal))
    1886         relRefs.add(new RouteReference(currentRel));
    1887       else if ("light_rail".equals(routeVal))
    1888         relRefs.add(new RouteReference(currentRel));
    1889       else if ("subway".equals(routeVal))
    1890         relRefs.add(new RouteReference(currentRel));
    1891       else if ("rail".equals(routeVal))
    1892         relRefs.add(new RouteReference(currentRel));
    1893     }
     1876        Relation currentRel = relIter.next();
     1877        if (!currentRel.isDeleted())
     1878        {
     1879          String routeVal = currentRel.get("route");
     1880          if ("bus".equals(routeVal))
     1881            relRefs.add(new RouteReference(currentRel));
     1882          else if ("trolleybus".equals(routeVal))
     1883            relRefs.add(new RouteReference(currentRel));
     1884          else if ("tram".equals(routeVal))
     1885            relRefs.add(new RouteReference(currentRel));
     1886          else if ("light_rail".equals(routeVal))
     1887            relRefs.add(new RouteReference(currentRel));
     1888          else if ("subway".equals(routeVal))
     1889            relRefs.add(new RouteReference(currentRel));
     1890          else if ("rail".equals(routeVal))
     1891            relRefs.add(new RouteReference(currentRel));
     1892        }
    18941893      }
    18951894
     
    18981897      Iterator< RouteReference > iter = relRefs.iterator();
    18991898      while (iter.hasNext())
    1900     relsListModel.addElement(iter.next());
     1899        relsListModel.addElement(iter.next());
    19011900    }
    19021901    else
    19031902    {
    1904       JOptionPane.showMessageDialog(null, "There exists no dataset."
    1905       + " Try to download data from the server or open an OSM file.",
    1906    "No data found", JOptionPane.ERROR_MESSAGE);
    1907 
    1908       System.out.println("Public Transport: No data found");
     1903      JOptionPane.showMessageDialog(null, tr("There exists no dataset."
     1904      + " Try to download data from the server or open an OSM file."),
     1905      tr("No data found"), JOptionPane.ERROR_MESSAGE);
    19091906    }
    19101907  }
     
    19241921      if (itineraryData.ways.elementAt(i) != null)
    19251922      {
    1926     RelationMember member = new RelationMember
     1923        RelationMember member = new RelationMember
    19271924        ((String)(itineraryData.getValueAt(i, 1)),
    19281925         itineraryData.ways.elementAt(i));
    1929     members.add(member);
     1926        members.add(member);
    19301927      }
    19311928    }
     
    19401937      if (currentRoute.getMember(i).isNode())
    19411938      {
    1942     currentRoute.removeMember(i);
     1939        currentRoute.removeMember(i);
    19431940      }
    19441941    }
     
    19701967      Node lastListNode = null;
    19711968      if ("backward".equals(list.getLast().getRole()))
    1972     lastListNode = list.getLast().getWay().getNode(0);
     1969        lastListNode = list.getLast().getWay().getNode(0);
    19731970      else
    1974     lastListNode = list.getLast().getWay().getNode
     1971        lastListNode = list.getLast().getWay().getNode
    19751972        (list.getLast().getWay().getNodesCount() - 1);
    19761973      if (lastNode.equals(lastListNode))
    19771974      {
    1978     backNodes.remove(lastListNode);
    1979     loops.add(list);
     1975        backNodes.remove(lastListNode);
     1976        loops.add(list);
    19801977      }
    19811978      else if (frontNodes.get(lastNode) != null)
    19821979      {
    1983     backNodes.remove(lastListNode);
    1984     LinkedList<RelationMember> listToAppend = frontNodes.get(lastNode);
    1985     Iterator<RelationMember> memberIter = list.iterator();
    1986     while (memberIter.hasNext())
    1987     {
    1988       RelationMember member = memberIter.next();
    1989       if ("backward".equals(member.getRole()))
    1990         listToAppend.addFirst(new RelationMember("forward", member.getWay()));
     1980        backNodes.remove(lastListNode);
     1981        LinkedList<RelationMember> listToAppend = frontNodes.get(lastNode);
     1982        Iterator<RelationMember> memberIter = list.iterator();
     1983        while (memberIter.hasNext())
     1984        {
     1985          RelationMember member = memberIter.next();
     1986          if ("backward".equals(member.getRole()))
     1987            listToAppend.addFirst(new RelationMember("forward", member.getWay()));
     1988          else
     1989            listToAppend.addFirst(new RelationMember("backward", member.getWay()));
     1990        }
     1991        frontNodes.remove(lastNode);
     1992        frontNodes.put(lastListNode, listToAppend);
     1993      }
     1994      else if (backNodes.get(lastNode) != null)
     1995      {
     1996        backNodes.remove(lastListNode);
     1997        LinkedList<RelationMember> listToAppend = backNodes.get(lastNode);
     1998        Iterator<RelationMember> memberIter = list.iterator();
     1999        while (memberIter.hasNext())
     2000        {
     2001          RelationMember member = memberIter.next();
     2002          listToAppend.addLast(member);
     2003        }
     2004        backNodes.remove(lastNode);
     2005        backNodes.put(lastListNode, listToAppend);
     2006      }
    19912007      else
    1992         listToAppend.addFirst(new RelationMember("backward", member.getWay()));
    1993     }
    1994     frontNodes.remove(lastNode);
    1995     frontNodes.put(lastListNode, listToAppend);
    1996       }
    1997       else if (backNodes.get(lastNode) != null)
    1998       {
    1999     backNodes.remove(lastListNode);
    2000     LinkedList<RelationMember> listToAppend = backNodes.get(lastNode);
    2001     Iterator<RelationMember> memberIter = list.iterator();
    2002     while (memberIter.hasNext())
    2003     {
    2004       RelationMember member = memberIter.next();
    2005       listToAppend.addLast(member);
    2006     }
    2007     backNodes.remove(lastNode);
    2008     backNodes.put(lastListNode, listToAppend);
    2009       }
    2010       else
    2011     frontNodes.put(lastNode, list);
     2008        frontNodes.put(lastNode, list);
    20122009    }
    20132010    else if (backNodes.get(firstNode) != null)
     
    20192016      Node firstListNode = null;
    20202017      if ("backward".equals(list.getFirst().getRole()))
    2021     firstListNode = list.getFirst().getWay().getNode
     2018        firstListNode = list.getFirst().getWay().getNode
    20222019        (list.getFirst().getWay().getNodesCount() - 1);
    20232020      else
    2024     firstListNode = list.getFirst().getWay().getNode(0);
     2021        firstListNode = list.getFirst().getWay().getNode(0);
    20252022      if (lastNode.equals(firstListNode))
    20262023      {
    2027     frontNodes.remove(firstListNode);
    2028     loops.add(list);
     2024        frontNodes.remove(firstListNode);
     2025        loops.add(list);
    20292026      }
    20302027      else if (frontNodes.get(lastNode) != null)
    20312028      {
    2032     frontNodes.remove(firstListNode);
    2033     LinkedList<RelationMember> listToAppend = frontNodes.get(lastNode);
    2034     ListIterator<RelationMember> memberIter = list.listIterator(list.size());
    2035     while (memberIter.hasPrevious())
    2036     {
    2037       RelationMember member = memberIter.previous();
    2038       listToAppend.addFirst(member);
    2039     }
    2040     frontNodes.remove(lastNode);
    2041     frontNodes.put(firstListNode, listToAppend);
     2029        frontNodes.remove(firstListNode);
     2030        LinkedList<RelationMember> listToAppend = frontNodes.get(lastNode);
     2031        ListIterator<RelationMember> memberIter = list.listIterator(list.size());
     2032        while (memberIter.hasPrevious())
     2033        {
     2034          RelationMember member = memberIter.previous();
     2035          listToAppend.addFirst(member);
     2036        }
     2037        frontNodes.remove(lastNode);
     2038        frontNodes.put(firstListNode, listToAppend);
    20422039      }
    20432040      else if (backNodes.get(lastNode) != null)
    20442041      {
    2045     frontNodes.remove(firstListNode);
    2046     LinkedList<RelationMember> listToAppend = backNodes.get(lastNode);
    2047     ListIterator<RelationMember> memberIter = list.listIterator(list.size());
    2048     while (memberIter.hasPrevious())
    2049     {
    2050       RelationMember member = memberIter.previous();
    2051       if ("backward".equals(member.getRole()))
    2052         listToAppend.addLast(new RelationMember("forward", member.getWay()));
     2042        frontNodes.remove(firstListNode);
     2043        LinkedList<RelationMember> listToAppend = backNodes.get(lastNode);
     2044        ListIterator<RelationMember> memberIter = list.listIterator(list.size());
     2045        while (memberIter.hasPrevious())
     2046        {
     2047          RelationMember member = memberIter.previous();
     2048          if ("backward".equals(member.getRole()))
     2049            listToAppend.addLast(new RelationMember("forward", member.getWay()));
     2050          else
     2051            listToAppend.addLast(new RelationMember("backward", member.getWay()));
     2052        }
     2053        backNodes.remove(lastNode);
     2054        backNodes.put(firstListNode, listToAppend);
     2055      }
    20532056      else
    2054         listToAppend.addLast(new RelationMember("backward", member.getWay()));
    2055     }
    2056     backNodes.remove(lastNode);
    2057     backNodes.put(firstListNode, listToAppend);
    2058       }
    2059       else
    2060     backNodes.put(lastNode, list);
     2057        backNodes.put(lastNode, list);
    20612058    }
    20622059    else if (frontNodes.get(lastNode) != null)
     
    21272124      if (curMember.isWay())
    21282125      {
    2129     itineraryData.insertRow(insPos, curMember.getWay(), curMember.getRole());
    2130     if (insPos >= 0)
    2131       ++insPos;
     2126        itineraryData.insertRow(insPos, curMember.getWay(), curMember.getRole());
     2127        if (insPos >= 0)
     2128          ++insPos;
    21322129      }
    21332130    }
     
    21692166      if (sm == null)
    21702167      {
    2171     angleLat = 100.0;
    2172     angleLon = 200.0;
    2173 
    2174     continue;
     2168        angleLat = 100.0;
     2169        angleLon = 200.0;
     2170
     2171        continue;
    21752172      }
    21762173
     
    21792176      if (curPosition < 0)
    21802177      {
    2181     if (angleLat <= 90.0)
    2182     {
    2183       double lastSegAngle = Math.atan2(angleLat - sm.aLat, angleLon - sm.aLon);
    2184       double segAngle = Math.atan2(sm.d1, -sm.o1);
    2185       double vertexAngle = Math.atan2(lat - sm.aLat, lon - sm.aLon);
    2186 
    2187       boolean vertexOnSeg = (vertexAngle == segAngle) ||
    2188           (vertexAngle == lastSegAngle);
    2189       boolean vertexOnTheLeft = (!vertexOnSeg) &&
    2190           (((lastSegAngle > vertexAngle) && (vertexAngle > segAngle))
    2191           || ((vertexAngle > segAngle) && (segAngle > lastSegAngle))
    2192           || ((segAngle > lastSegAngle) && (lastSegAngle > vertexAngle)));
    2193 
    2194       double currentDistance = Math.sqrt((lat - sm.aLat)*(lat - sm.aLat)
    2195         + (lon - sm.aLon)*(lon - sm.aLon)
    2196         *Math.cos(sm.aLat * Math.PI/180.0)*Math.cos(sm.aLat * Math.PI/180.0));
    2197       curPosition = vertexAngle - segAngle;
    2198       if (vertexOnTheLeft)
    2199         curPosition = -curPosition;
    2200       if (curPosition < 0)
    2201         curPosition += 2*Math.PI;
    2202       if ((Math.abs(currentDistance) < distance)
    2203         && (((!vertexOnTheLeft) && (rhsPossible))
    2204         || ((vertexOnTheLeft) && (lhsPossible))
    2205            || (vertexOnSeg)))
    2206       {
    2207         distance = Math.abs(currentDistance);
    2208         minIndex = curIndex-1;
    2209         position = curPosition;
    2210       }
    2211     }
    2212     angleLat = 100.0;
    2213     angleLon = 200.0;
     2178        if (angleLat <= 90.0)
     2179        {
     2180          double lastSegAngle = Math.atan2(angleLat - sm.aLat, angleLon - sm.aLon);
     2181          double segAngle = Math.atan2(sm.d1, -sm.o1);
     2182          double vertexAngle = Math.atan2(lat - sm.aLat, lon - sm.aLon);
     2183
     2184          boolean vertexOnSeg = (vertexAngle == segAngle) ||
     2185              (vertexAngle == lastSegAngle);
     2186          boolean vertexOnTheLeft = (!vertexOnSeg) &&
     2187              (((lastSegAngle > vertexAngle) && (vertexAngle > segAngle))
     2188              || ((vertexAngle > segAngle) && (segAngle > lastSegAngle))
     2189              || ((segAngle > lastSegAngle) && (lastSegAngle > vertexAngle)));
     2190
     2191          double currentDistance = Math.sqrt((lat - sm.aLat)*(lat - sm.aLat)
     2192            + (lon - sm.aLon)*(lon - sm.aLon)
     2193            *Math.cos(sm.aLat * Math.PI/180.0)*Math.cos(sm.aLat * Math.PI/180.0));
     2194          curPosition = vertexAngle - segAngle;
     2195          if (vertexOnTheLeft)
     2196            curPosition = -curPosition;
     2197          if (curPosition < 0)
     2198            curPosition += 2*Math.PI;
     2199          if ((Math.abs(currentDistance) < distance)
     2200            && (((!vertexOnTheLeft) && (rhsPossible))
     2201            || ((vertexOnTheLeft) && (lhsPossible))
     2202              || (vertexOnSeg)))
     2203          {
     2204            distance = Math.abs(currentDistance);
     2205            minIndex = curIndex-1;
     2206            position = curPosition;
     2207          }
     2208        }
     2209        angleLat = 100.0;
     2210        angleLon = 200.0;
    22142211      }
    22152212      else if (curPosition > sm.length)
    22162213      {
    2217     angleLat = sm.aLat;
    2218     angleLon = sm.aLon;
     2214        angleLat = sm.aLat;
     2215        angleLon = sm.aLon;
    22192216      }
    22202217      else
    22212218      {
    2222     double currentDistance = (lat - sm.aLat)*sm.o1 + (lon - sm.aLon)*sm.o2;
    2223     if ((Math.abs(currentDistance) < distance)
    2224             && (((currentDistance >= 0) && (rhsPossible))
    2225             || ((currentDistance <= 0) && (lhsPossible))))
    2226     {
    2227       distance = Math.abs(currentDistance);
    2228       minIndex = curIndex;
    2229       position = curPosition;
    2230     }
    2231 
    2232     angleLat = 100.0;
    2233     angleLon = 200.0;
     2219        double currentDistance = (lat - sm.aLat)*sm.o1 + (lon - sm.aLon)*sm.o2;
     2220        if ((Math.abs(currentDistance) < distance)
     2221                && (((currentDistance >= 0) && (rhsPossible))
     2222                || ((currentDistance <= 0) && (lhsPossible))))
     2223        {
     2224          distance = Math.abs(currentDistance);
     2225          minIndex = curIndex;
     2226          position = curPosition;
     2227        }
     2228
     2229        angleLat = 100.0;
     2230        angleLon = 200.0;
    22342231      }
    22352232    }
  • applications/editors/josm/plugins/public_transport/src/public_transport/SettingsStoptypeCommand.java

    r23192 r26168  
    11package public_transport;
     2
     3import static org.openstreetmap.josm.tools.I18n.tr;
    24
    35import org.openstreetmap.josm.Main;
     
    4749      if ((Node)waypointTM.nodes.elementAt(i) != null)
    4850      {
    49     Node node = (Node)waypointTM.nodes.elementAt(i);
    50     oldStrings.add(new HighwayRailway(node));
    51     StopImporterAction.setTagsWrtType(node, type);
     51        Node node = (Node)waypointTM.nodes.elementAt(i);
     52        oldStrings.add(new HighwayRailway(node));
     53        StopImporterAction.setTagsWrtType(node, type);
    5254      }
    5355    }
     
    5759      for (int i = 0; i < track.stoplistTM.getRowCount(); ++i)
    5860      {
    59     if (track.stoplistTM.nodeAt(i) != null)
    60     {
    61       Node node = track.stoplistTM.nodeAt(i);
    62       oldStrings.add(new HighwayRailway(node));
    63       StopImporterAction.setTagsWrtType(node, type);
    64     }
     61        if (track.stoplistTM.nodeAt(i) != null)
     62        {
     63          Node node = track.stoplistTM.nodeAt(i);
     64          oldStrings.add(new HighwayRailway(node));
     65          StopImporterAction.setTagsWrtType(node, type);
     66        }
    6567      }
    6668    }
     
    8688  @Override public JLabel getDescription()
    8789  {
    88     return new JLabel("public_transport.Settings.ChangeStoptype");
     90    return new JLabel(tr("Public Transport: Change stop type"));
    8991  }
    9092
  • applications/editors/josm/plugins/public_transport/src/public_transport/StopImporterAction.java

    r26147 r26168  
    11package public_transport;
    22
    3 import static org.openstreetmap.josm.tools.I18n.marktr;
    43import static org.openstreetmap.josm.tools.I18n.tr;
    54
     
    117116      }
    118117      JFileChooser fc = new JFileChooser(new File(curDir));
    119       fc.setDialogTitle("Select GPX file");
     118      fc.setDialogTitle(tr("Select GPX file"));
    120119      fc.setMultiSelectionEnabled(false);
    121120
     
    265264    {
    266265      JOptionPane.showMessageDialog
    267       (null, "The GPX file contained no tracks or waypoints.", "No data found",
     266      (null, tr("The GPX file contained no tracks or waypoints."), tr("No data found"),
    268267       JOptionPane.ERROR_MESSAGE);
    269 
    270       System.out.println("Public Transport: StopImporter: No data found");
    271268    }
    272269  }
     
    307304    if (Main.main.getCurrentDataSet() == null)
    308305    {
    309       JOptionPane.showMessageDialog(null, "There exists no dataset."
    310       + " Try to download data from the server or open an OSM file.",
    311    "No data found", JOptionPane.ERROR_MESSAGE);
    312 
    313       System.out.println("Public Transport: StopInserter: No data found");
     306      JOptionPane.showMessageDialog(null, tr("There exists no dataset."
     307      + " Try to download data from the server or open an OSM file."),
     308     tr("No data found"), JOptionPane.ERROR_MESSAGE);
    314309
    315310      return null;
     
    345340    {
    346341      for (int i = 0; i < selectedLines.length; ++i)
    347     consideredLines.add(selectedLines[i]);
     342        consideredLines.add(selectedLines[i]);
    348343    }
    349344    else
    350345    {
    351346      for (int i = 0; i < table.getRowCount(); ++i)
    352     consideredLines.add(new Integer(i));
     347        consideredLines.add(new Integer(i));
    353348    }
    354349    return consideredLines;
     
    366361    {
    367362      if ((nodes.elementAt(i) != null) &&
    368        (Main.main.getCurrentDataSet().isSelected(nodes.elementAt(i))))
    369     table.addRowSelectionInterval(i, i);
     363      (Main.main.getCurrentDataSet().isSelected(nodes.elementAt(i))))
     364        table.addRowSelectionInterval(i, i);
    370365    }
    371366  }
     
    381376      int j = consideredLines.elementAt(i);
    382377      if (nodes.elementAt(j) != null)
    383     nodes.elementAt(j).visit(box);
     378        nodes.elementAt(j).visit(box);
    384379    }
    385380    if (box.getBounds() == null)
     
    400395      int j = consideredLines.elementAt(i);
    401396      if (nodes.elementAt(j) != null)
    402     Main.main.getCurrentDataSet().addSelected(nodes.elementAt(j));
     397        Main.main.getCurrentDataSet().addSelected(nodes.elementAt(j));
    403398    }
    404399  }
     
    464459      public void actionPerformed(ActionEvent e)
    465460      {
    466     JTable table = dialog.getStoplistTable();
    467     int row = table.getEditingRow();
    468     if (row < 0)
    469       return;
    470     table.clearSelection();
    471     table.addRowSelectionInterval(row, row);
    472     Main.main.undoRedo.add
    473         (new TrackStoplistDeleteCommand(StopImporterAction.this));
     461        JTable table = dialog.getStoplistTable();
     462        int row = table.getEditingRow();
     463        if (row < 0)
     464          return;
     465        table.clearSelection();
     466        table.addRowSelectionInterval(row, row);
     467        Main.main.undoRedo.add
     468            (new TrackStoplistDeleteCommand(StopImporterAction.this));
    474469      }
    475470    };
  • applications/editors/josm/plugins/public_transport/src/public_transport/StopImporterDialog.java

    r23192 r26168  
    7575  private JTable waypointTable = null;
    7676
     77  private final String[] stoptypes = new String[]{marktr("bus"), marktr("tram"), marktr("light_rail"), marktr("subway"), marktr("rail")};
     78
    7779  public StopImporterDialog(StopImporterAction controller)
    7880  {
    7981    Frame frame = JOptionPane.getFrameForComponent(Main.parent);
    80     jDialog = new JDialog(frame, "Create Stops from GPX", false);
     82    jDialog = new JDialog(frame, tr("Create Stops from GPX"), false);
    8183    tabbedPane = new JTabbedPane();
    8284    JPanel tabTracks = new JPanel();
    83     tabbedPane.addTab(marktr("Tracks"), tabTracks);
     85    tabbedPane.addTab(tr("Tracks"), tabTracks);
    8486    JPanel tabSettings = new JPanel();
    85     tabbedPane.addTab(marktr("Settings"), tabSettings);
     87    tabbedPane.addTab(tr("Settings"), tabSettings);
    8688    JPanel tabStops = new JPanel();
    87     tabbedPane.addTab(marktr("Stops"), tabStops);
     89    tabbedPane.addTab(tr("Stops"), tabStops);
    8890    JPanel tabWaypoints = new JPanel();
    89     tabbedPane.addTab(marktr("Waypoints"), tabWaypoints);
     91    tabbedPane.addTab(tr("Waypoints"), tabWaypoints);
    9092    tabbedPane.setEnabledAt(0, true);
    9193    tabbedPane.setEnabledAt(1, true);
     
    100102    contentPane.setLayout(gridbag);
    101103
    102     JLabel label = new JLabel("Tracks in this GPX file:");
     104    JLabel label = new JLabel(tr("Tracks in this GPX file:"));
    103105
    104106    layoutCons.gridx = 0;
     
    134136    contentPane.setLayout(gridbag);
    135137
    136     label = new JLabel("Type of stops to add");
     138    label = new JLabel(tr("Type of stops to add"));
    137139
    138140    layoutCons.gridx = 0;
     
    147149    cbStoptype = new JComboBox();
    148150    cbStoptype.setEditable(false);
    149     cbStoptype.addItem("bus");
    150     cbStoptype.addItem("tram");
    151     cbStoptype.addItem("light_rail");
    152     cbStoptype.addItem("subway");
    153     cbStoptype.addItem("rail");
     151    for(String type : stoptypes)
     152        cbStoptype.addItem(new TransText(type));
    154153    cbStoptype.setActionCommand("stopImporter.settingsStoptype");
    155154    cbStoptype.addActionListener(controller);
     
    164163    contentPane.add(cbStoptype);
    165164
    166     label = new JLabel("Time on your GPS device");
     165    label = new JLabel(tr("Time on your GPS device"));
    167166
    168167    layoutCons.gridx = 0;
     
    188187    contentPane.add(tfGPSTimeStart);
    189188
    190     label = new JLabel("HH:MM:SS.sss");
     189    label = new JLabel(tr("HH:MM:SS.sss"));
    191190
    192191    layoutCons.gridx = 1;
     
    199198    contentPane.add(label);
    200199
    201     label = new JLabel("Time on your stopwatch");
     200    label = new JLabel(tr("Time on your stopwatch"));
    202201
    203202    layoutCons.gridx = 0;
     
    223222    contentPane.add(tfStopwatchStart);
    224223
    225     label = new JLabel("HH:MM:SS.sss");
     224    label = new JLabel(tr("HH:MM:SS.sss"));
    226225
    227226    layoutCons.gridx = 1;
     
    234233    contentPane.add(label);
    235234
    236     label = new JLabel("Time window");
     235    label = new JLabel(tr("Time window"));
    237236
    238237    layoutCons.gridx = 0;
     
    258257    contentPane.add(tfTimeWindow);
    259258
    260     label = new JLabel("seconds");
     259    label = new JLabel(tr("seconds"));
    261260
    262261    layoutCons.gridx = 1;
     
    269268    contentPane.add(label);
    270269
    271     label = new JLabel("Move Threshold");
     270    label = new JLabel(tr("Move Threshold"));
    272271
    273272    layoutCons.gridx = 0;
     
    293292    contentPane.add(tfThreshold);
    294293
    295     label = new JLabel("meters");
     294    label = new JLabel(tr("meters"));
    296295
    297296    layoutCons.gridx = 1;
     
    304303    contentPane.add(label);
    305304
    306     JButton bSuggestStops = new JButton("Suggest Stops");
     305    JButton bSuggestStops = new JButton(tr("Suggest Stops"));
    307306    bSuggestStops.setActionCommand("stopImporter.settingsSuggestStops");
    308307    bSuggestStops.addActionListener(controller);
     
    359358    contentPane.add(tableSP);
    360359
    361     JButton bFind = new JButton("Find");
     360    JButton bFind = new JButton(tr("Find"));
    362361    bFind.setActionCommand("stopImporter.stoplistFind");
    363362    bFind.addActionListener(controller);
     
    372371    contentPane.add(bFind);
    373372
    374     JButton bShow = new JButton("Show");
     373    JButton bShow = new JButton(tr("Show"));
    375374    bShow.setActionCommand("stopImporter.stoplistShow");
    376375    bShow.addActionListener(controller);
     
    385384    contentPane.add(bShow);
    386385
    387     JButton bMark = new JButton("Mark");
     386    JButton bMark = new JButton(tr("Mark"));
    388387    bMark.setActionCommand("stopImporter.stoplistMark");
    389388    bMark.addActionListener(controller);
     
    399398    contentPane.add(bMark);
    400399
    401     JButton bDetach = new JButton("Detach");
     400    JButton bDetach = new JButton(tr("Detach"));
    402401    bDetach.setActionCommand("stopImporter.stoplistDetach");
    403402    bDetach.addActionListener(controller);
     
    413412    contentPane.add(bDetach);
    414413
    415     JButton bAdd = new JButton("Add");
     414    JButton bAdd = new JButton(tr("Add"));
    416415    bAdd.setActionCommand("stopImporter.stoplistAdd");
    417416    bAdd.addActionListener(controller);
     
    427426    contentPane.add(bAdd);
    428427
    429     JButton bDelete = new JButton("Delete");
     428    JButton bDelete = new JButton(tr("Delete"));
    430429    bDelete.setActionCommand("stopImporter.stoplistDelete");
    431430    bDelete.addActionListener(controller);
     
    440439    contentPane.add(bDelete);
    441440
    442     JButton bSort = new JButton("Sort");
     441    JButton bSort = new JButton(tr("Sort"));
    443442    bSort.setActionCommand("stopImporter.stoplistSort");
    444443    bSort.addActionListener(controller);
     
    496495    contentPane.add(tableSP);
    497496
    498     bFind = new JButton("Find");
     497    bFind = new JButton(tr("Find"));
    499498    bFind.setActionCommand("stopImporter.waypointsFind");
    500499    bFind.addActionListener(controller);
     
    509508    contentPane.add(bFind);
    510509
    511     bShow = new JButton("Show");
     510    bShow = new JButton(tr("Show"));
    512511    bShow.setActionCommand("stopImporter.waypointsShow");
    513512    bShow.addActionListener(controller);
     
    522521    contentPane.add(bShow);
    523522
    524     bMark = new JButton("Mark");
     523    bMark = new JButton(tr("Mark"));
    525524    bMark.setActionCommand("stopImporter.waypointsMark");
    526525    bMark.addActionListener(controller);
     
    536535    contentPane.add(bMark);
    537536
    538     bDetach = new JButton("Detach");
     537    bDetach = new JButton(tr("Detach"));
    539538    bDetach.setActionCommand("stopImporter.waypointsDetach");
    540539    bDetach.addActionListener(controller);
     
    550549    contentPane.add(bDetach);
    551550
    552     bAdd = new JButton("Enable");
     551    bAdd = new JButton(tr("Enable"));
    553552    bAdd.setActionCommand("stopImporter.waypointsAdd");
    554553    bAdd.addActionListener(controller);
     
    564563    contentPane.add(bAdd);
    565564
    566     bDelete = new JButton("Disable");
     565    bDelete = new JButton(tr("Disable"));
    567566    bDelete.setActionCommand("stopImporter.waypointsDelete");
    568567    bDelete.addActionListener(controller);
     
    603602  public String getStoptype()
    604603  {
    605     return (String)cbStoptype.getSelectedItem();
     604    return ((TransText)cbStoptype.getSelectedItem()).text;
    606605  }
    607606
     
    615614    {
    616615      JOptionPane.showMessageDialog
    617       (null, "Can't parse a time from this string.", "Invalid value",
     616      (null, tr("Can't parse a time from this string."), tr("Invalid value"),
    618617       JOptionPane.ERROR_MESSAGE);
    619618      return false;
     
    640639    {
    641640      JOptionPane.showMessageDialog
    642       (null, "Can't parse a time from this string.", "Invalid value",
     641      (null, tr("Can't parse a time from this string."), tr("Invalid value"),
    643642       JOptionPane.ERROR_MESSAGE);
    644643      return false;
     
    675674    stoplistTable.setModel(model);
    676675    JComboBox comboBox = new JComboBox();
    677     comboBox.addItem("");
    678     comboBox.addItem("yes");
    679     comboBox.addItem("no");
    680     comboBox.addItem("implicit");
     676    comboBox.addItem(new TransText(null));
     677    comboBox.addItem(new TransText(marktr("yes")));
     678    comboBox.addItem(new TransText(marktr("no")));
     679    comboBox.addItem(new TransText(marktr("implicit")));
    681680    stoplistTable.getColumnModel().getColumn(2)
    682681    .setCellEditor(new DefaultCellEditor(comboBox));
     
    696695    waypointTable.setModel(model);
    697696    JComboBox comboBox = new JComboBox();
    698     comboBox.addItem("");
    699     comboBox.addItem("yes");
    700     comboBox.addItem("no");
    701     comboBox.addItem("implicit");
     697    comboBox.addItem(new TransText(null));
     698    comboBox.addItem(new TransText(marktr("yes")));
     699    comboBox.addItem(new TransText(marktr("no")));
     700    comboBox.addItem(new TransText(marktr("implicit")));
    702701    waypointTable.getColumnModel().getColumn(2)
    703702    .setCellEditor(new DefaultCellEditor(comboBox));
     
    736735      int selectedPos = tracksList.getAnchorSelectionIndex();
    737736      if (tracksList.isSelectedIndex(selectedPos))
    738     root.tracksSelectionChanged(selectedPos);
     737        root.tracksSelectionChanged(selectedPos);
    739738      else
    740     root.tracksSelectionChanged(-1);
     739        root.tracksSelectionChanged(-1);
    741740    }
    742741  };
  • applications/editors/josm/plugins/public_transport/src/public_transport/TrackReference.java

    r23192 r26168  
    11package public_transport;
    22
    3 import static org.openstreetmap.josm.tools.I18n.marktr;
    43import static org.openstreetmap.josm.tools.I18n.tr;
    54
     
    5756      {
    5857    JOptionPane.showMessageDialog
    59         (null, "The GPX file doesn't contain valid trackpoints. "
    60         + "Please use a GPX file that has trackpoints.", "GPX File Trouble",
     58        (null, tr("The GPX file doesn't contain valid trackpoints. "
     59        + "Please use a GPX file that has trackpoints."), tr("GPX File Trouble"),
    6160     JOptionPane.ERROR_MESSAGE);
    6261
     
    9392    String buf = (String)track.getAttributes().get("name");
    9493    if (buf == null)
    95       return "unnamed";
     94      return tr("unnamed");
    9695    return buf;
    9796  }
     
    111110        (stoplistTM.timeAt(e.getFirstRow()), e.getFirstRow(), 0);
    112111    JOptionPane.showMessageDialog
    113         (null, "Can't parse a time from this string.", "Invalid value",
     112        (null, tr("Can't parse a time from this string."), tr("Invalid value"),
    114113         JOptionPane.ERROR_MESSAGE);
    115114    return;
  • applications/editors/josm/plugins/public_transport/src/public_transport/TrackStoplistAddCommand.java

    r23192 r26168  
    11package public_transport;
     2
     3import static org.openstreetmap.josm.tools.I18n.tr;
    24
    35import org.openstreetmap.josm.Main;
     
    4345  @Override public JLabel getDescription()
    4446  {
    45     return new JLabel("public_transport.TrackStoplist.Add");
     47    return new JLabel(tr("Public Transport: Add track stop"));
    4648  }
    4749};
  • applications/editors/josm/plugins/public_transport/src/public_transport/TrackStoplistDeleteCommand.java

    r23192 r26168  
    11package public_transport;
     2
     3import static org.openstreetmap.josm.tools.I18n.tr;
    24
    35import org.openstreetmap.josm.Main;
     
    1416  private class NodeTimeName
    1517  {
    16     NodeTimeName(Node node, String time, String name, String shelter)
     18    NodeTimeName(Node node, String time, String name, TransText shelter)
    1719    {
    1820      this.node = node;
     
    2527    public String time;
    2628    public String name;
    27     public String shelter;
     29    public TransText shelter;
    2830  };
    2931
     
    4446      for (int i = 0; i < selectedLines.length; ++i)
    4547      {
    46     workingLines.add(selectedLines[i]);
     48        workingLines.add(selectedLines[i]);
    4749      }
    4850    }
     
    5052    {
    5153      for (int i = 0; i < stoplistTM.getRowCount(); ++i)
    52     workingLines.add(new Integer(i));
     54        workingLines.add(new Integer(i));
    5355    }
    5456  }
     
    6466      (node, (String)stoplistTM.getValueAt(j, 0),
    6567       (String)stoplistTM.getValueAt(j, 1),
    66        (String)stoplistTM.getValueAt(j, 2)));
     68       (TransText)stoplistTM.getValueAt(j, 2)));
    6769      stoplistTM.removeRow(j);
    6870      if (node == null)
    69     continue;
     71        continue;
    7072      Main.main.getCurrentDataSet().removePrimitive(node);
    7173      node.setDeleted(true);
     
    8284      stoplistTM.insertRow(j, ntn.node, ntn.time, ntn.name, ntn.shelter);
    8385      if (ntn.node == null)
    84     continue;
     86        continue;
    8587      ntn.node.setDeleted(false);
    8688      Main.main.getCurrentDataSet().addPrimitive(ntn.node);
     
    9698  @Override public JLabel getDescription()
    9799  {
    98     return new JLabel("public_transport.TrackStoplist.Delete");
     100    return new JLabel(tr("Public Transport: Delete track stop"));
    99101  }
    100102};
  • applications/editors/josm/plugins/public_transport/src/public_transport/TrackStoplistDetachCommand.java

    r23192 r26168  
    11package public_transport;
     2
     3import static org.openstreetmap.josm.tools.I18n.tr;
    24
    35import org.openstreetmap.josm.Main;
     
    2830    {
    2931      for (int i = 0; i < selectedLines.length; ++i)
    30     consideredLines.add(selectedLines[i]);
     32        consideredLines.add(selectedLines[i]);
    3133    }
    3234    else
    3335    {
    3436      for (int i = 0; i < stoplistTM.getRowCount(); ++i)
    35     consideredLines.add(new Integer(i));
     37        consideredLines.add(new Integer(i));
    3638    }
    3739
     
    4042    {
    4143      if (stoplistTM.nodeAt(consideredLines.elementAt(i)) != null)
    42     workingLines.add(consideredLines.elementAt(i));
     44        workingLines.add(consideredLines.elementAt(i));
    4345    }
    4446  }
     
    7577  @Override public JLabel getDescription()
    7678  {
    77     return new JLabel("public_transport.TrackStoplist.Detach");
     79    return new JLabel(tr("Public Transport: Detach track stop list"));
    7880  }
    7981};
  • applications/editors/josm/plugins/public_transport/src/public_transport/TrackStoplistNameCommand.java

    r23192 r26168  
    11package public_transport;
     2
     3import static org.openstreetmap.josm.tools.I18n.tr;
    24
    35import org.openstreetmap.josm.Main;
     
    2022  private String time = null;
    2123  private String oldShelter = null;
    22   private String shelter = null;
     24  private TransText shelter = null;
    2325  private LatLon oldLatLon = null;
    2426
     
    3840    this.time = (String)trackref.stoplistTM.getValueAt(workingLine, 0);
    3941    this.name = (String)trackref.stoplistTM.getValueAt(workingLine, 1);
    40     this.shelter = (String)trackref.stoplistTM.getValueAt(workingLine, 2);
    41     if ("".equals(this.shelter))
     42    this.shelter = (TransText)trackref.stoplistTM.getValueAt(workingLine, 2);
     43    if ("".equals(this.shelter.text))
    4244      this.shelter = null;
    4345  }
     
    4951    {
    5052      node.put("name", name);
    51       node.put("shelter", shelter);
     53      node.put("shelter", shelter.text);
    5254      double dTime = StopImporterDialog.parseTime(time);
    5355      node.setCoor(trackref.computeCoor(dTime));
     
    6264    else
    6365      trackref.stoplistTM.setValueAt(name, workingLine, 1);
    64     if (shelter == null)
    65       trackref.stoplistTM.setValueAt("", workingLine, 2);
    66     else
    67       trackref.stoplistTM.setValueAt(shelter, workingLine, 2);
     66    trackref.stoplistTM.setValueAt(shelter, workingLine, 2);
    6867    trackref.inEvent = false;
    6968    return true;
     
    8887    else
    8988      trackref.stoplistTM.setValueAt(oldName, workingLine, 1);
    90     if (oldShelter == null)
    91       trackref.stoplistTM.setValueAt("", workingLine, 2);
    92     else
    93       trackref.stoplistTM.setValueAt(oldShelter, workingLine, 2);
     89    trackref.stoplistTM.setValueAt(new TransText(oldShelter), workingLine, 2);
    9490    trackref.inEvent = false;
    9591  }
     
    10399  @Override public JLabel getDescription()
    104100  {
    105     return new JLabel("public_transport.TrackStoplist.Edit");
     101    return new JLabel(tr("Public Transport: Edit track stop list"));
    106102  }
    107103};
  • applications/editors/josm/plugins/public_transport/src/public_transport/TrackStoplistRelocateCommand.java

    r23192 r26168  
    11package public_transport;
     2
     3import static org.openstreetmap.josm.tools.I18n.tr;
    24
    35import org.openstreetmap.josm.Main;
     
    8890  @Override public JLabel getDescription()
    8991  {
    90     return new JLabel("public_transport.TrackStoplist.RelocateNodes");
     92    return new JLabel(tr("Public Transport: Relocate nodes in track stoplist"));
    9193  }
    9294};
  • applications/editors/josm/plugins/public_transport/src/public_transport/TrackStoplistSortCommand.java

    r23192 r26168  
    11package public_transport;
     2
     3import static org.openstreetmap.josm.tools.I18n.tr;
    24
    35import org.openstreetmap.josm.Main;
     
    3537    {
    3638      for (int i = 0; i < selectedLines.length; ++i)
    37     workingLines.add(selectedLines[i]);
     39        workingLines.add(selectedLines[i]);
    3840    }
    3941    else
    4042    {
    4143      for (int i = 0; i < stoplistTM.getRowCount(); ++i)
    42     workingLines.add(new Integer(i));
     44        workingLines.add(new Integer(i));
    4345    }
    4446  }
     
    5961      (stoplistTM.nodeAt(j), (String)stoplistTM.getValueAt(j, 0),
    6062        (String)stoplistTM.getValueAt(j, 1),
    61         (String)stoplistTM.getValueAt(j, 2),
     63        (TransText)stoplistTM.getValueAt(j, 2),
    6264         StopImporterDialog.parseTime(stopwatchStart)));
    6365      stoplistTM.removeRow(j);
     
    7375      stoplistTM.insertRow(insPos, nse.node, nse.time, nse.name, nse.shelter);
    7476      if (insPos >= 0)
    75     ++insPos;
     77        ++insPos;
    7678    }
    7779    return true;
     
    9395  @Override public JLabel getDescription()
    9496  {
    95     return new JLabel("public_transport.TrackStoplist.Sort");
     97    return new JLabel(tr("Public Transport: sort track stop list"));
    9698  }
    9799
     
    101103    public String time = null;
    102104    public String name = null;
    103     public String shelter = null;
     105    public TransText shelter = null;
    104106    public double startTime = 0;
    105107
    106108    public NodeSortEntry
    107         (Node node, String time, String name, String shelter, double startTime)
     109        (Node node, String time, String name, TransText shelter, double startTime)
    108110    {
    109111      this.node = node;
     
    117119      double time = StopImporterDialog.parseTime(this.time);
    118120      if (time - startTime > 12*60*60)
    119     time -= 24*60*60;
     121        time -= 24*60*60;
    120122
    121123      double nseTime = StopImporterDialog.parseTime(nse.time);
    122124      if (nseTime - startTime > 12*60*60)
    123     nseTime -= 24*60*60;
     125        nseTime -= 24*60*60;
    124126
    125127      if (time < nseTime)
    126     return -1;
     128        return -1;
    127129      else if (time > nseTime)
    128     return 1;
     130        return 1;
    129131      else
    130     return 0;
     132        return 0;
    131133    }
    132134  };
  • applications/editors/josm/plugins/public_transport/src/public_transport/TrackStoplistTableModel.java

    r23192 r26168  
    11package public_transport;
    22
    3 import static org.openstreetmap.josm.tools.I18n.marktr;
    43import static org.openstreetmap.josm.tools.I18n.tr;
    54
     
    2019    {
    2120      columns = new Vector< String >();
    22       columns.add("Time");
    23       columns.add("Name");
    24       columns.add("Shelter");
     21      columns.add(tr("Time"));
     22      columns.add(tr("Name"));
     23      columns.add(tr("Shelter"));
    2524    }
    2625    nodes = new Vector< Node >();
     
    4948  public void insertRow(int insPos, String time)
    5049  {
    51     insertRow(insPos, null, time, "", "");
     50    insertRow(insPos, null, time, "", new TransText(null));
    5251  }
    5352
     
    10099
    101100  public void insertRow
    102       (int insPos, Node node, String time, String name, String shelter)
     101      (int insPos, Node node, String time, String name, TransText shelter)
    103102  {
    104     String[] buf = { "", "", "" };
    105     buf[0] = time;
    106     buf[1] = name;
     103    Object[] buf = { time, name, shelter };
    107104    if (insPos == -1)
    108105    {
  • 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  };
  • applications/editors/josm/plugins/public_transport/src/public_transport/WaypointTableModel.java

    r23192 r26168  
    11package public_transport;
    22
    3 import static org.openstreetmap.josm.tools.I18n.marktr;
    43import static org.openstreetmap.josm.tools.I18n.tr;
    54
     
    2524  {
    2625    this.controller = controller;
    27     addColumn("Time");
    28     addColumn("Stopname");
    29     addColumn("Shelter");
     26    addColumn(tr("Time"));
     27    addColumn(tr("Stopname"));
     28    addColumn(tr("Shelter"));
    3029    addTableModelListener(this);
    3130  }
     
    5554  public void insertRow(int insPos, WayPoint wp)
    5655  {
    57     String[] buf = { "", "", "" };
    58     buf[0] = wp.getString("time");
    59     if (buf[0] == null)
    60       buf[0] = "";
    61     buf[1] = wp.getString("name");
    62     if (buf[1] == null)
    63       buf[1] = "";
     56    String time = wp.getString("time");
     57    if (time == null)
     58      time = "";
     59    String name = wp.getString("name");
     60    if (name == null)
     61      name = "";
    6462
    65     Node node = controller.createNode(wp.getCoor(), buf[1]);
     63    Node node = controller.createNode(wp.getCoor(), name);
    6664
     65    Object[] buf = { time, name, new TransText(null) };
    6766    if (insPos == -1)
    6867    {
     
    9089    {
    9190      if (inEvent)
    92     return;
     91        return;
    9392      Main.main.undoRedo.add(new WaypointsNameCommand
    9493      (this, e.getFirstRow(), (String)getValueAt(e.getFirstRow(), 1),
    95        (String)getValueAt(e.getFirstRow(), 2)));
     94       (TransText)getValueAt(e.getFirstRow(), 2)));
    9695    }
    9796  }
  • applications/editors/josm/plugins/public_transport/src/public_transport/WaypointsDetachCommand.java

    r23192 r26168  
    11package public_transport;
     2
     3import static org.openstreetmap.josm.tools.I18n.tr;
    24
    35import org.openstreetmap.josm.Main;
     
    7577  @Override public JLabel getDescription()
    7678  {
    77     return new JLabel("public_transport.Waypoints.Detach");
     79    return new JLabel(tr("Public Transport: Detach waypoints"));
    7880  }
    7981};
  • applications/editors/josm/plugins/public_transport/src/public_transport/WaypointsDisableCommand.java

    r23192 r26168  
    11package public_transport;
     2
     3import static org.openstreetmap.josm.tools.I18n.tr;
    24
    35import org.openstreetmap.josm.Main;
     
    8385  @Override public JLabel getDescription()
    8486  {
    85     return new JLabel("public_transport.Waypoints.Disable");
     87    return new JLabel(tr("Public Transport: Disable waypoints"));
    8688  }
    8789};
  • applications/editors/josm/plugins/public_transport/src/public_transport/WaypointsEnableCommand.java

    r23192 r26168  
    11package public_transport;
     2
     3import static org.openstreetmap.josm.tools.I18n.tr;
    24
    35import org.openstreetmap.josm.Main;
     
    2830    {
    2931      for (int i = 0; i < selectedLines.length; ++i)
    30     consideredLines.add(selectedLines[i]);
     32        consideredLines.add(selectedLines[i]);
    3133    }
    3234    else
    3335    {
    3436      for (int i = 0; i < waypointTM.getRowCount(); ++i)
    35     consideredLines.add(new Integer(i));
     37        consideredLines.add(new Integer(i));
    3638    }
    3739
     
    4042    {
    4143      if (waypointTM.nodes.elementAt(consideredLines.elementAt(i)) == null)
    42     workingLines.add(consideredLines.elementAt(i));
     44        workingLines.add(consideredLines.elementAt(i));
    4345    }
    4446  }
     
    5153      Node node = StopImporterAction.createNode
    5254        (waypointTM.coors.elementAt(j), type, (String)waypointTM.getValueAt(j, 1));
    53       if ("".equals((String)waypointTM.getValueAt(j, 2)))
    54     node.put("shelter", null);
    55       else
    56     node.put("shelter", (String)waypointTM.getValueAt(j, 2));
     55      TransText shelter = (TransText)waypointTM.getValueAt(j, 2);
     56      node.put("shelter", shelter.text);
    5757      waypointTM.nodes.set(j, node);
    5858    }
     
    6868      waypointTM.nodes.set(j, null);
    6969      if (node == null)
    70     continue;
     70        continue;
    7171      Main.main.getCurrentDataSet().removePrimitive(node);
    7272      node.setDeleted(true);
     
    8282  @Override public JLabel getDescription()
    8383  {
    84     return new JLabel("public_transport.Waypoints.Enable");
     84    return new JLabel(tr("Public Transport: Enable waypoints"));
    8585  }
    8686};
  • applications/editors/josm/plugins/public_transport/src/public_transport/WaypointsNameCommand.java

    r23192 r26168  
    11package public_transport;
     2
     3import static org.openstreetmap.josm.tools.I18n.tr;
    24
    35import org.openstreetmap.josm.Main;
     
    1719  private String name = null;
    1820  private String oldShelter = null;
    19   private String shelter = null;
     21  private TransText shelter;
    2022
    2123  public WaypointsNameCommand
    22       (WaypointTableModel waypointTM, int workingLine, String name, String shelter)
     24      (WaypointTableModel waypointTM, int workingLine, String name, TransText shelter)
    2325  {
    2426    this.waypointTM = waypointTM;
     
    3133    this.name = name;
    3234    this.shelter = shelter;
    33     if ("".equals(shelter))
    34       this.shelter = null;
    3535  }
    3636
     
    4040    {
    4141      waypointTM.nodes.elementAt(workingLine).put("name", name);
    42       waypointTM.nodes.elementAt(workingLine).put("shelter", shelter);
     42      waypointTM.nodes.elementAt(workingLine).put("shelter", shelter.text);
    4343    }
    4444    waypointTM.inEvent = true;
     
    4747    else
    4848      waypointTM.setValueAt(name, workingLine, 1);
    49     if (shelter == null)
    50       waypointTM.setValueAt("", workingLine, 2);
    51     else
    52       waypointTM.setValueAt(shelter, workingLine, 2);
     49    waypointTM.setValueAt(shelter, workingLine, 2);
    5350    waypointTM.inEvent = false;
    5451    return true;
     
    6764    else
    6865      waypointTM.setValueAt(oldName, workingLine, 1);
    69     if (oldShelter == null)
    70       waypointTM.setValueAt("", workingLine, 2);
    71     else
    72       waypointTM.setValueAt(oldShelter, workingLine, 2);
     66    waypointTM.setValueAt(new TransText(oldShelter), workingLine, 2);
    7367    waypointTM.inEvent = false;
    7468  }
     
    8276  @Override public JLabel getDescription()
    8377  {
    84     return new JLabel("public_transport.Waypoints.EditName");
     78    return new JLabel(tr("Public Transport: Edit waypoint name"));
    8579  }
    8680};
Note: See TracChangeset for help on using the changeset viewer.