25 |
* |
* |
26 |
* Contributors: |
* Contributors: |
27 |
* Martin O. J. Schmitz - initial API and implementation |
* Martin O. J. Schmitz - initial API and implementation |
28 |
* Stefan A. Krüger - additional utility classes |
* Stefan A. Tzeggai - additional utility classes |
29 |
******************************************************************************/ |
******************************************************************************/ |
30 |
package skrueger.geotools; |
package skrueger.geotools; |
31 |
|
|
35 |
import java.awt.event.ActionListener; |
import java.awt.event.ActionListener; |
36 |
import java.util.ArrayList; |
import java.util.ArrayList; |
37 |
import java.util.HashSet; |
import java.util.HashSet; |
|
import java.util.Locale; |
|
38 |
import java.util.Set; |
import java.util.Set; |
39 |
import java.util.SortedMap; |
import java.util.SortedMap; |
40 |
import java.util.TreeMap; |
import java.util.TreeMap; |
51 |
|
|
52 |
import org.apache.log4j.Logger; |
import org.apache.log4j.Logger; |
53 |
|
|
54 |
|
import schmitzm.geotools.gui.GeotoolsGUIUtil; |
55 |
import schmitzm.geotools.gui.SelectableXMapPane; |
import schmitzm.geotools.gui.SelectableXMapPane; |
56 |
|
import schmitzm.geotools.gui.XMapPaneEvent; |
57 |
|
import schmitzm.geotools.gui.XMapPaneTool; |
58 |
import schmitzm.geotools.map.event.JMapPaneListener; |
import schmitzm.geotools.map.event.JMapPaneListener; |
59 |
import schmitzm.geotools.map.event.MapAreaChangedEvent; |
import schmitzm.geotools.map.event.MapAreaChangedEvent; |
|
import schmitzm.geotools.map.event.MapPaneEvent; |
|
|
import schmitzm.lang.LangUtil; |
|
|
import schmitzm.lang.ResourceProvider; |
|
60 |
import schmitzm.swing.ButtonGroup; |
import schmitzm.swing.ButtonGroup; |
|
import schmitzm.swing.SwingUtil; |
|
61 |
import skrueger.swing.SmallButton; |
import skrueger.swing.SmallButton; |
62 |
import skrueger.swing.SmallToggleButton; |
import skrueger.swing.SmallToggleButton; |
63 |
|
|
72 |
* |
* |
73 |
* @author <a href="mailto:[email protected]">Martin Schmitz</a> |
* @author <a href="mailto:[email protected]">Martin Schmitz</a> |
74 |
* (University of Bonn/Germany) |
* (University of Bonn/Germany) |
75 |
* @version 1.2 Stefan Krüger |
* @version 1.2 Stefan Tzeggai |
76 |
*/ |
*/ |
77 |
public class MapPaneToolBar extends JToolBar { |
public class MapPaneToolBar extends JToolBar { |
78 |
private static final Logger LOGGER = Logger.getLogger(MapPaneToolBar.class |
private static final Logger LOGGER = Logger.getLogger(MapPaneToolBar.class |
79 |
.getName()); |
.getName()); |
80 |
|
|
|
public static ResourceProvider RESOURCE = new ResourceProvider(LangUtil |
|
|
.extendPackagePath(MapPaneToolBar.class, |
|
|
"resource.locales.mapPaneToolbar"), Locale.ENGLISH); |
|
|
|
|
81 |
public static String R(String key, Object... values) { |
public static String R(String key, Object... values) { |
82 |
return RESOURCE.getString(key, values); |
return GeotoolsGUIUtil.R(key, values); |
83 |
} |
} |
84 |
|
|
85 |
/** Constant for the tool "Panning" (10). */ |
/** Constant for the tool "Panning" (10). */ |
90 |
|
|
91 |
/** Constant for the tool "Zoom In" (110). */ |
/** Constant for the tool "Zoom In" (110). */ |
92 |
public static final int TOOL_ZOOMIN = 110; |
public static final int TOOL_ZOOMIN = 110; |
93 |
|
public static final int ACTION_ZOOM_DEFAULT = 150; |
94 |
/** Constant for the tool "Zoom Out" (120). */ |
/** Constant for the tool "Zoom Out" (120). */ |
95 |
public static final int TOOL_ZOOMOUT = 120; |
public static final int TOOL_ZOOMOUT = 120; |
96 |
/** Constant for the action "Zoom back" (130). */ |
/** Constant for the action "Zoom back" (130). */ |
203 |
|
|
204 |
// Create a Listener to listen to the zooms on the JMapPane |
// Create a Listener to listen to the zooms on the JMapPane |
205 |
this.mapPaneListener = new JMapPaneListener() { |
this.mapPaneListener = new JMapPaneListener() { |
206 |
public void performMapPaneEvent(MapPaneEvent e) { |
public void performMapPaneEvent(XMapPaneEvent e) { |
207 |
if (!(e instanceof MapAreaChangedEvent)) |
if (!(e instanceof MapAreaChangedEvent)) |
208 |
return; |
return; |
209 |
|
|
313 |
// MapView.class.getResource("resource/icons/info.png")), |
// MapView.class.getResource("resource/icons/info.png")), |
314 |
// R("MapPaneButtons.Info.TT")), false); |
// R("MapPaneButtons.Info.TT")), false); |
315 |
addTool(new MapPaneToolBarAction(TOOL_INFO, this, XMapPaneTool.INFO), false); |
addTool(new MapPaneToolBarAction(TOOL_INFO, this, XMapPaneTool.INFO), false); |
316 |
|
|
317 |
// Zoom in |
// Zoom in |
318 |
addTool(new MapPaneToolBarAction(TOOL_ZOOMIN, this, XMapPaneTool.ZOOM_IN), false); |
addTool(new MapPaneToolBarAction(TOOL_ZOOMIN, this, XMapPaneTool.ZOOM_IN), false); |
319 |
|
|
486 |
protected void performActionButton(int action, ActionEvent e) { |
protected void performActionButton(int action, ActionEvent e) { |
487 |
if (mapPane == null) |
if (mapPane == null) |
488 |
return; |
return; |
489 |
|
|
490 |
// Perform the action "Zoom back": Revert the last zoom |
// Perform the action "Zoom back": Revert the last zoom |
491 |
if (action == ACTION_ZOOM_BACK) { |
if (action == ACTION_ZOOM_BACK) { |
492 |
if (zoomBackIndex <= 1) |
if (zoomBackIndex <= 1) |
941 |
* wird) wird. Dann werden wird der Hintergrund auf WEISS gesetzt. |
* wird) wird. Dann werden wird der Hintergrund auf WEISS gesetzt. |
942 |
* |
* |
943 |
* @author <a href="mailto:[email protected]">Stefan Alfons |
* @author <a href="mailto:[email protected]">Stefan Alfons |
944 |
* Krüger</a> |
* Tzeggai</a> |
945 |
*/ |
*/ |
946 |
@Override |
@Override |
947 |
public void print(Graphics g) { |
public void print(Graphics g) { |