Changeset 5381 in josm
- Timestamp:
- 2012-07-30T02:38:20+02:00 (12 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java
r5369 r5381 8 8 import java.util.Collection; 9 9 import java.util.HashSet; 10 import java.util.Iterator; 10 11 import java.util.List; 11 12 import java.util.Set; … … 20 21 import org.openstreetmap.josm.data.imagery.ImageryInfo; 21 22 import org.openstreetmap.josm.data.imagery.ImageryLayerInfo; 23 import org.openstreetmap.josm.data.imagery.Shape; 22 24 import org.openstreetmap.josm.data.osm.DataSet; 23 25 import org.openstreetmap.josm.data.osm.DataSource; … … 255 257 } 256 258 } 259 // Do not suggest layers already in use 257 260 layers.removeAll(ImageryLayerInfo.instance.getLayers()); 261 // For layers containing complex shapes, check that center is in one of its shapes (fix #7910) 262 for (Iterator<ImageryInfo> iti = layers.iterator(); iti.hasNext(); ) { 263 List<Shape> shapes = iti.next().getBounds().getShapes(); 264 if (shapes != null) { 265 boolean found = false; 266 for (Iterator<Shape> its = shapes.iterator(); its.hasNext() && !found; ) { 267 found = its.next().contains(center); 268 } 269 if (!found) { 270 iti.remove(); 271 } 272 } 273 } 274 258 275 if (layers.isEmpty()) { 259 276 return; -
trunk/src/org/openstreetmap/josm/data/imagery/Shape.java
r4423 r5381 10 10 import org.openstreetmap.gui.jmapviewer.Coordinate; 11 11 import org.openstreetmap.josm.data.coor.LatLon; 12 import org.openstreetmap.josm.data.osm.Node; 12 13 import org.openstreetmap.josm.tools.CheckParameterUtil; 14 import org.openstreetmap.josm.tools.Geometry; 13 15 14 16 /** … … 24 26 String[] components = asString.split(separator); 25 27 if (components.length % 2 != 0) 26 throw new IllegalArgumentException(MessageFormat.format("Even number of doubles ex cpected in string, got {0}: {1}", components.length, asString));28 throw new IllegalArgumentException(MessageFormat.format("Even number of doubles expected in string, got {0}: {1}", components.length, asString)); 27 29 for (int i=0; i<components.length; i+=2) { 28 30 addPoint(components[i], components[i+1]); … … 46 48 public List<Coordinate> getPoints() { 47 49 return coords; 50 } 51 52 public boolean contains(LatLon latlon) { 53 if (latlon == null) 54 return false; 55 List<Node> nodes = new ArrayList<Node>(coords.size()); 56 for (Coordinate c : coords) { 57 nodes.add(new Node(new LatLon(c.getLat(), c.getLon()))); 58 } 59 return Geometry.nodeInsidePolygon(new Node(latlon), nodes); 48 60 } 49 61
Note:
See TracChangeset
for help on using the changeset viewer.