Ignore:
Timestamp:
2018-08-18T02:46:32+02:00 (6 years ago)
Author:
donvip
Message:

rename package, fix checkstyle and javadoc warnings

Location:
applications/editors/josm/plugins/alignways/src
Files:
5 added
1 deleted
2 edited
18 copied

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/alignways/src/org/openstreetmap/josm/plugins/alignways/AlignWaysAction.java

    r34488 r34489  
    1 /**
    2  *
    3  */
    4 package com.tilusnet.josm.plugins.alignways;
     1// License: GPL. For details, see LICENSE file.
     2package org.openstreetmap.josm.plugins.alignways;
    53
    64import static org.openstreetmap.josm.tools.I18n.tr;
     
    1614import org.openstreetmap.josm.data.osm.Node;
    1715import org.openstreetmap.josm.gui.MainApplication;
     16import org.openstreetmap.josm.plugins.alignways.AlignWaysDialog.AligningModeOption;
    1817import org.openstreetmap.josm.tools.Shortcut;
    1918
    20 import com.tilusnet.josm.plugins.alignways.AlignWaysDialog.AligningModeOption;
    21 
    2219/**
    23  * @author tilusnet <tilusnet@gmail.com>
    24  *
     20 * Makes a pair of selected way segments parallel by rotating one of them around a chosen pivot.
     21 * @author tilusnet &lt;tilusnet@gmail.com&gt;
    2522 */
    2623public class AlignWaysAction extends JosmAction {
     
    3532                        + "around a chosen pivot."),
    3633                Shortcut.registerShortcut("tools:alignways", tr("Tool: {0}", tr("Align Ways")),
    37                                 KeyEvent.VK_SPACE, Shortcut.SHIFT)
    38                 , true);
     34                                KeyEvent.VK_SPACE, Shortcut.SHIFT),
     35                true);
    3936        setEnabled(false);
    4037    }
  • applications/editors/josm/plugins/alignways/src/org/openstreetmap/josm/plugins/alignways/AlignWaysAlgnSegment.java

    r34441 r34489  
    1 package com.tilusnet.josm.plugins.alignways;
     1// License: GPL. For details, see LICENSE file.
     2package org.openstreetmap.josm.plugins.alignways;
    23
    34import java.awt.BasicStroke;
     
    2728
    2829/**
    29  * @author tilusnet <tilusnet@gmail.com>
     30 * @author tilusnet &lt;tilusnet@gmail.com&gt;
    3031 *
    3132 * The segment to be aligned to the reference segment. Actions it can do:
     
    4748    private final Color pivotColor = Color.YELLOW;
    4849    private final Color crossColor = pivotColor;
    49     private final Map<Node,ArrayList<WaySegment>> adjWaySegs = new HashMap<>();
     50    private final Map<Node, ArrayList<WaySegment>> adjWaySegs = new HashMap<>();
    5051
    5152    public AlignWaysAlgnSegment(MapView mapview, Point p)
     
    8889    /**
    8990     * Updates the segment's pivot list and sets the rotation pivot to centre.
     91     * @param pivotRef pivot reference
    9092     */
    9193    private void setPivots(PivotLocations pivotRef) {
     
    114116     * @param pp
    115117     *            The pivot location
     118     * @return east/north coordinates of pivot location
    116119     */
    117120    private EastNorth getPivotCoord(PivotLocations pp) {
     
    203206            pnew.setLocation(x, y);
    204207            WaySegment ws = MainApplication.getMap().mapView.getNearestWaySegment(pnew, OsmPrimitive::isUsable);
    205             if (ws != null &&  !ws.equals(this.segment) &&
     208            if (ws != null && !ws.equals(this.segment) &&
    206209                    (ws.getFirstNode().equals(node) || ws.getSecondNode().equals(node))) {
    207210                // We won't want to add a:
  • applications/editors/josm/plugins/alignways/src/org/openstreetmap/josm/plugins/alignways/AlignWaysCmdKeepAngles.java

    r34488 r34489  
    1 /**
    2  *
    3  */
    4 package com.tilusnet.josm.plugins.alignways;
     1// License: GPL. For details, see LICENSE file.
     2package org.openstreetmap.josm.plugins.alignways;
    53
    64import static org.openstreetmap.josm.tools.I18n.tr;
     
    1614import org.openstreetmap.josm.data.osm.WaySegment;
    1715import org.openstreetmap.josm.gui.MainApplication;
    18 
    19 import com.tilusnet.josm.plugins.alignways.geometry.AlignWaysGeomLine;
    20 import com.tilusnet.josm.plugins.alignways.geometry.AlignWaysGeomLine.IntersectionStatus;
    21 import com.tilusnet.josm.plugins.alignways.geometry.AlignWaysGeomPoint;
     16import org.openstreetmap.josm.plugins.alignways.geometry.AlignWaysGeomLine;
     17import org.openstreetmap.josm.plugins.alignways.geometry.AlignWaysGeomLine.IntersectionStatus;
     18import org.openstreetmap.josm.plugins.alignways.geometry.AlignWaysGeomPoint;
    2219
    2320/**
    24  * @author tilusnet <tilusnet@gmail.com>
     21 * @author tilusnet &lt;tilusnet@gmail.com&gt;
    2522 *
    2623 */
     
    3431        // without preserving the angles, i.e. preserving the length.
    3532
    36         Map<Node,EastNorth> calcNodesKeepLength = calculatedNodes;
     33        Map<Node, EastNorth> calcNodesKeepLength = calculatedNodes;
    3734
    3835        // Now we'll proceed with the hypothetical recalculation of the endpoint coordinates
     
    8683
    8784            // Update the calculated node for angle preserving alignment
    88             AlignWaysGeomPoint isectPnt = alignedLineKeepLength.getIntersection(new AlignWaysGeomLine(enAdjOther1.getX(), enAdjOther1.getY(),
    89                                                                                                       endpoint.getEastNorth().getX(), endpoint.getEastNorth().getY()));
     85            AlignWaysGeomPoint isectPnt = alignedLineKeepLength.getIntersection(
     86                    new AlignWaysGeomLine(enAdjOther1.getX(), enAdjOther1.getY(),
     87                            endpoint.getEastNorth().getX(), endpoint.getEastNorth().getY()));
    9088            EastNorth enIsectPt = null;
    9189            // If the intersection is null, the adjacent and the alignee are parallel already:
  • applications/editors/josm/plugins/alignways/src/org/openstreetmap/josm/plugins/alignways/AlignWaysCmdKeepLength.java

    r34488 r34489  
    1 /**
    2  *
    3  */
    4 package com.tilusnet.josm.plugins.alignways;
     1// License: GPL. For details, see LICENSE file.
     2package org.openstreetmap.josm.plugins.alignways;
    53
    64import static org.openstreetmap.josm.tools.I18n.tr;
     
    3028 * needed to align the ways.
    3129 *
    32  * @author tilusnet <tilusnet@gmail.com>
     30 * @author tilusnet &lt;tilusnet@gmail.com&gt;
    3331 */
    3432public class AlignWaysCmdKeepLength extends Command {
     
    4240        ALGN_INV_XPOINT_FALLSOUT            // for AlignWaysCmdKeepAngles
    4341    }
     42
    4443    final AlignWaysAlgnSegment algnSeg;
    4544
     
    5352     * Useful for validation.
    5453     */
    55     final Map<Node,EastNorth> calculatedNodes = new HashMap<>();
     54    final Map<Node, EastNorth> calculatedNodes = new HashMap<>();
    5655
    5756    /**
     
    7978     * Creates an AlignWaysRotateCommand.
    8079     * TODO Limitation (for now): constructor assumes areSegsAlignable() returns true.
     80     * @param ds the data set. Must not be null.
    8181     */
    8282    public AlignWaysCmdKeepLength(DataSet ds) {
     
    164164    /**
    165165     * Make sure angle is in interval ( -Pi/2, Pi/2 ].
     166     * @param a angle
     167     * @return normalized angle
    166168     */
    167169    private double normalise_angle(double a) {
     
    229231     * They are not if they are connected *and* the pivot is not the connection
    230232     * node.
     233     * @return alignable status
    231234     */
    232235    AlignableStatus areSegsAlignable() {
  • applications/editors/josm/plugins/alignways/src/org/openstreetmap/josm/plugins/alignways/AlignWaysDialog.java

    r34441 r34489  
    1 /**
    2  *
    3  */
    4 package com.tilusnet.josm.plugins.alignways;
     1// License: GPL. For details, see LICENSE file.
     2package org.openstreetmap.josm.plugins.alignways;
    53
    64import static org.openstreetmap.josm.tools.I18n.tr;
     
    2523
    2624/**
    27  * @author tilusnet <tilusnet@gmail.com>
     25 * @author tilusnet &lt;tilusnet@gmail.com&gt;
    2826 *
    2927 */
     
    3735        ALGN_OPT_KEEP_ANGLE
    3836    }
     37
    3938    AligningModeOption awOpt;
    4039    JPanel activateInfoPanel, modesPanel, dlgPane;
    41 
    4240
    4341    public AlignWaysDialog(AlignWaysMode awMode) {
     
    103101        infoText.setBorder(BorderFactory.createCompoundBorder(
    104102                BorderFactory.createEtchedBorder(),
    105                 BorderFactory.createEmptyBorder(10, 10, 10, 10) )
     103                BorderFactory.createEmptyBorder(10, 10, 10, 10))
    106104                );
    107105        modesPanel.add(infoText);
  • applications/editors/josm/plugins/alignways/src/org/openstreetmap/josm/plugins/alignways/AlignWaysMode.java

    r34488 r34489  
    1 /**
    2  *
    3  */
    4 package com.tilusnet.josm.plugins.alignways;
     1// License: GPL. For details, see LICENSE file.
     2package org.openstreetmap.josm.plugins.alignways;
    53
    64import static org.openstreetmap.josm.tools.I18n.tr;
     
    3735
    3836/**
    39  * @author tilusnet <tilusnet@gmail.com>
     37 * @author tilusnet &lt;tilusnet@gmail.com&gt;
    4038 * Handles the state machine and user interaction (mouse clicks).
    4139 *
     
    9391    }
    9492
    95 
    9693    @Override
    9794    public void exitMode() {
  • applications/editors/josm/plugins/alignways/src/org/openstreetmap/josm/plugins/alignways/AlignWaysPlugin.java

    r34441 r34489  
    1 package com.tilusnet.josm.plugins.alignways;
     1// License: GPL. For details, see LICENSE file.
     2package org.openstreetmap.josm.plugins.alignways;
    23
    34import static org.openstreetmap.josm.tools.I18n.tr;
     
    1213
    1314/**
    14  * @author tilusnet <tilusnet@gmail.com>
     15 * @author tilusnet &lt;tilusnet@gmail.com&gt;
    1516 *
    1617 */
  • applications/editors/josm/plugins/alignways/src/org/openstreetmap/josm/plugins/alignways/AlignWaysRefSegment.java

    r34441 r34489  
    1 /**
    2  *
    3  */
    4 package com.tilusnet.josm.plugins.alignways;
     1// License: GPL. For details, see LICENSE file.
     2package org.openstreetmap.josm.plugins.alignways;
    53
    64import java.awt.Color;
     
    108
    119/**
    12  * @author tilusnet <tilusnet@gmail.com> The basic segment treated as reference.
    13  * 
     10 * @author tilusnet &lt;tilusnet@gmail.com&gt; The basic segment treated as reference.
     11 *
    1412 */
    1513public class AlignWaysRefSegment extends AlignWaysSegment {
  • applications/editors/josm/plugins/alignways/src/org/openstreetmap/josm/plugins/alignways/AlignWaysSegment.java

    r34441 r34489  
    1 /**
    2  *
    3  */
    4 package com.tilusnet.josm.plugins.alignways;
     1// License: GPL. For details, see LICENSE file.
     2package org.openstreetmap.josm.plugins.alignways;
    53
    64import static org.openstreetmap.josm.tools.I18n.tr;
     
    2624
    2725/**
    28  * @author tilusnet <tilusnet@gmail.com>
     26 * @author tilusnet &lt;tilusnet@gmail.com&gt;
    2927 *
    3028 */
     
    5452        }
    5553    }
    56 
    5754
    5855    void setSegmentEndpoints(WaySegment segment) {
  • applications/editors/josm/plugins/alignways/src/org/openstreetmap/josm/plugins/alignways/AlignWaysSegmentMgr.java

    r34488 r34489  
    1 package com.tilusnet.josm.plugins.alignways;
     1// License: GPL. For details, see LICENSE file.
     2package org.openstreetmap.josm.plugins.alignways;
    23
    34import static org.openstreetmap.josm.tools.I18n.tr;
     
    1819 * manager. Can request alignee, reference segment updates and pivot updates on
    1920 * these.
    20  * 
    21  * @author tilusnet <tilusnet@gmail.com>
    22  * 
     21 *
     22 * @author tilusnet &lt;tilusnet@gmail.com&gt;
     23 *
    2324 */
    24 public class AlignWaysSegmentMgr {
     25public final class AlignWaysSegmentMgr {
    2526
    26     private volatile static AlignWaysSegmentMgr singleton;
     27    private static volatile AlignWaysSegmentMgr singleton;
    2728    private AlignWaysRefSegment refSeg = null;
    2829    private AlignWaysAlgnSegment algnSeg = null;
     
    3536    /**
    3637     * Get or creates the segment manager instance belonging to a given MapView.
     38     * @param mapView Map view
     39     * @return segment manager instance for this map view
    3740     */
    3841    public static AlignWaysSegmentMgr getInstance(MapView mapView) {
     
    7477        if (algnSeg != null && tmpAlgnSeg.equals(algnSeg)) {
    7578            return false;
    76         }
    77         else if (refSeg != null && tmpAlgnSeg.equals(refSeg)) {
     79        } else if (refSeg != null && tmpAlgnSeg.equals(refSeg)) {
    7880            JOptionPane.showMessageDialog(MainApplication.getMainFrame(),
    7981                    tr("Segment to be aligned cannot be the same with the reference segment.\n" +
     
    108110        if (refSeg != null && refSeg.equals(tmpRefSeg)) {
    109111            return false;
    110         }
    111         else if (algnSeg != null && tmpRefSeg.equals(algnSeg)) {
     112        } else if (algnSeg != null && tmpRefSeg.equals(algnSeg)) {
    112113            JOptionPane.showMessageDialog(MainApplication.getMainFrame(),
    113114                    tr("Reference segment cannot be the same with the segment to be aligned.\n" +
     
    165166     * Handles the event that OSM primitives were removed and checks whether
    166167     * this invalidates the currently selected alignee or reference segment.
     168     * @param primitives List of primitives that were removed.
    167169     * @return Whether any of the selected segments were invalidated.
    168      * @param primitives List of primitives that were removed.
    169170     */
    170171    public boolean primitivesRemoved(List<? extends OsmPrimitive> primitives) {
  • applications/editors/josm/plugins/alignways/src/org/openstreetmap/josm/plugins/alignways/AlignWaysSelAlgnState.java

    r34441 r34489  
    1 /**
    2  *
    3  */
    4 package com.tilusnet.josm.plugins.alignways;
     1// License: GPL. For details, see LICENSE file.
     2package org.openstreetmap.josm.plugins.alignways;
    53
    64import static org.openstreetmap.josm.tools.I18n.tr;
     
    97
    108/**
    11  * @author tilusnet <tilusnet@gmail.com>
    12  * 
     9 * @author tilusnet &lt;tilusnet@gmail.com&gt;
     10 *
    1311 */
    1412public class AlignWaysSelAlgnState extends AlignWaysState {
  • applications/editors/josm/plugins/alignways/src/org/openstreetmap/josm/plugins/alignways/AlignWaysSelBothState.java

    r34441 r34489  
    1 /**
    2  *
    3  */
    4 package com.tilusnet.josm.plugins.alignways;
     1// License: GPL. For details, see LICENSE file.
     2package org.openstreetmap.josm.plugins.alignways;
    53
    64import static org.openstreetmap.josm.tools.I18n.tr;
     
    97
    108/**
    11  * @author tilusnet <tilusnet@gmail.com>
    12  * 
     9 * @author tilusnet &lt;tilusnet@gmail.com&gt;
     10 *
    1311 */
    1412public class AlignWaysSelBothState extends AlignWaysState {
  • applications/editors/josm/plugins/alignways/src/org/openstreetmap/josm/plugins/alignways/AlignWaysSelNoneState.java

    r34441 r34489  
    1 /**
    2  *
    3  */
    4 package com.tilusnet.josm.plugins.alignways;
     1// License: GPL. For details, see LICENSE file.
     2package org.openstreetmap.josm.plugins.alignways;
    53
    64import static org.openstreetmap.josm.tools.I18n.tr;
     
    97
    108/**
    11  * @author tilusnet <tilusnet@gmail.com>
    12  * 
     9 * @author tilusnet &lt;tilusnet@gmail.com&gt;
     10 *
    1311 */
    1412public class AlignWaysSelNoneState extends AlignWaysState {
  • applications/editors/josm/plugins/alignways/src/org/openstreetmap/josm/plugins/alignways/AlignWaysSelRefState.java

    r34441 r34489  
    1 /**
    2  *
    3  */
    4 package com.tilusnet.josm.plugins.alignways;
     1// License: GPL. For details, see LICENSE file.
     2package org.openstreetmap.josm.plugins.alignways;
    53
    64import static org.openstreetmap.josm.tools.I18n.tr;
     
    97
    108/**
    11  * @author tilusnet <tilusnet@gmail.com>
    12  * 
     9 * @author tilusnet &lt;tilusnet@gmail.com&gt;
     10 *
    1311 */
    1412public class AlignWaysSelRefState extends AlignWaysState {
  • applications/editors/josm/plugins/alignways/src/org/openstreetmap/josm/plugins/alignways/AlignWaysState.java

    r34441 r34489  
    1 /**
    2  *
    3  */
    4 package com.tilusnet.josm.plugins.alignways;
     1// License: GPL. For details, see LICENSE file.
     2package org.openstreetmap.josm.plugins.alignways;
    53
    64import static org.openstreetmap.josm.tools.I18n.tr;
     
    97
    108/**
    11  * @author tilusnet <tilusnet@gmail.com>
     9 * @author tilusnet &lt;tilusnet@gmail.com&gt;
    1210 *
    1311 */
  • applications/editors/josm/plugins/alignways/src/org/openstreetmap/josm/plugins/alignways/AlignWaysTipsPanel.java

    r34441 r34489  
    1 /**
    2  *
    3  */
    4 package com.tilusnet.josm.plugins.alignways;
     1// License: GPL. For details, see LICENSE file.
     2package org.openstreetmap.josm.plugins.alignways;
    53
    64import static org.openstreetmap.josm.tools.I18n.tr;
     
    2119
    2220/**
    23  * @author tilusnet <tilusnet@gmail.com>
     21 * @author tilusnet &lt;tilusnet@gmail.com&gt;
    2422 *
    2523 */
  • applications/editors/josm/plugins/alignways/src/org/openstreetmap/josm/plugins/alignways/AlignWaysWhatsNewPanel.java

    r34441 r34489  
    1 /**
    2  *
    3  */
    4 package com.tilusnet.josm.plugins.alignways;
     1// License: GPL. For details, see LICENSE file.
     2package org.openstreetmap.josm.plugins.alignways;
    53
    64import static org.openstreetmap.josm.tools.I18n.tr;
    75
    86import java.awt.Desktop;
     7import java.awt.Dimension;
     8import java.awt.event.ActionEvent;
    99import java.io.IOException;
    1010import java.net.URI;
     
    1313import java.util.logging.Logger;
    1414
     15import javax.swing.GroupLayout;
     16import javax.swing.ImageIcon;
     17import javax.swing.JButton;
     18import javax.swing.JLabel;
    1519import javax.swing.JOptionPane;
    1620import javax.swing.JPanel;
     21import javax.swing.JSeparator;
    1722
    1823/**
    19  * @author tilusnet <tilusnet@gmail.com>
     24 * @author tilusnet &lt;tilusnet@gmail.com&gt;
    2025 *
    2126 */
    2227public class AlignWaysWhatsNewPanel extends JPanel {
    23 
    2428
    2529    private static final long serialVersionUID = 3691600157957492583L;
     
    2933    }
    3034
    31     /*** WARNING: The following code section is generated by/for Matisse. Do not modify! ***/
    32 
    33     /** This method is called from within the constructor to
    34      * initialize the form.
    35      * WARNING: Do NOT modify this code. The content of this method is
    36      * always regenerated by the Form Editor.
    37      */
    38     // <editor-fold defaultstate="collapsed" desc="Generated Code">
    3935    private void initComponents() {
    4036
    41         lblWhatsNew = new javax.swing.JLabel();
    42         icnLogo = new javax.swing.JLabel();
    43         jSeparator1 = new javax.swing.JSeparator();
    44         newItem1 = new javax.swing.JLabel();
    45         btnHelpItem1 = new javax.swing.JButton();
    46         newItem2 = new javax.swing.JLabel();
     37        lblWhatsNew = new JLabel();
     38        icnLogo = new JLabel();
     39        jSeparator1 = new JSeparator();
     40        newItem1 = new JLabel();
     41        btnHelpItem1 = new JButton();
     42        newItem2 = new JLabel();
    4743
    48         lblWhatsNew.setText("<html><div style=\"font-family: sans-serif; font-weight: bold; font-style: italic;\"><span style=\"font-size: large;\"><span style=\"font-size: x-large;\">"
     44        lblWhatsNew.setText("<html><div style=\"font-family: sans-serif; font-weight: bold; font-style: italic;\">"+
     45                            "<span style=\"font-size: large;\"><span style=\"font-size: x-large;\">"
    4946                            + tr("What''s new...")
    5047                            + "</span></div></html>");
    5148
    52         icnLogo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/wndialog/alignways64.png"))); // NOI18N
     49        icnLogo.setIcon(new ImageIcon(getClass().getResource("/images/wndialog/alignways64.png"))); // NOI18N
    5350
    5451        newItem1.setText("<html><div style=\"font-family: sans-serif;\"><ul style=\"margin-left: 20px;\"><li>"
     
    5653                         + "</li></ul></div></html>");
    5754
    58         btnHelpItem1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/wndialog/extlink10.png"))); // NOI18N
     55        btnHelpItem1.setIcon(new ImageIcon(getClass().getResource("/images/wndialog/extlink10.png"))); // NOI18N
    5956        btnHelpItem1.setText("More Info");
    6057        btnHelpItem1.setToolTipText("Preserving angle aligning");
     
    6562        btnHelpItem1.setIconTextGap(6);
    6663        btnHelpItem1.setOpaque(false);
    67         btnHelpItem1.setPreferredSize(new java.awt.Dimension(69, 25));
    68         btnHelpItem1.addActionListener(new java.awt.event.ActionListener() {
    69             @Override
    70             public void actionPerformed(java.awt.event.ActionEvent evt) {
    71                 btnHelpItem1ActionPerformed(evt);
    72             }
    73         });
     64        btnHelpItem1.setPreferredSize(new Dimension(69, 25));
     65        btnHelpItem1.addActionListener(evt -> btnHelpItem1ActionPerformed(evt));
    7466
    7567        newItem2.setText("<html><div style=\"font-family: sans-serif;\"><ul style=\"margin-left: 20px;\"><li>"
     
    7769                         + "</li></ul></div></html>");
    7870
    79         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
     71        GroupLayout layout = new GroupLayout(this);
    8072        this.setLayout(layout);
    8173        layout.setHorizontalGroup(
    82             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
     74            layout.createParallelGroup(GroupLayout.Alignment.LEADING)
    8375            .addGroup(layout.createSequentialGroup()
    8476                .addContainerGap()
    85                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    86                     .addComponent(jSeparator1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 349, Short.MAX_VALUE)
    87                     .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
    88                         .addComponent(lblWhatsNew, javax.swing.GroupLayout.DEFAULT_SIZE, 267, Short.MAX_VALUE)
     77                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
     78                    .addComponent(jSeparator1, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 349, Short.MAX_VALUE)
     79                    .addGroup(GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
     80                        .addComponent(lblWhatsNew, GroupLayout.DEFAULT_SIZE, 267, Short.MAX_VALUE)
    8981                        .addGap(18, 18, 18)
    9082                        .addComponent(icnLogo))
    9183                    .addGroup(layout.createSequentialGroup()
    92                         .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
    93                             .addComponent(newItem2, javax.swing.GroupLayout.Alignment.LEADING)
    94                             .addComponent(newItem1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 249, Short.MAX_VALUE))
     84                        .addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING, false)
     85                            .addComponent(newItem2, GroupLayout.Alignment.LEADING)
     86                            .addComponent(newItem1, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 249, Short.MAX_VALUE))
    9587                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
    96                         .addComponent(btnHelpItem1, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)))
     88                        .addComponent(btnHelpItem1, GroupLayout.PREFERRED_SIZE, 90, GroupLayout.PREFERRED_SIZE)))
    9789                .addContainerGap())
    9890        );
    9991        layout.setVerticalGroup(
    100             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
     92            layout.createParallelGroup(GroupLayout.Alignment.LEADING)
    10193            .addGroup(layout.createSequentialGroup()
    10294                .addContainerGap()
    103                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
     95                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
    10496                    .addComponent(icnLogo)
    105                     .addComponent(lblWhatsNew, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE))
     97                    .addComponent(lblWhatsNew, GroupLayout.PREFERRED_SIZE, 69, GroupLayout.PREFERRED_SIZE))
    10698                .addGap(20, 20, 20)
    107                 .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
     99                .addComponent(jSeparator1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
    108100                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    109                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    110                     .addComponent(newItem1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    111                     .addComponent(btnHelpItem1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
     101                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
     102                    .addComponent(newItem1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
     103                    .addComponent(btnHelpItem1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
    112104                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    113                 .addComponent(newItem2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
     105                .addComponent(newItem2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
    114106                .addContainerGap(23, Short.MAX_VALUE))
    115107        );
    116     }// </editor-fold>
     108    }
    117109
    118     private void btnHelpItem1ActionPerformed(java.awt.event.ActionEvent evt) {
     110    private void btnHelpItem1ActionPerformed(ActionEvent evt) {
    119111       openURI();
    120112    }
    121113
    122     // Variables declaration - do not modify
    123     private javax.swing.JButton btnHelpItem1;
    124     private javax.swing.JLabel icnLogo;
    125     private javax.swing.JSeparator jSeparator1;
    126     private javax.swing.JLabel lblWhatsNew;
    127     private javax.swing.JLabel newItem1;
    128     private javax.swing.JLabel newItem2;
    129     // End of variables declaration
     114    private JButton btnHelpItem1;
     115    private JLabel icnLogo;
     116    private JSeparator jSeparator1;
     117    private JLabel lblWhatsNew;
     118    private JLabel newItem1;
     119    private JLabel newItem2;
    130120
    131 
    132     private void openURI()  {
     121    private void openURI() {
    133122        if (Desktop.isDesktopSupported()) {
    134123          try {
     
    136125            Desktop.getDesktop().browse(uri);
    137126          } catch (URISyntaxException ex) {
    138                 Logger.getLogger(AlignWaysWhatsNewPanel.class.getName()).log(Level.SEVERE, null, ex);
     127              Logger.getLogger(AlignWaysWhatsNewPanel.class.getName()).log(Level.SEVERE, null, ex);
    139128          } catch (IOException e) {
    140129              JOptionPane.showMessageDialog(this, e, tr("Errr..."), JOptionPane.WARNING_MESSAGE);
     
    144133        }
    145134    }
    146 
    147     /*** End of Matisse generated code section ***/
    148 
    149135}
  • applications/editors/josm/plugins/alignways/src/org/openstreetmap/josm/plugins/alignways/geometry/AlignWaysGeomLine.java

    r32920 r34489  
    1 package com.tilusnet.josm.plugins.alignways.geometry;
     1// License: GPL. For details, see LICENSE file.
     2package org.openstreetmap.josm.plugins.alignways.geometry;
    23
    34import java.util.Objects;
    45
    56/**
    6  * @author tilusnet <tilusnet@gmail.com>
     7 * @author tilusnet &lt;tilusnet@gmail.com&gt;
    78 *
    89 */
     
    1920
    2021    IntersectionStatus isectStat = IntersectionStatus.UNDEFINED;
    21 
    22 
    2322
    2423    /**
  • applications/editors/josm/plugins/alignways/src/org/openstreetmap/josm/plugins/alignways/geometry/AlignWaysGeomPoint.java

    r30737 r34489  
    1 package com.tilusnet.josm.plugins.alignways.geometry;
     1// License: GPL. For details, see LICENSE file.
     2package org.openstreetmap.josm.plugins.alignways.geometry;
    23
    34import java.util.ArrayList;
     
    4041        if (awPts.size() <= 1)
    4142            return false;
    42        
     43
    4344        if (awPts.size() == 2)
    4445            return true;
     
    6061     * Determines which (EastNorth) point falls between the other two.
    6162     * Ideally to be used with collinear points.
    62      *
    63      * @return 1, 2 or 3 for pt1, pt2 and pt3, respectively.
    64      * 0 if middle value cannot be determined (i.e. some values are equal).
     63     * @param pt1 point 1
     64     * @param pt2 point 2
     65     * @param pt3 point 3
     66     *
     67     * @return 1, 2 or 3 for pt1, pt2 and pt3, respectively.
     68     * 0 if middle value cannot be determined (i.e. some values are equal).
    6569     */
    6670    public static int getMiddleOf3(
    67             AlignWaysGeomPoint pt1, 
    68             AlignWaysGeomPoint pt2, 
     71            AlignWaysGeomPoint pt1,
     72            AlignWaysGeomPoint pt2,
    6973            AlignWaysGeomPoint pt3) {
    70        
     74
    7175        int midPtXIdx = getMiddleOf3(pt1.x, pt2.x, pt3.x);
    7276        int midPtYIdx = getMiddleOf3(pt1.y, pt2.y, pt3.y);
    73        
     77
    7478        if ((midPtXIdx == 0) && (midPtYIdx == 0))
    75             // All 3 points overlap: 
     79            // All 3 points overlap:
    7680            // Design decision: return the middle point (could be any other or none)
    7781            return 2;
    78        
    79         if (midPtXIdx == 0) return midPtYIdx; 
     82
     83        if (midPtXIdx == 0) return midPtYIdx;
    8084        if (midPtYIdx == 0) return midPtXIdx;
    81        
     85
    8286        // Both x and y middle points could be determined;
    8387        // their indexes must coincide
     
    8892            // Fail
    8993            return 0;
    90        
     94
    9195    }
    9296
    9397    /**
    9498     * Determine which value, d1, d2 or d3 falls in the middle of the other two.
    95      * @return 1, 2 or 3 for d1, d2 and d3, respectively.
    96      * 0 if middle value cannot be determined (i.e. some values are equal).
     99     * @param d1 first value
     100     * @param d2 second value
     101     * @param d3 third value
     102     * @return 1, 2 or 3 for d1, d2 and d3, respectively.
     103     * 0 if middle value cannot be determined (i.e. some values are equal).
    97104     */
    98105    private static int getMiddleOf3(double d1, double d2, double d3) {
    99        
     106
    100107        Double[] dValues = {d1, d2, d3};
    101108        ArrayList<Double> alValues = new ArrayList<>(Arrays.asList(dValues));
    102109        Collections.sort(alValues);
    103        
     110
    104111        if ((Math.abs(alValues.get(1) - alValues.get(0)) < 0.01) ||
    105112            (Math.abs(alValues.get(1) - alValues.get(2)) < 0.01))
     
    111118            if (Math.abs(alValues.get(1) - d3) < 0.01) return 3;
    112119        }
    113        
     120
    114121        // Should never happen
    115122        return 0;
Note: See TracChangeset for help on using the changeset viewer.