public boolean execute(PlugInContext context) throws Exception {
    Collection selectedCategories = context.getLayerNamePanel().getSelectedCategories();

    String actualName = aplicacion.getI18nString("GeopistaAddNewLayerPlugIn.New");

    GeopistaLayer layer =
        new GeopistaLayer(
            actualName,
            context.getLayerManager().generateLayerFillColor(),
            createBlankFeatureCollection(),
            context.getLayerManager());
    // Como es una capa creada localmente asignamos el flag isLocal a true
    layer.setLocal(true);

    // com.geopista.io.datasource.GeopistaStandarReaderWriteFileDataSource.GeoGML
    // h = new
    // com.geopista.io.datasource.GeopistaStandarReaderWriteFileDataSource.GeoGML();
    // layer.setDataSourceQuery(new DataSourceQuery());

    context
        .getLayerManager()
        .addLayer(
            selectedCategories.isEmpty()
                ? StandardCategoryNames.WORKING
                : selectedCategories.iterator().next().toString(),
            layer);

    ((EditingPlugIn) context.getWorkbenchContext().getBlackboard().get(EditingPlugIn.KEY))
        .getToolbox(context.getWorkbenchContext())
        .setVisible(true);

    return true;
  }
  public void execute() throws Exception {
    if (encuestados1Panel != null) {
      if (encuestados1Panel.datosMinimosYCorrectos()) {
        GeopistaLayer geopistaLayer =
            (GeopistaLayer)
                GeopistaEditorPanel.getEditor()
                    .getLayerManager()
                    .getLayer(ConstantesLocalGISEIEL.ENCUESTADOS1_LAYER);
        String idLayer = geopistaLayer.getSystemId();
        encuestados1Panel.okPressed();
        Encuestados1EIEL encuestado1 =
            (Encuestados1EIEL)
                AppContext.getApplicationContext()
                    .getBlackboard()
                    .get("propiedadesnucleosencuestados1_panel");
        ConstantesLocalGISEIEL.clienteLocalGISEIEL.insertarElemento(
            encuestados1Panel.getEncuestados1(encuestado1),
            idLayer,
            ConstantesLocalGISEIEL.ENCUESTADOS1);

        if (EditingInfoPanel.getInstance() != null
            && EditingInfoPanel.getInstance().getJPanelTree() != null
            && EditingInfoPanel.getInstance().getJPanelTree().getPatronSelected() != null) {
          if (EditingInfoPanel.getInstance()
              .getJPanelTree()
              .getPatronSelected()
              .equals(ConstantesLocalGISEIEL.ENCUESTADOS1)) {
            EditingInfoPanel.getInstance().listarDatosTabla();
          }
        }
      }
    }
  }
  public void execute() throws Exception {
    if (captacionesPanel != null) {
      if (captacionesPanel.datosMinimosYCorrectos()) {
        GeopistaLayer geopistaLayer =
            (GeopistaLayer)
                GeopistaEditorPanel.getEditor()
                    .getLayerManager()
                    .getLayer(ConstantesLocalGISEIEL.CAPTACIONES_LAYER);
        String idLayer = geopistaLayer.getSystemId();
        captacionesPanel.okPressed();
        CaptacionesEIEL captacion =
            (CaptacionesEIEL) AppContext.getApplicationContext().getBlackboard().get("captacion");
        InitEIEL.clienteLocalGISEIEL.insertarElemento(
            captacionesPanel.getCaptacion(captacion), idLayer, ConstantesLocalGISEIEL.CAPTACIONES);

        if (EditingInfoPanel.getInstance() != null
            && EditingInfoPanel.getInstance().getJPanelTree() != null
            && EditingInfoPanel.getInstance().getJPanelTree().getPatronSelected() != null) {
          if (EditingInfoPanel.getInstance()
              .getJPanelTree()
              .getPatronSelected()
              .equals(ConstantesLocalGISEIEL.CAPTACIONES)) {
            EditingInfoPanel.getInstance().listarDatosTabla();
          }
        }
      }
    }
  }
 protected void enteredPanelFromLeft(Map dataMap) {
   try {
     if (!mapLoaded) {
       geopistaEditor.loadMap(appContext.getString("url.mapa.catastro"));
       GeopistaLayer layerParcelas =
           (GeopistaLayer) geopistaEditor.getLayerManager().getLayer("parcelas");
       layerParcelas.setActiva(true);
       mapLoaded = true;
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
예제 #5
0
  public static Collection searchByAttribute(
      GeopistaLayer geopistaLayer, int attributeNumber, String value) {
    Collection finalFeatures = new ArrayList();
    if (geopistaLayer == null) return finalFeatures;
    java.util.List allFeaturesList = geopistaLayer.getFeatureCollectionWrapper().getFeatures();
    Iterator allFeaturesListIter = allFeaturesList.iterator();
    while (allFeaturesListIter.hasNext()) {
      Feature localFeature = (Feature) allFeaturesListIter.next();
      String nombreAtributo = localFeature.getString(attributeNumber).trim();
      if (nombreAtributo.equals(value)) {
        finalFeatures.add(localFeature);
      }
    }

    return finalFeatures;
  }
예제 #6
0
  /**
   * Añade todos los atributos de las capas seleccionadas
   *
   * @param extractLayers
   * @return
   */
  private NamedVector[] getRootLayerNodes(ArrayList<GeopistaLayer> extractLayers) {
    NamedVector[] returnVector = null;
    if (extractLayers != null) {
      GeopistaLayer geopistaLayer = null;
      String layerSystemId;
      EIELFilesUtils eielFilesUtils;
      String layerName;
      returnVector = new NamedVector[extractLayers.size()];
      // capas
      for (int i = 0; i < extractLayers.size(); i++) {
        geopistaLayer = extractLayers.get(i);
        layerSystemId = geopistaLayer.getSystemId();
        eielFilesUtils = new EIELFilesUtils(layerSystemId);
        layerName = geopistaLayer.getName();

        // buscamos el identificador de cada capa
        GeopistaSchema featureGeoSchema =
            (GeopistaSchema) geopistaLayer.getFeatureCollectionWrapper().getFeatureSchema();
        // atributos
        NamedVector namedVector = new NamedVector(layerName);
        Column columnByAttribute = null;
        String colName = null;
        for (int j = 0; j < featureGeoSchema.getAttributeCount(); j++) {
          columnByAttribute = featureGeoSchema.getColumnByAttribute(j);
          colName = columnByAttribute.getName();
          if (colName.toLowerCase().equals(GEOMETRY_ATR)) { // no lo mostramos
            continue;
          }
          // CAMBIAR: COMPROBAR SI SE DEBE SELECCIONAR id SI ES TIPO EIEL
          else if (colName.toLowerCase().equals(Constants.FIELD_ID)) { // lo ponemos al principio
            namedVector.add(0, new CheckBoxNode(featureGeoSchema.getAttributeName(j), true, false));
          } else if (colName.toLowerCase().equals(Constants.FIELD_ID_MUNICIPIO)) {
            namedVector.add(1, new CheckBoxNode(featureGeoSchema.getAttributeName(j), true, false));
          }
          // caso especial para licencias
          // la referencia castastral será el atributo clave para localizar la licencia
          else if (colName.toLowerCase().contains(Constants.CLAVE_METAINFO)
              && Utils.isInArray(Constants.TIPOS_LICENCIAS, layerSystemId)) {
            namedVector.add(new CheckBoxNode(featureGeoSchema.getAttributeName(j), true, false));
          }
          // caso especial para inventario de patrimonio
          else if (colName.toLowerCase().equals(Constants.NUM_BIENES_ID)
              && Utils.isInArray(Constants.TIPOS_INVENTARIO, layerSystemId)) {
            namedVector.add(new CheckBoxNode(featureGeoSchema.getAttributeName(j), true, false));
          }
          // caso especial para EIEL
          else if (Utils.isInArray(Constants.TIPOS_EIEL, layerSystemId)) {
            if (isPkFieldEIEL(eielFilesUtils, layerSystemId, colName))
              namedVector.add(new CheckBoxNode(featureGeoSchema.getAttributeName(j), true, false));
            else
              namedVector.add(new CheckBoxNode(featureGeoSchema.getAttributeName(j), false, true));
          } else { // simplemente lo añadimos
            // if(!(licUtils.isInArray(Constants.TIPOS_LICENCIAS, layerSystemId) ||
            // licUtils.isInArray(Constants.TIPOS_INVENTARIO, layerSystemId))){
            if (!Utils.isInArray(Constants.TIPOS_LICENCIAS, layerSystemId)) {
              namedVector.add(new CheckBoxNode(featureGeoSchema.getAttributeName(j), false, true));
            }
          }
        }
        returnVector[i] = namedVector;
      }
    }

    return returnVector;
  }