Changeset 33209 in osm for applications/viewer/jmapviewer/src/org
- Timestamp:
- 2017-04-05T11:28:03+02:00 (8 years ago)
- Location:
- applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/Tile.java
r33034 r33209 4 4 import java.awt.Graphics; 5 5 import java.awt.Graphics2D; 6 import java.awt.Point; 6 7 import java.awt.geom.AffineTransform; 7 8 import java.awt.image.BufferedImage; … … 40 41 protected int zoom; 41 42 protected BufferedImage image; 43 protected TileAnchor anchor; 42 44 protected String key; 43 45 protected volatile boolean loaded; // field accessed by multiple threads without any monitors, needs to be volatile … … 75 77 this.ytile = ytile; 76 78 this.zoom = zoom; 77 this. image = image;79 this.setImage(image); 78 80 this.key = getTileKey(source, xtile, ytile, zoom); 79 81 } … … 239 241 } 240 242 241 public void setImage(BufferedImage image) { 242 this.image = image; 243 /** 244 * Get the position of the tile inside the image. 245 * @return the position of the tile inside the image 246 * @see #getImage() 247 */ 248 public TileAnchor getAnchor() { 249 return anchor; 250 } 251 252 public final synchronized void setImage(BufferedImage image) { 253 if (image == null) { 254 this.image = null; 255 this.anchor = null; 256 } else { 257 this.image = image; 258 this.anchor = new TileAnchor( 259 new Point.Double(0, 0), 260 new Point.Double(image.getWidth(), image.getHeight())); 261 } 243 262 } 244 263 245 264 public void loadImage(InputStream input) throws IOException { 246 image =ImageIO.read(input);265 setImage(ImageIO.read(input)); 247 266 } 248 267 -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/interfaces/TileSource.java
r33207 r33209 98 98 99 99 /** 100 * Transforms longitude and latitude to pixel space (as if all tiles at specified zoom level where joined). 100 101 * @param lon longitude 101 102 * @param lat latitude 102 103 * @param zoom zoom level 103 * @return t ransforms longitude and latitude topixelspace (as if all tiles at specified zoom level where joined)104 * @return the pixel coordinates 104 105 */ 105 106 Point latLonToXY(double lat, double lon, int zoom); 106 107 107 108 /** 109 * Transforms longitude and latitude to pixel space (as if all tiles at specified zoom level where joined). 108 110 * @param point point 109 111 * @param zoom zoom level 110 * @return t ransforms longitude and latitude topixelspace (as if all tiles at specified zoom level where joined)112 * @return the pixel coordinates 111 113 */ 112 114 Point latLonToXY(ICoordinate point, int zoom); 113 115 114 116 /** 117 * Transforms a point in pixel space to longitude/latitude (WGS84). 115 118 * @param point point 116 119 * @param zoom zoom level … … 120 123 121 124 /** 122 * 125 * Transforms a point in pixel space to longitude/latitude (WGS84). 123 126 * @param x X coordinate 124 127 * @param y Y coordinate … … 129 132 130 133 /** 134 * Transforms longitude and latitude to tile indices. 131 135 * @param lon longitude 132 136 * @param lat latitude … … 137 141 138 142 /** 139 * 143 * Transforms longitude and latitude to tile indices. 140 144 * @param point point 141 145 * @param zoom zoom level … … 145 149 146 150 /** 147 * @param xy X/Y coordinates 151 * Transforms tile indices to longitude and latitude. 152 * @param xy X/Y tile indices 148 153 * @param zoom zoom level 149 154 * @return WGS84 coordinates of given tile … … 152 157 153 158 /** 154 * 159 * Determines to longitude and latitude of a tile. 160 * (Refers to the tile origin - upper left tile corner) 155 161 * @param tile Tile 156 162 * @return WGS84 coordinates of given tile … … 159 165 160 166 /** 161 * 162 * @param x X coordinate163 * @param y Y coordinate167 * Transforms tile indices to longitude and latitude. 168 * @param x x tile index 169 * @param y y tile index 164 170 * @param zoom zoom level 165 171 * @return WGS84 coordinates of given tile … … 168 174 169 175 /** 170 * @param zoom zoom level 171 * @return maximum X index of tile for specified zoom level 176 * Get maximum x index of tile for specified zoom level. 177 * @param zoom zoom level 178 * @return maximum x index of tile for specified zoom level 172 179 */ 173 180 int getTileXMax(int zoom); 174 181 175 182 /** 176 * 177 * @param zoom zoom level 178 * @return minimum Xindex of tile for specified zoom level183 * Get minimum x index of tile for specified zoom level. 184 * @param zoom zoom level 185 * @return minimum x index of tile for specified zoom level 179 186 */ 180 187 int getTileXMin(int zoom); 181 188 182 189 /** 183 * 184 * @param zoom zoom level 185 * @return maximum Yindex of tile for specified zoom level190 * Get maximum y index of tile for specified zoom level. 191 * @param zoom zoom level 192 * @return maximum y index of tile for specified zoom level 186 193 */ 187 194 int getTileYMax(int zoom); 188 195 189 196 /** 190 * @param zoom zoom level 191 * @return minimum Y index of tile for specified zoom level 197 * Get minimum y index of tile for specified zoom level 198 * @param zoom zoom level 199 * @return minimum y index of tile for specified zoom level 192 200 */ 193 201 int getTileYMin(int zoom); … … 213 221 214 222 /** 215 * Convert tile ind eces (x/y/zoom) into projected coordinates of the tile origin.223 * Convert tile indices (x/y/zoom) into projected coordinates of the tile origin. 216 224 * @param x x tile index 217 225 * @param y z tile index … … 255 263 256 264 /** 257 * Get co ntentreference system for this tile source.265 * Get coordinate reference system for this tile source. 258 266 * 259 267 * E.g. "EPSG:3857" for Google-Mercator. 260 * @return code for the co ntentreference system in use268 * @return code for the coordinate reference system in use 261 269 */ 262 270 String getServerCRS();
Note:
See TracChangeset
for help on using the changeset viewer.