Changeset 12438 in osm for applications/editors/josm/plugins
- Timestamp:
- 2008-12-20T14:55:53+01:00 (16 years ago)
- Location:
- applications/editors/josm/plugins/wmsplugin/src/wmsplugin
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/GeorefImage.java
r10705 r12438 23 23 } 24 24 25 public void displace(double dx, double dy) {26 min = new EastNorth(min.east() + dx, min.north() + dy);27 max = new EastNorth(max.east() + dx, max.north() + dy);25 public boolean contains(EastNorth en, double dx, double dy) { 26 return min.east()+dx <= en.east() && en.east() <= max.east()+dx 27 && min.north()+dy <= en.north() && en.north() <= max.north()+dy; 28 28 } 29 29 30 public boolean contains(EastNorth en) { 31 return min.east() <= en.east() && en.east() <= max.east() 32 && min.north() <= en.north() && en.north() <= max.north(); 33 } 34 30 /* this does not take dx and dy offset into account! */ 35 31 public boolean isVisible(NavigatableComponent nc) { 36 32 Point minPt = nc.getPoint(min), maxPt = nc.getPoint(max); … … 41 37 } 42 38 43 public boolean paint(Graphics g, NavigatableComponent nc ) {39 public boolean paint(Graphics g, NavigatableComponent nc, double dx, double dy) { 44 40 if (image == null || min == null || max == null) return false; 45 41 46 Point minPt = nc.getPoint(min), maxPt = nc.getPoint(max); 42 EastNorth mi = new EastNorth(min.east()+dx, min.north()+dy); 43 EastNorth ma = new EastNorth(max.east()+dx, max.north()+dy); 44 Point minPt = nc.getPoint(mi), maxPt = nc.getPoint(ma); 47 45 48 if(!isVisible(nc)) 46 /* this is isVisible() but taking dx, dy into account */ 47 if(!(g.hitClip(minPt.x, maxPt.y, 48 maxPt.x - minPt.x, minPt.y - maxPt.y))) 49 49 return false; 50 50 -
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSAdjustAction.java
r12437 r12438 20 20 21 21 GeorefImage selectedImage; 22 WMSLayer selectedLayer; 22 23 boolean mouseDown; 23 24 EastNorth prevEastNorth; … … 48 49 if (layer.visible && layer instanceof WMSLayer) { 49 50 prevEastNorth=Main.map.mapView.getEastNorth(e.getX(),e.getY()); 50 selectedImage = ((WMSLayer)layer).findImage(prevEastNorth); 51 selectedLayer = ((WMSLayer)layer); 52 selectedImage = selectedLayer.findImage(prevEastNorth); 51 53 if(selectedImage!=null){ 52 54 Main.map.mapView.setCursor … … 66 68 EastNorth eastNorth= 67 69 Main.map.mapView.getEastNorth(e.getX(),e.getY()); 68 if(selectedImage.contains(eastNorth)) { 69 selectedImage.displace(eastNorth.east()-prevEastNorth.east(), 70 eastNorth.north()-prevEastNorth.north()); 71 prevEastNorth = eastNorth; 72 } 70 selectedLayer.displace(eastNorth.east()-prevEastNorth.east(), 71 eastNorth.north()-prevEastNorth.north()); 72 prevEastNorth = eastNorth; 73 73 Main.map.mapView.repaint(); 74 74 } … … 79 79 Main.map.mapView.setCursor(Cursor.getDefaultCursor()); 80 80 selectedImage = null; 81 prevEastNorth = null; 82 selectedLayer = null; 81 83 } 82 84 -
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSLayer.java
r11172 r12438 56 56 protected int day = 10; 57 57 protected int minZoom = 3; 58 protected double dx = 0.0; 59 protected double dy = 0.0; 58 60 protected double pixelPerDegree; 59 61 protected GeorefImage[][] images = new GeorefImage[dax][day]; … … 143 145 for(int x = 0; x<dax; ++x) 144 146 for(int y = 0; y<day; ++y) 145 images[modulo(x,dax)][modulo(y,day)].paint(g, mv );147 images[modulo(x,dax)][modulo(y,day)].paint(g, mv, dx, dy); 146 148 } else 147 149 downloadAndPaintVisible(g, mv); 150 } 151 152 public void displace(double dx, double dy) { 153 this.dx += dx; 154 this.dy += dy; 148 155 } 149 156 … … 162 169 for(int y = bminy; y<bmaxy; ++y){ 163 170 GeorefImage img = images[modulo(x,dax)][modulo(y,day)]; 164 if(!img.paint(g, mv) && !img.downloadingStarted){ 165 //System.out.println(tr("------{0}|{1}|{2}|{3}", modulo(x,dax), modulo(y,day), img.downloadingStarted, img.isVisible(mv))); 171 if(!img.paint(g, mv, dx, dy) && !img.downloadingStarted){ 166 172 img.downloadingStarted = true; 167 173 img.image = null; … … 205 211 for(int y = 0; y<day; ++y) 206 212 if(images[x][y].image!=null && images[x][y].min!=null && images[x][y].max!=null) 207 if(images[x][y].contains(eastNorth ))213 if(images[x][y].contains(eastNorth, dx, dy)) 208 214 return images[x][y]; 209 215 return null;
Note:
See TracChangeset
for help on using the changeset viewer.