[josm-dev] Patch for remembering last download area
Rainer Rothkegel
rainer.rothkegel at googlemail.com
Sun Aug 17 23:20:40 BST 2008
I just double-checked my sent mail. The attachment was there. Maybe the
mailing list service strips the attachments before forwarding the
emails? Anyway, the patch is quite small, so I just paste it into the email.
Cheers,
Rainer
Index: src/org/openstreetmap/josm/gui/download/DownloadDialog.java
===================================================================
--- src/org/openstreetmap/josm/gui/download/DownloadDialog.java
(revision 802)
+++ src/org/openstreetmap/josm/gui/download/DownloadDialog.java
(working copy)
@@ -6,6 +6,7 @@
import java.awt.GridBagLayout;
import java.util.ArrayList;
import java.util.List;
+import java.util.StringTokenizer;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
@@ -110,6 +111,21 @@
maxlat = mv.getLatLon(mv.getWidth(), 0).lat();
boundingBoxChanged(null);
}
+ else if (Main.pref.hasKey("osm-download.bounds")) {
+ // read the bounding box from the preferences
+ try {
+ String bounds = Main.pref.get("osm-download.bounds");
+ StringTokenizer st = new StringTokenizer(bounds, ",");
+ minlat = Double.parseDouble(st.nextToken());
+ minlon = Double.parseDouble(st.nextToken());
+ maxlat = Double.parseDouble(st.nextToken());
+ maxlon = Double.parseDouble(st.nextToken());
+ boundingBoxChanged(null);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
newLayer = new JCheckBox(tr("Download as new layer"),
Main.pref.getBoolean("download.newlayer", false));
add(newLayer, GBC.eol().insets(0,5,0,0));
Index: src/org/openstreetmap/josm/io/BoundingBoxDownloader.java
===================================================================
--- src/org/openstreetmap/josm/io/BoundingBoxDownloader.java
(revision 802)
+++ src/org/openstreetmap/josm/io/BoundingBoxDownloader.java (working
copy)
@@ -30,6 +30,9 @@
this.lon1 = lon1;
this.lat2 = lat2;
this.lon2 = lon2;
+ // store the bounding box in the preferences so it can be
+ // re-used across invocations of josm
+ Main.pref.put("osm-download.bounds",
lat1+","+lon1+","+lat2+","+lon2);
}
/**
Dirk Stöcker wrote:
> On Sun, 17 Aug 2008, Rainer Rothkegel wrote:
>
>
>> Please find attached a patch that makes josm remember the bounding box of the
>> download area across sessions. Upon a download, the bounding box is stored in
>> the preferences file. This information is used to pre-populate the download
>> dialog when the map view area is not yet defined.
>>
>
> Hmm, at least I see no attachement.
>
> Ciao
>
More information about the josm-dev
mailing list