Revision 38063

View differences:

trunk/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/layout/gui/FPopupMenu.java
93 93
    private IFFrame[] selecteds;
94 94
    private static String extPoint="Layout_PopupActions";
95 95
    //private JMenuItem capa;
96
    // Lo de fijar la fuente es porque en linux se ve?a mal si no se fija.
97
    // TODO: Esto no funcionar? para idiomas como el chino. Hay que cambiarlo.
98
    public final static Font theFont = new Font("SansSerif", Font.PLAIN, 10);
99 96

  
100 97
    public static void registerExtensionPoint() {
101 98

  
......
179 176
		for (int i=0;i < actions.length;i++) {
180 177
			IContextMenuAction action = actions[i];
181 178
			MenuItem item = new MenuItem(action.getText(),action);
182
			item.setFont(theFont);
183 179
			item.setEnabled(action.isEnabled(null,this.selecteds));
184 180
			if (!action.getGroup().equals(group)) {
185 181
				if (group != null) this.addSeparator();
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/view/toc/gui/FPopupMenu.java
43 43
 */
44 44
package com.iver.cit.gvsig.project.documents.view.toc.gui;
45 45

  
46
import java.awt.Font;
47
import java.awt.event.ActionEvent;
48
import java.awt.event.ActionListener;
49
import java.lang.reflect.Array;
50
import java.text.NumberFormat;
51 46
import java.util.ArrayList;
52 47
import java.util.Arrays;
53
import java.util.Comparator;
54 48
import java.util.Iterator;
55 49
import java.util.List;
56 50

  
......
59 53
import javax.swing.tree.DefaultMutableTreeNode;
60 54

  
61 55
import org.gvsig.fmap.swing.toc.TOC;
62
import org.gvsig.fmap.swing.toc.TOCFactory;
63 56
import org.gvsig.fmap.swing.toc.TOCLocator;
64 57
import org.gvsig.fmap.swing.toc.TOCManager;
65 58
import org.gvsig.fmap.swing.toc.action.TOCAction;
......
67 60
import org.gvsig.tools.service.ServiceException;
68 61

  
69 62
import com.iver.andami.messages.NotificationManager;
70
import com.iver.cit.gvsig.TOCImplementationExtension;
71 63
import com.iver.cit.gvsig.fmap.MapContext;
72
import com.iver.cit.gvsig.fmap.ViewPort;
73 64
import com.iver.cit.gvsig.fmap.layers.FLayer;
74
import com.iver.cit.gvsig.project.documents.IContextMenuAction;
75 65
import com.iver.cit.gvsig.project.documents.view.toc.AbstractTocContextMenuAction;
76 66
import com.iver.cit.gvsig.project.documents.view.toc.ITocItem;
77 67
import com.iver.cit.gvsig.project.documents.view.toc.TocItemBranch;
78 68
import com.iver.cit.gvsig.project.documents.view.toc.TocMenuEntry;
79
import com.iver.cit.gvsig.project.documents.view.toc.actions.ChangeNameTocMenuEntry;
80
import com.iver.cit.gvsig.project.documents.view.toc.actions.CopyLayersTocMenuEntry;
81
import com.iver.cit.gvsig.project.documents.view.toc.actions.CutLayersTocMenuEntry;
82
import com.iver.cit.gvsig.project.documents.view.toc.actions.EliminarCapaTocMenuEntry;
83
import com.iver.cit.gvsig.project.documents.view.toc.actions.FLyrVectEditPropertiesTocMenuEntry;
84
import com.iver.cit.gvsig.project.documents.view.toc.actions.ChangeSymbolTocMenuEntry;
85
import com.iver.cit.gvsig.project.documents.view.toc.actions.FirstLayerTocMenuEntry;
86
import com.iver.cit.gvsig.project.documents.view.toc.actions.LayersGroupTocMenuEntry;
87
import com.iver.cit.gvsig.project.documents.view.toc.actions.LayersUngroupTocMenuEntry;
88 69
import com.iver.cit.gvsig.project.documents.view.toc.actions.OldTocContextMenuAction;
89
import com.iver.cit.gvsig.project.documents.view.toc.actions.PasteLayersTocMenuEntry;
90
import com.iver.cit.gvsig.project.documents.view.toc.actions.ReloadLayerTocMenuEntry;
91
import com.iver.cit.gvsig.project.documents.view.toc.actions.ShowLayerErrorsTocMenuEntry;
92
import com.iver.cit.gvsig.project.documents.view.toc.actions.ZoomAlTemaTocMenuEntry;
93 70
import com.iver.cit.gvsig.project.documents.view.toc.util.TOCMenuItemComparator;
94 71
import com.iver.utiles.extensionPoints.ExtensionPoint;
95
import com.iver.utiles.extensionPoints.ExtensionPoints;
96 72
import com.iver.utiles.extensionPoints.ExtensionPointsSingleton;
97 73

  
98 74
/**
......
115 91
    private ExtensionPoint extensionPoint;
116 92
    private FLayer[] selecteds;
117 93
    //private JMenuItem capa;
118
    // Lo de fijar la fuente es porque en linux se ve?a mal si no se fija.
119
    // TODO: Esto no funcionar? para idiomas como el chino. Hay que cambiarlo.
120
    public final static Font theFont = new Font("SansSerif", Font.PLAIN, 10);
121
    
94

  
95

  
122 96
    /**
123 97
     * @deprecated
124 98
     */
......
134 108
    /**
135 109
     * @deprecated
136 110
     */
137
    
111

  
138 112
    /*
139 113
    public static Object getEntry(String className, boolean[][] bb) {
140 114
    	ExtensionPoints extensionPoints = ExtensionPointsSingleton.getInstance();
......
190 164
    public MapContext getMapContext() { return mapContext; }
191 165

  
192 166
	public ITocItem getNodeUserObject() {
193
		if (nodo == null) return null;
167
		if (nodo == null) {
168
		    return null;
169
		}
194 170
		return (ITocItem)nodo.getUserObject();
195 171
	}
196 172

  
......
199 175
	}
200 176

  
201 177
    private List<TOCAction> getActionList() {
202
    	
178

  
203 179
    	TOCManager tm = TOCLocator.getInstance().getTOCManager();
204 180
		List<TOCAction> result_list = null;
205 181
		List<TOCAction> result_list_sort = null;
206
		
182

  
207 183
		try {
208 184
			result_list = tm.getActions(toc);
209 185
		} catch (ServiceException se) {
210 186
			NotificationManager.addError("While getting actions for fpopupmenu", se);
211 187
			return null;
212 188
		}
213
		
214 189

  
215
    	
190

  
191

  
216 192
    	AbstractTocContextMenuAction action;
217 193
    	boolean contains=false;
218 194
    	ITocItem tocItem=(ITocItem)this.getNodeUserObject();
219 195
    	if (tocItem instanceof TocItemBranch){
220 196
    		for (int i=0;i<this.selecteds.length;i++){
221
    			if (this.selecteds[i].equals(((TocItemBranch)tocItem).getLayer()))
222
    				contains=true;
197
    			if (this.selecteds[i].equals(((TocItemBranch)tocItem).getLayer())) {
198
			    contains=true;
199
			}
223 200
    		}
224 201
    	}else{
225 202
    		contains=true;
226 203
    	}
227
    	
204

  
228 205
    	if (contains){
229 206

  
230 207
    		result_list_sort = new ArrayList<TOCAction>();
......
236 213
    		}
237 214
    		return result_list_sort;
238 215

  
239
    		
216

  
240 217
    		//    		Iterator iter = this.extensionPoint.keySet().iterator();
241 218
//    		while (iter.hasNext()) {
242 219
//    			action = null;
......
284 261
	*/
285 262

  
286 263
	private void createMenuElements(List<TOCAction> actions) {
287
		
264

  
288 265
		String group = null;
289 266
		String item_group = null;
290 267
		TOCAction action = null;
291
		
268

  
292 269
		for (int i=0;i < actions.size();i++) {
293
			
270

  
294 271
			action = actions.get(i);
295
			
272

  
296 273
			if (!action.isVisible() ||
297 274
					(action instanceof TOCActionAdapter &&
298 275
							((TOCActionAdapter) action).getContextMenuAction() instanceof OldTocContextMenuAction)) {
......
302 279
				}
303 280
				continue;
304 281
			}
305
			
282

  
306 283
			JMenuItem item = new JMenuItem(action);
307
			item.setFont(theFont);
284
	    // item.setFont(theFont);
308 285
			item.setEnabled(action.isEnabled());
309 286
			item_group = action.getValue(TOCAction.GROUP).toString();
310 287
			if (group == null || item_group.compareToIgnoreCase(group) != 0) {
311
				if (group != null) this.addSeparator();
288
				if (group != null) {
289
				    this.addSeparator();
290
				}
312 291
				group = item_group;
313 292
			}
314 293
			this.add(item);
315 294
		}
316
		
295

  
317 296
		// comprobamos si el ultimo elemento es un seprardor
318 297
		// not here
319 298
		/*
trunk/extensions/extWCS/src/com/iver/cit/gvsig/gui/toc/WCSZoomToPixelTocMenuEntry.java
54 54
import com.iver.cit.gvsig.project.documents.view.toc.TocMenuEntry;
55 55
import com.iver.cit.gvsig.project.documents.view.toc.gui.FPopupMenu;
56 56

  
57
/** 
57
/**
58 58
 * This class implements the TOC meny entry to do a zoom to pixel.
59 59
 * Zooming to a pixel causes to change the view's zoom to fit in the coverage's native
60 60
 * resolution.
61
 * 
61
 *
62 62
 * Entrada de men? para la activaci?n de la funcionalidad de zoom a un
63 63
 * pixel.
64 64
 * @author Jaume - jaume.dominguez@iver.es
......
68 68
	private JMenuItem properties;
69 69
	FLayer lyr = null;
70 70
	public int zoomType = ZOOM_TO_VIEW_CENTER;
71
	
71

  
72 72
	public void initialize(FPopupMenu m) {
73 73
		super.initialize(m);
74
		
74

  
75 75
		if (isTocItemBranch()) {
76 76
			lyr = getNodeLayer();
77 77
    		// Opciones para capas raster
78 78
    		if ((lyr instanceof FLyrWCS)) {
79 79
    			properties = new JMenuItem(PluginServices.getText(this, "Zoom_pixel"));
80 80
    			getMenu().add( properties );
81
    			properties.setFont(FPopupMenu.theFont);
82 81
    			getMenu().setEnabled(true);
83 82
    			// LWS getMenu().addSeparator();
84 83
    			properties.addActionListener(this);
......
87 86
	}
88 87
	/**
89 88
	 * Calculates the zoom that fits the coverage native resolution.
90
	 * 
89
	 *
91 90
	 * TODO fix the little loss of accuracy caused by a floating point issue
92 91
	 */
93 92
	public void actionPerformed(ActionEvent e) {
94 93
		//System.out.println("Zoom a un pixel");
95
		
94

  
96 95
    	ViewPort v = getMapContext().getViewPort();
97
    	
96

  
98 97
    	double w2 = v.getImageWidth()/2D;
99 98
    	double h2 = v.getImageHeight()/2D;
100 99
    	double wcOriginCenterX = v.getExtent().getMinX()+((v.getExtent().getMaxX()-v.getExtent().getMinX())/2D);
......
109 108
    	double wcDstWidth = w2*maxRes.getX()*2D;
110 109
       	//double wcDstHeight = h2*maxRes*2D;
111 110
    	double wcDstHeight = h2*maxRes.getY()*2D;
112
    	
111

  
113 112
    	getMapContext().getViewPort().setExtent(
114 113
    			new Rectangle2D.Double(wcDstMinX, wcDstMinY, wcDstWidth, wcDstHeight));
115 114

  
trunk/extensions/extWCS/src/com/iver/cit/gvsig/gui/toc/WCSPropsTocMenuEntry.java
53 53

  
54 54
/**
55 55
 * Changes the connection properties.
56
 * 
56
 *
57 57
 * Cambia las propiedades de la conexi?n al servidor WCS.
58
 * 
58
 *
59 59
 * @author jaume - jaume.dominguez@iver.es
60 60
 */
61 61
public class WCSPropsTocMenuEntry  extends TocMenuEntry {
......
63 63
	FLayer lyr = null;
64 64
	public void initialize(FPopupMenu m) {
65 65
		super.initialize(m);
66
		
66

  
67 67
		if (isTocItemBranch()) {
68 68
			lyr = getNodeLayer();
69 69
    		// Opciones para capas WCS
70 70
    		if ((lyr instanceof FLyrWCS)) {
71 71
    			propsMenuItem = new JMenuItem(PluginServices.getText(this, "wcs_properties"));
72 72
    			getMenu().add( propsMenuItem );
73
    			propsMenuItem.setFont(FPopupMenu.theFont);
74 73
    			getMenu().setEnabled(true);
75 74
    			//getMenu().addSeparator();
76 75
    	        //Cambio color
77
    			propsMenuItem.addActionListener(this);   			
76
    			propsMenuItem.addActionListener(this);
78 77
     		}
79 78
		}
80 79
	}
81
	
80

  
82 81
	public void actionPerformed(ActionEvent e) {
83 82
       	lyr = getNodeLayer();
84 83
       	WCSPropsDialog dialog = new WCSPropsDialog((FLyrWCS) lyr);
85
       	PluginServices.getMDIManager().addWindow(dialog);       	
84
       	PluginServices.getMDIManager().addWindow(dialog);
86 85
	}
87 86
}
trunk/extensions/extWCS/src/com/iver/cit/gvsig/gui/toc/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
}
trunk/extensions/extWMS/src/com/iver/cit/gvsig/gui/toc/WMSPropsTocMenuEntry.java
54 54
public class WMSPropsTocMenuEntry extends TocMenuEntry {
55 55
	private JMenuItem propsMenuItem;
56 56
	FLayer lyr = null;
57
	
57

  
58 58
	public void initialize(FPopupMenu m) {
59 59
		super.initialize(m);
60
		
60

  
61 61
		if (isTocItemBranch()) {
62 62
			lyr = getNodeLayer();
63 63
    		if ((lyr instanceof FLyrWMS)) {
64 64
    			propsMenuItem = new JMenuItem(PluginServices.getText(this, "wms_properties"));
65 65
    			getMenu().add( propsMenuItem );
66
    			propsMenuItem.setFont(FPopupMenu.theFont);
67 66
    			getMenu().setEnabled(true);
68
    			propsMenuItem.addActionListener(this);   			
67
    			propsMenuItem.addActionListener(this);
69 68
     		}
70 69
		}
71 70
	}
72
	
71

  
73 72
	public void actionPerformed(ActionEvent e) {
74 73
		lyr = getNodeLayer();
75 74
		if (lyr.isAvailable()) {
trunk/extensions/extWMS/src/com/iver/cit/gvsig/gui/toc/ZoomToVisibleScaleTocMenuEntry.java
54 54
public class ZoomToVisibleScaleTocMenuEntry extends TocMenuEntry {
55 55
	private JMenuItem propsMenuItem;
56 56
	FLayer lyr = null;
57
	
57

  
58 58
	public void initialize(FPopupMenu m) {
59 59
		super.initialize(m);
60
		
60

  
61 61
		if (isTocItemBranch()) {
62 62
			lyr = getNodeLayer();
63 63
    		if ((lyr instanceof FLyrWMS)) {
64 64
    			propsMenuItem = new JMenuItem(PluginServices.getText(this, "zoom_to_visible_scale"));
65 65
    			getMenu().add( propsMenuItem );
66
    			propsMenuItem.setFont(FPopupMenu.theFont);
67 66
    			getMenu().setEnabled(true);
68
    			propsMenuItem.addActionListener(this);   			
67
    			propsMenuItem.addActionListener(this);
69 68
     		}
70 69
		}
71 70
	}
72
	
71

  
73 72
	public void actionPerformed(ActionEvent e) {
74 73
		lyr = getNodeLayer();
75 74
		if (lyr.isAvailable()) {
......
77 76
				FLyrWMS wmsLayer = (FLyrWMS) lyr;
78 77
				MapContext mp = getMapContext();
79 78
				double mapScale = (double) mp.getScaleView();
80
				double correctedMinScale = wmsLayer.getCorrectedServerMinScale(); 
79
				double correctedMinScale = wmsLayer.getCorrectedServerMinScale();
81 80
				double correctedMaxScale = wmsLayer.getCorrectedServerMaxScale();
82 81

  
83 82
				if (correctedMinScale>0 // -1 and 0 are invalid values for scale
......
88 87
						&& mapScale>=correctedMaxScale){
89 88
					/**
90 89
					 * As the WMS 1.3 standard defines the MAX DENOMINATOR SCALE as a non-inclusive
91
					 * interval limit, we have to subtract a constant to MAX_SCALE in order to 
90
					 * interval limit, we have to subtract a constant to MAX_SCALE in order to
92 91
					 * move to the "safe side" of the limit.
93 92
					 */
94 93
					mp.setScaleView((long)correctedMaxScale-1);
trunk/frameworks/_fwAndami/config/text_km.properties
1
#Translations for language [km]
2
#Mon Sep 21 10:01:58 CEST 2009
3
MDIFrame.quiere_salir=\u1785\u17c1\u1789\u200b\u1796\u17b8 gvSIG ?
4

  

Also available in: Unified diff