Ignore:
Timestamp:
2016-07-02T03:55:03+02:00 (9 years ago)
Author:
donvip
Message:

checkstyle

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/imagery_offset_db/src/iodb/CalibrationLayer.java

    r29434 r32528  
     1// License: WTFPL. For details, see LICENSE file.
    12package iodb;
    23
    3 import java.awt.*;
     4import static org.openstreetmap.josm.tools.I18n.tr;
     5
     6import java.awt.BasicStroke;
     7import java.awt.Color;
     8import java.awt.Component;
     9import java.awt.Graphics;
     10import java.awt.Graphics2D;
     11import java.awt.Point;
     12import java.awt.RenderingHints;
     13import java.awt.Stroke;
    414import java.awt.event.ActionEvent;
    515import java.awt.geom.GeneralPath;
    6 import javax.swing.*;
     16
     17import javax.swing.AbstractAction;
     18import javax.swing.Action;
     19import javax.swing.Icon;
     20
    721import org.openstreetmap.josm.Main;
    822import org.openstreetmap.josm.actions.AutoScaleAction;
     
    1428import org.openstreetmap.josm.gui.dialogs.LayerListPopup;
    1529import org.openstreetmap.josm.gui.layer.Layer;
    16 import static org.openstreetmap.josm.tools.I18n.tr;
    1730import org.openstreetmap.josm.tools.ImageProvider;
    1831
     
    2942    private LatLon center;
    3043
    31     public CalibrationLayer( CalibrationObject obj ) {
     44    public CalibrationLayer(CalibrationObject obj) {
    3245        super(tr("Calibration Layer"));
    3346        color = Color.RED;
     
    4053     */
    4154    @Override
    42     public void paint( Graphics2D g, MapView mv, Bounds box ) {
     55    public void paint(Graphics2D g, MapView mv, Bounds box) {
    4356        g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    4457        Stroke oldStroke = g.getStroke();
     
    4659        g.setStroke(new BasicStroke(1));
    4760        LatLon[] geometry = obj.getGeometry();
    48         if( geometry.length == 1 ) {
     61        if (geometry.length == 1) {
    4962            // draw crosshair
    5063            Point p = mv.getPoint(geometry[0]);
     
    5467            g.drawLine(p.x, p.y - 10, p.x, p.y - 20);
    5568            g.drawLine(p.x, p.y + 10, p.x, p.y + 20);
    56         } else if( geometry.length > 1 ) {
     69        } else if (geometry.length > 1) {
    5770            // draw a line
    5871            GeneralPath path = new GeneralPath();
    59             for( int i = 0; i < geometry.length; i++ ) {
     72            for (int i = 0; i < geometry.length; i++) {
    6073                Point p = mv.getPoint(geometry[i]);
    61                 if( i == 0 )
     74                if (i == 0)
    6275                    path.moveTo(p.x, p.y);
    6376                else
     
    7184    @Override
    7285    public Icon getIcon() {
    73         if( icon == null )
     86        if (icon == null)
    7487            icon = ImageProvider.get("calibration_layer");
    7588        return icon;
     
    7790
    7891    @Override
    79     public void mergeFrom( Layer from ) {
    80     }
    81 
    82     @Override
    83     public boolean isMergable( Layer other ) {
     92    public void mergeFrom(Layer from) {
     93    }
     94
     95    @Override
     96    public boolean isMergable(Layer other) {
    8497        return false;
    8598    }
     
    89102     */
    90103    @Override
    91     public void visitBoundingBox( BoundingXYVisitor v ) {
    92         for( LatLon ll : obj.getGeometry() )
     104    public void visitBoundingBox(BoundingXYVisitor v) {
     105        for (LatLon ll : obj.getGeometry()) {
    93106            v.visit(ll);
     107        }
    94108    }
    95109
     
    99113    @Override
    100114    public String getToolTipText() {
    101         if( obj.isDeprecated() )
     115        if (obj.isDeprecated())
    102116            return tr("A deprecated calibration geometry of {0} nodes by {1}", obj.getGeometry().length, obj.getAuthor());
    103117        else
     
    116130    public Action[] getMenuEntries() {
    117131        return new Action[] {
    118             LayerListDialog.getInstance().createShowHideLayerAction(),
    119             LayerListDialog.getInstance().createDeleteLayerAction(),
    120             SeparatorLayerAction.INSTANCE,
    121             new ZoomToLayerAction(),
    122             new SelectColorAction(Color.RED),
    123             new SelectColorAction(Color.CYAN),
    124             new SelectColorAction(Color.YELLOW),
    125             SeparatorLayerAction.INSTANCE,
    126             new LayerListPopup.InfoAction(this)
     132                LayerListDialog.getInstance().createShowHideLayerAction(),
     133                LayerListDialog.getInstance().createDeleteLayerAction(),
     134                SeparatorLayerAction.INSTANCE,
     135                new ZoomToLayerAction(),
     136                new SelectColorAction(Color.RED),
     137                new SelectColorAction(Color.CYAN),
     138                new SelectColorAction(Color.YELLOW),
     139                SeparatorLayerAction.INSTANCE,
     140                new LayerListPopup.InfoAction(this)
    127141        };
    128142    }
     
    134148     */
    135149    public void panToCenter() {
    136         if( center == null ) {
     150        if (center == null) {
    137151            LatLon[] geometry = obj.getGeometry();
    138152            double lat = 0.0;
    139153            double lon = 0.0;
    140             for( int i = 0; i < geometry.length; i++ ) {
     154            for (int i = 0; i < geometry.length; i++) {
    141155                lon += geometry[i].lon();
    142156                lat += geometry[i].lat();
     
    155169        private Color c;
    156170
    157         public SelectColorAction( Color color ) {
     171        SelectColorAction(Color color) {
    158172            super(tr("Change Color"));
    159173            putValue(SMALL_ICON, new SingleColorIcon(color));
     
    161175        }
    162176
    163         public void actionPerformed( ActionEvent e ) {
     177        @Override
     178        public void actionPerformed(ActionEvent e) {
    164179            color = c;
    165180            Main.map.mapView.repaint();
     
    173188        private Color color;
    174189
    175         public SingleColorIcon( Color color ) {
     190        SingleColorIcon(Color color) {
    176191            this.color = color;
    177192        }
    178193
    179         public void paintIcon( Component c, Graphics g, int x, int y ) {
     194        @Override
     195        public void paintIcon(Component c, Graphics g, int x, int y) {
    180196            g.setColor(color);
    181197            g.fillRect(x, y, 24, 24);
    182198        }
    183199
     200        @Override
    184201        public int getIconWidth() {
    185202            return 24;
    186203        }
    187204
     205        @Override
    188206        public int getIconHeight() {
    189207            return 24;
    190208        }
    191 
    192209    }
    193210
     
    197214     */
    198215    class ZoomToLayerAction extends AbstractAction {
    199         public ZoomToLayerAction() {
     216        ZoomToLayerAction() {
    200217            super(tr("Zoom to {0}", tr("layer"))); // to use translation from AutoScaleAction
    201218            putValue(SMALL_ICON, ImageProvider.get("dialogs/autoscale/layer"));
    202219        }
    203220
    204         public void actionPerformed( ActionEvent e ) {
     221        @Override
     222        public void actionPerformed(ActionEvent e) {
    205223            AutoScaleAction.autoScale("layer");
    206224        }
Note: See TracChangeset for help on using the changeset viewer.