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 |
|
|
37 |
import javax.swing.JPanel; |
import javax.swing.JPanel; |
38 |
import javax.swing.JSplitPane; |
import javax.swing.JSplitPane; |
39 |
|
|
40 |
|
import net.miginfocom.swing.MigLayout; |
41 |
|
|
42 |
import org.apache.log4j.Logger; |
import org.apache.log4j.Logger; |
43 |
|
|
44 |
import schmitzm.geotools.gui.GeoMapPane; |
import schmitzm.geotools.gui.GeoMapPane; |
|
import schmitzm.geotools.gui.JMapPane; |
|
45 |
import schmitzm.geotools.gui.MapContextControlPane; |
import schmitzm.geotools.gui.MapContextControlPane; |
46 |
import schmitzm.geotools.gui.MapPaneStatusBar; |
import schmitzm.geotools.gui.MapPaneStatusBar; |
47 |
|
import schmitzm.geotools.gui.SelectableXMapPane; |
48 |
import schmitzm.geotools.styling.ColorMapManager; |
import schmitzm.geotools.styling.ColorMapManager; |
49 |
|
|
50 |
/** |
/** |
71 |
/** |
/** |
72 |
* Creates a new {@link MapView}. A {@link MapView} is a combination of a |
* Creates a new {@link MapView}. A {@link MapView} is a combination of a |
73 |
* {@link GeoMapPane}, a {@link MapContextManagerInterface} on the left, and |
* {@link GeoMapPane}, a {@link MapContextManagerInterface} on the left, and |
74 |
* some buttons floating over the {@link JMapPane} |
* some buttons floating over the {@link SelectableXMapPane} |
75 |
*/ |
*/ |
76 |
public MapView(Component parentGui, MapPaneToolBar toolBar) { |
public MapView(Component parentGui, MapPaneToolBar toolBar) { |
77 |
super(new BorderLayout()); |
super(new BorderLayout()); |
78 |
// Call initialize() by yourself afterwards. |
// Call initialize() by yourself afterwards. |
79 |
// Needed because variables for the overwritten methods |
// Needed because variables for the overwritten methods |
80 |
// are not yet set. |
// are not yet set. |
|
getGeoMapPane().getMapPane().setWaitCursorComponent(parentGui); |
|
|
if (toolBar == null) |
|
|
toolBar = new MapPaneToolBar(getMapPane()); |
|
81 |
jToolBar = toolBar; |
jToolBar = toolBar; |
82 |
|
|
83 |
|
// By default the MapPane will render with antialiasing on |
84 |
|
getGeoMapPane().getMapPane() |
85 |
|
.setAntiAliasing(true); |
86 |
} |
} |
87 |
|
|
88 |
/** |
/** |
89 |
* Creates a new {@link MapView}. A {@link MapView} is a combination of a |
* Creates a new {@link MapView}. A {@link MapView} is a combination of a |
90 |
* {@link GeoMapPane}, a {@link MapContextManagerInterface} on the left, and |
* {@link GeoMapPane}, a {@link MapContextManagerInterface} on the left, and |
91 |
* some buttons floating over the {@link JMapPane} |
* some buttons floating over the {@link SelectableXMapPane} |
92 |
*/ |
*/ |
93 |
public MapView(Component parentGui) { |
public MapView(Component parentGui) { |
94 |
this(parentGui, null); |
this(parentGui, null); |
128 |
* To the right side we now add a JPanel that consists of a toolbar and |
* To the right side we now add a JPanel that consists of a toolbar and |
129 |
* a gmp |
* a gmp |
130 |
*/ |
*/ |
131 |
JPanel newRight = new JPanel(new BorderLayout()); |
JPanel newRight = new JPanel(new MigLayout("center, wrap 1","[grow]","[][grow]")); |
132 |
newRight.add(getToolBar(), BorderLayout.NORTH); |
newRight.add(getToolBar()); |
133 |
newRight.add(getGeoMapPane(), BorderLayout.CENTER); |
newRight.add(getGeoMapPane(),"growx, growy"); |
134 |
getSplitPane().add(newRight); |
getSplitPane().add(newRight); |
135 |
|
|
136 |
this.add(getSplitPane(), BorderLayout.CENTER); |
this.add(getSplitPane(), BorderLayout.CENTER); |
137 |
|
|
138 |
} |
} |
139 |
|
|
140 |
/** |
/** |
141 |
* Returns the tool bar which controls the active mouse actions on the map. |
* Returns the tool bar which controls the active mouse actions on the map. |
142 |
* |
* |
143 |
* @return |
* @return never <code>null</code>, will rather create a default |
144 |
*/ |
*/ |
145 |
public MapPaneToolBar getToolBar() { |
public MapPaneToolBar getToolBar() { |
146 |
|
if (jToolBar == null) { |
147 |
|
jToolBar = new MapPaneToolBar(getMapPane()); |
148 |
|
} |
149 |
return jToolBar; |
return jToolBar; |
150 |
} |
} |
151 |
|
|
230 |
/** |
/** |
231 |
* Liefert den Karten-Bereich der Komponente. |
* Liefert den Karten-Bereich der Komponente. |
232 |
*/ |
*/ |
233 |
public final JMapPane getMapPane() { |
public final SelectableXMapPane getMapPane() { |
234 |
return getGeoMapPane().getMapPane(); |
return getGeoMapPane().getMapPane(); |
235 |
} |
} |
236 |
|
|
242 |
return jToolBar.getSelectedTool(); |
return jToolBar.getSelectedTool(); |
243 |
} |
} |
244 |
|
|
245 |
|
/** |
246 |
|
* Help the garbage collection |
247 |
|
*/ |
248 |
|
public void dispose() { |
249 |
|
if (geoMapPane != null) |
250 |
|
geoMapPane.dispose(); |
251 |
|
} |
252 |
|
|
253 |
} |
} |