root / branches / v051 / applications / appgvSIG / src / com / iver / cit / gvsig / gui / toc / FPopupMenu.java @ 4161
History | View | Annotate | Download (35.6 KB)
1 |
/*
|
---|---|
2 |
* Created on 02-mar-2004
|
3 |
*
|
4 |
* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
5 |
*
|
6 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
7 |
*
|
8 |
* This program is free software; you can redistribute it and/or
|
9 |
* modify it under the terms of the GNU General Public License
|
10 |
* as published by the Free Software Foundation; either version 2
|
11 |
* of the License, or (at your option) any later version.
|
12 |
*
|
13 |
* This program is distributed in the hope that it will be useful,
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
* GNU General Public License for more details.
|
17 |
*
|
18 |
* You should have received a copy of the GNU General Public License
|
19 |
* along with this program; if not, write to the Free Software
|
20 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
21 |
*
|
22 |
* For more information, contact:
|
23 |
*
|
24 |
* Generalitat Valenciana
|
25 |
* Conselleria d'Infraestructures i Transport
|
26 |
* Av. Blasco Ib??ez, 50
|
27 |
* 46010 VALENCIA
|
28 |
* SPAIN
|
29 |
*
|
30 |
* +34 963862235
|
31 |
* gvsig@gva.es
|
32 |
* www.gvsig.gva.es
|
33 |
*
|
34 |
* or
|
35 |
*
|
36 |
* IVER T.I. S.A
|
37 |
* Salamanca 50
|
38 |
* 46005 Valencia
|
39 |
* Spain
|
40 |
*
|
41 |
* +34 963163400
|
42 |
* dac@iver.es
|
43 |
*/
|
44 |
package com.iver.cit.gvsig.gui.toc; |
45 |
|
46 |
import java.awt.Color; |
47 |
import java.awt.Font; |
48 |
import java.awt.event.ActionEvent; |
49 |
import java.awt.geom.Rectangle2D; |
50 |
import java.util.ArrayList; |
51 |
|
52 |
import javax.swing.JColorChooser; |
53 |
import javax.swing.JDialog; |
54 |
import javax.swing.JMenuItem; |
55 |
import javax.swing.JPopupMenu; |
56 |
import javax.swing.tree.DefaultMutableTreeNode; |
57 |
|
58 |
import org.cresques.io.GeoRasterFile; |
59 |
import org.cresques.io.raster.RasterFilter; |
60 |
import org.cresques.io.raster.RasterFilterStackManager; |
61 |
import org.cresques.ui.raster.BandSetupPanel; |
62 |
import org.cresques.ui.raster.EnhancedPanel; |
63 |
import org.cresques.ui.raster.FilterRasterDialogPanel; |
64 |
import org.cresques.ui.raster.RasterTransparencyPanel; |
65 |
import org.cresques.ui.raster.SharpeningPanel; |
66 |
|
67 |
import com.iver.andami.PluginServices; |
68 |
import com.iver.cit.gvsig.ProjectExtension; |
69 |
import com.iver.cit.gvsig.fmap.DriverException; |
70 |
import com.iver.cit.gvsig.fmap.FMap; |
71 |
import com.iver.cit.gvsig.fmap.MapControl; |
72 |
import com.iver.cit.gvsig.fmap.ViewPort; |
73 |
import com.iver.cit.gvsig.fmap.core.v02.FSymbol; |
74 |
import com.iver.cit.gvsig.fmap.layers.CancelationException; |
75 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
76 |
import com.iver.cit.gvsig.fmap.layers.FLayers; |
77 |
import com.iver.cit.gvsig.fmap.layers.FLyrDefault; |
78 |
import com.iver.cit.gvsig.fmap.layers.FLyrRaster; |
79 |
import com.iver.cit.gvsig.fmap.layers.RasterAdapter; |
80 |
import com.iver.cit.gvsig.fmap.layers.layerOperations.AlphanumericData; |
81 |
import com.iver.cit.gvsig.fmap.layers.layerOperations.ClassifiableVectorial; |
82 |
import com.iver.cit.gvsig.fmap.rendering.SingleSymbolLegend; |
83 |
import com.iver.cit.gvsig.gui.View; |
84 |
import com.iver.cit.gvsig.gui.Panels.AdjustTransparencyPanel; |
85 |
import com.iver.cit.gvsig.gui.Panels.PropertiesRasterDialog; |
86 |
import com.iver.cit.gvsig.gui.thememanager.FThemeManagerWindow; |
87 |
import com.iver.cit.gvsig.project.Project; |
88 |
import com.iver.cit.gvsig.project.ProjectTable; |
89 |
|
90 |
/**
|
91 |
* Realiza el cambio de color si se pulsa OK
|
92 |
* @author Luis W. Sevilla (sevilla_lui@gva.es)
|
93 |
*/
|
94 |
class FSymbolChangeColorTocMenuEntry extends TocMenuEntry { |
95 |
private JMenuItem color; |
96 |
public void initialize(FPopupMenu m) { |
97 |
super.initialize(m);
|
98 |
boolean bShow = false; |
99 |
if (isTocItemBranch())
|
100 |
{ |
101 |
FLayer lyr = getNodeLayer(); |
102 |
if ((lyr instanceof ClassifiableVectorial)) |
103 |
{ |
104 |
ClassifiableVectorial lyrVect = (ClassifiableVectorial) lyr; |
105 |
if (lyrVect.getLegend() instanceof SingleSymbolLegend) |
106 |
bShow = true;
|
107 |
} |
108 |
} |
109 |
else
|
110 |
bShow = true;
|
111 |
if (bShow)
|
112 |
{ |
113 |
color = new JMenuItem(PluginServices.getText(this, "Cambio_Color")); |
114 |
color.setFont(FPopupMenu.theFont); |
115 |
getMenu().add(color); |
116 |
getMenu().setEnabled(true);
|
117 |
//Cambio color
|
118 |
color.addActionListener(this);
|
119 |
} |
120 |
} |
121 |
|
122 |
/* (non-Javadoc)
|
123 |
* @see com.iver.cit.gvsig.gui.toc.TocMenuEntry#execute(com.iver.cit.gvsig.gui.toc.ITocItem)
|
124 |
*/
|
125 |
public void actionPerformed(ActionEvent e) { |
126 |
ITocItem tocItem = (ITocItem) getNodeUserObject(); |
127 |
|
128 |
Color newColor = JColorChooser.showDialog(null, |
129 |
PluginServices.getText(this, "Elegir_Color"), |
130 |
null);
|
131 |
if (newColor != null) |
132 |
{ |
133 |
if (isTocItemBranch())
|
134 |
{ |
135 |
//FLayer lyr = getNodeLayer();
|
136 |
FLayer[] actives = getMapContext().getLayers().getActives();
|
137 |
for (int i=0;i<actives.length;i++){ |
138 |
if ((actives[i] instanceof ClassifiableVectorial)) |
139 |
{ |
140 |
ClassifiableVectorial lyrVect = (ClassifiableVectorial) actives[i]; |
141 |
if (lyrVect.getLegend() instanceof SingleSymbolLegend) |
142 |
{ |
143 |
SingleSymbolLegend leg = (SingleSymbolLegend) lyrVect.getLegend(); |
144 |
leg.getDefaultSymbol().setColor(newColor); |
145 |
} |
146 |
} |
147 |
} |
148 |
} |
149 |
else
|
150 |
{ |
151 |
TocItemLeaf leaf = (TocItemLeaf) tocItem; |
152 |
FSymbol sym = leaf.getSymbol(); |
153 |
sym.setColor(newColor); |
154 |
|
155 |
} |
156 |
// TRUCO PARA REFRESCAR.
|
157 |
getMapContext().invalidate(); |
158 |
|
159 |
} |
160 |
|
161 |
} |
162 |
} |
163 |
/**
|
164 |
* Realiza un cambio de nombre en la capa seleccionada
|
165 |
*
|
166 |
* @author Vicente Caballero Navarro
|
167 |
*/
|
168 |
class ChangeNameTocMenuEntry extends TocMenuEntry { |
169 |
private JMenuItem changename; |
170 |
public void initialize(FPopupMenu m) { |
171 |
super.initialize(m);
|
172 |
//boolean bShow = false;
|
173 |
if (isTocItemBranch())
|
174 |
{ |
175 |
changename = new JMenuItem(PluginServices.getText(this, "cambio_nombre")); |
176 |
changename.setFont(FPopupMenu.theFont); |
177 |
getMenu().add(changename); |
178 |
getMenu().setEnabled(true);
|
179 |
if (getMapContext().getLayers().getActives().length == 1) { |
180 |
changename.setEnabled(true);
|
181 |
} else {
|
182 |
changename.setEnabled(false);
|
183 |
} |
184 |
//Cambio nombre
|
185 |
changename.addActionListener(this);
|
186 |
|
187 |
} |
188 |
} |
189 |
|
190 |
/* (non-Javadoc)
|
191 |
* @see com.iver.cit.gvsig.gui.toc.TocMenuEntry#execute(com.iver.cit.gvsig.gui.toc.ITocItem)
|
192 |
*/
|
193 |
public void actionPerformed(ActionEvent e) { |
194 |
//ITocItem tocItem = (ITocItem) getNodeUserObject();
|
195 |
if (isTocItemBranch())
|
196 |
{ |
197 |
FLayer lyr = getNodeLayer(); |
198 |
ChangeName chn=new ChangeName(lyr.getName());
|
199 |
PluginServices.getMDIManager().addView(chn); |
200 |
getNodeLayer().setName(chn.getName()); |
201 |
} |
202 |
// TRUCO PARA REFRESCAR.
|
203 |
///getMapContext().invalidate();
|
204 |
|
205 |
} |
206 |
} |
207 |
/**
|
208 |
* Muestra el men? de propiedades del tema.
|
209 |
*
|
210 |
* @author jmorell
|
211 |
*
|
212 |
* TODO To change the template for this generated type comment go to
|
213 |
* Window - Preferences - Java - Code Style - Code Templates
|
214 |
*/
|
215 |
class FLyrVectEditPropertiesTocMenuEntry extends TocMenuEntry { |
216 |
private JMenuItem prop; |
217 |
public void initialize(FPopupMenu m) { |
218 |
super.initialize(m);
|
219 |
FLayer lyr = null;
|
220 |
if (isTocItemBranch()) {
|
221 |
getMenu().addSeparator(); |
222 |
lyr = getNodeLayer(); |
223 |
//if ((lyr instanceof ClassifiableVectorial) && (getMapContext().getLayers().getActives().length == 1)) {
|
224 |
if ((lyr instanceof ClassifiableVectorial)) { |
225 |
prop = new JMenuItem(PluginServices.getText(this, "propiedades")); |
226 |
getMenu().add(prop); |
227 |
prop.setFont(FPopupMenu.theFont); |
228 |
if (getMapContext().getLayers().getActives().length == 1) { |
229 |
prop.setEnabled(true);
|
230 |
} else {
|
231 |
prop.setEnabled(false);
|
232 |
} |
233 |
//Cambio estilo
|
234 |
prop.addActionListener(this);
|
235 |
} |
236 |
} |
237 |
} |
238 |
/* (non-Javadoc)
|
239 |
* @see com.iver.cit.gvsig.gui.toc.TocMenuEntry#execute(com.iver.cit.gvsig.gui.toc.ITocItem)
|
240 |
*/
|
241 |
public void actionPerformed(ActionEvent e) { |
242 |
/*FThemeManagerWindow fThemeManagerWindow = new FThemeManagerWindow();
|
243 |
try {
|
244 |
fThemeManagerWindow.setMapContext(getMapContext());
|
245 |
} catch (com.iver.cit.gvsig.fmap.DriverException e1) {
|
246 |
e1.printStackTrace();
|
247 |
}*/
|
248 |
FLayer[] actives = getMapContext().getLayers().getActives();
|
249 |
FThemeManagerWindow fThemeManagerWindow; |
250 |
if (actives.length==1) { |
251 |
System.out.println("openPliegoThemeProperties(): Una sola capa. Abrimos el panel para la capa " + actives[0]); |
252 |
fThemeManagerWindow = new FThemeManagerWindow();
|
253 |
try {
|
254 |
fThemeManagerWindow.setMapContext(getMapContext()); |
255 |
} catch (com.iver.cit.gvsig.fmap.DriverException e1) {
|
256 |
e1.printStackTrace(); |
257 |
} |
258 |
//PluginServices.getMDIManager().addView(fThemeManagerWindow);
|
259 |
if (PluginServices.getMainFrame() == null) { |
260 |
JDialog dlg = new JDialog(); |
261 |
fThemeManagerWindow.setPreferredSize(fThemeManagerWindow.getSize()); |
262 |
dlg.getContentPane().add(fThemeManagerWindow); |
263 |
dlg.setModal(false);
|
264 |
dlg.pack(); |
265 |
dlg.show(); |
266 |
} else {
|
267 |
PluginServices.getMDIManager().addView(fThemeManagerWindow); |
268 |
} |
269 |
} else {
|
270 |
for (int i = 0; i < actives.length; i++){ |
271 |
System.out.println("openPliegoThemeProperties(): Muchas capas. Abrimos el panel para la capa " + actives[i]); |
272 |
fThemeManagerWindow = new FThemeManagerWindow(actives[i], getMapContext());
|
273 |
//PluginServices.getMDIManager().addView(fThemeManagerWindow);
|
274 |
if (PluginServices.getMainFrame() == null) { |
275 |
JDialog dlg = new JDialog(); |
276 |
fThemeManagerWindow.setPreferredSize(fThemeManagerWindow.getSize()); |
277 |
dlg.getContentPane().add(fThemeManagerWindow); |
278 |
dlg.setModal(false);
|
279 |
dlg.pack(); |
280 |
dlg.show(); |
281 |
} else {
|
282 |
PluginServices.getMDIManager().addView(fThemeManagerWindow); |
283 |
} |
284 |
} |
285 |
} |
286 |
/*if (PluginServices.getMainFrame() == null) {
|
287 |
JDialog dlg = new JDialog();
|
288 |
fThemeManagerWindow.setPreferredSize(fThemeManagerWindow.getSize());
|
289 |
dlg.getContentPane().add(fThemeManagerWindow);
|
290 |
dlg.setModal(false);
|
291 |
dlg.pack();
|
292 |
dlg.show();
|
293 |
} else {
|
294 |
PluginServices.getMDIManager().addView(fThemeManagerWindow);
|
295 |
}*/
|
296 |
} |
297 |
} |
298 |
|
299 |
class FLyrRasterAdjustTransparencyTocMenuEntry extends TocMenuEntry { |
300 |
private JMenuItem transparency; |
301 |
FLayer lyr = null;
|
302 |
public void initialize(FPopupMenu m) { |
303 |
super.initialize(m);
|
304 |
|
305 |
if (isTocItemBranch()) {
|
306 |
lyr = getNodeLayer(); |
307 |
// Opcciones para capas raster
|
308 |
if ((lyr instanceof FLyrRaster)) { |
309 |
transparency = new JMenuItem(PluginServices.getText(this, "adjust_transparency")); |
310 |
getMenu().add( transparency ); |
311 |
transparency.setFont(FPopupMenu.theFont); |
312 |
getMenu().setEnabled(true);
|
313 |
//getMenu().addSeparator();
|
314 |
//Cambio color
|
315 |
transparency.addActionListener(this);
|
316 |
} |
317 |
} |
318 |
} |
319 |
/* (non-Javadoc)
|
320 |
* @see com.iver.cit.gvsig.gui.toc.TocMenuEntry#execute(com.iver.cit.gvsig.gui.toc.ITocItem)
|
321 |
*/
|
322 |
public void actionPerformed(ActionEvent e) { |
323 |
lyr = getNodeLayer(); |
324 |
AdjustTransparencyPanel transPanel = new AdjustTransparencyPanel((FLyrDefault) lyr);
|
325 |
transPanel.openJDialog(); |
326 |
//getMapContext().invalidate();
|
327 |
} |
328 |
} |
329 |
|
330 |
class FLyrRasterAdjustPropertiesTocMenuEntry extends TocMenuEntry { |
331 |
private JMenuItem properties; |
332 |
FLayer lyr = null;
|
333 |
private PropertiesRasterDialog propsDialog = null; |
334 |
private BandSetupPanel bandSetup = null; |
335 |
|
336 |
|
337 |
public void initialize(FPopupMenu m) { |
338 |
super.initialize(m);
|
339 |
|
340 |
if (isTocItemBranch()) {
|
341 |
lyr = getNodeLayer(); |
342 |
// Opcciones para capas raster
|
343 |
if ((lyr instanceof FLyrRaster)) { |
344 |
properties = new JMenuItem(PluginServices.getText(this, "propiedades_raster")); |
345 |
getMenu().add( properties ); |
346 |
properties.setFont(FPopupMenu.theFont); |
347 |
getMenu().setEnabled(true);
|
348 |
//getMenu().addSeparator();
|
349 |
//Cambio color
|
350 |
properties.addActionListener(this);
|
351 |
} |
352 |
} |
353 |
} |
354 |
|
355 |
/**
|
356 |
* Gestiona la apertura del dialogo de propiedades de raster cuando se pulsa
|
357 |
* la opci?n asignando a este las propiedades iniciales.
|
358 |
*/
|
359 |
public void actionPerformed(ActionEvent e) { |
360 |
lyr = getNodeLayer(); |
361 |
|
362 |
if(lyr instanceof FLyrRaster){ |
363 |
RasterFilterStackManager stackManager = null;
|
364 |
|
365 |
stackManager = new RasterFilterStackManager(((FLyrRaster)lyr).getSource().getFilterStack());
|
366 |
|
367 |
int[][] rangeR = stackManager.getTransparecyR(); |
368 |
int[][] rangeG = stackManager.getTransparecyG(); |
369 |
int[][] rangeB = stackManager.getTransparecyB(); |
370 |
|
371 |
propsDialog = new PropertiesRasterDialog(((FLyrRaster)lyr), rangeR, rangeG, rangeB);
|
372 |
|
373 |
int alpha = 255-((FLyrRaster)lyr).getSource().getTransparency(); |
374 |
|
375 |
bandSetup = ((FilterRasterDialogPanel)propsDialog.getContentPane()).getBandSetup(); |
376 |
|
377 |
//Asignaci?n del alpha actual de la imagen al dialogo
|
378 |
RasterTransparencyPanel rasterTrans = ((FilterRasterDialogPanel)propsDialog.getContentPane()).getTransparencyPanel(); |
379 |
rasterTrans.setOpacity(alpha); |
380 |
|
381 |
//Asignaci?n del porcentaje de recorte actual de la imagen al dialogo
|
382 |
EnhancedPanel pEnhan = ((FilterRasterDialogPanel)propsDialog.getContentPane()).getEnhancedPanel(); |
383 |
|
384 |
propsDialog.setRasterFilterStackManager(stackManager); |
385 |
|
386 |
ArrayList stackList = stackManager.getStringsFromStack();
|
387 |
boolean remove = false; |
388 |
String hideBands = null; |
389 |
for(int i=0;i<stackList.size();i++){ |
390 |
//System.out.println("*=>"+((String)stackList.get(i)));
|
391 |
if(((String)stackList.get(i)).startsWith("filter.tail.value")){ |
392 |
int tail = (int)(Double.parseDouble(stackManager.getValue((String)stackList.get(i)))*200); |
393 |
pEnhan.setPercentTail(tail); |
394 |
} |
395 |
if(((String)stackList.get(i)).startsWith("filter.tail.remove")) |
396 |
remove = Boolean.valueOf(stackManager.getValue((String)stackList.get(i))).booleanValue(); |
397 |
|
398 |
if(((String)stackList.get(i)).startsWith("filter.enhanced.remove")) |
399 |
remove = Boolean.valueOf(stackManager.getValue((String)stackList.get(i))).booleanValue(); |
400 |
|
401 |
if(((String)stackList.get(i)).startsWith("filter.removebands.bands")) |
402 |
hideBands = stackManager.getValue((String)stackList.get(i));
|
403 |
} |
404 |
|
405 |
if(stackManager.isActive(stackManager.getTypeFilter("enhanced"))){ |
406 |
if(remove)
|
407 |
pEnhan.setSelectedFilter(1);
|
408 |
else
|
409 |
pEnhan.setSelectedFilter(2);
|
410 |
}else
|
411 |
pEnhan.setSelectedFilter(0);
|
412 |
|
413 |
GeoRasterFile[] files = ((FLyrRaster)lyr).getSource().getFiles();
|
414 |
propsDialog.addFiles(files); |
415 |
for(int i=0; i< files.length;i++) |
416 |
propsDialog.addNumBands(files[i].getBandCount()); |
417 |
|
418 |
RasterAdapter rad = ((FLyrRaster)lyr).getSource(); |
419 |
int posR = 0, posG = 0, posB = 0; |
420 |
|
421 |
for(int i=0;i<rad.getPosFile(GeoRasterFile.RED_BAND);i++) |
422 |
posR += files[i].getBandCount(); |
423 |
posR += rad.getBand(GeoRasterFile.RED_BAND); |
424 |
|
425 |
for(int i=0;i<rad.getPosFile(GeoRasterFile.GREEN_BAND);i++) |
426 |
posG += files[i].getBandCount(); |
427 |
posG += rad.getBand(GeoRasterFile.GREEN_BAND); |
428 |
|
429 |
for(int i=0;i<rad.getPosFile(GeoRasterFile.BLUE_BAND);i++) |
430 |
posB += files[i].getBandCount(); |
431 |
posB += rad.getBand(GeoRasterFile.BLUE_BAND); |
432 |
|
433 |
bandSetup.assignBand(posR, GeoRasterFile.RED_BAND); |
434 |
bandSetup.assignBand(posG, GeoRasterFile.GREEN_BAND); |
435 |
bandSetup.assignBand(posB, GeoRasterFile.BLUE_BAND); |
436 |
|
437 |
//Selecci?n de 1, 2 o 3 bandas para visualizar
|
438 |
if(hideBands != null){ |
439 |
int pos = 2; |
440 |
if(hideBands.length() == 1) |
441 |
pos = 1;
|
442 |
else if(hideBands.length() == 2) |
443 |
pos = 0;
|
444 |
bandSetup.getFileList().getJComboBox().setSelectedIndex(pos); |
445 |
|
446 |
//Reseteamos los controles de la tabla
|
447 |
|
448 |
for(int i=0;i<bandSetup.getRGBTable().getModel().getRowCount();i++) |
449 |
for(int j=0;j<3;j++) |
450 |
bandSetup.getRGBTable().getModel().setValueAt(new Boolean(false), i, j); |
451 |
|
452 |
if(hideBands.equals("GB") || hideBands.equals("G") || hideBands.equals("B") ) |
453 |
bandSetup.getRGBTable().getModel().setValueAt(new Boolean(true), posR, 0); |
454 |
|
455 |
if(hideBands.equals("RB") || hideBands.equals("R") || hideBands.equals("B") ) |
456 |
bandSetup.getRGBTable().getModel().setValueAt(new Boolean(true), posG, 1); |
457 |
|
458 |
if(hideBands.equals("RG") || hideBands.equals("R") || hideBands.equals("G") ) |
459 |
bandSetup.getRGBTable().getModel().setValueAt(new Boolean(true), posB, 2); |
460 |
} |
461 |
|
462 |
propsDialog.readStat(); |
463 |
|
464 |
//Modificaci?n del estado de los controles del pansharpening
|
465 |
if(stackManager.isActive(stackManager.getTypeFilter("sharpening"))){ |
466 |
SharpeningPanel pSharp = ((FilterRasterDialogPanel)propsDialog.getContentPane()).getSharpeningPanel(); |
467 |
pSharp.getCbActiveSharpening().setSelected(true);
|
468 |
pSharp.setTableEnabled(true);
|
469 |
|
470 |
RasterFilter sharp = stackManager.getFilter("sharpening");
|
471 |
String pancrName = (String)sharp.getParam("pancrName"); |
472 |
for(int i=0;i<pSharp.getNBands();i++){ |
473 |
if(pSharp.getBandName(i).endsWith(pancrName))
|
474 |
pSharp.selectRow(i); |
475 |
} |
476 |
if(((String)sharp.getParam("method")).equals("hsl")){ |
477 |
pSharp.getRbHSL().setSelected(true);
|
478 |
Double coef = ((Double)sharp.getParam("coef")); |
479 |
pSharp.getJTextField().setText(coef.toString()); |
480 |
pSharp.getJSlider().setValue((int)((coef.doubleValue() * 100)/0.5)); |
481 |
} |
482 |
|
483 |
if(((String)sharp.getParam("method")).equals("brovey")){ |
484 |
pSharp.getRbBrovey().setSelected(true);
|
485 |
Integer coefBrovey = ((Integer)sharp.getParam("coefBrovey")); |
486 |
pSharp.getJTextField1().setText(coefBrovey.toString()); |
487 |
pSharp.getJSlider1().setValue((int)((coefBrovey.intValue() * 100)/50)); |
488 |
} |
489 |
} |
490 |
|
491 |
PluginServices.getMDIManager().addView(propsDialog); |
492 |
} |
493 |
} |
494 |
} |
495 |
|
496 |
class ZoomAlTemaTocMenuEntry extends TocMenuEntry { |
497 |
private JMenuItem zoom; |
498 |
public void initialize(FPopupMenu m) { |
499 |
super.initialize(m);
|
500 |
if (isTocItemBranch()) {
|
501 |
zoom = new JMenuItem(PluginServices.getText(this, "Zoom_al_Tema")); |
502 |
getMenu().add(zoom); |
503 |
zoom.setFont(FPopupMenu.theFont); |
504 |
|
505 |
zoom.addActionListener(this);
|
506 |
} |
507 |
} |
508 |
/* (non-Javadoc)
|
509 |
* @see com.iver.cit.gvsig.gui.toc.TocMenuEntry#execute(com.iver.cit.gvsig.gui.toc.ITocItem)
|
510 |
*/
|
511 |
public void actionPerformed(ActionEvent e) { |
512 |
/*FLayer lyr = getNodeLayer();
|
513 |
try {
|
514 |
getMapContext().getViewPort().setExtent(lyr.getFullExtent());
|
515 |
} catch (com.iver.cit.gvsig.fmap.DriverException e1) {
|
516 |
e1.printStackTrace();
|
517 |
}*/
|
518 |
// 050209, jmorell: Para que haga un zoom a un grupo de capas seleccionadas.
|
519 |
FLayer[] actives = getMapContext().getLayers().getActives();
|
520 |
if (actives.length==1) { |
521 |
try {
|
522 |
getMapContext().getViewPort().setExtent(actives[0].getFullExtent());
|
523 |
} catch (com.iver.cit.gvsig.fmap.DriverException e1) {
|
524 |
e1.printStackTrace(); |
525 |
} |
526 |
} else {
|
527 |
try {
|
528 |
Rectangle2D maxExtent = setMaxExtent(actives);
|
529 |
getMapContext().getViewPort().setExtent(maxExtent); |
530 |
} catch (com.iver.cit.gvsig.fmap.DriverException e1) {
|
531 |
e1.printStackTrace(); |
532 |
} |
533 |
} |
534 |
} |
535 |
|
536 |
private Rectangle2D setMaxExtent(FLayer[] actives) throws DriverException { |
537 |
Rectangle2D extRef = actives[0].getFullExtent(); |
538 |
double minXRef = extRef.getMinX();
|
539 |
double maxYRef = extRef.getMaxY();
|
540 |
double maxXRef = extRef.getMaxX();
|
541 |
double minYRef = extRef.getMinY();
|
542 |
for (int i=0;i<actives.length;i++) { |
543 |
Rectangle2D extVar = actives[i].getFullExtent();
|
544 |
double minXVar = extVar.getMinX();
|
545 |
double maxYVar = extVar.getMaxY();
|
546 |
double maxXVar = extVar.getMaxX();
|
547 |
double minYVar = extVar.getMinY();
|
548 |
if (minXVar<=minXRef) minXRef=minXVar;
|
549 |
if (maxYVar>=maxYRef) maxYRef=maxYVar;
|
550 |
if (maxXVar>=maxXRef) maxXRef=maxXVar;
|
551 |
if (minYVar<=minYRef) minYRef=minYVar;
|
552 |
extRef.setRect(minXRef, minYRef, maxXRef-minXRef, maxYRef-minYRef); |
553 |
} |
554 |
return extRef;
|
555 |
} |
556 |
} |
557 |
|
558 |
class EliminarCapaTocMenuEntry extends TocMenuEntry { |
559 |
private JMenuItem removeLayer; |
560 |
public void initialize(FPopupMenu m) { |
561 |
super.initialize(m);
|
562 |
if (getNodeUserObject() instanceof TocItemBranch) { |
563 |
removeLayer = new JMenuItem(PluginServices.getText(this, "eliminar_capa")); |
564 |
removeLayer.setFont(FPopupMenu.theFont); |
565 |
removeLayer.addActionListener(this);
|
566 |
getMenu().addSeparator(); |
567 |
getMenu().add(removeLayer); |
568 |
getMenu().addSeparator(); |
569 |
} |
570 |
} |
571 |
/* (non-Javadoc)
|
572 |
* @see com.iver.cit.gvsig.gui.toc.TocMenuEntry#execute(com.iver.cit.gvsig.gui.toc.ITocItem)
|
573 |
*/
|
574 |
public void actionPerformed(ActionEvent e) { |
575 |
// 050209, jmorell: Para poder borrar todas las capas seleccionadas desde el FPopUpMenu.
|
576 |
// Es necesario pulsar May?sculas a la vez que el bot?n derecho.
|
577 |
FMap fMap = getMapContext(); |
578 |
FLayer[] actives = fMap.getLayers().getActives();
|
579 |
for (int i = actives.length-1; i>=0; i--){ |
580 |
try {
|
581 |
actives[i].getParentLayer().removeLayer(actives[i]); |
582 |
FLayers lyrs=getMapContext().getLayers(); |
583 |
lyrs.addLayer(actives[i]); |
584 |
actives[i].getParentLayer().removeLayer(actives[i]); |
585 |
|
586 |
if (actives[i] instanceof AlphanumericData){ |
587 |
Project project = ((ProjectExtension)PluginServices.getExtension(ProjectExtension.class)).getProject(); |
588 |
ProjectTable pt = project.getTable((AlphanumericData) actives[i]); |
589 |
|
590 |
ArrayList tables = project.getTables();
|
591 |
for (int j = 0; j < tables.size(); j++) { |
592 |
if (tables.get(j) == pt){
|
593 |
project.delTable(j); |
594 |
break;
|
595 |
} |
596 |
} |
597 |
|
598 |
PluginServices.getMDIManager().closeSingletonView(pt); |
599 |
} |
600 |
|
601 |
if (getMapContext().getLayers().getLayersCount()==0) |
602 |
PluginServices.getMainFrame().enableControls(); |
603 |
} catch (CancelationException e1) {
|
604 |
e1.printStackTrace(); |
605 |
} |
606 |
} |
607 |
// 050209, jmorell: As? solo borra una capa (sobre la que pulsas).
|
608 |
/*FLayer lyr = getNodeLayer();
|
609 |
try {
|
610 |
getMapContext().getLayers().removeLayer(lyr);
|
611 |
if (getMapContext().getLayers().getLayersCount()==0)PluginServices.getMainFrame().enableControls();
|
612 |
} catch (CancelationException e1) {
|
613 |
e1.printStackTrace();
|
614 |
}*/
|
615 |
} |
616 |
} |
617 |
/**
|
618 |
* Realiza una agrupaci?n de capas, a partir de las capas que se encuentren activas.
|
619 |
*
|
620 |
* @author Vicente Caballero Navarro
|
621 |
*/
|
622 |
class LayersGroupTocMenuEntry extends TocMenuEntry { |
623 |
private JMenuItem agrupar; |
624 |
public void initialize(FPopupMenu m) { |
625 |
super.initialize(m);
|
626 |
if (isTocItemBranch()) {
|
627 |
agrupar = new JMenuItem(PluginServices.getText(this, "agrupar_capas")); |
628 |
agrupar.setFont(FPopupMenu.theFont); |
629 |
getMenu().add(agrupar); |
630 |
getMenu().setEnabled(true);
|
631 |
if (getMapContext().getLayers().getActives().length > 1) { |
632 |
agrupar.setEnabled(true);
|
633 |
} else {
|
634 |
agrupar.setEnabled(false);
|
635 |
} |
636 |
agrupar.addActionListener(this);
|
637 |
} |
638 |
} |
639 |
|
640 |
/* (non-Javadoc)
|
641 |
* @see com.iver.cit.gvsig.gui.toc.TocMenuEntry#execute(com.iver.cit.gvsig.gui.toc.ITocItem)
|
642 |
*/
|
643 |
public void actionPerformed(ActionEvent e) { |
644 |
//ITocItem tocItem = (ITocItem) getNodeUserObject();
|
645 |
ChangeName changename=new ChangeName(null); |
646 |
PluginServices.getMDIManager().addView(changename); |
647 |
String nombre=changename.getName();
|
648 |
|
649 |
if (nombre != null){ |
650 |
if (isTocItemBranch()){
|
651 |
FLayer[] actives = getMapContext().getLayers().getActives();
|
652 |
|
653 |
if (actives.length>1) { |
654 |
|
655 |
FLayers layerGroup=new FLayers(getMapContext(),getNodeLayer().getParentLayer());
|
656 |
View theView = (View) PluginServices.getMDIManager().getActiveView(); |
657 |
theView.getMapControl().getMapContext().getLayers() |
658 |
.addLayer(layerGroup); |
659 |
for (int i=0;i<actives.length;i++){ |
660 |
|
661 |
if(actives[i] instanceof FLyrRaster) |
662 |
((FLyrRaster)actives[i]).setRemoveRasterFlag(false);
|
663 |
|
664 |
actives[i].getParentLayer().removeLayer(actives[i]); |
665 |
layerGroup.addLayer(actives[i]); |
666 |
} |
667 |
layerGroup.setName(nombre); |
668 |
|
669 |
|
670 |
} |
671 |
|
672 |
} |
673 |
// TRUCO PARA REFRESCAR.
|
674 |
getMapContext().invalidate(); |
675 |
} |
676 |
} |
677 |
} |
678 |
/**
|
679 |
* Realiza una desagrupaci?n de capas, a partir de las capas que se encuentren activas.
|
680 |
*
|
681 |
* @author Vicente Caballero Navarro
|
682 |
*/
|
683 |
class LayersUngroupTocMenuEntry extends TocMenuEntry { |
684 |
private JMenuItem desagrupar; |
685 |
public void initialize(FPopupMenu m) { |
686 |
super.initialize(m);
|
687 |
if (isTocItemBranch()) {
|
688 |
boolean isFLayers=true; |
689 |
if (isTocItemBranch()){
|
690 |
FLayer lyr = getNodeLayer(); |
691 |
if (!(lyr instanceof FLayers)){ |
692 |
isFLayers=false;
|
693 |
} |
694 |
} |
695 |
if (isFLayers){
|
696 |
desagrupar = new JMenuItem(PluginServices.getText(this, "desagrupar_capas")); |
697 |
desagrupar.setFont(FPopupMenu.theFont); |
698 |
getMenu().add(desagrupar); |
699 |
getMenu().setEnabled(true);
|
700 |
desagrupar.addActionListener(this);
|
701 |
} |
702 |
} |
703 |
} |
704 |
|
705 |
/* (non-Javadoc)
|
706 |
* @see com.iver.cit.gvsig.gui.toc.TocMenuEntry#execute(com.iver.cit.gvsig.gui.toc.ITocItem)
|
707 |
*/
|
708 |
public void actionPerformed(ActionEvent e) { |
709 |
//ITocItem tocItem = (ITocItem) getNodeUserObject();
|
710 |
if (isTocItemBranch()){
|
711 |
FLayers agrupa = (FLayers)getNodeLayer(); |
712 |
FLayers parent=agrupa.getParentLayer(); |
713 |
if (parent!=null){ |
714 |
for (int j=0;j<agrupa.getLayersCount();j++){ |
715 |
parent.addLayer(agrupa.getLayer(j)); |
716 |
} |
717 |
parent.removeLayer(agrupa); |
718 |
} |
719 |
} |
720 |
// TRUCO PARA REFRESCAR.
|
721 |
getMapContext().invalidate(); |
722 |
|
723 |
|
724 |
|
725 |
} |
726 |
} |
727 |
/**
|
728 |
* Cambia la posici?n actual del layer a la primera posici?n.
|
729 |
*
|
730 |
* @author Vicente Caballero Navarro
|
731 |
*/
|
732 |
class FirstLayerTocMenuEntry extends TocMenuEntry { |
733 |
private JMenuItem first; |
734 |
public void initialize(FPopupMenu m) { |
735 |
super.initialize(m);
|
736 |
if (isTocItemBranch()) {
|
737 |
first = new JMenuItem(PluginServices.getText(this, "colocar_delante")); |
738 |
first.setFont(FPopupMenu.theFont); |
739 |
getMenu().add(first); |
740 |
getMenu().setEnabled(true);
|
741 |
first.addActionListener(this);
|
742 |
} |
743 |
} |
744 |
|
745 |
/* (non-Javadoc)
|
746 |
* @see com.iver.cit.gvsig.gui.toc.TocMenuEntry#execute(com.iver.cit.gvsig.gui.toc.ITocItem)
|
747 |
*/
|
748 |
public void actionPerformed(ActionEvent e) { |
749 |
ITocItem tocItem = (ITocItem) getNodeUserObject(); |
750 |
|
751 |
if (isTocItemBranch()){
|
752 |
if (getMapContext().getLayers().getActives().length == 1) { |
753 |
FLayer layer=((TocItemBranch)tocItem).getLayer(); |
754 |
FLayers layers=layer.getParentLayer(); |
755 |
for (int i=0;i<layers.getLayersCount();i++){ |
756 |
if(layers.getLayer(i).equals(layer)){
|
757 |
layers.removeLayer(i); |
758 |
layers.addLayer(layer); |
759 |
} |
760 |
} |
761 |
} else if (getMapContext().getLayers().getActives().length > 1) { |
762 |
FLayer[] actives = getMapContext().getLayers().getActives();
|
763 |
FLayers layers=actives[0].getParentLayer();
|
764 |
//FLayers layerGroup=new FLayers(getMapContext(),getNodeLayer().getParentLayer());
|
765 |
for (int i=0;i<actives.length;i++){ |
766 |
for (int j=0;j<layers.getLayersCount();j++){ |
767 |
if(layers.getLayer(j).equals(actives[i])){
|
768 |
layers.removeLayer(j); |
769 |
layers.addLayer(actives[i]); |
770 |
} |
771 |
} |
772 |
} |
773 |
} |
774 |
} |
775 |
// TRUCO PARA REFRESCAR.
|
776 |
getMapContext().invalidate(); |
777 |
} |
778 |
} |
779 |
/**
|
780 |
* @author Nacho Brodin <brodin_ign@gva.es>
|
781 |
*
|
782 |
* Entrada de men? para la activaci?n de la funcionalidad de zoom a un
|
783 |
* pixel.
|
784 |
*/
|
785 |
class ZoomPixelTocMenuEntry extends TocMenuEntry { |
786 |
public static final int ZOOM_TO_IMAGE_CENTER = 0x1; |
787 |
public static final int ZOOM_TO_VIEW_CENTER = 0x2; |
788 |
private JMenuItem properties; |
789 |
FLayer lyr = null;
|
790 |
public int zoomType = ZOOM_TO_VIEW_CENTER; |
791 |
|
792 |
public void initialize(FPopupMenu m) { |
793 |
super.initialize(m);
|
794 |
|
795 |
if (isTocItemBranch()) {
|
796 |
lyr = getNodeLayer(); |
797 |
// Opcciones para capas raster
|
798 |
if ((lyr instanceof FLyrRaster)) { |
799 |
properties = new JMenuItem(PluginServices.getText(this, "Zoom_pixel")); |
800 |
getMenu().add( properties ); |
801 |
properties.setFont(FPopupMenu.theFont); |
802 |
getMenu().setEnabled(true);
|
803 |
|
804 |
properties.addActionListener(this);
|
805 |
} |
806 |
} |
807 |
} |
808 |
|
809 |
public void actionPerformed(ActionEvent e) { |
810 |
|
811 |
FLayer[] actives = getMapContext().getLayers().getActives();
|
812 |
if (actives.length==1) { |
813 |
try {
|
814 |
Rectangle2D r = actives[0].getFullExtent(); |
815 |
|
816 |
ArrayList attr = ((FLyrRaster)actives[0]).getSource().getAttributes(); |
817 |
int width = 0, height = 0; |
818 |
for (int i=0; i<attr.size(); i++) { |
819 |
Object[] a = (Object []) attr.get(i); |
820 |
if (a[0].toString().equals("Width")) |
821 |
width = ((Integer)a[1]).intValue(); |
822 |
if (a[0].toString().equals("Height")) |
823 |
height = ((Integer)a[1]).intValue(); |
824 |
} |
825 |
ViewPort v = getMapContext().getViewPort(); |
826 |
|
827 |
if (zoomType == ZOOM_TO_IMAGE_CENTER) {
|
828 |
//A centro de imagen
|
829 |
/*double centroX = width/2;
|
830 |
double centroY = height/2;
|
831 |
int minX = (int)Math.round(centroX - (v.getImageWidth()/2));
|
832 |
int minY = (int)Math.round(centroY - (v.getImageHeight()/2));
|
833 |
int maxX = (int)Math.round(minX + v.getImageWidth());
|
834 |
int maxY = (int)Math.round(minY + v.getImageHeight());
|
835 |
double wcOriginWidth = r.getMaxX() - r.getMinX();
|
836 |
double wcOriginHeight = r.getMaxY() - r.getMinY();
|
837 |
|
838 |
double wcDstMinX = r.getMinX()+((minX*wcOriginWidth)/width);
|
839 |
double wcDstMinY = r.getMinY()+((minY*wcOriginHeight)/height);
|
840 |
double wcDstMaxX = r.getMinX()+((maxX*wcOriginWidth)/width);
|
841 |
double wcDstMaxY = r.getMinY()+((maxY*wcOriginHeight)/height);
|
842 |
|
843 |
double wcDstWidth = wcDstMaxX - wcDstMinX;
|
844 |
double wcDstHeight = wcDstMaxY - wcDstMinY;*/
|
845 |
} else if (zoomType == ZOOM_TO_VIEW_CENTER) { |
846 |
//A centro de vista
|
847 |
double wcOriginCenterX = v.getExtent().getMinX()+((v.getExtent().getMaxX()-v.getExtent().getMinX())/2); |
848 |
double wcOriginCenterY = v.getExtent().getMinY()+((v.getExtent().getMaxY()-v.getExtent().getMinY())/2); |
849 |
|
850 |
//Hallamos la relaci?n entre el pixel y las WC a partir de la imagen de la capa
|
851 |
double relacionPixelWcWidth = (r.getMaxX() - r.getMinX())/width;
|
852 |
double relacionPixelWcHeight = (r.getMaxY() - r.getMinY())/height;
|
853 |
//double desplazamientoX = r.getMinX();
|
854 |
//double desplazamientoY = r.getMinY();
|
855 |
|
856 |
double wcOriginX = wcOriginCenterX - ((v.getImageWidth()*relacionPixelWcWidth)/2); |
857 |
double wcOriginY = wcOriginCenterY - ((v.getImageHeight()*relacionPixelWcHeight)/2); |
858 |
|
859 |
double wcDstMinX = wcOriginX;
|
860 |
double wcDstMinY = wcOriginY;
|
861 |
double wcDstMaxX = wcDstMinX + (v.getImageWidth()*relacionPixelWcWidth);
|
862 |
double wcDstMaxY = wcDstMinY + (v.getImageHeight()*relacionPixelWcHeight);
|
863 |
|
864 |
double wcDstWidth = wcDstMaxX - wcDstMinX;
|
865 |
double wcDstHeight = wcDstMaxY - wcDstMinY;
|
866 |
|
867 |
r = new Rectangle2D.Double(wcDstMinX, wcDstMinY, wcDstWidth, wcDstHeight); |
868 |
getMapContext().getViewPort().setExtent(r); |
869 |
} |
870 |
} catch (com.iver.cit.gvsig.fmap.DriverException e1) {
|
871 |
e1.printStackTrace(); |
872 |
} |
873 |
} |
874 |
//View vista = (View) PluginServices.getMDIManager().getActiveView();
|
875 |
//MapControl mapCtrl = vista.getMapControl();
|
876 |
} |
877 |
} |
878 |
|
879 |
/**
|
880 |
* @author Nacho Brodin <brodin_ign@gva.es>
|
881 |
*
|
882 |
* Entrada de men? para la activaci?n de la funcionalidad de zoom a un
|
883 |
* pixel centrado en el cursor.
|
884 |
*/
|
885 |
class ZoomPixelCursorTocMenuEntry extends TocMenuEntry { |
886 |
public static final int ZOOM_TO_IMAGE_CENTER = 0x1; |
887 |
public static final int ZOOM_TO_VIEW_CENTER = 0x2; |
888 |
private JMenuItem properties; |
889 |
FLayer lyr = null;
|
890 |
public int zoomType = ZOOM_TO_VIEW_CENTER; |
891 |
|
892 |
public void initialize(FPopupMenu m) { |
893 |
super.initialize(m);
|
894 |
|
895 |
if (isTocItemBranch()) {
|
896 |
lyr = getNodeLayer(); |
897 |
// Opcciones para capas raster
|
898 |
if ((lyr instanceof FLyrRaster)) { |
899 |
properties = new JMenuItem(PluginServices.getText(this, "Zoom_pixel")); |
900 |
getMenu().add( properties ); |
901 |
properties.setFont(FPopupMenu.theFont); |
902 |
getMenu().setEnabled(true);
|
903 |
properties.addActionListener(this);
|
904 |
} |
905 |
} |
906 |
} |
907 |
|
908 |
public void actionPerformed(ActionEvent e) { |
909 |
|
910 |
FLayer[] actives = getMapContext().getLayers().getActives();
|
911 |
if (actives.length==1) { |
912 |
|
913 |
lyr = getNodeLayer(); |
914 |
View vista = (View) PluginServices.getMDIManager().getActiveView(); |
915 |
MapControl mapCtrl = vista.getMapControl(); |
916 |
mapCtrl.setTool("zoom_pixel_cursor");
|
917 |
|
918 |
} |
919 |
//View vista = (View) PluginServices.getMDIManager().getActiveView();
|
920 |
//MapControl mapCtrl = vista.getMapControl();
|
921 |
} |
922 |
} |
923 |
|
924 |
/**
|
925 |
*
|
926 |
* @author Nacho Brodin <brodin_ign@gva.es>
|
927 |
*
|
928 |
* Entrada de men? para la activaci?n de la funcionalidad de salvar
|
929 |
* a raster una parte de la vista.
|
930 |
*/
|
931 |
class SaveRasterTocMenuEntry extends TocMenuEntry{ |
932 |
private JMenuItem properties; |
933 |
FLayer lyr = null;
|
934 |
|
935 |
public void initialize(FPopupMenu m) { |
936 |
super.initialize(m);
|
937 |
|
938 |
if (isTocItemBranch()) {
|
939 |
lyr = getNodeLayer(); |
940 |
// Opcciones para capas raster
|
941 |
if ((lyr instanceof FLyrRaster)) { |
942 |
properties = new JMenuItem(PluginServices.getText(this, "salvar_raster")); |
943 |
getMenu().add( properties ); |
944 |
properties.setFont(FPopupMenu.theFont); |
945 |
getMenu().setEnabled(true);
|
946 |
//getMenu().addSeparator();
|
947 |
//Cambio color
|
948 |
properties.addActionListener(this);
|
949 |
} |
950 |
} |
951 |
} |
952 |
|
953 |
public void actionPerformed(ActionEvent e) { |
954 |
lyr = getNodeLayer(); |
955 |
View vista = (View) PluginServices.getMDIManager().getActiveView(); |
956 |
MapControl mapCtrl = vista.getMapControl(); |
957 |
mapCtrl.setTool("saveRaster");
|
958 |
} |
959 |
} |
960 |
|
961 |
/**
|
962 |
* Menu de bot?n derecho para el TOC.
|
963 |
* Se pueden a?adir entradas facilmente desde una extensi?n,
|
964 |
* creando una clase derivando de TocMenuEntry, y a?adiendola en
|
965 |
* est?tico (o en tiempo de carga de la extensi?n) a FPopupMenu.
|
966 |
* (Las entradas actuales est?n hechas de esa manera).
|
967 |
*
|
968 |
* @author vcn To change the template for this generated type comment go to
|
969 |
* Window>Preferences>Java>Code Generation>Code and
|
970 |
* Comments
|
971 |
*/
|
972 |
|
973 |
public class FPopupMenu extends JPopupMenu { |
974 |
private static ArrayList menuEntrys = new ArrayList(); |
975 |
public DefaultMutableTreeNode nodo; |
976 |
protected FMap mapContext;
|
977 |
//private JMenuItem capa;
|
978 |
// Lo de fijar la fuente es porque en linux se ve?a mal si no se fija.
|
979 |
// TODO: Esto no funcionar? para idiomas como el chino. Hay que cambiarlo.
|
980 |
public final static Font theFont = new Font("SansSerif", Font.PLAIN, 10); |
981 |
|
982 |
static {
|
983 |
FPopupMenu.addEntry(new FSymbolChangeColorTocMenuEntry());
|
984 |
FPopupMenu.addEntry(new ChangeNameTocMenuEntry());
|
985 |
menuEntrys.add(new FLyrVectEditPropertiesTocMenuEntry());
|
986 |
//FPopupMenu.addEntry(new FLyrRasterAdjustTransparencyTocMenuEntry());
|
987 |
FPopupMenu.addEntry(new ZoomAlTemaTocMenuEntry());
|
988 |
//FPopupMenu.addEntry(new ZoomPixelTocMenuEntry());
|
989 |
FPopupMenu.addEntry(new ZoomPixelCursorTocMenuEntry());
|
990 |
FPopupMenu.addEntry(new EliminarCapaTocMenuEntry());
|
991 |
menuEntrys.add(new LayersGroupTocMenuEntry());
|
992 |
menuEntrys.add(new LayersUngroupTocMenuEntry());
|
993 |
menuEntrys.add(new FirstLayerTocMenuEntry());
|
994 |
FPopupMenu.addEntry(new FLyrRasterAdjustPropertiesTocMenuEntry());
|
995 |
} |
996 |
|
997 |
public static void addEntry(TocMenuEntry entry) { |
998 |
menuEntrys.add(entry); |
999 |
} |
1000 |
|
1001 |
/**
|
1002 |
* Creates a new FPopupMenu object.
|
1003 |
*
|
1004 |
* @param nodo DOCUMENT ME!
|
1005 |
* @param vista DOCUMENT ME!
|
1006 |
*/
|
1007 |
public FPopupMenu(FMap mc, DefaultMutableTreeNode node) { |
1008 |
//super();
|
1009 |
this.mapContext = mc;
|
1010 |
this.nodo = node;
|
1011 |
|
1012 |
//salir = new MenuItem("Salir");
|
1013 |
|
1014 |
for (int i=0; i<menuEntrys.size(); i++) { |
1015 |
((TocMenuEntry) menuEntrys.get(i)).initialize(this);
|
1016 |
} |
1017 |
} |
1018 |
|
1019 |
public FMap getMapContext() { return mapContext; } |
1020 |
|
1021 |
} |