|
Last change
on this file was 19640, checked in by stoecker, 4 days ago |
|
add grid overlay and tile border display, fix #8464, patch by wangi
|
|
File size:
1.4 KB
|
| Line | |
|---|
| 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.layer.MapGridPaintable;
|
|---|
| 11 | import org.openstreetmap.josm.tools.ImageProvider;
|
|---|
| 12 |
|
|---|
| 13 | /**
|
|---|
| 14 | * This action toggles the display of the grid over the map view.
|
|---|
| 15 | * @see MapGridPaintable
|
|---|
| 16 | * @since 19640
|
|---|
| 17 | */
|
|---|
| 18 | public class ShowGridAction extends PreferenceToggleAction {
|
|---|
| 19 |
|
|---|
| 20 | /**
|
|---|
| 21 | * Constructs a new {@link ShowGridAction}.
|
|---|
| 22 | */
|
|---|
| 23 | public ShowGridAction() {
|
|---|
| 24 | super(tr("Show"),
|
|---|
| 25 | new ImageProvider("grid"),
|
|---|
| 26 | tr("Enable/disable the grid drawn over the map. Its spacing and orientation are set in the display preferences."),
|
|---|
| 27 | MapGridPaintable.ENABLED
|
|---|
| 28 | );
|
|---|
| 29 | setHelpId(ht("/MapView#Grid"));
|
|---|
| 30 | }
|
|---|
| 31 |
|
|---|
| 32 | @Override
|
|---|
| 33 | protected boolean listenToSelectionChange() {
|
|---|
| 34 | return false;
|
|---|
| 35 | }
|
|---|
| 36 |
|
|---|
| 37 | @Override
|
|---|
| 38 | protected void updateEnabledState() {
|
|---|
| 39 | setEnabled(MainApplication.isDisplayingMapView());
|
|---|
| 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 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.