Revision 38063 trunk/extensions/extWCS/src/com/iver/cit/gvsig/gui/toc/WCSZoomPixelCursorTocMenuEntry.java

View differences:

WCSZoomPixelCursorTocMenuEntry.java
14 14
import com.iver.cit.gvsig.fmap.tools.Behavior.PointBehavior;
15 15
import com.iver.cit.gvsig.gui.toolListeners.WCSZoomPixelCursorListener;
16 16
import com.iver.cit.gvsig.project.documents.view.gui.BaseView;
17
import com.iver.cit.gvsig.project.documents.view.gui.View;
18 17
import com.iver.cit.gvsig.project.documents.view.toc.TocMenuEntry;
19 18
import com.iver.cit.gvsig.project.documents.view.toc.gui.FPopupMenu;
20 19
import com.iver.cit.gvsig.project.documents.view.toolListeners.StatusBarListener;
21 20

  
22
/** 
21
/**
23 22
 * @author Nacho Brodin <brodin_ign@gva.es>
24 23
 *
25 24
 * Entrada de men? para la activaci?n de la funcionalidad de zoom a un
......
28 27
public class WCSZoomPixelCursorTocMenuEntry extends TocMenuEntry {
29 28
	private JMenuItem properties;
30 29
	FLayer lyr = null;
31
	
30

  
32 31
	public void initialize(FPopupMenu m) {
33 32
		super.initialize(m);
34
		
33

  
35 34
		if (isTocItemBranch()) {
36 35
			lyr = getNodeLayer();
37 36
    		// Opcciones para capas WCS
38 37
    		if ((lyr instanceof FLyrWCS)) {
39 38
	    		properties = new JMenuItem(PluginServices.getText(this, "Zoom_pixel"));
40 39
	    		getMenu().add( properties );
41
	    		properties.setFont(FPopupMenu.theFont);
42 40
	    		getMenu().setEnabled(true);
43 41
	    		properties.addActionListener(this);
44
	    		
42

  
45 43
	    		IWindow window = PluginServices.getMDIManager().getActiveWindow();
46
	    		
47
	    		if(!(window instanceof BaseView))
48
	    			return;
49
	    	
44

  
45
	    		if(!(window instanceof BaseView)) {
46
			    return;
47
			}
48

  
50 49
	    		MapControl mapCtrl = ((BaseView)window).getMapControl();
51
		    	
50

  
52 51
		    	StatusBarListener sbl = new StatusBarListener(mapCtrl);
53
		    	
52

  
54 53
		    	WCSZoomPixelCursorListener zp = new WCSZoomPixelCursorListener(mapCtrl);
55 54
		    	mapCtrl.addMapTool("zoom_pixel_cursor", new Behavior[]{new PointBehavior(zp), new MouseMovementBehavior(sbl)});
56 55
    		}
57 56
		}
58 57
	}
59
	
58

  
60 59
	public void actionPerformed(ActionEvent e) {
61 60

  
62 61
		FLayer[] actives = getMapContext().getLayers().getActives();
63 62
		if (actives.length==1) {
64 63
	        lyr = getNodeLayer();
65 64
	        IWindow window = PluginServices.getMDIManager().getActiveWindow();
66
    		
67
    		if(!(window instanceof BaseView))
68
    			return;
69
    		
65

  
66
    		if(!(window instanceof BaseView)) {
67
		    return;
68
		}
69

  
70 70
	    	MapControl mapCtrl = ((BaseView)window).getMapControl();
71
	    	
72
	    	mapCtrl.setTool("zoom_pixel_cursor");  	 
73
		} 
71

  
72
	    	mapCtrl.setTool("zoom_pixel_cursor");
73
		}
74 74
	}
75 75
}

Also available in: Unified diff