Changeset 24682 in osm for applications/editors/josm
- Timestamp:
- 2010-12-10T15:20:03+01:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/tms/TMSLayer.java
r24670 r24682 81 81 { 82 82 tile.setLoaded(true); 83 needRedraw = true;84 83 Main.map.repaint(100); 85 84 tileRequestsOutstanding.remove(tile); … … 106 105 public int currentZoomLevel; 107 106 108 EastNorth lastTopLeft;109 EastNorth lastBotRight;110 private Image bufferImage;111 107 private Tile clickedTile; 112 private boolean needRedraw;113 108 private JPopupMenu tileOptionMenu; 114 109 JCheckBoxMenuItem autoZoomPopup; … … 131 126 void redraw() 132 127 { 133 needRedraw = true;134 128 Main.map.repaint(); 135 129 } … … 158 152 //tileloader = new OsmTileLoader(this); 159 153 tileLoader = new OsmFileCacheTileLoader(this); 160 }161 162 @Override163 public void setOffset(double dx, double dy) {164 super.setOffset(dx, dy);165 needRedraw = true;166 154 } 167 155 … … 364 352 if (debug) 365 353 out("zoomChanged(): " + currentZoomLevel); 366 needRedraw = true;367 354 jobDispatcher.cancelOutstandingJobs(); 368 355 tileRequestsOutstanding.clear(); … … 513 500 public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) { 514 501 boolean done = ((infoflags & (ERROR | FRAMEBITS | ALLBITS)) != 0); 515 needRedraw = true;516 502 if (debug) 517 503 out("imageUpdate() done: " + done + " calling repaint"); … … 754 740 755 741 String tileStatus = tile.getStatus(); 756 if (!tile.isLoaded() ) {742 if (!tile.isLoaded() && TMSPreferences.PROP_DRAW_DEBUG.get()) { 757 743 g.drawString(tr("image " + tileStatus), p.x + 2, texty); 758 744 texty += 1 + fontHeight; … … 911 897 EastNorth topLeft = mv.getEastNorth(0, 0); 912 898 EastNorth botRight = mv.getEastNorth(mv.getWidth(), mv.getHeight()); 913 Graphics2D oldg = g;914 899 915 900 if (botRight.east() == 0.0 || botRight.north() == 0) { … … 918 903 return; 919 904 } 920 921 if (lastTopLeft != null && lastBotRight != null && topLeft.equals(lastTopLeft)922 && botRight.equals(lastBotRight) && bufferImage != null923 && mv.getWidth() == bufferImage.getWidth(null) && mv.getHeight() == bufferImage.getHeight(null)924 && !needRedraw) {925 926 if (debug)927 out("drawing buffered image");928 g.drawImage(bufferImage, 0, 0, null);929 return;930 }931 932 needRedraw = false;933 lastTopLeft = topLeft;934 lastBotRight = botRight;935 bufferImage = mv.createImage(mv.getWidth(), mv.getHeight());936 g = (Graphics2D) bufferImage.getGraphics();937 905 938 906 int zoom = currentZoomLevel; … … 944 912 out("too many tiles, decreasing zoom from " + currentZoomLevel); 945 913 if (decreaseZoomLevel()) 946 this.paint( oldg, mv, bounds);914 this.paint(g, mv, bounds); 947 915 return; 948 916 } … … 964 932 az_disable = true; 965 933 if (increaseZoomLevel()) 966 this.paint( oldg, mv, bounds);934 this.paint(g, mv, bounds); 967 935 az_disable = tmp; 968 936 return; … … 1057 1025 } 1058 1026 1059 oldg.drawImage(bufferImage, 0, 0, null);1060 1061 1027 if (autoZoomEnabled() && lastImageScale != null) { 1062 1028 // If each source image pixel is being stretched into > 3 … … 1066 1032 out("autozoom increase: scale: " + lastImageScale); 1067 1033 increaseZoomLevel(); 1068 this.paint( oldg, mv, bounds);1034 this.paint(g, mv, bounds); 1069 1035 // If each source image pixel is being squished into > 0.32 1070 1036 // of a drawn pixels, zoom out. … … 1073 1039 out("autozoom decrease: scale: " + lastImageScale); 1074 1040 decreaseZoomLevel(); 1075 this.paint( oldg, mv, bounds);1041 this.paint(g, mv, bounds); 1076 1042 } 1077 1043 } 1078 1044 //g.drawString("currentZoomLevel=" + currentZoomLevel, 120, 120); 1079 oldg.setColor(Color.black);1045 g.setColor(Color.black); 1080 1046 if (ts.insane()) { 1081 oldg.drawString("zoom in to load any tiles", 120, 120);1047 g.drawString("zoom in to load any tiles", 120, 120); 1082 1048 } else if (ts.tooLarge()) { 1083 oldg.drawString("zoom in to load more tiles", 120, 120);1049 g.drawString("zoom in to load more tiles", 120, 120); 1084 1050 } else if (ts.tooSmall()) { 1085 oldg.drawString("increase zoom level to see more detail", 120, 120);1051 g.drawString("increase zoom level to see more detail", 120, 120); 1086 1052 } 1087 1053 }// end of paint method
Note:
See TracChangeset
for help on using the changeset viewer.