Esempio n. 1
0
  protected void executeSelectedAlgorithmIteratively(final int iParameterToIterateOver) {

    try {
      if (m_Alg != null) {
        final GeoAlgorithm alg = m_Alg.getNewInstance();
        final int iRet =
            SextanteGUI.getGUIFactory().showAlgorithmDialog(alg, m_ParentDialog.getDialog(), null);
        if (iRet == IGUIFactory.OK) {
          final ParametersSet params = m_Alg.getParameters();
          final int iParamCount = params.getNumberOfParameters();
          int iVectorLayers = 0;
          for (int i = 0; i < iParamCount; i++) {
            final Parameter param = m_Alg.getParameters().getParameter(i);
            if (param instanceof ParameterVectorLayer) {
              if (iVectorLayers == iParameterToIterateOver) {
                GeoAlgorithmExecutors.executeIterative(
                    alg, m_ParentDialog.getDialog(), param.getParameterName());
                break;
              }
              iVectorLayers++;
            }
          }
        }
      }
    } catch (final Exception e) {
      Sextante.addErrorToLog(e);
    }
  }
Esempio n. 2
0
  protected void executeAsBatchInGIS() {

    if (m_Alg != null) {
      SextanteGUI.getGUIFactory()
          .showBatchProcessingFromGISDialog(m_Alg, m_ParentDialog.getDialog());
    }
  }
Esempio n. 3
0
  protected void executeSelectedAlgorithm() {

    try {
      if (m_Alg != null) {
        final GeoAlgorithm alg = m_Alg.getNewInstance();
        final int iRet =
            SextanteGUI.getGUIFactory().showAlgorithmDialog(alg, m_ParentDialog.getDialog(), null);
        if (iRet == IGUIFactory.OK) {
          final String[] cmd = alg.getAlgorithmAsCommandLineSentences();
          if (cmd != null) {
            History.addToHistory(cmd);
          }
          GeoAlgorithmExecutors.execute(alg, m_ParentDialog.getDialog());
          updateListOfMostRecentAlgorithms();
        }
      } else if (m_Action != null) {
        m_Action.execute();
      }
    } catch (final Exception e) {
      Sextante.addErrorToLog(e);
    }
  }