Changeset 8619 in josm


Ignore:
Timestamp:
2015-07-26T18:19:24+02:00 (9 years ago)
Author:
wiktorn
Message:

Class cleanup / style fixes.

  • Replace Coordinate with ICoordinate
  • Move @Overriden methods so they are grupped together
  • Move Unsupported operations in one block
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/imagery/TemplatedWMSTileSource.java

    r8618 r8619  
    1515import java.util.regex.Pattern;
    1616
    17 import org.openstreetmap.gui.jmapviewer.Coordinate;
    1817import org.openstreetmap.gui.jmapviewer.OsmMercator;
    1918import org.openstreetmap.gui.jmapviewer.Tile;
     
    169168
    170169    @Override
    171     public double getDistance(double lat1, double lon1, double lat2, double lon2) {
    172         throw new UnsupportedOperationException("Not implemented");
    173     }
    174 
    175     @Override
    176     public int lonToX(double lon, int zoom) {
    177         throw new UnsupportedOperationException("Not implemented");
    178     }
    179 
    180     @Override
    181     public int latToY(double lat, int zoom) {
    182         throw new UnsupportedOperationException("Not implemented");
    183     }
    184 
    185     @Override
    186     public double XToLon(int x, int zoom) {
    187         throw new UnsupportedOperationException("Not implemented");
    188     }
    189 
    190     @Override
    191     public double YToLat(int y, int zoom) {
    192         throw new UnsupportedOperationException("Not implemented");
    193     }
    194 
    195     @Override
    196     public double latToTileY(double lat, int zoom) {
    197         throw new UnsupportedOperationException("Not implemented");
    198     }
    199 
    200     @Override
    201     public Coordinate tileXYToLatLon(Tile tile) {
     170    public String getTileId(int zoom, int tilex, int tiley) {
     171        return getTileUrl(zoom, tilex, tiley);
     172    }
     173
     174    @Override
     175    public ICoordinate tileXYToLatLon(Tile tile) {
    202176        return tileXYToLatLon(tile.getXtile(), tile.getYtile(), tile.getZoom());
    203177    }
    204178
    205179    @Override
    206     public Coordinate tileXYToLatLon(TileXY xy, int zoom) {
     180    public ICoordinate tileXYToLatLon(TileXY xy, int zoom) {
    207181        return tileXYToLatLon(xy.getXIndex(), xy.getYIndex(), zoom);
    208182    }
    209183
    210184    @Override
    211     public Coordinate tileXYToLatLon(int x, int y, int zoom) {
    212         LatLon ret = Main.getProjection().eastNorth2latlon(getTileEastNorth(x, y, zoom));
    213         return new Coordinate(ret.lat(),  ret.lon());
     185    public ICoordinate tileXYToLatLon(int x, int y, int zoom) {
     186        return Main.getProjection().eastNorth2latlon(getTileEastNorth(x, y, zoom)).toCoordinate();
    214187    }
    215188
     
    268241
    269242    @Override
    270     public Coordinate XYToLatLon(Point point, int zoom) {
     243    public ICoordinate XYToLatLon(Point point, int zoom) {
    271244        return XYToLatLon(point.x, point.y, zoom);
    272245    }
    273246
    274247    @Override
    275     public Coordinate XYToLatLon(int x, int y, int zoom) {
     248    public ICoordinate XYToLatLon(int x, int y, int zoom) {
    276249        double scale = getDegreesPerTile(zoom) / getTileSize();
    277250        Projection proj = Main.getProjection();
     
    280253                topLeftCorner.north() - y * scale
    281254                );
    282         LatLon ll = proj.eastNorth2latlon(ret);
    283         return new Coordinate(ll.lat(), ll.lon());
    284     }
    285 
    286     @Override
    287     public double lonToTileX(double lon, int zoom) {
    288         throw new UnsupportedOperationException("Not implemented");
    289     }
    290 
    291     @Override
    292     public double tileXToLon(int x, int zoom) {
    293         throw new UnsupportedOperationException("Not implemented");
    294     }
    295 
    296     @Override
    297     public double tileYToLat(int y, int zoom) {
    298         throw new UnsupportedOperationException("Not implemented");
     255        return proj.eastNorth2latlon(ret).toCoordinate();
    299256    }
    300257
     
    302259    public Map<String, String> getHeaders() {
    303260        return headers;
     261    }
     262
     263    @Override
     264    public double lonToTileX(double lon, int zoom) {
     265        throw new UnsupportedOperationException("Not implemented");
     266    }
     267
     268    @Override
     269    public double tileXToLon(int x, int zoom) {
     270        throw new UnsupportedOperationException("Not implemented");
     271    }
     272
     273    @Override
     274    public double tileYToLat(int y, int zoom) {
     275        throw new UnsupportedOperationException("Not implemented");
     276    }
     277
     278    @Override
     279    public double getDistance(double lat1, double lon1, double lat2, double lon2) {
     280        throw new UnsupportedOperationException("Not implemented");
     281    }
     282
     283    @Override
     284    public int lonToX(double lon, int zoom) {
     285        throw new UnsupportedOperationException("Not implemented");
     286    }
     287
     288    @Override
     289    public int latToY(double lat, int zoom) {
     290        throw new UnsupportedOperationException("Not implemented");
     291    }
     292
     293    @Override
     294    public double XToLon(int x, int zoom) {
     295        throw new UnsupportedOperationException("Not implemented");
     296    }
     297
     298    @Override
     299    public double YToLat(int y, int zoom) {
     300        throw new UnsupportedOperationException("Not implemented");
     301    }
     302
     303    @Override
     304    public double latToTileY(double lat, int zoom) {
     305        throw new UnsupportedOperationException("Not implemented");
    304306    }
    305307
     
    378380        return bounds;
    379381    }
    380 
    381     @Override
    382     public String getTileId(int zoom, int tilex, int tiley) {
    383         return getTileUrl(zoom, tilex, tiley);
    384     }
    385382}
Note: See TracChangeset for help on using the changeset viewer.