Changeset 2096 in osm for utils/josm


Ignore:
Timestamp:
2007-02-11T14:38:45+01:00 (18 years ago)
Author:
nick
Message:

srtm2shp added

Location:
utils/josm/plugins/landsat/src/landsat
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • utils/josm/plugins/landsat/src/landsat/LandsatPlugin.java

    r1566 r2096  
    2828                        "New Popular Edition maps - " +
    2929                        "see npemap.org.uk for conditions of use");
     30
     31                /* can now do these always
    3032                task.setEnabled(false);
    3133                npeTask.setEnabled(false);
     34                */
    3235                Main.main.menu.download.downloadTasks.add(task);
    3336                Main.main.menu.download.downloadTasks.add(npeTask);
     
    3538
    3639        public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
     40                /* don't do anything now
    3741                if(oldFrame==null && newFrame!=null) {
    3842                        task.setEnabled(true);
     
    5458                        npeTask.setEnabled(false);
    5559                }
     60                */
    5661        }
    5762}
  • utils/josm/plugins/landsat/src/landsat/OSGBLayer.java

    r1567 r2096  
    1515        throws IOException {
    1616                MapView mv = Main.map.mapView;
     17                initMapView(mv);
    1718                OSGBImage npeImage = new OSGBImage(url);
    1819                npeImage.grab(mv,minlat,minlon,maxlat,maxlon);
  • utils/josm/plugins/landsat/src/landsat/WMSLayer.java

    r1567 r2096  
    6565        {
    6666                MapView mv = Main.map.mapView;
     67                initMapView(mv);
    6768                WMSImage wmsImage = new WMSImage(url);
    6869                wmsImage.grab(mv,minlat,minlon,maxlat,maxlon);
    6970                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                }
    70120        }
    71121
Note: See TracChangeset for help on using the changeset viewer.