public boolean isEnabled() { IProjectView model = vista.getModel(); MapContext mapa = model.getMapContext(); for (int i = 0; i < mapa.getLayers().getActives().length; i++) { FLayer lyr = mapa.getLayers().getActives()[i]; if (lyr.isAvailable() && lyr instanceof FLyrVect) { // && !lyr.isEditing()) { return true; } } return false; }
public void execute(String actionCommand) { IProjectView model = vista.getModel(); MapContext mapa = model.getMapContext(); logger.debug("Comand : " + actionCommand); if (actionCommand.equals("INVERT_SELECTION")) { FLayer[] actives = mapa.getLayers().getActives(); for (int i = 0; i < actives.length; i++) { FLayer lyr = actives[i]; if (lyr.isAvailable() && lyr instanceof SingleLayer) { SingleLayer lyrSingle = (SingleLayer) lyr; DataStore ds = lyrSingle.getDataStore(); if (ds instanceof FeatureStore) { try { ((FeatureStore) ds).getFeatureSelection().reverse(); ((ProjectDocument) vista.getModel()).setModified(true); } catch (DataException e) { e.printStackTrace(); NotificationManager.addError(e); } } else { // TODO Not supported yet } } } ((ProjectDocument) vista.getModel()).setModified(true); } }
/** * Constructor * * @param vista vista actual de la aplicacion. */ public PrincipalComponentPanel(View vista) { super(ButtonsPanel.BUTTONS_ACCEPTCANCEL); view = vista; m_MapContext = vista.getModel().getMapContext(); layers = m_MapContext.getLayers(); Inicializar(); }
public boolean isVisible() { IWindow f = PluginServices.getMDIManager().getActiveWindow(); if (f != null && f instanceof View) { vista = (View) f; IProjectView model = vista.getModel(); MapContext mapa = model.getMapContext(); return hasVectorLayers(mapa.getLayers()); } return false; }