- Timestamp:
- 2007-05-24T22:55:15+02:00 (18 years ago)
- Location:
- src/org/openstreetmap/josm
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/actions/OpenAction.java
r236 r247 19 19 import org.openstreetmap.josm.Main; 20 20 import org.openstreetmap.josm.data.osm.DataSet; 21 import org.openstreetmap.josm.data.osm.DataSource; 21 22 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 22 23 import org.openstreetmap.josm.gui.layer.RawGpsLayer; … … 86 87 if (ExtensionFileFilter.filters[ExtensionFileFilter.OSM].acceptName(fn)) { 87 88 dataSet = OsmReader.parseDataSet(new FileInputStream(file), null, Main.pleaseWaitDlg); 89 DataSource src = new DataSource(); 90 src.sourceSpec = "File " + fn; 91 dataSet.dataSources.add(src); 88 92 } else if (ExtensionFileFilter.filters[ExtensionFileFilter.CSV].acceptName(fn)) { 89 93 JOptionPane.showMessageDialog(Main.parent, fn+": "+tr("CSV Data import for non-GPS data is not implemented yet.")); -
src/org/openstreetmap/josm/data/osm/DataSet.java
r203 r247 43 43 public Collection<Way> ways = new LinkedList<Way>(); 44 44 45 /** 46 * All data sources of this DataSet. 47 */ 48 public Collection<DataSource> dataSources = new LinkedList<DataSource>(); 49 45 50 /** 46 51 * A list of listeners to selection changed events. -
src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
r234 r247 4 4 import static org.openstreetmap.josm.tools.I18n.trn; 5 5 6 import java.awt.Color; 6 7 import java.awt.Component; 7 8 import java.awt.Graphics; 8 9 import java.awt.GridBagLayout; 10 import java.awt.Point; 9 11 import java.awt.event.ActionEvent; 10 12 import java.io.File; … … 29 31 import org.openstreetmap.josm.actions.SaveAsAction; 30 32 import org.openstreetmap.josm.command.Command; 33 import org.openstreetmap.josm.data.coor.EastNorth; 31 34 import org.openstreetmap.josm.data.osm.DataSet; 35 import org.openstreetmap.josm.data.osm.DataSource; 32 36 import org.openstreetmap.josm.data.osm.Node; 33 37 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 140 144 */ 141 145 @Override public void paint(final Graphics g, final MapView mv) { 146 if (Main.pref.getBoolean("draw.data.downloaded_area", false)) { 147 // FIXME this is inefficient; instead a proper polygon has to be built, and instead 148 // of drawing the outline, the outlying areas should perhaps be shaded. 149 for (DataSource src : data.dataSources) { 150 if (src.sourceBounds != null) { 151 EastNorth en1 = Main.proj.latlon2eastNorth(src.sourceBounds.min); 152 EastNorth en2 = Main.proj.latlon2eastNorth(src.sourceBounds.max); 153 Point p1 = mv.getPoint(en1); 154 Point p2 = mv.getPoint(en2); 155 g.setColor(SimplePaintVisitor.getPreferencesColor("downloaded Area", Color.YELLOW)); 156 g.drawRect(Math.min(p1.x,p2.x), Math.min(p1.y, p2.y), Math.abs(p2.x-p1.x), Math.abs(p2.y-p1.y)); 157 } 158 } 159 } 142 160 mapPainter.setGraphics(g); 143 161 mapPainter.setNavigatableComponent(mv); … … 161 179 osm.visit(visitor); 162 180 visitor.fixReferences(); 181 182 // copy the merged layer's data source info 183 for (DataSource src : ((OsmDataLayer)from).data.dataSources) 184 data.dataSources.add(src); 185 163 186 if (visitor.conflicts.isEmpty()) 164 187 return; -
src/org/openstreetmap/josm/gui/preferences/DrawingPreference.java
r181 r247 18 18 private JCheckBox directionHint = new JCheckBox(tr("Draw Direction Arrows")); 19 19 private JCheckBox segmentOrderNumber = new JCheckBox(tr("Draw segment order numbers")); 20 private JCheckBox sourceBounds = new JCheckBox(tr("Draw boundaries of downloaded data")); 20 21 21 22 public void addGui(PreferenceDialog gui) { … … 52 53 segmentOrderNumber.setSelected(Main.pref.getBoolean("draw.segment.order_number")); 53 54 gui.display.add(segmentOrderNumber, GBC.eop().insets(20,0,0,0)); 55 56 // downloaded area 57 sourceBounds.setToolTipText(tr("Draw the boundaries of data loaded from the server.")); 58 sourceBounds.setSelected(Main.pref.getBoolean("draw.data.downloaded_area")); 59 gui.display.add(sourceBounds, GBC.eop().insets(20,0,0,0)); 54 60 } 55 61 … … 60 66 Main.pref.put("draw.segment.direction", directionHint.isSelected()); 61 67 Main.pref.put("draw.segment.order_number", segmentOrderNumber.isSelected()); 68 Main.pref.put("draw.data.downloaded_area", sourceBounds.isSelected()); 62 69 } 63 70 } -
src/org/openstreetmap/josm/io/BoundingBoxDownloader.java
r210 r247 9 9 10 10 import org.openstreetmap.josm.Main; 11 import org.openstreetmap.josm.data.Bounds; 12 import org.openstreetmap.josm.data.coor.LatLon; 11 13 import org.openstreetmap.josm.data.osm.DataSet; 14 import org.openstreetmap.josm.data.osm.DataSource; 12 15 import org.openstreetmap.josm.gui.layer.RawGpsLayer.GpsPoint; 13 16 import org.xml.sax.SAXException; 17 14 18 15 19 public class BoundingBoxDownloader extends OsmServerReader { … … 98 102 Main.pleaseWaitDlg.currentAction.setText(tr("Downloading OSM data...")); 99 103 final DataSet data = OsmReader.parseDataSet(in, null, Main.pleaseWaitDlg); 104 DataSource src = new DataSource(); 105 src.sourceSpec = "Server"; 106 src.sourceBounds = new Bounds(new LatLon(lat1, lon1), new LatLon(lat2, lon2)); 107 data.dataSources.add(src); 100 108 in.close(); 101 109 activeConnection = null;
Note:
See TracChangeset
for help on using the changeset viewer.