コード例 #1
0
  public void execute(String actionCommand) {
    if (actionCommand.compareToIgnoreCase("NEW_ORACLE_SPATIAL") == 0) {

      IWindow w = PluginServices.getMDIManager().getActiveWindow();
      if (w instanceof View) {
        try {
          String _file = createResourceUrl("images/new_geodb_table.png").getFile();
          ImageIcon iicon = new ImageIcon(_file);

          DriverManager writerManager = LayerFactory.getDM();
          WizardAndami wizard = new WizardAndami(iicon);
          RepeatedChooseGeometryTypePanel panelChoose =
              new RepeatedChooseGeometryTypePanel(wizard.getWizardComponents());
          RepeatedFieldDefinitionPanel panelFields =
              new RepeatedFieldDefinitionPanel(wizard.getWizardComponents());
          NewVectorDBConnectionPanel connPanel =
              new NewVectorDBConnectionPanel(
                  wizard.getWizardComponents(),
                  OracleSpatialDriver.NAME,
                  OracleSpatialDriver.MAX_ID_LENGTH);

          wizard.getWizardComponents().addWizardPanel(panelChoose);
          wizard.getWizardComponents().addWizardPanel(panelFields);
          wizard.getWizardComponents().addWizardPanel(connPanel);

          Driver driver = new OracleSpatialDriver();
          panelFields.setWriter(((IWriteable) driver).getWriter());
          panelChoose.setDriver(driver);

          View theView = (View) w;
          MapContext mc = theView.getMapControl().getMapContext();

          NewOracleSpatialTableFinishAction action =
              new NewOracleSpatialTableFinishAction(
                  wizard.getWizardComponents(), wizard, connPanel, mc);

          wizard.getWizardComponents().setFinishAction(action);
          wizard.getWizardComponents().getFinishButton().setEnabled(false);
          wizard.getWindowInfo().setWidth(640);
          wizard.getWindowInfo().setHeight(350);
          wizard.getWindowInfo().setTitle(PluginServices.getText(this, "new_layer"));
          PluginServices.getMDIManager().addWindow(wizard);

        } catch (Exception ex) {
          logger.error("While showing new oracle spatial table wizard: " + ex.getMessage());
        }
      }
    }
  }
コード例 #2
0
ファイル: LayerReprojectPanel.java プロジェクト: omusico/siga
  private void setLayer(FLyrRasterSE lyr) {
    this.lyr = lyr;

    if (this.lyr == null) return;

    BaseView view = (BaseView) PluginServices.getMDIManager().getActiveWindow();
    viewName = PluginServices.getMDIManager().getWindowInfo(view).getTitle();

    projSrc = this.lyr.readProjection();
    if (projSrc == null) projSrc = CRSFactory.getCRS("EPSG:23030");

    projDst = CRSFactory.getCRS("EPSG:23030");

    getLayerReprojectListener().setIsInTOC(isInTOC);
    getLayerReprojectListener().setLayer(this.lyr);
  }
コード例 #3
0
ファイル: EditionManager.java プロジェクト: CafeGIS/gvSIG2_0
 public void layerRemoved(LayerCollectionEvent e) {
   VectorialLayerEdited vle = (VectorialLayerEdited) getActiveLayerEdited();
   if (vle != null && vle.getLayer().isActive()) {
     // FLayers layers=getMapControl().getMapContext().getLayers();
     // if (layers.getLayersCount()>0)
     //	layers.getLayer(0).setActive(true);
     try {
       vle.clearSelection();
     } catch (DataException e1) {
       NotificationManager.addError(e1);
     }
     editedLayers.remove(vle);
     getMapControl().setTool("zoomIn");
     FLyrVect lv = (FLyrVect) vle.getLayer();
     if (e.getAffectedLayer().equals(lv)) {
       IWindow window = PluginServices.getMDIManager().getActiveWindow();
       if (window instanceof View) {
         View view = (View) window;
         view.hideConsole();
         view.validate();
         view.repaint();
       }
     }
   }
   PluginServices.getMainFrame().enableControls();
 }
コード例 #4
0
  public boolean isEnabled() {

    if (!ORACLE_JAR_PRESENT) return false;

    IWindow w = PluginServices.getMDIManager().getActiveWindow();
    return (w instanceof View);
  }
コード例 #5
0
 /** acciones al cerrar */
 public void close() {
   try {
     PluginServices.getMDIManager().closeWindow(this);
   } catch (ArrayIndexOutOfBoundsException ex) {
     // Si la ventana no se puede eliminar no hacemos nada
   }
 }
コード例 #6
0
 public void execute(String actionCommand) {
   layer = getLayerFromTOC();
   Example1Form dialog = new Example1Form(layer);
   if (dialog.init()) {
     PluginServices.getMDIManager().addWindow(dialog);
   }
 }
コード例 #7
0
 public void execute(ITocItem item, FLayer[] selectedItems) {
   FLayer lyr = getNodeLayer(item);
   if (!lyr.isAvailable()) return;
   ChangeName chn = new ChangeName(lyr.getName());
   PluginServices.getMDIManager().addWindow(chn);
   lyr.setName(chn.getName());
   Project project =
       ((ProjectExtension) PluginServices.getExtension(ProjectExtension.class)).getProject();
   project.setModified(true);
 }
コード例 #8
0
  public void actionPerformed(ActionEvent arg0) {
    Object src = arg0.getSource();

    if (src == connectedCheckBox) {
      if (connectedCheckBox.isSelected()) {
        passwordField.setEnabled(true);
        passwordField.setBackground(Color.WHITE);
      } else {
        passwordField.setText("");
        passwordField.setEnabled(false);
        passwordField.setBackground(Color.LIGHT_GRAY);
      }
    }

    if (src == okButton) {
      okPressed = true;
      PluginServices.getMDIManager().closeWindow(this);

      return;
    }

    if (src == cancelButton) {
      okPressed = false;
      PluginServices.getMDIManager().closeWindow(this);

      return;
    }

    if (src == driverComboBox) {
      String driverName = driverComboBox.getSelectedItem().toString();
      IVectorialDatabaseDriver driver;

      try {
        driver = (IVectorialDatabaseDriver) LayerFactory.getDM().getDriver(driverName);
        portTextField.setText("" + driver.getDefaultPort());
      } catch (DriverLoadException e1) {
        portTextField.setText("");
      }

      return;
    }
  }
コード例 #9
0
  public void end(Object param) {
    fileName = Utilities.createTempDirectory() + File.separator;
    fileName = fileName + RasterLibrary.getOnlyLayerName() + ".tif";
    RasterLibrary.usesOnlyLayerName();

    PrincipalComponentCalculusPanel altPrincipalComponentCalculusPanel =
        new PrincipalComponentCalculusPanel(
            view, (PCStatistics) param, statisticsProcess, selectecBands);
    altPrincipalComponentCalculusPanel.setFilename(fileName);
    PluginServices.getMDIManager().addWindow(altPrincipalComponentCalculusPanel);
  }
コード例 #10
0
  public void actionPerformed(ActionEvent e) {
    if (e.getSource() == this.buttonAccept) {
      String costFieldName = null;
      try {
        costFieldName = (String) this.comboCostFieldValues.getSelectedItem();
        this.properties.put("COST_FIELD", costFieldName);
      } catch (NullPointerException except) {

      }
      try {
        this.properties.put(
            "ROUND_VALUE", Integer.valueOf(this.comboRoundValues.getSelectedIndex()));
      } catch (NullPointerException except) {

      }
      PluginServices.getMDIManager().closeWindow(this);
    } else if (e.getSource() == this.buttonCancel) {
      PluginServices.getMDIManager().closeWindow(this);
    }
  }
コード例 #11
0
  /**
   * Obtiene el mapControl. La llamada createLayer recibe el MapControl por parámetro pero ni pre()
   * ni post() pueden tener acceso al MapControl a no ser que lo busquen ellos.
   *
   * @return MapControl
   */
  public MapControl getMapControl() {
    if (mapControl != null) return mapControl;

    IWindow activeWindow = PluginServices.getMDIManager().getActiveWindow();
    if ((activeWindow != null) && (activeWindow instanceof BaseView))
      return ((BaseView) activeWindow).getMapControl();

    IWindow[] w = PluginServices.getMDIManager().getAllWindows();
    // Obtiene la primera vista activa
    for (int i = 0; i < w.length; i++)
      if (w[i] instanceof BaseView && w[i].equals(PluginServices.getMDIManager().getActiveWindow()))
        return ((BaseView) w[i]).getMapControl();

    // Si no hay ninguna activa obtiene la primera vista aunque no esté
    // activa
    for (int i = 0; i < w.length; i++)
      if (w[i] instanceof BaseView) return ((BaseView) w[i]).getMapControl();

    return null;
  }
コード例 #12
0
  /** @see com.iver.andami.plugins.IExtension#isVisible() */
  public boolean isVisible() {
    IWindow v = PluginServices.getMDIManager().getActiveWindow();

    if (v == null) {
      return false;
      //        } else if (!(v instanceof Table) && !(v instanceof BaseView)) {
    } else if (!(v instanceof Table)) {
      return false;
    }
    return true;
  }
コード例 #13
0
 /** @see com.iver.andami.plugins.IExtension#execute(java.lang.String) */
 @Override
 public void execute(String s) {
   CADExtension.initFocus();
   if (s.equals(CAD_TOOL_KEY)) {
     CADExtension.setCADTool(CAD_TOOL_KEY, true);
     View view = (View) PluginServices.getMDIManager().getActiveWindow();
     MapControl mapControl = view.getMapControl();
     CADExtension.getEditionManager().setMapControl(mapControl);
   }
   CADExtension.getCADToolAdapter().configureMenu();
 }
コード例 #14
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;
  }
コード例 #15
0
  public boolean isEnabled() {
    IWindow f = PluginServices.getMDIManager().getActiveWindow();

    if (f == null) {
      return false;
    }

    if (f instanceof Layout) {
      return ((Layout) f).getLayoutContext().isEditable();
    }

    return false;
  }
コード例 #16
0
  public boolean isVisible() {
    IWindow f = PluginServices.getMDIManager().getActiveWindow();

    if (f == null) {
      return false;
    }

    if (f instanceof Layout) {
      return true; // layout.m_Display.getMapControl().getMapContext().getLayers().layerCount()
      // > 0;
    }
    return false;
  }
コード例 #17
0
  public boolean isVisible() {
    IWindow f = PluginServices.getMDIManager().getActiveWindow();

    if (f == null) {
      return false;
    }

    if (f instanceof Layout) {
      return true;
    } else {
      return false;
    }
  }
コード例 #18
0
  @Override
  public void execute(String actionCommand) {
    AbstractForm dialog = null;
    if (FormFactory.hasMainFormRegistered(actionCommand)) {
      FLyrVect layer = new TOCLayerManager().getLayerByName(actionCommand);
      if (layer != null) {
        dialog = FormFactory.createFormRegistered(layer);
      }
    }

    if ((dialog != null) && (dialog.init())) {
      PluginServices.getMDIManager().addWindow(dialog);
    }
  }
コード例 #19
0
  public void execute(String actionCommand) {
    ImportFieldParams param = new ImportFieldParams();

    IWindow v = PluginServices.getMDIManager().getActiveWindow();
    if (v instanceof Table) {
      Table table = (Table) v;
      param.setLockTable(true);
      try {
        param.setTable(table.getModel());
      } catch (ReadDriverException e) {
        NotificationManager.showMessageError(
            PluginServices.getText(null, "Failed_filling_table"), e);
      }
    }

    ImageIcon logo =
        new javax.swing.ImageIcon(
            this.getClass().getClassLoader().getResource("images/package_graphics.png"));

    WizardAndami wizard = new WizardAndami(logo);
    // Adds the wizard panels:

    LinkDefinitionPanel linkPanel = new LinkDefinitionPanel(wizard.getWizardComponents(), param);
    wizard.getWizardComponents().addWizardPanel(linkPanel);

    ImportFieldPanel fieldsPanel = new ImportFieldPanel(wizard.getWizardComponents(), param);
    wizard.getWizardComponents().addWizardPanel(fieldsPanel);

    wizard.getWizardComponents().getFinishButton().setEnabled(false);
    wizard.getWindowInfo().setWidth(640);
    wizard.getWindowInfo().setHeight(350);
    wizard.getWindowInfo().setTitle(PluginServices.getText(this, "import_fields"));

    wizard.getWizardComponents().setFinishAction(new ImportFieldsAction(wizard, param));

    PluginServices.getMDIManager().addWindow(wizard);
  }
コード例 #20
0
  public void execute(String s) {
    layout = (Layout) PluginServices.getMDIManager().getActiveWindow();

    logger.debug("Comand : " + s);
    boolean insertGroupPosibility = false;
    if (s.equals("SELECT")) {
      layout.getLayoutControl().setTool("layoutselect");
    } else if (s.equals("RECTANGLEVIEW")) {
      layout.getLayoutControl().setTool("layoutaddview");
      insertGroupPosibility = true;
    } else if (s.equals("RECTANGLEOVERVIEW")) {
      layout.getLayoutControl().setTool("layoutaddoverview");
      insertGroupPosibility = true;
    } else if (s.equals("RECTANGLEPICTURE")) {
      layout.getLayoutControl().setTool("layoutaddpicture");
      insertGroupPosibility = true;
    } else if (s.equals("RECTANGLESCALEBAR")) {
      layout.getLayoutControl().setTool("layoutaddscale");
      insertGroupPosibility = true;
    } else if (s.equals("RECTANGLELEGEND")) {
      layout.getLayoutControl().setTool("layoutaddlegend");
      insertGroupPosibility = true;
    } else if (s.equals("RECTANGLETEXT")) {
      layout.getLayoutControl().setTool("layoutaddtext");
      insertGroupPosibility = true;
    } else if (s.equals("RECTANGLENORTH")) {
      layout.getLayoutControl().setTool("layoutaddnorth");
      insertGroupPosibility = true;
    } else if (s.equals("RECTANGLEBOX")) {
      layout.getLayoutControl().setTool("layoutaddbox");
      insertGroupPosibility = true;
    } else if (s.equals("POINT")) {
      layout.getLayoutControl().setTool("layoutaddpoint");
    } else if (s.equals("LINE")) {
      layout.getLayoutControl().setTool("layoutaddline");
    } else if (s.equals("POLYLINE")) {
      layout.getLayoutControl().setTool("layoutaddpolyline");
    } else if (s.equals("CIRCLE")) {
      layout.getLayoutControl().setTool("layoutaddcircle");
    } else if (s.equals("RECTANGLESIMPLE")) {
      layout.getLayoutControl().setTool("layoutaddrectangle");
    } else if (s.equals("POLYGON")) {
      layout.getLayoutControl().setTool("layoutaddpolygon");
    } else if (s.equals("REMOVE")) {
      layout.getLayoutContext().delFFrameSelected();
      layout.getLayoutControl().refresh();
    }
    layout.getModel().setModified(true);
  }
コード例 #21
0
  public void execute(String s) {
    // TODO Auto-generated method stub
    layout = (Layout) PluginServices.getMDIManager().getActiveWindow();

    LayoutAddView3DListenerImpl lavl = new LayoutAddView3DListenerImpl(layout);

    layout.getLayoutControl().addLayoutTool("view3Dinsert", new LayoutRectangleBehavior(lavl));

    FLayoutZooms zooms = new FLayoutZooms(layout);
    // logger.debug("Comand : " + s);

    if (s.equals("INSERT_3D_VIEW")) {
      layout.getLayoutControl().setTool("view3Dinsert");
    }
  }
コード例 #22
0
  /**
   * Creating cvs format file with the statistics. Option to select the two columns separator.
   *
   * <p>Example with semicolon: Name;data\n Name2;data2\n
   *
   * @param valores - Pairs: String name (key) + Double value (
   * @param endFile - File to write the information
   */
  private void exportToCSVFile(List<MyObjectStatistics> valores, File endFile) {

    try {
      CSVSeparatorOptionsPanel csvSeparatorOptions = new CSVSeparatorOptionsPanel();
      PluginServices.getMDIManager().addWindow(csvSeparatorOptions);

      String separator = csvSeparatorOptions.getSeparator();

      if (separator != null) {

        FileWriter fileCSV = new FileWriter(endFile);

        fileCSV.write(
            PluginServices.getText(this, "Nombre")
                + separator
                + PluginServices.getText(this, "Valor")
                + "\n");

        Iterator<MyObjectStatistics> iterador = valores.listIterator();

        while (iterador.hasNext()) { // Writing value,value\n
          MyObjectStatistics data = (MyObjectStatistics) iterador.next();
          fileCSV.write(data.getKey() + separator + (data.getValue()) + "\n");
        }
        fileCSV.close();
        JOptionPane.showMessageDialog(
            null,
            PluginServices.getText(this, "fichero_creado_en") + " " + endFile.getAbsolutePath(),
            PluginServices.getText(this, "fichero_creado_en_formato")
                + " csv "
                + PluginServices.getText(this, "mediante_el_separador")
                + " \""
                + separator
                + "\"",
            JOptionPane.INFORMATION_MESSAGE); // Informing the user
      } else return;

    } catch (IOException e) { // Informing the user
      logger.error("Error exportando a formato csv");
      JOptionPane.showMessageDialog(
          null,
          PluginServices.getText(this, "Error_exportando_las_estadisticas")
              + " "
              + endFile.getAbsolutePath(),
          PluginServices.getText(this, "Error"),
          JOptionPane.ERROR_MESSAGE);
    }
  }
コード例 #23
0
  /** @see com.iver.andami.plugins.IExtension#isEnabled() */
  public boolean isEnabled() {

    try {
      if (EditionUtilities.getEditionStatus()
          == EditionUtilities.EDITION_STATUS_ONE_VECTORIAL_LAYER_ACTIVE_AND_EDITABLE) {
        view = (View) PluginServices.getMDIManager().getActiveWindow();
        mapControl = view.getMapControl();
        if (CADExtension.getEditionManager().getActiveLayerEdited() == null) return false;
        FLyrVect lv = (FLyrVect) CADExtension.getEditionManager().getActiveLayerEdited().getLayer();
        if (polygon.isApplicable(lv.getShapeType())) {
          return true;
        }
      }
    } catch (ReadDriverException e) {
      NotificationManager.addError(e.getMessage(), e);
    }
    return false;
  }
コード例 #24
0
  /** @see com.iver.andami.plugins.IExtension#isEnabled() */
  public boolean isEnabled() {
    IWindow v = PluginServices.getMDIManager().getActiveWindow();
    if (!(v instanceof Table)) {
      return false;
    }
    IEditableSource ies = ((Table) v).getModel().getModelo();
    if (!(ies instanceof IWriteable)) {
      return false;
    }
    IWriter writer = ((IWriteable) ies).getWriter();
    if (writer == null) {
      return false;
    }
    if (!writer.canAlterTable()) {
      return false;
    }

    return true;
  }
コード例 #25
0
  public void accept() {

    if (getModeloTabla().getNumSelected() > 0) {
      FLyrRasterSE rasterLayer =
          (FLyrRasterSE) layers.getLayer((String) getComboCapas().getSelectedItem());
      PluginServices.getMDIManager().closeWindow(this);
      statisticsProcess = new PCStatisticsProcess();
      statisticsProcess.addParam("inputRasterLayer", rasterLayer);
      selectecBands = getModeloTabla().getSeleccionadas();
      statisticsProcess.addParam("selectedBands", selectecBands);

      statisticsProcess.setActions(this);
      statisticsProcess.start();
    } else {

      JOptionPane.showMessageDialog(
          null,
          PluginServices.getText(this, "no_bandas"),
          PluginServices.getText(this, "principal_components"),
          JOptionPane.WARNING_MESSAGE);
    }
  }
コード例 #26
0
 /** @see com.iver.andami.plugins.IExtension#isEnabled() */
 public boolean isEnabled() {
   DisposableIterator iterator = null;
   try {
     if (EditionUtilities.getEditionStatus()
         == EditionUtilities.EDITION_STATUS_ONE_VECTORIAL_LAYER_ACTIVE_AND_EDITABLE) {
       view = (View) PluginServices.getMDIManager().getActiveWindow();
       mapControl = view.getMapControl();
       EditionManager em = CADExtension.getEditionManager();
       if (em.getActiveLayerEdited() == null) {
         return false;
       }
       VectorialLayerEdited vle = (VectorialLayerEdited) em.getActiveLayerEdited();
       //				FLyrVect lv=(FLyrVect)vle.getLayer();
       if (((FeatureSelection) vle.getFeatureStore().getSelection()).getSize() < 1) {
         return false;
       }
       //				ArrayList selectedRows=vle.getSelectedRow();
       //				if (selectedRows.size()<1) {
       //					return false;
       //				}
       iterator = ((FeatureSelection) vle.getFeatureStore().getSelection()).iterator();
       if (iterator.hasNext()) {
         Feature feature = (Feature) iterator.next();
         if (feature.getDefaultGeometry() != null
             && exploit.isApplicable((feature.getDefaultGeometry()).getType())) {
           return true;
         }
       }
     }
   } catch (DataException e) {
     NotificationManager.addError(e.getMessage(), e);
   } finally {
     if (iterator != null) {
       iterator.dispose();
     }
   }
   return false;
 }
コード例 #27
0
  public void execute(ITocItem item, FLayer[] selectedItems) {
    // ITocItem tocItem = (ITocItem) getNodeUserObject();
    ChangeName changename = new ChangeName(null);
    PluginServices.getMDIManager().addWindow(changename);
    if (!changename.isAccepted()) return;
    String nombre = changename.getName();

    if (nombre != null) {

      getMapContext().beginAtomicEvent();
      FLayers parent = selectedItems[0].getParentLayer();
      //			FLayers newGroup = new FLayers(getMapContext(),parent);
      FLayers newGroup = getMapContext().getNewGroupLayer(parent);
      newGroup.setName(nombre);
      int pos = 0;
      for (int i = 0; i < parent.getLayersCount(); i++) {
        if (parent.getLayer(i).equals(selectedItems[0])) {
          pos = i;
          continue;
        }
      }
      for (int j = 0; j < selectedItems.length; j++) {
        FLayer layer = selectedItems[j];
        parent.removeLayer(layer);
        newGroup.addLayer(layer);
      }
      parent.addLayer(pos, newGroup);

      getMapContext().endAtomicEvent();
      // TRUCO PARA REFRESCAR.
      getMapContext().invalidate();
      Project project =
          ((ProjectExtension) PluginServices.getExtension(ProjectExtension.class)).getProject();
      project.setModified(true);
    }
  }
コード例 #28
0
  /**
   * @see
   *     com.iver.cit.gvsig.fmap.tools.Listeners.RectangleListener#rectangle(com.iver.cit.gvsig.fmap.tools.Events.RectangleEvent)
   */
  public void rectangle(RectangleEvent event) throws BehaviorException {
    FFrameOverView fframe =
        (FFrameOverView) FrameFactory.createFrameFromName(FFrameOverViewFactory.registerName);

    fframe.setLayout(layout);
    Rectangle2D r =
        new Rectangle2D
            .Double(); // rectOrigin.x+m_PointAnt.x,rectOrigin.y+m_PointAnt.y,m_LastPoint.x-m_PointAnt.x,m_LastPoint.y-m_PointAnt.y);

    r = getRectangle(TOLERANCE);
    fframe.setBoundBox(FLayoutUtilities.toSheetRect(r, layout.getLayoutControl().getAT()));
    FFrameOverViewDialog fframedialog = new FFrameOverViewDialog(layout, fframe);
    if (fframedialog != null) {
      fframedialog.setRectangle(fframe.getBoundingBox(layout.getLayoutControl().getAT()));
      PluginServices.getMDIManager().addWindow(fframedialog);
    }

    IFFrame newFrame = fframedialog.getFFrame();
    if (newFrame != null) {
      layout.getLayoutContext().addFFrame(newFrame, true, true);
    }
    PluginServices.getMainFrame().enableControls();
    layout.getLayoutControl().refresh();
  }
コード例 #29
0
ファイル: LayerReprojectPanel.java プロジェクト: omusico/siga
  /**
   * Obtiene el bot�n que lanza el panel de selecci�n de proyecciones.
   *
   * @return
   */
  private CRSSelectPanel getProjectionSrcSelector() {
    if (projectionSrcSelector == null) {

      IProjection projectionAux = null;
      IWindow activeWindow = PluginServices.getMDIManager().getActiveWindow();
      if (activeWindow instanceof BaseView) {
        BaseView activeView = (BaseView) activeWindow;
        projectionAux = activeView.getProjection();
        activeView.setProjection(projSrc);
      }

      projectionSrcSelector = CRSSelectPanel.getPanel(projSrc);

      if (activeWindow instanceof BaseView) {
        BaseView activeView = (BaseView) activeWindow;
        activeView.setProjection(projectionAux);
      }

      // projectionSrcSelector.setTransPanelActive(true);
      projectionSrcSelector.setPreferredSize(null);
      projectionSrcSelector.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              if (projectionSrcSelector.isOkPressed()) {
                projSrc = projectionSrcSelector.getCurProj();
              }
            }
          });
      projectionSrcSelector.setBorder(
          BorderFactory.createTitledBorder(RasterToolsUtil.getText(this, "src_proj")));

      if (isInTOC.booleanValue() && this.lyr.readProjection() != null)
        StatusComponent.setDisabled(projectionSrcSelector);
    }
    return projectionSrcSelector;
  }
コード例 #30
0
  /*
   * (non-Javadoc)
   *
   * @see org.gvsig.raster.gui.wizards.IFileOpen#post(java.io.File[])
   */
  public File post(File file) throws LoadLayerException {

    // Si el fichero es raw lanzamos el dialogo de parámetros de raw
    if (RasterUtilities.getExtensionFromFileName(file.getAbsolutePath()).equals("raw")) {
      OpenRawFileDefaultView view = new OpenRawFileDefaultView(file.getAbsolutePath());
      file = view.getImageFile();
    }

    if (file == null || file.getAbsoluteFile() == null) return null;

    // Si el fichero es vrt chequeamos que sea correcto
    if (RasterUtilities.getExtensionFromFileName(file.getAbsolutePath()).equals("vrt")) {
      try {
        checkFileVRT(file);
      } catch (FileOpenVRTException e) {
        RasterToolsUtil.messageBoxError(
            PluginServices.getText(this, "error_abrir_fichero")
                + " "
                + file.getName()
                + "\n\n"
                + PluginServices.getText(this, "informacion_adicional")
                + ":\n\n  "
                + e.getMessage(),
            this,
            e);
        return null;
      }
    }

    try {
      FLyrRasterSE lyrRaster = null;

      String lyr_name = RasterToolsUtil.getLayerNameFromFile(file);
      lyrRaster = FLyrRasterSE.createLayer(lyr_name, file, null);

      // Si hay que generar las overviews por el panel de preferencias
      // if (Configuration.getValue("overviews_ask_before_loading",
      // Boolean.FALSE).booleanValue() == true) {
      // try {
      // boolean generate = false;
      // for (int i = 0; i < lyrRaster.getFileCount(); i++) {
      // if
      // (lyrRaster.getDataSource().getDataset(i)[0].getOverviewCount(0)
      // == 0) {
      // generate = true;
      // break;
      // }
      // }
      // if (generate) {
      // if (firstTaskOverview) {
      // execOverview =
      // RasterToolsUtil.messageBoxYesOrNot("generar_overviews", this);
      // firstTaskOverview = false;
      // }
      //
      // if (execOverview) {
      // RasterProcess process = new OverviewsProcess();
      // process.setCancelable(false);
      // process.addParam("layer", (FLyrRasterSE) lyrRaster);
      // UniqueProcessQueue.getSingleton().add(process);
      // }
      // }
      // } catch (Exception e) {
      // // Si no se puede generar la overview no hacemos nada
      // }
      // }

      // Mostramos el cuadro que pide la georreferenciación si la capa no
      // tiene y si la opción está activa en preferencias
      if (RasterModule.askCoordinates) {
        if (lyrRaster.getFullExtent().getMinX() == 0
            && lyrRaster.getFullExtent().getMinY() == 0
            && lyrRaster.getFullExtent().getMaxX() == ((FLyrRasterSE) lyrRaster).getPxWidth()
            && lyrRaster.getFullExtent().getMaxY() == ((FLyrRasterSE) lyrRaster).getPxHeight()) {
          if (RasterToolsUtil.messageBoxYesOrNot(
              lyrRaster.getName() + "\n" + PluginServices.getText(this, "layer_without_georref"),
              null)) {
            GeoLocationOpeningRasterDialog gld = new GeoLocationOpeningRasterDialog(lyrRaster);
            PluginServices.getMDIManager().addWindow(gld);
          }
        }
      }

      // Opciones de proyección
      boolean compareProj =
          Configuration.getValue("general_ask_projection", Boolean.valueOf(false)).booleanValue();
      if (compareProj) compareProjections(lyrRaster);
      else actionList.add(new Integer(defaultActionLayer));

      lyrsRaster.add(lyrRaster);
    } catch (LoadLayerException e) {
      RasterToolsUtil.messageBoxError("error_carga_capa", this, e);
      throw new LoadLayerException("error_carga_capa", e);
    }

    return super.post(file);
  }