1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.actions;
|
---|
3 |
|
---|
4 | import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
|
---|
5 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
6 |
|
---|
7 | import java.awt.event.ActionEvent;
|
---|
8 |
|
---|
9 | import org.openstreetmap.josm.gui.MainApplication;
|
---|
10 | import org.openstreetmap.josm.gui.preferences.display.DrawingPreference;
|
---|
11 | import org.openstreetmap.josm.tools.ImageProvider;
|
---|
12 |
|
---|
13 | /**
|
---|
14 | * This class toggles whether to draw boundaries of downloaded data.
|
---|
15 | *
|
---|
16 | * @since 14648
|
---|
17 | */
|
---|
18 | public class DrawBoundariesOfDownloadedDataAction extends PreferenceToggleAction {
|
---|
19 |
|
---|
20 | /**
|
---|
21 | * Constructs a new {@link DrawBoundariesOfDownloadedDataAction}.
|
---|
22 | */
|
---|
23 | public DrawBoundariesOfDownloadedDataAction() {
|
---|
24 | super(tr("Draw boundaries of downloaded data"),
|
---|
25 | new ImageProvider("hatched.svg"),
|
---|
26 | tr("Enable/disable hatched background rendering of areas outside of the downloaded areas."),
|
---|
27 | DrawingPreference.SOURCE_BOUNDS_PROP
|
---|
28 | );
|
---|
29 | setHelpId(ht("/MapView#Downloadedarea"));
|
---|
30 | }
|
---|
31 |
|
---|
32 | @Override
|
---|
33 | protected boolean listenToSelectionChange() {
|
---|
34 | return false;
|
---|
35 | }
|
---|
36 |
|
---|
37 | @Override
|
---|
38 | protected void updateEnabledState() {
|
---|
39 | setEnabled(MainApplication.getLayerManager().getEditLayer() != null);
|
---|
40 | }
|
---|
41 |
|
---|
42 | @Override
|
---|
43 | public void actionPerformed(ActionEvent e) {
|
---|
44 | super.actionPerformed(e);
|
---|
45 | if (MainApplication.isDisplayingMapView()) {
|
---|
46 | MainApplication.getMap().mapView.repaint();
|
---|
47 | }
|
---|
48 | }
|
---|
49 |
|
---|
50 | }
|
---|