Changeset 2096 in osm for utils/josm/plugins/landsat/src/landsat/WMSLayer.java
- Timestamp:
- 2007-02-11T14:38:45+01:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
utils/josm/plugins/landsat/src/landsat/WMSLayer.java
r1567 r2096 65 65 { 66 66 MapView mv = Main.map.mapView; 67 initMapView(mv); 67 68 WMSImage wmsImage = new WMSImage(url); 68 69 wmsImage.grab(mv,minlat,minlon,maxlat,maxlon); 69 70 wmsImages.add(wmsImage); 71 } 72 73 protected void initMapView(MapView mv) 74 { 75 // If there is no data we need to initialise the centre and scale 76 // of the map view, so that we can display the Landsat/OSGB image. 77 // To do this, we centre the map in the centre point of the requested 78 // data, and set the scale so that the requested data is just 79 // completely within the visible area, even if it's a non-square area. 80 81 if(mv.getCenter()==null) 82 { 83 EastNorth centre = Main.proj.latlon2eastNorth 84 (new LatLon(minlat+(maxlat-minlat)/2 , 85 minlon+(maxlon-minlon)/2)), 86 oldBottomLeft = Main.proj.latlon2eastNorth 87 (new LatLon(minlat,minlon)), 88 oldTopRight = Main.proj.latlon2eastNorth 89 (new LatLon(maxlat,maxlon)), 90 bottomLeft, 91 topRight; 92 93 if(oldTopRight.north-oldBottomLeft.north < 94 oldTopRight.east-oldBottomLeft.east) 95 { 96 bottomLeft = new EastNorth 97 ( oldBottomLeft.east(), centre.north() - 98 (oldTopRight.east()-oldBottomLeft.east()/2); 99 topRight = new EastNorth 100 ( oldTopRight.east(), centre.north() + 101 (oldTopRight.east()-oldBottomLeft.east()/2); 102 } 103 else 104 { 105 bottomLeft = new EastNorth 106 ( centre.east() - 107 (oldTopRight.north()-oldBottomLeft.north()/2), 108 oldBottomLeft.north() ); 109 topRight = new EastNorth 110 ( centre.east() + 111 (oldTopRight.north()-oldBottomLeft.north()/2), 112 oldTopRight.north() ); 113 } 114 115 // scale is enPerPixel 116 double scale = (topRight.east()-bottomLeft.east())/ 117 mapView.getWidth(); 118 mv.zoomTo(centre,scale); 119 } 70 120 } 71 121
Note:
See TracChangeset
for help on using the changeset viewer.