/[schmitzm]/trunk/src/skrueger/geotools/MapView.java
ViewVC logotype

Annotation of /trunk/src/skrueger/geotools/MapView.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 111 - (hide annotations)
Tue May 12 23:33:14 2009 UTC (15 years, 9 months ago) by alfonx
File size: 5688 byte(s)
* Fixed some bugs with the SelectionListeners and the JMapPane. To make this work,  StyledFeatureLayerSelectionModel now extends StyledLayerSelectionModel<String>. So the selection is remembered as a Set of Feature-IDs. This change was needed, because Feature.java doesn't overwrite the equals method, and therefore the HashSet didn't function as expected.
* Added new Tools and BUttons to MapPaneToolBar.java to select features
* Changed a lot in MapPaneToolBar.java. It now allows to position Spaces, Actions and Tools via the ID field. (the new feature is to mix them)
* Fixed a bug in AV's ClickInfoPanel that would suddenly pop up an AtlasViewer if started from Geopublisher under special circumstances.
* Moving layers in the legend is using MapContext's move method instead of remove and insert.
* LayerPanel's remember* Maps now all have the MapLayer's ID as a key. 

This commit includes latest schmitzm.jar and av.jar. The av.jar is also commited to the ISDSS, but the ISDSS will still have the old schmitzm.jar. Latest schmitzm.jar in ISDSS should be updated ASAP. I just don't know where to put it.
1 mojays 2 package skrueger.geotools;
2    
3     import java.awt.BorderLayout;
4 alfonx 87 import java.awt.Window;
5 mojays 2
6     import javax.swing.BorderFactory;
7     import javax.swing.JComponent;
8     import javax.swing.JPanel;
9     import javax.swing.JSplitPane;
10    
11     import org.apache.log4j.Logger;
12    
13     import schmitzm.geotools.gui.GeoMapPane;
14     import schmitzm.geotools.gui.JMapPane;
15     import schmitzm.geotools.gui.MapContextControlPane;
16     import schmitzm.geotools.gui.MapPaneStatusBar;
17     import schmitzm.geotools.styling.ColorMapManager;
18    
19     /**
20     * Achtung! Dieser code ist verwuestet
21     */
22    
23     /**
24     * TODO DOKU und initialize schöner machen. SK
25     */
26     public class MapView extends JPanel {
27     private static final Logger LOGGER = Logger.getLogger(MapView.class);
28    
29     private final JSplitPane splitPane = new JSplitPane(
30     JSplitPane.HORIZONTAL_SPLIT);
31    
32     protected MapPaneStatusBar statusBar = null;
33    
34     /**
35     * Komponente, in der die Karten, der Massstab und das Koordinaten-Raster
36     * dargestellt werden
37     */
38     protected final GeoMapPane geoMapPane = new GeoMapPane();
39    
40     private MapPaneToolBar jToolBar;
41    
42     /**
43     * Creates a new {@link MapView}. A {@link MapView} is a combination of a
44     * {@link GeoMapPane}, a {@link MapContextManagerInterface} on the left,
45     * and some buttons floating over the {@link JMapPane}
46     */
47 alfonx 87 public MapView(Window parentGui, MapPaneToolBar toolBar) {
48 mojays 2 super(new BorderLayout());
49     // Call initialize() by yourself afterwards.
50     // Needed because variables for the overwritten methods
51     // are not yet set.
52 alfonx 87 getGeoMapPane().getMapPane().setWaitCursorComponent(parentGui);
53 mojays 2 if ( toolBar == null )
54     toolBar = new MapPaneToolBar(getMapPane());
55     jToolBar = toolBar;
56     }
57    
58     /**
59     * Creates a new {@link MapView}. A {@link MapView} is a combination of a
60     * {@link GeoMapPane}, a {@link MapContextManagerInterface} on the left,
61     * and some buttons floating over the {@link JMapPane}
62     */
63 alfonx 87 public MapView(Window parentGui) {
64     this(parentGui, null);
65 mojays 2 }
66    
67     /**
68     * Calls #getSidePanel() which can be overwritten.
69     *
70     * @see #adjustSizeOfGeoMapPane()
71     */
72     public void initialize() {
73     // horizontales SplitPane initialisieren
74    
75     // Status-Zeile
76     statusBar = new MapPaneStatusBar(getGeoMapPane()
77     .getMapPane());
78     statusBar.setBorder(BorderFactory.createCompoundBorder(BorderFactory
79     .createLoweredBevelBorder(), BorderFactory.createEmptyBorder(2,
80     5, 2, 5)));
81     this.add(statusBar, BorderLayout.SOUTH);
82    
83     splitPane.setDividerLocation(0.4);
84     splitPane.setDividerSize(5);
85    
86     splitPane.add(getSidePane());
87    
88     /***********************************************************************
89     * To the right side we now add a JPanel that consists of a toolbar and
90     * a gmp
91     */
92     JPanel newRight = new JPanel(new BorderLayout());
93     newRight.add(getToolBar(), BorderLayout.NORTH);
94     newRight.add(getGeoMapPane(), BorderLayout.CENTER);
95     splitPane.add(newRight);
96    
97     this.add(splitPane, BorderLayout.CENTER);
98     }
99    
100     /**
101     * Returns the tool bar which controls the active mouse actions on the map.
102     * @return
103     */
104     public MapPaneToolBar getToolBar() {
105     return jToolBar;
106     }
107    
108     /**
109     * Returns the split pane which divides the layer list from the map panel.
110     */
111     public JSplitPane getSplitPane() {
112     return this.splitPane;
113     }
114    
115    
116     /**
117     * Sets the active tool.
118     * Simply calls {@link MapPaneToolBar#setSelectedTool(Integer)}.
119     * @param tool
120     * One of {@link #TOOL_INFO}, {@link #TOOL_PAN} .. constants
121     */
122     public void setSelectedTool(Integer tool) {
123     jToolBar.setSelectedTool(tool);
124     }
125    
126     /**
127     * Sets whether a tool is activated or not.
128     * Simply calls {@link MapPaneToolBar#setButtonEnabled(int, boolean, boolean)}.
129     * @param tool tool ID
130     * @param enabled if {@code true} the tool becomes available
131     * @param hideOnDisable if {@code true} the button is also hidden if
132     * {@code enabled} is {@code false}
133     */
134     public void setToolEnabled(Integer tool, boolean enabled, boolean hideOnDisable) {
135     jToolBar.setButtonEnabled(tool,enabled,hideOnDisable);
136     }
137    
138     /**
139     * Sets the activation for all tools.
140     * Simply calls {@link MapPaneToolBar#setAllToolsEnabled(boolean, boolean)}.
141     * @param enabled if {@code true} all tool becomes available
142     * @param hideOnDisable if {@code true} the buttons are also hidden if
143     * {@code enabled} is {@code false}
144     */
145     public void setAllToolsEnabled(boolean enabled, boolean hideOnDisable) {
146     jToolBar.setAllToolsEnabled(enabled, hideOnDisable);
147     }
148    
149     /**
150     * Checks whether a tool is activated.
151     * Simply calls {@link MapPaneToolBar#isButtonEnabled(Integer)}.
152     * @param tool tool ID
153     * @return {@code false} if an unknown ID is specified
154     */
155     public boolean isToolEnabled(Integer tool) {
156     return jToolBar.isButtonEnabled(tool);
157     }
158    
159     /**
160     * called by initialize() to fill the left of the XULUMapView Supposed to be
161     * overwritten by AtlasMapView or DesignMapView
162     */
163     public JComponent getSidePane() {
164     return new MapContextControlPane(getGeoMapPane().getMapPane(),
165     new ColorMapManager());
166     }
167    
168     /**
169     * Liefert die Status-Zeile, in der die Koordinaten und Raster-Werte
170     * angezeigt werden.
171     */
172     public MapPaneStatusBar getStatusBar() {
173     return this.statusBar;
174     }
175    
176     /**
177     * Liefert den Karten-Bereich der Komponente.
178     */
179     public final JMapPane getMapPane() {
180     return getGeoMapPane().getMapPane();
181     }
182    
183     public GeoMapPane getGeoMapPane() {
184     return geoMapPane;
185     }
186    
187     public int getSelectedTool() {
188     return jToolBar.getSelectedTool();
189     }
190    
191     }

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26