Ignore:
Timestamp:
2009-03-10T13:45:35+01:00 (16 years ago)
Author:
stotz
Message:

consistent code formatting for all source files applied (e.g. indentation by spaces instead of tabs) & patch applied provided by r_x that allows to clear the MemoryTileCache at runtime

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/OsmTileSource.java

    r13035 r14053  
    55public class OsmTileSource {
    66
    7         public static final String MAP_MAPNIK = "http://tile.openstreetmap.org";
    8         public static final String MAP_OSMA = "http://tah.openstreetmap.org/Tiles/tile";
     7    public static final String MAP_MAPNIK = "http://tile.openstreetmap.org";
     8    public static final String MAP_OSMA = "http://tah.openstreetmap.org/Tiles/tile";
    99
    10         protected static abstract class AbstractOsmTileSource implements TileSource {
     10    protected static abstract class AbstractOsmTileSource implements TileSource {
    1111
    12                 public int getMaxZoom() {
    13                         return 18;
    14                 }
     12        public int getMaxZoom() {
     13            return 18;
     14        }
    1515
    16                 public int getMinZoom() {
     16        public int getMinZoom() {
    1717            return 0;
    1818        }
    1919
    20                 public String getTileUrl(int zoom, int tilex, int tiley) {
    21                         return "/" + zoom + "/" + tilex + "/" + tiley + ".png";
    22                 }
     20        public String getTileUrl(int zoom, int tilex, int tiley) {
     21            return "/" + zoom + "/" + tilex + "/" + tiley + ".png";
     22        }
    2323
    24                 @Override
    25                 public String toString() {
    26                         return getName();
    27                 }
     24        @Override
     25        public String toString() {
     26            return getName();
     27        }
    2828
    29                 public String getTileType() {
    30                         return "png";
    31                 }
    32                
    33         }
     29        public String getTileType() {
     30            return "png";
     31        }
    3432
    35         public static class Mapnik extends AbstractOsmTileSource {
     33    }
    3634
    37                 public static String NAME = "Mapnik";
    38                
    39                 public String getName() {
    40                         return NAME;
    41                 }
     35    public static class Mapnik extends AbstractOsmTileSource {
    4236
    43                 @Override
    44                 public String getTileUrl(int zoom, int tilex, int tiley) {
    45                         return MAP_MAPNIK + super.getTileUrl(zoom, tilex, tiley);
    46                 }
     37        public static String NAME = "Mapnik";
    4738
    48                 public TileUpdate getTileUpdate() {
    49                         return TileUpdate.IfNoneMatch;
    50                 }
     39        public String getName() {
     40            return NAME;
     41        }
    5142
    52         }
     43        @Override
     44        public String getTileUrl(int zoom, int tilex, int tiley) {
     45            return MAP_MAPNIK + super.getTileUrl(zoom, tilex, tiley);
     46        }
    5347
    54         public static class CycleMap extends AbstractOsmTileSource {
    55                
    56             private static final String PATTERN = "http://%s.andy.sandbox.cloudmade.com/tiles/cycle/%d/%d/%d.png";
     48        public TileUpdate getTileUpdate() {
     49            return TileUpdate.IfNoneMatch;
     50        }
     51
     52    }
     53
     54    public static class CycleMap extends AbstractOsmTileSource {
     55
     56        private static final String PATTERN = "http://%s.andy.sandbox.cloudmade.com/tiles/cycle/%d/%d/%d.png";
    5757        public static String NAME = "OSM Cycle Map";
    5858
     
    6868        }
    6969
    70                 public String getName() {
    71                         return NAME;
    72                 }
     70        public String getName() {
     71            return NAME;
     72        }
    7373
    74                 public TileUpdate getTileUpdate() {
    75                         return TileUpdate.LastModified;
    76                 }
     74        public TileUpdate getTileUpdate() {
     75            return TileUpdate.LastModified;
     76        }
    7777
    78         }
     78    }
    7979
    80         public static class TilesAtHome extends AbstractOsmTileSource {
     80    public static class TilesAtHome extends AbstractOsmTileSource {
    8181
    82                 public static String NAME = "TilesAtHome";
     82        public static String NAME = "TilesAtHome";
    8383
    84                 public int getMaxZoom() {
    85                         return 17;
    86                 }
     84        public int getMaxZoom() {
     85            return 17;
     86        }
    8787
    88                 public String getName() {
    89                         return NAME;
    90                 }
     88        public String getName() {
     89            return NAME;
     90        }
    9191
    92                 @Override
    93                 public String getTileUrl(int zoom, int tilex, int tiley) {
    94                         return MAP_OSMA + super.getTileUrl(zoom, tilex, tiley);
    95                 }
     92        @Override
     93        public String getTileUrl(int zoom, int tilex, int tiley) {
     94            return MAP_OSMA + super.getTileUrl(zoom, tilex, tiley);
     95        }
    9696
    97                 public TileUpdate getTileUpdate() {
    98                         return TileUpdate.IfModifiedSince;
    99                 }
    100         }
     97        public TileUpdate getTileUpdate() {
     98            return TileUpdate.IfModifiedSince;
     99        }
     100    }
    101101}
Note: See TracChangeset for help on using the changeset viewer.