root / trunk / extensions / extWCS / src / com / iver / cit / gvsig / gui / toc / WCSZoomPixelCursorTocMenuEntry.java @ 7304
History | View | Annotate | Download (2.24 KB)
1 |
package com.iver.cit.gvsig.gui.toc; |
---|---|
2 |
|
3 |
import java.awt.event.ActionEvent; |
4 |
|
5 |
import javax.swing.JMenuItem; |
6 |
|
7 |
import com.iver.andami.PluginServices; |
8 |
import com.iver.cit.gvsig.fmap.MapControl; |
9 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
10 |
import com.iver.cit.gvsig.fmap.layers.FLyrWCS; |
11 |
import com.iver.cit.gvsig.fmap.tools.Behavior.Behavior; |
12 |
import com.iver.cit.gvsig.fmap.tools.Behavior.MouseMovementBehavior; |
13 |
import com.iver.cit.gvsig.fmap.tools.Behavior.PointBehavior; |
14 |
import com.iver.cit.gvsig.gui.toolListeners.StatusBarListener; |
15 |
import com.iver.cit.gvsig.gui.toolListeners.WCSZoomPixelCursorListener; |
16 |
import com.iver.cit.gvsig.project.documents.view.gui.View; |
17 |
import com.iver.cit.gvsig.project.documents.view.toc.TocMenuEntry; |
18 |
import com.iver.cit.gvsig.project.documents.view.toc.gui.FPopupMenu; |
19 |
|
20 |
/**
|
21 |
* @author Nacho Brodin <brodin_ign@gva.es>
|
22 |
*
|
23 |
* Entrada de men? para la activaci?n de la funcionalidad de zoom a un
|
24 |
* pixel centrado en el cursor.
|
25 |
*/
|
26 |
public class WCSZoomPixelCursorTocMenuEntry extends TocMenuEntry { |
27 |
private JMenuItem properties; |
28 |
FLayer lyr = null;
|
29 |
|
30 |
public void initialize(FPopupMenu m) { |
31 |
super.initialize(m);
|
32 |
|
33 |
if (isTocItemBranch()) {
|
34 |
lyr = getNodeLayer(); |
35 |
// Opcciones para capas WCS
|
36 |
if ((lyr instanceof FLyrWCS)) { |
37 |
properties = new JMenuItem(PluginServices.getText(this, "Zoom_pixel")); |
38 |
getMenu().add( properties ); |
39 |
properties.setFont(FPopupMenu.theFont); |
40 |
getMenu().setEnabled(true);
|
41 |
properties.addActionListener(this);
|
42 |
|
43 |
View vista = (View) PluginServices.getMDIManager().getActiveWindow(); |
44 |
MapControl mapCtrl = vista.getMapControl(); |
45 |
|
46 |
StatusBarListener sbl = new StatusBarListener(mapCtrl);
|
47 |
|
48 |
WCSZoomPixelCursorListener zp = new WCSZoomPixelCursorListener(mapCtrl);
|
49 |
mapCtrl.addMapTool("zoom_pixel_cursor", new Behavior[]{new PointBehavior(zp), new MouseMovementBehavior(sbl)}); |
50 |
} |
51 |
} |
52 |
} |
53 |
|
54 |
public void actionPerformed(ActionEvent e) { |
55 |
|
56 |
FLayer[] actives = getMapContext().getLayers().getActives();
|
57 |
if (actives.length==1) { |
58 |
lyr = getNodeLayer(); |
59 |
View vista = (View) PluginServices.getMDIManager().getActiveWindow(); |
60 |
MapControl mapCtrl = vista.getMapControl(); |
61 |
|
62 |
mapCtrl.setTool("zoom_pixel_cursor");
|
63 |
} |
64 |
} |
65 |
} |