Ejemplo n.º 1
0
  protected boolean refreshFeatureSelection(String layerName, String id) {

    try {
      if (id == null || geopistaEditor == null) return false;
      this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
      geopistaEditor.getSelectionManager().clear();
      GeopistaLayer geopistaLayer =
          (GeopistaLayer) geopistaEditor.getLayerManager().getLayer(layerName);
      Collection collection = searchByAttribute(geopistaLayer, 0, id);
      Iterator it = collection.iterator();
      if (it.hasNext()) {
        Feature feature = (Feature) it.next();
        geopistaEditor.select(geopistaLayer, feature);
      }
      geopistaEditor.zoomToSelected();
      this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
      return true;
    } catch (Exception ex) {
      this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
      StringWriter sw = new StringWriter();
      PrintWriter pw = new PrintWriter(sw);
      ex.printStackTrace(pw);
      logger.error("Exception: " + sw.toString());
      return false;
    }
  }
Ejemplo n.º 2
0
  public boolean refreshBusquedaSelection(JInternalFrame frame, GeopistaEditor geopistaEditor) {

    try {

      frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

      geopistaEditor.getSelectionManager().clear();

      GeopistaLayer geopistaLayer =
          (GeopistaLayer) geopistaEditor.getLayerManager().getLayer(layerBusqueda);

      Enumeration enumerationElement = valoresBusqueda.keys();

      while (enumerationElement.hasMoreElements()) {
        String referenciaCatastral = (String) enumerationElement.nextElement();
        // El numero 1 identifica el id numero de policia
        Collection collection = searchByAttribute(geopistaLayer, 1, referenciaCatastral);
        Iterator it = collection.iterator();
        if (it.hasNext()) {
          Feature feature = (Feature) it.next();
          geopistaEditor.select(geopistaLayer, feature);
        }
      }

      geopistaEditor.zoomToSelected();
      frame.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
      return true;
    } catch (Exception ex) {

      frame.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
      StringWriter sw = new StringWriter();
      PrintWriter pw = new PrintWriter(sw);
      ex.printStackTrace(pw);
      logger.error("Exception: " + sw.toString());
      return false;
    }
  }