Changeset 1577 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2009-05-05T17:39:15+02:00 (16 years ago)
Author:
stoecker
Message:

close #1872 - patch by avar - handle GPX line drawing different for local and remote

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java

    r1519 r1577  
    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", 200);
     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));
  • trunk/src/org/openstreetmap/josm/gui/preferences/DrawingPreference.java

    r1519 r1577  
    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."));
     
    6364        gpsLinesGroup.add(drawRawGpsLinesAll);
    6465
    65         if(Main.pref.getBoolean("draw.rawgps.lines")) {
     66        /* ensure that default is in data base */
     67        Boolean lf = Main.pref.getBoolean("draw.rawgps.lines.localfiles", false);
     68        if(Main.pref.getBoolean("draw.rawgps.lines", true))
    6669            drawRawGpsLinesAll.setSelected(true);
    67         } else if (Main.pref.getBoolean("draw.rawgps.lines.localfiles")) {
     70        else if (lf)
    6871            drawRawGpsLinesLocal.setSelected(true);
    69         } else {
     72        else
    7073            drawRawGpsLinesNone.setSelected(true);
    71         }
    7274
    7375        panel.add(new JLabel(tr("Draw lines between raw GPS points")), GBC.eol().insets(20,0,0,0));
     
    7981            public void actionPerformed(ActionEvent e) {
    8082                forceRawGpsLines.setEnabled(!drawRawGpsLinesNone.isSelected());
    81                 drawRawGpsMaxLineLength.setEnabled(!drawRawGpsLinesNone.isSelected());
     83                drawRawGpsMaxLineLength.setEnabled(!(drawRawGpsLinesNone.isSelected() || drawRawGpsLinesLocal.isSelected()));
     84                drawRawGpsMaxLineLengthLocal.setEnabled(!drawRawGpsLinesNone.isSelected());
    8285                drawGpsArrows.setEnabled(!drawRawGpsLinesNone.isSelected() );
    8386                drawGpsArrowsFast.setEnabled(drawGpsArrows.isSelected() && drawGpsArrows.isEnabled());
     
    9093        drawRawGpsLinesAll.addActionListener(drawRawGpsLinesActionListener);
    9194
     95        // drawRawGpsMaxLineLengthLocal
     96        drawRawGpsMaxLineLengthLocal.setText(Integer.toString(Main.pref.getInteger("draw.rawgps.max-line-length.local", -1)));
     97        drawRawGpsMaxLineLengthLocal.setToolTipText(tr("Maximum length (in meters) to draw lines for local files. Set to '-1' to draw all lines."));
     98        drawRawGpsMaxLineLengthLocal.setEnabled(!drawRawGpsLinesNone.isSelected());
     99        panel.add(new JLabel(tr("Maximum length for local files (meters)")), GBC.std().insets(40,0,0,0));
     100        panel.add(drawRawGpsMaxLineLengthLocal, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5));
     101
    92102        // drawRawGpsMaxLineLength
    93         drawRawGpsMaxLineLength.setText(Integer.toString(Main.pref.getInteger("draw.rawgps.max-line-length", -1)));
     103        drawRawGpsMaxLineLength.setText(Integer.toString(Main.pref.getInteger("draw.rawgps.max-line-length", 200)));
    94104        drawRawGpsMaxLineLength.setToolTipText(tr("Maximum length (in meters) to draw lines. Set to '-1' to draw all lines."));
    95105        drawRawGpsMaxLineLength.setEnabled(!drawRawGpsLinesNone.isSelected());
     
    99109        // forceRawGpsLines
    100110        forceRawGpsLines.setToolTipText(tr("Force drawing of lines if the imported data contain no line information."));
    101         forceRawGpsLines.setSelected(Main.pref.getBoolean("draw.rawgps.lines.force"));
     111        forceRawGpsLines.setSelected(Main.pref.getBoolean("draw.rawgps.lines.force", false));
    102112        forceRawGpsLines.setEnabled(!drawRawGpsLinesNone.isSelected());
    103113        panel.add(forceRawGpsLines, GBC.eop().insets(40,0,0,0));
     
    111121        });
    112122        drawGpsArrows.setToolTipText(tr("Draw direction arrows for lines, connecting GPS points."));
    113         drawGpsArrows.setSelected(Main.pref.getBoolean("draw.rawgps.direction"));
     123        drawGpsArrows.setSelected(Main.pref.getBoolean("draw.rawgps.direction", false));
    114124        drawGpsArrows.setEnabled(!drawRawGpsLinesNone.isSelected());
    115125        panel.add(drawGpsArrows, GBC.eop().insets(40,0,0,0));
     
    117127        // drawGpsArrowsFast
    118128        drawGpsArrowsFast.setToolTipText(tr("Draw the direction arrows using table lookups instead of complex math."));
    119         drawGpsArrowsFast.setSelected(Main.pref.getBoolean("draw.rawgps.alternatedirection"));
     129        drawGpsArrowsFast.setSelected(Main.pref.getBoolean("draw.rawgps.alternatedirection", false));
    120130        drawGpsArrowsFast.setEnabled(drawGpsArrows.isSelected() && drawGpsArrows.isEnabled());
    121131        panel.add(drawGpsArrowsFast, GBC.eop().insets(60,0,0,0));
     
    129139
    130140        // largeGpsPoints
    131         largeGpsPoints.setSelected(Main.pref.getBoolean("draw.rawgps.large"));
     141        largeGpsPoints.setSelected(Main.pref.getBoolean("draw.rawgps.large", false));
    132142        largeGpsPoints.setToolTipText(tr("Draw larger dots for the GPS points."));
    133143        panel.add(largeGpsPoints, GBC.eop().insets(20,0,0,0));
     
    247257        Main.pref.put("draw.rawgps.lines.localfiles", drawRawGpsLinesLocal.isSelected());
    248258        Main.pref.put("draw.rawgps.max-line-length", drawRawGpsMaxLineLength.getText());
     259        Main.pref.put("draw.rawgps.max-line-length.local", drawRawGpsMaxLineLengthLocal.getText());
    249260        Main.pref.put("draw.rawgps.lines.force", forceRawGpsLines.isSelected());
    250261        Main.pref.put("draw.rawgps.direction", drawGpsArrows.isSelected());
Note: See TracChangeset for help on using the changeset viewer.