示例#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);
   }
 }
示例#2
0
  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;
  }
示例#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;
  }