Ignore:
Timestamp:
2016-08-06T00:52:15+02:00 (8 years ago)
Author:
donvip
Message:

checkstyle

Location:
applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation
Files:
33 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/ColorMap.java

    r32315 r32775  
    1515 *
    1616 */
    17 public class ColorMap {
     17public final class ColorMap {
    1818    private List<ColorMapEntry> colorList;
    1919    private String name;
     
    6767
    6868                // interpolate color between both
    69                 double val = (elevation - e1.getEle()) / (double)(e2.getEle() - e1.getEle());
     69                double val = (elevation - e1.getEle()) / (double) (e2.getEle() - e1.getEle());
    7070                return interpolate(e1.getColor(), e2.getColor(), val);
    7171            }
     
    165165    }
    166166
    167 
    168167    class ColorMapEntry implements Comparable<ColorMapEntry> {
    169168        private final int ele; // limit
    170169        private final Color color;
    171170
    172         public ColorMapEntry(Color color, int ele) {
     171        ColorMapEntry(Color color, int ele) {
    173172            super();
    174173            this.color = color;
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/ElevationHelper.java

    r32315 r32775  
    1616 * Provides methods to access way point attributes and some utility methods regarding elevation stuff (
    1717 * e. g. special text formats, unit conversion, geoid calc).
    18  * @author Oliver Wieland <oliver.wieland@online.de>
     18 * @author Oliver Wieland &lt;oliver.wieland@online.de&gt;
    1919 */
    20 public class ElevationHelper {
     20public final class ElevationHelper {
     21
     22    private ElevationHelper() {
     23        // Hide default constructor for utilities classes
     24    }
     25
    2126    public static double METER_TO_FEET = 3.280948;
    2227
    2328    /* Countries which use the imperial system instead of the metric system. */
    24     private static String IMPERIAL_SYSTEM_COUNTRIES[] = {
    25         "en_US",     /* USA */
    26         "en_CA",    /* Canada */
    27         "en_AU",    /* Australia */
    28         "en_NZ",    /* New Zealand */
    29         //        "de_DE",    /* for testing only */
    30         "en_ZA"    /* South Africa */
     29    private static String[] IMPERIAL_SYSTEM_COUNTRIES = {
     30            "en_US",     /* USA */
     31            "en_CA",    /* Canada */
     32            "en_AU",    /* Australia */
     33            "en_NZ",    /* New Zealand */
     34            //        "de_DE",    /* for testing only */
     35            "en_ZA"    /* South Africa */
    3136    };
    3237
     
    4853    /**
    4954     * Gets the current mode of GEOID correction.
    50      * @return
    5155     */
    5256    public static GeoidCorrectionKind getGeoidKind() {
     
    6064    /**
    6165     * Gets the current unit mode (metric or imperial).
    62      * @return
    6366     */
    6467    public static UnitMode getUnitMode() {
     
    8891    /**
    8992     * Gets the unit string for elevation ("m" or "ft").
    90      * @return
    9193     */
    9294    public static String getUnit() {
     
    148150        }
    149151    }
    150 
    151152
    152153    private static double getElevation(LatLon ll) {
     
    211212    /**
    212213     * Gets the elevation string for a given elevation, e. g "300m" or "800ft".
    213      * @param elevation
    214      * @return
    215214     */
    216215    public static String getElevationText(int elevation) {
     
    220219    /**
    221220     * Gets the elevation string for a given elevation, e. g "300m" or "800ft".
    222      * @param elevation
    223      * @return
    224221     */
    225222    public static String getElevationText(double elevation) {
    226         return String.format("%d %s", (int)Math.round(elevation), getUnit());
     223        return String.format("%d %s", (int) Math.round(elevation), getUnit());
    227224    }
    228225
     
    236233        if (wpt == null) return "-";
    237234
    238         int elevation = (int)Math.round(ElevationHelper.getElevation(wpt));
     235        int elevation = (int) Math.round(ElevationHelper.getElevation(wpt));
    239236        return String.format("%d %s", elevation, getUnit());
    240237    }
     
    242239    /**
    243240     * Get the time string for a given way point.
    244      * @param wpt
    245      * @return
    246241     */
    247242    public static String getTimeText(WayPoint wpt) {
     
    287282        LatLon br = bounds.getMax();
    288283
    289         return     isValidElevation(getSrtmElevation(tl)) &&
     284        return isValidElevation(getSrtmElevation(tl)) &&
    290285                isValidElevation(getSrtmElevation(br));
    291286    }
     
    343338    /**
    344339     * Gets the hour value of a way point in 24h format.
    345      * @param wpt
    346      * @return
    347340     */
    348341    public static int getHourOfWayPoint(WayPoint wpt) {
     
    356349    /**
    357350     * Gets the minute value of a way point in 24h format.
    358      * @param wpt
    359      * @return
    360351     */
    361352    public static int getMinuteOfWayPoint(WayPoint wpt) {
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/ElevationMapMode.java

    r30344 r32775  
    1010
    1111/**
    12  * @author Oliver Wieland <oliver.wieland@online.de>
     12 * @author Oliver Wieland &lt;oliver.wieland@online.de&gt;
    1313 * Provides the map mode and controls visibility of the elevation profile layer/panel.
    1414 */
    1515public class ElevationMapMode extends MapMode implements IElevationModelListener {
    1616    /**
    17      * 
     17     *
    1818     */
    1919    private static final long serialVersionUID = -1011179566962655639L;
    20 
    2120
    2221    public ElevationMapMode(String name, MapFrame mapFrame) {
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/ElevationProfilePlugin.java

    r32443 r32775  
    1818/**
    1919 * Plugin class for displaying an elevation profile of the tracks.
    20  * @author Oliver Wieland <oliver.wieland@online.de>
     20 * @author Oliver Wieland &lt;oliver.wieland@online.de&gt;
    2121 *
    2222 */
     
    6060     * Gets the elevation profile layer which decorates the current layer
    6161     * with some markers.
    62      * @return
    6362     */
    64     public static ElevationProfileLayer getCurrentLayer(){
    65         if(currentLayer == null){
     63    public static ElevationProfileLayer getCurrentLayer() {
     64        if (currentLayer == null) {
    6665            currentLayer = new ElevationProfileLayer(tr("Elevation Profile"));
    6766            Main.getLayerManager().addLayer(currentLayer);
     
    7473        ColorMap.create("Physical_US",
    7574                new Color[]{
    76                         new Color(18,129,242),
    77                         new Color(113,153,89),
    78                         new Color(117,170,101),
    79                         new Color(149,190,113),
    80                         new Color(178,214,117),
    81                         new Color(202,226,149),
    82                         new Color(222,238,161),
    83                         new Color(242,238,161),
    84                         new Color(238,222,153),
    85                         new Color(242,206,133),
    86                         new Color(234,182,129),
    87                         new Color(218,157,121),
    88                         new Color(194,141,125),
    89                         new Color(214,157,145),
    90                         new Color(226,174,165),
    91                         new Color(222,186,182),
    92                         new Color(238,198,210),
    93                         new Color(255,206,226),
    94                         new Color(250,218,234),
    95                         new Color(255,222,230),
    96                         new Color(255,230,242),
    97                         new Color(255,242,255)
     75                        new Color(18, 129, 242),
     76                        new Color(113, 153, 89),
     77                        new Color(117, 170, 101),
     78                        new Color(149, 190, 113),
     79                        new Color(178, 214, 117),
     80                        new Color(202, 226, 149),
     81                        new Color(222, 238, 161),
     82                        new Color(242, 238, 161),
     83                        new Color(238, 222, 153),
     84                        new Color(242, 206, 133),
     85                        new Color(234, 182, 129),
     86                        new Color(218, 157, 121),
     87                        new Color(194, 141, 125),
     88                        new Color(214, 157, 145),
     89                        new Color(226, 174, 165),
     90                        new Color(222, 186, 182),
     91                        new Color(238, 198, 210),
     92                        new Color(255, 206, 226),
     93                        new Color(250, 218, 234),
     94                        new Color(255, 222, 230),
     95                        new Color(255, 230, 242),
     96                        new Color(255, 242, 255)
    9897        },
    9998                // elevation in meters - the page above uses feet, so these values differs slightly
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/HgtReader.java

    r32315 r32775  
    1919 *
    2020 *  SRTM data files are available at the <a href="http://dds.cr.usgs.gov/srtm/version2_1/SRTM3">NASA SRTM site</a>
    21  *  @author Oliver Wieland <oliver.wieland@online.de>
     21 *  @author Oliver Wieland &lt;oliver.wieland@online.de&gt;
    2222 */
    2323public class HgtReader {
     
    116116
    117117        // compute offset within HGT file
    118         int row = (int)Math.round(fLat * SECONDS_PER_MINUTE / HGT_RES);
    119         int col = (int)Math.round(fLon * SECONDS_PER_MINUTE / HGT_RES);
     118        int row = (int) Math.round(fLat * SECONDS_PER_MINUTE / HGT_RES);
     119        int col = (int) Math.round(fLon * SECONDS_PER_MINUTE / HGT_RES);
    120120
    121121        row = HGT_ROW_LENGTH - row;
    122         int cell = (HGT_ROW_LENGTH* (row - 1)) + col;
     122        int cell = (HGT_ROW_LENGTH * (row - 1)) + col;
    123123
    124124        //System.out.println("Read SRTM elevation data from row/col/cell " + row + "," + col + ", " + cell + ", " + sb.limit());
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/IEleRenderingListener.java

    r30344 r32775  
    1111     * @param vertex the vertex
    1212     */
    13     public void finished(EleVertex vertex);
     13    void finished(EleVertex vertex);
    1414
    1515    /**
    1616     * Notifies a client that all vertices can be rendered now.
    1717     */
    18     public void finishedAll();
     18    void finishedAll();
    1919}
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/IElevationModel.java

    r30344 r32775  
    88    /**
    99     * Adds a model listener to this instance.
    10      * 
     10     *
    1111     * @param listener
    1212     *            The listener to add.
    1313     */
    14     public abstract void addModelListener(IElevationModelListener listener);
     14    void addModelListener(IElevationModelListener listener);
    1515
    1616    /**
    1717     * Removes a model listener from this instance.
    18      * 
     18     *
    1919     * @param listener
    2020     *            The listener to remove.
    2121     */
    22     public abstract void removeModelListener(IElevationModelListener listener);
     22    void removeModelListener(IElevationModelListener listener);
    2323
    2424    /**
    2525     * Removes all listeners from this instance.
    2626     */
    27     public abstract void removeAllListeners();
     27    void removeAllListeners();
    2828
    2929    /**
     
    3232     * @return the profiles
    3333     */
    34     public abstract List<IElevationProfile> getProfiles();
     34    List<IElevationProfile> getProfiles();
    3535
    3636    /**
     
    3939     * @return the current profile
    4040     */
    41     public abstract IElevationProfile getCurrentProfile();
     41    IElevationProfile getCurrentProfile();
    4242
    4343    /**
     
    4646     * @param newProfile the new current profile
    4747     */
    48     public abstract void setCurrentProfile(IElevationProfile newProfile);
     48    void setCurrentProfile(IElevationProfile newProfile);
    4949
    5050    /**
     
    5353     * @param index the new current profile. Valied numbers are 0 to (profileCount - 1)
    5454     */
    55     public abstract void setCurrentProfile(int index);
     55    void setCurrentProfile(int index);
    5656
    5757    /**
     
    6060     * @return the int
    6161     */
    62     public abstract int profileCount();
    63 
     62    int profileCount();
    6463}
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/IElevationModelListener.java

    r30344 r32775  
    88 * repaint UI widgets).
    99 * {@link ElevationModel}
    10  * @author Oliver Wieland <oliver.wieland@online.de>
     10 * @author Oliver Wieland &lt;oliver.wieland@online.de&gt;
    1111 */
    1212public interface IElevationModelListener {
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/IElevationProfile.java

    r30344 r32775  
    99
    1010/**
    11  * @author Oliver Wieland <oliver.wieland@online.de>
     11 * @author Oliver Wieland &lt;oliver.wieland@online.de&gt;
    1212 * Interface for an elevation profile providing special properties/values.
    1313 */
     
    1515    /**
    1616     * Gets the name of the elevation profile.
    17      * @return
    1817     */
    19     public abstract String getName();
     18    String getName();
    2019
    2120    /**
    2221     * Gets the time stamp of first recorded track point.
    23      * @return
    2422     */
    25     public abstract Date getStart();
     23    Date getStart();
    2624
    2725    /**
    2826     * Gets the time stamp of last recorded track point.
    29      * @return
    3027     */
    31     public abstract Date getEnd();
     28    Date getEnd();
    3229
    3330    /**
    3431     * Gets the minimum elevation height of all tracks and routes.
    35      * @return
    3632     */
    37     public abstract int getMinHeight();
     33    int getMinHeight();
    3834
    3935    /**
    4036     * Gets the maximum elevation height of all tracks and routes.
    41      * @return
    4237     */
    43     public abstract int getMaxHeight();
     38    int getMaxHeight();
    4439
    4540    /**
    4641     * Gets the distance of the track in kilometers.
    4742     */
    48     public abstract double getDistance();
     43    double getDistance();
    4944
    5045    /**
    5146     * Gets the average elevation height of all tracks and routes.
    52      * @return
    5347     */
    54     public abstract int getAverageHeight();
     48    int getAverageHeight();
    5549
    5650    /**
    5751     * Gets the difference between min and max elevation.
    58      * @return
    5952     */
    60     public int getHeightDifference();
     53    int getHeightDifference();
    6154
    6255    /**
    6356     * Gets the elevation gain.
    64      *
    65      * @return
     57     *
    6658     */
    67     public int getGain();
     59    int getGain();
    6860
    6961    /**
    7062     * Gets the total number of way points (sum of all way points of all tracks and routes).
    71      * @return
    7263     */
    73     public abstract int getNumberOfWayPoints();
     64    int getNumberOfWayPoints();
    7465
    7566    /**
    7667     * Gets the list containing the way points.
    77      * @return
    7868     */
    79     public List<WayPoint> getWayPoints();
     69    List<WayPoint> getWayPoints();
    8070
    8171    /**
    8272     * Gets the first recorded way point.
    83      * @return
    8473     */
    85     public WayPoint getStartWayPoint();
     74    WayPoint getStartWayPoint();
    8675
    8776    /**
    8877     * Gets the last recorded way point.
    89      * @return
    9078     */
    91     public WayPoint getEndWayPoint();
     79    WayPoint getEndWayPoint();
    9280
    9381    /**
    9482     * Gets the way point with the highest elevation value.
    95      * @return
    9683     */
    97     public WayPoint getMaxWayPoint();
     84    WayPoint getMaxWayPoint();
    9885
    9986    /**
    10087     * Gets the way point with the lowest elevation value.
    101      * @return
    10288     */
    103     public WayPoint getMinWayPoint();
     89    WayPoint getMinWayPoint();
    10490
    10591    /**
     
    10793     * contained elevation data or not. This is the case if min
    10894     * and max height are equal.
    109      * @return
    11095     */
    111     public boolean hasElevationData();
     96    boolean hasElevationData();
    11297
    11398    /**
    11499     * Returns the time between start and end of the track.
    115      * @return
    116100     */
    117     public long getTimeDifference();
     101    long getTimeDifference();
    118102
    119103    /**
    120104     * Gets the elevation value for at the given data index point.
    121105     */
    122     public int elevationValueAt(int i);
     106    int elevationValueAt(int i);
    123107
    124108    /**
     
    127111     * @return the bounds
    128112     */
    129     public Bounds getBounds();
     113    Bounds getBounds();
    130114
    131115    /**
    132116     * Gets the children of the segment (maybe null).
    133117     */
    134     public List<IElevationProfile> getChildren();
     118    List<IElevationProfile> getChildren();
    135119
    136120    /**
    137121     * Gets the parent of the elevation profile.
    138122     */
    139     public IElevationProfile getParent();
     123    IElevationProfile getParent();
    140124
    141125    /**
    142126     * Triggers model refresh.
    143127     */
    144     public void updateElevationData();
     128    void updateElevationData();
    145129}
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/IVertexRenderer.java

    r30344 r32775  
    88/**
    99 * The interface IVertexRenderer.
    10  * 
     10 *
    1111 * Implementors should provide a default color map which cannot be unregistered
    1212 */
     
    1919     * @return the elevation color
    2020     */
    21     public Color getElevationColor(EleVertex vertex);
     21    Color getElevationColor(EleVertex vertex);
    2222
    2323    /**
     
    2727     * @param mapToUse the map to use
    2828     */
    29     public void selectColorMap(String name);
    30 
     29    void selectColorMap(String name);
    3130}
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/UnitMode.java

    r30344 r32775  
    33
    44/**
    5  * @author Oliver Wieland <oliver.wieland@online.de>
     5 * @author Oliver Wieland &lt;oliver.wieland@online.de&gt;
    66 * Enumeration for different unit types.
    77 */
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/ElevationModel.java

    r32315 r32775  
    2020 * breaks done into the tracks/routes of a GPX file.
    2121 *
     22 * @author Oliver Wieland &lt;oliver.wieland@online.de&gt;
    2223 * @see IElevationModelTrackListener
    23  * @author Oliver Wieland <oliver.wieland@online.de>
    2424 */
    2525public class ElevationModel implements IGpxVisitor, IElevationModel {
     
    5555    /**
    5656     * Gets the GPX data instance used by this model.
    57      *
    58      * @return
    5957     */
    6058    public GpxData getGpxData() {
     
    119117    @Override
    120118    public void setCurrentProfile(int index) {
    121         if (index < 0 || index >= profileCount()) throw new RuntimeException("Invalid arg for setCurrentProfile: " + index + ", value must be 0.." + profileCount());
     119        if (index < 0 || index >= profileCount())
     120            throw new RuntimeException("Invalid arg for setCurrentProfile: " + index + ", value must be 0.." + profileCount());
    122121
    123122        currentProfileIndex = index;
     
    146145        // we ignore single way points (elevation profile is quite meaningless...)
    147146    }
    148 
    149147
    150148    @Override
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/ElevationProfile.java

    r32315 r32775  
    2929 * {@link IElevationProfile} {@link IGpxWaypointVisitor} {@link GpxIterator}
    3030 *
    31  * @author Oliver Wieland <oliver.wieland@online.de>
     31 * @author Oliver Wieland &lt;oliver.wieland@online.de&gt;
    3232 *
    3333 */
     
    5959    /**
    6060     * Creates a name elevation profile without any way points.
    61      *
    62      * @param name
    6361     */
    6462    public ElevationProfile(String name) {
     
    187185    /**
    188186     * Sets the average height.
    189      * @param avrgHeight
    190187     */
    191188    protected void setAvrgHeight(int avrgHeight) {
     
    195192    /**
    196193     * Sets the very first way point.
    197      * @param wp
    198194     */
    199195    protected void setStart(WayPoint wp) {
     
    204200    /**
    205201     * Sets the very last way point.
    206      * @param wp
    207202     */
    208203    protected void setEnd(WayPoint wp) {
     
    217212    /**
    218213     * Sets the way points of this profile.
    219      *
    220      * @param wayPoints
    221214     */
    222215    public void setWayPoints(List<WayPoint> wayPoints) {
     
    225218            numWayPoints = wayPoints != null ? wayPoints.size() : 0;
    226219            updateValues();
    227 
    228220        }
    229221    }
     
    278270    /**
    279271     * Gets the difference between min and max elevation.
    280      *
    281      * @return
    282272     */
    283273    @Override
     
    288278    /**
    289279     * Gets the elevation gain.
    290      *
    291      * @return
    292280     */
    293281    @Override
     
    303291    /**
    304292     * Sets the distance of the elevation profile.
    305      * @param dist
    306293     */
    307294    protected void setDistance(double dist) {
     
    311298    /**
    312299     * Returns the time between start and end of the track.
    313      * @return
    314300     */
    315301    @Override
     
    363349    @Override
    364350    public int getNumberOfWayPoints() {
    365         return numWayPoints;// wayPoints != null ? wayPoints.size() : 0;
     351        return numWayPoints; // wayPoints != null ? wayPoints.size() : 0;
    366352    }
    367353
     
    380366     * elevation data or not. This is the case if min and max height or both
    381367     * zero.
    382      *
    383      * @return
    384368     */
    385369    @Override
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/ElevationWayPointKind.java

    r30344 r32775  
    33
    44/**
    5  * @author Oliver Wieland <oliver.wieland@online.de>
     5 * @author Oliver Wieland &lt;oliver.wieland@online.de&gt;
    66 * Enumeration which classifies way points within an elevation profile.
    77 */
    88public enum ElevationWayPointKind {
    9     Plain,                 // Simple way point (equal to no or low slope)
    10     Highlighted,            // Highlighted waypoint
    11     StartPoint,            // First way point
    12     EndPoint,            // Last way point
    13     MaxElevation,            // Highest way point
    14     MinElevation,            // Lowest way point
    15     ElevationGainHigh,        // Elevation gain (high slope 15-25%)
    16     ElevationLossHigh,        // Elevation loss (high downward slope)
    17     ElevationGainLow,        // Elevation gain (low slope, 5-14.9%)
    18     ElevationLossLow,        // Elevation loss (low downward slope)
    19     ElevationLevelGain,        // Elevation level gain (e. g. crossed 300m from lower elevation)
    20     ElevationLevelLoss,        // Elevation level (e. g. crossed 300m from higher elevation)
     9    Plain,              // Simple way point (equal to no or low slope)
     10    Highlighted,        // Highlighted waypoint
     11    StartPoint,         // First way point
     12    EndPoint,           // Last way point
     13    MaxElevation,       // Highest way point
     14    MinElevation,       // Lowest way point
     15    ElevationGainHigh,  // Elevation gain (high slope 15-25%)
     16    ElevationLossHigh,  // Elevation loss (high downward slope)
     17    ElevationGainLow,   // Elevation gain (low slope, 5-14.9%)
     18    ElevationLossLow,   // Elevation loss (low downward slope)
     19    ElevationLevelGain, // Elevation level gain (e. g. crossed 300m from lower elevation)
     20    ElevationLevelLoss, // Elevation level (e. g. crossed 300m from higher elevation)
    2121    FullHour            // Full Hour
    2222}
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/GeoidCorrectionKind.java

    r30344 r32775  
    33
    44/**
    5  * @author Oliver Wieland <oliver.wieland@online.de>
     5 * @author Oliver Wieland &lt;oliver.wieland@online.de&gt;
    66 * Enumeration for available elevation correction modes.
    77 */
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/GpxIterator.java

    r30344 r32775  
    1212/**
    1313 * Utility class to apply a visitor on GPX containers (track, route, data).
    14  * @author Oliver Wieland <oliver.wieland@online.de>
     14 * @author Oliver Wieland &lt;oliver.wieland@online.de&gt;
    1515 */
    16 public class GpxIterator {
     16public final class GpxIterator {
    1717    /**
    1818     * Static class, no need to instantiate me.
     
    2323     * Runs the given visitor on a GPX data instance. If one or both
    2424     * arguments are null, this method will return immediately.
    25      * 
     25     *
    2626     * @param data
    2727     *            The GPX data instance.
     
    7474    // ---------------------- Helper methods ----------------
    7575
    76     /**
    77      * @param visitor
    78      * @param trk
    79      */
    8076    private static void visitTrack(IGpxVisitor visitor, GpxTrack trk) {
    8177        if (trk == null) return;
     
    10399            visitor.endTrack(trk);
    104100        }
    105 
    106101    }
    107102
    108     /**
    109      * @param visitor
    110      * @param route
    111      */
    112103    private static void visitRoute(IGpxVisitor visitor, GpxRoute route) {
    113104        if (route == null) return;
     
    121112    }
    122113
    123     /**
    124      * @param data
    125      * @param visitor
    126      */
    127114    private static void visitSingleWaypoints(GpxData data, IGpxVisitor visitor) {
    128115        // isolated way points
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/IGpxVisitor.java

    r30344 r32775  
    99/**
    1010 * Interface for all GPX visitors.
    11  * @author Oliver Wieland <oliver.wieland@online.de>
     11 * @author Oliver Wieland &lt;oliver.wieland@online.de&gt;
    1212 */
    1313public interface IGpxVisitor extends IGpxWaypointVisitor {
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/IGpxWaypointVisitor.java

    r30344 r32775  
    55
    66/**
    7  * @author Oliver Wieland <oliver.wieland@online.de>
     7 * @author Oliver Wieland &lt;oliver.wieland@online.de&gt;
    88 * Interface for all GPX data visitors. Hopefully this will be part of JOSM some day.
    99 */
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/grid/EleVertex.java

    r32315 r32775  
    173173    }
    174174
    175 
    176 
    177 
    178175    class TriangleEdge implements Comparable<TriangleEdge> {
    179176        private final int i;
     
    181178        private final double dist;
    182179
    183         public TriangleEdge(int i, int j, double dist) {
     180        TriangleEdge(int i, int j, double dist) {
    184181            super();
    185182            this.i = i;
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/grid/ElevationGridLayer.java

    r32315 r32775  
    2828
    2929/**
    30  * @author Oliver Wieland <oliver.wieland@online.de>
     30 * @author Oliver Wieland &lt;oliver.wieland@online.de&gt;
    3131 *
    3232 */
     
    4242    private TileSet tileSet;
    4343
    44     /**
    45      * @param info
    46      */
    4744    public ElevationGridLayer(String name) {
    4845        super(name);
     
    8077        }
    8178
    82         for(int x = tileSet.x0; x <= tileSet.x1; x++) {
    83             for(int y = tileSet.y0; y <= tileSet.y1; y++) {
     79        for (int x = tileSet.x0; x <= tileSet.x1; x++) {
     80            for (int y = tileSet.y0; y <= tileSet.y1; y++) {
    8481                Tile t = tileController.getTile(x, y, ELE_ZOOM_LEVEL);
    8582
    8683                if (t != null && t.isLoaded() && t instanceof ElevationGridTile) {
    87                     ((ElevationGridTile)t).paintTile(g, mv, vertexRenderer);
     84                    ((ElevationGridTile) t).paintTile(g, mv, vertexRenderer);
    8885                } else {
    8986                    // give some consolation...
     
    119116                Main.map.repaint(100);
    120117            }
    121         } catch(Exception ex) {
     118        } catch (Exception ex) {
    122119            System.err.println(ex);
    123120            ex.printStackTrace(System.err);
     
    153150        Color oldColor = g.getColor();
    154151        g.setColor(Color.black);
    155         g.drawString(text,x+1,y+1);
     152        g.drawString(text, x+1, y+1);
    156153        g.setColor(oldColor);
    157         g.drawString(text,x,y);
     154        g.drawString(text, x, y);
    158155    }
    159156
     
    165162         * Create a TileSet by known LatLon bbox without layer shift correction
    166163         */
    167         public TileSet(LatLon topLeft, LatLon botRight, int zoom) {
     164        TileSet(LatLon topLeft, LatLon botRight, int zoom) {
    168165            if (zoom == 0)
    169166                return;
     
    186183                y1 = tmp;
    187184            }
    188             tileMax = (int)Math.pow(2.0, zoom);
     185            tileMax = (int) Math.pow(2.0, zoom);
    189186            if (x0 < 0) {
    190187                x0 = 0;
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/grid/ElevationGridTile.java

    r32315 r32775  
    5959
    6060    /**
    61      * Use {@link ElevationGridTile#paintTile(Graphics2D, MapView, IVertexRenderer)} to render the tile as grid. This method just issues a debug text.
     61     * Use {@link ElevationGridTile#paintTile(Graphics2D, MapView, IVertexRenderer)} to render the tile as grid.
     62     * This method just issues a debug text.
    6263     */
    6364    @Override
     
    170171                + ", ytile=" + ytile + "]";
    171172    }
    172 
    173 
    174173}
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/grid/ElevationGridTileController.java

    r32315 r32775  
    1616public class ElevationGridTileController extends TileController {
    1717
    18     /**
    19      * @param source
    20      * @param tileCache
    21      * @param listener
    22      */
    2318    public ElevationGridTileController(TileSource source, TileCache tileCache,
    2419            TileLoaderListener listener, TileLoader loader) {
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/grid/SimpleVertexRenderer.java

    r30344 r32775  
    1414    private ColorMap cMap = null;
    1515
    16     /**
    17      *
    18      */
    1916    public SimpleVertexRenderer() {
    2017        cMap = ColorMap.getMap(ColorMap.getNames()[0]);
     
    2623    }
    2724
    28 
    2925    @Override
    3026    public void selectColorMap(String name) {
    3127        // TODO Auto-generated method stub
    32 
    3328    }
    34 
    3529}
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/DefaultElevationProfileRenderer.java

    r32315 r32775  
    2828/**
    2929 * Provides default rendering for elevation profile layer.
    30  * @author Oliver Wieland <oliver.wieland@online.de>
     30 * @author Oliver Wieland &lt;oliver.wieland@online.de&gt;
    3131 */
    3232public class DefaultElevationProfileRenderer implements
     
    287287
    288288        // coordinates for upwards directed triangle
    289         Point p[] = new Point[3];
     289        Point[] p = new Point[3];
    290290
    291291        for (int i = 0; i < p.length; i++) {
     
    384384        Point2D focus = new Point2D.Float(x - (radius * 0.6f), y
    385385                - (radius * 0.6f));
    386         float[] dist = { 0.1f, 0.2f, 1.0f };
    387         Color[] colors = { firstCol, secondCol, Color.DARK_GRAY };
     386        float[] dist = {0.1f, 0.2f, 1.0f};
     387        Color[] colors = {firstCol, secondCol, Color.DARK_GRAY};
    388388        RadialGradientPaint p = new RadialGradientPaint(center, radius, focus,
    389389                dist, colors, CycleMethod.NO_CYCLE);
     
    414414
    415415    /**
    416      * Draws a label within a filled rounded rectangle with the specified second gradient color (first color is <tt>Color.WHITE<tt>).
     416     * Draws a label within a filled rounded rectangle with the specified second gradient color (first color is <tt>Color.WHITE</tt>).
    417417     *
    418418     * @param s
     
    539539        // nothing to do currently
    540540    }
    541 
    542 
    543541}
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/ElevationColors.java

    r30344 r32775  
    88/**
    99 * Contains some extra predefined colors.
    10  * @author Oliver Wieland <oliver.wieland@online.de>
     10 * @author Oliver Wieland &lt;oliver.wieland@online.de&gt;
    1111 */
    12 public class ElevationColors {
     12public final class ElevationColors {
     13
     14    private ElevationColors() {
     15        // Hide default constructor for utilities classes
     16    }
     17
    1318    public static Color EPDarkBlue = new Color(21, 59, 99);
    1419    public static Color EPMidBlue = new Color(115, 140, 180);
     
    2429        private final int ele; // limit
    2530        private final Color color;
    26         public ColorMapEntry(java.awt.Color color, int ele) {
     31
     32        ColorMapEntry(Color color, int ele) {
    2733            super();
    2834            this.color = color;
     
    3945    }
    4046
    41 
    42 
    4347    private static ColorMapEntry[] colors = new ColorMapEntry[]{
    44         new ColorMapEntry(new Color(0,128, 0), 0),
    45         new ColorMapEntry(new Color(156,187, 105), 1),
    46         new ColorMapEntry(new Color(193,208, 107), 100),
    47         new ColorMapEntry(new Color(244,224, 100), 200),
    48         new ColorMapEntry(new Color(242,216, 149), 500),
    49         new ColorMapEntry(new Color(234,191, 104), 1000),
    50         new ColorMapEntry(new Color(207,169, 96), 2000),
     48            new ColorMapEntry(new Color(0, 128, 0), 0),
     49            new ColorMapEntry(new Color(156, 187, 105), 1),
     50            new ColorMapEntry(new Color(193, 208, 107), 100),
     51            new ColorMapEntry(new Color(244, 224, 100), 200),
     52            new ColorMapEntry(new Color(242, 216, 149), 500),
     53            new ColorMapEntry(new Color(234, 191, 104), 1000),
     54            new ColorMapEntry(new Color(207, 169, 96), 2000),
    5155    };
    52 
    5356
    5457    public static Color getElevationColor(double ele) {
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/ElevationProfileDialog.java

    r32443 r32775  
    4545
    4646/**
    47  * @author Oliver Wieland <oliver.wieland@online.de>
     47 * @author Oliver Wieland &lt;oliver.wieland@online.de&gt;
    4848 * Implements a JOSM ToggleDialog to show the elevation profile. It monitors the
    4949 * connection between layer and elevation profile.
     
    216216    /**
    217217     * Gets the elevation model instance.
    218      * @return
    219218     */
    220219    public IElevationModel getModel() {
     
    236235    /**
    237236     * Gets the associated layer instance of the elevation profile.
    238      * @return
    239237     */
    240238    public ElevationProfileLayer getProfileLayer() {
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/ElevationProfileLayer.java

    r30344 r32775  
    2525 * Layer class to show additional information on the elevation map, e. g. show
    2626 * min/max elevation markers.
    27  * 
    28  * @author Oliver Wieland <oliver.wieland@online.de>
    29  * 
     27 *
     28 * @author Oliver Wieland &lt;oliver.wieland@online.de&gt;
     29 *
    3030 */
    3131public class ElevationProfileLayer extends Layer implements IElevationProfileSelectionListener {
     
    3838    /**
    3939     * Creates a new elevation profile layer
    40      * 
     40     *
    4141     * @param name
    4242     *            The name of the layer.
     
    4848    /**
    4949     * Gets the current elevation profile shown in this layer.
    50      *
    51      * @return
    5250     */
    5351    public IElevationProfile getProfile() {
     
    5755    /**
    5856     * Sets the current elevation profile shown in this layer.
    59      * 
     57     *
    6058     * @param profile
    6159     *            The profile to show in the layer
     
    8179    public Action[] getMenuEntries() {
    8280        // TODO: More entries???
    83         return new Action[] { new LayerListPopup.InfoAction(this) };
     81        return new Action[] {new LayerListPopup.InfoAction(this)};
    8482    }
    8583
     
    159157    /**
    160158     * Checks if the given way point requires special decoration (e. g. elevation gain/loss or level crossing).
    161      * 
     159     *
    162160     * Parameters <tt>ele1</tt> and <tt>ele2</tt> point are used for detecting "level crossings",
    163161     * e. g. 1 to 2 indicate that we crossed the 200m elevation in upward direction
     
    173171
    174172        // normalize elevation to levels
    175         int actLevel = (int)(actEle / Level_Factor);
    176         int lastLevel = (int)(lastEle / Level_Factor);
     173        int actLevel = (int) (actEle / Level_Factor);
     174        int lastLevel = (int) (lastEle / Level_Factor);
    177175        double slope = Math.abs(ElevationHelper.computeSlope(lastWpt.getCoor(), actWpt.getCoor()));
    178176
     
    184182        if (actLevel != lastLevel && Math.abs(actLevel - lastLevel) == 1) {
    185183            if (actLevel > lastLevel) { // we went down?
    186                 kind =ElevationWayPointKind.ElevationLevelGain;
     184                kind = ElevationWayPointKind.ElevationLevelGain;
    187185            } else {
    188                 kind =ElevationWayPointKind.ElevationLevelLoss;
     186                kind = ElevationWayPointKind.ElevationLevelLoss;
    189187            }
    190188        } else { // check for elevation gain or loss
    191189            if (actEle > lastEle) { // we went uphill?
    192190                // TODO: Provide parameters for high/low thresholds
    193                 if (slope > 2) kind =ElevationWayPointKind.ElevationGainLow;
    194                 if (slope > 15) kind =ElevationWayPointKind.ElevationGainHigh;
     191                if (slope > 2) kind = ElevationWayPointKind.ElevationGainLow;
     192                if (slope > 15) kind = ElevationWayPointKind.ElevationGainHigh;
    195193            } else {
    196                 if (slope > 2) kind =ElevationWayPointKind.ElevationLossLow;
    197                 if (slope > 15) kind =ElevationWayPointKind.ElevationLossHigh;
     194                if (slope > 2) kind = ElevationWayPointKind.ElevationLossLow;
     195                if (slope > 15) kind = ElevationWayPointKind.ElevationLossHigh;
    198196            }
    199197        }
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/ElevationProfilePanel.java

    r32315 r32775  
    3232/**
    3333 * Provides the panel showing the elevation profile.
    34  * @author Oliver Wieland <oliver.wieland@online.de>
     34 * @author Oliver Wieland &lt;oliver.wieland@online.de&gt;
    3535 *
    3636 */
     
    6969    /**
    7070     * Gets the elevation profile instance.
    71      * @return
    7271     */
    7372    public IElevationModel getProfile() {
     
    7776    /**
    7877     * Sets the new elevation profile instance.
    79      * @param model
    8078     */
    8179    public void setElevationModel(IElevationModel model) {
     
    8886    /**
    8987     * Gets the plot area coordinates.
    90      * @return
    9188     */
    9289    public Rectangle getPlotArea() {
     
    9693    /**
    9794     * Sets the plot area coordinates.
    98      * @param plotArea
    9995     */
    10096    public void setPlotArea(Rectangle plotArea) {
     
    104100    /**
    105101     * Gets the selected index of the bar.
    106      * @return
    107102     */
    108103    public int getSelectedIndex() {
     
    112107    /**
    113108     * Sets the selected index of the bar.
    114      * @param selectedIndex
    115109     */
    116110    public void setSelectedIndex(int selectedIndex) {
     
    259253    /**
    260254     * Formats the date in a predefined manner: "21. Oct 2010, 12:10".
    261      * @param date
    262      * @return
    263255     */
    264256    private String formatDate(Date date) {
     
    270262    /**
    271263     * Helper function to draw elevation axes.
    272      * @param g
    273264     */
    274265    private void drawElevationLines(Graphics g) {
     
    321312     * Gets the x value of the left border for axes (slightly smaller than the
    322313     * left x).
    323      *
    324      * @return
    325314     */
    326315    private int getPlotLeftAxis() {
     
    330319    /**
    331320     * Gets the x value of the left border.
    332      *
    333      * @return
    334321     */
    335322    private int getPlotLeft() {
     
    339326    /**
    340327     * Gets the horizontal center coordinate (mid between left and right x).
    341      *
    342      * @return
    343328     */
    344329    private int getPlotHCenter() {
     
    348333    /**
    349334     * Gets the vertical center coordinate (mid between top and bottom y).
    350      *
    351      * @return
    352335     */
    353336    private int getPlotVCenter() {
     
    357340    /**
    358341     * Gets the x value of the right border.
    359      *
    360      * @return
    361342     */
    362343    private int getPlotRight() {
     
    374355    /**
    375356     * Gets for an elevation value the according y coordinate in the plot area.
    376      *
    377      * @param elevation
    378357     * @return The y coordinate in the plot area.
    379358     */
     
    394373    /**
    395374     * Draws the elevation profile
    396      *
    397      * @param g
    398375     */
    399376    private void drawProfile(Graphics g) {
     
    511488        WayPoint wpt = getSelectedWayPoint();
    512489        if (wpt != null) {
    513             return  String.format("%s: %s", ElevationHelper.getTimeText(wpt), ElevationHelper.getElevationText(wpt));
     490            return String.format("%s: %s", ElevationHelper.getTimeText(wpt), ElevationHelper.getElevationText(wpt));
    514491        }
    515492
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/IElevationProfileRenderer.java

    r30344 r32775  
    1515 * Second, the layer can simply pass the painting stuff to a renderer without taking care of
    1616 * details.
    17  * 
    18  * @author Oliver Wieland <oliver.wieland@online.de>
     17 *
     18 * @author Oliver Wieland &lt;oliver.wieland@online.de&gt;
    1919 *
    2020 */
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/IElevationProfileSelectionListener.java

    r30344 r32775  
    77    /**
    88     * Notifies clients about selected index changed.
    9      * @param newIndex
    109     */
    11     public void selectedWayPointChanged(WayPoint wpt);
     10    void selectedWayPointChanged(WayPoint wpt);
    1211}
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/TextAlignment.java

    r30344 r32775  
    33
    44/**
    5  * @author Oliver Wieland <oliver.wieland@online.de>
     5 * @author Oliver Wieland &lt;oliver.wieland@online.de&gt;
    66 *
    77 */
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/Triangle.java

    r30344 r32775  
    1313
    1414/**
    15  * @author Oliver Wieland <oliver.wieland@online.de>
     15 * @author Oliver Wieland &lt;oliver.wieland@online.de&gt;
    1616 * Class to represent a triangle shape. {@see java.awt.Shape}.
    1717 */
     
    2121    /**
    2222     * Copy constructor.
    23      * @param p
    2423     */
    2524    public Triangle(Polygon p) {
     
    3130     * Creates a triangle from 3 given points. The points are used without any sanity check, so it is up to
    3231     * the user that the points form a triangle.
    33      * @param p1
    34      * @param p2
    35      * @param p3
    3632     */
    3733    public Triangle(Point p1, Point p2, Point p3) {
     
    4440    /**
    4541     * Draws an outlined triangle.
    46      * @param g
    4742     */
    4843    public void draw(Graphics g) {
     
    5247    /**
    5348     * Draws a filled triangle.
    54      * @param g
    5549     */
    5650    public void fill(Graphics g) {
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/TriangleDir.java

    r30344 r32775  
    33
    44/**
    5  * @author Oliver Wieland <oliver.wieland@online.de>
     5 * @author Oliver Wieland &lt;oliver.wieland@online.de&gt;
    66 *
    77 */
Note: See TracChangeset for help on using the changeset viewer.