Changeset 3280 in josm for trunk/src/org
- Timestamp:
- 2010-05-26T17:16:28+02:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java
r3235 r3280 78 78 79 79 private static final String PREF_DOWNLOAD_ALONG_TRACK_DISTANCE = "gpxLayer.downloadAlongTrack.distance"; 80 private static final String PREF_DOWNLOAD_ALONG_TRACK_AREA = "gpxLayer.downloadAlongTrack.distance"; 80 private static final String PREF_DOWNLOAD_ALONG_TRACK_AREA = "gpxLayer.downloadAlongTrack.area"; 81 private static final String PREF_DOWNLOAD_ALONG_TRACK_NEAR = "gpxLayer.downloadAlongTrack.near"; 81 82 82 83 public GpxData data; … … 877 878 buffer.setSelectedIndex(Main.pref.getInteger(PREF_DOWNLOAD_ALONG_TRACK_DISTANCE, 0)); 878 879 msg.add(buffer, GBC.eol()); 880 879 881 msg.add(new JLabel(tr("Maximum area per request:")), GBC.eol()); 880 882 s = new String[area.length]; … … 885 887 maxRect.setSelectedIndex(Main.pref.getInteger(PREF_DOWNLOAD_ALONG_TRACK_AREA, 0)); 886 888 msg.add(maxRect, GBC.eol()); 889 890 msg.add(new JLabel(tr("Download near:")), GBC.eol()); 891 JList downloadNear = new JList(new String[] { tr("track only"), tr("waypoints only"), tr("track and waypoints") }); 892 int NEAR_TRACK=0; 893 int NEAR_WAYPOINTS=1; 894 int NEAR_BOTH=2; 895 896 downloadNear.setSelectedIndex(Main.pref.getInteger(PREF_DOWNLOAD_ALONG_TRACK_NEAR, 0)); 897 msg.add(downloadNear, GBC.eol()); 887 898 888 899 int ret = JOptionPane.showConfirmDialog( … … 903 914 Main.pref.putInteger(PREF_DOWNLOAD_ALONG_TRACK_DISTANCE, buffer.getSelectedIndex()); 904 915 Main.pref.putInteger(PREF_DOWNLOAD_ALONG_TRACK_AREA, maxRect.getSelectedIndex()); 916 int near = downloadNear.getSelectedIndex(); 917 Main.pref.putInteger(PREF_DOWNLOAD_ALONG_TRACK_NEAR, near); 905 918 906 919 /* … … 911 924 int latcnt = 0; 912 925 913 for (GpxTrack trk : data.tracks) { 914 for (GpxTrackSegment segment : trk.getSegments()) { 915 for (WayPoint p : segment.getWayPoints()) { 916 latsum += p.getCoor().lat(); 917 latcnt++; 918 } 926 if (near == NEAR_TRACK || near == NEAR_BOTH) { 927 for (GpxTrack trk : data.tracks) { 928 for (GpxTrackSegment segment : trk.getSegments()) { 929 for (WayPoint p : segment.getWayPoints()) { 930 latsum += p.getCoor().lat(); 931 latcnt++; 932 } 933 } 934 } 935 } 936 937 if (near == NEAR_WAYPOINTS || near == NEAR_BOTH) { 938 for (WayPoint p : data.waypoints) { 939 latsum += p.getCoor().lat(); 940 latcnt++; 919 941 } 920 942 } … … 944 966 */ 945 967 LatLon previous = null; 946 for (GpxTrack trk : data.tracks) { 947 for (GpxTrackSegment segment : trk.getSegments()) { 948 for (WayPoint p : segment.getWayPoints()) { 949 LatLon c = p.getCoor(); 950 if (previous == null || c.greatCircleDistance(previous) > buffer_dist) { 951 // we add a buffer around the point. 952 r.setRect(c.lon() - buffer_x, c.lat() - buffer_y, 2 * buffer_x, 2 * buffer_y); 953 a.add(new Area(r)); 954 previous = c; 955 } 968 if (near == NEAR_TRACK || near == NEAR_BOTH) { 969 for (GpxTrack trk : data.tracks) { 970 for (GpxTrackSegment segment : trk.getSegments()) { 971 for (WayPoint p : segment.getWayPoints()) { 972 LatLon c = p.getCoor(); 973 if (previous == null || c.greatCircleDistance(previous) > buffer_dist) { 974 // we add a buffer around the point. 975 r.setRect(c.lon() - buffer_x, c.lat() - buffer_y, 2 * buffer_x, 2 * buffer_y); 976 a.add(new Area(r)); 977 previous = c; 978 } 979 } 980 } 981 } 982 } 983 if (near == NEAR_WAYPOINTS || near == NEAR_BOTH) { 984 for (WayPoint p : data.waypoints) { 985 LatLon c = p.getCoor(); 986 if (previous == null || c.greatCircleDistance(previous) > buffer_dist) { 987 // we add a buffer around the point. 988 r.setRect(c.lon() - buffer_x, c.lat() - buffer_y, 2 * buffer_x, 2 * buffer_y); 989 a.add(new Area(r)); 990 previous = c; 956 991 } 957 992 }
Note:
See TracChangeset
for help on using the changeset viewer.