Changeset 80 in josm for src


Ignore:
Timestamp:
2006-04-03T23:12:07+02:00 (18 years ago)
Author:
imi
Message:
  • hardened gpx import (clean out empty ways or segments with from=to)
  • removed Java6-only stuff
Location:
src/org/openstreetmap/josm
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/org/openstreetmap/josm/Main.java

    r79 r80  
    3535import org.openstreetmap.josm.actions.UndoAction;
    3636import org.openstreetmap.josm.actions.UploadAction;
    37 import org.openstreetmap.josm.actions.WmsServerAction;
    3837import org.openstreetmap.josm.data.Preferences;
    3938import org.openstreetmap.josm.data.osm.DataSet;
     
    8584        private OpenAction openAction;
    8685        private DownloadAction downloadAction;
    87     private Action wmsServerAction;
     86    //private Action wmsServerAction;
    8887       
    8988        /**
     
    102101                downloadAction = new DownloadAction();
    103102                Action uploadAction = new UploadAction();
    104                 wmsServerAction = new WmsServerAction();
     103                //wmsServerAction = new WmsServerAction();
    105104        openAction = new OpenAction();
    106105                Action saveAction = new SaveAction();
     
    325324                        mapFrame.setVisible(true);
    326325                }
    327         //TODO: This is really hacky to unselect the action when the layer gets
    328         // deleted. The whole mapView/mapFrame/layer concept needs refactoring!
    329                 if (mapFrame == null && (Boolean)wmsServerAction.getValue(Action.SELECTED_KEY))
    330                         wmsServerAction.putValue(Action.SELECTED_KEY, false);
    331326        }
    332327        /**
  • src/org/openstreetmap/josm/gui/IconToggleButton.java

    r79 r80  
    2121                super(action);
    2222                setText(null);
    23                
     23
    2424                // Tooltip
    2525                String toolTipText = "";
  • src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java

    r79 r80  
    77
    88import javax.swing.AbstractButton;
    9 import javax.swing.Action;
    109import javax.swing.BorderFactory;
    1110import javax.swing.JLabel;
     
    5352                    EventQueue.invokeLater(new Runnable(){
    5453                        public void run() {
    55                             action.putValue(Action.SELECTED_KEY, true);
     54                                action.putValue("active", true);
    5655                            action.actionPerformed(null);
    5756                        }
  • src/org/openstreetmap/josm/io/GpxReader.java

    r71 r80  
    88import java.io.Reader;
    99import java.util.HashMap;
     10import java.util.Iterator;
    1011
    1112import org.jdom.Element;
     
    102103                        addNode(data, node);
    103104                }
    104        
     105
    105106                // read ways (and line segments)
    106107                for (Object wayElement : e.getChildren("trk", GPX))
     
    112113                                osm.id = 0;
    113114               
     115                // clean up the data a bit (remove broken stuff)
     116                // remove line segments with from==to
     117                for (Iterator<LineSegment> it = data.lineSegments.iterator(); it.hasNext();) {
     118                        LineSegment ls = it.next();
     119                        if (ls.from.equals(ls.to)) {
     120                                it.remove();
     121                                for (Way w : data.ways)
     122                                        w.segments.remove(ls);
     123                        }
     124                }
     125                // remove double line segments (remove only subsequent doubles yet)
     126                for (Iterator<Way> it = data.ways.iterator(); it.hasNext();) {
     127                        LineSegment ls = null;
     128                        for (Iterator<LineSegment> its = it.next().segments.iterator(); its.hasNext();) {
     129                                LineSegment cur = its.next();
     130                                if (ls != null && ls.equals(cur))
     131                                        its.remove();
     132                                ls = cur;
     133                        }
     134                }
     135                // remove empty ways
     136                for (Iterator<Way> it = data.ways.iterator(); it.hasNext();)
     137                        if (it.next().segments.isEmpty())
     138                                it.remove();
     139
    114140                return data;
    115141        }
  • src/org/openstreetmap/josm/tools/TileCache.java

    r79 r80  
    2828 *
    2929 * The tile identifier is an 32-bit integer whose bits are ordered in pairs of two.
    30  * If bit0 (the LSB) is 0, then the tile is right of the equator (0°). If bit1 is 0, it
    31  * is in the northern hemisphere. The next two bits representing the quarter within
    32  * the first quarter, so bit2 equals to 0 means, it is in the right half of the
    33  * quarter, represented by bit0 and bit1.
     30 * If bit0 (the LSB) is 0, then the tile is right of the equator (0 grad). If bit1
     31 * is 0, it is in the northern hemisphere. The next two bits representing the
     32 * quarter within the first quarter, so bit2 equals to 0 means, it is in the right
     33 * half of the quarter, represented by bit0 and bit1.
    3434 */
    3535public class TileCache {
Note: See TracChangeset for help on using the changeset viewer.