Revision 22475

View differences:

trunk/extensions/extRasterTools-SE/src/org/gvsig/raster/util/process/ClippingProcess.java
39 39
import org.gvsig.raster.dataset.RasterDataset;
40 40
import org.gvsig.raster.dataset.io.RasterDriverException;
41 41
import org.gvsig.raster.dataset.properties.DatasetColorInterpretation;
42
import org.gvsig.raster.dataset.serializer.RmfSerializerException;
42 43
import org.gvsig.raster.datastruct.ColorTable;
43 44
import org.gvsig.raster.datastruct.NoData;
44 45
import org.gvsig.raster.grid.GridPalette;
......
147 148

  
148 149
		// Guardamos en el RMF el valor NoData
149 150
		if (Configuration.getValue("nodata_transparency_enabled", Boolean.FALSE).booleanValue()) {
150
			RasterDataset.saveObjectToRmfFile(fileName, NoData.class, new NoData(rasterSE.getNoDataValue(), rasterSE.getNoDataType(), rasterSE.getDataType()[0]));
151
			try {
152
				RasterDataset.saveObjectToRmfFile(fileName, NoData.class, new NoData(rasterSE.getNoDataValue(), rasterSE.getNoDataType(), rasterSE.getDataType()[0]));
153
			} catch (RmfSerializerException e) {
154
				RasterToolsUtil.messageBoxError("error_salvando_rmf", this, e);
155
			}
151 156
		}
152 157

  
153 158
		// Guardamos en el RMF la tabla de color
154 159
		ColorTableFilter colorTableFilter = (ColorTableFilter) rasterFilterList.getByName(ColorTableFilter.names[0]);
155 160
		if (colorTableFilter != null) {
156 161
			GridPalette gridPalette = new GridPalette((ColorTable) colorTableFilter.getColorTable().clone());
157
			RasterDataset.saveObjectToRmfFile(fileName, ColorTable.class, (ColorTable) gridPalette);
162
			try {
163
				RasterDataset.saveObjectToRmfFile(fileName, ColorTable.class, (ColorTable) gridPalette);
164
			} catch (RmfSerializerException e) {
165
				RasterToolsUtil.messageBoxError("error_salvando_rmf", this, e);
166
			}
158 167
		}
159 168
	}
160 169

  
trunk/extensions/extRasterTools-SE/src/org/gvsig/raster/util/process/FilterProcess.java
36 36
import org.gvsig.raster.dataset.RasterDataset;
37 37
import org.gvsig.raster.dataset.io.RasterDriverException;
38 38
import org.gvsig.raster.dataset.properties.DatasetColorInterpretation;
39
import org.gvsig.raster.dataset.serializer.RmfSerializerException;
39 40
import org.gvsig.raster.datastruct.NoData;
40 41
import org.gvsig.raster.datastruct.Transparency;
41 42
import org.gvsig.raster.grid.Grid;
......
216 217
			
217 218
			// Guardamos en el RMF del fichero el valor NoData
218 219
			if (Configuration.getValue("nodata_transparency_enabled", Boolean.FALSE).booleanValue()) {
219
				RasterDataset.saveObjectToRmfFile(filename, NoData.class, new NoData(rasterDataSource.getNoDataValue(), rasterDataSource.isNoDataEnabled()?2:0, rasterDataSource.getDataType()[0]));
220
				try {
221
					RasterDataset.saveObjectToRmfFile(filename, NoData.class, new NoData(rasterDataSource.getNoDataValue(), rasterDataSource.isNoDataEnabled()?2:0, rasterDataSource.getDataType()[0]));
222
				} catch (RmfSerializerException e) {
223
					RasterToolsUtil.messageBoxError(PluginServices.getText(this,"error_salvando_rmf"), this, e);
224
				}
220 225
			}
221 226
			
222 227
			SwingUtilities.invokeLater(new Runnable() {
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/colortable/ui/ColorTablePanel.java
32 32
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelListener;
33 33
import org.gvsig.raster.beans.previewbase.PreviewBasePanel;
34 34
import org.gvsig.raster.dataset.RasterDataset;
35
import org.gvsig.raster.dataset.serializer.RmfSerializerException;
35 36
import org.gvsig.raster.datastruct.ColorTable;
36 37
import org.gvsig.raster.grid.GridPalette;
37 38
import org.gvsig.raster.grid.GridTransparency;
......
215 216
	 */
216 217
	private void saveColorTable() {
217 218
		RasterDataset dataset = ((FLyrRasterSE) getLayer()).getDataSource().getDataset(0)[0];
218
		if (getColorTableData().isEnabled())
219
			dataset.saveObjectToRmf(ColorTable.class, getColorTableData().getColorTable());
220
		else
221
			dataset.saveObjectToRmf(ColorTable.class, null);
219
		try {
220
			if (getColorTableData().isEnabled())
221
				dataset.saveObjectToRmf(ColorTable.class, getColorTableData().getColorTable());
222
			else
223
				dataset.saveObjectToRmf(ColorTable.class, null);
224
		} catch (RmfSerializerException e) {
225
			RasterToolsUtil.messageBoxError("error_salvando_rmf", this, e);
226
		}
222 227
	}
223 228

  
224 229
	/**
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/properties/control/BandSelectorListener.java
33 33
import org.gvsig.raster.dataset.RasterDataset;
34 34
import org.gvsig.raster.dataset.io.RasterDriverException;
35 35
import org.gvsig.raster.dataset.properties.DatasetColorInterpretation;
36
import org.gvsig.raster.dataset.serializer.RmfSerializerException;
36 37
import org.gvsig.raster.datastruct.Extent;
37 38
import org.gvsig.raster.datastruct.Transparency;
38 39
import org.gvsig.raster.grid.GridTransparency;
......
188 189
					for (int iBand = 0; iBand < bandSetupPanel.getARGBTable().getRowCount(); iBand++)
189 190
						ci.setColorInterpValue(iBand, bandSetupPanel.getColorInterpretationByBand(iBand));
190 191
				}
191
				
192 192
				((FLyrRasterSE) fLayer).getDataSource().getDataset(0)[0].saveObjectToRmf(DatasetColorInterpretation.class, ci);
193
			} catch (RmfSerializerException exc) {
194
				RasterToolsUtil.messageBoxError("error_salvando_rmf", bandSetupPanel, exc);
193 195
			} catch (NotInitializeException exc) {
194
				RasterToolsUtil.messageBoxError("table_not_initialize", bandSetupPanel);
196
				RasterToolsUtil.messageBoxError("table_not_initialize", bandSetupPanel, exc);
195 197
			}
196 198
		}
197 199
		
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/properties/panels/NoDataPanel.java
39 39

  
40 40
import org.gvsig.fmap.raster.layers.FLyrRasterSE;
41 41
import org.gvsig.raster.ConfigurationEvent;
42
import org.gvsig.raster.dataset.RasterDataset;
42
import org.gvsig.raster.dataset.IRasterDataSource;
43
import org.gvsig.raster.dataset.serializer.RmfSerializerException;
43 44
import org.gvsig.raster.datastruct.NoData;
44 45
import org.gvsig.raster.hierarchy.IRasterProperties;
45 46
import org.gvsig.raster.util.BasePanel;
47
import org.gvsig.raster.util.RasterToolsUtil;
48

  
49
import com.iver.andami.PluginServices;
46 50
/**
47 51
 * Panel para la gestion del valor NoData en el panel de propiedades
48 52
 *
......
214 218
	 */
215 219
	private void saveToRmf() {
216 220
		if (JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(this, getText(this, "nodata_modificado_continuar"))) {
217
			RasterDataset dataset = ((FLyrRasterSE) layer).getDataSource().getDataset(0)[0];
218
			dataset.saveObjectToRmf(NoData.class, new NoData(getNoDataValue(), getComboSetupIndex(), layer.getDataType()[0]));
221
			IRasterDataSource datasource = ((FLyrRasterSE) layer).getDataSource();
222
			try {
223
				datasource.saveObjectToRmf(0, NoData.class, new NoData(getNoDataValue(), getComboSetupIndex(), layer.getDataType()[0]));
224
			} catch (RmfSerializerException e) {
225
				RasterToolsUtil.messageBoxError(PluginServices.getText(this,"error_salvando_rmf"), this, e);
226
			}
219 227
		}
220 228
	}
221 229
}
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/properties/panels/GeneralPanel.java
46 46
import org.gvsig.raster.IProcessActions;
47 47
import org.gvsig.raster.RasterProcess;
48 48
import org.gvsig.raster.dataset.properties.DatasetStatistics;
49
import org.gvsig.raster.dataset.serializer.RmfSerializerException;
49 50
import org.gvsig.raster.grid.GridTransparency;
50 51
import org.gvsig.raster.hierarchy.IRasterProperties;
51 52
import org.gvsig.raster.util.RasterToolsUtil;
......
483 484
	private void refreshHTMLStatistics() {
484 485
		String html = "";
485 486
		DatasetStatistics statistics = ((FLyrRasterSE) fLayer).getDataSource().getStatistics();
486
		((FLyrRasterSE) fLayer).getDataSource().getDataset(0)[0].loadObjectFromRmf(DatasetStatistics.class, statistics);
487
		try {
488
			((FLyrRasterSE) fLayer).getDataSource().loadObjectFromRmf(DatasetStatistics.class, statistics);
489
		} catch (RmfSerializerException e) {
490
			// Si no las consigue cargar no las mostrar?
491
		}
487 492

  
488 493
		if (statistics.isCalculated()) {
489 494
			double[] maxRGB = statistics.getMaxRGB();
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/geolocation/listener/GeoLocationPanelListener.java
35 35

  
36 36
import org.gvsig.fmap.raster.layers.FLyrRasterSE;
37 37
import org.gvsig.gui.beans.datainput.DataInputContainerListener;
38
import org.gvsig.raster.dataset.serializer.RmfSerializerException;
38 39
import org.gvsig.raster.datastruct.Extent;
39 40
import org.gvsig.raster.util.ExtendedFileFilter;
40 41
import org.gvsig.raster.util.Historical;
......
75 76
				try {
76 77
					panel.getLayer().saveGeoToRmf();
77 78
					panel.activeButtons();
78
				} catch (IOException e1) {
79
				} catch (RmfSerializerException e1) {
79 80
					RasterToolsUtil.messageBoxError(PluginServices.getText(this,"error_salvando_rmf"), panel, e1);
80 81
				}
81 82
				panel.setModify(false);
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/geolocation/ui/GeoLocationDialog.java
21 21
import java.awt.BorderLayout;
22 22
import java.awt.Dimension;
23 23
import java.awt.geom.AffineTransform;
24
import java.io.IOException;
25 24

  
26 25
import javax.swing.JPanel;
27 26

  
28 27
import org.gvsig.fmap.raster.layers.FLyrRasterSE;
28
import org.gvsig.raster.dataset.serializer.RmfSerializerException;
29 29
import org.gvsig.raster.util.RasterToolsUtil;
30 30
import org.gvsig.rastertools.geolocation.behavior.ITransformIO;
31 31

  
......
50 50
	private GeoLocationPanel  geolocationPanel = null;
51 51

  
52 52
	/**
53
   * Posici?n de la ventana en X y en Y
54
   */
53
	 * Posici?n de la ventana en X y en Y
54
	 */
55 55
	private int               posWindowX       = 0;
56 56
	private int               posWindowY       = 0;
57 57

  
......
211 211
			if(RasterToolsUtil.messageBoxYesOrNot(PluginServices.getText(this,"aviso_salir_salvando"), geolocationPanel)) {
212 212
				try {
213 213
					geolocationPanel.getLayer().saveGeoToRmf();
214
				} catch (IOException e1) {
215
					RasterToolsUtil.messageBoxError(PluginServices.getText(this,"error_salvando_rmf"), geolocationPanel);
214
				} catch (RmfSerializerException e1) {
215
					RasterToolsUtil.messageBoxError(PluginServices.getText(this,"error_salvando_rmf"), geolocationPanel, e1);
216 216
				}
217 217
			}
218 218
			geolocationPanel.setModify(false);
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/geolocation/ui/GeoLocationOpeningRasterDialog.java
20 20

  
21 21
import java.awt.BorderLayout;
22 22
import java.awt.geom.AffineTransform;
23
import java.io.IOException;
24 23

  
25 24
import javax.swing.JPanel;
26 25

  
27 26
import org.gvsig.fmap.raster.layers.FLyrRasterSE;
27
import org.gvsig.raster.dataset.serializer.RmfSerializerException;
28 28
import org.gvsig.raster.util.RasterToolsUtil;
29 29
import org.gvsig.rastertools.geolocation.behavior.ITransformIO;
30 30

  
......
153 153
			if(RasterToolsUtil.messageBoxYesOrNot(PluginServices.getText(this,"aviso_salir_salvando"), geolocationPanel)) {
154 154
				try {
155 155
					geolocationPanel.getLayer().saveGeoToRmf();
156
				} catch (IOException e1) {
157
					RasterToolsUtil.messageBoxError(PluginServices.getText(this,"error_salvando_rmf"), geolocationPanel);
156
				} catch (RmfSerializerException e1) {
157
					RasterToolsUtil.messageBoxError(PluginServices.getText(this,"error_salvando_rmf"), geolocationPanel, e1);
158 158
				}
159 159
			}
160 160
			geolocationPanel.setModify(false);
trunk/extensions/extRasterTools-SE/src/org/gvsig/fmap/raster/layers/FLyrRasterSE.java
54 54
import org.gvsig.raster.dataset.io.RasterDriverException;
55 55
import org.gvsig.raster.dataset.properties.DatasetColorInterpretation;
56 56
import org.gvsig.raster.dataset.properties.DatasetMetadata;
57
import org.gvsig.raster.dataset.serializer.RmfSerializerException;
57 58
import org.gvsig.raster.datastruct.ColorTable;
58 59
import org.gvsig.raster.datastruct.Extent;
59 60
import org.gvsig.raster.datastruct.ViewPortData;
......
1062 1063
		// Salva a RMF
1063 1064
		if (this.getDataSource() != null) {
1064 1065
			// Guardamos la GeoReferenciacion de cada dataset
1065
			for (int i = 0; i < getDataSource().getDatasetCount(); i++)
1066
				getDataSource().getDataset(i)[0].saveObjectToRmf(RasterDataset.class, getDataSource().getDataset(i)[0]);
1066
			try {
1067
				for (int i = 0; i < getDataSource().getDatasetCount(); i++) {
1068
					getDataSource().saveObjectToRmf(i, RasterDataset.class, getDataSource().getDataset(i)[0]);
1069
				}
1070
			} catch (RmfSerializerException e) {
1071
				RasterToolsUtil.messageBoxError("error_salvando_rmf", this, e);
1072
			}
1067 1073
		}
1068 1074

  
1069 1075
		if (this.isRemoveRasterFlag()) {
......
1618 1624
	/**
1619 1625
	 * Salva la georreferenciaci?n a fichero rmf.
1620 1626
	 * @param fName
1621
	 * @throws IOException
1627
	 * @throws RmfSerializerException 
1622 1628
	 */
1623
	public void saveGeoToRmf() throws IOException {
1629
	public void saveGeoToRmf() throws RmfSerializerException {
1624 1630
		if (!isOpen())
1625 1631
			return;
1626 1632

  
1627 1633
		// Guardamos la GeoReferenciacion de cada dataset
1628 1634
		for (int i = 0; i < getDataSource().getDatasetCount(); i++)
1629
			getDataSource().getDataset(i)[0].saveObjectToRmf(RasterDataset.class, getDataSource().getDataset(i)[0]);
1635
			getDataSource().saveObjectToRmf(i, RasterDataset.class, getDataSource().getDataset(i)[0]);
1630 1636
		
1631 1637
		affineTransformList.clear();
1632 1638
		affineTransformList.add(this.getAffineTransform());

Also available in: Unified diff