Ejemplo n.º 1
0
 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);
   }
 }
Ejemplo n.º 2
0
 public void execute(ITocItem item, FLayer[] selectedItems) {
   FLayer lyr = getNodeLayer(item);
   if (!lyr.isAvailable()) return;
   ChangeName chn = new ChangeName(lyr.getName());
   PluginServices.getMDIManager().addWindow(chn);
   lyr.setName(chn.getName());
   Project project =
       ((ProjectExtension) PluginServices.getExtension(ProjectExtension.class)).getProject();
   project.setModified(true);
 }
Ejemplo n.º 3
0
  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;
  }