Changeset 7816 in josm for trunk/src/org/openstreetmap/josm/data
- Timestamp:
- 2014-12-17T01:49:45+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/ProjectionBounds.java
r6830 r7816 84 84 } 85 85 86 public boolean hasExtend() { 87 return minEast != maxEast || minNorth != maxNorth; 88 } 86 89 } -
trunk/src/org/openstreetmap/josm/data/ViewportData.java
r6992 r7816 5 5 6 6 /** 7 * Simple data class that keeps map center and scale in one object. 7 * Data class to keep viewport information. 8 * 9 * This can be either a combination of map center and map scale or 10 * a rectangle in east-north coordinate space. 11 * 12 * Either of those will be null, so the consumer of the ViewportData 13 * object has to check, which one is set. 14 * 8 15 * @since 5670 (creation) 9 * @since 6992 (extraction in this package) 16 * @since 6992 (extraction in this package) 10 17 */ 11 18 public class ViewportData { 12 private EastNorth center; 13 private Double scale; 19 private final EastNorth center; 20 private final Double scale; 21 22 private final ProjectionBounds bounds; 14 23 15 24 /** … … 21 30 this.center = center; 22 31 this.scale = scale; 32 this.bounds = null; 33 } 34 35 public ViewportData(ProjectionBounds bounds) { 36 this.center = null; 37 this.scale = null; 38 this.bounds = bounds; 23 39 } 24 40 … … 38 54 return scale; 39 55 } 56 57 /** 58 * Return the bounds in east-north coordinate space. 59 * @return the bounds 60 */ 61 public ProjectionBounds getBounds() { 62 return bounds; 63 } 40 64 } -
trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
r7714 r7816 26 26 import org.openstreetmap.josm.data.Data; 27 27 import org.openstreetmap.josm.data.DataSource; 28 import org.openstreetmap.josm.data.ProjectionBounds; 28 29 import org.openstreetmap.josm.data.SelectionChangedListener; 29 30 import org.openstreetmap.josm.data.coor.EastNorth; … … 39 40 import org.openstreetmap.josm.data.osm.event.TagsChangedEvent; 40 41 import org.openstreetmap.josm.data.osm.event.WayNodesChangedEvent; 42 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; 41 43 import org.openstreetmap.josm.data.projection.Projection; 42 44 import org.openstreetmap.josm.data.projection.ProjectionChangeListener; … … 1348 1350 invalidateEastNorthCache(); 1349 1351 } 1352 1353 public ProjectionBounds getDataSourceBoundingBox() { 1354 BoundingXYVisitor bbox = new BoundingXYVisitor(); 1355 for (DataSource source : dataSources) { 1356 bbox.visit(source.bounds); 1357 } 1358 if (bbox.hasExtend()) { 1359 return bbox.getBounds(); 1360 } 1361 return null; 1362 } 1363 1350 1364 } -
trunk/src/org/openstreetmap/josm/data/osm/visitor/BoundingXYVisitor.java
r7509 r7816 85 85 } 86 86 87 public boolean hasExtend() 88 { 89 return bounds != null && !bounds.getMin().equals(bounds.getMax()); 87 public boolean hasExtend() { 88 return bounds != null && bounds.hasExtend(); 90 89 } 91 90
Note:
See TracChangeset
for help on using the changeset viewer.