Changeset 20839 in osm


Ignore:
Timestamp:
2010-04-08T14:26:34+02:00 (14 years ago)
Author:
roland
Message:

Public Transport Plugin: Shelter

Location:
applications/editors/josm
Files:
10 edited

Legend:

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

    r20835 r20839  
    281281     
    282282      //Prepare Stoplist
    283       dialog.getStoplistTable().setModel
     283      dialog.setStoplistTableModel
    284284          (((TrackReference)tracksListModel.elementAt(selectedPos)).stoplistTM);
    285285    }
  • applications/editors/josm/plugins/public_transport/src/public_transport/StopImporterDialog.java

    r20835 r20839  
    621621  }
    622622 
     623  public void setStoplistTableModel(TrackStoplistTableModel model)
     624  {
     625    stoplistTable.setModel(model);
     626    JComboBox comboBox = new JComboBox();
     627    comboBox.addItem("");
     628    comboBox.addItem("yes");
     629    comboBox.addItem("no");
     630    comboBox.addItem("implicit");
     631    stoplistTable.getColumnModel().getColumn(2)
     632        .setCellEditor(new DefaultCellEditor(comboBox));
     633    int width = stoplistTable.getPreferredSize().width;
     634    stoplistTable.getColumnModel().getColumn(0).setPreferredWidth((int)(width * 0.4));
     635    stoplistTable.getColumnModel().getColumn(1).setPreferredWidth((int)(width * 0.5));
     636    stoplistTable.getColumnModel().getColumn(2).setPreferredWidth((int)(width * 0.1));
     637  }
     638 
    623639  public JTable getWaypointsTable()
    624640  {
  • applications/editors/josm/plugins/public_transport/src/public_transport/TrackReference.java

    r20815 r20839  
    117117
    118118      Main.main.undoRedo.add(new TrackStoplistNameCommand
    119               (this, e.getFirstRow(),
    120                (String)stoplistTM.getValueAt(e.getFirstRow(), 0),
    121                (String)stoplistTM.getValueAt(e.getFirstRow(), 1)));
     119              (this, e.getFirstRow()));
    122120      stoplistTM.setTimeAt
    123121          (e.getFirstRow(), (String)stoplistTM.getValueAt(e.getFirstRow(), 0));
  • applications/editors/josm/plugins/public_transport/src/public_transport/TrackStoplistDeleteCommand.java

    r20815 r20839  
    1515  private class NodeTimeName
    1616  {
    17     NodeTimeName(Node node, String time, String name)
     17    NodeTimeName(Node node, String time, String name, String shelter)
    1818    {
    1919      this.node = node;
    2020      this.time = time;
    2121      this.name = name;
     22      this.shelter = shelter;
    2223    }
    2324   
     
    2526    public String time;
    2627    public String name;
     28    public String shelter;
    2729  };
    2830 
     
    6264      nodesForUndo.add(new NodeTimeName
    6365          (node, (String)stoplistTM.getValueAt(j, 0),
    64            (String)stoplistTM.getValueAt(j, 1)));
     66           (String)stoplistTM.getValueAt(j, 1),
     67           (String)stoplistTM.getValueAt(j, 2)));
    6568      stoplistTM.removeRow(j);
    6669      if (node == null)
     
    7881      int j = workingLines.elementAt(i).intValue();
    7982      NodeTimeName ntn = nodesForUndo.elementAt(workingLines.size() - i - 1);
    80       stoplistTM.insertRow(j, ntn.node, ntn.time, ntn.name);
     83      stoplistTM.insertRow(j, ntn.node, ntn.time, ntn.name, ntn.shelter);
    8184      if (ntn.node == null)
    8285        continue;
  • applications/editors/josm/plugins/public_transport/src/public_transport/TrackStoplistNameCommand.java

    r20815 r20839  
    2020  private String oldTime = null;
    2121  private String time = null;
     22  private String oldShelter = null;
     23  private String shelter = null;
    2224  private LatLon oldLatLon = null;
    2325 
    2426  @SuppressWarnings("unchecked")
    25   public TrackStoplistNameCommand
    26     (TrackReference trackref, int workingLine, String time, String name)
     27  public TrackStoplistNameCommand(TrackReference trackref, int workingLine)
    2728  {
    2829    this.trackref = trackref;
     
    3334      oldName = node.get("name");
    3435      oldTime = trackref.stoplistTM.timeAt(workingLine);
     36      oldShelter = node.get("shelter");
    3537      oldLatLon = (LatLon)node.getCoor().clone();
    36       System.out.println("Setze oldLatLon: " + oldLatLon);
    3738    }
    38     this.name = name;
    39     this.time = time;
     39    this.time = (String)trackref.stoplistTM.getValueAt(workingLine, 0);
     40    this.name = (String)trackref.stoplistTM.getValueAt(workingLine, 1);
     41    this.shelter = (String)trackref.stoplistTM.getValueAt(workingLine, 2);
    4042  }
    4143 
     
    4648    {
    4749      node.put("name", name);
     50      node.put("shelter", shelter);
    4851      double dTime = StopImporterDialog.parseTime(time);
    4952      node.setCoor(trackref.computeCoor(dTime));
    50       trackref.inEvent = true;
     53    }
     54    trackref.inEvent = true;
     55    if (time == null)
     56      trackref.stoplistTM.setValueAt("", workingLine, 0);
     57    else
    5158      trackref.stoplistTM.setValueAt(time, workingLine, 0);
     59    if (name == null)
     60      trackref.stoplistTM.setValueAt("", workingLine, 1);
     61    else
    5262      trackref.stoplistTM.setValueAt(name, workingLine, 1);
    53       trackref.inEvent = false;
    54     }
     63    if (shelter == null)
     64      trackref.stoplistTM.setValueAt("", workingLine, 2);
     65    else
     66      trackref.stoplistTM.setValueAt(shelter, workingLine, 2);
     67    trackref.inEvent = false;
    5568    return true;
    5669  }
     
    6275    {
    6376      node.put("name", oldName);
    64       System.out.println("Verwende oldLatLon: " + oldLatLon);
     77      node.put("shelter", oldShelter);
    6578      node.setCoor(oldLatLon);
    66       trackref.inEvent = true;
     79    }
     80    trackref.inEvent = true;
     81    if (oldTime == null)
     82      trackref.stoplistTM.setValueAt("", workingLine, 0);
     83    else
    6784      trackref.stoplistTM.setValueAt(oldTime, workingLine, 0);
     85    if (oldName == null)
     86      trackref.stoplistTM.setValueAt("", workingLine, 1);
     87    else
    6888      trackref.stoplistTM.setValueAt(oldName, workingLine, 1);
    69       trackref.inEvent = false;
    70     }
     89    if (oldShelter == null)
     90      trackref.stoplistTM.setValueAt("", workingLine, 2);
     91    else
     92      trackref.stoplistTM.setValueAt(oldShelter, workingLine, 2);
     93    trackref.inEvent = false;
    7194  }
    7295 
  • applications/editors/josm/plugins/public_transport/src/public_transport/TrackStoplistSortCommand.java

    r20815 r20839  
    6060          (stoplistTM.nodeAt(j), (String)stoplistTM.getValueAt(j, 0),
    6161            (String)stoplistTM.getValueAt(j, 1),
     62            (String)stoplistTM.getValueAt(j, 2),
    6263             StopImporterDialog.parseTime(stopwatchStart)));
    6364      stoplistTM.removeRow(j);
     
    7172    {
    7273      NodeSortEntry nse = iter.next();
    73       stoplistTM.insertRow(insPos, nse.node, nse.time, nse.name);
     74      stoplistTM.insertRow(insPos, nse.node, nse.time, nse.name, nse.shelter);
    7475      if (insPos >= 0)
    7576        ++insPos;
     
    101102    public String time = null;
    102103    public String name = null;
     104    public String shelter = null;
    103105    public double startTime = 0;
    104106   
    105     public NodeSortEntry(Node node, String time, String name, double startTime)
     107    public NodeSortEntry
     108        (Node node, String time, String name, String shelter, double startTime)
    106109    {
    107110      this.node = node;
    108111      this.time = time;
    109112      this.name = name;
     113      this.shelter = shelter;
    110114    }
    111115   
  • applications/editors/josm/plugins/public_transport/src/public_transport/TrackStoplistTableModel.java

    r20815 r20839  
    1313  private Vector< Node > nodes = null;
    1414  private Vector< String > times = null;
    15   private Vector< String > columns = null;
     15  private static Vector< String > columns = null;
    1616   
    1717  public TrackStoplistTableModel(TrackReference tr)
     
    2222      columns.add("Time");
    2323      columns.add("Name");
     24      columns.add("Shelter");
    2425    }
    2526    nodes = new Vector< Node >();
     
    4849  public void insertRow(int insPos, String time)
    4950  {
    50     insertRow(insPos, null, time, "");
     51    insertRow(insPos, null, time, "", "");
    5152  }
    5253
     
    9899  }
    99100
    100   public void insertRow(int insPos, Node node, String time, String name)
     101  public void insertRow
     102      (int insPos, Node node, String time, String name, String shelter)
    101103  {
    102     String[] buf = { "", "" };
     104    String[] buf = { "", "", "" };
    103105    buf[0] = time;
    104106    buf[1] = name;
  • applications/editors/josm/plugins/public_transport/src/public_transport/TrackSuggestStopsCommand.java

    r20815 r20839  
    157157        time -= timeDelta;
    158158        Node node = StopImporterAction.createNode(latLon, type, "");
    159         stoplistTM.insertRow(-1, node, StopImporterAction.timeOf(time), "");
     159        stoplistTM.insertRow(-1, node, StopImporterAction.timeOf(time), "", "");
    160160      }
    161161       
  • applications/editors/josm/plugins/public_transport/src/public_transport/WaypointsNameCommand.java

    r20835 r20839  
    4242      waypointTM.nodes.elementAt(workingLine).put("name", name);
    4343      waypointTM.nodes.elementAt(workingLine).put("shelter", shelter);
    44       waypointTM.inEvent = true;
     44    }
     45    waypointTM.inEvent = true;
     46    if (name == null)
     47      waypointTM.setValueAt("", workingLine, 1);
     48    else
    4549      waypointTM.setValueAt(name, workingLine, 1);
    46       if (shelter == null)
    47         waypointTM.setValueAt("", workingLine, 2);
    48       else
    49         waypointTM.setValueAt(shelter, workingLine, 2);
    50       waypointTM.inEvent = false;
    51     }
     50    if (shelter == null)
     51      waypointTM.setValueAt("", workingLine, 2);
     52    else
     53      waypointTM.setValueAt(shelter, workingLine, 2);
     54    waypointTM.inEvent = false;
    5255    return true;
    5356  }
     
    5962      waypointTM.nodes.elementAt(workingLine).put("name", oldName);
    6063      waypointTM.nodes.elementAt(workingLine).put("shelter", oldShelter);
    61       waypointTM.inEvent = true;
     64    }
     65    waypointTM.inEvent = true;
     66    if (oldName == null)
     67      waypointTM.setValueAt("", workingLine, 1);
     68    else
    6269      waypointTM.setValueAt(oldName, workingLine, 1);
    63       if (oldShelter == null)
    64         waypointTM.setValueAt("", workingLine, 2);
    65       else
    66         waypointTM.setValueAt(oldShelter, workingLine, 2);
    67       waypointTM.inEvent = false;
    68     }
     70    if (oldShelter == null)
     71      waypointTM.setValueAt("", workingLine, 2);
     72    else
     73      waypointTM.setValueAt(oldShelter, workingLine, 2);
     74    waypointTM.inEvent = false;
    6975  }
    7076 
Note: See TracChangeset for help on using the changeset viewer.