コード例 #1
0
  public int[] obtainIndexForOptionalLayers(String[] menuSelected) {

    if (menuSelected.length == 0) { // if not entry return null
      return null;
    }

    ArrayList<Integer> result = new ArrayList(); // temporal list to hold values
    Layer tempLayer = null;
    for (int index = 0;
        index < layersManager.getVectorLayers().size();
        index++) { // loop each vector layer
      tempLayer = layersManager.getVectorLayers().get(index); // temp variable

      // each tree value has to be send separately.
      // becuase the vector layers are all on one level of the tree
      for (int menuNumber = 0; menuNumber < menuSelected.length; menuNumber++) {
        if (tempLayer.isThisLayer(
            StringAndNumbers.strArrayFromStringColon(menuSelected[menuNumber]))) {
          // check to see if the layer is selected
          result.add(Integer.valueOf(index));
          break;
        }
      }
    }
    // convert into array of ints and then return.
    return ConvertionTools.convertObjectArrayToIntArray(result.toArray());
  }
コード例 #2
0
  /**
   * Obtains the index of the list of vector layers or raster depending on the selection.
   *
   * @param {MenuEntry[]} menuEntry User selection array
   * @param {boolean} layerType layer type checking it can be HtmlTools.RASTER_LAYERS
   * @return int[] we return an array with the index of the layers.
   */
  public int[] obtainArrayIndexOfLayers(MenuEntry[] menuEntry) {
    int index = 0;
    if (menuEntry.length == 0) { // if not entry return null
      return null;
    }

    ArrayList<Integer> resultado = new ArrayList(); // temporal list to hold values
    Layer tempLayer = null; // temp layer used to check
    // loop alentries until find the one selected
    for (index = 0; index < layersManager.getMainLayers().size(); index++) {
      tempLayer = layersManager.getMainLayers().get(index); // get index of this layer
      if (tempLayer.isThisLayer(menuEntry)) { // if this is the layer we are looking for
        resultado.add(Integer.valueOf(index)); // add layer to list of index
        break; // if found then break from for loop.
      }
    }

    // convert into array of ints and then return.
    return ConvertionTools.convertObjectArrayToIntArray(resultado.toArray());
  }