/** @param mapCtrl The mapCtrl to set. */ public void setMapControl(MapControl mapCtrl) { if (mapCtrl != null) { this.mapCtrl = mapCtrl; mapCtrl.getMapContext().getLayers().addLayerListener(this); mapCtrl.getMapContext().getLayers().addLayerCollectionListener(this); } }
public void editionChanged(LayerEvent e) { Logger.global.info(e.toString()); ILayerEdited lyrEdit = getLayerEdited(e.getSource()); // Si no está en la lista, comprobamos que está en edición // y lo añadimos if ((lyrEdit == null) && e.getSource().isEditing()) { lyrEdit = FactoryLayerEdited.createLayerEdited(e.getSource()); editedLayers.add(lyrEdit); if (getMapControl() != null) { getMapControl().setTool("cadtooladapter"); CADExtension.setCADTool("_selection", true); } PluginServices.getMainFrame().setSelectedTool("_selection"); // idActiveLayer = editedLayers.size() - 1; ile = getLayerEdited(e.getSource()); System.out.println("NUEVA CAPA EN EDICION: " + lyrEdit.getLayer().getName()); // activationChanged(e); // Ponemos el resto de temas desactivados if (mapCtrl != null) mapCtrl.getMapContext().getLayers().setActive(false); // y activamos el nuevo. e.getSource().setActive(true); if (e.getSource() instanceof FLyrVect) { FLyrVect fLyrVect = (FLyrVect) e.getSource(); ((VectorialLayerEdited) lyrEdit) .setEditionChangeManager(new EditionChangeManager(fLyrVect)); // VectorialEditableAdapter vea = // (VectorialEditableAdapter)fLyrVect.getSource(); // vea.addEditionListener(new EditionChangeManager(fLyrVect)); } } else { for (int i = 0; i < editedLayers.size(); i++) { VectorialLayerEdited vle = (VectorialLayerEdited) editedLayers.get(i); if (vle.equals(lyrEdit)) { editedLayers.remove(i); ile = null; // idActiveLayer=-1; return; } } } }