Ignore:
Timestamp:
2013-08-21T11:09:21+02:00 (11 years ago)
Author:
donvip
Message:

[josm_plugins] project updates/cleanups + update public_transport to JOSM 6169

Location:
applications/editors/josm/plugins/public_transport/src/public_transport
Files:
4 edited

Legend:

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

    r29854 r29859  
    17021702    {
    17031703      Vector< RelationMember > itemsToReflect = new Vector< RelationMember >();
    1704       Vector< Double > distancesToReflect = new Vector< Double >();
    17051704      int insPos = stoplistTable.getSelectedRow();
    17061705
  • applications/editors/josm/plugins/public_transport/src/public_transport/StopImporterAction.java

    r29854 r29859  
    2929import org.openstreetmap.josm.data.gpx.GpxTrack;
    3030import org.openstreetmap.josm.data.gpx.WayPoint;
    31 import org.openstreetmap.josm.data.osm.DataSet;
    3231import org.openstreetmap.josm.data.osm.Node;
    3332import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    7776  public void actionPerformed(ActionEvent event)
    7877  {
    79     DataSet mainDataSet = Main.main.getCurrentDataSet();
    80 
    8178    if (dialog == null)
    8279      dialog = new StopImporterDialog(this);
  • applications/editors/josm/plugins/public_transport/src/public_transport/StopImporterDialog.java

    r29854 r29859  
    676676  public static double parseTime(String s)
    677677  {
    678     double result = 0;
    679678    if ((s.charAt(2) != ':') || (s.charAt(2) != ':')
    680679     || (s.length() < 8))
  • applications/editors/josm/plugins/public_transport/src/public_transport/TrackStoplistNameCommand.java

    r29854 r29859  
    1010import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1111
    12 public class TrackStoplistNameCommand extends Command
    13 {
    14   private int workingLine = 0;
    15   private TrackReference trackref = null;
    16   private String oldName = null;
    17   private String name = null;
    18   private String oldTime = null;
    19   private String time = null;
    20   private String oldShelter = null;
    21   private TransText shelter = null;
    22   private LatLon oldLatLon = null;
     12public class TrackStoplistNameCommand extends Command {
     13        private int workingLine = 0;
     14        private TrackReference trackref = null;
     15        private String oldName = null;
     16        private String name = null;
     17        private String oldTime = null;
     18        private String time = null;
     19        private String oldShelter = null;
     20        private TransText shelter = null;
     21        private LatLon oldLatLon = null;
    2322
    24   public TrackStoplistNameCommand(TrackReference trackref, int workingLine)
    25   {
    26     this.trackref = trackref;
    27     this.workingLine = workingLine;
    28     Node node = trackref.stoplistTM.nodeAt(workingLine);
    29     if (node != null)
    30     {
    31       oldName = node.get("name");
    32       oldTime = trackref.stoplistTM.timeAt(workingLine);
    33       oldShelter = node.get("shelter");
    34       oldLatLon = (LatLon)node.getCoor().clone();
    35     }
    36     this.time = (String)trackref.stoplistTM.getValueAt(workingLine, 0);
    37     this.name = (String)trackref.stoplistTM.getValueAt(workingLine, 1);
    38     this.shelter = (TransText)trackref.stoplistTM.getValueAt(workingLine, 2);
    39     if ("".equals(this.shelter.text))
    40       this.shelter = null;
    41   }
     23        public TrackStoplistNameCommand(TrackReference trackref, int workingLine) {
     24                this.trackref = trackref;
     25                this.workingLine = workingLine;
     26                Node node = trackref.stoplistTM.nodeAt(workingLine);
     27                if (node != null) {
     28                        oldName = node.get("name");
     29                        oldTime = trackref.stoplistTM.timeAt(workingLine);
     30                        oldShelter = node.get("shelter");
     31                        try {
     32                                oldLatLon = node.getCoor().clone();
     33                        } catch (CloneNotSupportedException e) {
     34                                e.printStackTrace();
     35                        }
     36                }
     37                this.time = (String) trackref.stoplistTM.getValueAt(workingLine, 0);
     38                this.name = (String) trackref.stoplistTM.getValueAt(workingLine, 1);
     39                this.shelter = (TransText) trackref.stoplistTM.getValueAt(workingLine, 2);
     40                if ("".equals(this.shelter.text))
     41                        this.shelter = null;
     42        }
    4243
    43   public boolean executeCommand()
    44   {
    45     Node node = trackref.stoplistTM.nodeAt(workingLine);
    46     if (node != null)
    47     {
    48       node.put("name", name);
    49       node.put("shelter", shelter.text);
    50       double dTime = StopImporterDialog.parseTime(time);
    51       node.setCoor(trackref.computeCoor(dTime));
    52     }
    53     trackref.inEvent = true;
    54     if (time == null)
    55       trackref.stoplistTM.setValueAt("", workingLine, 0);
    56     else
    57       trackref.stoplistTM.setValueAt(time, workingLine, 0);
    58     if (name == null)
    59       trackref.stoplistTM.setValueAt("", workingLine, 1);
    60     else
    61       trackref.stoplistTM.setValueAt(name, workingLine, 1);
    62     trackref.stoplistTM.setValueAt(shelter, workingLine, 2);
    63     trackref.inEvent = false;
    64     return true;
    65   }
     44        public boolean executeCommand() {
     45                Node node = trackref.stoplistTM.nodeAt(workingLine);
     46                if (node != null) {
     47                        node.put("name", name);
     48                        node.put("shelter", shelter.text);
     49                        double dTime = StopImporterDialog.parseTime(time);
     50                        node.setCoor(trackref.computeCoor(dTime));
     51                }
     52                trackref.inEvent = true;
     53                if (time == null)
     54                        trackref.stoplistTM.setValueAt("", workingLine, 0);
     55                else
     56                        trackref.stoplistTM.setValueAt(time, workingLine, 0);
     57                if (name == null)
     58                        trackref.stoplistTM.setValueAt("", workingLine, 1);
     59                else
     60                        trackref.stoplistTM.setValueAt(name, workingLine, 1);
     61                trackref.stoplistTM.setValueAt(shelter, workingLine, 2);
     62                trackref.inEvent = false;
     63                return true;
     64        }
    6665
    67   public void undoCommand()
    68   {
    69     Node node = trackref.stoplistTM.nodeAt(workingLine);
    70     if (node != null)
    71     {
    72       node.put("name", oldName);
    73       node.put("shelter", oldShelter);
    74       node.setCoor(oldLatLon);
    75     }
    76     trackref.inEvent = true;
    77     if (oldTime == null)
    78       trackref.stoplistTM.setValueAt("", workingLine, 0);
    79     else
    80       trackref.stoplistTM.setValueAt(oldTime, workingLine, 0);
    81     if (oldName == null)
    82       trackref.stoplistTM.setValueAt("", workingLine, 1);
    83     else
    84       trackref.stoplistTM.setValueAt(oldName, workingLine, 1);
    85     trackref.stoplistTM.setValueAt(new TransText(oldShelter), workingLine, 2);
    86     trackref.inEvent = false;
    87   }
     66        public void undoCommand() {
     67                Node node = trackref.stoplistTM.nodeAt(workingLine);
     68                if (node != null) {
     69                        node.put("name", oldName);
     70                        node.put("shelter", oldShelter);
     71                        node.setCoor(oldLatLon);
     72                }
     73                trackref.inEvent = true;
     74                if (oldTime == null)
     75                        trackref.stoplistTM.setValueAt("", workingLine, 0);
     76                else
     77                        trackref.stoplistTM.setValueAt(oldTime, workingLine, 0);
     78                if (oldName == null)
     79                        trackref.stoplistTM.setValueAt("", workingLine, 1);
     80                else
     81                        trackref.stoplistTM.setValueAt(oldName, workingLine, 1);
     82                trackref.stoplistTM.setValueAt(new TransText(oldShelter), workingLine, 2);
     83                trackref.inEvent = false;
     84        }
    8885
    89   public void fillModifiedData
    90     (Collection< OsmPrimitive > modified, Collection< OsmPrimitive > deleted,
    91      Collection< OsmPrimitive > added)
    92   {
    93   }
     86        public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted,
     87                        Collection<OsmPrimitive> added) {
     88        }
    9489
    95   @Override public String getDescriptionText()
    96   {
    97     return tr("Public Transport: Edit track stop list");
    98   }
     90        @Override
     91        public String getDescriptionText() {
     92                return tr("Public Transport: Edit track stop list");
     93        }
    9994};
Note: See TracChangeset for help on using the changeset viewer.