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