Changeset 31434 in osm for applications/viewer
- Timestamp:
- 2015-08-02T17:09:43+02:00 (10 years ago)
- Location:
- applications/viewer/jmapviewer
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/viewer/jmapviewer/.settings/org.sonar.ide.eclipse.core.prefs
r31433 r31434 1 1 eclipse.preferences.version=1 2 2 extraProperties= 3 lastAnalysisDate=143852 56662263 lastAnalysisDate=1438527074033 4 4 projectKey=jmapviewer 5 5 serverUrl=https\://josm.openstreetmap.de/sonar -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/AbstractLayer.java
r31433 r31434 11 11 private Style style; 12 12 private Boolean visible; 13 private Boolean visibleTexts = true;13 private Boolean visibleTexts = Boolean.TRUE; 14 14 15 15 public AbstractLayer(String name) { … … 42 42 setDescription(description); 43 43 setStyle(style); 44 setVisible( true);44 setVisible(Boolean.TRUE); 45 45 46 46 if (parent != null) parent.add(this); -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/DefaultMapController.java
r31433 r31434 23 23 24 24 private static final int MAC_MOUSE_BUTTON3_MASK = MouseEvent.CTRL_DOWN_MASK | MouseEvent.BUTTON1_DOWN_MASK; 25 public DefaultMapController(JMapViewer map) {26 super(map);27 }28 25 29 26 private Point lastDragPoint; … … 38 35 private boolean wheelZoomEnabled = true; 39 36 private boolean doubleClickZoomEnabled = true; 37 38 public DefaultMapController(JMapViewer map) { 39 super(map); 40 } 40 41 41 42 @Override -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/Demo.java
r31433 r31434 202 202 Layer spain = treeMap.addLayer("Spain"); 203 203 map().addMapMarker(new MapMarkerCircle(spain, "La Garena", new Coordinate(40.4838, -3.39), .002)); 204 spain.setVisible( false);204 spain.setVisible(Boolean.FALSE); 205 205 206 206 Layer wales = treeMap.addLayer("UK"); -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/JMapViewer.java
r31433 r31434 92 92 93 93 protected transient AttributionSupport attribution = new AttributionSupport(); 94 95 protected EventListenerList evtListenerList = new EventListenerList(); 94 96 95 97 /** … … 1099 1101 } 1100 1102 1101 protected EventListenerList evtListenerList = new EventListenerList();1102 1103 1103 /** 1104 1104 * @param listener listener to set … … 1120 1120 * @param evt event to dispatch 1121 1121 */ 1122 void fireJMVEvent(JMVCommandEvent evt) { 1122 private void fireJMVEvent(JMVCommandEvent evt) { 1123 1123 Object[] listeners = evtListenerList.getListenerList(); 1124 1124 for (int i = 0; i < listeners.length; i += 2) { -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/JMapViewerTree.java
r31429 r31434 115 115 } 116 116 117 private void setVisibleTexts(AbstractLayer layer, boolean visible) { 117 private static void setVisibleTexts(AbstractLayer layer, boolean visible) { 118 118 layer.setVisibleTexts(visible); 119 119 if (layer instanceof LayerGroup) { -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/JobDispatcher.java
r31430 r31434 21 21 private static final JobDispatcher instance = new JobDispatcher(); 22 22 23 private static int workerThreadMaxCount = 8; 24 25 private BlockingDeque<TileJob> jobQueue = new LinkedBlockingDeque<>(); 26 27 private JobDispatcher() { 28 addWorkerThread().firstThread = true; 29 } 30 23 31 /** 24 32 * @return the singelton instance of the {@link JobDispatcher} … … 27 35 return instance; 28 36 } 29 30 private JobDispatcher() {31 addWorkerThread().firstThread = true;32 }33 34 protected BlockingDeque<TileJob> jobQueue = new LinkedBlockingDeque<>();35 36 private static int workerThreadMaxCount = 8;37 37 38 38 /** … … 47 47 * Type of queue, FIFO if <code>false</code>, LIFO if <code>true</code> 48 48 */ 49 pr otectedboolean modeLIFO = false;49 private boolean modeLIFO = false; 50 50 51 51 /** 52 52 * Total number of worker threads currently idle or active 53 53 */ 54 pr otectedint workerThreadCount = 0;54 private int workerThreadCount = 0; 55 55 56 56 /** 57 57 * Number of worker threads currently idle 58 58 */ 59 pr otectedint workerThreadIdleCount = 0;59 private int workerThreadIdleCount = 0; 60 60 61 61 /** 62 62 * Just an id for identifying an worker thread instance 63 63 */ 64 pr otectedint workerThreadId = 0;64 private int workerThreadId = 0; 65 65 66 66 /** … … 124 124 public class JobThread extends Thread { 125 125 126 Runnable job; 127 boolean firstThread = false; 126 private Runnable job; 127 private boolean firstThread = false; 128 128 129 /** 130 * Constructs a new {@code JobThread}. 131 * @param threadId Thread ID 132 */ 129 133 public JobThread(int threadId) { 130 134 super("OSMJobThread " + threadId); -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/MapMarkerCircle.java
r31433 r31434 21 21 public class MapMarkerCircle extends MapObjectImpl implements MapMarker { 22 22 23 Coordinate coord; 24 double radius; 25 STYLE markerStyle; 23 private Coordinate coord; 24 private double radius; 25 private STYLE markerStyle; 26 26 27 /** 28 * Constructs a new {@code MapMarkerCircle}. 29 * @param coord Coordinates of the map marker 30 * @param radius Radius of the map marker position 31 */ 27 32 public MapMarkerCircle(Coordinate coord, double radius) { 28 33 this(null, null, coord, radius); 29 34 } 30 35 36 /** 37 * Constructs a new {@code MapMarkerCircle}. 38 * @param name Name of the map marker 39 * @param coord Coordinates of the map marker 40 * @param radius Radius of the map marker position 41 */ 31 42 public MapMarkerCircle(String name, Coordinate coord, double radius) { 32 43 this(null, name, coord, radius); 33 44 } 34 45 46 /** 47 * Constructs a new {@code MapMarkerCircle}. 48 * @param layer Layer of the map marker 49 * @param coord Coordinates of the map marker 50 * @param radius Radius of the map marker position 51 */ 35 52 public MapMarkerCircle(Layer layer, Coordinate coord, double radius) { 36 53 this(layer, null, coord, radius); 37 54 } 38 55 56 /** 57 * Constructs a new {@code MapMarkerCircle}. 58 * @param lat Latitude of the map marker 59 * @param lon Longitude of the map marker 60 * @param radius Radius of the map marker position 61 */ 39 62 public MapMarkerCircle(double lat, double lon, double radius) { 40 63 this(null, null, new Coordinate(lat, lon), radius); 41 64 } 42 65 66 /** 67 * Constructs a new {@code MapMarkerCircle}. 68 * @param layer Layer of the map marker 69 * @param lat Latitude of the map marker 70 * @param lon Longitude of the map marker 71 * @param radius Radius of the map marker position 72 */ 43 73 public MapMarkerCircle(Layer layer, double lat, double lon, double radius) { 44 74 this(layer, null, new Coordinate(lat, lon), radius); 45 75 } 46 76 77 /** 78 * Constructs a new {@code MapMarkerCircle}. 79 * @param layer Layer of the map marker 80 * @param name Name of the map marker 81 * @param coord Coordinates of the map marker 82 * @param radius Radius of the map marker position 83 */ 47 84 public MapMarkerCircle(Layer layer, String name, Coordinate coord, double radius) { 48 85 this(layer, name, coord, radius, STYLE.VARIABLE, getDefaultStyle()); 49 86 } 50 87 88 /** 89 * Constructs a new {@code MapMarkerCircle}. 90 * @param layer Layer of the map marker 91 * @param name Name of the map marker 92 * @param coord Coordinates of the map marker 93 * @param radius Radius of the map marker position 94 * @param markerStyle Marker style (fixed or variable) 95 * @param style Graphical style 96 */ 51 97 public MapMarkerCircle(Layer layer, String name, Coordinate coord, double radius, STYLE markerStyle, Style style) { 52 98 super(layer, name, style); -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/MemoryTileCache.java
r31427 r31434 43 43 public synchronized void addTile(Tile tile) { 44 44 CacheEntry entry = createCacheEntry(tile); 45 46 47 48 49 45 hash.put(tile.getKey(), entry); 46 lruTiles.addFirst(entry); 47 if (hash.size() > cacheSize) { 48 removeOldEntries(); 49 } 50 50 } 51 51 … … 116 116 */ 117 117 protected static class CacheEntry { 118 Tile tile; 119 CacheEntry next; 120 CacheEntry prev; 118 private Tile tile; 119 private CacheEntry next; 120 private CacheEntry prev; 121 121 122 122 protected CacheEntry(Tile tile) { … … 137 137 protected int elementCount; 138 138 139 /** 140 * Constructs a new {@code CacheLinkedListElement}. 141 */ 139 142 public CacheLinkedListElement() { 140 143 clear(); … … 208 211 return firstElement; 209 212 } 210 211 213 } 212 214 } -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/OsmTileLoader.java
r31433 r31434 24 24 private final class OsmTileJob implements TileJob { 25 25 private final Tile tile; 26 InputStream input = null; 27 boolean force = false; 26 private InputStream input = null; 27 private boolean force = false; 28 28 29 29 private OsmTileJob(Tile tile) { -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/Style.java
r31429 r31434 60 60 } 61 61 62 private AlphaComposite getAlphaComposite(Color color) { 62 private static AlphaComposite getAlphaComposite(Color color) { 63 63 return color.getAlpha() == 255 ? OPAQUE : TRANSPARENCY; 64 64 } -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/Tile.java
r31430 r31434 89 89 /** 90 90 * Tries to get tiles of a lower or higher zoom level (one or two level 91 * difference) from cache and use it as a placeholder until the tile has 92 * been loaded. 91 * difference) from cache and use it as a placeholder until the tile has been loaded. 93 92 */ 94 93 public void loadPlaceholderFromCache(TileCache cache) { 95 94 BufferedImage tmpImage = new BufferedImage(source.getTileSize(), source.getTileSize(), BufferedImage.TYPE_INT_RGB); 96 95 Graphics2D g = (Graphics2D) tmpImage.getGraphics(); 97 // g.drawImage(image, 0, 0, null);98 96 for (int zoomDiff = 1; zoomDiff < 5; zoomDiff++) { 99 97 // first we check if there are already the 2^x tiles 100 98 // of a higher detail level 101 int zoom _high = zoom + zoomDiff;102 if (zoomDiff < 3 && zoom _high <= JMapViewer.MAX_ZOOM) {99 int zoomHigh = zoom + zoomDiff; 100 if (zoomDiff < 3 && zoomHigh <= JMapViewer.MAX_ZOOM) { 103 101 int factor = 1 << zoomDiff; 104 int xtile _high = xtile << zoomDiff;105 int ytile _high = ytile << zoomDiff;102 int xtileHigh = xtile << zoomDiff; 103 int ytileHigh = ytile << zoomDiff; 106 104 double scale = 1.0 / factor; 107 105 g.setTransform(AffineTransform.getScaleInstance(scale, scale)); … … 109 107 for (int x = 0; x < factor; x++) { 110 108 for (int y = 0; y < factor; y++) { 111 Tile tile = cache.getTile(source, xtile _high + x, ytile_high + y, zoom_high);109 Tile tile = cache.getTile(source, xtileHigh + x, ytileHigh + y, zoomHigh); 112 110 if (tile != null && tile.isLoaded()) { 113 111 paintedTileCount++; … … 122 120 } 123 121 124 int zoom _low = zoom - zoomDiff;125 if (zoom _low >= JMapViewer.MIN_ZOOM) {126 int xtile _low = xtile >> zoomDiff;127 int ytile _low = ytile >> zoomDiff;128 int factor = (1 << zoomDiff);122 int zoomLow = zoom - zoomDiff; 123 if (zoomLow >= JMapViewer.MIN_ZOOM) { 124 int xtileLow = xtile >> zoomDiff; 125 int ytileLow = ytile >> zoomDiff; 126 int factor = 1 << zoomDiff; 129 127 double scale = factor; 130 128 AffineTransform at = new AffineTransform(); 131 int translate _x= (xtile % factor) * source.getTileSize();132 int translate _y= (ytile % factor) * source.getTileSize();133 at.setTransform(scale, 0, 0, scale, -translate _x, -translate_y);129 int translateX = (xtile % factor) * source.getTileSize(); 130 int translateY = (ytile % factor) * source.getTileSize(); 131 at.setTransform(scale, 0, 0, scale, -translateX, -translateY); 134 132 g.setTransform(at); 135 Tile tile = cache.getTile(source, xtile _low, ytile_low, zoom_low);133 Tile tile = cache.getTile(source, xtileLow, ytileLow, zoomLow); 136 134 if (tile != null && tile.isLoaded()) { 137 135 tile.paint(g, 0, 0); -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/TileController.java
r31077 r31434 13 13 protected TileSource tileSource; 14 14 15 JobDispatcher jobDispatcher; 15 protected JobDispatcher jobDispatcher; 16 16 17 17 public TileController(TileSource source, TileCache tileCache, TileLoaderListener listener) { … … 33 33 */ 34 34 public Tile getTile(int tilex, int tiley, int zoom) { 35 int max = (1 << zoom);35 int max = 1 << zoom; 36 36 if (tilex < 0 || tilex >= max || tiley < 0 || tiley >= max) 37 37 return null; -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/checkBoxTree/CheckBoxNodeRenderer.java
r31429 r31434 22 22 private final CheckBoxNodePanel panel = new CheckBoxNodePanel(); 23 23 private final DefaultTreeCellRenderer defaultRenderer = new DefaultTreeCellRenderer(); 24 private final Color selectionForeground, selectionBackground; 25 private final Color textForeground, textBackground; 24 private final Color selectionForeground; 25 private final Color selectionBackground; 26 private final Color textForeground; 27 private final Color textBackground; 26 28 27 protected CheckBoxNodePanel getPanel() { 28 return panel; 29 } 30 29 /** 30 * Constructs a new {@code CheckBoxNodeRenderer}. 31 */ 31 32 public CheckBoxNodeRenderer() { 32 33 final Font fontValue = UIManager.getFont("Tree.font"); … … 43 44 } 44 45 46 protected CheckBoxNodePanel getPanel() { 47 return panel; 48 } 49 45 50 public void addNodeListener(MouseAdapter listener) { 46 51 panel.addMouseListener(listener); 47 52 } 53 48 54 // -- TreeCellRenderer methods -- 49 55 … … 65 71 //panel.label.setText(stringValue); 66 72 67 panel.setSelected( false);73 panel.setSelected(Boolean.FALSE); 68 74 69 75 panel.setEnabled(tree.isEnabled()); -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/checkBoxTree/CheckBoxTree.java
r31429 r31434 90 90 91 91 public static void main(final String[] args) { 92 final DefaultMutableTreeNode root = new DefaultMutableTreeNode(new CheckBoxNodeData("Root", true));92 final DefaultMutableTreeNode root = new DefaultMutableTreeNode(new CheckBoxNodeData("Root", Boolean.TRUE)); 93 93 94 94 final DefaultMutableTreeNode accessibility = -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/interfaces/MapMarker.java
r31433 r31434 17 17 public interface MapMarker extends MapObject, ICoordinate{ 18 18 19 public static enum STYLE {FIXED, VARIABLE} 19 public static enum STYLE { 20 FIXED, 21 VARIABLE 22 } 20 23 21 24 /** -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/AbstractOsmTileSource.java
r31429 r31434 26 26 public AbstractOsmTileSource(String name, String base_url, String id) { 27 27 super(new TileSourceInfo(name, base_url, id)); 28 29 28 } 30 29 -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/AbstractTMSTileSource.java
r31433 r31434 283 283 } 284 284 285 private int getTileMax(int zoom) { 285 private static int getTileMax(int zoom) { 286 286 return (int) Math.pow(2.0, zoom) - 1; 287 287 } -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/BingAerialTileSource.java
r31432 r31434 39 39 public class BingAerialTileSource extends AbstractTMSTileSource { 40 40 41 private static String API_KEY = "Arzdiw4nlOJzRwOz__qailc8NiR31Tt51dN2D7cm57NrnceZnCpgOkmJhNpGoppU"; 41 private static final String API_KEY = "Arzdiw4nlOJzRwOz__qailc8NiR31Tt51dN2D7cm57NrnceZnCpgOkmJhNpGoppU"; 42 42 private static volatile Future<List<Attribution>> attributions; // volatile is required for getAttribution(), see below. 43 43 private static String imageUrlTemplate; … … 57 57 } 58 58 59 /** 60 * Constructs a new {@code BingAerialTileSource}. 61 */ 59 62 public BingAerialTileSource(TileSourceInfo info) { 60 63 super(info); … … 62 65 63 66 protected static class Attribution { 64 String attribution; 65 int minZoom; 66 int maxZoom; 67 Coordinate min; 68 Coordinate max; 67 private String attribution; 68 private int minZoom; 69 private int maxZoom; 70 private Coordinate min; 71 private Coordinate max; 69 72 } 70 73 … … 100 103 imageUrlTemplate = xpath.compile("//ImageryMetadata/ImageUrl/text()").evaluate(document); 101 104 imageUrlTemplate = culturePattern.matcher(imageUrlTemplate).replaceAll(Locale.getDefault().toString()); 102 imageryZoomMax = Integer. parseInt(xpath.compile("//ImageryMetadata/ZoomMax/text()").evaluate(document));105 imageryZoomMax = Integer.valueOf(xpath.compile("//ImageryMetadata/ZoomMax/text()").evaluate(document)); 103 106 104 107 NodeList subdomainTxt = (NodeList) xpath.compile("//ImageryMetadata/ImageUrlSubdomains/string/text()") … … 137 140 attr.minZoom = Integer.parseInt(zoomMinXpath.evaluate(areaNode)); 138 141 139 Double southLat = Double. parseDouble(southLatXpath.evaluate(areaNode));140 Double northLat = Double. parseDouble(northLatXpath.evaluate(areaNode));141 Double westLon = Double. parseDouble(westLonXpath.evaluate(areaNode));142 Double eastLon = Double. parseDouble(eastLonXpath.evaluate(areaNode));142 Double southLat = Double.valueOf(southLatXpath.evaluate(areaNode)); 143 Double northLat = Double.valueOf(northLatXpath.evaluate(areaNode)); 144 Double westLon = Double.valueOf(westLonXpath.evaluate(areaNode)); 145 Double eastLon = Double.valueOf(eastLonXpath.evaluate(areaNode)); 143 146 attr.min = new Coordinate(southLat, westLon); 144 147 attr.max = new Coordinate(northLat, eastLon); … … 281 284 && topLeft.getLat() > attr.min.getLat() && botRight.getLat() < attr.max.getLat()) { 282 285 a.append(attr.attribution); 283 a.append( " ");286 a.append(' '); 284 287 } 285 288 } … … 292 295 } 293 296 294 static String computeQuadTree(int zoom, int tilex, int tiley) { 297 private static String computeQuadTree(int zoom, int tilex, int tiley) { 295 298 StringBuilder k = new StringBuilder(); 296 299 for (int i = zoom; i > 0; i--) { -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/OsmTileSource.java
r31433 r31434 16 16 private static final String[] SERVER = {"a", "b", "c"}; 17 17 18 private int SERVER_NUM= 0;18 private int serverNum = 0; 19 19 20 20 /** … … 27 27 @Override 28 28 public String getBaseUrl() { 29 String url = String.format(this.baseUrl, new Object[] {SERVER[ SERVER_NUM]});30 SERVER_NUM = (SERVER_NUM+ 1) % SERVER.length;29 String url = String.format(this.baseUrl, new Object[] {SERVER[serverNum]}); 30 serverNum = (serverNum + 1) % SERVER.length; 31 31 return url; 32 }33 34 @Override35 public int getMaxZoom() {36 return 19;37 32 } 38 33 … … 52 47 private static final String[] SERVER = {"a", "b", "c"}; 53 48 54 private int SERVER_NUM= 0;49 private int serverNum = 0; 55 50 56 51 /** … … 63 58 @Override 64 59 public String getBaseUrl() { 65 String url = String.format(this.baseUrl, new Object[] {SERVER[ SERVER_NUM]});66 SERVER_NUM = (SERVER_NUM+ 1) % SERVER.length;60 String url = String.format(this.baseUrl, new Object[] {SERVER[serverNum]}); 61 serverNum = (serverNum + 1) % SERVER.length; 67 62 return url; 68 63 } -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/ScanexTileSource.java
r31429 r31434 10 10 * 11 11 * Earth is assumed an ellipsoid in this projection, unlike 12 * sphere in OsmMercator, so latitude calculation differs 13 * a lot. 12 * sphere in OsmMercator, so latitude calculation differs a lot. 14 13 * 15 14 * The longitude calculation is the same as in OsmMercator, … … 21 20 private static final String DEFAULT_URL = "http://maps.kosmosnimki.ru"; 22 21 private static final int DEFAULT_MAXZOOM = 14; 23 private static String API_KEY = "4018C5A9AECAD8868ED5DEB2E41D09F7"; 22 private static final String API_KEY = "4018C5A9AECAD8868ED5DEB2E41D09F7"; 24 23 25 24 private enum ScanexLayer { … … 45 44 46 45 /* IRS by default */ 47 private ScanexLayer Layer = ScanexLayer.IRS;46 private ScanexLayer layer = ScanexLayer.IRS; 48 47 49 48 public ScanexTileSource(TileSourceInfo info) { … … 53 52 for (ScanexLayer layer : ScanexLayer.values()) { 54 53 if (url.equalsIgnoreCase(layer.getName())) { 55 this. Layer = layer;54 this.layer = layer; 56 55 /* 57 56 * Override baseUrl and maxZoom in base class. … … 77 76 tiley = tmp - tiley - 1; 78 77 79 return this.Layer.getUri() + "&apikey=" + API_KEY + "&x=" + tilex + "&y=" + tiley + "&z=" + zoom; 80 } 81 82 @Override 83 public TileUpdate getTileUpdate() { 84 return TileUpdate.IfNoneMatch; 78 return this.layer.getUri() + "&apikey=" + API_KEY + "&x=" + tilex + "&y=" + tiley + "&z=" + zoom; 85 79 } 86 80 … … 122 116 * value. 123 117 */ 124 private double cached _lat = 0;118 private double cachedLat = 0; 125 119 private double tileYToLat(double y, int zoom) { 126 double lat0, lat; 127 128 lat = cached_lat; 120 double lat0; 121 double lat = cachedLat; 129 122 do { 130 123 lat0 = lat; 131 lat = lat - Math.toDegrees( NextTerm(Math.toRadians(lat), y, zoom));124 lat = lat - Math.toDegrees(nextTerm(Math.toRadians(lat), y, zoom)); 132 125 if (lat > OsmMercator.MAX_LAT || lat < OsmMercator.MIN_LAT) { 133 126 Random r = new Random(); … … 137 130 } while ((Math.abs(lat0 - lat) > 0.000001)); 138 131 139 cached _lat = lat;132 cachedLat = lat; 140 133 141 return (lat);134 return lat; 142 135 } 143 136 144 137 /* Next term in Newton's polynomial */ 145 private double NextTerm(double lat, double y, int zoom) {138 private static double nextTerm(double lat, double y, int zoom) { 146 139 double sinl = Math.sin(lat); 147 140 double cosl = Math.cos(lat); 148 double ec, f, df;149 141 150 142 zoom = (int) Math.pow(2.0, zoom - 1); 151 ec = Math.exp((1 - y/zoom)*Math.PI); 143 double ec = Math.exp((1 - y/zoom)*Math.PI); 152 144 153 f = (Math.tan(Math.PI/4+lat/2) - 145 double f = (Math.tan(Math.PI/4+lat/2) - 154 146 ec * Math.pow(Math.tan(Math.PI/4 + Math.asin(E * sinl)/2), E)); 155 df = 1/(1 - sinl) - ec * E * cosl/((1 - E * sinl) * 147 double df = 1/(1 - sinl) - ec * E * cosl/((1 - E * sinl) * 156 148 (Math.sqrt(1 - E * E * sinl * sinl))); 157 149 158 return (f/df);150 return f/df; 159 151 } 160 152 }
Note:
See TracChangeset
for help on using the changeset viewer.