Revision 20610

View differences:

trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/properties/control/EnhancedControl.java
262 262
					eManager.addEnhancedStretchFilter(leParams, stats, renderBands, ePanel.isRemoveEndsSelected());
263 263
				}
264 264
			} catch (FileNotOpenException e) {
265
				throw new FilterAddException("No se han podido calcular estadisticas. Error al a?adir realce.");
265
				throw new FilterAddException("No se han podido calcular estadisticas. Error al a?adir realce;" + e.getMessage());
266 266
			} catch (RasterDriverException e) {
267
				throw new FilterAddException("No se han podido calcular estadisticas. Error al a?adir realce.");
267
				throw new FilterAddException("No se han podido calcular estadisticas. Error al a?adir realce; " + e.getMessage());
268 268
			}
269 269
		} else {
270 270
			filterList.remove(LinearStretchEnhancementFilter.class);
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/properties/panels/BandSelectorPanel.java
309 309
	 * @param mode
310 310
	 */
311 311
	public void resetMode(int mode) {
312
		DefaultTableModel model = getARGBTable().getModel();
312 313
		// Reseteamos los checkbox
313
		for (int i = 0; i < (getARGBTable().getModel().getColumnCount() - 1); i++)
314
			for (int j = 0; j < getARGBTable().getModel().getRowCount(); j++)
315
				((DefaultTableModel) getARGBTable().getModel()).setValueAt(new Boolean(false), j, i);
314
		for (int i = 0; i < (model.getColumnCount() - 1); i++)
315
			for (int j = 0; j < model.getRowCount(); j++)
316
				model.setValueAt(Boolean.FALSE, j, i);
316 317

  
317 318
		// Asignamos los valores
318
		if (this.getNBands() >= 3) {
319
		if (getNBands() >= 1) {
319 320
			switch (mode) {
320
			case 3:
321
				((DefaultTableModel) getARGBTable().getModel()).setValueAt(new Boolean(true), 2, 3);
322
			case 2:
323
				((DefaultTableModel) getARGBTable().getModel()).setValueAt(new Boolean(true), 1, 2);
324
			case 1:
325
				((DefaultTableModel) getARGBTable().getModel()).setValueAt(new Boolean(true), 0, 1);
321
				case 3:
322
					int b = 2;
323
					if (getNBands() < 3)
324
						b = getNBands() - 1;
325
					model.setValueAt(Boolean.TRUE, b, 3);
326
				case 2:
327
					int g = 1;
328
					if (getNBands() == 1)
329
						g = 0;
330
					model.setValueAt(Boolean.TRUE, g, 2);
331
				case 1:
332
					model.setValueAt(Boolean.TRUE, 0, 1);
326 333
			}
327
		} else if (this.getNBands() == 2) {
328
			switch (mode) {
329
			case 3:
330
				((DefaultTableModel) getARGBTable().getModel()).setValueAt(new Boolean(true), 1, 3);
331
			case 2:
332
				((DefaultTableModel) getARGBTable().getModel()).setValueAt(new Boolean(true), 1, 2);
333
			case 1:
334
				((DefaultTableModel) getARGBTable().getModel()).setValueAt(new Boolean(true), 0, 1);
335
			}
336
		} else if (this.getNBands() == 1) {
337
			switch (mode) {
338
			case 3:
339
				((DefaultTableModel) getARGBTable().getModel()).setValueAt(new Boolean(true), 0, 3);
340
			case 2:
341
				((DefaultTableModel) getARGBTable().getModel()).setValueAt(new Boolean(true), 0, 2);
342
			case 1:
343
				((DefaultTableModel) getARGBTable().getModel()).setValueAt(new Boolean(true), 0, 1);
344
			}
345 334
		}
346 335

  
347 336
		col[0] = 0;
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/clipping/ui/listener/ClippingPanelListener.java
64 64
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
65 65
import com.iver.andami.PluginServices;
66 66
import com.iver.andami.Utilities;
67
import com.iver.cit.gvsig.addlayer.fileopen.FileOpenWizard;
68 67
import com.iver.cit.gvsig.exceptions.expansionfile.ExpansionFileReadException;
69 68
import com.iver.cit.gvsig.fmap.layers.FLayer;
70 69
import com.iver.cit.gvsig.fmap.tools.BehaviorException;
......
642 641
			lrx = Double.parseDouble(coordinatesReales.getValue21());
643 642
			uly = Double.parseDouble(coordinatesReales.getValue12());
644 643
			Rectangle2D ext = getClippingPanel().getFLayer().getFullExtent();
645
			if (((int)ulx) > ((int)ext.getMaxX()) || ((int)lrx) < ((int)ext.getMinX())
646
				|| ((int)uly) > ((int)ext.getMaxY()) || ((int)lry) < ((int)ext.getMinY())) {
647
				JOptionPane.showMessageDialog(
648
						(Component) PluginServices.getMainFrame(), PluginServices.getText(
649
								this, "coordenadas_erroneas"));
644
			if (((int) ulx) > ((int) ext.getMaxX()) || ((int) lrx) < ((int) ext.getMinX()) || ((int) uly) > ((int) ext.getMaxY()) || ((int) lry) < ((int) ext.getMinY())) {
645
				JOptionPane.showMessageDialog((Component) PluginServices.getMainFrame(), PluginServices.getText(this, "coordenadas_erroneas"));
650 646
				return;
651 647
			}
652 648
		} catch (NumberFormatException e) {
653
			JOptionPane.showMessageDialog((Component) PluginServices.getMainFrame(),
654
					PluginServices.getText(this, "coordenadas_erroneas"));
649
			JOptionPane.showMessageDialog((Component) PluginServices.getMainFrame(), PluginServices.getText(this, "coordenadas_erroneas"));
655 650
			return;
656 651
		} catch (ExpansionFileReadException e) {
657 652
			Logger.getLogger(getClass().getName()).debug("error en el dibujado", e);
......
691 686
		/**
692 687
		 * Donde se va a guardar el fichero
693 688
		 */
694
		String path = FileOpenWizard.getLastPath();
695
		if (getOptionsPanel().getCbSaveFile().isSelected()) {
696
			path = FileOpenWizard.getLastPath();
697
		} else {
689
		String path;
690
		if (getOptionsPanel().getCbSaveFile().isSelected())
691
			path = getOptionsPanel().getDirectoryTextField().getText();
692
		else
698 693
			path = Utilities.createTempDirectory();
699
		}
700
		
694

  
701 695
		String file = getOptionsPanel().getFilenameTextField().getText();
702
		if(file.compareTo(RasterLibrary.getOnlyLayerName()) == 0) 
696
		if (file.compareTo(RasterLibrary.getOnlyLayerName()) == 0)
703 697
			RasterLibrary.usesOnlyLayerName();
704
		
705
		if (file == "") file = "cutlayer";
706 698

  
699
		if (file == "")
700
			file = "cutlayer";
701

  
707 702
		String filename = path + File.separator + file;
708
		
709
		if(new File(filename + ".tif").exists())
710
			if(!RasterToolsUtil.messageBoxYesOrNot("raster_error_file_exists", getOptionsPanel()))
703

  
704
		if (new File(filename + ".tif").exists())
705
			if (!RasterToolsUtil.messageBoxYesOrNot("raster_error_file_exists", getOptionsPanel()))
711 706
				return;
712 707

  
713 708
		/**
714 709
		 * Preparacion para la generacion del proceso del recorte
715 710
		 */
716
		if(((FLyrRasterSE) getClippingPanel().getFLayer()) == null)
711
		if (((FLyrRasterSE) getClippingPanel().getFLayer()) == null)
717 712
			return;
718 713

  
719 714
		WriterBufferServer dataWriter1 = new WriterBufferServer();
......
721 716
		AffineTransform transf = calcAffineTransform(ulx, uly, lrx, lry, getClippingPanel().getWidthText(), getClippingPanel().getHeightText());
722 717

  
723 718
		int interpMethod = getResolutionPanel().getSelectedInterpolationMethod();
724
		
725
		//Creamos la interpretaci?n de color para el caso de que la salida tenga m?s de una banda por fichero
726
		//Siempre creamos RED, GREEN, BLUE a pi?on fijo
719

  
720
		// Creamos la interpretaci?n de color para el caso de que la salida tenga
721
		// m?s de una banda por fichero. Siempre creamos RED, GREEN y BLUE
727 722
		String[] ci = new String[drawableBands.length];
728 723
		for (int j = 0; j < ci.length; j++) {
729 724
			switch (j) {
730
			case 0: ci[j] = DatasetColorInterpretation.RED_BAND; break;
731
			case 1: ci[j] = DatasetColorInterpretation.GREEN_BAND; break;
732
			case 2: ci[j] = DatasetColorInterpretation.BLUE_BAND; break;
733
			default: ci[j] = DatasetColorInterpretation.UNDEF_BAND; break;
725
				case 0:
726
					if (ci.length >= 3)
727
						ci[j] = DatasetColorInterpretation.RED_BAND;
728
					else
729
						ci[j] = DatasetColorInterpretation.GRAY_BAND;
730
					break;
731
				case 1:
732
					if (ci.length >= 3)
733
						ci[j] = DatasetColorInterpretation.GREEN_BAND;
734
					else
735
						ci[j] = DatasetColorInterpretation.UNDEF_BAND;
736
					break;
737
				case 2:
738
					ci[j] = DatasetColorInterpretation.BLUE_BAND;
739
					break;
740
				default:
741
					ci[j] = DatasetColorInterpretation.UNDEF_BAND;
742
					break;
734 743
			}
735 744
		}
736
		
745

  
737 746
		RasterProcess clippingProcess = new ClippingProcess();
738 747
		clippingProcess.setActions(this);
739 748
		clippingProcess.addParam("viewname", getClippingPanel().getViewName());
trunk/extensions/extRasterTools-SE/src/org/gvsig/raster/util/process/FilterProcess.java
78 78
	 * 
79 79
	 * @param geoRasterWriter
80 80
	 */
81
	private DatasetColorInterpretation getColorIntepretation(GeoRasterWriter geoRasterWriter, IBuffer buffer, Grid grid) {
81
	private DatasetColorInterpretation getColorIntepretation(IBuffer buffer, Grid grid) {
82 82
		
83 83
		DatasetColorInterpretation colorInterpretation = null;
84 84
		
......
166 166
				geoRasterWriter = GeoRasterWriter.getWriter(writerBufferServer, filename, buffer.getBandCount(), rasterDataSource.getAffineTransform(), buffer.getWidth(), buffer.getHeight(), buffer.getDataType(), GeoRasterWriter.getWriter(filename).getParams(), null);
167 167
			
168 168
			//Asignamos la interpretaci?n de color al escritor
169
			DatasetColorInterpretation colorInterpretation = getColorIntepretation(geoRasterWriter, buffer, grid);
169
			DatasetColorInterpretation colorInterpretation = getColorIntepretation(buffer, grid);
170 170
			if (transparency.isTransparencyActive()) {
171 171
				DatasetColorInterpretation alphaI;
172 172
				alphaI = new DatasetColorInterpretation(new String[] { DatasetColorInterpretation.ALPHA_BAND });

Also available in: Unified diff