Changeset 31430 in osm for applications/viewer/jmapviewer
- Timestamp:
- 2015-08-01T23:03:12+02:00 (9 years ago)
- Location:
- applications/viewer/jmapviewer
- Files:
-
- 1 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/viewer/jmapviewer/.project
r31428 r31430 16 16 </arguments> 17 17 </buildCommand> 18 <buildCommand> 19 <name>edu.umd.cs.findbugs.plugin.eclipse.findbugsBuilder</name> 20 <arguments> 21 </arguments> 22 </buildCommand> 18 23 </buildSpec> 19 24 <natures> 20 25 <nature>org.eclipse.jdt.core.javanature</nature> 21 26 <nature>net.sf.eclipsecs.core.CheckstyleNature</nature> 27 <nature>edu.umd.cs.findbugs.plugin.eclipse.findbugsNature</nature> 22 28 </natures> 23 29 </projectDescription> -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/JMapViewer.java
r31429 r31430 44 44 public class JMapViewer extends JPanel implements TileLoaderListener { 45 45 46 public static boolean debug= false;46 public static final boolean DEBUG = false; 47 47 48 48 /** 49 49 * Vectors for clock-wise tile painting 50 50 */ 51 pr otectedstatic final Point[] move = {new Point(1, 0), new Point(0, 1), new Point(-1, 0), new Point(0, -1)};51 private static final Point[] move = {new Point(1, 0), new Point(0, 1), new Point(-1, 0), new Point(0, -1)}; 52 52 53 53 public static final int MAX_ZOOM = 22; 54 54 public static final int MIN_ZOOM = 0; 55 55 56 protected List<MapMarker> mapMarkerList;57 protected List<MapRectangle> mapRectangleList;58 protected List<MapPolygon> mapPolygonList;56 protected transient List<MapMarker> mapMarkerList; 57 protected transient List<MapRectangle> mapRectangleList; 58 protected transient List<MapPolygon> mapPolygonList; 59 59 60 60 protected boolean mapMarkersVisible; … … 65 65 protected boolean scrollWrapEnabled; 66 66 67 protected TileController tileController;67 protected transient TileController tileController; 68 68 69 69 /** … … 91 91 protected transient TileSource tileSource; 92 92 93 protected AttributionSupport attribution = new AttributionSupport();93 protected transient AttributionSupport attribution = new AttributionSupport(); 94 94 95 95 /** -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/JobDispatcher.java
r31429 r31430 34 34 protected BlockingDeque<TileJob> jobQueue = new LinkedBlockingDeque<>(); 35 35 36 pr otectedstatic int workerThreadMaxCount = 8;36 private static int workerThreadMaxCount = 8; 37 37 38 38 /** … … 42 42 * ignores the timeout and will never terminate itself. 43 43 */ 44 pr otectedstatic int workerThreadTimeout = 30;44 private static int workerThreadTimeout = 30; 45 45 46 46 /** -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/OsmMercator.java
r31429 r31430 16 16 * default tile size 17 17 */ 18 public static int DEFAUL_TILE_SIZE = 256;18 public static final int DEFAUL_TILE_SIZE = 256; 19 19 /** maximum latitude (north) for mercator display */ 20 20 public static final double MAX_LAT = 85.05112877980659; … … 128 128 * @return [0..2^Zoomlevel*TILE_SIZE[ 129 129 */ 130 public double LonToX(double aLongitude, int aZoomlevel) {130 public double lonToX(double aLongitude, int aZoomlevel) { 131 131 int mp = getMaxPixels(aZoomlevel); 132 132 double x = (mp * (aLongitude + 180L)) / 360L; … … 151 151 * @return [0..2^Zoomlevel*TILE_SIZE[ 152 152 */ 153 public double LatToY(double aLat, int aZoomlevel) {153 public double latToY(double aLat, int aZoomlevel) { 154 154 if (aLat < MIN_LAT) 155 155 aLat = MIN_LAT; -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/OsmTileLoader.java
r31429 r31430 144 144 } catch (NumberFormatException e) { 145 145 // ignore malformed Cache-Control headers 146 if (JMapViewer. debug) {146 if (JMapViewer.DEBUG) { 147 147 System.err.println(e.getMessage()); 148 148 } -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/Tile.java
r31429 r31430 27 27 * Hourglass image that is displayed until a map tile has been loaded, except for overlay sources 28 28 */ 29 public static BufferedImage LOADING_IMAGE;29 public static final BufferedImage LOADING_IMAGE = loadImage("images/hourglass.png"); 30 30 31 31 /** 32 32 * Red cross image that is displayed after a loading error, except for overlay sources 33 33 */ 34 public static BufferedImage ERROR_IMAGE;35 36 static{34 public static final BufferedImage ERROR_IMAGE = loadImage("images/error.png"); 35 36 private static BufferedImage loadImage(String path) { 37 37 try { 38 LOADING_IMAGE = ImageIO.read(JMapViewer.class.getResourceAsStream("images/hourglass.png")); 39 ERROR_IMAGE = ImageIO.read(JMapViewer.class.getResourceAsStream("images/error.png")); 38 return ImageIO.read(JMapViewer.class.getResourceAsStream(path)); 40 39 } catch (Exception ex) { 41 40 ex.printStackTrace(); 41 return null; 42 42 } 43 43 } -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/AbstractTMSTileSource.java
r31429 r31430 129 129 @Override 130 130 public int lonToX(double lon, int zoom) { 131 return (int) osmMercator. LonToX(lon, zoom);131 return (int) osmMercator.lonToX(lon, zoom); 132 132 } 133 133 134 134 @Override 135 135 public int latToY(double lat, int zoom) { 136 return (int) osmMercator. LatToY(lat, zoom);136 return (int) osmMercator.latToY(lat, zoom); 137 137 } 138 138 … … 140 140 public Point latLonToXY(double lat, double lon, int zoom) { 141 141 return new Point( 142 (int) osmMercator. LonToX(lon, zoom),143 (int) osmMercator. LatToY(lat, zoom)142 (int) osmMercator.lonToX(lon, zoom), 143 (int) osmMercator.latToY(lat, zoom) 144 144 ); 145 145 } … … 175 175 @Override 176 176 public double latToTileY(double lat, int zoom) { 177 return osmMercator. LatToY(lat, zoom) / tileSize;177 return osmMercator.latToY(lat, zoom) / tileSize; 178 178 } 179 179 180 180 @Override 181 181 public double lonToTileX(double lon, int zoom) { 182 return osmMercator. LonToX(lon, zoom) / tileSize;182 return osmMercator.lonToX(lon, zoom) / tileSize; 183 183 } 184 184 … … 186 186 public TileXY latLonToTileXY(double lat, double lon, int zoom) { 187 187 return new TileXY( 188 osmMercator. LonToX(lon, zoom) / tileSize,189 osmMercator. LatToY(lat, zoom) / tileSize188 osmMercator.lonToX(lon, zoom) / tileSize, 189 osmMercator.latToY(lat, zoom) / tileSize 190 190 ); 191 191 } -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/BingAerialTileSource.java
r31429 r31430 196 196 for (int i = 0; i < 5 && getAttribution() == null; i++) { 197 197 // Makes sure attribution is loaded 198 if (JMapViewer. debug) {198 if (JMapViewer.DEBUG) { 199 199 System.out.println("Bing attribution attempt " + (i+1)); 200 200 } -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/TemplatedTMSTileSource.java
r31429 r31430 90 90 if (m.matches()) { 91 91 if (m.group(1) != null) { 92 finalZoom = Integer. valueOf(m.group(1))-zoom;92 finalZoom = Integer.parseInt(m.group(1))-zoom; 93 93 } 94 94 if (m.group(2) != null) { … … 96 96 if (ofs.startsWith("+")) 97 97 ofs = ofs.substring(1); 98 finalZoom += Integer. valueOf(ofs);98 finalZoom += Integer.parseInt(ofs); 99 99 } 100 100 } -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/TileSourceInfo.java
r31429 r31430 13 13 public class TileSourceInfo { 14 14 /** id for this imagery entry, optional at the moment */ 15 protected String id; 15 private final String id; 16 16 17 /** URL of the imagery service */ 17 pr otected String url = null;18 private final String url; 18 19 19 20 /** name of the imagery layer */ 20 pr otectedString name;21 private final String name; 21 22 22 23 /** headers meaning, that there is no tile at this zoom level */ … … 46 47 */ 47 48 public TileSourceInfo(String name, String base_url, String id) { 48 this (name);49 this.name = name; 49 50 this.url = base_url; 50 51 this.id = id; … … 57 58 */ 58 59 public TileSourceInfo(String name) { 59 this .name = name;60 this(name, null, null); 60 61 } 61 62 … … 64 65 */ 65 66 public TileSourceInfo() { 67 this(null, null, null); 66 68 } 67 69 … … 70 72 * @return name of the tile source 71 73 */ 72 public String getName() {74 public final String getName() { 73 75 return name; 74 76 } … … 78 80 * @return url of the tile source 79 81 */ 80 public String getUrl() {82 public final String getUrl() { 81 83 return url; 84 } 85 86 /** 87 * Request ID of the tile source 88 * @return id of the tile source 89 */ 90 public final String getId() { 91 return id; 82 92 } 83 93
Note:
See TracChangeset
for help on using the changeset viewer.