Ignore:
Timestamp:
2017-01-06T20:26:55+01:00 (7 years ago)
Author:
Don-vip
Message:

fix #13124 - Enhanced GPS data rendering: add new heatmap mode (patch by kidelo)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/preferences/display/GPXSettingsPanel.java

    r11039 r11431  
    5656    private final JRadioButton colorTypeDilution = new JRadioButton(tr("Dilution of Position (red = high, green = low, if available)"));
    5757    private final JRadioButton colorTypeTime = new JRadioButton(tr("Track date"));
     58    private final JRadioButton colorTypeHeatMap = new JRadioButton(tr("Heat Map (dark = few tracks, bright = many tracks)"));
    5859    private final JRadioButton colorTypeNone = new JRadioButton(tr("Single Color (can be customized for named layers)"));
    5960    private final JRadioButton colorTypeGlobal = new JRadioButton(tr("Use global settings"));
    6061    private final JosmComboBox<String> colorTypeVelocityTune = new JosmComboBox<>(new String[] {tr("Car"), tr("Bicycle"), tr("Foot")});
     62    private final JosmComboBox<String> colorTypeHeatMapTune = new JosmComboBox<>(new String[] {tr("User"), tr("Inferno"), tr("Viridis"),
     63                                                                                 tr("Wood"), tr("Heat")});
    6164    private final JCheckBox makeAutoMarkers = new JCheckBox(tr("Create markers when reading GPX"));
    6265    private final JCheckBox drawGpsArrows = new JCheckBox(tr("Draw Direction Arrows"));
     
    6972    private final JosmTextField audioWaypointLabelPattern = new JosmTextField();
    7073    private final JCheckBox useGpsAntialiasing = new JCheckBox(tr("Smooth GPX graphics (antialiasing)"));
     74    private final JCheckBox drawLineWithAlpha = new JCheckBox(tr("Draw with Opacity (alpha blending) "));
    7175
    7276    private String layerName;
     
    180184        });
    181185        drawGpsArrows.setToolTipText(tr("Draw direction arrows for lines, connecting GPS points."));
    182         add(drawGpsArrows, GBC.eop().insets(40, 0, 0, 0));
     186        add(drawGpsArrows, GBC.eop().insets(20, 0, 0, 0));
    183187
    184188        // drawGpsArrowsFast
    185189        drawGpsArrowsFast.setToolTipText(tr("Draw the direction arrows using table lookups instead of complex math."));
    186         add(drawGpsArrowsFast, GBC.eop().insets(60, 0, 0, 0));
     190        add(drawGpsArrowsFast, GBC.eop().insets(40, 0, 0, 0));
    187191        ExpertToggleAction.addVisibilitySwitcher(drawGpsArrowsFast);
    188192
    189193        // drawGpsArrowsMinDist
    190194        drawGpsArrowsMinDist.setToolTipText(tr("Do not draw arrows if they are not at least this distance away from the last one."));
    191         add(new JLabel(tr("Minimum distance (pixels)")), GBC.std().insets(60, 0, 0, 0));
     195        add(new JLabel(tr("Minimum distance (pixels)")), GBC.std().insets(40, 0, 0, 0));
    192196        add(drawGpsArrowsMinDist, GBC.eol().fill(GBC.HORIZONTAL).insets(5, 0, 0, 5));
    193197
     
    210214        add(useGpsAntialiasing, GBC.eop().insets(20, 0, 0, 0));
    211215        ExpertToggleAction.addVisibilitySwitcher(useGpsAntialiasing);
     216
     217        // alpha blending
     218        drawLineWithAlpha.setToolTipText(tr("Apply dynamic alpha-blending and adjust width based on zoom level for all GPX lines."));
     219        add(drawLineWithAlpha, GBC.eop().insets(20, 0, 0, 0));
     220        ExpertToggleAction.addVisibilitySwitcher(drawLineWithAlpha);
    212221
    213222        // colorTracks
     
    221230        colorGroup.add(colorTypeDilution);
    222231        colorGroup.add(colorTypeTime);
     232        colorGroup.add(colorTypeHeatMap);
    223233
    224234        colorTypeVelocity.addChangeListener(e -> {
     
    226236            colorDynamic.setEnabled(colorTypeVelocity.isSelected() || colorTypeDilution.isSelected());
    227237        });
     238
     239        colorTypeHeatMap.addChangeListener(e -> {
     240            colorTypeHeatMapTune.setEnabled(colorTypeHeatMap.isSelected());
     241            colorDynamic.setEnabled(false);
     242        });
     243
    228244        colorTypeDilution.addChangeListener(e -> colorDynamic.setEnabled(colorTypeVelocity.isSelected() || colorTypeDilution.isSelected()));
    229245
     
    234250                tr("Colors points and track segments by dilution of position (HDOP). Your capture device needs to log that information."));
    235251        colorTypeTime.setToolTipText(tr("Colors points and track segments by its timestamp."));
     252        colorTypeHeatMap.setToolTipText(tr("Collected points and track segments for a position and displayed as heat map."));
    236253
    237254        // color Tracks by Velocity Tune
    238255        colorTypeVelocityTune.setToolTipText(tr("Allows to tune the track coloring for different average speeds."));
     256
     257        colorTypeHeatMapTune.setToolTipText(tr("Selects the color schema for heat map."));
    239258
    240259        add(Box.createVerticalGlue(), GBC.eol().insets(0, 20, 0, 0));
     
    250269        add(colorTypeDilution, GBC.eol().insets(40, 0, 0, 0));
    251270        add(colorTypeTime, GBC.eol().insets(40, 0, 0, 0));
     271        add(colorTypeHeatMap, GBC.std().insets(40, 0, 0, 0));
     272        add(colorTypeHeatMapTune, GBC.eop().insets(5, 0, 0, 5));
     273
    252274        ExpertToggleAction.addVisibilitySwitcher(colorTypeDirection);
    253275        ExpertToggleAction.addVisibilitySwitcher(colorTypeDilution);
     
    316338        drawRawGpsMaxLineLength.setText(Integer.toString(Main.pref.getInteger("draw.rawgps.max-line-length", layerName, 200)));
    317339        drawLineWidth.setText(Integer.toString(Main.pref.getInteger("draw.rawgps.linewidth", layerName, 0)));
     340        drawLineWithAlpha.setSelected(Main.pref.getBoolean("draw.rawgps.lines.alpha-blend", layerName, false));
    318341        forceRawGpsLines.setSelected(Main.pref.getBoolean("draw.rawgps.lines.force", layerName, false));
    319342        drawGpsArrows.setSelected(Main.pref.getBoolean("draw.rawgps.direction", layerName, false));
     
    323346        largeGpsPoints.setSelected(Main.pref.getBoolean("draw.rawgps.large", layerName, false));
    324347        useGpsAntialiasing.setSelected(Main.pref.getBoolean("mappaint.gpx.use-antialiasing", false));
     348
    325349        drawRawGpsLinesActionListener.actionPerformed(null);
    326350
     
    337361            case 3: colorTypeDirection.setSelected(true); break;
    338362            case 4: colorTypeTime.setSelected(true); break;
     363            case 5: colorTypeHeatMap.setSelected(true); break;
    339364            default: Main.warn("Unknown color type: " + colorType);
    340365            }
     
    342367            colorTypeVelocityTune.setSelectedIndex(ccts == 10 ? 2 : (ccts == 20 ? 1 : 0));
    343368            colorTypeVelocityTune.setEnabled(colorTypeVelocity.isSelected() && colorTypeVelocity.isEnabled());
     369
     370            colorTypeHeatMapTune.setSelectedIndex(Main.pref.getInteger("draw.rawgps.heatmap.colormap", layerName, 0));
     371            colorTypeHeatMapTune.setEnabled(colorTypeHeatMap.isSelected() && colorTypeHeatMap.isEnabled());
     372
    344373            colorDynamic.setSelected(Main.pref.getBoolean("draw.rawgps.colors.dynamic", layerName, false));
    345374            colorDynamic.setEnabled(colorTypeVelocity.isSelected() || colorTypeDilution.isSelected());
     
    386415        Main.pref.put("draw.rawgps.large"+layerNameDot, largeGpsPoints.isSelected());
    387416        Main.pref.put("draw.rawgps.linewidth"+layerNameDot, drawLineWidth.getText());
     417        Main.pref.put("draw.rawgps.lines.alpha-blend"+layerNameDot, drawLineWithAlpha.isSelected());
     418
    388419        Main.pref.put("mappaint.gpx.use-antialiasing", useGpsAntialiasing.isSelected());
    389420
     
    404435        } else if (colorTypeTime.isSelected()) {
    405436            Main.pref.putInteger("draw.rawgps.colors"+layerNameDot, 4);
     437        } else if (colorTypeHeatMap.isSelected()) {
     438            Main.pref.putInteger("draw.rawgps.colors"+layerNameDot, 5);
    406439        } else {
    407440            Main.pref.putInteger("draw.rawgps.colors"+layerNameDot, 0);
     
    410443        int ccti = colorTypeVelocityTune.getSelectedIndex();
    411444        Main.pref.putInteger("draw.rawgps.colorTracksTune"+layerNameDot, ccti == 2 ? 10 : (ccti == 1 ? 20 : 45));
     445
     446        Main.pref.putInteger("draw.rawgps.heatmap.colormap"+layerNameDot, colorTypeHeatMapTune.getSelectedIndex());
     447
    412448        return false;
    413449    }
Note: See TracChangeset for help on using the changeset viewer.