public void activationChanged(LayerEvent e) { if (e.getSource().isActive()) { ile = getLayerEdited(e.getSource()); } // IWindow window=PluginServices.getMDIManager().getActiveWindow(); // if (window instanceof View){ // View view=(View)window; // if (e.getSource().isEditing()){ // view.showConsole(); // }else{ // view.hideConsole(); // } // } if (ile == null || ile.getLayer().equals(e.getSource())) { if (ile != null && !ile.getLayer().isActive()) { VectorialLayerEdited lastVLE = (VectorialLayerEdited) ile; lastVLE.activationLost(e); } if (e.getSource() instanceof FLyrVect) { VectorialLayerEdited vle = null; vle = (VectorialLayerEdited) getLayerEdited(e.getSource()); // for (int i = 0; i < editedLayers.size(); i++) { // vle = (VectorialLayerEdited) editedLayers.get(i); // if (vle.getLayer().equals(e.getSource())) { // idActiveLayer = i; ile = vle; if (getMapControl() != null && vle != null && vle.getLayer().isActive()) { getMapControl().setTool("cadtooladapter"); vle.activationGained(e); return; } } // } // idActiveLayer=-1; // ile=null; if (getMapControl() != null) { getMapControl().setTool("zoomIn"); PluginServices.getMainFrame().setSelectedTool("ZOOM_IN"); } } }
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; } } } }