Changeset 1082 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2008-11-18T08:40:49+01:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java
r746 r1082 11 11 import org.openstreetmap.josm.actions.DownloadAction; 12 12 import org.openstreetmap.josm.data.osm.DataSet; 13 import org.openstreetmap.josm.data.osm.DataSource; 13 14 import org.openstreetmap.josm.gui.PleaseWaitRunnable; 14 15 import org.openstreetmap.josm.gui.download.DownloadDialog.DownloadTask; 15 16 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 16 17 import org.openstreetmap.josm.io.BoundingBoxDownloader; 18 import org.openstreetmap.josm.data.Bounds; 19 import org.openstreetmap.josm.data.coor.LatLon; 17 20 import org.xml.sax.SAXException; 21 18 22 19 23 /** … … 22 26 */ 23 27 public class DownloadOsmTask implements DownloadTask { 28 29 private static Bounds currentBounds; 24 30 25 31 private static class Task extends PleaseWaitRunnable { … … 41 47 if (dataSet == null) 42 48 return; // user cancelled download or error occoured 43 if (dataSet.allPrimitives().isEmpty()) 49 if (dataSet.allPrimitives().isEmpty()) { 44 50 errorMessage = tr("No data imported."); 51 // need to synthesize a download bounds lest the visual indication of downloaded 52 // area doesn't work 53 dataSet.dataSources.add(new DataSource(currentBounds, "OpenStreetMap server")); 54 } 55 45 56 OsmDataLayer layer = new OsmDataLayer(dataSet, tr("Data Layer"), null); 46 57 if (newLayer) … … 69 80 70 81 Task task = new Task(action != null && (action.dialog == null || action.dialog.newLayer.isSelected()), new BoundingBoxDownloader(minlat, minlon, maxlat, maxlon)); 82 currentBounds = new Bounds(new LatLon(minlat, minlon), new LatLon(maxlat, maxlon)); 71 83 Main.worker.execute(task); 72 84 } -
trunk/src/org/openstreetmap/josm/data/Preferences.java
r1073 r1082 178 178 } 179 179 180 synchronized public Map<String, String> getDefaults() 181 { 180 synchronized public Map<String, String> getDefaults() { 182 181 return defaults; 183 182 } -
trunk/src/org/openstreetmap/josm/gui/MainApplication.java
r1065 r1082 165 165 Main.pref.save(); 166 166 } 167 167 168 // TODO remove this in early 2009 - just here to weed out color setting we don't use any more 169 Main.pref.put("downloaded Area", null); 168 170 169 171 String localeName = null; //The locale to use -
trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
r1078 r1082 7 7 import static org.openstreetmap.josm.tools.I18n.trn; 8 8 9 import java.awt.AlphaComposite; 9 10 import java.awt.Color; 10 11 import java.awt.Component; 12 import java.awt.Composite; 11 13 import java.awt.Graphics; 12 14 import java.awt.Graphics2D; … … 128 130 * a paint texture for non-downloaded area 129 131 */ 130 private TexturePaint hatched;132 private static TexturePaint hatched; 131 133 134 static { 135 createHatchTexture(); 136 } 137 138 /** 139 * Initialize the hatch pattern used to paint the non-downloaded area 140 */ 141 public static void createHatchTexture() { 142 BufferedImage bi = new BufferedImage(15, 15, BufferedImage.TYPE_INT_ARGB); 143 Graphics2D big = bi.createGraphics(); 144 big.setColor(Main.pref.getColor(marktr("background"), Color.BLACK)); 145 Composite comp = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.3f); 146 big.setComposite(comp); 147 big.fillRect(0,0,15,15); 148 big.setColor(Main.pref.getColor(marktr("outside downloaded area"), Color.YELLOW)); 149 big.drawLine(0,15,15,0); 150 Rectangle r = new Rectangle(0, 0, 15,15); 151 hatched = new TexturePaint(bi, r); 152 } 153 132 154 /** 133 155 * Construct a OsmDataLayer. … … 137 159 this.data = data; 138 160 this.associatedFile = associatedFile; 139 140 BufferedImage bi = new BufferedImage(15, 15, BufferedImage.TYPE_INT_RGB);141 Graphics2D big = bi.createGraphics();142 big.setColor(Main.pref.getColor(marktr("background"), Color.BLACK));143 big.fillRect(0,0,15,15);144 big.setColor(Main.pref.getColor(marktr("downloaded Area"), Color.YELLOW));145 big.drawLine(0,15,15,0);146 Rectangle r = new Rectangle(0, 0, 15,15);147 hatched = new TexturePaint(bi, r);148 161 } 149 162 -
trunk/src/org/openstreetmap/josm/gui/preferences/ColorPreference.java
r1053 r1082 30 30 import org.openstreetmap.josm.Main; 31 31 import org.openstreetmap.josm.data.osm.visitor.SimplePaintVisitor; 32 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 32 33 import org.openstreetmap.josm.tools.ColorHelper; 33 34 import org.openstreetmap.josm.tools.GBC; … … 172 173 Main.pref.put("color." + name, ColorHelper.color2html(col)); 173 174 } 175 org.openstreetmap.josm.gui.layer.OsmDataLayer.createHatchTexture(); 174 176 } 175 177 }
Note:
See TracChangeset
for help on using the changeset viewer.