Changeset 31830 in osm
- Timestamp:
 - 2015-12-15T17:42:22+01:00 (10 years ago)
 - File:
 - 
      
- 1 edited
 
 
Legend:
- Unmodified
 - Added
 - Removed
 
- 
      
applications/editors/josm/plugins/proj4j/src/org/openstreetmap/josm/plugins/proj4j/Proj4JProjection.java
r31353 r31830 5 5 6 6 import org.openstreetmap.josm.data.Bounds; 7 import org.openstreetmap.josm.data.ProjectionBounds; 7 8 import org.openstreetmap.josm.data.coor.EastNorth; 8 9 import org.openstreetmap.josm.data.coor.LatLon; … … 20 21 public Proj4JProjection(String crsCode) { 21 22 this.crsCode = crsCode; 22 23 23 24 org.osgeo.proj4j.CRSFactory crsFactory = 24 25 new org.osgeo.proj4j.CRSFactory(); … … 86 87 87 88 @Override 89 public ProjectionBounds getWorldBoundsBoxEastNorth() { 90 // TODO: Check if this method does, what it should do. For now it's just a workaround to fix the failing build. 91 // This code is a simplified version of org.openstreetmap.josm.data.projection.AbstractProjection.getWorldBoundsBoxEastNorth() 92 Bounds b = getWorldBoundsLatLon(); 93 // add 4 corners 94 ProjectionBounds result = new ProjectionBounds(latlon2eastNorth(b.getMin())); 95 result.extend(latlon2eastNorth(b.getMax())); 96 result.extend(latlon2eastNorth(new LatLon(b.getMinLat(), b.getMaxLon()))); 97 result.extend(latlon2eastNorth(new LatLon(b.getMaxLat(), b.getMinLon()))); 98 // and trace along the outline 99 double dLon = (b.getMaxLon() - b.getMinLon()) / 1000; 100 double dLat = (b.getMaxLat() - b.getMinLat()) / 1000; 101 for (double lon=b.getMinLon(); lon<b.getMaxLon(); lon += dLon) { 102 result.extend(latlon2eastNorth(new LatLon(b.getMinLat(), lon))); 103 result.extend(latlon2eastNorth(new LatLon(b.getMaxLat(), lon))); 104 } 105 for (double lat=b.getMinLat(); lat<b.getMaxLat(); lat += dLat) { 106 result.extend(latlon2eastNorth(new LatLon(lat, b.getMinLon()))); 107 result.extend(latlon2eastNorth(new LatLon(lat, b.getMaxLon()))); 108 } 109 return result; 110 } 111 112 @Override 88 113 public Bounds getWorldBoundsLatLon() { 89 114 org.osgeo.proj4j.proj.Projection proj = proj4jCRS.getProjection(); … … 96 121 97 122 @Override 98 public double getMetersPerUnit() { 123 public double getMetersPerUnit() { 99 124 return 1.0 / proj4jCRS.getProjection().getFromMetres(); 100 125 }  
  Note:
 See   TracChangeset
 for help on using the changeset viewer.
  