Ticket #1978: addTunePrefToGPXprefs.patch

File addTunePrefToGPXprefs.patch, 3.7 KB (added by xeen, 12 years ago)

Adds UI for speed coloring tuning to the prefs

  • src/org/openstreetmap/josm/gui/preferences/DrawingPreference.java

    old new  
    1010
    1111import javax.swing.BorderFactory;
    1212import javax.swing.JCheckBox;
     13import javax.swing.JComboBox;
    1314import javax.swing.JLabel;
    1415import javax.swing.JTextField;
    1516import javax.swing.JScrollPane;
     
    2627    private JCheckBox forceRawGpsLines = new JCheckBox(tr("Force lines if no segments imported."));
    2728    private JCheckBox largeGpsPoints = new JCheckBox(tr("Draw large GPS points."));
    2829    private JCheckBox colorTracks = new JCheckBox(tr("Color tracks by velocity."));
     30    private JComboBox colorTracksTune = new JComboBox(new String[] {tr("Car"), tr("Bicycle"), tr("Foot")});
    2931    private JCheckBox directionHint = new JCheckBox(tr("Draw Direction Arrows"));
    3032    private JCheckBox drawGpsArrows = new JCheckBox(tr("Draw Direction Arrows"));
    3133    private JCheckBox drawGpsArrowsFast = new JCheckBox(tr("Fast drawing (looks uglier)"));
     
    5153                            drawGpsArrowsFast.setEnabled(drawGpsArrows.isSelected() && drawGpsArrows.isEnabled());
    5254                            drawGpsArrowsMinDist.setEnabled(drawGpsArrows.isSelected() && drawGpsArrows.isEnabled());
    5355                            colorTracks.setEnabled(drawRawGpsLines.isSelected());
     56                            colorTracksTune.setEnabled(colorTracks.isSelected() && drawRawGpsLines.isSelected());
    5457            }
    5558        });
    5659        drawRawGpsLines.setSelected(Main.pref.getBoolean("draw.rawgps.lines"));
     
    9699        panel.add(drawGpsArrowsMinDist, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5));
    97100
    98101        // colorTracks
     102        colorTracks.addActionListener(new ActionListener(){
     103            public void actionPerformed(ActionEvent e) {
     104                            colorTracksTune.setEnabled(colorTracks.isSelected() && drawRawGpsLines.isSelected());
     105            }
     106        });
    99107        colorTracks.setSelected(Main.pref.getBoolean("draw.rawgps.colors"));
    100108        colorTracks.setToolTipText(tr("Choose the hue for the track color by the velocity at that point."));
    101109        colorTracks.setEnabled(drawRawGpsLines.isSelected());
    102         panel.add(colorTracks, GBC.eop().insets(40,0,0,0));
    103 
     110        panel.add(colorTracks, GBC.std().insets(40,0,0,0));
     111       
     112        // color Tracks by Velocity Tune
     113        int ccts = Main.pref.getInteger("draw.rawgps.colorTracksTune", 45);
     114        colorTracksTune.setSelectedIndex(ccts==10 ? 2 : (ccts==20 ? 1 : 0));
     115        colorTracksTune.setToolTipText(tr("Allows to tune the track coloring for different average speeds."));
     116        colorTracksTune.setEnabled(colorTracks.isSelected() && colorTracks.isEnabled());
     117        panel.add(colorTracksTune, GBC.eop().insets(5,0,0,5));
     118       
    104119        // largeGpsPoints
    105120        largeGpsPoints.setSelected(Main.pref.getBoolean("draw.rawgps.large"));
    106121        largeGpsPoints.setToolTipText(tr("Draw larger dots for the GPS points."));
     
    173188        Main.pref.put("draw.rawgps.alternatedirection", drawGpsArrowsFast.isSelected());
    174189        Main.pref.put("draw.rawgps.min-arrow-distance", drawGpsArrowsMinDist.getText());
    175190        Main.pref.put("draw.rawgps.colors", colorTracks.isSelected());
     191        int ccti=colorTracksTune.getSelectedIndex();
     192        Main.pref.putInteger("draw.rawgps.colorTracksTune", ccti==2 ? 10 : (ccti==1 ? 20 : 45));
    176193        Main.pref.put("draw.rawgps.large", largeGpsPoints.isSelected());
    177194        Main.pref.put("draw.segment.direction", directionHint.isSelected());
    178195        Main.pref.put("draw.segment.relevant_directions_only", interestingDirections.isSelected());