Revision 2104 branches/gvSIG_03_SLD/applications/appgvSIG/src/com/iver/cit/gvsig/gui/toc/FPopupMenu.java
FPopupMenu.java | ||
---|---|---|
301 | 301 |
private JMenuItem zoom; |
302 | 302 |
public void initialize(FPopupMenu m) { |
303 | 303 |
super.initialize(m); |
304 |
//if (isTocItemBranch()) {
|
|
304 |
if (isTocItemBranch()) { |
|
305 | 305 |
zoom = new JMenuItem(PluginServices.getText(this, "Zoom_al_Tema")); |
306 | 306 |
getMenu().add(zoom); |
307 | 307 |
zoom.setFont(FPopupMenu.theFont); |
308 | 308 |
|
309 | 309 |
zoom.addActionListener(this); |
310 |
//}
|
|
310 |
} |
|
311 | 311 |
} |
312 | 312 |
/* (non-Javadoc) |
313 | 313 |
* @see com.iver.cit.gvsig.gui.toc.TocMenuEntry#execute(com.iver.cit.gvsig.gui.toc.ITocItem) |
... | ... | |
403 | 403 |
} |
404 | 404 |
} |
405 | 405 |
/** |
406 |
* Realiza una uni?n entre las capas que esten seleccionadas.
|
|
406 |
* Realiza una agrupaci?n de capas, a partir de las capas que se encuentren activas.
|
|
407 | 407 |
* |
408 | 408 |
* @author Vicente Caballero Navarro |
409 | 409 |
*/ |
... | ... | |
411 | 411 |
private JMenuItem agrupar; |
412 | 412 |
public void initialize(FPopupMenu m) { |
413 | 413 |
super.initialize(m); |
414 |
agrupar = new JMenuItem(PluginServices.getText(this, "Agrupar_capas"));
|
|
414 |
agrupar = new JMenuItem(PluginServices.getText(this, "agrupar_capas"));
|
|
415 | 415 |
agrupar.setFont(FPopupMenu.theFont); |
416 | 416 |
getMenu().add(agrupar); |
417 | 417 |
getMenu().setEnabled(true); |
... | ... | |
440 | 440 |
|
441 | 441 |
} |
442 | 442 |
layerGroup.setName(nombre); |
443 |
//getNodeLayer().getParentLayer().addLayer(layerGroup); |
|
443 | 444 |
View theView = (View) PluginServices.getMDIManager().getActiveView(); |
444 | 445 |
theView.getMapControl().getMapContext().getLayers() |
445 | 446 |
.addLayer(layerGroup); |
447 |
|
|
446 | 448 |
} |
447 | 449 |
|
448 | 450 |
} |
... | ... | |
460 | 462 |
|
461 | 463 |
} |
462 | 464 |
} |
465 |
/** |
|
466 |
* Realiza una desagrupaci?n de capas, a partir de las capas que se encuentren activas. |
|
467 |
* |
|
468 |
* @author Vicente Caballero Navarro |
|
469 |
*/ |
|
470 |
class LayersUngroupTocMenuEntry extends TocMenuEntry { |
|
471 |
private JMenuItem desagrupar; |
|
472 |
public void initialize(FPopupMenu m) { |
|
473 |
super.initialize(m); |
|
474 |
boolean isFLayers=true; |
|
475 |
if (isTocItemBranch()){ |
|
476 |
FLayer lyr = getNodeLayer(); |
|
477 |
if (!(lyr instanceof FLayers)){ |
|
478 |
isFLayers=false; |
|
479 |
} |
|
480 |
/* for (int i=0;i<actives.length;i++){ |
|
481 |
if (!(actives[i] instanceof FLayers)){ |
|
482 |
isFLayers=false; |
|
483 |
} |
|
484 |
} |
|
485 |
*/ |
|
486 |
} |
|
487 |
if (isFLayers){ |
|
488 |
desagrupar = new JMenuItem(PluginServices.getText(this, "desagrupar_capas")); |
|
489 |
desagrupar.setFont(FPopupMenu.theFont); |
|
490 |
getMenu().add(desagrupar); |
|
491 |
getMenu().setEnabled(true); |
|
492 |
desagrupar.addActionListener(this); |
|
493 |
} |
|
494 |
} |
|
495 |
|
|
496 |
/* (non-Javadoc) |
|
497 |
* @see com.iver.cit.gvsig.gui.toc.TocMenuEntry#execute(com.iver.cit.gvsig.gui.toc.ITocItem) |
|
498 |
*/ |
|
499 |
public void actionPerformed(ActionEvent e) { |
|
500 |
ITocItem tocItem = (ITocItem) getNodeUserObject(); |
|
501 |
if (isTocItemBranch()){ |
|
502 |
FLayers agrupa = (FLayers)getNodeLayer(); |
|
503 |
FLayers parent=agrupa.getParentLayer(); |
|
504 |
if (parent!=null){ |
|
505 |
for (int j=0;j<agrupa.getLayersCount();j++){ |
|
506 |
parent.addLayer(agrupa.getLayer(j)); |
|
507 |
} |
|
508 |
parent.removeLayer(agrupa); |
|
509 |
} |
|
510 |
|
|
511 |
/*View theView = (View) PluginServices.getMDIManager().getActiveView(); |
|
512 |
theView.getMapControl().getMapContext().getLayers() |
|
513 |
.addLayer(layerGroup); |
|
514 |
*/ |
|
515 |
|
|
516 |
} |
|
517 |
/*else |
|
518 |
{ |
|
519 |
TocItemLeaf leaf = (TocItemLeaf) tocItem; |
|
520 |
FSymbol sym = leaf.getSymbol(); |
|
521 |
sym.setColor(newColor); |
|
522 |
|
|
523 |
}*/ |
|
524 |
// TRUCO PARA REFRESCAR. |
|
525 |
getMapContext().invalidate(); |
|
463 | 526 |
|
527 |
} |
|
528 |
|
|
529 |
} |
|
530 |
|
|
464 | 531 |
/** |
465 | 532 |
* Menu de bot?n derecho para el TOC. |
466 | 533 |
* Se pueden a?adir entradas facilmente desde una extensi?n, |
... | ... | |
490 | 557 |
menuEntrys.add(new ZoomAlTemaTocMenuEntry()); |
491 | 558 |
menuEntrys.add(new EliminarCapaTocMenuEntry()); |
492 | 559 |
menuEntrys.add(new LayersGroupTocMenuEntry()); |
560 |
menuEntrys.add(new LayersUngroupTocMenuEntry()); |
|
493 | 561 |
} |
494 | 562 |
|
495 | 563 |
public static void addEntry(TocMenuEntry entry) { |
Also available in: Unified diff