Ticket #1872: drawRawGpsMaxLineLengthLocal.patch

File drawRawGpsMaxLineLengthLocal.patch, 4.3 KB (added by avarab@…, 12 years ago)

Adds a new field to "GPS points" preferences for maximum length line drawing for local files

  • src/org/openstreetmap/josm/gui/layer/GpxLayer.java

     
    395395        // draw direction arrows on the lines
    396396        boolean direction = Main.pref.getBoolean("draw.rawgps.direction");
    397397        // don't draw lines if longer than x meters
    398         int maxLineLength = Main.pref.getInteger("draw.rawgps.max-line-length", -1);
     398        int maxLineLength;
     399        if (this.isLocalFile) {
     400            maxLineLength = Main.pref.getInteger("draw.rawgps.max-line-length.local", -1);
     401        } else {
     402            maxLineLength = Main.pref.getInteger("draw.rawgps.max-line-length", -1);
     403        }
    399404        // draw line between points, global setting
    400405        boolean lines = (Main.pref.getBoolean("draw.rawgps.lines") || (Main.pref.getBoolean("draw.rawgps.lines.localfiles") && this.isLocalFile));
    401406        String linesKey = "draw.rawgps.lines.layer "+name;
  • src/org/openstreetmap/josm/gui/preferences/DrawingPreference.java

     
    3232    private JRadioButton drawRawGpsLinesNone = new JRadioButton(tr("None"));
    3333    private ActionListener drawRawGpsLinesActionListener;
    3434    private JTextField drawRawGpsMaxLineLength = new JTextField(8);
     35    private JTextField drawRawGpsMaxLineLengthLocal = new JTextField(8);
    3536    private JCheckBox forceRawGpsLines = new JCheckBox(tr("Force lines if no segments imported."));
    3637    private JCheckBox largeGpsPoints = new JCheckBox(tr("Draw large GPS points."));
    3738    private ButtonGroup colorGroup;
     
    7879        drawRawGpsLinesActionListener = new ActionListener(){
    7980            public void actionPerformed(ActionEvent e) {
    8081                forceRawGpsLines.setEnabled(!drawRawGpsLinesNone.isSelected());
    81                 drawRawGpsMaxLineLength.setEnabled(!drawRawGpsLinesNone.isSelected());
     82                drawRawGpsMaxLineLength.setEnabled(!(drawRawGpsLinesNone.isSelected() || drawRawGpsLinesLocal.isSelected()));
     83                drawRawGpsMaxLineLengthLocal.setEnabled(!drawRawGpsLinesNone.isSelected());
    8284                drawGpsArrows.setEnabled(!drawRawGpsLinesNone.isSelected() );
    8385                drawGpsArrowsFast.setEnabled(drawGpsArrows.isSelected() && drawGpsArrows.isEnabled());
    8486                drawGpsArrowsMinDist.setEnabled(drawGpsArrows.isSelected() && drawGpsArrows.isEnabled());
     
    8991        drawRawGpsLinesLocal.addActionListener(drawRawGpsLinesActionListener);
    9092        drawRawGpsLinesAll.addActionListener(drawRawGpsLinesActionListener);
    9193
     94        // drawRawGpsMaxLineLengthLocal
     95        drawRawGpsMaxLineLengthLocal.setText(Integer.toString(Main.pref.getInteger("draw.rawgps.max-line-length.local", -1)));
     96        drawRawGpsMaxLineLengthLocal.setToolTipText(tr("Maximum length (in meters) to draw lines for local files. Set to '-1' to draw all lines."));
     97        drawRawGpsMaxLineLengthLocal.setEnabled(!drawRawGpsLinesNone.isSelected());
     98        panel.add(new JLabel(tr("Maximum length for local files (meters)")), GBC.std().insets(40,0,0,0));
     99        panel.add(drawRawGpsMaxLineLengthLocal, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5));
     100
    92101        // drawRawGpsMaxLineLength
    93102        drawRawGpsMaxLineLength.setText(Integer.toString(Main.pref.getInteger("draw.rawgps.max-line-length", -1)));
    94103        drawRawGpsMaxLineLength.setToolTipText(tr("Maximum length (in meters) to draw lines. Set to '-1' to draw all lines."));
     
    246255        Main.pref.put("draw.rawgps.lines", drawRawGpsLinesAll.isSelected());
    247256        Main.pref.put("draw.rawgps.lines.localfiles", drawRawGpsLinesLocal.isSelected());
    248257        Main.pref.put("draw.rawgps.max-line-length", drawRawGpsMaxLineLength.getText());
     258        Main.pref.put("draw.rawgps.max-line-length.local", drawRawGpsMaxLineLengthLocal.getText());
    249259        Main.pref.put("draw.rawgps.lines.force", forceRawGpsLines.isSelected());
    250260        Main.pref.put("draw.rawgps.direction", drawGpsArrows.isSelected());
    251261        Main.pref.put("draw.rawgps.alternatedirection", drawGpsArrowsFast.isSelected());