- Timestamp:
- 2006-01-23T00:00:39+01:00 (19 years ago)
- Location:
- src/org/openstreetmap/josm
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/Main.java
r40 r44 56 56 */ 57 57 private Container panel; 58 /**59 * The name of the current loaded mapFrame60 */61 private String name;62 58 /** 63 59 * The mapFrame currently loaded. … … 182 178 * aborts, nothing happens. 183 179 */ 184 public void setMapFrame( String name,MapFrame mapFrame) {180 public void setMapFrame(MapFrame mapFrame) { 185 181 //TODO: Check for changes and ask user 186 this.name = name;187 182 if (this.mapFrame != null) 188 183 this.mapFrame.setVisible(false); … … 197 192 } 198 193 /** 199 * @return Returns the name.200 */201 public String getNameOfLoadedMapFrame() {202 return name;203 }204 /**205 194 * @return Returns the mapFrame. 206 195 */ -
src/org/openstreetmap/josm/actions/DownloadAction.java
r43 r44 175 175 Layer layer = null; 176 176 if (rawGps.isSelected()) { 177 layer = new RawGpsDataLayer(osmReader.parseRawGps(), 178 name); 177 layer = new RawGpsDataLayer(osmReader.parseRawGps(), name); 179 178 } else { 180 179 DataSet dataSet = osmReader.parseOsm(); 181 180 if (dataSet == null) 182 181 return; // user cancelled download 183 if (dataSet.nodes.isEmpty()) 182 if (dataSet.nodes.isEmpty()) { 183 pleaseWaitDlg.setVisible(false); 184 pleaseWaitDlg.dispose(); 184 185 JOptionPane.showMessageDialog(Main.main, 185 186 "No data imported."); 186 187 layer = new OsmDataLayer(dataSet, name); 187 } 188 189 layer = new OsmDataLayer(dataSet, "Data Layer"); 188 190 } 189 191 190 192 if (Main.main.getMapFrame() == null) 191 Main.main.setMapFrame(n ame, new MapFrame(layer));193 Main.main.setMapFrame(new MapFrame(layer)); 192 194 else 193 195 Main.main.getMapFrame().mapView.addLayer(layer); … … 195 197 } catch (JDOMException x) { 196 198 pleaseWaitDlg.setVisible(false); 199 pleaseWaitDlg.dispose(); 197 200 x.printStackTrace(); 198 201 JOptionPane.showMessageDialog(Main.main, x.getMessage()); 199 202 } catch (FileNotFoundException x) { 200 203 pleaseWaitDlg.setVisible(false); 204 pleaseWaitDlg.dispose(); 201 205 x.printStackTrace(); 202 206 JOptionPane.showMessageDialog(Main.main, … … 204 208 } catch (IOException x) { 205 209 pleaseWaitDlg.setVisible(false); 210 pleaseWaitDlg.dispose(); 206 211 x.printStackTrace(); 207 212 JOptionPane.showMessageDialog(Main.main, x.getMessage()); 208 213 } finally { 209 pleaseWaitDlg.setVisible(false); 214 if (pleaseWaitDlg.isVisible()) { 215 pleaseWaitDlg.setVisible(false); 216 pleaseWaitDlg.dispose(); 217 } 210 218 } 211 219 } -
src/org/openstreetmap/josm/actions/JosmAction.java
r43 r44 47 47 pleaseWaitDlg.getContentPane().add(l); 48 48 pleaseWaitDlg.pack(); 49 pleaseWaitDlg.setLocation(Main.main.getWidth()/2-pleaseWaitDlg.getWidth()/2, 50 Main.main.getHeight()/2-pleaseWaitDlg.getHeight()/2); 49 pleaseWaitDlg.setLocation(Main.main.getX()+Main.main.getWidth()/2-pleaseWaitDlg.getWidth()/2, 50 Main.main.getY()+Main.main.getHeight()/2-pleaseWaitDlg.getHeight()/2); 51 51 pleaseWaitDlg.setResizable(false); 52 pleaseWaitDlg.setAlwaysOnTop(true);53 52 return pleaseWaitDlg; 54 53 } -
src/org/openstreetmap/josm/actions/OpenAction.java
r40 r44 82 82 return; 83 83 } 84 layer = new OsmDataLayer(dataSet, filename.getName());84 layer = new OsmDataLayer(dataSet, "Data Layer"); 85 85 } 86 86 87 87 if (Main.main.getMapFrame() == null) 88 Main.main.setMapFrame( filename.getName(),new MapFrame(layer));88 Main.main.setMapFrame(new MapFrame(layer)); 89 89 else 90 90 Main.main.getMapFrame().mapView.addLayer(layer); -
src/org/openstreetmap/josm/actions/UploadAction.java
r43 r44 83 83 } catch (JDOMException x) { 84 84 dlg.setVisible(false); 85 dlg.dispose(); 85 86 x.printStackTrace(); 86 87 JOptionPane.showMessageDialog(Main.main, x.getMessage()); 87 88 } finally { 88 dlg.setVisible(false); 89 if (dlg.isVisible()) { 90 dlg.setVisible(false); 91 dlg.dispose(); 92 } 89 93 } 90 94 } -
src/org/openstreetmap/josm/gui/BugReportExceptionHandler.java
r40 r44 27 27 public final class BugReportExceptionHandler implements Thread.UncaughtExceptionHandler { 28 28 public void uncaughtException(Thread t, Throwable e) { 29 e.printStackTrace(); 29 30 if (Main.main == null) 30 31 e.printStackTrace(); -
src/org/openstreetmap/josm/gui/dialogs/LayerList.java
r30 r44 153 153 public void actionPerformed(ActionEvent e) { 154 154 if (model.size() == 1) { 155 Main.main.setMapFrame(null , null);155 Main.main.setMapFrame(null); 156 156 Main.main.ds = new DataSet(); 157 157 } else { -
src/org/openstreetmap/josm/io/GpxReader.java
r35 r44 66 66 Node data = new Node(); 67 67 data.coor = new GeoPoint( 68 Float.parseFloat(e.getAttributeValue("lat")),69 Float.parseFloat(e.getAttributeValue("lon")));68 Double.parseDouble(e.getAttributeValue("lat")), 69 Double.parseDouble(e.getAttributeValue("lon"))); 70 70 71 71 for (Object o : e.getChildren()) { … … 190 190 osm.id = Long.parseLong(idElement.getText()); 191 191 osm.modified = e.getChild("modified", JOSM) != null; 192 osm.setDeleted(e.getChild("deleted", JOSM) != null); 192 193 osm.modifiedProperties = e.getChild("modifiedProperties", JOSM) != null; 193 194 } -
src/org/openstreetmap/josm/io/GpxWriter.java
r35 r44 242 242 @SuppressWarnings("unchecked") 243 243 private void addPropertyExtensions(Element e, Map<Key, String> keys, OsmPrimitive osm) { 244 if ((keys == null || keys.isEmpty()) && osm.id == 0 && !osm.modified && !osm.modifiedProperties) 244 if ((keys == null || keys.isEmpty()) && osm.id == 0 && !osm.modified && !osm.isDeleted() && !osm.modifiedProperties) 245 245 return; 246 246 Element extensions = e.getChild("extensions", GPX); … … 264 264 extensions.getChildren().add(modElement); 265 265 } 266 if (osm.isDeleted()) { 267 Element modElement = new Element("deleted", JOSM); 268 extensions.getChildren().add(modElement); 269 } 266 270 if (osm.modifiedProperties) { 267 271 Element modElement = new Element("modifiedProperties", JOSM); -
src/org/openstreetmap/josm/io/OsmReader.java
r39 r44 66 66 Node data = new Node(); 67 67 data.coor = new GeoPoint( 68 Float.parseFloat(e.getAttributeValue("lat")),69 Float.parseFloat(e.getAttributeValue("lon")));68 Double.parseDouble(e.getAttributeValue("lat")), 69 Double.parseDouble(e.getAttributeValue("lon"))); 70 70 if (Double.isNaN(data.coor.lat) || 71 71 data.coor.lat < -90 || data.coor.lat > 90 || -
src/org/openstreetmap/josm/io/OsmWriter.java
r40 r44 102 102 */ 103 103 private void addProperties(Element e, OsmPrimitive osm) { 104 if (osm.id == 0) 105 osm.id = newIdCounter--; 106 e.setAttribute("uid", ""+osm.id); 104 long id = osm.id; 105 if (id == 0) 106 id = newIdCounter--; 107 e.setAttribute("uid", ""+id); 107 108 if (osm.keys != null) 108 109 for (Entry<Key, String> entry : osm.keys.entrySet()) … … 135 136 @SuppressWarnings("unchecked") 136 137 public void visit(Track t) { 137 Element e= new Element("track");138 addProperties(e, t); 138 element = new Element("track"); 139 addProperties(element, t); 139 140 for (LineSegment ls : t.segments) 140 e.getChildren().add(new Element("segment").setAttribute("uid", ""+ls.id)); 141 element.getChildren().add(new Element("segment").setAttribute("uid", ""+ls.id)); 141 142 } 142 143 -
src/org/openstreetmap/josm/io/RawGpsReader.java
r40 r44 63 63 for (Object o : root.getChildren("wpt", GPX)) { 64 64 Collection<GeoPoint> line = new LinkedList<GeoPoint>(); 65 line.add(new GeoPoint(parse Float((Element)o, LatLon.lat), parseFloat((Element)o, LatLon.lon)));65 line.add(new GeoPoint(parseDouble((Element)o, LatLon.lat), parseDouble((Element)o, LatLon.lon))); 66 66 data.add(line); 67 67 } … … 88 88 * @throws JDOMException If the absolute of the value is out of bound. 89 89 */ 90 private float parseFloat(Element e, LatLon attr) throws JDOMException {91 float f = Float.parseFloat(e.getAttributeValue(attr.toString()));92 if (Math.abs( f) > (attr == LatLon.lat ? 90 : 180))93 throw new JDOMException("Data error: "+attr+" value '"+ f+"' is out of bound.");94 return f;90 private double parseDouble(Element e, LatLon attr) throws JDOMException { 91 double d = Double.parseDouble(e.getAttributeValue(attr.toString())); 92 if (Math.abs(d) > (attr == LatLon.lat ? 90 : 180)) 93 throw new JDOMException("Data error: "+attr+" value '"+d+"' is out of bound."); 94 return d; 95 95 } 96 96 … … 102 102 Collection<GeoPoint> data = new LinkedList<GeoPoint>(); 103 103 for (Element e : wpt) 104 data.add(new GeoPoint(parse Float(e, LatLon.lat), parseFloat(e, LatLon.lon)));104 data.add(new GeoPoint(parseDouble(e, LatLon.lat), parseDouble(e, LatLon.lon))); 105 105 return data; 106 106 }
Note:
See TracChangeset
for help on using the changeset viewer.