Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/overview/GdalOverviewBuilder.java
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/overview/GdalOverviewBuilder.java	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/overview/GdalOverviewBuilder.java	(revision 9865)
@@ -0,0 +1,100 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.raster.gdal.overview;
+
+import org.gvsig.addo.BuildingOverviewsException;
+import org.gvsig.addo.IOverviewIncrement;
+import org.gvsig.addo.Jaddo;
+import org.gvsig.addo.WritingException;
+import org.gvsig.fmap.dal.coverage.exception.OverviewException;
+import org.gvsig.fmap.dal.coverage.process.BaseIncrementableTask;
+import org.gvsig.fmap.dal.coverage.process.overview.OverviewBuilder;
+
+/**
+ * Servicios ofrecidos por el proceso de construcci�n de overviews. Esta
+ * implementaci�n usa gdal para construir las overviews.
+ * 
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ */
+public class GdalOverviewBuilder implements OverviewBuilder {
+	private Jaddo        build         = new Jaddo();
+	private int          value         = 0;
+
+	/**
+	 * Bindings between an IOverviewIncrement and a BaseIncrementableTask
+	 * @author Nacho Brodin (nachobrodin@gmail.com)
+	 */
+	class ProcessBinding implements IOverviewIncrement {
+		private BaseIncrementableTask  task = null;
+		
+		public ProcessBinding(BaseIncrementableTask task) {
+			this.task = task;	
+		}
+		
+		public int getPercent() {
+			return task.getPercent();
+		}
+
+		public void setPercent(int value) {
+			task.setPercent(value);
+		}
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.coverage.process.overview.OverviewBuilder#buildOverviews(int, java.lang.String, int[])
+	 */
+	public void buildOverviews(int resamplingAlg, String file, int[] overviews)
+			throws OverviewException {
+		try {
+			build.buildOverviews(resamplingAlg, file, overviews);
+		} catch (BuildingOverviewsException e) {
+			throw new OverviewException("Error building overviews", e);
+		} catch (WritingException e) {
+			throw new OverviewException("Error writing overviews", e);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.coverage.process.overview.OverviewBuilder#getPercent()
+	 */
+	public int getPercent() {
+		return value;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.coverage.process.overview.OverviewBuilder#setIncrementListener(org.gvsig.addo.IOverviewIncrement)
+	 */
+	public void setIncrementListener(BaseIncrementableTask incr) {
+		build.setIncrementListener(new ProcessBinding(incr));
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.coverage.process.overview.OverviewBuilder#setPercent(int)
+	 */
+	public void setPercent(int value) {
+		this.value = value;
+	}
+}

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/overview/GdalOverviewBuilder.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/GdalNewRasterStoreParameters.java
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/GdalNewRasterStoreParameters.java	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/GdalNewRasterStoreParameters.java	(revision 9865)
@@ -0,0 +1,40 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+package org.gvsig.raster.gdal.io;
+
+import org.gvsig.raster.impl.store.AbstractNewRasterStoreParameters;
+
+/**
+ * Parameters for creating a Gdal store
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ */
+public class GdalNewRasterStoreParameters extends AbstractNewRasterStoreParameters {
+
+	public String getDataStoreName() {
+		return GdalProvider.NAME;
+	}
+
+	public String getDescription() {
+		return GdalProvider.DESCRIPTION;
+	}
+
+}

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/GdalNewRasterStoreParameters.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/GdalFilesystemServerExplorer.java
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/GdalFilesystemServerExplorer.java	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/GdalFilesystemServerExplorer.java	(revision 9865)
@@ -0,0 +1,192 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 IVER T.I   {{Task}}
+*/
+
+package org.gvsig.raster.gdal.io;
+
+import java.awt.geom.AffineTransform;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.DataManager;
+import org.gvsig.fmap.dal.DataServerExplorer;
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.NewDataStoreParameters;
+import org.gvsig.fmap.dal.coverage.RasterLocator;
+import org.gvsig.fmap.dal.coverage.datastruct.Params;
+import org.gvsig.fmap.dal.coverage.exception.NotSupportedExtensionException;
+import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException;
+import org.gvsig.fmap.dal.coverage.exception.RasterDriverException;
+import org.gvsig.fmap.dal.coverage.store.DataServerWriter;
+import org.gvsig.fmap.dal.coverage.store.RasterWriter;
+import org.gvsig.fmap.dal.coverage.store.parameter.NewRasterStoreParameters;
+import org.gvsig.fmap.dal.exception.CreateException;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.RemoveException;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.impl.AbstractFilesystemServerExplorerProvider;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProviderServices;
+import org.gvsig.raster.impl.store.AbstractRasterFileDataParameters;
+import org.gvsig.tools.locator.LocatorException;
+
+public class GdalFilesystemServerExplorer extends AbstractFilesystemServerExplorerProvider {
+	
+	public boolean canCreate() {
+		return false;
+	}
+
+	public boolean canCreate(NewDataStoreParameters parameters) {
+		return false;
+	}
+
+	public void create(NewDataStoreParameters parameters, boolean overwrite)
+			throws CreateException {
+		NewRasterStoreParameters p = null;
+		if(parameters instanceof NewRasterStoreParameters)
+			 p = (NewRasterStoreParameters)parameters;
+		
+		DataServerWriter dataWriter = p.getDataServer();
+		if(dataWriter == null)
+			dataWriter = RasterLocator.getManager().createDataServerWriter();
+		
+		dataWriter.setBuffer(p.getBuffer(), p.getBand());
+		Params params;
+		try {
+			if(p.getDriverParams() != null)
+				params = p.getDriverParams();
+			else
+				params = RasterLocator.getManager().createWriter(p.getFileName()).getParams();
+			
+			AffineTransform affineTransform = p.getAffineTransform();
+			if(affineTransform == null) {
+				if(p.getBuffer().getDataExtent() != null) {
+					double x = p.getBuffer().getDataExtent().getMinX();
+					double y = p.getBuffer().getDataExtent().getMaxY();
+					double pixelSizeX = p.getBuffer().getDataExtent().getWidth() / p.getBuffer().getWidth();
+					double pixelSizeY = p.getBuffer().getDataExtent().getHeight() / p.getBuffer().getHeight();
+					affineTransform = new AffineTransform(pixelSizeX, 0, 0, -pixelSizeY, x, y);
+				} else {
+					affineTransform = new AffineTransform();
+				}
+			}
+			
+			RasterWriter writer = RasterLocator.getManager().createWriter(
+					dataWriter, 
+					p.getPath() + File.separator + p.getFileName(),
+					p.getBand() < 0 ? p.getBuffer().getBandCount() : 1, 
+					affineTransform, 
+					p.getBuffer().getWidth(),
+					p.getBuffer().getHeight(), 
+					p.getBuffer().getDataType(), 
+					params, 
+					null);
+			if(p.getColorInterpretation() != null)
+				writer.setColorBandsInterpretation(p.getColorInterpretation());
+			writer.setWkt(p.getWktProjection());
+			
+			writer.dataWrite();
+			writer.writeClose();
+		} catch (LocatorException e) {
+			throw new CreateException("", e);
+		} catch (NotSupportedExtensionException e) {
+			throw new CreateException("", e);
+		} catch (RasterDriverException e) {
+			throw new CreateException("", e);
+		} catch (ProcessInterruptedException e) {
+			//Fin del proceso
+		} catch (IOException e) {
+			throw new CreateException("", e);
+		}
+	}
+
+	public NewDataStoreParameters getCreateParameters() throws DataException {
+		return new GdalNewRasterStoreParameters();
+	}
+
+	public void initialize(FilesystemServerExplorerProviderServices serverExplorer) {
+	}
+	
+	public void remove(DataStoreParameters parameters) throws RemoveException {
+		throw new UnsupportedOperationException();
+	}
+
+	public String getDataStoreProviderName() {
+		return GdalProvider.NAME;
+	}
+
+	public boolean accept(File pathname) {
+		if (pathname.getParentFile() != null && 
+			pathname.getParentFile().getName().equals("cellhd")) {
+			if (pathname.getName().endsWith(".rmf")
+					|| pathname.getName().endsWith(".rmf~")) {
+				return false;
+			}
+			return true;
+		}
+
+		// Comprobamos que no sea un rmf propio, osea, que contenga xml
+		if (pathname.getName().toLowerCase().endsWith(".rmf")) {
+			FileInputStream reader = null;
+			try {
+				reader = new FileInputStream(pathname);
+				String xml = "";
+				for (int i = 0; i < 6; i++) {
+					xml += (char) reader.read();
+				}
+				if (xml.equals("<?xml ")) {
+					return false;
+				}
+			} catch (Exception e) {
+			} finally {
+				try {
+					reader.close();
+				} catch (Exception e) {
+				}
+			}
+		}
+		return RasterLocator.getManager().getProviderServices().isExtensionSupported(
+				pathname.getAbsolutePath(), 
+				GdalProvider.class);
+	}
+
+	public String getDescription() {
+		return GdalProvider.DESCRIPTION;
+	}
+
+	public DataStoreParameters getParameters(File file) throws DataException {
+		DataManager manager = DALLocator.getDataManager();
+		AbstractRasterFileDataParameters params = (AbstractRasterFileDataParameters) manager
+				.createStoreParameters(this.getDataStoreProviderName());
+		params.setFile(file);
+		return params;
+	}
+	
+	public int getMode() {
+		return DataServerExplorer.MODE_RASTER;
+	}
+
+}

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/GdalFilesystemServerExplorer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/GdalWriter.java
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/GdalWriter.java	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/GdalWriter.java	(revision 9865)
@@ -0,0 +1,799 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.raster.gdal.io;
+
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Point2D;
+import java.io.File;
+import java.io.IOException;
+import java.sql.Savepoint;
+import java.util.ArrayList;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.FilenameUtils;
+import org.cresques.cts.ICRSFactory;
+import org.cresques.cts.IProjection;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.gvsig.fmap.dal.coverage.RasterLibrary;
+import org.gvsig.fmap.dal.coverage.RasterLocator;
+import org.gvsig.fmap.dal.coverage.dataset.Buffer;
+import org.gvsig.fmap.dal.coverage.datastruct.Params;
+import org.gvsig.fmap.dal.coverage.exception.NotSupportedExtensionException;
+import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException;
+import org.gvsig.fmap.dal.coverage.exception.RmfSerializerException;
+import org.gvsig.fmap.dal.coverage.store.DataServerWriter;
+import org.gvsig.jgdal.GdalBuffer;
+import org.gvsig.jgdal.GdalDataset;
+import org.gvsig.jgdal.GdalDriver;
+import org.gvsig.jgdal.GdalException;
+import org.gvsig.jgdal.GdalRasterBand;
+import org.gvsig.jgdal.GeoTransform;
+import org.gvsig.raster.gdal.io.features.BMPFeatures;
+import org.gvsig.raster.gdal.io.features.GTiffFeatures;
+import org.gvsig.raster.gdal.io.features.HFAFeatures;
+import org.gvsig.raster.gdal.io.features.IDRISIFeatures;
+import org.gvsig.raster.gdal.io.features.ILWIS_MprFeatures;
+import org.gvsig.raster.gdal.io.features.Jpeg2000Features;
+import org.gvsig.raster.gdal.io.features.PNM_PgmFeatures;
+import org.gvsig.raster.gdal.io.features.PNM_PpmFeatures;
+import org.gvsig.raster.impl.buffer.DefaultDataServerWriter;
+import org.gvsig.raster.impl.buffer.RasterBuffer;
+import org.gvsig.raster.impl.process.RasterTask;
+import org.gvsig.raster.impl.process.RasterTaskQueue;
+import org.gvsig.raster.impl.store.ParamImpl;
+import org.gvsig.raster.impl.store.ParamsImpl;
+import org.gvsig.raster.impl.store.WriteFileFormatFeatures;
+import org.gvsig.raster.impl.store.properties.DataStoreColorInterpretation;
+import org.gvsig.raster.impl.store.writer.DefaultRasterWriter;
+import org.gvsig.raster.util.DefaultProviderServices;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.extensionpoint.ExtensionPoint;
+import org.gvsig.tools.extensionpoint.ExtensionPointManager;
+
+
+/**
+ * Driver para la escritura a trav�s de Gdal.
+ * Puede exportar un fichero de un formato a otro desde un GeoRasterFile
+ * en cualquier formato soportado por la lectura a un formato que este incluido
+ * en la lista supportedDrv.
+ *
+ * Puede salvar a disco en un formato que este incluido en la lista supportedDrv
+ * obteniendo los datos que van siendo servidos desde el cliente. Este cliente
+ * debe implementar un DataServerWriter o tener un objeto que lo implemente. Inicialmente
+ * le pasar� los par�metros de la imagen de salida y cuando el driver comience a
+ * escribir le ir� solicitando m�s a trav�s del m�todo readData de DataServerWriter.
+ * El cliente ser� el que lleve el control de lo que va sirviendo y lo que le queda
+ * por servir.
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ */
+public class GdalWriter extends DefaultRasterWriter {
+
+    private static final Logger logger = LoggerFactory.getLogger(GdalWriter.class);
+
+	/**
+	 *
+	 */
+	public static void register() {
+		DefaultProviderServices pInfo = (DefaultProviderServices)RasterLocator.getManager().getProviderServices();
+		ExtensionPointManager extensionPoints = ToolsLocator.getExtensionPointManager();
+		ExtensionPoint point = extensionPoints.get("RasterWriter");
+
+		point.append("tif", "", GdalWriter.class);
+		pInfo.getFileFeature().put("tif", new GTiffFeatures());
+
+		point.append("img", "", GdalWriter.class);
+		pInfo.getFileFeature().put("img", new HFAFeatures());
+
+		point.append("bmp", "", GdalWriter.class);
+		pInfo.getFileFeature().put("bmp", new BMPFeatures());
+
+		point.append("pgm", "", GdalWriter.class);
+		pInfo.getFileFeature().put("pgm", new PNM_PgmFeatures());
+
+		point.append("ppm", "", GdalWriter.class);
+		pInfo.getFileFeature().put("ppm", new PNM_PpmFeatures());
+
+		point.append("mpl", "", GdalWriter.class);
+		pInfo.getFileFeature().put("mpl", new ILWIS_MprFeatures());
+
+		point.append("rst", "", GdalWriter.class);
+		pInfo.getFileFeature().put("rst", new IDRISIFeatures());
+
+		point.append("jp2", "", GdalWriter.class);
+		pInfo.getFileFeature().put("jp2", new Jpeg2000Features());
+
+		//La exportaci�n no es correcta del todo
+//		point.append("rmf", "", GdalWriter.class);
+//		pInfo.getFileFeature().put("rmf", new RMFFeatures());
+
+		//No salva datos. Siempre sale negra la imagen
+		//point.register("aux", GdalWriter.class);
+		//fileFeature.put("aux", new PAuxFeatures());
+	}
+
+	private GdalDriver	                 	drv;
+	private GdalDataset 							dstDataset = null;
+	private GdalRasterBand 					rband = null;
+	private GeoTransform 					geot = null; //Datos de georeferenciaci�n
+	//private OGRSpatialReference 			oSRS; //Datos de proyecci�n
+	private GdalBuffer[]					bufBands = null;
+	private int 							nBlocks = 0; //N�mero de bloques en Y en el que se divide la imagen para escribir
+	private int 							anchoResto = 0; //Tama�o del �ltimo bloque de la imagen.
+	private boolean							write = true; //Cuando est� a true se puede escribir en la imagen de salida. Si est� a false el proceso es interrumpido
+	private int 							dataType = RasterBuffer.TYPE_UNDEFINED;
+
+	/**
+	 * Carga los par�metros de este driver.
+	 * @param ident
+	 */
+	public void loadParams(String ident) {
+		WriteFileFormatFeatures wfff = (WriteFileFormatFeatures)pInfo.getFileFeature().get(ident);
+		wfff.loadParams();
+		driverParams = (ParamsImpl)wfff.getParams();
+	}
+
+	public String getProviderName() {
+		return GdalProvider.NAME;
+	}
+
+	/**
+	 * Constructor para la obtenci�n de par�metros del driver
+	 * @param fileName
+	 */
+	public GdalWriter(String fileName) {
+		ident = fileUtil.getExtensionFromFileName(fileName);
+		driver = ((WriteFileFormatFeatures)pInfo.getFileFeature().get(ident)).getDriverName();
+
+		loadParams(ident);
+	}
+
+	/**
+	 * Constructor para salvar datos servidos por el cliente
+	 * @param dataWriter       	Objeto servidor de datos para el driver de escritura
+	 * @param outFileName      	Fichero de salida
+	 * @param nBands            N�mero de bandas
+	 * @param at                Transformaci�n afin
+	 * @param outSizeX		  	Tama�o de salida en X
+	 * @param outSizeY			Tama�o de salida en Y
+	 * @param dataType			Tipo de dato
+	 * @param params
+	 * @param proj
+	 * @throws GdalException
+	 * @throws IOException
+	 */
+	public GdalWriter(	DataServerWriter dataWriter,
+			String outFileName,
+			Integer nBands,
+			AffineTransform at,
+			Integer outSizeX,
+			Integer outSizeY,
+			Integer dataType,
+			Params params,
+			IProjection proj) throws GdalException, IOException {
+		this(dataWriter, outFileName, nBands, at, outSizeX, outSizeY, dataType, params, proj, new Boolean(true));
+	}
+
+	/**
+	 * Constructor para salvar datos servidos por el cliente
+	 * @param dataWriter       	Objeto servidor de datos para el driver de escritura
+	 * @param outFileName
+	 * @param nBands
+	 * @param at
+	 * @param outFilename      	Fichero de salida
+	 * @param outSizeX		  	Tama�o de salida en X
+	 * @param outSizeY			Tama�o de salida en Y
+	 * @param dataType			Tipo de dato
+	 * @param params
+	 * @param proj
+	 * @param geo				Flag que dice si se salva con georreferenciaci�n o sin ella
+	 * @throws GdalException
+	 * @throws IOException
+	 */
+	public GdalWriter(	DataServerWriter dataWriter,
+			String outFileName,
+			Integer nBands,
+			AffineTransform at,
+			Integer outSizeX,
+			Integer outSizeY,
+			Integer dataType,
+			Params params,
+			IProjection proj,
+			Boolean geo)throws GdalException, IOException {
+
+		this.proj = proj;
+		ident = outFileName.toLowerCase().substring(outFileName.lastIndexOf(".") + 1);
+		driver = ((WriteFileFormatFeatures)pInfo.getFileFeature().get(ident)).getDriverName();
+		this.dataType = dataType.intValue();
+		this.at = at;
+		percent = 0;
+
+		this.dataWriter = dataWriter;
+		this.outFileName = outFileName;
+
+		this.sizeWindowX = outSizeX.intValue();
+		this.sizeWindowY = outSizeY.intValue();
+
+		if ((sizeWindowX < 0) || (sizeWindowY < 0))
+			throw new IOException("Tama�o del fichero de salida erroneo.");
+
+		this.nBands = nBands.intValue();
+
+		//Calculamos la georeferenciaci�n a partir del extend pasado por el cliente.
+
+		geot = new GeoTransform();
+		geot.adfgeotransform[0] = at.getTranslateX();
+		geot.adfgeotransform[3] = at.getTranslateY();
+		geot.adfgeotransform[1] = at.getScaleX();
+		geot.adfgeotransform[5] = at.getScaleY();
+		geot.adfgeotransform[2] = at.getShearX();
+		geot.adfgeotransform[4] = at.getShearY();
+
+		String outRmf = outFileName.substring(0, outFileName.lastIndexOf("."));
+		if(geo.booleanValue())
+			rasterUtil.saveGeoInfo(outRmf, at, new Point2D.Double(sizeWindowX, sizeWindowY));
+
+		if(params == null)
+			loadParams(ident);
+		else
+			if(params instanceof ParamsImpl)
+				this.driverParams = (ParamsImpl)params;
+
+		init();
+	}
+
+	/**
+	 * A�ade la proyecci�n Wkt con la que salvar.
+	 * @param wkt
+	 * @throws GdalException
+	 */
+	public void setWkt(String wkt) {
+		if(dstDataset != null && wkt != null && wkt.compareTo("unknown") != 0)
+			try {
+				dstDataset.setProjection(wkt);
+			} catch (GdalException e) {
+				System.err.println("Proyecci�n Wkt no asignada en GdalWriter");
+				return;
+			}
+	}
+
+	/**
+	 * Asigna el tipo de driver con el que se salvar� la imagen
+	 * @param drvType        Tipo de driver
+	 */
+	public void setDriverType(String drvType) {
+		this.driver = drvType;
+	}
+
+	/**
+	 * Creaci�n del dataset de destino.
+	 * @throws EcwException
+	 */
+	private void init() throws GdalException {
+		//Controlamos que el tipo de driver sea correcto
+		if (driver == null)
+			throw new GdalException("Tipo de driver sin especificar.");
+
+		boolean okdrvtype = false;
+
+		String[] types = pInfo.getWriteDriversType();
+		for (int i = 0; i < pInfo.getWriteNTypes(); i++)
+			if (driver.equals(types[i]))
+				okdrvtype = true;
+
+		if (okdrvtype == false)
+			throw new GdalException("El tipo de driver " + driver + " no est� soportado por GdalWriter.");
+
+		//Obtenemos el driver y creamos el dataset del destino
+		drv = GdalDataset.getDriverByName(driver);
+
+		if (dstDataset != null) {
+			dstDataset.close();
+			dstDataset = null;
+		}
+
+		dstDataset = drv.create(outFileName, sizeWindowX, sizeWindowY,
+				nBands, GdalDataSource.getGdalTypeFromRasterBufType(dataType), gdalParamsFromRasterParams(driverParams));
+
+		dstDataset.setGeoTransform(geot);
+
+		int blockSize = RasterLibrary.blockHeight;
+		if(dataWriter.getBuffer() != null && dataWriter.getBuffer().isCached())
+			blockSize = dataWriter.getBuffer().getBlockHeight();
+
+		nBlocks = (sizeWindowY / blockSize);
+		anchoResto = sizeWindowY - (nBlocks * blockSize);
+	}
+
+	/**
+	 * @param fileName
+	 * @throws GdalException
+	 */
+	public void anotherFile(String fileName) throws GdalException {
+		dstDataset = drv.create(fileName, sizeWindowX, sizeWindowY,
+				nBands, GdalDataSource.getGdalTypeFromRasterBufType(dataType), gdalParamsFromRasterParams(driverParams));
+	}
+
+	/**
+	 * Convierte los par�metros obtenidos desde el objeto params a parametros
+	 * comprensibles por la librer�a gdal
+	 * @param p Params
+	 * @return Array de par�metros
+	 */
+	public String[] gdalParamsFromRasterParams(Params p) {
+		if (p == null)
+			return null;
+		ArrayList<String> paramList = new ArrayList<String>();
+		ParamImpl phot = (ParamImpl)p.getParamById("photometric");
+		if (phot != null)
+			paramList.add("PHOTOMETRIC=" + phot.getList()[((Integer) phot.getDefaultValue()).intValue()]);
+		ParamImpl inter = (ParamImpl)p.getParamById("interleave");
+		if (inter != null)
+			paramList.add("INTERLEAVE=" + inter.getList()[((Integer) inter.getDefaultValue()).intValue()]);
+		ParamImpl comp = (ParamImpl)p.getParamById("compression");// GIF LZW, ...
+		if (comp != null)
+			paramList.add("COMPRESS=" + comp.getList()[((Integer) comp.getDefaultValue()).intValue()]);
+		ParamImpl comp1 = (ParamImpl)p.getParamById("compress"); // HFA (YES, NO)
+		if (comp1 != null)
+			paramList.add("COMPRESS=" + comp1.getList()[((Integer) comp1.getDefaultValue()).intValue()]);
+		ParamImpl rrd = (ParamImpl)p.getParamById("rrd");
+		if (rrd != null)
+			paramList.add("HFA_USE_RRD=" + rrd.getList()[((Integer) rrd.getDefaultValue()).intValue()]);
+		ParamImpl mtw = (ParamImpl)p.getParamById("Mtw");
+		if (mtw != null)
+			paramList.add("MTW=" + mtw.getList()[((Integer) mtw.getDefaultValue()).intValue()]);
+		ParamImpl tw = (ParamImpl)p.getParamById("Tile Width");
+		if (tw != null)
+			paramList.add("BLOCKXSIZE=" + tw.getList()[((Integer) tw.getDefaultValue()).intValue()]);
+		ParamImpl th = (ParamImpl)p.getParamById("Tile Height");
+		if (th != null)
+			paramList.add("BLOCKYSIZE=" + th.getList()[((Integer) th.getDefaultValue()).intValue()]);
+		ParamImpl qt = (ParamImpl)p.getParamById("quality");
+		if (qt != null)
+			paramList.add("QUALITY=" + qt.getDefaultValue());
+		ParamImpl prog = (ParamImpl)p.getParamById("progressive");
+		if (prog != null)
+			paramList.add("PROGRESSIVE=" + prog.getDefaultValue());
+
+		if (paramList.size() == 0)
+			return null;
+
+		String[] result = new String[paramList.size()];
+		for (int i = 0; i < result.length; i++)
+			result[i] = (String) paramList.get(i);
+		return result;
+	}
+
+	/**
+	 * Escritura de datos tipo Byte.
+	 * @param sizeY Alto del bloque que se escribe.
+	 * @param posicionY Posici�ny a partir desde donde se comienza.
+	 */
+	public void writeByteBand(int sizeY, int posicionY) {
+		byte[][] buftmp = dataWriter.readByteData(sizeWindowX, sizeY);
+		for(int iBand = 0; iBand < nBands; iBand ++)
+			bufBands[iBand].buffByte = new byte[buftmp[iBand].length];
+
+		//Escribimos el bloque destino
+		for (int iBand = 0; iBand < buftmp.length; iBand++)
+			for (int i = 0; i < buftmp[iBand].length; i++)
+				bufBands[iBand].buffByte[i] = buftmp[iBand][i];
+
+		for (int iBand = 0; iBand < buftmp.length; iBand++)
+			try {
+				rband = dstDataset.getRasterBand(iBand + 1);
+				rband.writeRaster(0, posicionY, sizeWindowX, sizeY, bufBands[iBand], GdalDataset.GDT_Byte);
+				bufBands[iBand].buffByte = null;
+			} catch (GdalException e) {
+				//No se est� escribiendo ...
+			}
+		buftmp = null;
+
+	}
+
+	/**
+	 * Escritura de datos tipo Short.
+	 * @param sizeY Alto del bloque que se escribe.
+	 * @param posicionY Posici�ny a partir desde donde se comienza.
+	 */
+	public void writeShortBand(int sizeY, int posicionY) {
+		short[][] buftmp = dataWriter.readShortData(sizeWindowX, sizeY);
+		for(int iBand = 0; iBand < nBands; iBand ++)
+			bufBands[iBand].buffShort = new short[buftmp[iBand].length];
+
+		//Escribimos el bloque destino
+		for (int iBand = 0; iBand < nBands; iBand++)
+			for (int i = 0; i < buftmp[iBand].length; i++)
+				bufBands[iBand].buffShort[i] = buftmp[iBand][i];
+
+		for (int iBand = 0; iBand < nBands; iBand++)
+			try {
+				rband = dstDataset.getRasterBand(iBand + 1);
+				rband.writeRaster(0, posicionY, sizeWindowX, sizeY, bufBands[iBand], GdalDataset.GDT_Int16);
+				bufBands[iBand].buffShort = null;
+			} catch (GdalException e) {
+				//No se est� escribiendo ...
+			}
+		buftmp = null;
+	}
+
+	/**
+	 * Escritura de datos tipo Int.
+	 * @param sizeY Alto del bloque que se escribe.
+	 * @param posicionY Posici�ny a partir desde donde se comienza.
+	 */
+	public void writeIntBand(int sizeY, int posicionY) {
+		int[][] buftmp = dataWriter.readIntData(sizeWindowX, sizeY);
+		for(int iBand = 0; iBand < nBands; iBand ++)
+			bufBands[iBand].buffInt = new int[buftmp[iBand].length];
+
+		//Escribimos el bloque destino
+		for (int iBand = 0; iBand < buftmp.length; iBand++)
+			for (int i = 0; i < buftmp[iBand].length; i++)
+				bufBands[iBand].buffInt[i] = buftmp[iBand][i];
+
+		for (int iBand = 0; iBand < buftmp.length; iBand++)
+			try {
+				rband = dstDataset.getRasterBand(iBand + 1);
+				rband.writeRaster(0, posicionY, sizeWindowX, sizeY, bufBands[iBand], GdalDataset.GDT_Int32);
+				bufBands[iBand].buffInt = null;
+			} catch (GdalException e) {
+				//No se est� escribiendo ...
+			}
+		buftmp = null;
+	}
+
+	/**
+	 * Escritura de datos tipo Float.
+	 * @param sizeY Alto del bloque que se escribe.
+	 * @param posicionY Posici�ny a partir desde donde se comienza.
+	 */
+	public void writeFloatBand(int sizeY, int posicionY) {
+		float[][] buftmp = dataWriter.readFloatData(sizeWindowX, sizeY);
+		for(int iBand = 0; iBand < nBands; iBand ++)
+			bufBands[iBand].buffFloat = new float[buftmp[iBand].length];
+
+		//Escribimos el bloque destino
+		for (int iBand = 0; iBand < buftmp.length; iBand++)
+			for (int i = 0; i < buftmp[iBand].length; i++)
+				bufBands[iBand].buffFloat[i] = buftmp[iBand][i];
+
+		for (int iBand = 0; iBand < buftmp.length; iBand++)
+			try {
+				rband = dstDataset.getRasterBand(iBand + 1);
+				rband.writeRaster(0, posicionY, sizeWindowX, sizeY, bufBands[iBand], GdalDataset.GDT_Float32);
+				bufBands[iBand].buffFloat = null;
+			} catch (GdalException e) {
+				//No se est� escribiendo ...
+			}
+		buftmp = null;
+	}
+
+	/**
+	 * Escritura de datos tipo Double.
+	 * @param sizeY Alto del bloque que se escribe.
+	 * @param posicionY Posici�ny a partir desde donde se comienza.
+	 */
+	public void writeDoubleBand(int sizeY, int posicionY) {
+		double[][] buftmp = dataWriter.readDoubleData(sizeWindowX, sizeY);
+		for(int iBand = 0; iBand < nBands; iBand ++)
+			bufBands[iBand].buffDouble = new double[buftmp[iBand].length];
+
+		//Escribimos el bloque destino
+		for (int iBand = 0; iBand < buftmp.length; iBand++)
+			for (int i = 0; i < buftmp[iBand].length; i++)
+				bufBands[iBand].buffDouble[i] = buftmp[iBand][i];
+
+		for (int iBand = 0; iBand < buftmp.length; iBand++)
+			try {
+				rband = dstDataset.getRasterBand(iBand + 1);
+				rband.writeRaster(0, posicionY, sizeWindowX, sizeY, bufBands[iBand], GdalDataset.GDT_Float64);
+				bufBands[iBand].buffDouble = null;
+			} catch (GdalException e) {
+				//No se est� escribiendo ...
+			}
+		buftmp = null;
+	}
+	/**
+	 * Escritura para tipo de dato ARGB.
+	 * @param sizeY Alto del bloque que se escribe.
+	 * @param posicionY Posici�ny a partir desde donde se comienza.
+	 * @throws ProcessInterruptedException
+	 * @throws OutOfMemoryError
+	 */
+	public void writeARGBBand(int sizeY, int posicionY)
+			throws ProcessInterruptedException, OutOfMemoryError {
+		int[] buftmp = dataWriter.readARGBData(sizeWindowX, sizeY, 0);
+		for(int iBand = 0; iBand < nBands; iBand ++)
+			bufBands[iBand].buffByte = new byte[buftmp.length];
+
+		//Escribimos el bloque destino
+		for (int i = 0; i < buftmp.length; i++) {
+			bufBands[0].buffByte[i] = (byte) (((buftmp[i] & 0xff0000) >> 16) &
+					0xff);
+			bufBands[1].buffByte[i] = (byte) (((buftmp[i] & 0xff00) >> 8) & 0xff);
+			bufBands[2].buffByte[i] = (byte) ((buftmp[i] & 0xff) & 0xff);
+		}
+
+		try {
+			rband = dstDataset.getRasterBand(1);
+			rband.writeRaster(0, posicionY, sizeWindowX, sizeY, bufBands[0],
+					GdalDataset.GDT_Byte);
+			rband = dstDataset.getRasterBand(2);
+			rband.writeRaster(0, posicionY, sizeWindowX, sizeY, bufBands[1],
+					GdalDataset.GDT_Byte);
+			rband = dstDataset.getRasterBand(3);
+			rband.writeRaster(0, posicionY, sizeWindowX, sizeY, bufBands[2],
+					GdalDataset.GDT_Byte);
+		} catch (GdalException e) {
+			e.printStackTrace();
+		}
+
+		bufBands[0].buffByte = null;
+		bufBands[1].buffByte = null;
+		bufBands[2].buffByte = null;
+	}
+
+	/**
+	 * Escribe tres bandas en el GDALRasterBand desde el DataServerWriter con una
+	 * altura definida por sizeY.
+	 * @param buftmp        Buffer
+	 * @param sizeY        Altura en pixels del bloque leido
+	 * @param posicionY        Posici�n y a partir de la cual se escribe en el GDALRasterBand destino
+	 */
+	private void writeBands(int sizeY, int posicionY)
+			throws ProcessInterruptedException, OutOfMemoryError {
+		//leemos el bloque origen
+
+		switch(dataType){
+		case RasterBuffer.TYPE_IMAGE:
+			writeARGBBand(sizeY, posicionY);
+			break;
+		case RasterBuffer.TYPE_BYTE:
+			writeByteBand(sizeY, posicionY);
+			break;
+		case RasterBuffer.TYPE_SHORT:
+			writeShortBand(sizeY, posicionY);
+			break;
+		case RasterBuffer.TYPE_INT:
+			writeIntBand(sizeY, posicionY);
+			break;
+		case RasterBuffer.TYPE_FLOAT:
+			writeFloatBand(sizeY, posicionY);
+			break;
+		case RasterBuffer.TYPE_DOUBLE:
+			writeDoubleBand(sizeY, posicionY);
+			break;
+		}
+	}
+
+	/**
+	 * Funci�n que gestiona la lectura desde el origen y la escritura
+	 * de Gdal sobre el fichero destino.
+	 * @param mode        Modo de escritura
+	 * @throws IOException
+	 */
+	private void write(int mode) throws IOException, ProcessInterruptedException,
+			OutOfMemoryError {
+		RasterTask task = RasterTaskQueue.get(Thread.currentThread().getId() + "");
+		bufBands = new GdalBuffer[nBands];
+		for(int iBand = 0; iBand < nBands; iBand ++)
+			bufBands[iBand] = new GdalBuffer();
+
+		int blockSize = RasterLibrary.blockHeight;
+		if(dataWriter instanceof DefaultDataServerWriter) {
+			Buffer source = ((DefaultDataServerWriter)dataWriter).getSource();
+			if(source.isCached()) {
+				blockSize = source.getBlockHeight();
+			}
+		}
+
+		percent = 0;
+		nBlocks = (sizeWindowY / blockSize);
+		double increment = (blockSize * 100) / (double)sizeWindowY;
+
+		if (mode == DefaultRasterWriter.MODE_DATAWRITE)
+			for (int iBlock = 0; iBlock < nBlocks; iBlock++) {
+				if(task.getEvent() != null)
+					task.manageEvent(task.getEvent());
+				int posicionY = iBlock * blockSize;
+				if(write)
+					writeBands( blockSize, posicionY);
+				percent = (int)((iBlock + 1) * increment);
+			}
+
+		if (anchoResto != 0)
+			if (mode == DefaultRasterWriter.MODE_DATAWRITE) {
+				if(task.getEvent() != null)
+					task.manageEvent(task.getEvent());
+				int posicionY = nBlocks * blockSize;
+				if(write)
+					writeBands(anchoResto, posicionY);
+				percent = (int)(nBlocks * increment);
+			}
+
+	}
+
+	/**
+	 * Realiza la funci�n de compresi�n a partir de un GeoRasterFile.
+	 * @throws IOException
+	 */
+	public void fileWrite() throws IOException, ProcessInterruptedException {
+		write(DefaultRasterWriter.MODE_FILEWRITE);
+	}
+
+	/**
+	 * Realiza una copia en el formato especificado.
+	 * @param driverDst
+	 * @param dst
+	 * @param src
+	 * @param bstrict
+	 * @param params
+	 * @throws IOException
+	 * @throws GdalException
+	 */
+	public static void createCopy(GdalDriver driverDst, String dst, String src,
+			boolean bstrict, String[] params) throws IOException, GdalException {
+		if (dst == null || src == null)
+			throw new IOException("No se ha asignado un fichero de entrada.");
+
+		GdalProvider gdalFile;
+		try {
+			GdalDataParameters par = new GdalDataParameters();
+			par.setFile(new File(src));
+			gdalFile = new GdalProvider(par, null);
+			GdalDataset dstDataset = driverDst.createCopy(dst, gdalFile.getNative(), bstrict, params);
+			if(	dst.endsWith(".jpg") ||
+				dst.endsWith(".jpeg") ||
+				dst.endsWith(".png"))
+				RasterLocator.getManager().getFileUtils().createWorldFile(dst, gdalFile.getExtent(), (int)gdalFile.getWidth(), (int)gdalFile.getHeight());
+			gdalFile.close();
+			dstDataset.close();
+		} catch (NotSupportedExtensionException e) {
+			e.printStackTrace();
+		}
+	}
+
+	/**
+	 * Realiza la escritura de datos con los datos que le pasa el cliente.
+	 * @throws IOException
+	 * @throws RmfSerializerException
+	 */
+	public void dataWrite() throws IOException, ProcessInterruptedException,
+			OutOfMemoryError {
+		if (dataWriter == null)
+			throw new IOException("No se ha obtenido un objeto de entrada para la escritura valido.");
+
+		write(DefaultRasterWriter.MODE_DATAWRITE);
+
+		if (driverParams.getParamById("tfw") != null &&
+				((ParamImpl)driverParams.getParamById("tfw")).getDefaultValue() instanceof Boolean /*&&
+				((Boolean) ((ParamImpl)driverParams.getParamById("tfw")).getDefaultValue()).booleanValue() == true*/)
+			if (at != null)
+				fileUtil.createWorldFile(this.outFileName, at, sizeWindowX, sizeWindowY);
+
+		if (colorInterp != null)
+			try {
+                RasterLocator.getManager().getProviderServices()
+                    .saveObjectToRmfFile(outFileName, DataStoreColorInterpretation.class, colorInterp);
+			} catch (RmfSerializerException e) {
+				throw new IOException("No se ha podido guardar la interpretacion de color");
+			}
+
+		this.savePrjFile(new File(this.outFileName), proj);
+	}
+
+	public void writeClose() {
+		try {
+			if(bufBands != null) {
+				for (int i = 0; i < bufBands.length; i++) {
+					bufBands[i].buffAPalette = null;
+					bufBands[i].buffBPalette = null;
+					bufBands[i].buffByte = null;
+					bufBands[i].buffShort = null;
+					bufBands[i].buffInt = null;
+					bufBands[i].buffFloat = null;
+					bufBands[i].buffDouble = null;
+				}
+			}
+
+			if(dstDataset != null)
+				dstDataset.close();
+		} catch (GdalException e) {
+			e.printStackTrace();
+		}
+	}
+
+	/**
+	 * Cancela el salvado de datos.
+	 */
+	public void writeCancel() {
+		write = false;
+	}
+
+	/**
+	 * Obtiene el valor a la variable write que estar� a true cuando se est� escribiendo
+	 *  o puede escribirse la imagen de salida. El cancelar la operaci�n de escritura
+	 * pondr� esta variable a false deteniendose la escritura y cerrandose el dataset
+	 * de salida.
+	 * @return True si puede escribirse y false si no puede
+	 */
+	public boolean isWrite() {
+		return write;
+	}
+
+	/**
+	 * Asigna el valor a la variable write que estar� a true cuando se est� escribiendo
+	 *  o puede escribirse la imagen de salida. El cancelar la operaci�n de escritura
+	 * pondr� esta variable a false deteniendose la escritura y cerrandose el dataset
+	 * de salida.
+	 * @param write Variable booleana. True si puede escribirse y false si no puede
+	 */
+	public void setWrite(boolean write) {
+		this.write = write;
+	}
+
+	/**
+	 * Asigna los par�metros del driver modificados por el cliente.
+	 * @param Params
+	 */
+	public void setParams(Params params) {
+		if(params instanceof ParamsImpl)
+			this.driverParams = (ParamsImpl)params;
+		else
+			return;
+
+		int blockSize = 256;
+		try {
+			ParamImpl param = (ParamImpl)driverParams.getParamById("blocksize");
+			blockSize = Integer.parseInt(param.getList()[((Integer)param.getDefaultValue()).intValue()]);
+			nBlocks = (sizeWindowY / blockSize);
+			anchoResto = sizeWindowY - (nBlocks * blockSize);
+		}catch(NumberFormatException e) {
+			//Se queda con el valor de inicializaci�n
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see java.lang.Object#finalize()
+	 */
+	protected void finalize() throws Throwable {
+		drv        = null;
+		dstDataset = null;
+		rband      = null;
+		geot       = null;
+		if(bufBands != null) {
+			for (int i = 0; i < bufBands.length; i++) {
+				bufBands[i].buffAPalette = null;
+				bufBands[i].buffBPalette = null;
+				bufBands[i].buffByte = null;
+				bufBands[i].buffShort = null;
+				bufBands[i].buffInt = null;
+				bufBands[i].buffFloat = null;
+				bufBands[i].buffDouble = null;
+			}
+		}
+		super.finalize();
+	}
+}

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/GdalWriter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/GdalDataParameters.java
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/GdalDataParameters.java	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/GdalDataParameters.java	(revision 9865)
@@ -0,0 +1,70 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+
+package org.gvsig.raster.gdal.io;
+
+import org.gvsig.raster.impl.store.AbstractRasterFileDataParameters;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DelegatedDynObject;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.PersistenceManager;
+
+/**
+ * Parameters for the Gdal provider
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ */
+public class GdalDataParameters extends AbstractRasterFileDataParameters {
+	
+	public GdalDataParameters() {
+		initialize();
+	}
+	
+	protected void initialize() {
+		this.delegatedDynObject = (DelegatedDynObject) ToolsLocator
+				.getDynObjectManager().createDynObject(
+						registerDynClass());
+	}
+    
+	public String getDataStoreName() {
+		return GdalProvider.NAME;
+	}
+	
+	public String getDescription() {
+		return GdalProvider.DESCRIPTION;
+	}
+	
+	public static DynStruct registerDynClass() {
+		PersistenceManager manager = ToolsLocator.getPersistenceManager();
+		DynStruct definition = manager.getDefinition("GdalDataParameters_Persistent");
+		if( definition == null ) {
+			definition = manager.addDefinition(
+					GdalDataParameters.class,
+					"GdalDataParameters_Persistent",
+					"GdalDataParameters Persistent",
+					null, 
+					null
+			);
+			AbstractRasterFileDataParameters.registerDynClass(definition);
+		}
+		return definition;
+	}
+}

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/GdalDataParameters.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/DefaultGdalIOLibrary.java
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/DefaultGdalIOLibrary.java	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/DefaultGdalIOLibrary.java	(revision 9865)
@@ -0,0 +1,75 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.raster.gdal.io;
+
+import org.gvsig.fmap.dal.DALFileLibrary;
+import org.gvsig.fmap.dal.DALLibrary;
+import org.gvsig.fmap.dal.coverage.RasterLocator;
+import org.gvsig.raster.gdal.overview.GdalOverviewBuilder;
+import org.gvsig.raster.gdal.util.DefaultCRSUtils;
+import org.gvsig.raster.impl.store.AbstractNewRasterStoreParameters;
+import org.gvsig.tools.ToolsLibrary;
+import org.gvsig.tools.library.AbstractLibrary;
+import org.gvsig.tools.library.Library;
+import org.gvsig.tools.library.LibraryException;
+/**
+ *
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ */
+public class DefaultGdalIOLibrary extends AbstractLibrary {	
+
+	public DefaultGdalIOLibrary() {
+		super(DefaultGdalIOLibrary.class,Library.TYPE.IMPL);
+		require(ToolsLibrary.class);
+		require(DALLibrary.class);
+		require(DALFileLibrary.class);
+	}
+	
+	@Override
+	protected void doInitialize() throws LibraryException {
+		//RasterLibrary.wakeUp();
+	}
+
+	@Override
+	protected void doPostInitialize() throws LibraryException {
+		//AbstractRasterFileDataParameters.registerDynClass();
+		AbstractNewRasterStoreParameters.registerDynClass();
+		
+		// Registro de los drivers de lectura
+		GdalProvider.register();
+		
+		// Registro de los drivers de escritura
+		GdalWriter.register();
+		JpegWriter.register();
+		PngWriter.register();
+		GdalDataParameters.registerDynClass();
+		
+		//Register GdalOverviewBuilder
+		RasterLocator.getManager().getProviderServices().registerOverviewBuilderImplementation(
+				"GDAL",
+				new GdalOverviewBuilder());
+		
+		//Register CRSUtils
+		RasterLocator.getManager().getProviderServices().registerCRSUtilImplementation(
+						new DefaultCRSUtils());
+	}
+}

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/DefaultGdalIOLibrary.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/PAuxFeatures.java
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/PAuxFeatures.java	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/PAuxFeatures.java	(revision 9865)
@@ -0,0 +1,47 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.raster.gdal.io.features;
+
+import org.gvsig.raster.gdal.io.GdalProvider;
+import org.gvsig.raster.gdal.io.GdalWriter;
+import org.gvsig.raster.impl.store.WriteFileFormatFeatures;
+/**
+ * Caracteristicas del formato PAux para escritura.
+ * Soporta tipo de datos enteros de 8 y 16 bits y reales de 32 bits.
+ * La georreferenciaci�n y la proyecci�n son ignoradas.
+ * 
+ * @version 04/06/2007
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ */
+public class PAuxFeatures extends WriteFileFormatFeatures {
+
+	public PAuxFeatures() {
+		super(GdalProvider.FORMAT_PAUX, "aux", new int[] { 3 }, null, GdalWriter.class);
+	}
+
+	/**
+	 * Carga los par�metros de este driver.
+	 */
+	public void loadParams() {
+		super.loadParams();
+	}
+}

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/PAuxFeatures.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/PNM_PgmFeatures.java
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/PNM_PgmFeatures.java	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/PNM_PgmFeatures.java	(revision 9865)
@@ -0,0 +1,50 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.raster.gdal.io.features;
+
+import org.gvsig.fmap.dal.coverage.datastruct.Params;
+import org.gvsig.raster.gdal.io.GdalProvider;
+import org.gvsig.raster.gdal.io.GdalWriter;
+import org.gvsig.raster.impl.store.WriteFileFormatFeatures;
+/**
+ * Caracteristicas del formato PNM para escritura.
+ * Esta clase soporta solo ficheros pgm. Estos son solo los PNM en 
+ * escala de grises
+ * 
+ * @version 04/06/2007
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ */
+public class PNM_PgmFeatures extends WriteFileFormatFeatures {
+
+	public PNM_PgmFeatures() {
+		super(GdalProvider.FORMAT_PNM, "pgm", new int[] { 1 }, null, GdalWriter.class);
+	}
+
+	/**
+	 * Carga los par�metros de este driver.
+	 */
+	public void loadParams() {
+		super.loadParams();
+
+		driverParams.setParam("tfw", new Boolean("true"), Params.CHECK, null);
+	}
+}

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/PNM_PgmFeatures.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/BMPFeatures.java
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/BMPFeatures.java	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/BMPFeatures.java	(revision 9865)
@@ -0,0 +1,49 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.raster.gdal.io.features;
+
+import org.gvsig.fmap.dal.coverage.datastruct.Params;
+import org.gvsig.raster.gdal.io.GdalProvider;
+import org.gvsig.raster.gdal.io.GdalWriter;
+import org.gvsig.raster.impl.store.WriteFileFormatFeatures;
+/**
+ * Caracteristicas del formato BMP para escritura.
+ * Soporta escritura de imagenes 1 banda (monocromo) o 3 (RGB) en 8 bits. 
+ * La georreferenciaci�n puede hacerse mediante un fichero .wld.
+ * 
+ * @version 04/06/2007
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ */
+public class BMPFeatures extends WriteFileFormatFeatures {
+
+	public BMPFeatures() {
+		super(GdalProvider.FORMAT_BMP, "bmp", new int[] { 3 }, null, GdalWriter.class);
+	}
+
+	/**
+	 * Carga los par�metros de este driver.
+	 */
+	public void loadParams() {
+		super.loadParams();
+		driverParams.setParam("tfw", new Boolean("true"), Params.CHECK, null);
+	}
+}

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/BMPFeatures.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/HFAFeatures.java
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/HFAFeatures.java	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/HFAFeatures.java	(revision 9865)
@@ -0,0 +1,59 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.raster.gdal.io.features;
+
+import org.gvsig.fmap.dal.coverage.datastruct.Params;
+import org.gvsig.raster.gdal.io.GdalProvider;
+import org.gvsig.raster.gdal.io.GdalWriter;
+import org.gvsig.raster.impl.store.WriteFileFormatFeatures;
+/**
+ * Caracteristicas del formato HFA (.img) de Erdas para escritura.
+ * Soporta enteros de 8, 16 y 32 bits y datos en coma flotante de 32 y 64 bits
+ * con cualquier n�mero de bandas.
+ * 
+ * @version 04/06/2007
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ */
+ //TODO: Mirar si se pueden generar con piramides
+public class HFAFeatures extends WriteFileFormatFeatures {
+	
+	public HFAFeatures() {
+		super(GdalProvider.FORMAT_HFA, "img", new int[] { -1 }, new int[] { 0, 1, 2, 3, 4, 5 }, GdalWriter.class);
+	}
+	
+	/**
+	 * Carga los par�metros de este driver.
+	 */
+	public void loadParams() {
+		super.loadParams();
+
+		driverParams.setParam("rrd", 
+				new Integer(1), 
+				Params.CHOICE, 
+				new String[]{ "YES", "NO"});
+
+		driverParams.setParam("compress", 
+				new Integer(1), 
+				Params.CHOICE, 
+				new String[]{"YES", "NO"});
+	}
+}

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/HFAFeatures.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/GTiffFeatures.java
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/GTiffFeatures.java	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/GTiffFeatures.java	(revision 9865)
@@ -0,0 +1,63 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.raster.gdal.io.features;
+
+import org.gvsig.fmap.dal.coverage.datastruct.Params;
+import org.gvsig.raster.gdal.io.GdalProvider;
+import org.gvsig.raster.gdal.io.GdalWriter;
+import org.gvsig.raster.impl.store.WriteFileFormatFeatures;
+
+/**
+ * Caracteristicas del formato GeoTiff para escritura.
+ * 
+ * @version 04/06/2007
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ */
+public class GTiffFeatures extends WriteFileFormatFeatures {
+
+	public GTiffFeatures() {
+		super(GdalProvider.FORMAT_GTiff, "tif", new int[] { -1 }, new int[] { 0, 1, 2, 3, 4, 5 }, GdalWriter.class);
+	}
+
+	/**
+	 * Carga los par�metros de este driver.
+	 */
+	public void loadParams() {
+		super.loadParams();
+		driverParams.setParam(
+				"photometric", 
+				new Integer(3), 
+				Params.CHOICE, 
+				new String[]{"YCBR", "MINISBLACK", "MINISWHITE", "RGB", "CMYK", "CIELAB", "ICCLAB", "ITULAB", "CBCR"});
+		driverParams.setParam(
+				"interleave", 
+				new Integer(0), 
+				Params.CHOICE, 
+				new String[]{ "BAND", "PIXEL"});
+		driverParams.setParam(
+				"compression", 
+				new Integer(3),
+				Params.CHOICE, 
+				new String[]{"LZW", "PACKBITS", "DEFLATE", "NONE"});
+		driverParams.setParam("tfw", new Boolean("false"), Params.CHECK, null);
+	}
+}

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/GTiffFeatures.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/IDRISIFeatures.java
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/IDRISIFeatures.java	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/IDRISIFeatures.java	(revision 9865)
@@ -0,0 +1,47 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.raster.gdal.io.features;
+
+import org.gvsig.raster.gdal.io.GdalProvider;
+import org.gvsig.raster.gdal.io.GdalWriter;
+import org.gvsig.raster.impl.store.WriteFileFormatFeatures;
+/**
+ * Caracteristicas del formato RST de IDRISI para escritura.
+ * Soporta tipos de datos enteros en 8, 16 y 32 bits y coma flotante en 32 bits
+ * Genera un fichero RDC con la descripci�n de la imagen
+ * 
+ * @version 04/06/2007
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ */
+public class IDRISIFeatures extends WriteFileFormatFeatures {
+	
+	public IDRISIFeatures() {
+		super(GdalProvider.FORMAT_RST, "rst", new int[] { -1 }, new int[] { 0, 1, 2, 3, 4 }, GdalWriter.class);
+	}
+
+	/**
+	 * Carga los par�metros de este driver.
+	 */
+	public void loadParams() {
+		super.loadParams();
+	}
+}

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/IDRISIFeatures.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/PngFeatures.java
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/PngFeatures.java	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/PngFeatures.java	(revision 9865)
@@ -0,0 +1,45 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.raster.gdal.io.features;
+
+import org.gvsig.raster.gdal.io.PngWriter;
+import org.gvsig.raster.impl.store.WriteFileFormatFeatures;
+/**
+ * Caracteristicas del formato Png para escritura.
+ * La georreferenciaci�n puede hacerse mediante un fichero .wld.
+ * 
+ * @version 14/12/2007
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ */
+public class PngFeatures extends WriteFileFormatFeatures {
+
+	public PngFeatures() {
+		super("Png", "png", new int[] { 4 }, null, PngWriter.class);
+	}
+
+	/**
+	 * Carga los par�metros de este driver.
+	 */
+	public void loadParams() {
+		super.loadParams();
+	}
+}

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/PngFeatures.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/RMFFeatures.java
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/RMFFeatures.java	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/RMFFeatures.java	(revision 9865)
@@ -0,0 +1,61 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.raster.gdal.io.features;
+
+import org.gvsig.fmap.dal.coverage.datastruct.Params;
+import org.gvsig.raster.gdal.io.GdalProvider;
+import org.gvsig.raster.gdal.io.GdalWriter;
+import org.gvsig.raster.impl.store.WriteFileFormatFeatures;
+/**
+ * Caracteristicas del formato Raster Matrix Format 
+ * Soporta tipos de datos enteros en 16 bits y coma flotante en 64 bits.
+ * �Ojo! en la documentaci�n de gdal pone 32 bits en flotante pero no se lo traga.
+ * 
+ * @version 04/06/2007
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ */
+public class RMFFeatures extends WriteFileFormatFeatures {
+	
+	public RMFFeatures() {
+		super(GdalProvider.FORMAT_RMF, "rmf", new int[]{-1}, new int[]{0, 1, 3, 5}, GdalWriter.class);
+	}
+	
+	/**
+	 * Carga los par�metros de este driver.
+	 */
+	public void loadParams() {
+		super.loadParams();
+		
+		driverParams.setParam("Mtw", 
+			new Integer(1), 
+			Params.CHOICE, 
+			new String[]{"ON", "OFF"});
+		driverParams.setParam("Tile Width", 
+			new Integer(3), 
+			Params.CHOICE, 
+			new String[]{"32", "64", "128", "256", "512"});
+		driverParams.setParam("Tile Height", 
+			new Integer(3),  
+			Params.CHOICE, 
+			new String[]{"32", "64", "128", "256", "512"});
+	}
+}
\ No newline at end of file

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/RMFFeatures.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/ILWIS_MprFeatures.java
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/ILWIS_MprFeatures.java	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/ILWIS_MprFeatures.java	(revision 9865)
@@ -0,0 +1,49 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.raster.gdal.io.features;
+
+import org.gvsig.raster.gdal.io.GdalProvider;
+import org.gvsig.raster.gdal.io.GdalWriter;
+import org.gvsig.raster.impl.store.WriteFileFormatFeatures;
+/**
+ * Caracteristicas del formato ILWIS para escritura.
+ * Soporta tipos de datos enteros en 8, 16 y 32 bits y coma flotante en 32 y 64 bits
+ * Genera un fichero .mpl con la informaci�n de contenido (ficheros), un fichero .grf con la
+ * georreferenciaci�n, y dos ficheros por banda. Un .mpr con la informaci�n referente a los
+ * datos de la banda y un .mp# con los datos de la banda
+ * 
+ * @version 04/06/2007
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ */
+public class ILWIS_MprFeatures extends WriteFileFormatFeatures {
+
+	public ILWIS_MprFeatures() {
+		super(GdalProvider.FORMAT_ILWIS, "mpl", new int[] { -1 }, new int[] { 0, 1, 2, 3, 4, 5 }, GdalWriter.class);
+	}
+
+	/**
+	 * Carga los par�metros de este driver.
+	 */
+	public void loadParams() {
+		super.loadParams();
+	}
+}

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/ILWIS_MprFeatures.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/JpegFeatures.java
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/JpegFeatures.java	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/JpegFeatures.java	(revision 9865)
@@ -0,0 +1,58 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.raster.gdal.io.features;
+
+import org.gvsig.fmap.dal.coverage.datastruct.Params;
+import org.gvsig.raster.gdal.io.JpegWriter;
+import org.gvsig.raster.impl.store.WriteFileFormatFeatures;
+/**
+ * Caracteristicas del formato Jpeg para escritura.
+ * Soporta escritura de imagenes 1 banda (monocromo) o 3 (RGB) en 8 bits. 
+ * La georreferenciaci�n puede hacerse mediante un fichero .wld.
+ * 
+ * @version 04/06/2007
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ *
+ */
+public class JpegFeatures extends WriteFileFormatFeatures {
+	
+	public JpegFeatures() {
+		super("Jpeg", "jpg", new int[]{3}, null, JpegWriter.class);
+	}
+	
+	/**
+	 * Carga los par�metros de este driver.
+	 */
+	public void loadParams() {
+		super.loadParams();
+		
+		driverParams.setParam("quality",
+				new Integer(16),
+				Params.SLIDER,
+				new String[]{ "10", "100", "16", "5", "30"}); //min, max, valor defecto, intervalo peque�o, intervalo grande;
+
+		driverParams.setParam("progressive", 
+				new Boolean("false"), 
+				Params.CHECK, 
+				null);
+	}
+}

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/JpegFeatures.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/PNM_PpmFeatures.java
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/PNM_PpmFeatures.java	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/PNM_PpmFeatures.java	(revision 9865)
@@ -0,0 +1,50 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.raster.gdal.io.features;
+
+import org.gvsig.fmap.dal.coverage.datastruct.Params;
+import org.gvsig.raster.gdal.io.GdalProvider;
+import org.gvsig.raster.gdal.io.GdalWriter;
+import org.gvsig.raster.impl.store.WriteFileFormatFeatures;
+/**
+ * Caracteristicas del formato PNM para escritura.
+ * Esta clase soporta solo ficheros ppm. Estos son solo los PNM en
+ * RGB
+ * 
+ * @version 04/06/2007
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ */
+public class PNM_PpmFeatures extends WriteFileFormatFeatures {
+
+	public PNM_PpmFeatures() {
+		super(GdalProvider.FORMAT_PNM, "pgm", new int[] { 3 }, null, GdalWriter.class);
+	}
+
+	/**
+	 * Carga los par�metros de este driver.
+	 */
+	public void loadParams() {
+		super.loadParams();
+
+		driverParams.setParam("tfw", new Boolean("true"), Params.CHECK, null);
+	}
+}

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/PNM_PpmFeatures.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/Jpeg2000Features.java
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/Jpeg2000Features.java	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/Jpeg2000Features.java	(revision 9865)
@@ -0,0 +1,59 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.raster.gdal.io.features;
+
+import org.gvsig.fmap.dal.coverage.datastruct.Params;
+import org.gvsig.raster.gdal.io.GdalProvider;
+import org.gvsig.raster.gdal.io.GdalWriter;
+import org.gvsig.raster.impl.store.WriteFileFormatFeatures;
+/**
+ * Caracteristicas del formato Jpeg2000 para escritura.
+ * Soporta escritura de imagenes 1 banda (monocromo) o 3 (RGB) en 8 bits. 
+ * La georreferenciaci�n puede hacerse mediante un fichero .wld.
+ * 
+ * @version 26/08/2013
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ *
+ */
+public class Jpeg2000Features extends WriteFileFormatFeatures {
+	
+	public Jpeg2000Features() {
+		super(GdalProvider.FORMAT_JP2, "jp2", new int[]{3}, null, GdalWriter.class);
+	}
+	
+	/**
+	 * Carga los par�metros de este driver.
+	 */
+	public void loadParams() {
+		super.loadParams();
+		
+		driverParams.setParam("quality",
+				new Integer(16),
+				Params.SLIDER,
+				new String[]{ "10", "100", "16", "5", "30"}); //min, max, valor defecto, intervalo peque�o, intervalo grande;
+
+		driverParams.setParam("progressive", 
+				new Boolean("false"), 
+				Params.CHECK, 
+				null);
+	}
+}

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/Jpeg2000Features.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/PngWriter.java
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/PngWriter.java	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/PngWriter.java	(revision 9865)
@@ -0,0 +1,213 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.raster.gdal.io;
+
+import java.awt.geom.AffineTransform;
+import java.io.File;
+import java.io.IOException;
+
+import org.cresques.cts.IProjection;
+import org.gvsig.fmap.dal.coverage.RasterLocator;
+import org.gvsig.fmap.dal.coverage.datastruct.Params;
+import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException;
+import org.gvsig.fmap.dal.coverage.store.DataServerWriter;
+import org.gvsig.jgdal.GdalDataset;
+import org.gvsig.jgdal.GdalDriver;
+import org.gvsig.jgdal.GdalException;
+import org.gvsig.raster.gdal.io.features.PngFeatures;
+import org.gvsig.raster.impl.store.WriteFileFormatFeatures;
+import org.gvsig.raster.impl.store.writer.DefaultRasterWriter;
+import org.gvsig.raster.util.DefaultProviderServices;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.extensionpoint.ExtensionPoint;
+import org.gvsig.tools.extensionpoint.ExtensionPointManager;
+/**
+ * Driver para la escritura de Png.
+ * Este driver utiliza GdalWriter para salvar Png.
+ * La escritura de un png no es posible utilizando un servidor de datos
+ * como el que usan los drivers comunes por lo que ser� necesario salvar antes
+ * a Tif con el driver de Gdal para posteriormente convertir la imagen completa
+ * a png. El problema que tiene es el mismo del jpg y es que el dataset solo soporta la
+ * escritura rw y no rw+.
+ *
+ * @version 22/07/2008
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ */
+public class PngWriter extends DefaultRasterWriter {
+
+	// Datos de registro de drivers
+	public static void register() {
+		DefaultProviderServices pInfo = (DefaultProviderServices)RasterLocator.getManager().getProviderServices();
+		ExtensionPointManager extensionPoints =ToolsLocator.getExtensionPointManager();
+		ExtensionPoint point=extensionPoints.get("RasterWriter");
+		point.append("png", "", PngWriter.class);
+		pInfo.getFileFeature().put("png", new PngFeatures());
+	}
+
+	private GdalWriter gdalWriter = null;
+	private String     outTif     = null;
+	private String     outPng     = null;
+
+	/**
+	 * Carga los par�metros de este driver.
+	 */
+	public void loadParams(String ident) {
+		WriteFileFormatFeatures wfff = (WriteFileFormatFeatures) pInfo.getFileFeature().get(ident);
+		wfff.loadParams();
+		driverParams = wfff.getParams();
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.coverage.store.RasterWriter#getProviderName()
+	 */
+	public String getProviderName() {
+		return GdalProvider.NAME;
+	}
+
+	/**
+	 * Constructor para la obtenci�n de par�metros del driver
+	 * @param drvType Tipo de driver
+	 */
+	public PngWriter(String fileName) {
+		ident = fileUtil.getExtensionFromFileName(fileName);
+		driver = ((WriteFileFormatFeatures) pInfo.getFileFeature().get(ident)).getDriverName();
+		gdalWriter = new GdalWriter(fileName);
+
+		loadParams(ident);
+	}
+
+	/**
+	 * Constructor para salvar datos servidos por el cliente
+	 * @param dataWriter Objeto servidor de datos para el driver de escritura
+	 * @param outSizeX N�mero de pixels en X de la imagen de salida
+	 * @param outSizeY N�mero de pixels en Y de la imagen de salida
+	 * @param outFilename Fichero de salida
+	 * @param extentMaxX Posici�n en X m�xima del extent
+	 * @param extentMinX Posici�n en X m�nima del extent
+	 * @param extentMaxY Posici�n en Y m�xima del extent
+	 * @param extentMinY Posici�n en Y m�nima del extent
+	 * @param nBands N�mero de bandas
+	 * @param drvType Tipo de driver
+	 * @throws GdalException
+	 * @throws IOException
+	 */
+	public PngWriter(DataServerWriter dataWriter,
+							String outFileName,
+							Integer nBands,
+							AffineTransform at,
+							Integer outSizeX,
+							Integer outSizeY,
+							Integer dataType,
+							Params params,
+							IProjection proj,
+							Boolean geo)throws GdalException, IOException  {
+		ident = fileUtil.getExtensionFromFileName(outFileName);
+		driver = ((WriteFileFormatFeatures) pInfo.getFileFeature().get(ident)).getDriverName();
+		outPng = outFileName;
+		outTif = outFileName.substring(0, outFileName.lastIndexOf("."));
+		outTif += ".tif";
+		this.at = at;
+
+		gdalWriter = new GdalWriter(dataWriter, outTif, nBands, at, outSizeX, outSizeY, dataType, params, proj, geo);
+		if (params == null)
+			loadParams(ident);
+		else
+			this.driverParams = params;
+	}
+
+	/**
+	 * Asigna el tipo de driver con el que se salvar� la imagen
+	 * @param drvType Tipo de driver
+	 */
+	public void setDriverType(String drvType) {
+		gdalWriter.setDriverType(drvType);
+	}
+
+		/**
+	 * Realiza la funci�n de compresi�n a partir de un GeoRasterFile.
+	 * @throws IOException
+	 */
+	public void fileWrite() throws IOException, ProcessInterruptedException {
+		gdalWriter.fileWrite();
+	}
+
+	/**
+	 * Realiza una copia en el formato especificado.
+	 * @throws IOException
+	 */
+	public static void createCopy(GdalDriver driverDst, String dst, String src,
+			boolean bstrict, String[] params) throws IOException, GdalException {
+		GdalWriter.createCopy(driverDst, dst, src, bstrict, params);
+	}
+
+	/**
+	 * Realiza la escritura de datos con los datos que le pasa el cliente.
+	 * @throws IOException
+	 */
+	public void dataWrite() throws IOException, ProcessInterruptedException {
+		if(colorInterp != null)
+			gdalWriter.setColorBandsInterpretation(colorInterp.getValues());
+		gdalWriter.dataWrite();
+		if (gdalWriter.isWrite()) {
+			gdalWriter.writeClose();
+			if (outTif != null) {
+				GdalDriver driver = null;
+				try {
+					driver = GdalDataset.getDriverByName("PNG");
+					GdalWriter.createCopy(driver, outPng, outTif, false, gdalWriter.gdalParamsFromRasterParams(driverParams));
+				} catch (GdalException exc) {
+					throw new IOException("No se ha podido obtener el driver.");
+				}
+				File file = new File(outTif);
+				file.delete();
+			}
+		}
+	}
+
+	/**
+	 * Cancela el salvado de datos.
+	 */
+	public void writeCancel() {
+		gdalWriter.setWrite(false);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.gvsig.raster.dataset.GeoRasterWriter#setParams(org.gvsig.raster.dataset.Params)
+	 */
+	public void setParams(Params params) {
+		driverParams = params;
+		if (gdalWriter != null)
+			gdalWriter.setParams(params);
+	}
+
+	/**
+	 * Cierra el compresor ecw.
+	 * @throws GdalException
+	 */
+	public void writeClose() {
+	// El close del tif se hizo en dataWrite
+	}
+
+	public void setWkt(String wkt) {}
+}

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/PngWriter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/GdalDataSource.java
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/GdalDataSource.java	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/GdalDataSource.java	(revision 9865)
@@ -0,0 +1,1485 @@
+	/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.raster.gdal.io;
+
+import java.awt.Color;
+import java.awt.Rectangle;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.NoninvertibleTransformException;
+import java.awt.geom.Point2D;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.gdal.gdal.gdal;
+import org.gdal.ogr.ogr;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.gvsig.fmap.dal.coverage.RasterLibrary;
+import org.gvsig.fmap.dal.coverage.RasterLocator;
+import org.gvsig.fmap.dal.coverage.dataset.Buffer;
+import org.gvsig.fmap.dal.coverage.datastruct.BandList;
+import org.gvsig.fmap.dal.coverage.datastruct.ColorItem;
+import org.gvsig.fmap.dal.coverage.datastruct.Extent;
+import org.gvsig.fmap.dal.coverage.datastruct.NoData;
+import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException;
+import org.gvsig.fmap.dal.coverage.store.props.ColorInterpretation;
+import org.gvsig.fmap.dal.coverage.store.props.ColorTable;
+import org.gvsig.fmap.dal.coverage.util.FileUtils;
+import org.gvsig.jgdal.GdalBuffer;
+import org.gvsig.jgdal.GdalColorEntry;
+import org.gvsig.jgdal.GdalColorTable;
+import org.gvsig.jgdal.GdalDataset;
+import org.gvsig.jgdal.GdalException;
+import org.gvsig.jgdal.GdalRasterBand;
+import org.gvsig.jgdal.GeoTransform;
+import org.gvsig.jgdal.GeoTransform.GeoTransformException;
+import org.gvsig.raster.impl.datastruct.ColorItemImpl;
+import org.gvsig.raster.impl.datastruct.DefaultNoData;
+import org.gvsig.raster.impl.datastruct.ExtentImpl;
+import org.gvsig.raster.impl.process.RasterTask;
+import org.gvsig.raster.impl.process.RasterTaskQueue;
+import org.gvsig.raster.impl.store.properties.DataStoreColorInterpretation;
+import org.gvsig.raster.impl.store.properties.DataStoreColorTable;
+import org.gvsig.raster.impl.store.properties.DataStoreMetadata;
+import org.gvsig.raster.impl.store.properties.DataStoreTransparency;
+import org.gvsig.tools.dispose.Disposable;
+import org.gvsig.tools.task.TaskStatus;
+/**
+ * Soporte 'nativo' para ficheros desde GDAL.
+ */
+public class GdalDataSource extends GdalDataset implements Disposable {
+	private String                       fileName                = null;
+	private String                       shortName               = "";
+	public 	GeoTransform                 trans                   = null;
+	public int                           width                   = 0, height = 0;
+	public double                        originX                 = 0D, originY = 0D;
+	public String                        version                 = "";
+	protected int                        rBandNr                 = 1, gBandNr = 2, bBandNr = 3, aBandNr = 4;
+	private int[]                        dataType                = null;
+	DataStoreMetadata                    metadata                = null;
+	protected boolean                    georeferenced           = true;
+
+	private static final Logger logger = LoggerFactory.getLogger(GdalDataSource.class);
+
+	/**
+	 * Vectores que contiene los desplazamientos de un pixel cuando hay supersampling.
+	 * , es decir el n?mero de pixels de pantalla que tiene un pixel de imagen. Como todos
+	 * los pixeles no tienen el mismo ancho y alto ha de meterse en un array y no puede ser
+	 * una variable. Adem?s hay que tener en cuenta que el primer y ?ltimo pixel son de
+	 * distinto tama?o que el resto.
+	 */
+	public int[]                              stepArrayX             = null;
+	public int[]                              stepArrayY             = null;
+	protected GdalRasterBand[]                gdalBands              = null;
+	private double                            lastReadLine           = -1;
+	private int                               overviewWidth          = -1;
+	private int                               overviewHeight         = -1;
+	private int                               currentViewWidth       = -1;
+	private int                               currentViewHeight      = -1;
+	private double                            currentViewX           = 0D;
+	private double                            viewportScaleX         = 0D;
+	private double                            viewportScaleY         = 0D;
+	private double                            stepX                  = 0D;
+	private double                            stepY                  = 0D;
+	public boolean                            isSupersampling        = false;
+	private boolean                           open                   = false;
+	/**
+	 * Estado de transparencia del raster.
+	 */
+	protected DataStoreTransparency           fileTransparency       = null;
+	protected DataStoreColorTable             palette                = null;
+	protected DataStoreColorInterpretation    colorInterpr           = null;
+	protected AffineTransform                 ownTransformation      = null;
+	protected AffineTransform                 externalTransformation = new AffineTransform();
+
+	public static int getGdalTypeFromRasterBufType(int rasterBufType) {
+		switch (rasterBufType) {
+			case Buffer.TYPE_BYTE: return GdalDataset.GDT_Byte;
+			case Buffer.TYPE_USHORT: return GdalDataset.GDT_UInt16;
+			case Buffer.TYPE_SHORT: return GdalDataset.GDT_Int16;
+			case Buffer.TYPE_INT: return GdalDataset.GDT_Int32;
+			case Buffer.TYPE_FLOAT: return GdalDataset.GDT_Float32;
+			case Buffer.TYPE_DOUBLE: return GdalDataset.GDT_Float64;
+			case Buffer.TYPE_UNDEFINED: return GdalDataset.GDT_Unknown;
+			case Buffer.TYPE_IMAGE: return GdalDataset.GDT_Byte;
+		}
+		return GdalDataset.GDT_Unknown;
+	}
+
+	/**
+	 * Conversi?n de los tipos de datos de gdal a los tipos de datos de RasterBuf
+	 * @param gdalType Tipo de dato de gdal
+	 * @return Tipo de dato de RasterBuf
+	 */
+	public static int getRasterBufTypeFromGdalType(int gdalType) {
+		switch (gdalType) {
+			case 1:// Eight bit unsigned integer GDT_Byte = 1
+				return Buffer.TYPE_BYTE;
+
+			case 3:// Sixteen bit signed integer GDT_Int16 = 3,
+				return Buffer.TYPE_SHORT;
+
+			case 2:// Sixteen bit unsigned integer GDT_UInt16 = 2
+				//return RasterBuffer.TYPE_USHORT;
+				return Buffer.TYPE_SHORT; //Apa?o para usar los tipos de datos que soportamos
+
+			case 5:// Thirty two bit signed integer GDT_Int32 = 5
+				return Buffer.TYPE_INT;
+
+			case 6:// Thirty two bit floating point GDT_Float32 = 6
+				return Buffer.TYPE_FLOAT;
+
+			case 7:// Sixty four bit floating point GDT_Float64 = 7
+				return Buffer.TYPE_DOUBLE;
+
+				// TODO:Estos tipos de datos no podemos gestionarlos. Habria que definir
+				// el tipo complejo y usar el tipo long que de momento no se gasta.
+			case 4:// Thirty two bit unsigned integer GDT_UInt32 = 4,
+				return Buffer.TYPE_INT;
+				//return RasterBuffer.TYPE_UNDEFINED; // Deberia devolver un Long
+
+			case 8:// Complex Int16 GDT_CInt16 = 8
+			case 9:// Complex Int32 GDT_CInt32 = 9
+			case 10:// Complex Float32 GDT_CFloat32 = 10
+			case 11:// Complex Float64 GDT_CFloat64 = 11
+				return Buffer.TYPE_UNDEFINED;
+		}
+		return Buffer.TYPE_UNDEFINED;
+	}
+
+	/**
+	 * Overview usada en el ?ltimo setView
+	 */
+	int currentOverview = -1;
+
+	public GdalDataSource(String fName) throws GdalException, IOException {
+		super();
+		init(fName);
+	}
+
+//	private static Dataset initializeGdal(String fName) throws GdalException {
+//		gdal.AllRegister();
+//		ogr.RegisterAll();
+//		Dataset data = gdal.Open(fName, 1);
+//		if (data == null)
+//			throw new GdalException("Error en la apertura del fichero. El fichero no tiene un formato v?lido.");
+//
+//		return data;
+//	}
+
+	private void init(String fName) throws GdalException, IOException {
+		gdal.AllRegister();
+		ogr.RegisterAll();
+		fileName = fName;
+		open(fName, GA_ReadOnly);
+		open = true;
+		if (getDataset() == null)
+			throw new GdalException("Error en la apertura del fichero. El fichero no tiene un formato v?lido.");
+		width = getRasterXSize();
+		height = getRasterYSize();
+
+		int[] dt = new int[getRasterCount()];
+		for (int i = 0; i < getRasterCount(); i++)
+			dt[i] = this.getRasterBand(i + 1).getRasterDataType();
+		setDataType(dt);
+		shortName = getDriverShortName();
+		colorInterpr = new DataStoreColorInterpretation(getRasterCount());
+		fileTransparency = new DataStoreTransparency(colorInterpr);
+		metadata = new DataStoreMetadata(getMetadata(), colorInterpr);
+
+		// Asignamos la interpretaci?n de color leida por gdal a cada banda. Esto
+		// nos sirve para saber que banda de la imagen va asignada a cada banda de
+		// visualizaci?n (ARGB)
+		metadata.initNoDataByBand(getRasterCount());
+		for (int i = 0; i < getRasterCount(); i++) {
+			GdalRasterBand rb = getRasterBand(i + 1);
+			String colorInt = getColorInterpretationName(rb.getRasterColorInterpretation());
+			metadata.setNoDataEnabled(rb.existsNoDataValue());
+			if(rb.existsNoDataValue()) {
+				metadata.setNoDataValue(i, rb.getRasterNoDataValue());
+				metadata.setNoDataEnabled(rb.existsNoDataValue());
+			}
+			colorInterpr.setColorInterpValue(i, colorInt);
+			if (colorInt.equals("Alpha"))
+				fileTransparency.setTransparencyBand(i);
+
+			if (rb.getRasterColorTable() != null && palette == null) {
+				palette = new DataStoreColorTable(gdalColorTable2ColorItems(rb.getRasterColorTable()), false);
+//				fileTransparency.setTransparencyRangeList(palette.getTransparencyRange());
+			}
+		}
+		fileTransparency.setTransparencyByPixelFromMetadata(metadata);
+
+		try {
+			trans = getGeoTransform();
+                        if( !trans.isValid() ) {
+                            throw new GeoTransformException();
+                        }
+
+			double psX = trans.adfgeotransform[1];
+			double psY = trans.adfgeotransform[5];
+			double rotX = trans.adfgeotransform[4];
+			double rotY = trans.adfgeotransform[2];
+			double offX = trans.adfgeotransform[0];
+			double offY = trans.adfgeotransform[3];
+
+			ownTransformation = new AffineTransform(psX, rotX, rotY, psY, offX, offY);
+					//trans.adfgeotransform[1], trans.adfgeotransform[4], trans.adfgeotransform[2], trans.adfgeotransform[5], trans.adfgeotransform[0], trans.adfgeotransform[3]);
+			externalTransformation = (AffineTransform) ownTransformation.clone();
+			overviewWidth = width;
+			overviewHeight = height;
+
+			this.georeferenced = true;
+                } catch (GeoTransformException exc) {
+                    // Transformaci?n para ficheros sin georreferenciaci?n. Se invierte la Y
+                    // ya que las WC decrecen de
+                    // arriba a abajo y los pixeles crecen de arriba a abajo
+		    logger.warn("Can't retrieve transformation from file '"+fName+"' use default.");
+                    ownTransformation = new AffineTransform(1, 0, 0, -1, 0, height);
+                    externalTransformation = (AffineTransform) ownTransformation.clone();
+                    overviewWidth = width;
+                    overviewHeight = height;
+                    this.georeferenced = false;
+
+                } catch (Exception exc) {
+			// Transformaci?n para ficheros sin georreferenciaci?n. Se invierte la Y
+			// ya que las WC decrecen de
+			// arriba a abajo y los pixeles crecen de arriba a abajo
+		    logger.warn("Can't retrieve transformation from file '"+fName+"' use default.", exc);
+			ownTransformation = new AffineTransform(1, 0, 0, -1, 0, height);
+			externalTransformation = (AffineTransform) ownTransformation.clone();
+			overviewWidth = width;
+			overviewHeight = height;
+			this.georeferenced = false;
+
+		}
+	}
+
+	/**
+	 * Returns true if this provider is open and false if don't
+	 * @return
+	 */
+	public boolean isOpen() {
+		return open;
+	}
+
+	/**
+	 * Obtiene el flag que informa de si el raster tiene valor no data o no.
+	 * Consultar? todas las bandas del mismo y si alguna tiene valor no data
+	 * devuelve true sino devolver? false.
+	 * @return true si tiene valor no data y false si no lo tiene
+	 * @throws GdalException
+	 */
+	public boolean existsNoDataValue() throws GdalException {
+		for (int i = 0; i < getRasterCount(); i++) {
+			GdalRasterBand rb = getRasterBand(i + 1);
+			if (rb.existsNoDataValue())
+				return true;
+		}
+		return false;
+	}
+
+	/**
+	 * Obtiene el flag que informa de si el raster tiene valor no data o no
+	 * en una banda concreta.
+	 * @return true si tiene valor no data en esa banda y false si no lo tiene
+	 * @param band Posici?n de la banda a consultar (0..n)
+	 * @throws GdalException
+	 */
+	public boolean existsNoDataValue(int band) throws GdalException {
+		GdalRasterBand rb = getRasterBand(band + 1);
+		return rb.existsNoDataValue();
+	}
+
+	/**
+	 * Gets nodata value
+	 * @return
+	 */
+	public NoData getNoDataValue() {
+		Number value = null;
+		int type = getRasterBufTypeFromGdalType(getDataType()[0]);
+		if (metadata != null && metadata.isNoDataEnabled() && metadata.getNoDataValue().length > 0) {
+			switch (type) {
+			case Buffer.TYPE_BYTE:
+				if (metadata == null || metadata.getNoDataValue().length == 0)
+					value = new Byte(RasterLibrary.defaultByteNoDataValue);
+				else
+					value = new Byte((byte)metadata.getNoDataValue()[0]);
+				break;
+			case Buffer.TYPE_SHORT:
+				if (metadata == null || metadata.getNoDataValue().length == 0)
+					value = new Short(RasterLibrary.defaultShortNoDataValue);
+				else
+					value = new Short((short)metadata.getNoDataValue()[0]);
+				break;
+			case Buffer.TYPE_INT:
+				if (metadata == null || metadata.getNoDataValue().length == 0)
+					value = new Integer((int)RasterLibrary.defaultIntegerNoDataValue);
+				else
+					value = new Integer((int)metadata.getNoDataValue()[0]);
+				break;
+			case Buffer.TYPE_FLOAT:
+				if (metadata == null || metadata.getNoDataValue().length == 0)
+					value = new Float(RasterLibrary.defaultFloatNoDataValue);
+				else
+					value = new Float(metadata.getNoDataValue()[0]);
+				break;
+			case Buffer.TYPE_DOUBLE:
+				if (metadata == null || metadata.getNoDataValue().length == 0)
+					value = new Double(RasterLibrary.defaultFloatNoDataValue);
+				else
+					value = new Double(metadata.getNoDataValue()[0]);
+				break;
+			}
+		}
+
+		NoData nodata = new DefaultNoData(value, value, fileName);
+		nodata.setNoDataTransparent(false);
+		return nodata;
+	}
+
+	/**
+	 * Asigna el tipo de dato
+	 * @param dt entero que representa el tipo de dato
+	 */
+	public void setDataType(int[] dt) {
+		dataType = dt;
+	}
+
+	/**
+	 * Obtiene el tipo de dato
+	 * @return entero que representa el tipo de dato
+	 */
+	public int[] getDataType() {
+		return dataType;
+	}
+
+	/**
+	 * Gets the color interpretation
+	 * @return
+	 */
+	public ColorInterpretation getColorInterpretation() {
+		return colorInterpr;
+	}
+
+	/**
+	 * Gets the color table
+	 * @return
+	 */
+	public ColorTable getColorTable() {
+		return palette;
+	}
+
+	/**
+	 * Obtiene un punto 2D con las coordenadas del raster a partir de uno en coordenadas
+	 * del punto real.
+	 * Supone rasters no girados
+	 * @param pt	punto en coordenadas del punto real
+	 * @return	punto en coordenadas del raster
+	 */
+	public Point2D worldToRasterWithoutRot(Point2D pt) {
+		Point2D p = new Point2D.Double();
+		AffineTransform at = new AffineTransform(	externalTransformation.getScaleX(), 0,
+													0, externalTransformation.getScaleY(),
+													externalTransformation.getTranslateX(), externalTransformation.getTranslateY());
+		try {
+			at.inverseTransform(pt, p);
+		} catch (NoninvertibleTransformException e) {
+			return pt;
+		}
+		return p;
+	}
+
+	/**
+	 * Obtiene un punto 2D con las coordenadas del raster a partir de uno en coordenadas
+	 * del punto real.
+	 * Supone rasters no girados
+	 * @param pt	punto en coordenadas del punto real
+	 * @return	punto en coordenadas del raster
+	 */
+	public Point2D worldToRaster(Point2D pt) {
+		Point2D p = new Point2D.Double();
+		try {
+			externalTransformation.inverseTransform(pt, p);
+		} catch (NoninvertibleTransformException e) {
+			return pt;
+		}
+		return p;
+	}
+
+	/**
+	 * Obtiene un punto del raster en coordenadas pixel a partir de un punto en coordenadas
+	 * reales.
+	 * @param pt Punto en coordenadas reales
+	 * @return Punto en coordenadas pixel.
+	 */
+	public Point2D rasterToWorld(Point2D pt) {
+		Point2D p = new Point2D.Double();
+		externalTransformation.transform(pt, p);
+		return p;
+	}
+
+	/**
+	 * Calcula el overview a usar. Hay que tener en cuenta que tenemos que tener calculadas las variables
+	 * viewPortScale, currentFullWidth y currentFulHeight
+	 * @param coordenada pixel expresada en double que indica la posici?n superior izquierda
+	 * @throws GdalException
+	 */
+	private void calcOverview(Point2D tl, Point2D br) throws GdalException {
+		gdalBands[0] = getRasterBand(1);
+		currentOverview = -1;
+		if (gdalBands[0].getOverviewCount() > 0) {
+			GdalRasterBand ovb = null;
+			for (int i = gdalBands[0].getOverviewCount() - 1; i > 0; i--) {
+				ovb = gdalBands[0].getOverview(i);
+				if (ovb.getRasterBandXSize() > getRasterXSize() * viewportScaleX) {
+					currentOverview = i;
+					viewportScaleX *= ((double) width / (double) ovb.getRasterBandXSize());
+					viewportScaleY *= ((double) height / (double) ovb.getRasterBandYSize());
+					stepX = 1D / viewportScaleX;
+					stepY = 1D / viewportScaleY;
+					overviewWidth = ovb.getRasterBandXSize();
+					overviewHeight = ovb.getRasterBandYSize();
+					currentViewX = Math.min(tl.getX(), br.getX());
+					lastReadLine = Math.min(tl.getY(), br.getY());
+					break;
+				}
+			}
+		}
+	}
+
+	public void setView(double dWorldTLX, double dWorldTLY,
+						double dWorldBRX, double dWorldBRY,
+						int nWidth, int nHeight) throws GdalException {
+		overviewWidth = width;
+		overviewHeight = height;
+		Point2D tl = worldToRaster(new Point2D.Double(dWorldTLX, dWorldTLY));
+		Point2D br = worldToRaster(new Point2D.Double(dWorldBRX, dWorldBRY));
+		// Calcula cual es la primera l?nea a leer;
+		currentViewWidth = nWidth;
+		currentViewHeight = nHeight;
+//		wcWidth = Math.abs(br.getX() - tl.getX());
+
+		currentViewX = Math.min(tl.getX(), br.getX());
+
+		viewportScaleX = (double) currentViewWidth / (br.getX() - tl.getX());
+		viewportScaleY = (double) currentViewHeight / (br.getY() - tl.getY());
+		stepX = 1D / viewportScaleX;
+		stepY = 1D / viewportScaleY;
+
+		lastReadLine = Math.min(tl.getY(), br.getY());
+
+		//Para lectura del renderizado (ARGB). readWindow selecciona las bandas que necesita.
+
+		// calcula el overview a usar
+		gdalBands = new GdalRasterBand[4];
+		calcOverview(tl, br);
+	}
+
+	/**
+	 * Selecciona bandas y overview en el objeto GdalRasterBand[] para el n?mero de bandas solicitado.
+	 * @param nbands N?mero de bandas solicitado.
+	 * @throws GdalException
+	 */
+	public void selectGdalBands(int nbands) throws GdalException {
+		gdalBands = new GdalRasterBand[nbands];
+		// Selecciona las bandas y los overviews necesarios
+		gdalBands[0] = getRasterBand(1);
+		for (int i = 0; i < nbands; i++)
+			gdalBands[i] = gdalBands[0];
+
+		assignDataTypeFromGdalRasterBands(gdalBands);
+//		setDataType(gdalBands[0].getRasterDataType());
+
+		for (int i = 2; i <= nbands; i++) {
+			if (getRasterCount() >= i) {
+				gdalBands[i - 1] = getRasterBand(i);
+				for (int j = i; j < nbands; j++)
+					gdalBands[j] = gdalBands[i - 1];
+			}
+		}
+
+		if (currentOverview > 0) {
+			gdalBands[0] = gdalBands[0].getOverview(currentOverview);
+			for (int i = 2; i <= nbands; i++) {
+				if (getRasterCount() >= i)
+					gdalBands[i - 1] = gdalBands[i - 1].getOverview(currentOverview);
+			}
+		}
+	}
+
+	int lastY = -1;
+
+	/**
+	 * Lee una l?nea de bytes
+	 * @param line Buffer donde se cargan los datos
+	 * @param initOffset Desplazamiento inicial desde el margen inzquierdo. Esto es necesario para cuando
+	 * se supersamplea ya que cada pixel de imagen ocupa muchos pixeles de pantalla y puede empezar a dibujarse
+	 * por la izquierda a mitad de pixel
+	 * @param gdalBuffer Buffer con la l?nea de datos original
+	 */
+	private void readLine(byte[][] line, double initOffset, GdalBuffer[] gdalBuffer) {
+		double j = 0D;
+		int i = 0;
+		for (int iBand = 0; iBand < gdalBuffer.length; iBand++) {
+			for (i = 0, j = initOffset; i < currentViewWidth && j < gdalBuffer[0].getSize(); i++, j += stepX) {
+				line[iBand][i] = gdalBuffer[iBand].buffByte[(int) j];
+			}
+		}
+	}
+
+	/**
+	 * Lee una l?nea de shorts
+	 * @param line Buffer donde se cargan los datos
+	 * @param initOffset Desplazamiento inicial desde el margen inzquierdo. Esto es necesario para cuando
+	 * se supersamplea ya que cada pixel de imagen ocupa muchos pixeles de pantalla y puede empezar a dibujarse
+	 * por la izquierda a mitad de pixel
+	 * @param gdalBuffer Buffer con la l?nea de datos original
+	 */
+	private void readLine(short[][] line, double initOffset, GdalBuffer[] gdalBuffer) {
+		double j = 0D;
+		int i = 0;
+		for (int iBand = 0; iBand < gdalBuffer.length; iBand++) {
+			for (i = 0, j = initOffset; i < currentViewWidth && j < gdalBuffer[0].getSize(); i++, j += stepX) {
+				line[iBand][i] = (short) (gdalBuffer[iBand].buffShort[(int) j] & 0xffff);
+			}
+		}
+	}
+
+	/**
+	 * Lee una l?nea de ints
+	 * @param line Buffer donde se cargan los datos
+	 * @param initOffset Desplazamiento inicial desde el margen inzquierdo. Esto es necesario para cuando
+	 * se supersamplea ya que cada pixel de imagen ocupa muchos pixeles de pantalla y puede empezar a dibujarse
+	 * por la izquierda a mitad de pixel
+	 * @param gdalBuffer Buffer con la l?nea de datos original
+	 */
+	private void readLine(int[][] line, double initOffset, GdalBuffer[] gdalBuffer) {
+		double j = 0D;
+		int i = 0;
+		for (int iBand = 0; iBand < gdalBuffer.length; iBand++) {
+			for (i = 0, j = initOffset; i < currentViewWidth && j < gdalBuffer[0].getSize(); i++, j += stepX) {
+				line[iBand][i] = (gdalBuffer[iBand].buffInt[(int) j] & 0xffffffff);
+			}
+		}
+	}
+
+	/**
+	 * Lee una l?nea de float
+	 * @param line Buffer donde se cargan los datos
+	 * @param initOffset Desplazamiento inicial desde el margen izquierdo. Esto es necesario para cuando
+	 * se supersamplea ya que cada pixel de imagen ocupa muchos pixeles de pantalla y puede empezar a dibujarse
+	 * por la izquierda a mitad de pixel
+	 * @param gdalBuffer Buffer con la l?nea de datos original
+	 */
+	private void readLine(float[][] line, double initOffset, GdalBuffer[] gdalBuffer) {
+		double j = 0D;
+		int i = 0;
+		for (int iBand = 0; iBand < gdalBuffer.length; iBand++) {
+			for (i = 0, j = initOffset; i < currentViewWidth && j < gdalBuffer[0].getSize(); i++, j += stepX) {
+				line[iBand][i] = gdalBuffer[iBand].buffFloat[(int) j];
+			}
+		}
+	}
+
+	/**
+	 * Lee una l?nea de doubles
+	 * @param line Buffer donde se cargan los datos
+	 * @param initOffset Desplazamiento inicial desde el margen inzquierdo. Esto es necesario para cuando
+	 * se supersamplea ya que cada pixel de imagen ocupa muchos pixeles de pantalla y puede empezar a dibujarse
+	 * por la izquierda a mitad de pixel
+	 * @param gdalBuffer Buffer con la l?nea de datos original
+	 */
+	private void readLine(double[][] line, double initOffset, GdalBuffer[] gdalBuffer) {
+		double j = 0D;
+		int i = 0;
+		for (int iBand = 0; iBand < gdalBuffer.length; iBand++) {
+			for (i = 0, j = initOffset; i < currentViewWidth && j < gdalBuffer[0].getSize(); i++, j += stepX) {
+				line[iBand][i] = gdalBuffer[iBand].buffDouble[(int) j];
+			}
+		}
+	}
+
+	/**
+	 * Lee una l?nea completa del raster y devuelve un array del tipo correcto. Esta funci?n es util
+	 * para una lectura rapida de todo el fichero sin necesidad de asignar vista.
+	 * @param nLine N?mero de l?nea a leer
+	 * @param band Banda requerida
+	 * @return Object que es un array unidimendional del tipo de datos del raster
+	 * @throws GdalException
+	 */
+	public Object readCompleteLine(int nLine, int band) throws GdalException {
+		GdalRasterBand gdalBand = super.getRasterBand(band + 1);
+		GdalBuffer gdalBuf = null;
+
+		gdalBuf = gdalBand.readRaster(0, nLine, getRasterXSize(), 1, getRasterXSize(), 1, dataType[band]);
+
+		if (dataType[band] == GDT_Byte)
+			return gdalBuf.buffByte;
+
+		if (dataType[band] == GDT_Int16 || dataType[band] == GDT_UInt16)
+			return gdalBuf.buffShort;
+
+		if (dataType[band] == GDT_Int32 || dataType[band] == GDT_UInt32)
+			return gdalBuf.buffInt;
+
+		if (dataType[band] == GDT_Float32)
+			return gdalBuf.buffFloat;
+
+		if (dataType[band] == GDT_Float64)
+			return gdalBuf.buffDouble;
+
+		if (dataType[band] == GDT_CInt16 || dataType[band] == GDT_CInt32 ||
+				dataType[band] == GDT_CFloat32 || dataType[band] == GDT_CFloat64)
+			return null;
+
+		return null;
+	}
+
+	/**
+	 * Lee una bloque completo del raster y devuelve un array tridimensional del tipo correcto. Esta funci?n es util
+	 * para una lectura rapida de todo el fichero sin necesidad de asignar vista.
+	 * @param nLine N?mero de l?nea a leer
+	 * @param band Banda requerida
+	 * @return Object que es un array unidimendional del tipo de datos del raster
+	 * @throws GdalException
+	 */
+	public Object readBlock(int pos, int blockHeight, double scale) throws GdalException, ProcessInterruptedException {
+		bBandNr = super.getRasterCount();
+		int widthBuffer = (int)(getRasterXSize() * scale);
+		int heightBuffer = (int)(blockHeight * scale);
+
+		RasterTask task = RasterTaskQueue.get(Thread.currentThread().getId() + "");
+
+		GdalRasterBand[] gdalBand = new GdalRasterBand[bBandNr];
+		for (int iBand = 0; iBand < gdalBand.length; iBand++)
+			gdalBand[iBand] = super.getRasterBand(iBand + 1);
+
+		GdalBuffer[] gdalBuf = new GdalBuffer[bBandNr];
+
+		if (dataType[0] == GDT_Byte) {
+			byte[][][] buf = new byte[bBandNr][heightBuffer][widthBuffer];
+			for (int iBand = 0; iBand < gdalBuf.length; iBand++) {
+				gdalBuf[iBand] = gdalBand[iBand].readRaster(0, pos, getRasterXSize(), blockHeight, widthBuffer, heightBuffer, dataType[0]);
+				for (int iRow = 0; iRow < heightBuffer; iRow++) {
+					for (int iCol = 0; iCol < widthBuffer; iCol++)
+						buf[iBand][iRow][iCol] = gdalBuf[iBand].buffByte[iRow * widthBuffer + iCol];
+					if(task.getEvent() != null)
+						task.manageEvent(task.getEvent());
+				}
+				gdalBuf[iBand].buffByte = null;
+			}
+			return buf;
+		} else if (dataType[0] == GDT_CInt16 || dataType[0] == GDT_Int16  || dataType[0] == GDT_UInt16) {
+			short[][][] buf = new short[bBandNr][heightBuffer][widthBuffer];
+			for (int iBand = 0; iBand < gdalBuf.length; iBand++) {
+				gdalBuf[iBand] = gdalBand[iBand].readRaster(0, pos, getRasterXSize(), blockHeight, widthBuffer, heightBuffer, dataType[0]);
+				for (int iRow = 0; iRow < heightBuffer; iRow++) {
+					for (int iCol = 0; iCol < widthBuffer; iCol++)
+						buf[iBand][iRow][iCol] = gdalBuf[iBand].buffShort[iRow * widthBuffer + iCol];
+					if(task.getEvent() != null)
+						task.manageEvent(task.getEvent());
+				}
+				gdalBuf[iBand].buffShort = null;
+			}
+			return buf;
+		} else if (dataType[0] == GDT_CInt32 || dataType[0] == GDT_Int32  || dataType[0] == GDT_UInt32) {
+			int[][][] buf = new int[bBandNr][heightBuffer][widthBuffer];
+			for (int iBand = 0; iBand < gdalBuf.length; iBand++) {
+				gdalBuf[iBand] = gdalBand[iBand].readRaster(0, pos, getRasterXSize(), blockHeight, widthBuffer, heightBuffer, dataType[0]);
+				for (int iRow = 0; iRow < heightBuffer; iRow++) {
+					for (int iCol = 0; iCol < widthBuffer; iCol++)
+						buf[iBand][iRow][iCol] = gdalBuf[iBand].buffInt[iRow * widthBuffer + iCol];
+					if(task.getEvent() != null)
+						task.manageEvent(task.getEvent());
+				}
+				gdalBuf[iBand].buffInt = null;
+			}
+			return buf;
+		} else if(dataType[0] == GDT_Float32 || dataType[0] == GDT_CFloat32) {
+			float[][][] buf = new float[bBandNr][heightBuffer][widthBuffer];
+			for (int iBand = 0; iBand < gdalBuf.length; iBand++) {
+				gdalBuf[iBand] = gdalBand[iBand].readRaster(0, pos, getRasterXSize(), blockHeight, widthBuffer, heightBuffer, dataType[0]);
+				for (int iRow = 0; iRow < heightBuffer; iRow++) {
+					for (int iCol = 0; iCol < widthBuffer; iCol++)
+						buf[iBand][iRow][iCol] = gdalBuf[iBand].buffFloat[iRow * widthBuffer + iCol];
+					if(task.getEvent() != null)
+						task.manageEvent(task.getEvent());
+				}
+				gdalBuf[iBand].buffFloat = null;
+			}
+			return buf;
+		} else if(dataType[0] == GDT_Float64 || dataType[0] == GDT_CFloat64) {
+			double[][][] buf = new double[bBandNr][heightBuffer][widthBuffer];
+			for (int iBand = 0; iBand < gdalBuf.length; iBand++) {
+				gdalBuf[iBand] = gdalBand[iBand].readRaster(0, pos, getRasterXSize(), blockHeight, widthBuffer, heightBuffer, dataType[0]);
+				for (int iRow = 0; iRow < heightBuffer; iRow++) {
+					for (int iCol = 0; iCol < widthBuffer; iCol++)
+						buf[iBand][iRow][iCol] = gdalBuf[iBand].buffDouble[iRow * widthBuffer + iCol];
+					if(task.getEvent() != null)
+						task.manageEvent(task.getEvent());
+				}
+				gdalBuf[iBand].buffDouble = null;
+			}
+			return buf;
+		}
+
+		return null;
+	}
+
+	/**
+	 * Lectura de una l?nea de datos.
+	 * @param line
+	 * @throws GdalException
+	 */
+	public void readLine(Object line) throws GdalException {
+		int w = (int) (Math.ceil(((double)currentViewWidth)*stepX) + 1);
+		int x = (int) (currentViewX);
+		int y = (int) (lastReadLine);
+		GdalBuffer r = null, g = null, b = null;
+		GdalBuffer a = new GdalBuffer();
+
+		while(y >= gdalBands[0].getRasterBandYSize())
+			y--;
+
+		if (x+w > gdalBands[0].getRasterBandXSize())
+			w = gdalBands[0].getRasterBandXSize()-x;
+
+		if(gdalBands[0].getRasterColorTable() != null) {
+			palette = new DataStoreColorTable(gdalColorTable2ColorItems(gdalBands[0].getRasterColorTable()), false);
+			r = gdalBands[0].readRaster(x, y, w, 1, w, 1, dataType[0]);
+		} else {
+			a.buffByte = new byte[w];
+			r = gdalBands[0].readRaster(x, y, w, 1, w, 1, dataType[0]);
+			g = b = r;
+			if (getRasterCount() > 1 && gdalBands[1] != null)
+				g = gdalBands[1].readRaster(x, y, w, 1, w, 1, dataType[0]);
+			if (getRasterCount() > 2 && gdalBands[2] != null)
+				b = gdalBands[2].readRaster(x, y, w, 1, w, 1, dataType[0]);
+		}
+
+		lastReadLine += stepY;
+
+		double initOffset =  Math.abs(currentViewX - ((int)currentViewX));
+		GdalBuffer[] bands = {r, g, b};
+
+		if (dataType[0] == GDT_Byte)
+			readLine((byte[][])line, initOffset, bands);
+		else if (dataType[0] == GDT_CInt16 || dataType[0] == GDT_Int16  || dataType[0] == GDT_UInt16)
+			readLine((short[][])line, initOffset, bands);
+		else if (dataType[0] == GDT_CInt32 || dataType[0] == GDT_Int32  || dataType[0] == GDT_UInt32)
+			readLine((int[][])line, initOffset, bands);
+		else if(dataType[0] == GDT_Float32 || dataType[0] == GDT_CFloat32)
+			readLine((float[][])line, initOffset, bands);
+		else if(dataType[0] == GDT_Float64 || dataType[0] == GDT_CFloat64)
+			readLine((double[][])line, initOffset, bands);
+
+		return;
+	}
+
+	private List<ColorItem> gdalColorTable2ColorItems(GdalColorTable table) {
+		try {
+			List<ColorItem> colorItems = new ArrayList<ColorItem>();
+			for (int iEntry = 0; iEntry < table.getColorEntryCount(); iEntry++) {
+				GdalColorEntry entry = table.getColorEntryAsRGB(iEntry);
+
+				ColorItem colorItem = new ColorItemImpl();
+				colorItem.setNameClass("");
+				colorItem.setValue(iEntry);
+				colorItem.setColor(new Color(	(int) (entry.c1 & 0xff),
+																			(int) (entry.c2 & 0xff),
+																			(int) (entry.c3 & 0xff),
+																			(int) (entry.c4 & 0xff)));
+
+				colorItems.add(colorItem);
+			}
+			return colorItems;
+		} catch (GdalException ex) {
+			// No se crea la paleta
+		}
+		return null;
+	}
+
+
+	/**
+	 * Cuando se hace una petici?n de carga de buffer la extensi?n pedida puede
+	 * estar ajustada a la extensi?n del raster o no estarlo. En caso de no
+	 * estarlo los pixeles del buffer que caen fuera de la extensi?n del raster
+	 * tendr?n valor de NoData. Esta funci?n calcula en que pixel del buffer hay
+	 * que empezar a escribir en caso de que este sea mayor que los datos a leer.
+	 *
+	 * @param dWorldTLX Posici?n X superior izquierda en coord reales
+	 * @param dWorldTLY Posici?n Y superior izquierda en coord reales
+	 * @param dWorldBRX Posici?n X inferior derecha en coord reales
+	 * @param dWorldBRY Posici?n Y inferior derecha en coord reales
+	 * @param nWidth Ancho en pixeles del buffer
+	 * @param nHeight Alto en pixeles del buffer
+	 * @return desplazamiento dentro del buffer en X e Y
+	 */
+	private int[] calcStepBuffer(Extent dataExtent, int nWidth, int nHeight, int[] stpBuffer) {
+		Extent imageExtent = getExtentWithoutRot();
+		Extent ajustDataExtent = RasterLocator.getManager().getRasterUtils().calculateAdjustedView(dataExtent, imageExtent);
+		if(!RasterLocator.getManager().getRasterUtils().compareExtents(dataExtent, ajustDataExtent)){
+			Point2D p1 = worldToRasterWithoutRot(new Point2D.Double(ajustDataExtent.minX(), ajustDataExtent.maxY()));
+			Point2D p2 = worldToRasterWithoutRot(new Point2D.Double(ajustDataExtent.maxX(), ajustDataExtent.minY()));
+			Point2D p3 = worldToRasterWithoutRot(new Point2D.Double(dataExtent.minX(), dataExtent.maxY()));
+			//    		Point2D p4 = worldToRasterWithoutRot(new Point2D.Double(dataExtent.maxX(), dataExtent.minY()));
+			//Ese es el ancho y alto q tendr?a el buffer en caso de haberse ajustado
+			int w = (int)Math.abs(Math.ceil(p2.getX()) - Math.floor(p1.getX()));
+			int h = (int)Math.abs(Math.floor(p1.getY()) - Math.ceil(p2.getY()));
+
+			stpBuffer[0] = (int)(p1.getX() + (-p3.getX()));
+			stpBuffer[1] = (int)(p1.getY() + (-p3.getY()));
+			stpBuffer[2] = stpBuffer[0] + w;
+			stpBuffer[3] = stpBuffer[1] + h;
+			return new int[]{w, h};
+		}
+		return new int[]{nWidth, nHeight};
+	}
+
+	/**
+	 * Lee una ventana de datos sin resampleo a partir de coordenadas reales.
+	 * @param buf Buffer donde se almacenan los datos
+	 * @param bandList Lista de bandas que queremos leer y sobre que bandas del buffer de destino queremos escribirlas
+	 * @param dWorldTLX Posici?n X superior izquierda en coord reales
+	 * @param dWorldTLY Posici?n Y superior izquierda en coord reales
+	 * @param dWorldBRX Posici?n X inferior derecha en coord reales
+	 * @param dWorldBRY Posici?n Y inferior derecha en coord reales
+	 * @param nWidth Ancho en pixeles del buffer
+	 * @param nHeight Alto en pixeles del buffer
+	 * @throws GdalException
+	 */
+	public void readWindow(Buffer buf, BandList bandList, double ulx, double uly,double lrx, double lry,
+			int nWidth, int nHeight, boolean adjustToExtent, TaskStatus status) throws GdalException, ProcessInterruptedException {
+		Extent petExtent = new ExtentImpl(ulx, uly, lrx, lry);
+		setView(ulx, uly, lrx, lry, nWidth, nHeight);
+		Point2D tl = worldToRaster(new Point2D.Double(ulx, uly));
+		Point2D br = worldToRaster(new Point2D.Double(lrx, lry));
+
+		if(tl.getX() > br.getX())
+			tl.setLocation(tl.getX() - 1, tl.getY());
+		else
+			br.setLocation(br.getX() - 1, br.getY());
+
+		if(tl.getY() > br.getY())
+			tl.setLocation(tl.getX(), tl.getY() - 1);
+		else
+			br.setLocation(br.getX(), br.getY() - 1);
+
+		if(gdalBands.length == 0)
+			return;
+
+		selectGdalBands(/*buf.getBandCount()*/getRasterCount());
+
+		int x = (int) Math.round(Math.min(tl.getX(), br.getX()));
+		int y = (int) Math.round(Math.min(tl.getY(), br.getY()));
+
+		int[] stpBuffer = new int[]{0, 0 , buf.getWidth(), buf.getHeight()};
+		//Si el buffer no se ajusta al extent entonces calculamos en que posici?n comienza a escribirse dentro del buffer
+		//ya que lo que cae fuera ser?n valores NoData
+		if(!adjustToExtent){
+			int[] wh = calcStepBuffer(petExtent, nWidth, nHeight, stpBuffer);
+			if(x < 0)
+				x  = 0;
+			if(y < 0)
+				y  = 0;
+			readDataCachedBuffer(buf, bandList, new int[]{x, y, wh[0], wh[1]},
+					wh[0], wh[1], 0, 0, stpBuffer, status);
+			return;
+		}
+
+		readDataCachedBuffer(buf, bandList, new int[]{x, y, nWidth, nHeight},
+				nWidth, nHeight, 0, 0, stpBuffer, status);
+	}
+
+	public void readWindow(Buffer buf, BandList bandList, Extent ext, Rectangle adjustedWindow, TaskStatus status) throws GdalException, ProcessInterruptedException {
+		setView(ext.getULX(), ext.getULY(), ext.getLRX(), ext.getLRY(), buf.getWidth(), buf.getHeight());
+
+		if(gdalBands.length == 0)
+			return;
+
+		selectGdalBands(getRasterCount());
+
+		int[] stpBuffer = new int[]{0, 0 , buf.getWidth(), buf.getHeight()};
+
+		adjustedWindow = getAdjustedWindowInOverviewCoordinates(adjustedWindow);
+
+		readDataCachedBuffer(buf,
+				bandList,
+				new int[]{(int)adjustedWindow.getX(), (int)adjustedWindow.getY(), (int)adjustedWindow.getWidth(), (int)adjustedWindow.getHeight()},
+				buf.getWidth(),
+				buf.getHeight(),
+				0, 0, stpBuffer, status);
+	}
+
+	/**
+	 * Adjust the request rectangle to the overview size. The requests in Gdal have to be
+	 * in the overview scale
+	 * @param adjustedWindow
+	 * @return
+	 */
+	private Rectangle getAdjustedWindowInOverviewCoordinates(Rectangle adjustedWindow) {
+		int nWidth = (int)(((long)adjustedWindow.getWidth() * overviewWidth) / width);
+		int nHeight = (int)(((long)adjustedWindow.getHeight() * overviewHeight) / height);
+		int x = (int)(((long)adjustedWindow.getX() * (long)overviewWidth) / (long)width);
+		int y = (int) (((long)adjustedWindow.getY() * (long)overviewHeight) / (long)height);
+		return new Rectangle(x, y, nWidth, nHeight);
+	}
+
+	/**
+	 * Lee una ventana de datos con resampleo a partir de coordenadas reales. Este m?todo lee la
+	 * ventana de una vez cargando los datos de un golpe en el buffer. Las coordenadas se solicitan
+	 * en coordenadas del mundo real por lo que estas pueden caer en cualquier parte de un pixel.
+	 * Esto se hace m?s evidente cuando supersampleamos en la petici?n, es decir el buffer de de
+	 * mayor tama?o que el n?mero de pixels solicitado.
+	 *
+	 * Para resolver esto escribiremos con la funci?n readRaster los datos sobre un buffer mayor
+	 * que el solicitado. Despu?s calcularemos el desplazamiento en pixels dentro de este buffer
+	 * de mayor tama?o hasta llegar a la coordenada real donde comienza la petici?n real que ha
+	 * hecho el usuario. Esto es as? porque cuando supersampleamos no queremos los pixeles del
+	 * raster de disco completos sino que en los bordes del buffer quedan cortados.
+	 *
+	 * @param buf Buffer donde se almacenan los datos
+	 * @param bandList Lista de bandas que queremos leer y sobre que bandas del buffer de destino queremos escribirlas
+	 * @param dWorldTLX Posici?n X superior izquierda en coord reales
+	 * @param dWorldTLY Posici?n Y superior izquierda en coord reales
+	 * @param dWorldBRX Posici?n X inferior derecha en coord reales
+	 * @param dWorldBRY Posici?n Y inferior derecha en coord reales
+	 * @param nWidth Ancho en pixeles de la petici?n
+	 * @param nHeight Alto en pixeles de la petici?n
+	 * @param bufWidth Ancho del buffer
+	 * @param bufHeight Alto del buffer
+	 * @throws GdalException
+	 */
+	public void readWindow(Buffer buf, BandList bandList, double ulx, double uly, double lrx, double lry,
+							double nWidth, double nHeight, int bufWidth, int bufHeight, boolean adjustToExtent, TaskStatus status) throws GdalException, ProcessInterruptedException {
+		Extent petExtent = new ExtentImpl(ulx, uly, lrx, lry);
+		setView(ulx, uly, lrx, lry, bufWidth, bufHeight);
+		Point2D ul = worldToRaster(new Point2D.Double(ulx, uly));
+		Point2D lr = worldToRaster(new Point2D.Double(lrx, lry));
+		ul.setLocation(ul.getX() < 0 ? 1 : ul.getX(), ul.getY() < 0 ? 1 : ul.getY());
+		lr.setLocation(lr.getX() < 0 ? 1 : lr.getX(), lr.getY() < 0 ? 1 : lr.getY());
+		ul.setLocation(ul.getX() - 0.5, ul.getY() - 0.5);
+		lr.setLocation(lr.getX() - 0.5, lr.getY() - 0.5);
+
+		adjustPoints(ul, lr);
+
+		if(gdalBands.length == 0)
+			return;
+
+		selectGdalBands(/*buf.getBandCount()*/getRasterCount());
+
+		Rectangle requestWindow = new Rectangle(
+				(int) Math.min(ul.getX(), lr.getX()),
+				(int) Math.min(ul.getY(), lr.getY()),
+				(int)nWidth,
+				(int)nHeight);
+
+		requestWindow = getAdjustedWindowInOverviewCoordinates(requestWindow);
+
+		int[] stpBuffer = new int[]{0, 0 , buf.getWidth(), buf.getHeight()};
+		//Si el buffer no se ajusta al extent entonces calculamos en que posici?n comienza a escribirse dentro del buffer
+		//ya que lo que cae fuera ser?n valores NoData
+		if(!adjustToExtent){
+			int[] wh = calcStepBuffer(petExtent, bufWidth, bufHeight, stpBuffer);
+			if(requestWindow.getX() < 0)
+				requestWindow.setLocation(0, (int)requestWindow.getY());
+			if(requestWindow.getY() < 0)
+				requestWindow.setLocation((int)requestWindow.getX(), 0);
+			stpBuffer[0] = (int)((stpBuffer[0] * bufWidth) / requestWindow.getWidth());
+			stpBuffer[1] = (int)((stpBuffer[1] * bufHeight) / requestWindow.getHeight());
+			stpBuffer[2] = (int)((stpBuffer[2] * bufWidth) / requestWindow.getWidth());
+			stpBuffer[3] = (int)((stpBuffer[3] * bufHeight) / requestWindow.getHeight());
+			bufWidth = (int)Math.abs(stpBuffer[2] - stpBuffer[0]);
+			bufHeight = (int)Math.abs(stpBuffer[3] - stpBuffer[1]);
+			readDataCachedBuffer(buf, bandList,
+					new int[]{(int)requestWindow.getX(), (int)requestWindow.getY(), wh[0], wh[1]},
+						bufWidth, bufHeight, 0, 0, stpBuffer, status);
+			return;
+		}
+
+		if ((requestWindow.getX() + requestWindow.getWidth()) > gdalBands[0].getRasterBandXSize())
+			requestWindow.setSize((int)(gdalBands[0].getRasterBandXSize() - requestWindow.getX()), (int)requestWindow.getHeight());
+
+		if ((requestWindow.getY() + requestWindow.getHeight()) > gdalBands[0].getRasterBandYSize())
+			requestWindow.setSize((int)requestWindow.getWidth(), (int)(gdalBands[0].getRasterBandYSize() - requestWindow.getY()));
+
+		readDataCachedBuffer(buf, bandList,
+				new int[]{(int)requestWindow.getX(), (int)requestWindow.getY(), (int)requestWindow.getWidth(), (int)requestWindow.getHeight()},
+				bufWidth, bufHeight, 0, 0, stpBuffer, status);
+	}
+
+	private void adjustPoints(Point2D ul, Point2D lr) {
+		double a = (ul.getX() - (int)ul.getX());
+		double b = (ul.getY() - (int)ul.getY());
+		ul.setLocation(	(a > 0.95 || a < 0.05) ? Math.round(ul.getX()) : ul.getX(),
+						(b > 0.95 || b < 0.05) ? Math.round(ul.getY()) : ul.getY());
+		lr.setLocation(	(a > 0.95 || a < 0.05) ? Math.round(lr.getX()) : lr.getX(),
+						(b > 0.95 || b < 0.05) ? Math.round(lr.getY()) : lr.getY());
+	}
+
+	/**
+	 * Lee una ventana de datos con resampleo a partir de coordenadas en pixeles. Este m?todo lee la
+	 * ventana de una vez cargando los datos de un golpe en el buffer.
+	 * @param buf Buffer donde se almacenan los datos
+	 * @param bandList Lista de bandas que queremos leer y sobre que bandas del buffer de destino queremos escribirlas
+	 * @param x Posici?n X en pixeles
+	 * @param y Posici?n Y en pixeles
+	 * @param w Ancho en pixeles
+	 * @param h Alto en pixeles
+	 * @param bufWidth Ancho del buffer
+	 * @param bufHeight Alto del buffer
+	 * @throws GdalException
+	 */
+	public void readWindow(Buffer buf, BandList bandList, int x, int y, int w, int h, TaskStatus status) throws GdalException, ProcessInterruptedException {
+		gdalBands = new GdalRasterBand[getRasterCount()];
+
+		if(buf.getWidth() == w && buf.getHeight() == h)
+			isSupersampling = false;
+
+		if(gdalBands.length == 0)
+			return;
+
+		// Selecciona las bandas
+		gdalBands[0] = getRasterBand(1);
+
+		for(int iBand = 1; iBand < gdalBands.length; iBand++)
+			gdalBands[iBand] = getRasterBand(iBand + 1);
+
+		assignDataTypeFromGdalRasterBands(gdalBands);
+
+		int[] stpBuffer = new int[]{0, 0 , buf.getWidth(), buf.getHeight()};
+		readDataCachedBuffer(buf, bandList, new int[]{x, y, w, h}, buf.getWidth(), buf.getHeight(), 0, 0, stpBuffer, status);
+	}
+
+	/**
+	 * Asigna el tipo de datos de las bandas a partir de una lista de GdalRasterBands
+	 * @param gdalBands
+	 * @throws GdalException
+	 */
+	private void assignDataTypeFromGdalRasterBands(GdalRasterBand[] gdalBands) throws GdalException {
+		int[] dt = new int[gdalBands.length];
+		for (int i = 0; i < gdalBands.length; i++) {
+			if(gdalBands[i] != null)
+				dt[i] = gdalBands[i].getRasterDataType();
+		}
+		setDataType(dt);
+	}
+
+	/**
+	 * Lee una ventana de datos. Esta funci?n es usuada por
+	 * readWindow para coordenadas reales y readWindow en coordenadas pixel. Esta es una versi?n de readData pero
+	 * comprueba si el buffer es cacheado y si lo es pide por trozos para no intentar cargar desde gdal demasiados
+	 * datos.
+	 * @param buf Buffer donde se almacenan los datos
+	 * @param bandList Lista de bandas que queremos leer y sobre que bandas del buffer de destino queremos escribirlas
+	 * @param inputWindow
+	 * <UL>
+	 * <LI>inputWindow[0]:Posici?n X en pixeles de la imagen de entrada</LI>
+	 * <LI>inputWindow[1]:Posici?n Y en pixeles de la imagen de entrada</LI>
+	 * <LI>inputWindow[2]:Ancho en p?xeles a leer de la imagen de entrada</LI>
+	 * <LI>inputWindow[3]:Alto en p?xeles a leer de la imagen de entrada</LI>
+	 * </UL>
+	 * @param bufWidth Ancho del buffer de la imagen de entrada. Si no coincide con inputWindow[2] el propio gdal resamplea
+	 * @param bufHeight Alto del buffer de la imagen de entrada. Si no coincide con inputWindow[3] el propio gdal resamplea
+	 * @param stepX Desplazamiento en p?xeles en X a partir de la posici?n x. Este desplazamiento es util cuando hay un
+	 * supersampleo ya que puede ser que de los pixeles que est?n en el borde izquierdo de la petici?n solo queramos una
+	 * parte de ellos.
+	 * @param stepY Desplazamiento en p?xeles en Y a partir de la posici?n y. Este desplazamiento es util cuando hay un
+	 * supersampleo ya que puede ser que de los p?xeles que est?n en el borde superior de la petici?n solo queramos una
+	 * parte de ellos.
+	 * @param stepBuffer El buffer puede empezar a escribirse a partir de un pixel determinado y acabar de escribir antes
+	 * de fin de buffer. Este par?metro indica el desplazamiento desde el inicio del buffer y la posici?n final.
+	 * <UL>
+	 * <LI>stepBuffer[0]:Desplazamiento en X desde el inicio</LI>
+	 * <LI>stepBuffer[1]:Desplazamiento en Y desde el inicio</LI>
+	 * <LI>stepBuffer[2]:Posici?n X final m?s uno</LI>
+	 * <LI>stepBuffer[3]:Posici?n Y final m?s uno</LI>
+	 * </UL>
+	 * @throws GdalException
+	 */
+	private void readDataCachedBuffer(Buffer buf,
+			BandList bandList,
+			int[] inputWindow,
+			int bufWidth,
+			int bufHeight,
+			int stpX,
+			int stpY,
+			int[] stepBuffer,
+			TaskStatus status) throws GdalException, ProcessInterruptedException {
+		if(buf.isCached()) {
+			int nBlocks = (int)(buf.getHeight() / buf.getBlockHeight());
+			int lastblock = buf.getHeight() - (nBlocks * buf.getBlockHeight());
+			if(lastblock > 0)
+				nBlocks ++;
+			int initYSrc = inputWindow[1];
+			int stepYSrc = (buf.getBlockHeight() * inputWindow[3]) / buf.getHeight();
+			int lastBlockYSrc = (lastblock * inputWindow[3]) / buf.getHeight();
+			int initYBuffer = 0;
+			for (int i = 0; i < nBlocks; i++) {
+				if(lastblock > 0 && i == (nBlocks - 1)) {
+					int[] newStepBuffer = new int[]{0, initYBuffer, stepBuffer[2], initYBuffer + lastblock};
+					int[] newWindow = new int[]{inputWindow[0], initYSrc, inputWindow[2], lastBlockYSrc};
+					readData(buf,
+							bandList,
+							newWindow,
+							bufWidth, lastblock, 0, 0, newStepBuffer);
+				} else {
+					int[] newStepBuffer = new int[]{0, initYBuffer, stepBuffer[2], initYBuffer + buf.getBlockHeight()};
+					int[] newWindow = new int[]{inputWindow[0], initYSrc, inputWindow[2], stepYSrc};
+					readData(buf,
+							bandList,
+							newWindow,
+							bufWidth, buf.getBlockHeight(), 0, 0, newStepBuffer);
+					initYSrc += stepYSrc;
+					initYBuffer += buf.getBlockHeight();
+				}
+			}
+		} else {
+			readData(buf, bandList, inputWindow, bufWidth, bufHeight, 0, 0, stepBuffer);
+		}
+	}
+
+	/**
+	 * Lee una ventana de datos. Esta funci?n es usuada por
+	 * readWindow para coordenadas reales y readWindow en coordenadas pixel.
+	 * @param buf Buffer donde se almacenan los datos
+	 * @param bandList Lista de bandas que queremos leer y sobre que bandas del buffer de destino queremos escribirlas
+	 * @param inputWindow
+	 * <UL>
+	 * <LI>inputWindow[0]:Posici?n X en pixeles de la imagen de entrada</LI>
+	 * <LI>inputWindow[1]:Posici?n Y en pixeles de la imagen de entrada</LI>
+	 * <LI>inputWindow[2]:Ancho en p?xeles a leer de la imagen de entrada</LI>
+	 * <LI>inputWindow[3]:Alto en p?xeles a leer de la imagen de entrada</LI>
+	 * </UL>
+	 * @param bufWidth Ancho del buffer de la imagen de entrada. Si no coincide con inputWindow[2] el propio gdal resamplea
+	 * @param bufHeight Alto del buffer de la imagen de entrada. Si no coincide con inputWindow[3] el propio gdal resamplea
+	 * @param stepX Desplazamiento en p?xeles en X a partir de la posici?n x. Este desplazamiento es util cuando hay un
+	 * supersampleo ya que puede ser que de los pixeles que est?n en el borde izquierdo de la petici?n solo queramos una
+	 * parte de ellos.
+	 * @param stepY Desplazamiento en p?xeles en Y a partir de la posici?n y. Este desplazamiento es util cuando hay un
+	 * supersampleo ya que puede ser que de los p?xeles que est?n en el borde superior de la petici?n solo queramos una
+	 * parte de ellos.
+	 * @param stepBuffer El buffer puede empezar a escribirse a partir de un pixel determinado y acabar de escribir antes
+	 * de fin de buffer. Este par?metro indica el desplazamiento desde el inicio del buffer y la posici?n final.
+	 * <UL>
+	 * <LI>stepBuffer[0]:Desplazamiento en X desde el inicio</LI>
+	 * <LI>stepBuffer[1]:Desplazamiento en Y desde el inicio</LI>
+	 * <LI>stepBuffer[2]:Posici?n X final m?s uno</LI>
+	 * <LI>stepBuffer[3]:Posici?n Y final m?s uno</LI>
+	 * </UL>
+	 * @throws GdalException
+	 */
+	private void readData(Buffer buf,
+			BandList bandList,
+			int[] inputWindow,
+			int bufWidth,
+			int bufHeight,
+			int stpX,
+			int stpY,
+			int[] stepBuffer) throws GdalException, ProcessInterruptedException {
+
+		RasterTask task = RasterTaskQueue.get(Thread.currentThread().getId() + "");
+		FileUtils fUtil = RasterLocator.getManager().getFileUtils();
+
+		GdalBuffer gdalBuf = null;
+		for(int iBand = 0; iBand < gdalBands.length; iBand++) {
+			int[] drawableBands = bandList.getBufferBandToDraw(fileName, iBand);
+			if(drawableBands == null || (drawableBands.length == 1 && drawableBands[0] == -1))
+				continue;
+			int init = (int)((bufWidth * stpY) + stpX); //Pos inicial. Desplazamos stpX pixels hacia la derecha y bajamos stpY lineas
+			int pos = init;
+			gdalBuf = gdalBands[iBand].readRaster(	inputWindow[0],
+													inputWindow[1],
+													inputWindow[2],
+													inputWindow[3],
+													bufWidth,
+													bufHeight,
+													dataType[iBand]);
+			int lineInputWindow = 0;
+			if(dataType[iBand] == GdalDataset.GDT_Byte) {
+				for (int line = stepBuffer[1]; line < stepBuffer[3]; line++) {
+					pos = (int)((bufWidth * (lineInputWindow - stepBuffer[0])) + init);
+					for (int col = stepBuffer[0]; col < stepBuffer[2]; col ++) {
+						for (int i = 0; i < drawableBands.length; i++)
+							buf.setElem(line, col, drawableBands[i], gdalBuf.buffByte[pos]);
+						pos ++;
+					}
+					lineInputWindow ++;
+					if(task.getEvent() != null)
+						task.manageEvent(task.getEvent());
+				}
+				gdalBuf.buffByte = null;
+			} else if((dataType[iBand] == GdalDataset.GDT_UInt16) || (dataType[iBand] == GdalDataset.GDT_Int16) || (dataType[iBand] == GdalDataset.GDT_CInt16)) {
+				for (int line = stepBuffer[1]; line < stepBuffer[3]; line++) {
+					pos = (int)((bufWidth * (lineInputWindow - stepBuffer[0])) + init);
+					for (int col = stepBuffer[0]; col < stepBuffer[2]; col ++) {
+						for (int i = 0; i < drawableBands.length; i++)
+							buf.setElem(line, col, drawableBands[i], gdalBuf.buffShort[pos]);
+						pos ++;
+					}
+					lineInputWindow ++;
+					if(task.getEvent() != null)
+						task.manageEvent(task.getEvent());
+				}
+				gdalBuf.buffShort = null;
+			} else if((dataType[iBand] == GdalDataset.GDT_UInt32) || (dataType[iBand] == GdalDataset.GDT_Int32) || (dataType[iBand] == GdalDataset.GDT_CInt32)) {
+				for (int line = stepBuffer[1]; line < stepBuffer[3]; line++) {
+					pos = (int)((bufWidth * (lineInputWindow - stepBuffer[0])) + init);
+					for (int col = stepBuffer[0]; col < stepBuffer[2]; col ++) {
+						for (int i = 0; i < drawableBands.length; i++)
+							buf.setElem(line, col, drawableBands[i], gdalBuf.buffInt[pos]);
+						pos ++;
+					}
+					lineInputWindow ++;
+					if(task.getEvent() != null)
+						task.manageEvent(task.getEvent());
+				}
+				gdalBuf.buffInt = null;
+			} else if(dataType[iBand] == GdalDataset.GDT_Float32) {
+				for (int line = stepBuffer[1]; line < stepBuffer[3]; line++) {
+					pos = (int)((bufWidth * (lineInputWindow - stepBuffer[0])) + init);
+					for (int col = stepBuffer[0]; col < stepBuffer[2]; col ++) {
+						for (int i = 0; i < drawableBands.length; i++)
+							buf.setElem(line, col, drawableBands[i], gdalBuf.buffFloat[pos]);
+						pos ++;
+					}
+					lineInputWindow ++;
+					if(task.getEvent() != null)
+						task.manageEvent(task.getEvent());
+				}
+				gdalBuf.buffFloat = null;
+			} else if(dataType[iBand] == GdalDataset.GDT_Float64) {
+				for (int line = stepBuffer[1]; line < stepBuffer[3]; line++) {
+					pos = (int)((bufWidth * (lineInputWindow - stepBuffer[0])) + init);
+					for (int col = stepBuffer[0]; col < stepBuffer[2]; col ++) {
+						for (int i = 0; i < drawableBands.length; i++)
+							buf.setElem(line, col, drawableBands[i], gdalBuf.buffDouble[pos]);
+						pos ++;
+					}
+					lineInputWindow ++;
+					if(task.getEvent() != null)
+						task.manageEvent(task.getEvent());
+				}
+				gdalBuf.buffDouble = null;
+			}
+		}
+	}
+
+	/**
+	 * Lee una ventana de datos sin resampleo a partir de coordenadas en pixeles. Esta funci?n es usuada por
+	 * readWindow para coordenadas reales y readWindow en coordenadas pixel.
+	 * @param buf Buffer donde se almacenan los datos
+	 * @param bandList Lista de bandas que queremos leer y sobre que bandas del buffer de destino queremos escribirlas
+	 * @param x Posici?n X en pixeles
+	 * @param y Posici?n Y en pixeles
+	 * @param w Ancho en pixeles
+	 * @param yMax altura m?xima de y
+	 * @throws GdalException
+	 */
+	@SuppressWarnings("unused")
+	private void readDataByLine(Buffer buf, BandList bandList, int x, int y, int w, int yMax) throws GdalException, ProcessInterruptedException {
+		GdalBuffer gdalBuf = null;
+		int rasterBufLine;
+		RasterTask task = RasterTaskQueue.get(Thread.currentThread().getId() + "");
+		FileUtils fUtil = RasterLocator.getManager().getFileUtils();
+
+		for(int iBand = 0; iBand < gdalBands.length; iBand++) {
+			int[] drawableBands = bandList.getBufferBandToDraw(fUtil.getFormatedRasterFileName(fileName), iBand);
+			if(drawableBands == null || (drawableBands.length == 1 && drawableBands[0] == -1))
+				continue;
+			if(dataType[iBand] == GdalDataset.GDT_Byte) {
+				for (int line = y; line < yMax; line++) {
+					gdalBuf = gdalBands[iBand].readRaster(x, line, w, 1, w, 1, dataType[iBand]);
+					rasterBufLine = line - y;
+					for (int i = 0; i < drawableBands.length; i++) {
+						buf.setLineInBandByte(gdalBuf.buffByte, rasterBufLine, drawableBands[i]);
+					}
+					if(task.getEvent() != null)
+						task.manageEvent(task.getEvent());
+				}
+			}else if((dataType[iBand] == GdalDataset.GDT_UInt16) || (dataType[iBand] == GdalDataset.GDT_Int16) || (dataType[iBand] == GdalDataset.GDT_CInt16)) {
+				for (int line = y; line < yMax; line++) {
+					gdalBuf = gdalBands[iBand].readRaster(x, line, w, 1, w, 1, dataType[iBand]);
+					rasterBufLine = line - y;
+					for (int i = 0; i < drawableBands.length; i++) {
+						buf.setLineInBandShort(gdalBuf.buffShort, rasterBufLine, drawableBands[i]);
+					}
+					if(task.getEvent() != null)
+						task.manageEvent(task.getEvent());
+				}
+			}else if((dataType[iBand] == GdalDataset.GDT_UInt32) || (dataType[iBand] == GdalDataset.GDT_Int32) || (dataType[iBand] == GdalDataset.GDT_CInt32)) {
+				for (int line = y; line < yMax; line++) {
+					gdalBuf = gdalBands[iBand].readRaster(x, line, w, 1, w, 1, dataType[iBand]);
+					rasterBufLine = line - y;
+					for (int i = 0; i < drawableBands.length; i++) {
+						buf.setLineInBandInt(gdalBuf.buffInt, rasterBufLine, drawableBands[i]);
+					}
+					if(task.getEvent() != null)
+						task.manageEvent(task.getEvent());
+				}
+			}else if(dataType[iBand] == GdalDataset.GDT_Float32){
+				for (int line = y; line < yMax; line++) {
+					gdalBuf = gdalBands[iBand].readRaster(x, line, w, 1, w, 1, dataType[iBand]);
+					rasterBufLine = line - y;
+					for (int i = 0; i < drawableBands.length; i++) {
+						buf.setLineInBandFloat(gdalBuf.buffFloat, rasterBufLine, drawableBands[i]);
+					}
+					if(task.getEvent() != null)
+						task.manageEvent(task.getEvent());
+				}
+			}else if(dataType[iBand] == GdalDataset.GDT_Float64){
+				for (int line = y; line < yMax; line++) {
+					gdalBuf = gdalBands[iBand].readRaster(x, line, w, 1, w, 1, dataType[iBand]);
+					rasterBufLine = line - y;
+					for (int i = 0; i < drawableBands.length; i++) {
+						buf.setLineInBandDouble(gdalBuf.buffDouble, rasterBufLine, drawableBands[i]);
+					}
+					if(task.getEvent() != null)
+						task.manageEvent(task.getEvent());
+				}
+			}
+		}
+	}
+
+	/**
+	 * Obtiene el valor de un pixel determinado por las coordenadas x e y que se pasan
+	 * por par?metro
+	 * @param x Coordenada X del pixel
+	 * @param y Coordenada Y del pixel
+	 * @return Array de Object donde cada posici?n representa una banda y el valor ser? Integer
+	 * en caso de ser byte, shot o int, Float en caso de ser float y Double en caso de ser double.
+	 */
+	public Object[] getData(int x, int y) {
+		try {
+			Object[] data = new Object[getRasterCount()];
+			for(int i = 0; i < getRasterCount(); i++){
+				GdalRasterBand rb = getRasterBand(i + 1);
+				GdalBuffer r = rb.readRaster(x, y, 1, 1, 1, 1, dataType[i]);
+				switch(dataType[i]){
+				case 0:	break;									//Sin tipo
+				case 1:	data[i] = new Integer(r.buffByte[0]); 	//Buffer byte (8)
+						break;
+				case 2:											//Buffer short (16)
+				case 3:	data[i] = new Integer(r.buffShort[0]);	//Buffer short (16)
+						break;
+				case 4:											//Buffer int (32)
+				case 5: data[i] = new Integer(r.buffInt[0]);	//Buffer int (32)
+						break;
+				case 6:	data[i] = new Float(r.buffFloat[0]);	//Buffer float (32)
+						break;
+				case 7:	data[i] = new Double(r.buffDouble[0]);	//Buffer double (64)
+						break;
+				}
+			}
+			return data;
+		} catch (GdalException e) {
+			return null;
+		}
+	}
+
+	public int getBlockSize(){
+		return this.getBlockSize();
+	}
+
+	/**
+	 * Devuelve la transformaci?n del fichero de georreferenciaci?n
+	 * @return AffineTransform
+	 */
+	public AffineTransform getOwnTransformation() {
+		return ownTransformation;
+	}
+
+	/**
+	 * Calcula el extent en coordenadas del mundo real sin rotaci?n. Solo coordenadas y tama?o de pixel
+	 * @return Extent
+	 */
+	public Extent getExtentWithoutRot() {
+		AffineTransform at = new AffineTransform(	externalTransformation.getScaleX(), 0,
+													0, externalTransformation.getScaleY(),
+													externalTransformation.getTranslateX(), externalTransformation.getTranslateY());
+		Point2D p1 = new Point2D.Double(0, 0);
+		Point2D p2 = new Point2D.Double(width, height);
+		at.transform(p1, p1);
+		at.transform(p2, p2);
+		return new ExtentImpl(p1, p2);
+	}
+
+	/**
+	 * Asigna una transformaci?n que es aplicada sobre la que ya tiene el propio fichero
+	 * @param t
+	 */
+	public void setExternalTransform(AffineTransform t){
+		externalTransformation = t;
+	}
+
+	/**
+	 * Obtiene el nombre del driver de Gdal
+	 * @return Cadena que representa el nombre del driver de gdal
+	 */
+	public String getGdalShortName() {
+		return shortName;
+	}
+
+	public void dispose() {
+		open = false;
+		try {
+			super.close();
+		} catch (GdalException e1) {
+		}
+		try {
+			finalize();
+		} catch (Throwable e) {
+		}
+	}
+
+	protected void finalize() {
+		fileTransparency       = null;
+		palette                = null;
+		colorInterpr           = null;
+		ownTransformation      = null;
+		externalTransformation = null;
+		stepArrayX             = null;
+		stepArrayY             = null;
+		fileName               = null;
+		shortName              = null;
+		trans                  = null;
+		version                = null;
+		dataType               = null;
+		metadata                = null;
+
+		if(gdalBands != null) {
+			for (int i = 0; i < gdalBands.length; i++) {
+				gdalBands[i] = null;
+			}
+			gdalBands = null;
+		}
+		this.finalize();
+	}
+
+}
+
+
+
+

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/GdalDataSource.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/GdalProvider.java
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/GdalProvider.java	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/GdalProvider.java	(revision 9865)
@@ -0,0 +1,710 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.raster.gdal.io;
+
+import java.awt.geom.AffineTransform;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.FilenameUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.cresques.cts.ICRSFactory;
+import org.cresques.cts.IProjection;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.gvsig.fmap.crs.CRSFactory;
+import org.gvsig.fmap.dal.DALFileLocator;
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.DataStore;
+import org.gvsig.fmap.dal.coverage.RasterLocator;
+import org.gvsig.fmap.dal.coverage.dataset.Buffer;
+import org.gvsig.fmap.dal.coverage.datastruct.Extent;
+import org.gvsig.fmap.dal.coverage.exception.BandAccessException;
+import org.gvsig.fmap.dal.coverage.exception.FileNotOpenException;
+import org.gvsig.fmap.dal.coverage.exception.InvalidSetViewException;
+import org.gvsig.fmap.dal.coverage.exception.InvalidSourceException;
+import org.gvsig.fmap.dal.coverage.exception.NotSupportedExtensionException;
+import org.gvsig.fmap.dal.coverage.exception.ParsingException;
+import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException;
+import org.gvsig.fmap.dal.coverage.exception.RasterDriverException;
+import org.gvsig.fmap.dal.coverage.store.parameter.RasterDataParameters;
+import org.gvsig.fmap.dal.coverage.store.props.Transparency;
+import org.gvsig.fmap.dal.exception.OpenException;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemStoreParameters;
+import org.gvsig.fmap.dal.spi.DataManagerProviderServices;
+import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
+import org.gvsig.jgdal.GdalException;
+import org.gvsig.metadata.MetadataLocator;
+import org.gvsig.raster.cache.tile.provider.TileServer;
+import org.gvsig.raster.impl.buffer.SpiRasterQuery;
+import org.gvsig.raster.impl.datastruct.ExtentImpl;
+import org.gvsig.raster.impl.provider.AbstractRasterProvider;
+import org.gvsig.raster.impl.provider.RasterProvider;
+import org.gvsig.raster.impl.provider.tile.FileTileServer;
+import org.gvsig.raster.impl.store.AbstractRasterDataParameters;
+import org.gvsig.raster.impl.store.DefaultRasterStore;
+import org.gvsig.raster.impl.store.DefaultStoreFactory;
+import org.gvsig.raster.impl.store.properties.DataStoreMetadata;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.extensionpoint.ExtensionPoint;
+import org.gvsig.tools.extensionpoint.ExtensionPointManager;
+
+
+/**
+ * This class represents the data access for gdal formats.
+ *
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ */
+public class GdalProvider extends AbstractRasterProvider {
+
+    public static String NAME = "Gdal Store";
+    public static String DESCRIPTION = "Gdal Raster file";
+    public static final String METADATA_DEFINITION_NAME = "GdalStore";
+    private static final Logger logger = LoggerFactory.getLogger(GdalProvider.class);
+
+    public static final String FORMAT_GTiff = "GTiff";
+    public static final String FORMAT_VRT = "VRT";
+    public static final String FORMAT_NITF = "NITF";
+    public static final String FORMAT_HFA = "HFA";
+    public static final String FORMAT_ELAS = "ELAS";
+    public static final String FORMAT_MEM = "MEM";
+    public static final String FORMAT_BMP = "BMP";
+    public static final String FORMAT_PCIDSK = "PCIDSK";
+    public static final String FORMAT_ILWIS = "ILWIS";
+    public static final String FORMAT_HDF4 = "HDF4Image";
+    public static final String FORMAT_PNM = "PNM";
+    public static final String FORMAT_ENVI = "ENVI";
+    public static final String FORMAT_EHDR = "EHdr";
+    public static final String FORMAT_PAUX = "PAux";
+    public static final String FORMAT_MFF = "MFF";
+    public static final String FORMAT_MFF2 = "MFF2";
+    public static final String FORMAT_BT = "BT";
+    public static final String FORMAT_IDA = "IDA";
+    public static final String FORMAT_RMF = "RMF";
+    public static final String FORMAT_RST = "RST";
+    public static final String FORMAT_LEVELLER = "Leveller";
+    public static final String FORMAT_TERRAGEN = "Terragen";
+    public static final String FORMAT_ERS = "ERS";
+    public static final String FORMAT_INGR = "INGR";
+    public static final String FORMAT_GSAG = "GSAG";
+    public static final String FORMAT_GSBG = "GSBG";
+    public static final String FORMAT_ADRG = "ADRG";
+    public static final String FORMAT_JP2 = "JPEG2000";
+    public static final String FORMAT_GRD = "GRD";
+    public static final int BAND_HEIGHT = 64;
+    protected GdalDataSource file = null;
+    private Extent viewRequest = null;
+    protected static String[][] formatList = null;
+
+    public static void register() {
+        ExtensionPointManager extensionPoints = ToolsLocator.getExtensionPointManager();
+        registerFormats();
+
+        ExtensionPoint point = extensionPoints.get("DefaultRasterProvider");
+        point.append("reader", GdalProvider.NAME, GdalProvider.class);
+
+        RasterLocator.getManager().getProviderServices().registerFileProvidersTiled(GdalProvider.class);
+
+        DataManagerProviderServices dataman = (DataManagerProviderServices) DALLocator.getDataManager();
+        if (dataman != null && !dataman.getStoreProviders().contains(NAME)) {
+            dataman.registerStoreProvider(NAME,
+                    GdalProvider.class, GdalDataParameters.class);
+        }
+
+        if (DALFileLocator.getFilesystemServerExplorerManager() != null) {
+            DALFileLocator.getFilesystemServerExplorerManager().registerProvider(
+                    NAME, DESCRIPTION,
+                    GdalFilesystemServerExplorer.class);
+        }
+
+        dataman.registerStoreFactory(NAME, DefaultStoreFactory.class);
+    }
+
+    private static void registerFormats() {
+        formatList = new String[][]{
+            new String[]{"bmp", "image/bmp"},
+            new String[]{"gif", "image/gif"},
+            new String[]{"tif", "image/tiff"},
+            new String[]{"tiff", "image/tiff"},
+            new String[]{"jpg", "image/jpeg"},
+            new String[]{"jpeg", "image/jpeg"},
+            new String[]{"png", "image/png"},
+            new String[]{"vrt", "image/vrt"},
+            new String[]{"dat", "image/dat"}, // Envi
+            new String[]{"lan", "image/lan"}, // Erdas
+            new String[]{"gis", "image/gis"}, // Erdas
+            new String[]{"img", "image/img"}, // Erdas
+            new String[]{"pix", "image/pix"},// PCI Geomatics
+            new String[]{"aux", "image/aux"}, // PCI Geomatics
+            new String[]{"adf", "image/adf"}, // ESRI Grids
+            new String[]{"mpr", "image/mpr"}, // Ilwis
+            new String[]{"mpl", "image/mpl"}, // Ilwis
+            new String[]{"map", "image/map"},// PC Raster
+            new String[]{"asc", "image/asc"},
+            new String[]{"pgm", "image/pgn"},//Ficheros PNM en escala de grises
+            new String[]{"ppm", "image/ppm"},//Ficheros PNM en RGB
+            new String[]{"rst", "image/rst"},//IDRISIS
+            new String[]{"rmf", "image/rmf"},//Raster Matrix Format
+            new String[]{"nos", "image/nos"},
+            new String[]{"kap", "image/kap"},
+            new String[]{"hdr", "image/hdr"},
+            new String[]{"raw", "image/raw"},
+            new String[]{"ers", "image/ers"},
+            new String[]{"xml", "image/xml"},
+            new String[]{"grd", "image/grd"},
+            /*
+             new String[] {"jp2","image/jp2" },
+             new String[] {"mrsid","image/mrsid" },
+             new String[] {"ecw","image/ecw" },
+             */
+            new String[]{"txt", "image/txt"}
+        };
+        for (int i = 0; i < formatList.length; i++) {
+            RasterLocator.getManager().getProviderServices().addFormat(formatList[i][0], GdalProvider.class);
+        }
+    }
+
+    public String[] getFormatList() {
+        String[] fl = new String[formatList.length];
+        for (int i = 0; i < fl.length; i++) {
+            fl[i] = formatList[i][0];
+        }
+        return fl;
+    }
+
+    /**
+     * Returns true if the extension is supported and false if doesn't
+     *
+     * @param ext
+     * @return
+     */
+    public boolean isExtensionSupported(String ext) {
+        if (ext.indexOf(".") != -1) {
+            ext = ext.substring(ext.lastIndexOf(".") + 1, ext.length());
+        }
+        for (int i = 0; i < formatList.length; i++) {
+            if (formatList[i][0].compareTo(ext) == 0) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Mandatory constructor to instantiate an empty provider
+     */
+    public GdalProvider() {
+    }
+
+    /**
+     * Constructor. Abre el dataset.
+     *
+     * @param params
+     * @throws NotSupportedExtensionException
+     * @throws OpenException
+     * @deprecated use {@link #GdalProvider(URI)}, this constructor will be
+     * removed in gvSIG 2.5
+     */
+    public GdalProvider(String params) throws NotSupportedExtensionException, OpenException {
+        super(params);
+        logger.info("Deprecated use of GdalProvider constructor");
+        if (params instanceof String) {
+            GdalDataParameters p = new GdalDataParameters();
+            URI uriParam;
+            try {
+                uriParam = new URI((String) params);
+            } catch (URISyntaxException e) {
+                throw new OpenException("Can't create uri from " + (String) params, e);
+            }
+            p.setURI(uriParam);
+            super.init(p, null, ToolsLocator.getDynObjectManager()
+                    .createDynObject(
+                            MetadataLocator.getMetadataManager().getDefinition(
+                                    DataStore.METADATA_DEFINITION_NAME)));
+            init(p, null);
+        }
+    }
+
+    /**
+     * Constructor. Abre el dataset.
+     *
+     * @param uri
+     * @throws NotSupportedExtensionException
+     */
+    public GdalProvider(URI uri) throws NotSupportedExtensionException {
+        super(uri);
+        GdalDataParameters p = new GdalDataParameters();
+        p.setURI(uri);
+        super.init(
+                p,
+                null,
+                ToolsLocator.getDynObjectManager().createDynObject(
+                        MetadataLocator.getMetadataManager().getDefinition(DataStore.METADATA_DEFINITION_NAME)));
+        init(p, null);
+    }
+
+    public GdalProvider(GdalDataParameters params,
+            DataStoreProviderServices storeServices) throws NotSupportedExtensionException {
+        super(params, storeServices, ToolsLocator.getDynObjectManager()
+                .createDynObject(
+                        MetadataLocator.getMetadataManager().getDefinition(
+                                DataStore.METADATA_DEFINITION_NAME)));
+        init(params, storeServices);
+    }
+
+    public GdalProvider(AbstractRasterDataParameters params,
+            DataStoreProviderServices storeServices, DynObject metadata) {
+        super(params, storeServices, metadata);
+    }
+
+    /**
+     * Creates file references and loads structures with the information and
+     * metadata
+     *
+     * @param params load parameters
+     * @param storeServices
+     * @throws NotSupportedExtensionException
+     */
+    public void init(AbstractRasterDataParameters params,
+            DataStoreProviderServices storeServices) throws NotSupportedExtensionException {
+        try {
+            setParam(storeServices, params);
+            String fname = getFileName(params);
+            setFName(fname);
+            file = new GdalDataSource(fname);
+            setColorInterpretation(file.colorInterpr);
+            setColorTable(file.palette);
+            noData = file.getNoDataValue();
+            ICRSFactory crsFactory = CRSFactory.getCRSFactory();
+
+            IProjection proj = params.getSRS();
+            if (proj == null) {
+                File prjFile = getPrjFile(params.getURI());
+                if (prjFile.exists()) {
+                    String wktEsri = loadPrj(prjFile);
+                    if (wktEsri != null) {
+                        try {
+                            proj = crsFactory.get(ICRSFactory.FORMAT_WKT_ESRI,
+                                wktEsri);
+                        } catch(Exception ex) {
+                            // Do nothing, continue
+                        }
+                    }
+                }
+            }
+            if (proj == null) {
+                String wktProjection = file.getProjectionRef();
+                if (!StringUtils.isEmpty(wktProjection) ) {
+                    try {
+                        proj = crsFactory.get(ICRSFactory.FORMAT_WKT, wktProjection);
+                        if ( StringUtils.isEmpty( proj.getAbrev()) ){
+                            proj=null;
+                        } else {
+                            setProjection(proj, true);
+                        }
+                    } catch (Exception e ) {
+                        proj=null;
+                        logger.info("Error reading WKT from the raster provider", e);
+                    }
+                }
+            } else {
+                setProjection(proj, false);
+            }
+
+            ownTransformation = file.getOwnTransformation();
+            externalTransformation = (AffineTransform) ownTransformation.clone();
+            load();
+
+            if (file != null) {
+                bandCount = file.getRasterCount();
+            }
+        } catch (GdalException e) {
+            throw new NotSupportedExtensionException("Extension not supported", e);
+        } catch (Exception e) {
+            System.out.println("Error en GdalOpen");
+            e.printStackTrace();
+            file = null;
+        }
+
+        //Obtenemos el tipo de dato de gdal y lo convertimos el de RasterBuf
+        int[] dt = new int[file.getDataType().length];
+        for (int i = 0; i < dt.length; i++) {
+            dt[i] = GdalDataSource.getRasterBufTypeFromGdalType(file.getDataType()[i]);
+        }
+        setDataType(dt);
+
+        super.init();
+
+        try {
+            loadFromRmf(getRmfBlocksManager());
+        } catch (ParsingException e) {
+            //No lee desde rmf
+            logger.debug("Problems reading from the RMF file", e);
+        }
+    }
+
+    private String getFileName(RasterDataParameters params) throws GdalException {
+        File f = new File(params.getURI());
+        validRmf(f.getAbsolutePath());
+        return translateFileName(f.getAbsolutePath());
+    }
+
+    public String getMimeType() {
+        try {
+            File f = ((FilesystemStoreParameters) (this.getDataStoreParameters())).getFile();
+            String ext = FilenameUtils.getExtension(f.getName());
+            for (int i = 0; i < formatList.length; i++) {
+                if (ext.equalsIgnoreCase(formatList[i][0])) {
+                    return formatList[i][1];
+                }
+            }
+        } catch (Exception ex) {
+            logger.warn("Can't get mime type for GDAL archive.", ex);
+        }
+        return "image";
+    }
+
+    /**
+     * Comprueba si el fichero abierto es un RasterMetaFile o una imagen raster.
+     *
+     * @throws GdalException
+     */
+    private void validRmf(String file) throws GdalException {
+        if (file.endsWith(".rmf")) {
+            File f = new File(file);
+            try {
+                FileReader fr = new FileReader(f);
+                BufferedReader br = new BufferedReader(fr);
+                char[] buffer = new char[5];
+                br.read(buffer);
+                StringBuffer st = new StringBuffer(new String(buffer));
+                br.close();
+                fr.close();
+                if (st.toString().equals("<?xml")) {
+                    throw new GdalException("RasterMetaFile");
+                }
+            } catch (FileNotFoundException e) {
+                throw new GdalException("File Not Found");
+            } catch (IOException e) {
+                throw new GdalException("");
+            }
+        }
+    }
+
+    public RasterProvider load() {
+        return this;
+    }
+
+    public boolean isOpen() {
+        if (file != null && file.isOpen()) {
+            return true;
+        }
+        return false;
+    }
+
+    public URI translateURI(URI uri) {
+        String absolutePath = new File(uri).getAbsolutePath();
+        if ("hdr".equalsIgnoreCase(FilenameUtils.getExtension(absolutePath))) {
+            File file = new File(FilenameUtils.removeExtension(absolutePath));
+            return file.toURI();
+        }
+        return uri;
+    }
+
+    /**
+     * Asigna el extent de la vista actual. existe un fichero .rmf debemos hacer
+     * una transformaci�n de la vista asignada ya que la petici�n viene en
+     * coordenadas del fichero .rmf y la vista (v) ha de estar en coordenadas
+     * del fichero.
+     *
+     * @param e
+     */
+    public void setView(Extent e) {
+        viewRequest = new ExtentImpl(e);
+    }
+
+    public Extent getView() {
+        return viewRequest;
+    }
+
+    public double getWidth() {
+        return file.width;
+    }
+
+    public double getHeight() {
+        return file.height;
+    }
+
+    /**
+     * Read a line from the file
+     *
+     * @param line
+     * @param band
+     * @return
+     * @throws InvalidSetViewException
+     * @throws FileNotOpenException
+     * @throws RasterDriverException
+     * @Deprecated This operation is deprecated because is not useful and in the
+     * future it will not be maintained. The abstract operation has dissapear
+     */
+    public Object readCompleteLine(int line, int band) throws InvalidSetViewException, FileNotOpenException, RasterDriverException {
+        if (line > this.getHeight() || band > this.getBandCount()) {
+            throw new InvalidSetViewException("Request out of grid");
+        }
+
+        try {
+            return file.readCompleteLine(line, band);
+        } catch (GdalException e) {
+            throw new RasterDriverException("Error reading data from Gdal library");
+        }
+    }
+
+    public Object readBlock(int pos, int blockHeight, double scale)
+            throws InvalidSetViewException, FileNotOpenException, RasterDriverException, ProcessInterruptedException {
+        if (pos < 0) {
+            throw new InvalidSetViewException("Request out of grid");
+        }
+
+        if ((pos + blockHeight) > getHeight()) {
+            blockHeight = Math.abs(((int) getHeight()) - pos);
+        }
+        try {
+            return file.readBlock(pos, blockHeight, scale);
+        } catch (GdalException e) {
+            throw new RasterDriverException("Error reading data from Gdal library");
+        }
+    }
+
+    public Object getData(int x, int y, int band) throws InvalidSetViewException, FileNotOpenException, RasterDriverException {
+        if (file != null) {
+            if (x < 0 || y < 0 || x >= file.width || y >= file.height) {
+                throw new InvalidSetViewException("Request out of grid");
+            }
+            Object[] data = file.getData(x, y);
+            return data[band];
+        }
+        throw new FileNotOpenException("GdalNative not exist");
+    }
+
+    @Override
+    public void loadBuffer(SpiRasterQuery q)
+            throws ProcessInterruptedException, RasterDriverException {
+        setView(q.getAdjustedRequestBoundingBox());
+
+        try {
+            file.readWindow(q.getBufferForProviders(),
+                    q.getBandList(),
+                    q.getAdjustedRequestBoundingBox(),
+                    q.getAdjustedRequestPxWindow(),
+                    q.getTaskStatus());
+        } catch (GdalException e) {
+            throw new RasterDriverException("Error reading data", e);
+        }
+
+    }
+
+    public int getBlockSize() {
+        if (file != null) {
+            return file.getBlockSize();
+        } else {
+            return 0;
+        }
+    }
+
+    public DataStoreMetadata getMetadata() {
+        if (file != null) {
+            return file.metadata;
+        } else {
+            return null;
+        }
+    }
+
+    public Transparency getTransparency() {
+        return file.fileTransparency;
+    }
+
+    public boolean isGeoreferenced() {
+        if (file != null) {
+            return file.georeferenced;
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * Informa de si el driver ha supersampleado en el �ltimo dibujado. Es el
+     * driver el que colocar� el valor de esta variable cada vez que dibuja.
+     *
+     * @return true si se ha supersampleado y false si no se ha hecho.
+     */
+    public boolean isSupersampling() {
+        if (file != null) {
+            return file.isSupersampling;
+        } else {
+            return false;
+        }
+    }
+
+    protected GdalDataSource getNative() {
+        return file;
+    }
+
+    public void setAffineTransform(AffineTransform t) {
+        super.setAffineTransform(t);
+        file.setExternalTransform(t);
+    }
+
+    public int getOverviewCount(int band) throws BandAccessException, RasterDriverException {
+        if (band >= getBandCount()) {
+            throw new BandAccessException("Wrong band");
+        }
+        try {
+            return file.getRasterBand(band + 1).getOverviewCount();
+        } catch (GdalException e) {
+            throw new RasterDriverException("");
+        }
+    }
+
+    public int getOverviewWidth(int band, int overview) throws BandAccessException, RasterDriverException {
+        if (band >= getBandCount()) {
+            throw new BandAccessException("Wrong band");
+        }
+        try {
+            if (overview >= file.getRasterBand(band + 1).getOverviewCount()) {
+                throw new BandAccessException("Wrong overview count");
+            }
+            return file.getRasterBand(band + 1).getOverview(overview).getRasterBandXSize();
+        } catch (GdalException e) {
+            throw new RasterDriverException("");
+        }
+    }
+
+    public int getOverviewHeight(int band, int overview) throws BandAccessException, RasterDriverException {
+        if (band >= getBandCount()) {
+            throw new BandAccessException("Wrong band");
+        }
+        try {
+            if (overview >= file.getRasterBand(band + 1).getOverviewCount()) {
+                throw new BandAccessException("Wrong overview count");
+            }
+            return file.getRasterBand(band + 1).getOverview(overview).getRasterBandYSize();
+        } catch (GdalException e) {
+            throw new RasterDriverException("");
+        }
+    }
+
+    public boolean isOverviewsSupported() {
+        return true;
+    }
+
+    public boolean isReproyectable() {
+        return true;
+    }
+
+    public boolean needEnhanced() {
+        return (getDataType()[0] != Buffer.TYPE_BYTE);
+		//Desconozco pq raz�n estaba esta condici�n. Quiz�s haya que volver a a�adirla
+        //Eliminada 30/5/2013
+        //|| (getBandCount() == 1 && getDataType()[0] == Buffer.TYPE_BYTE));
+    }
+
+    public String getProviderName() {
+        return NAME;
+    }
+
+    public void setStatus(RasterProvider provider) {
+        if (provider instanceof GdalProvider) {
+            //Not implemented yet
+        }
+    }
+
+    public TileServer getTileServer() {
+        if (tileServer == null) {
+            DefaultRasterStore store = new DefaultRasterStore();
+            store.setProvider(this);
+            tileServer = new FileTileServer(store);
+//			tileServer.setFileSuffix("rmf");
+        }
+        return tileServer;
+    }
+
+    public void close() {
+        if (file != null) {
+            file.dispose();
+        }
+        try {
+            finalize();
+        } catch (Throwable e) {
+        }
+    }
+
+    protected void finalize() throws Throwable {
+        file = null;
+        viewRequest = null;
+        if (formatList != null) {
+            for (int i = 0; i < formatList.length; i++) {
+                formatList[i] = null;
+            }
+            formatList = null;
+        }
+        super.finalize();
+    }
+
+    public void addFile(File file) throws InvalidSourceException {
+        // Do nothing
+    }
+
+    public void removeFile(File file) {
+        // Do nothing
+    }
+
+    private File getPrjFile(URI uri) {
+        if ("file".equalsIgnoreCase(uri.getScheme())) {
+            String uriPath = new File(uri).getAbsolutePath();
+            String prjPath = FilenameUtils.removeExtension(uriPath) + ".prj";
+            return new File(prjPath);
+        }
+        return null;
+    }
+
+    ;
+
+    private String loadPrj(File prjFile) {
+        if (prjFile.exists()) {
+            try {
+                return FileUtils.readFileToString(prjFile);
+            } catch (IOException e) {
+                return null;
+            }
+        }
+        return null;
+    }
+
+}

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/GdalProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/JpegWriter.java
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/JpegWriter.java	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/JpegWriter.java	(revision 9865)
@@ -0,0 +1,210 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.raster.gdal.io;
+
+import java.awt.geom.AffineTransform;
+import java.io.File;
+import java.io.IOException;
+
+import org.cresques.cts.IProjection;
+import org.gvsig.fmap.dal.coverage.RasterLocator;
+import org.gvsig.fmap.dal.coverage.datastruct.Params;
+import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException;
+import org.gvsig.fmap.dal.coverage.store.DataServerWriter;
+import org.gvsig.jgdal.GdalDataset;
+import org.gvsig.jgdal.GdalDriver;
+import org.gvsig.jgdal.GdalException;
+import org.gvsig.raster.gdal.io.features.JpegFeatures;
+import org.gvsig.raster.impl.store.WriteFileFormatFeatures;
+import org.gvsig.raster.impl.store.writer.DefaultRasterWriter;
+import org.gvsig.raster.util.DefaultProviderServices;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.extensionpoint.ExtensionPoint;
+import org.gvsig.tools.extensionpoint.ExtensionPointManager;
+/**
+ * Driver para la escritura de Jpeg.
+ * Este driver utiliza GdalWriter para salvar Jpeg.
+ * La escritura de un jpeg no es posible utilizando un servidor de datos
+ * como el que usan los drivers comunes por lo que ser� necesario salvar antes
+ * a Tif con el driver de Gdal para posteriormente convertir la imagen completa
+ * a jpg.
+ *
+ * @version 22/07/2008
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ */
+public class JpegWriter extends DefaultRasterWriter {
+
+	// Datos de registro de drivers
+	public static void register() {
+		DefaultProviderServices pInfo = (DefaultProviderServices)RasterLocator.getManager().getProviderServices();
+		ExtensionPointManager extensionPoints =ToolsLocator.getExtensionPointManager();
+		ExtensionPoint point=extensionPoints.get("RasterWriter");
+		point.append("jpg", "", JpegWriter.class);
+		pInfo.getFileFeature().put("jpg", new JpegFeatures());
+	}
+
+	private GdalWriter gdalWriter = null;
+	private String     outTif     = null;
+	private String     outJpg     = null;
+
+	/**
+	 * Carga los par�metros de este driver.
+	 */
+	public void loadParams(String ident) {
+		WriteFileFormatFeatures wfff = (WriteFileFormatFeatures) pInfo.getFileFeature().get(ident);
+		wfff.loadParams();
+		driverParams = wfff.getParams();
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.coverage.store.RasterWriter#getProviderName()
+	 */
+	public String getProviderName() {
+		return GdalProvider.NAME;
+	}
+
+	/**
+	 * Constructor para la obtenci�n de par�metros del driver
+	 * @param drvType Tipo de driver
+	 */
+	public JpegWriter(String fileName) {
+		ident = fileUtil.getExtensionFromFileName(fileName);
+		driver = ((WriteFileFormatFeatures) pInfo.getFileFeature().get(ident)).getDriverName();
+		gdalWriter = new GdalWriter(fileName);
+
+		loadParams(ident);
+	}
+
+	/**
+	 * Constructor para salvar datos servidos por el cliente
+	 * @param dataWriter Objeto servidor de datos para el driver de escritura
+	 * @param outSizeX N�mero de pixels en X de la imagen de salida
+	 * @param outSizeY N�mero de pixels en Y de la imagen de salida
+	 * @param outFilename Fichero de salida
+	 * @param extentMaxX Posici�n en X m�xima del extent
+	 * @param extentMinX Posici�n en X m�nima del extent
+	 * @param extentMaxY Posici�n en Y m�xima del extent
+	 * @param extentMinY Posici�n en Y m�nima del extent
+	 * @param nBands N�mero de bandas
+	 * @param drvType Tipo de driver
+	 * @throws GdalException
+	 * @throws IOException
+	 */
+	public JpegWriter(DataServerWriter dataWriter,
+							String outFileName,
+							Integer nBands,
+							AffineTransform at,
+							Integer outSizeX,
+							Integer outSizeY,
+							Integer dataType,
+							Params params,
+							IProjection proj,
+							Boolean geo)throws GdalException, IOException  {
+		ident = fileUtil.getExtensionFromFileName(outFileName);
+		driver = ((WriteFileFormatFeatures) pInfo.getFileFeature().get(ident)).getDriverName();
+		outJpg = outFileName;
+		outTif = outFileName.substring(0, outFileName.lastIndexOf("."));
+		outTif += ".tif";
+
+		gdalWriter = new GdalWriter(dataWriter, outTif, nBands, at, outSizeX, outSizeY, dataType, params, proj, geo);
+		if (params == null)
+			loadParams(ident);
+		else
+			this.driverParams = params;
+	}
+
+	/**
+	 * Asigna el tipo de driver con el que se salvar� la imagen
+	 * @param drvType Tipo de driver
+	 */
+	public void setDriverType(String drvType) {
+		gdalWriter.setDriverType(drvType);
+	}
+
+	/**
+	 * Realiza la funci�n de compresi�n a partir de un GeoRasterFile.
+	 * @throws IOException
+	 */
+	public void fileWrite() throws IOException, ProcessInterruptedException {
+		gdalWriter.fileWrite();
+	}
+
+	/**
+	 * Realiza una copia en el formato especificado.
+	 * @throws IOException
+	 */
+	public static void createCopy(GdalDriver driverDst, String dst, String src, boolean bstrict, String[] params) throws IOException, GdalException {
+		GdalWriter.createCopy(driverDst, dst, src, bstrict, params);
+	}
+
+	/**
+	 * Realiza la escritura de datos con los datos que le pasa el cliente.
+	 * @throws IOException
+	 */
+	public void dataWrite() throws IOException, ProcessInterruptedException {
+		if (colorInterp != null)
+			gdalWriter.setColorBandsInterpretation(colorInterp.getValues());
+		gdalWriter.dataWrite();
+		if (gdalWriter.isWrite()) {
+			gdalWriter.writeClose();
+			if (outTif != null) {
+				GdalDriver driver = null;
+				try {
+					driver = GdalDataset.getDriverByName("JPEG");
+					GdalWriter.createCopy(driver, outJpg, outTif, false, gdalWriter.gdalParamsFromRasterParams(driverParams));
+				} catch (GdalException exc) {
+					throw new IOException("No se ha podido obtener el driver.");
+				}
+				File file = new File(outTif);
+				file.delete();
+			}
+		}
+	}
+
+	/**
+	 * Cancela el salvado de datos.
+	 */
+	public void writeCancel() {
+		gdalWriter.setWrite(false);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.gvsig.raster.dataset.GeoRasterWriter#setParams(org.gvsig.raster.dataset.Params)
+	 */
+	public void setParams(Params params) {
+		driverParams = params;
+		if (gdalWriter != null)
+			gdalWriter.setParams(params);
+	}
+
+	/**
+	 * Cierra el compresor ecw.
+	 * @throws GdalException
+	 */
+	public void writeClose() {
+	// El close del tif se hizo en dataWrite
+	}
+
+	public void setWkt(String wkt) {}
+}

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/JpegWriter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/util/DefaultCRSUtils.java
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/util/DefaultCRSUtils.java	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/util/DefaultCRSUtils.java	(revision 9865)
@@ -0,0 +1,104 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.raster.gdal.util;
+
+import org.cresques.cts.ICRSFactory;
+import org.cresques.cts.IProjection;
+import org.gdal.osr.SpatialReference;
+
+import org.gvsig.fmap.crs.CRSFactory;
+import org.gvsig.fmap.dal.coverage.util.CRSUtils;
+
+/**
+ * Esta clase se encarga de hacer la conversion entre Wkt e IProjection.
+ *
+ * El uso se hace mediante dos llamadas estaticas que son:
+ * convertIProjectionToWkt y
+ * convertWktToIProjection.
+ *
+ * Antes de usarlos, hay que saber si tenemos acceso a gvSIG e intentar coger el
+ * factory desde all�.
+ * Ya que su uso consume tiempo y espacio de memoria y es preferible
+ * reaprovechar ese objeto ya
+ * creado. Esto se hace con setCRSFactory.
+ *
+ * En caso de no asignarse el ya existente, el crear� uno interno y lo dejara en
+ * una variable estatica.
+ *
+ * @version 11/07/2008
+ * @author BorSanZa - Borja S�nchez Zamorano (borja.sanchez@iver.es)
+ */
+public class DefaultCRSUtils implements CRSUtils {
+
+    private ICRSFactory factory = null;
+
+    public void setCRSFactory(ICRSFactory factory) {
+        this.factory = factory;
+    }
+
+    /**
+     * Devuelve el CRSFactory asignado desde fuera o creado desde dentro, todo
+     * depende de como se haya
+     * usado.
+     *
+     * @param code
+     * @return
+     */
+    private IProjection getCRS(String code) {
+        if (factory == null)
+            factory = CRSFactory.getCRSFactory(); // new ProjectionPool();
+        return factory.get(code);
+    }
+
+    public IProjection convertWktToIProjection(String wkt) {
+        if (wkt == null || wkt.equals(""))
+            return null;
+
+        String code = null;
+        String name = null;
+
+        SpatialReference oSRSSource = new SpatialReference();
+
+        oSRSSource.ImportFromWkt(wkt);
+
+        code = oSRSSource.GetAuthorityCode("PROJCS");
+        if (code == null)
+            code = oSRSSource.GetAuthorityCode("GEOGCS");
+        name = oSRSSource.GetAuthorityName("PROJCS");
+        if (name == null)
+            name = oSRSSource.GetAuthorityName("GEOGCS");
+        try {
+            if (name != null && code != null)
+                return getCRS(name + ":" + code);
+        } catch (NumberFormatException ex) {
+            return null;
+        }
+
+        return null;
+    }
+
+    public String convertIProjectionToWkt(IProjection projection) {
+        if (projection == null)
+            return null;
+        return projection.export(ICRSFactory.FORMAT_WKT);
+    }
+}

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/util/DefaultCRSUtils.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/memory/io/MemoryRasterProvider.java
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/memory/io/MemoryRasterProvider.java	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/memory/io/MemoryRasterProvider.java	(revision 9865)
@@ -0,0 +1,698 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.raster.memory.io;
+
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+import java.io.File;
+
+import org.cresques.cts.ICoordTrans;
+
+import org.gvsig.fmap.dal.coverage.dataset.Buffer;
+import org.gvsig.fmap.dal.coverage.datastruct.BandList;
+import org.gvsig.fmap.dal.coverage.datastruct.Extent;
+import org.gvsig.fmap.dal.coverage.exception.BandAccessException;
+import org.gvsig.fmap.dal.coverage.exception.FileNotOpenException;
+import org.gvsig.fmap.dal.coverage.exception.InvalidSetViewException;
+import org.gvsig.fmap.dal.coverage.exception.InvalidSourceException;
+import org.gvsig.fmap.dal.coverage.exception.NotSupportedExtensionException;
+import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException;
+import org.gvsig.fmap.dal.coverage.exception.RasterDriverException;
+import org.gvsig.fmap.dal.coverage.store.props.Transparency;
+import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
+import org.gvsig.metadata.MetadataLocator;
+import org.gvsig.raster.cache.tile.provider.TileServer;
+import org.gvsig.raster.impl.buffer.SpiRasterQuery;
+import org.gvsig.raster.impl.datastruct.ExtentImpl;
+import org.gvsig.raster.impl.provider.AbstractRasterProvider;
+import org.gvsig.raster.impl.provider.RasterProvider;
+import org.gvsig.raster.impl.store.AbstractRasterDataParameters;
+import org.gvsig.raster.impl.store.properties.DataStoreTransparency;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.task.TaskStatus;
+
+/**
+ * Driver para datos cargados en un objeto IBuffer
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ *
+ */
+public class MemoryRasterProvider extends AbstractRasterProvider {
+	public static String        NAME                     = "Gdal Store";
+	public static String        DESCRIPTION              = "Gdal Raster file";
+	public static final String  METADATA_DEFINITION_NAME = "GdalStore";
+
+	private Extent              v                        = null;
+	protected Buffer            buffer                   = null;
+	private Extent 		        extent                   = null;
+	private boolean             open                     = false;
+
+	public static void register() {
+	}
+
+	public void registerTileProviderFormats(Class<RasterProvider> c) {
+
+	}
+
+	/**
+	 * Mandatory constructor to instantiate an empty provider
+	 */
+	public MemoryRasterProvider() {}
+
+	/**
+	 * Constructor. Asigna el buffer de datos y la extensi�n
+	 * @param proj Proyecci�n
+	 * @param buf Buffer
+	 * @throws NotSupportedExtensionException
+	 */
+	public MemoryRasterProvider(AbstractRasterDataParameters params,
+			DataStoreProviderServices storeServices) throws NotSupportedExtensionException {
+		super(params, storeServices, ToolsLocator.getDynObjectManager()
+				.createDynObject(
+						MetadataLocator.getMetadataManager().getDefinition(
+								METADATA_DEFINITION_NAME)));
+		setParam(storeServices, params);
+		if(!(params instanceof MemoryDataParameters))
+			throw new NotSupportedExtensionException("Buffer not supported");
+
+		extent = ((MemoryDataParameters)params).getExtent();
+		this.buffer = ((MemoryDataParameters)params).getBuffer();
+
+		if(extent != null) {
+			double psX = (extent.maxX() - extent.minX()) / buffer.getWidth();
+			double psY = (extent.minY() - extent.maxY()) / buffer.getHeight();
+			ownTransformation = new AffineTransform(psX, 0, 0, psY, extent.minX(), extent.maxY());
+		} else
+			ownTransformation = new AffineTransform(1, 0, 0, -1, 0, buffer.getHeight());
+
+		if(buffer == null)
+			throw new NotSupportedExtensionException("Buffer invalid");
+
+		load();
+		bandCount = buffer.getBandCount();
+
+		//Obtenemos el tipo de dato de gdal y lo convertimos el de RasterBuf
+		int[] dt = new int[buffer.getBandCount()];
+		for (int i = 0; i < dt.length; i++)
+			dt[i] = buffer.getDataType();
+		setDataType(dt);
+		open = true;
+	}
+
+	public RasterProvider load() {
+		return this;
+	}
+
+	public boolean isOpen() {
+		return open;
+	}
+
+	public void close() {
+		buffer = null;
+		open = false;
+	}
+
+	/**
+	 * Asigna el extent de la vista actual.
+	 */
+	public void setView(Extent e) {
+		v = e;
+	}
+
+	/**
+	 * Obtiene extent de la vista actual
+	 */
+	public Extent getView() {
+		return v;
+	}
+
+	/**
+	 * Obtiene la anchura del fichero
+	 */
+	public double getWidth() {
+		return buffer.getWidth();
+	}
+
+	/**
+	 * Obtiene la altura del fichero
+	 */
+	public double getHeight() {
+		return buffer.getHeight();
+	}
+
+	public void reProject(ICoordTrans rp) {
+	}
+
+	/**
+	 * Obtiene la orientaci�n de la imagen a partir del signo del tama�o de pixel para poder
+	 * asignarlo en el setView. Esto es util para poder conocer como debe leerse la image,
+	 * de abajo a arriba, de arriba a abajo, de izquierda a derecha o de derecha a izquierda.
+	 * La posici�n habitual es la que el pixel size en X es positivo y en Y negativo leyendose
+	 * en este caso las X de menor a mayor y las Y de mayor a menor. Los casos posibles son:
+	 * <UL>
+	 * <LI><B>X > 0; Y < 0;</B> {true, false}</LI>
+	 * <LI><B>X > 0; Y > 0;</B> {true, true}</LI>
+	 * <LI><B>X < 0; Y > 0;</B> {false, true}</LI>
+	 * <LI><B>X < 0; Y < 0;</B> {false, false}</LI>
+	 * </UL>
+	 *
+	 * @return
+	 */
+	/*private boolean[] getOrientation(){
+		boolean[] orientation = {true, false};
+		return orientation;
+	}*/
+
+	public Object getData(int x, int y, int band) {
+		if(buffer.getDataType() == Buffer.TYPE_BYTE){
+			return new Integer(buffer.getElemByte(y, x, band));
+		}else if(buffer.getDataType() == Buffer.TYPE_SHORT){
+			return new Integer(buffer.getElemShort(y, x, band));
+		}else if(buffer.getDataType() == Buffer.TYPE_INT){
+			return new Integer(buffer.getElemInt(y, x, band));
+		}else if(buffer.getDataType() == Buffer.TYPE_FLOAT){
+			return new Float(buffer.getElemFloat(y, x, band));
+		}else if(buffer.getDataType() == Buffer.TYPE_DOUBLE){
+			return new Double(buffer.getElemDouble(y, x, band));
+		}
+		return null;
+	}
+
+
+	/**
+	 * Devuelve el tama�o de bloque
+	 * @return Tama�o de bloque
+	 */
+	public int getBlockSize(){
+		return 0;
+	}
+
+	/**
+	 * Obtiene el flag que dice si la imagen est� o no georreferenciada
+	 * @return true si est� georreferenciada y false si no lo est�.
+	 */
+	public boolean isGeoreferenced() {
+		return (this.extent != null);
+	}
+
+	/**
+	 * Informa de si el driver ha supersampleado en el �ltimo dibujado. Es el driver el que colocar�
+	 * el valor de esta variable cada vez que dibuja.
+	 * @return true si se ha supersampleado y false si no se ha hecho.
+	 */
+	public boolean isSupersampling() {
+		return false;
+	}
+
+	/**
+	 * @return Returns the dataType.
+	 */
+	public int[] getDataType() {
+		int[] dt = new int[buffer.getBandCount()];
+		for (int i = 0; i < dt.length; i++)
+			dt[i] = buffer.getDataType();
+		return dt;
+	}
+
+	/**
+	 * Ajusta los puntos pasados por par�metro a los l�mites del buffer. Es decir si alguno excede
+	 * los l�mites por arriba o por abajo los ajusta.
+	 * @param begin Punto inicial
+	 * @param end Punto final
+	 */
+	private void adjustPointsToBufferLimits(Point2D begin, Point2D end) {
+		if(begin.getX() < 0)
+			begin.setLocation(0, begin.getY());
+		if(begin.getY() > buffer.getHeight())
+			begin.setLocation(begin.getX(), buffer.getHeight());
+		if(end.getY() < 0)
+			end.setLocation(begin.getX(), 0);
+		if(end.getX() > buffer.getWidth())
+			begin.setLocation(buffer.getWidth(), begin.getY());
+	}
+
+	public void loadBuffer(SpiRasterQuery q)
+			throws ProcessInterruptedException, RasterDriverException {
+		getWindow(q.getAdjustedRequestBoundingBox(), q.getBandList(), q.getBufferForProviders(), q.getTaskStatus());
+	}
+
+	public Buffer getWindow(Extent ex, BandList bandList, Buffer rasterBuf, TaskStatus status) {
+		Point2D begin = worldToRaster(new Point2D.Double(ex.getULX(), ex.getULY()));
+		Point2D end = worldToRaster(new Point2D.Double(ex.getLRX(), ex.getLRY()));
+		setView(ex);
+
+		adjustPointsToBufferLimits(begin, end);
+
+		switch(buffer.getDataType()){
+		case Buffer.TYPE_BYTE: writeByteBuffer(rasterBuf, 1, 1, begin, bandList); break;
+		case Buffer.TYPE_SHORT: writeShortBuffer(rasterBuf, 1, 1, begin, bandList); break;
+		case Buffer.TYPE_INT: writeIntBuffer(rasterBuf, 1, 1, begin, bandList); break;
+		case Buffer.TYPE_FLOAT: writeFloatBuffer(rasterBuf, 1, 1, begin, bandList); break;
+		case Buffer.TYPE_DOUBLE: writeDoubleBuffer(rasterBuf, 1, 1, begin, bandList); break;
+		}
+		return rasterBuf;
+	}
+
+	public Buffer getWindow(double x, double y, double w, double h,
+			BandList bandList, Buffer rasterBuf, boolean adjustToExtent, TaskStatus status) {
+		Point2D begin = worldToRaster(new Point2D.Double(x, y));
+		Point2D end = worldToRaster(new Point2D.Double(x + w, y - h));
+		setView(new ExtentImpl(x, y, x + w, y - h));
+
+		adjustPointsToBufferLimits(begin, end);
+
+		switch(buffer.getDataType()){
+		case Buffer.TYPE_BYTE: writeByteBuffer(rasterBuf, 1, 1, begin, bandList); break;
+		case Buffer.TYPE_SHORT: writeShortBuffer(rasterBuf, 1, 1, begin, bandList); break;
+		case Buffer.TYPE_INT: writeIntBuffer(rasterBuf, 1, 1, begin, bandList); break;
+		case Buffer.TYPE_FLOAT: writeFloatBuffer(rasterBuf, 1, 1, begin, bandList); break;
+		case Buffer.TYPE_DOUBLE: writeDoubleBuffer(rasterBuf, 1, 1, begin, bandList); break;
+		}
+		return rasterBuf;
+	}
+
+	public Buffer getWindow(Extent extent, int bufWidth, int bufHeight,
+			BandList bandList, Buffer rasterBuf, boolean adjustToExtent, TaskStatus status) {
+		Point2D begin = worldToRaster(new Point2D.Double(extent.getMin().getX(), extent.getMax().getY()));
+		Point2D end = worldToRaster(new Point2D.Double(extent.getMax().getX(), extent.getMin().getY()));
+		setView(extent);
+
+		adjustPointsToBufferLimits(begin, end);
+
+		//Ancho y alto en pixels (double) del area seleccionada.
+		double w = Math.abs(end.getX() - begin.getX());
+		double h = Math.abs(end.getY() - begin.getY());
+
+		//Relaci�n entre el n�mero de pixels del buffer origen (area seleccionada) y el destino
+		double stepX = w / ((double)bufWidth);
+		double stepY = h / ((double)bufHeight);
+
+		//Escritura separada en 5 llamadas para mejorar el rendimiento
+		switch(buffer.getDataType()){
+		case Buffer.TYPE_BYTE: writeByteBuffer(rasterBuf, stepX, stepY, begin, bandList); break;
+		case Buffer.TYPE_SHORT: writeShortBuffer(rasterBuf, stepX, stepY, begin, bandList); break;
+		case Buffer.TYPE_INT: writeIntBuffer(rasterBuf, stepX, stepY, begin, bandList); break;
+		case Buffer.TYPE_FLOAT: writeFloatBuffer(rasterBuf, stepX, stepY, begin, bandList); break;
+		case Buffer.TYPE_DOUBLE: writeDoubleBuffer(rasterBuf, stepX, stepY, begin, bandList); break;
+		}
+
+		/*int xPx = 0, yPx = 0;
+		for (int iBand = 0; iBand < rasterBuf.getBandCount(); iBand++) {
+			yPx = 0;
+			for(double row = begin.getY(); yPx < bufHeight; row += stepY) {
+				xPx = 0;
+				for(double col = begin.getX(); xPx < bufWidth; col += stepX) {
+					switch(buffer.getDataType()){
+					case Buffer.TYPE_BYTE: rasterBuf.setElem(yPx, xPx, iBand, buffer.getElemByte((int)row, (int)col, iBand)); break;
+					case Buffer.TYPE_SHORT: rasterBuf.setElem(yPx, xPx, iBand, buffer.getElemShort((int)row, (int)col, iBand)); break;
+					case Buffer.TYPE_INT: rasterBuf.setElem(yPx, xPx, iBand, buffer.getElemInt((int)row, (int)col, iBand)); break;
+					case Buffer.TYPE_FLOAT: rasterBuf.setElem(yPx, xPx, iBand, buffer.getElemFloat((int)row, (int)col, iBand)); break;
+					case Buffer.TYPE_DOUBLE: rasterBuf.setElem(yPx, xPx, iBand, buffer.getElemDouble((int)row, (int)col, iBand)); break;
+					}
+					xPx ++;
+				}
+				yPx ++;
+			}
+		}*/
+		return rasterBuf;
+	}
+
+	/**
+	 * Escribe sobre el buffer pasado por par�metro los valores solicitados, desde el buffer de la clase. Los valores
+	 * se solicitan a trav�s de los par�metros. En ellos se especifica el tama�o del buffer de destino, las bandas a
+	 * escribir, el punto inicial en coordenadas pixel (double) y el incremento.
+	 * @param rasterBuf Buffer donde se escriben los datos
+	 * @param stepX Incremento en X. Cada vez que se escribe un pixel en X se incrementa el contador en stepX pixels. Esto es necesario
+	 * ya que el buffer destino no tiene porque tener el mismo ancho que el de origen. Este valor suele ser ancho_buffer_origen / ancho_buffer_destino.
+	 * @param stepY Incremento en Y. Cada vez que se escribe un pixel en Y se incrementa el contador en stepY pixels. Esto es necesario
+	 * ya que el buffer destino no tiene porque tener el mismo alto que el de origen. Este valor suele ser alto_buffer_origen / alto_buffer_destino.
+	 * @param begin pixel donde se comienza a leer en el buffer de origen. Este valor es decimal ya que no tiene porque empezar a leerse al principio
+	 * del pixel. Esto es util cuando se supersamplea.
+	 */
+	private void writeByteBuffer(Buffer rasterBuf, double stepX, double stepY, Point2D begin, BandList bandList) {
+		int xPx = 0, yPx = 0;
+		for (int iBand = 0; iBand < buffer.getBandCount(); iBand++) {
+			int[] drawableBands = bandList.getBufferBandToDraw(new File(this.getURIOfFirstProvider()).getAbsolutePath(), iBand);
+			if(drawableBands == null || (drawableBands.length == 1 && drawableBands[0] == -1))
+				continue;
+			for(int drawBands = 0; drawBands < drawableBands.length; drawBands++) {
+				yPx = 0;
+				for(double row = begin.getY(); (yPx < rasterBuf.getHeight() && row < buffer.getHeight()); row += stepY) {
+					xPx = 0;
+					for(double col = begin.getX(); (xPx < rasterBuf.getWidth() && col < buffer.getWidth()); col += stepX) {
+						rasterBuf.setElem(yPx, xPx, iBand, buffer.getElemByte((int)row, (int)col, iBand));
+						xPx ++;
+					}
+					yPx ++;
+				}
+			}
+		}
+	}
+
+	/**
+	 * Escribe sobre el buffer pasado por par�metro los valores solicitados, desde el buffer de la clase. Los valores
+	 * se solicitan a trav�s de los par�metros. En ellos se especifica el tama�o del buffer de destino, las bandas a
+	 * escribir, el punto inicial en coordenadas pixel (double) y el incremento.
+	 * @param rasterBuf Buffer donde se escriben los datos
+	 * @param stepX Incremento en X. Cada vez que se escribe un pixel en X se incrementa el contador en stepX pixels. Esto es necesario
+	 * ya que el buffer destino no tiene porque tener el mismo ancho que el de origen. Este valor suele ser ancho_buffer_origen / ancho_buffer_destino.
+	 * @param stepY Incremento en Y. Cada vez que se escribe un pixel en Y se incrementa el contador en stepY pixels. Esto es necesario
+	 * ya que el buffer destino no tiene porque tener el mismo alto que el de origen. Este valor suele ser alto_buffer_origen / alto_buffer_destino.
+	 * @param begin pixel donde se comienza a leer en el buffer de origen. Este valor es decimal ya que no tiene porque empezar a leerse al principio
+	 * del pixel. Esto es util cuando se supersamplea.
+	 */
+	private void writeShortBuffer(Buffer rasterBuf, double stepX, double stepY, Point2D begin, BandList bandList) {
+		int xPx = 0, yPx = 0;
+		for (int iBand = 0; iBand < buffer.getBandCount(); iBand++) {
+			int[] drawableBands = bandList.getBufferBandToDraw(new File(this.getURIOfFirstProvider()).getAbsolutePath(), iBand);
+			if(drawableBands == null || (drawableBands.length == 1 && drawableBands[0] == -1))
+				continue;
+			for(int drawBands = 0; drawBands < drawableBands.length; drawBands++) {
+				yPx = 0;
+				for(double row = begin.getY(); yPx < rasterBuf.getHeight(); row += stepY) {
+					xPx = 0;
+					for(double col = begin.getX(); xPx < rasterBuf.getWidth(); col += stepX) {
+						rasterBuf.setElem(yPx, xPx, iBand, buffer.getElemShort((int)row, (int)col, iBand));
+						xPx ++;
+					}
+					yPx ++;
+				}
+			}
+		}
+	}
+
+	/**
+	 * Escribe sobre el buffer pasado por par�metro los valores solicitados, desde el buffer de la clase. Los valores
+	 * se solicitan a trav�s de los par�metros. En ellos se especifica el tama�o del buffer de destino, las bandas a
+	 * escribir, el punto inicial en coordenadas pixel (double) y el incremento.
+	 * @param rasterBuf Buffer donde se escriben los datos
+	 * @param stepX Incremento en X. Cada vez que se escribe un pixel en X se incrementa el contador en stepX pixels. Esto es necesario
+	 * ya que el buffer destino no tiene porque tener el mismo ancho que el de origen. Este valor suele ser ancho_buffer_origen / ancho_buffer_destino.
+	 * @param stepY Incremento en Y. Cada vez que se escribe un pixel en Y se incrementa el contador en stepY pixels. Esto es necesario
+	 * ya que el buffer destino no tiene porque tener el mismo alto que el de origen. Este valor suele ser alto_buffer_origen / alto_buffer_destino.
+	 * @param begin pixel donde se comienza a leer en el buffer de origen. Este valor es decimal ya que no tiene porque empezar a leerse al principio
+	 * del pixel. Esto es util cuando se supersamplea.
+	 */
+	private void writeIntBuffer(Buffer rasterBuf, double stepX, double stepY, Point2D begin, BandList bandList) {
+		int xPx = 0, yPx = 0;
+		for (int iBand = 0; iBand < buffer.getBandCount(); iBand++) {
+			int[] drawableBands = bandList.getBufferBandToDraw(new File(this.getURIOfFirstProvider()).getAbsolutePath(), iBand);
+			if(drawableBands == null || (drawableBands.length == 1 && drawableBands[0] == -1))
+				continue;
+			for(int drawBands = 0; drawBands < drawableBands.length; drawBands++) {
+				yPx = 0;
+				for(double row = begin.getY(); yPx < rasterBuf.getHeight(); row += stepY) {
+					xPx = 0;
+					for(double col = begin.getX(); xPx < rasterBuf.getWidth(); col += stepX) {
+						rasterBuf.setElem(yPx, xPx, iBand, buffer.getElemInt((int)row, (int)col, iBand));
+						xPx ++;
+					}
+					yPx ++;
+				}
+			}
+		}
+	}
+
+	/**
+	 * Escribe sobre el buffer pasado por par�metro los valores solicitados, desde el buffer de la clase. Los valores
+	 * se solicitan a trav�s de los par�metros. En ellos se especifica el tama�o del buffer de destino, las bandas a
+	 * escribir, el punto inicial en coordenadas pixel (double) y el incremento.
+	 * @param rasterBuf Buffer donde se escriben los datos
+	 * @param stepX Incremento en X. Cada vez que se escribe un pixel en X se incrementa el contador en stepX pixels. Esto es necesario
+	 * ya que el buffer destino no tiene porque tener el mismo ancho que el de origen. Este valor suele ser ancho_buffer_origen / ancho_buffer_destino.
+	 * @param stepY Incremento en Y. Cada vez que se escribe un pixel en Y se incrementa el contador en stepY pixels. Esto es necesario
+	 * ya que el buffer destino no tiene porque tener el mismo alto que el de origen. Este valor suele ser alto_buffer_origen / alto_buffer_destino.
+	 * @param begin pixel donde se comienza a leer en el buffer de origen. Este valor es decimal ya que no tiene porque empezar a leerse al principio
+	 * del pixel. Esto es util cuando se supersamplea.
+	 */
+	private void writeFloatBuffer(Buffer rasterBuf, double stepX, double stepY, Point2D begin, BandList bandList) {
+		int xPx = 0, yPx = 0;
+		for (int iBand = 0; iBand < buffer.getBandCount(); iBand++) {
+			int[] drawableBands = bandList.getBufferBandToDraw(new File(this.getURIOfFirstProvider()).getAbsolutePath(), iBand);
+			if(drawableBands == null || (drawableBands.length == 1 && drawableBands[0] == -1))
+				continue;
+			for(int drawBands = 0; drawBands < drawableBands.length; drawBands++) {
+				yPx = 0;
+				for(double row = begin.getY(); yPx < rasterBuf.getHeight(); row += stepY) {
+					xPx = 0;
+					for(double col = begin.getX(); xPx < rasterBuf.getWidth(); col += stepX) {
+						rasterBuf.setElem(yPx, xPx, iBand, buffer.getElemFloat((int)row, (int)col, iBand));
+						xPx ++;
+					}
+					yPx ++;
+				}
+			}
+		}
+	}
+
+	/**
+	 * Escribe sobre el buffer pasado por par�metro los valores solicitados, desde el buffer de la clase. Los valores
+	 * se solicitan a trav�s de los par�metros. En ellos se especifica el tama�o del buffer de destino, las bandas a
+	 * escribir, el punto inicial en coordenadas pixel (double) y el incremento.
+	 * @param rasterBuf Buffer donde se escriben los datos
+	 * @param stepX Incremento en X. Cada vez que se escribe un pixel en X se incrementa el contador en stepX pixels. Esto es necesario
+	 * ya que el buffer destino no tiene porque tener el mismo ancho que el de origen. Este valor suele ser ancho_buffer_origen / ancho_buffer_destino.
+	 * @param stepY Incremento en Y. Cada vez que se escribe un pixel en Y se incrementa el contador en stepY pixels. Esto es necesario
+	 * ya que el buffer destino no tiene porque tener el mismo alto que el de origen. Este valor suele ser alto_buffer_origen / alto_buffer_destino.
+	 * @param begin pixel donde se comienza a leer en el buffer de origen. Este valor es decimal ya que no tiene porque empezar a leerse al principio
+	 * del pixel. Esto es util cuando se supersamplea.
+	 */
+	private void writeDoubleBuffer(Buffer rasterBuf, double stepX, double stepY, Point2D begin, BandList bandList) {
+		int xPx = 0, yPx = 0;
+		for (int iBand = 0; iBand < buffer.getBandCount(); iBand++) {
+			int[] drawableBands = bandList.getBufferBandToDraw(new File(this.getURIOfFirstProvider()).getAbsolutePath(), iBand);
+			if(drawableBands == null || (drawableBands.length == 1 && drawableBands[0] == -1))
+				continue;
+			for(int drawBands = 0; drawBands < drawableBands.length; drawBands++) {
+				yPx = 0;
+				for(double row = begin.getY(); yPx < rasterBuf.getHeight(); row += stepY) {
+					xPx = 0;
+					for(double col = begin.getX(); xPx < rasterBuf.getWidth(); col += stepX) {
+						rasterBuf.setElem(yPx, xPx, iBand, buffer.getElemDouble((int)row, (int)col, iBand));
+						xPx ++;
+					}
+					yPx ++;
+				}
+			}
+		}
+	}
+
+	/*
+	 *  (non-Javadoc)
+	 * @see org.gvsig.raster.dataset.RasterDataset#getWindowRaster(int, int, org.gvsig.raster.dataset.BandList, org.gvsig.raster.dataset.Buffer)
+	 */
+//	public Buffer getWindow(int x, int y, BandList bandList, Buffer rasterBuf) {
+//		int w = rasterBuf.getWidth();
+//		int h = rasterBuf.getHeight();
+//		setView(
+//				new ExtentImpl( rasterUtil.getMapRectFromPxRect(getExtent().toRectangle2D(),
+//							getWidth(),
+//							getHeight(),
+//							new Rectangle2D.Double(x, y, w, h)))
+//				);
+//
+//		for(int iBand = 0; iBand < buffer.getBandCount(); iBand ++){
+//			int[] drawableBands = bandList.getBufferBandToDraw(this.getURIOfFirstProvider(), iBand);
+//			if(drawableBands == null || (drawableBands.length == 1 && drawableBands[0] == -1))
+//				continue;
+//			if(buffer.getDataType() == Buffer.TYPE_BYTE) {
+//				for(int drawBands = 0; drawBands < drawableBands.length; drawBands++) {
+//					for(int line = y; line < (y + h); line ++)
+//						for(int col = x; col < (x + w); col ++)
+//							rasterBuf.setElem((line - y), (col - x), drawableBands[drawBands], buffer.getElemByte(line, col, drawableBands[drawBands]));
+//				}
+//			}else if(buffer.getDataType() == Buffer.TYPE_SHORT){
+//				for(int drawBands = 0; drawBands < drawableBands.length; drawBands++){
+//					for(int line = y; line < (y + h); line ++)
+//						for(int col = x; col < (x + w); col ++)
+//							rasterBuf.setElem((line - y), (col - x), drawableBands[drawBands], buffer.getElemShort(line, col, drawableBands[drawBands]));
+//				}
+//			}else if(buffer.getDataType() == Buffer.TYPE_INT){
+//				for(int drawBands = 0; drawBands < drawableBands.length; drawBands++){
+//					for(int line = y; line < (y + h); line ++)
+//						for(int col = x; col < (x + w); col ++)
+//							rasterBuf.setElem((line - y), (col - x), drawableBands[drawBands], buffer.getElemInt(line, col, drawableBands[drawBands]));
+//				}
+//			}else if(buffer.getDataType() == Buffer.TYPE_FLOAT){
+//				for(int drawBands = 0; drawBands < drawableBands.length; drawBands++){
+//					for(int line = y; line < (y + h); line ++)
+//						for(int col = x; col < (x + w); col ++)
+//							rasterBuf.setElem((line - y), (col - x), drawableBands[drawBands], buffer.getElemFloat(line, col, drawableBands[drawBands]));
+//				}
+//			}else if(buffer.getDataType() == Buffer.TYPE_DOUBLE){
+//				for(int drawBands = 0; drawBands < drawableBands.length; drawBands++){
+//					for(int line = y; line < (y + h); line ++)
+//						for(int col = x; col < (x + w); col ++)
+//							rasterBuf.setElem((line - y), (col - x), drawableBands[drawBands], buffer.getElemDouble(line, col, drawableBands[drawBands]));
+//				}
+//			}
+//		}
+//		return rasterBuf;
+//	}
+
+	public Buffer getWindow(int x, int y, int w, int h,
+			BandList bandList, Buffer rasterBuf, TaskStatus status) {
+		setView(
+				new ExtentImpl( rasterUtil.getMapRectFromPxRect(getExtent().toRectangle2D(),
+							getWidth(),
+							getHeight(),
+							new Rectangle2D.Double(x, y, w, h)))
+				);
+
+		//Relaci�n entre el n�mero de pixels del buffer origen (area seleccionada) y el destino
+		double stepX = w / ((double)rasterBuf.getWidth());
+		double stepY = h / ((double)rasterBuf.getHeight());
+		switch(buffer.getDataType()){
+		case Buffer.TYPE_BYTE: writeByteBuffer(rasterBuf, stepX, stepY, new Point2D.Double(x, y), bandList); break;
+		case Buffer.TYPE_SHORT: writeShortBuffer(rasterBuf, stepX, stepY, new Point2D.Double(x, y), bandList); break;
+		case Buffer.TYPE_INT: writeIntBuffer(rasterBuf, stepX, stepY, new Point2D.Double(x, y), bandList); break;
+		case Buffer.TYPE_FLOAT: writeFloatBuffer(rasterBuf, stepX, stepY, new Point2D.Double(x, y), bandList); break;
+		case Buffer.TYPE_DOUBLE: writeDoubleBuffer(rasterBuf, stepX, stepY, new Point2D.Double(x, y), bandList); break;
+		}
+		return rasterBuf;
+	}
+
+	public Object readCompleteLine(int line, int band) throws InvalidSetViewException, FileNotOpenException, RasterDriverException {
+		switch(buffer.getDataType()){
+		case Buffer.TYPE_BYTE: return buffer.getLineFromBandByte(line, band);
+		case Buffer.TYPE_SHORT: return buffer.getLineFromBandShort(line, band);
+		case Buffer.TYPE_INT: return buffer.getLineFromBandInt(line, band);
+		case Buffer.TYPE_FLOAT: return buffer.getLineFromBandFloat(line, band);
+		case Buffer.TYPE_DOUBLE: return buffer.getLineFromBandDouble(line, band);
+		}
+		return null;
+	}
+
+	public Object readBlock(int pos, int blockHeight, double scale) throws InvalidSetViewException, FileNotOpenException, RasterDriverException {
+		if(pos < 0)
+			throw new InvalidSetViewException("Request out of grid");
+
+		if((pos + blockHeight) > buffer.getHeight())
+			blockHeight = Math.abs(buffer.getHeight() - pos);
+
+		switch(buffer.getDataType()){
+		case Buffer.TYPE_BYTE:
+			byte[][][] bufb = new byte[getBandCount()][][];
+			for (int iBand = 0; iBand < buffer.getBandCount(); iBand++) {
+				for (int row = 0; row < blockHeight; row++) {
+					bufb[iBand][row] = buffer.getLineFromBandByte(row, iBand);
+				}
+			}
+			return bufb;
+		case Buffer.TYPE_SHORT:
+			short[][][] bufs = new short[getBandCount()][][];
+			for (int iBand = 0; iBand < buffer.getBandCount(); iBand++) {
+				for (int row = 0; row < blockHeight; row++) {
+					bufs[iBand][row] = buffer.getLineFromBandShort(row, iBand);
+				}
+			}
+			return bufs;
+		case Buffer.TYPE_INT:
+			int[][][] bufi = new int[getBandCount()][][];
+			for (int iBand = 0; iBand < buffer.getBandCount(); iBand++) {
+				for (int row = 0; row < blockHeight; row++) {
+					bufi[iBand][row] = buffer.getLineFromBandInt(row, iBand);
+				}
+			}
+			return bufi;
+		case Buffer.TYPE_FLOAT:
+			float[][][] buff = new float[getBandCount()][][];
+			for (int iBand = 0; iBand < buffer.getBandCount(); iBand++) {
+				for (int row = 0; row < blockHeight; row++) {
+					buff[iBand][row] = buffer.getLineFromBandFloat(row, iBand);
+				}
+			}
+			return buff;
+		case Buffer.TYPE_DOUBLE:
+			double[][][] bufd = new double[getBandCount()][][];
+			for (int iBand = 0; iBand < buffer.getBandCount(); iBand++) {
+				for (int row = 0; row < blockHeight; row++) {
+					bufd[iBand][row] = buffer.getLineFromBandDouble(row, iBand);
+				}
+			}
+			return bufd;
+		}
+		return null;
+	}
+
+		/**
+	 * Obtiene el objeto que contiene el estado de la transparencia
+	 */
+	public Transparency getTransparency() {
+		if(transparency == null)
+			transparency = new DataStoreTransparency(getColorInterpretation());
+		return transparency;
+	}
+
+	public int getOverviewCount(int band) throws BandAccessException, RasterDriverException {
+		if(band >= getBandCount())
+			throw new BandAccessException("Wrong band");
+		return 0;
+	}
+
+	public int getOverviewWidth(int band, int overview) throws BandAccessException, RasterDriverException {
+		if (band >= getBandCount())
+			throw new BandAccessException("Wrong band");
+		return 0;
+	}
+
+	public int getOverviewHeight(int band, int overview) throws BandAccessException, RasterDriverException {
+		if (band >= getBandCount())
+			throw new BandAccessException("Wrong band");
+		return 0;
+	}
+
+	public boolean isOverviewsSupported() {
+		return false;
+	}
+
+	public String getProviderName() {
+		return NAME;
+	}
+
+        public String getName() {
+		return "buffer"+this.hashCode();
+	}
+
+        public String getFullName() {
+		return this.getName();
+	}
+
+	public void setStatus(RasterProvider provider) {
+		if(provider instanceof MemoryRasterProvider) {
+			//Not implemented yet
+		}
+	}
+
+	public TileServer getTileServer() {
+		return null;
+	}
+
+    public void addFile(File file) throws InvalidSourceException {
+        // Do nothing
+    }
+
+    public void removeFile(File file) {
+        // Do nothing
+    }
+
+}
\ No newline at end of file

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/memory/io/MemoryRasterProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/memory/io/MemoryDataParameters.java
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/memory/io/MemoryDataParameters.java	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/memory/io/MemoryDataParameters.java	(revision 9865)
@@ -0,0 +1,114 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 IVER T.I   {{Task}}
+*/
+
+package org.gvsig.raster.memory.io;
+
+import org.gvsig.fmap.dal.coverage.dataset.Buffer;
+import org.gvsig.fmap.dal.coverage.datastruct.Extent;
+import org.gvsig.raster.impl.store.AbstractRasterFileDataParameters;
+
+/**
+ * Parameters for the memory provider
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ */
+public class MemoryDataParameters extends AbstractRasterFileDataParameters {
+	private final String id = "memory";
+	private Buffer buffer = null;
+	private Extent extent = null;
+	
+	/**
+	 * Constructor vacio
+	 */
+	public MemoryDataParameters() {
+	}
+	
+	/**
+	 * Contructor
+	 * @param buf buffer del driver
+	 * @param ext extensi�n del buffer
+	 */
+	public MemoryDataParameters(Buffer buf, Extent ext) {
+		this.buffer = buf;
+		this.extent = ext;
+	}
+	
+	/**
+	 * Obtiene el buffer de datos
+	 * @return Buffer
+	 */
+	public Buffer getBuffer() {
+		return buffer;
+	}
+	
+	/**
+	 * Asigna el buffer de datos
+	 * @param buffer Buffer
+	 */
+	public void setBuffer(Buffer buffer) {
+		this.buffer = buffer;
+	}
+	
+	/**
+	 * Obtiene la extensi�n del buffer de datos
+	 * @return Extent
+	 */
+	public Extent getExtent() {
+		return extent;
+	}
+	
+	/**O
+	 * Asigna la extensi�n del buffer de datos
+	 * @param extent
+	 */
+	public void setExtent(Extent extent) {
+		this.extent = extent;
+	}
+
+	/**
+	 * Obtiene el identificador del driver
+	 * @return String 
+	 */
+	public String getFormatID() {
+		return id;
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.DataStoreParameters#getDataStoreName()
+	 */
+	public String getDataStoreName() {
+		return MemoryRasterProvider.NAME;
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.DataStoreParameters#getDescription()
+	 */
+	public String getDescription() {
+		return MemoryRasterProvider.DESCRIPTION;
+	}
+}

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/memory/io/MemoryDataParameters.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/GdalBuffer.java
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/GdalBuffer.java	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/GdalBuffer.java	(revision 9865)
@@ -0,0 +1,86 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+* MA  02110-1301, USA.
+* 
+*/
+
+package org.gvsig.jgdal;
+
+
+/**  
+ * Buffer para el almacenamiento de l�neas de la im�g�n. Esta clase es instanciada desde C para que se pueda acceder a sus datos desde el cliente java.
+ * 
+ * @author Nacho Brodin (nachobrodin@gmail.com).<BR> Equipo de desarrollo gvSIG.<BR> http://www.gvsig.gva.es
+ * @version 0.0
+ * @link http://www.gvsig.gva.es
+ */
+
+public class GdalBuffer{
+	
+    public byte[] buffByte;			//8 bits
+    public short[] buffShort;		//16 bits
+    public int[] buffInt;			//32 bits
+    public float[] buffFloat;		//32 bits
+    public double[] buffDouble;		//64 bits
+    
+    public byte[] buffAPalette;
+    public byte[] buffRPalette;
+    public byte[] buffGPalette;
+    public byte[] buffBPalette;
+    
+    public void reservaByte(int r){
+    	buffByte = new byte[r];
+    }
+    
+    public void reservaShort(int r){
+    	buffShort = new short[r];
+    }
+    
+    public void reservaInt(int r){
+    	buffInt = new int[r];
+    }
+    
+    public void reservaFloat(int r){
+    	buffFloat = new float[r];
+    }
+    
+    public void reservaDouble(int r){
+    	buffDouble = new double[r];
+    }
+    
+    public void reservaPalette(int r){
+    	buffAPalette = new byte[r];
+    	buffRPalette = new byte[r];
+        buffGPalette = new byte[r];
+        buffBPalette = new byte[r];
+    }
+    
+    public int getSize(){
+      for(int i=0;i<5;i++){
+      	if(buffByte!=null)return buffByte.length;
+    	if(buffShort!=null)return buffShort.length;
+    	if(buffInt!=null)return buffInt.length;
+    	if(buffFloat!=null)return buffFloat.length;
+    	if(buffDouble!=null)return buffDouble.length;
+    	if(buffRPalette!=null)return buffRPalette.length;
+      }
+      return 0;
+    }
+  
+}
\ No newline at end of file

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/GdalBuffer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/GdalWarp.java
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/GdalWarp.java	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/GdalWarp.java	(revision 9865)
@@ -0,0 +1,118 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+package org.gvsig.jgdal;
+
+import java.util.ArrayList;
+
+/**
+ * Clase que recubre la funci�n de reproyecci�n de gdal.
+ *
+ * @author Miguel �ngel Querol Carratal�
+ */
+public class GdalWarp {
+	private int    porcentaje;
+
+	/**
+	 * Par�metros de la operaci�n de reproyecci�n
+	 */
+	private String s_srs = null;
+
+	/**
+	 * M�todo nativo para el warp desde gdal.
+	 */
+//	private native int warpDataset(String s_srs, String t_srs, String source, String dest, String format);
+
+	/**
+	 * Constructor generico.
+	 */
+	public GdalWarp() {}
+
+	/**
+	 * Reproyecta una imagen raster, creando una imagen de salida
+	 * @param proj EPSG:code o proj4
+	 * @param source Ruta del fichero fuente
+	 * @param dest Ruta del fichero destino
+	 * @param format
+	 * @return 0 si ha ocurrido algun error o 1 si la ejecuci�n ha sido correcta.
+	 * @throws GdalException
+	 */
+	public int warp(String t_srs, String source, String dest, String format) {
+
+//		int stat = warpDataset(s_srs, t_srs, source, dest, format);
+		int stat = 0;
+
+		return stat;
+	}
+
+	/**
+	 * Indica la proyecci�n del dataset origen
+	 * @param s_srs
+	 */
+	public void setSsrs(String s_srs) {
+		this.s_srs = s_srs;
+	}
+
+	/**
+	 * Obtiene el porcentaje de proceso que se ha completado
+	 */
+	public int getPercent() {
+		return porcentaje;
+	}
+
+	/**
+	 * Devuelve la lista de drivers que usa GdalWarp para reproyectar
+	 * @return
+	 */
+	static public ArrayList getDrivers() {
+		ArrayList list = new ArrayList();
+		list.add("GTiff");
+		list.add("VRT");
+		list.add("NITF");
+		list.add("HFA");
+		list.add("ELAS");
+		list.add("MEM");
+		list.add("BMP");
+		list.add("PCIDSK");
+		list.add("ILWIS");
+		String os = System.getProperty("os.name");
+		if (!os.toLowerCase().startsWith("windows"))
+			list.add("HDF4Image");
+		list.add("PNM");
+		list.add("ENVI");
+		list.add("EHdr");
+		list.add("PAux");
+		list.add("MFF");
+		list.add("MFF2");
+		list.add("BT");
+		list.add("IDA");
+		list.add("RMF");
+		list.add("RST");
+		list.add("Leveller");
+		list.add("Terragen");
+		list.add("ERS");
+		list.add("INGR");
+		list.add("GSAG");
+		list.add("GSBG");
+		list.add("ADRG");
+		return list;
+	}
+}

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/GdalWarp.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/GdalDriver.java
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/GdalDriver.java	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/GdalDriver.java	(revision 9865)
@@ -0,0 +1,150 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+package org.gvsig.jgdal;
+
+import java.io.File;
+import java.nio.charset.Charset;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import org.gdal.gdal.Dataset;
+import org.gdal.gdal.Driver;
+import org.gdal.gdal.gdal;
+/**
+ * Representa un driver de un tipo de im�gen
+ *
+ * @author Nacho Brodin (nachobrodin@gmail.com).<BR> Equipo de desarrollo gvSIG.<BR> http://www.gvsig.gva.es
+ * @version 0.0
+ * @link http://www.gvsig.gva.es
+ */
+public class GdalDriver{
+	private Driver driver;
+
+	public GdalDriver(Driver drv) {
+		this.driver = drv;
+	}
+
+	/**
+	 * Crea una copia de una im�gen a partir de un dataset de origen especificado.
+	 * @param file	Nombre del fichero sobre el cual se guardar� la copia
+	 * @param src	Dataset fuente a copiar
+	 * @param bstrict	TRUE si la copia debe ser estrictamente equivalente y FALSE indica que la copia puede
+	 * adaptarse a las necesidades del formato de salida
+	 * @return Gdal	Dataset de la im�gen de salida
+	 * @throws GdalException
+	 */
+	public GdalDataset createCopy(String file, GdalDataset src, boolean bstrict) throws GdalException {
+		String path = file.substring(0, file.lastIndexOf(File.separator));
+		File f = new File(path);
+		if (!f.canWrite())
+			throw new GdalException("Ruta de archivo incorrecta.");
+		f = null;
+
+		if (src == null)
+			throw new GdalException("El objeto Gdal es null");
+
+		Dataset data = gdal.Open(file, bstrict ? 1 : 0);
+		Dataset copyDataset = this.driver.CreateCopy(file, data, bstrict ? 1 : 0);
+
+		return new GdalDataset(copyDataset);
+	}
+
+
+	/**
+	 * A partir de las opciones en forma de vector de Strings pasadas por el usuario donde cada
+	 * elemento del vector tiene la forma VARIABLE=VALOR crea el objeto Options para que sea accesible
+	 * a las funciones JNI desde C.
+	 * @param params	Vector de strigs con las opciones
+	 * @return Options	Objeto de opciones
+	 */
+	private Options selectOptions(String[] params) {
+		if (params == null)
+			return null;
+
+		Options opc = new Options(params.length);
+		StringTokenizer st;
+		for (int i = 0; i < params.length; i++) {
+			st = new StringTokenizer(params[i], "=");
+			String var = st.nextToken();
+			String dato = st.nextToken();
+			opc.addOption(var, dato);
+		}
+		return opc;
+	}
+
+	/**
+	 * Crea una copia de una im�gen a partir de un dataset de origen especificado y unos par�metros dados.
+	 * @param file	Nombre del fichero sobre el cual se guardar� la copia
+	 * @param src	Dataset fuente a copiar
+	 * @param bstrict	TRUE si la copia debe ser estrictamente equivalente y FALSE indica que la copia puede
+	 * adaptarse a las necesidades del formato de salida
+	 * @param params	Vector de strigs con las opciones de la copia
+	 * @return Gdal	Dataset de la im�gen de salida
+	 * @throws GdalException
+	 */
+	public GdalDataset createCopy(String file, GdalDataset src, boolean bstrict, String[] params) throws GdalException {
+		String path = file.substring(0, file.lastIndexOf(File.separator));
+		File f = new File(path);
+		if (!f.canWrite())
+			throw new GdalException("Ruta de archivo incorrecta.");
+		f = null;
+
+		Dataset data = gdal.Open(file, bstrict ? 1 : 0);
+		Dataset copyDataset = this.driver.CreateCopy(file, src.getDataset(), bstrict ? 1 : 0, params);
+
+		if (copyDataset == null)
+			throw new GdalException("No se ha podido crear la copia");
+
+		return new GdalDataset(copyDataset);
+	}
+
+
+	/**
+	 * Crea un nuevo dataset con el driver actual
+	 *
+	 * @param filename	Nombre del dataset a crear
+	 * @param nXSize	Ancho en pixels
+	 * @param nYSize	Alto en pixels
+	 * @param nBands	N�mero de bandas
+	 * @param nType	Tipo de raster
+	 * @param params	lista de par�metros especificos del driver
+	 */
+	public GdalDataset create(String filename, int nXSize, int nYSize, int nBands, int nType, String[] params) throws GdalException {
+
+		byte ptext[] = filename.getBytes(Charset.forName("ISO_8859_1"));
+		String value = new String(ptext, Charset.forName("UTF-8"));
+		Dataset data = this.driver.Create(value, nXSize, nYSize, nBands, nType, StringArrayToVector(params));
+
+		return new GdalDataset(data);
+	}
+
+	private static Vector StringArrayToVector(String[] options)
+	  {
+	      if (options == null)
+	        return null;
+	      Vector v = new Vector();
+	      for(int i=0;i<options.length;i++)
+	        v.addElement(options[i]);
+	      return v;
+	  }
+
+}
\ No newline at end of file

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/GdalDriver.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/GdalException.java
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/GdalException.java	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/GdalException.java	(revision 9865)
@@ -0,0 +1,41 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+* MA  02110-1301, USA.
+* 
+*/
+ 
+package org.gvsig.jgdal;
+
+/**
+ * Es generada cuando los c�digos de retorno de las funciones de Gdal significan que algo ha ido mal.
+ * 
+ * @author Nacho Brodin (nachobrodin@gmail.com).<BR> Equipo de desarrollo gvSIG.<BR> http://www.gvsig.gva.es
+ * @version 0.0
+ * @link http://www.gvsig.gva.es
+ */
+
+
+public class GdalException extends Exception{
+
+	public GdalException(String msg){
+		super(msg);
+	}
+	
+	
+}
\ No newline at end of file

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/GdalException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/GeoTransform.java
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/GeoTransform.java	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/GeoTransform.java	(revision 9865)
@@ -0,0 +1,68 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.jgdal;
+
+import java.util.Arrays;
+
+/**
+ * Buffer para el almacenamiento de los datos de georeferenciaci?n.
+ *
+ * @author Nacho Brodin (nachobrodin@gmail.com).<BR> Equipo de desarrollo
+ * gvSIG.<BR> http://www.gvsig.gva.es
+ * @version 0.0
+ * @see http://www.gvsig.gva.es
+ * @link http://www.gvsig.gva.es
+ */
+public class GeoTransform {
+
+    public double adfgeotransform[] = new double[6];
+
+    private static double identity[] = {0, 1, 0, 0, 0, 1};
+
+    public boolean isIdentity() {
+        return Arrays.equals(this.adfgeotransform, identity);
+    }
+
+    ;
+   
+   public boolean isValid() {
+        boolean valid = false;
+        for (int i = 0; i < this.adfgeotransform.length; i++) {
+            if (this.adfgeotransform[i] != 0) {
+                valid = true;
+            }
+        }
+        return valid;
+    }
+
+    public static class GeoTransformException extends GdalException {
+
+        public GeoTransformException(String msg) {
+            super(msg);
+        }
+
+        public GeoTransformException() {
+            super("Invalid GeoTransformation");
+        }
+    }
+
+}

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/GeoTransform.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/GdalColorEntry.java
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/GdalColorEntry.java	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/GdalColorEntry.java	(revision 9865)
@@ -0,0 +1,41 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+* MA  02110-1301, USA.
+* 
+*/
+package org.gvsig.jgdal;
+
+/**
+ * Clase que representa una entrada de la tabla de color.
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ *
+ */
+public class GdalColorEntry{
+	 /*! gray, red, cyan or hue */
+    public short      c1;      
+
+    /*! green, magenta, or lightness */    
+    public short      c2;      
+
+    /*! blue, yellow, or saturation */
+    public short      c3;      
+
+    /*! alpha or blackband */
+    public short      c4;      
+}
\ No newline at end of file

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/GdalColorEntry.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/GdalTools.java
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/GdalTools.java	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/GdalTools.java	(revision 9865)
@@ -0,0 +1,39 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+* MA  02110-1301, USA.
+* 
+*/
+
+package org.gvsig.jgdal;
+
+public class GdalTools {
+	
+	static public int CSLFindString(String[] lista, String target) {
+		
+		if(lista==null || lista.length==0)return -1;
+		
+		for( int i = 0; i<lista.length; i++ ) {
+	        if( lista[i].equals(target) )
+	            return i;
+	    }
+	    return -1;
+		
+	}
+	
+}
\ No newline at end of file

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/GdalTools.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/Options.java
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/Options.java	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/Options.java	(revision 9865)
@@ -0,0 +1,48 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+* MA  02110-1301, USA.
+* 
+*/
+
+package org.gvsig.jgdal;
+
+
+public class Options {
+	String[] vars;
+	String[] datos;
+	int longitud;
+	int nopc;
+	
+   	public Options(int nopciones) {
+   		vars=new String[nopciones];
+   		datos=new String[nopciones];
+   		longitud=nopciones;
+   		nopc=0;
+   	}
+	
+   	public void addOption(String var, String dato) {
+   		vars[nopc]=var;
+		datos[nopc]=dato;
+		nopc++;
+   	}
+   	
+   	public int getSize() {
+   		return longitud;
+   	}
+ }
\ No newline at end of file

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/Options.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/GdalDataset.java
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/GdalDataset.java	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/GdalDataset.java	(revision 9865)
@@ -0,0 +1,357 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+package org.gvsig.jgdal;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Vector;
+
+import org.gdal.gdal.Band;
+import org.gdal.gdal.Dataset;
+import org.gdal.gdal.Driver;
+import org.gdal.gdal.gdal;
+import org.gdal.ogr.ogr;
+import org.gvsig.jgdal.GeoTransform.GeoTransformException;
+
+import org.gvsig.jogr.OGRTools;
+/**
+ * Contiene las funcionalidades necesarias para el acceso a los elementos de un
+ * dataset de gdal correspondiente a una imagen
+ *
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ */
+public class GdalDataset  {
+	// CONSTANTES
+
+	// GDALAccess
+	public static int GA_ReadOnly   = 0;
+	public static int GA_Update     = 1;
+
+	// GDALDataType
+	public static int GDT_Unknown   = 0;
+	public static int GDT_Byte      = 1; // Buffer byte (8)
+	public static int GDT_UInt16    = 2; // Buffer short (16)
+	public static int GDT_Int16     = 3; // Buffer short (16)
+	public static int GDT_UInt32    = 4; // Buffer int (32)
+	public static int GDT_Int32     = 5; // Buffer int (32)
+	public static int GDT_Float32   = 6; // Buffer float (32)
+	public static int GDT_Float64   = 7; // Buffer double (64)
+	public static int GDT_CInt16    = 8; // Buffer short (16)
+	public static int GDT_CInt32    = 9; // Buffer int (32)
+	public static int GDT_CFloat32  = 10; // Buffer float (32)
+	public static int GDT_CFloat64  = 11; // Buffer double (64)
+	public static int GDT_TypeCount = 12;
+
+//	private String    pszFilename ;
+	private Dataset dataset;
+
+	/**
+	 *Constructor generico
+	 */
+	public GdalDataset(){
+		super();
+	}
+
+	public GdalDataset(Dataset dataset){
+		super();
+		this.dataset = dataset;
+	}
+
+
+
+	/**
+	 * Abre el fichero de imagen.
+	 *
+	 * @param filename	Nombre del fichero.
+	 * @param access	Apertura en solo lectura o escritura.
+	 * @throws GdalException
+            */
+        public void open(String filename, int access) throws GdalException, IOException {
+            if (filename == null) {
+                throw new IllegalArgumentException("filename is null");
+            }
+            if ((access < 0) || (access > 1)) {
+                throw new GdalException("Access type mistmatch (access="+access+").");
+            }
+            this.dataset = gdal.Open(filename, access);
+            if (this.dataset == null) {
+                throw new GdalException("Can't open file '" + filename + "'.");
+            }
+        }
+
+	/**
+	 * Obtiene un array de Strings con los metadatos
+	 *
+	 * @throws GdalException
+	 * @return Array de Strings que corresponden a los metadatos que ofrece la imagen
+	 */
+	public String[] getMetadata()throws GdalException {
+		return getMetadata(null);
+
+	}
+
+
+	/**
+	 * Obtiene un array de Strings con los metadatos
+	 *
+	 * @throws GdalException
+	 * @return Array de Strings que corresponden a los metadatos que ofrece la imagen
+	 */
+	@SuppressWarnings("unchecked")
+    public String[] getMetadata(String domain)throws GdalException {
+		@SuppressWarnings("rawtypes")
+        Vector res = this.dataset.GetMetadata_List(domain);
+		if(res == null)
+			return new String[0];
+		else
+		    return OGRTools.safeVectorToStringArray(res);
+
+	}
+
+	/**
+	 * Obtiene el n?mero de bandas de la imagen
+	 *
+	 * @throws GdalException
+	 * @param hBand	Entero que corresponde al n?mero de banda que se quiere recuperar
+	 * @return Objeto GdalRasterBand que representa la banda recuperada
+	 */
+
+	public GdalRasterBand getRasterBand(int hBand)throws GdalException {
+		Band rb;
+
+		if ((hBand < 1) || (hBand > getRasterCount()))
+			throw new GdalException("Banda seleccionada incorrecta");
+
+		if (this.dataset == null)
+				throw new GdalException("No se ha podido acceder al archivo.");
+
+		rb = this.dataset.GetRasterBand(hBand);
+
+		return new GdalRasterBand(rb);
+	}
+
+
+
+	/**
+	 * Obtiene la dimensi?n del raster en el eje X.
+	 *
+	 * @return	Devuelve un entero con la longitud de la imagen en el eje X en pixels.
+	 */
+	public int getRasterXSize() {
+		return this.dataset.getRasterXSize();
+	}
+
+
+	/**
+	 * Obtiene la dimensi?n del raster en el eje Y.
+	 *
+	 * @return	Devuelve un entero con la longitud de la imagen en el eje Y en pixels.
+	 */
+	public int getRasterYSize() {
+		return this.dataset.getRasterYSize();
+	}
+
+
+	/**
+	 * Obtiene el n?mero de bandas de la imagen
+	 *
+	 * @return	Devuelve un entero con el n?mero de bandas que contiene la imagen.
+	 */
+	public int getRasterCount() {
+		return this.dataset.getRasterCount();
+	}
+
+
+	/**
+	 * Obtiene el vector geoTransform de la imagen que contiene los valores Origen y pixelSize
+	 *
+	 * @return	Devuelve un vector de doubles que contiene los valores de coordenadas de origen y pixelSize.
+	 * @throws GdalException
+	 */
+        public GeoTransform getGeoTransform() throws GdalException {
+            GeoTransform gt = new GeoTransform();
+
+            if (this.dataset == null) {
+                throw new GdalException("No se ha podido acceder al archivo.");
+            }
+
+            this.dataset.GetGeoTransform(gt.adfgeotransform);
+            if (gt.isIdentity()) {
+                // The default transform is (0,1,0,0,0,1) and should be returned even when an error occurs,
+                // such as for formats that don't support transformation to projection coordinates.
+                // http://gdal.org/java/org/gdal/gdal/Dataset.html#GetGeoTransform%28double[]%29
+                throw new GeoTransformException("Error en getGeoTransform(). No se han obtenido valores para geoTransform.");
+            }
+
+            return gt;
+        }
+
+	/**
+	 * Obtiene el Nombre corto asociado al driver del dataset
+	 *
+	 * @return	Cadena con el nombre del driver
+	 * @throws GdalException
+	 */
+	public String getDriverShortName()throws GdalException {
+		if (this.dataset == null)
+				throw new GdalException("No se ha podido acceder al archivo.");
+
+		String shortName =this.dataset.GetDriver().getShortName();
+
+		if(shortName == null)
+			throw new GdalException("Error en getDriverShortName(). No ha podido obtenerse el driver");
+		else
+			return shortName;
+	}
+
+	/**
+	 * A?ade el vector geoTransform a la imagen que contiene los valores Origen y pixelSize
+	 *
+	 * @return	Devuelve un vector de doubles que contiene los valores de coordenadas de origen y pixelSize.
+	 * @throws GdalException
+	 */
+	public void setGeoTransform(GeoTransform gt)throws GdalException {
+		if (this.dataset == null)
+				throw new GdalException("No se ha podido acceder al archivo.");
+		if (gt == null)
+			throw new GdalException("el objeto es null");
+
+		@SuppressWarnings("unused")
+        int res = this.dataset.SetGeoTransform(gt.adfgeotransform);
+	}
+
+	/**
+	 * Obtiene el sistema de coordenadas de referencia de la imagen.
+	 *
+	 * @return	Devuelve un String con los datos del sistema de coordenadas de referencia.
+	 * @throws GdalException
+	 */
+	public String getProjectionRef()throws GdalException {
+		if (this.dataset == null)
+				throw new GdalException("No se ha podido acceder al archivo.");
+
+		String res = this.dataset.GetProjectionRef();
+
+		if(res == null)return new String("");
+		else return res;
+	}
+
+	/**
+	 * Cierra el fichero de imagen.
+	 *
+	 * @throws GdalException
+	 */
+	public void close()throws GdalException {
+//		if (cPtr == 0)
+//				throw new GdalException("No se ha podido acceder al archivo.");
+//
+//		closeNat(cPtr);
+		this.dataset.delete();
+	}
+
+	/**
+	 * Obtiene un driver a trav?s de su nombre
+	 *
+	 * @param name	Nombre del driver
+	 */
+	public static GdalDriver getDriverByName(String name)throws GdalException {
+
+		if (name == null)
+			throw new GdalException("El nombre del driver es null");
+		gdal.AllRegister();
+		ogr.RegisterAll();
+		Driver ptrdrv = gdal.GetDriverByName(name);
+
+		return new GdalDriver(ptrdrv);
+	}
+
+
+	/**
+	 * Obtiene el numero de bandas de la imagen
+	 *
+	 * @return	Devuelve un entero con el numero de bandas que contiene la imagen.
+	 * @throws GdalException
+	 */
+	public int getGCPCount()throws GdalException {
+//		String msg1="Error en GDALGetRasterCount. . La llamada GDALOpen no tuvo ?xito";
+//		String msg2="Error en el conteo de n?mero de bandas";
+		return this.dataset.GetGCPCount();
+	}
+
+	public Dataset getDataset(){
+		return this.dataset;
+	}
+
+	/**
+	 *Asigna la proyecci?n especificada en la cadena que se le pasa por par?metro.
+	 *@param proj	proyecci?n
+	 *@throws GdalException
+	 */
+	public void setProjection(String proj)throws GdalException {
+		if (this.dataset == null)
+				throw new GdalException("No se ha podido acceder al archivo.");
+		if (proj == null)
+				throw new GdalException("La proyeccion es null");
+
+		int res = this.dataset.SetProjection(proj);
+
+		if(res < 0)
+			throw new GdalException("Error en setProjection(). No se ha podido asignar la proyecci?n.");
+	}
+
+	/**
+	 * Obtiene la cadena que representa el tipo de banda de color. Los tipos posibles son:
+	 * <UL>
+	 *  <LI>0 = "Undefined" </LI>
+	 *  <LI>1 = "Gray";</LI>
+	 *  <LI>2 = "Palette";</LI>
+	 *  <LI>3 = "Red";</LI>
+	 *  <LI>4 = "Green";</LI>
+	 *  <LI>5 = "Blue";</LI>
+	 *  <LI>6 = "Alpha";</LI>
+	 *  <LI>7 = "Hue";</LI>
+	 *  <LI>8 = "Saturation";</LI>
+	 *  <LI>9 = "Lightness";</LI>
+	 *  <LI>10 = "Cyan";</LI>
+	 *  <LI>11 = "Magenta";</LI>
+	 *  <LI>12 = "Yellow";</LI>
+	 *  <LI>13 = "Black";</LI>
+	 *  <LI>14 = "YCbCr_Y";</LI>
+	 *  <LI>15 = "YCbCr_Cb";</LI>
+	 *  <LI>16 = "YCbCr_Cr";</LI>
+	 * </UL>
+	 * @return	Cadena con el nombre del tipo de banda de color
+	 * @throws GdalException
+	 */
+	public String getColorInterpretationName(int colorInterp)throws GdalException {
+		if ((colorInterp < 0) || (colorInterp > 16))
+			throw new GdalException("Valor de interpretacion de color fuera de rango");
+
+		String bandTypeName = gdal.GetColorInterpretationName(colorInterp);
+
+		if(bandTypeName == null)
+			throw new GdalException("Error en getColorInterpretationName(). No ha podido obtenerse el tipo de banda de color");
+		else
+			return bandTypeName;
+	}
+
+}

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/GdalDataset.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/GdalRasterBand.java
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/GdalRasterBand.java	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/GdalRasterBand.java	(revision 9865)
@@ -0,0 +1,496 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+
+package org.gvsig.jgdal;
+
+import java.util.Vector;
+
+import org.gdal.gdal.Band;
+import org.gdal.gdal.ColorTable;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Representa a una banda simple de la im�gen o canal.
+ *
+ * @author Nacho Brodin (nachobrodin@gmail.com).<BR> Equipo de desarrollo gvSIG.<BR> http://www.gvsig.gva.es
+ * @version 0.0
+ * @link http://www.gvsig.gva.es
+ */
+
+public class GdalRasterBand {
+
+	public static final Logger logger = LoggerFactory.getLogger(GdalRasterBand.class);
+
+	private boolean hasNoDataValue = false;
+
+    private Band band;
+
+	 public GdalRasterBand(Band band) {
+		 this.band = band;
+	 }
+
+	 /**
+	  * Lee datos de la banda de la imagen
+	  *
+	  * @return	Devuelve un vector de bytes con el trozo de raster le�do.
+	  * @param nXOff	El desplazamiento del pixel desde la esquina superior derecha
+	  * de la banda accedida.
+	  * @param nYOff	El desplazamiento de l�nea desde la esquina superior derecha
+	  * de la banda accedida.
+	  * @param nXSize	Ancho de la regi�n en pixels de la banda que ser� accedida
+	  * @param nYSize	Altura de la regi�n en l�neas de la banda que ser� accedida
+	  * @param bufXSize	Ancho del buffer donde la regi�n de la im�gen ser� guardada
+	  * @param bufYSize	Altura del buffer donde la regi�n de la im�gen ser� guardada
+	  * En caso de que bufXSize o bufYSize sean menores que 1, pasan a tener el mismo valor que
+	  * nXSize y nYSize respectivamente para evitar buffers con tama�o 0.
+	  * @param eBufType
+	  */
+
+	 public GdalBuffer readRaster(int nXOff, int nYOff, int nXSize, int nYSize,
+			 int bufXSize, int bufYSize,
+			 int eBufType)throws GdalException {
+
+		 if ((nXOff<0) || (nXOff > getRasterBandXSize()) || (nYOff < 0) || (nYOff > getRasterBandYSize()))
+			 throw new GdalException("Desplazamiento de la ventana fuera de rango.");
+
+		 if ((nXSize < 1) || (nXSize > getRasterBandXSize()) || (nYSize<1) || (nYSize > getRasterBandYSize()))
+			 throw new GdalException("Tama�o de ventana incorrecto.");
+
+		 if (((nXSize + nXOff) > (getRasterBandXSize())) || ((nYSize + nYOff) > (getRasterBandYSize()))){
+			 throw new GdalException("Posicion de la ventana incorrecta.");
+		 }
+
+		 if ((eBufType < 1) || (eBufType > 11))
+			 throw new GdalException("Tipo de datos incorrecto.");
+
+		 if (bufXSize < 1)
+			 bufXSize = nXSize;
+
+		 if (bufYSize < 1)
+			 bufYSize = nYSize;
+
+		 GdalBuffer buf = new GdalBuffer();
+		 int i = 0;
+
+		 switch(eBufType) {
+		 case 0:
+			 i = 0;
+			 break;
+		 case 1:
+			 buf.reservaByte(bufXSize * bufYSize);
+			 i = this.band.ReadRaster(nXOff, nYOff, nXSize, nYSize, bufXSize, bufYSize, eBufType, buf.buffByte);
+			 break;
+		 case 2:
+		 case 3:
+		 case 8:
+			 buf.reservaShort(bufXSize * bufYSize);
+			 i = this.band.ReadRaster(nXOff, nYOff, nXSize, nYSize, bufXSize, bufYSize, eBufType, buf.buffShort);
+			 break;
+		 case 4:
+		 case 5:
+		 case 9:
+			 buf.reservaInt(bufXSize * bufYSize);
+			 i = this.band.ReadRaster(nXOff, nYOff, nXSize, nYSize, bufXSize, bufYSize, eBufType, buf.buffInt);
+			 break;
+		 case 6:
+		 case 10:
+			 buf.reservaFloat(bufXSize * bufYSize);
+			 i = this.band.ReadRaster(nXOff, nYOff, nXSize, nYSize, bufXSize, bufYSize, eBufType, buf.buffFloat);
+			 break;
+		 case 7:
+		 case 11:
+			 buf.reservaDouble(bufXSize * bufYSize);
+			 i = this.band.ReadRaster(nXOff, nYOff, nXSize, nYSize, bufXSize, bufYSize, eBufType, buf.buffDouble);
+			 break;
+		 case 12:
+			 i = 0;
+			 break;
+		 }
+
+
+		 if(i>=0)
+			 return buf;
+		 else
+			 return null;
+	 }
+
+	 /**
+	  * Escribe datos en la banda de la imagen
+	  *
+	  * @param nXOff	El desplazamiento del pixel desde la esquina superior derecha
+	  * de la banda accedida.
+	  * @param nYOff	El desplazamiento de l�nea desde la esquina superior derecha
+	  * de la banda accedida.
+	  * @param nXSize	Ancho de la regi�n en pixels de la banda que ser� accedida
+	  * @param nYSize	Altura de la regi�n en l�neas de la banda que ser� accedida
+	  * @param BufXSize	Ancho del buffer donde la regi�n de la im�gen ser� guardada
+	  * @param BufYSize	Altura del buffer donde la regi�n de la im�gen ser� guardada
+	  * @param eBufType
+	  */
+
+	 public void writeRaster(int nXOff, int nYOff, int nXSize, int nYSize, GdalBuffer buf, int eBufType)throws GdalException {
+		 GdalBuffer buffer = new GdalBuffer();
+
+		 if ((nXOff < 0) || (nXOff > getRasterBandXSize()) || (nYOff < 0) || (nYOff > getRasterBandYSize()))
+			 throw new GdalException("Desplazamiento de la ventana fuera de rango.");
+
+		 if ((nXSize < 1) || (nXSize > getRasterBandXSize()) || (nYSize < 1) || (nYSize > getRasterBandYSize()))
+			 throw new GdalException("Tama�o de ventana incorrecto.");
+
+		 if (((nXSize + nXOff) > (getRasterBandXSize())) || ((nYSize + nYOff) > (getRasterBandYSize())))
+			 throw new GdalException("Posicion de la ventana incorrecta.");
+
+		 if ((eBufType < 1) || (eBufType > 11))
+			 throw new GdalException("Tipo de datos incorrecto.");
+
+		 if (buf == null)
+			 throw new GdalException("Buffer incorrecto");
+
+		 switch(eBufType) {
+		 case 0:
+			 return;
+		 case 1:
+			 buffer.buffByte = buf.buffByte;
+			 break;
+		 case 2:
+		 case 3:
+		 case 8:
+			 buffer.buffShort = buf.buffShort;
+			 break;
+		 case 4:
+		 case 5:
+		 case 9:
+			 buffer.buffInt = buf.buffInt;
+			 break;
+		 case 6:
+		 case 10:
+			 buffer.buffFloat = buf.buffFloat;
+			 break;
+		 case 7:
+		 case 11:
+			 buffer.buffDouble = buf.buffDouble;
+			 break;
+		 case 12:
+			 return;
+		 }
+
+
+
+		 switch(eBufType) {
+		 case 0:
+			 break;
+		 case 1:
+			 this.band.WriteRaster(nXOff, nYOff, nXSize, nYSize, eBufType, buffer.buffByte);
+			 break;
+		 case 2:
+		 case 3:
+		 case 8:
+			 this.band.WriteRaster(nXOff, nYOff, nXSize, nYSize, eBufType, buffer.buffShort);
+			 break;
+		 case 4:
+		 case 5:
+		 case 9:
+			 this.band.WriteRaster(nXOff, nYOff, nXSize, nYSize, eBufType, buffer.buffInt);
+			 break;
+		 case 6:
+		 case 10:
+			 this.band.WriteRaster(nXOff, nYOff, nXSize, nYSize, eBufType, buffer.buffFloat);
+			 break;
+		 case 7:
+		 case 11:
+			 this.band.WriteRaster(nXOff, nYOff, nXSize, nYSize, eBufType, buffer.buffDouble);
+			 break;
+		 case 12:
+			 break;
+		 }
+	 }
+
+	 /**
+	  *Obtiene el tama�o en pixeles de la im�gen en el eje de las X
+	  *@return Tama�o en pixeles del eje X
+	  *@throws GdalException
+	  */
+
+	 public int getRasterBandXSize()throws GdalException {
+		 return this.band.GetXSize();
+	 }
+
+	 /**
+	  *Obtiene el tama�o en pixeles de la im�gen en el eje de las Y
+	  *@return Tama�o en pixeles del eje Y
+	  *@throws GdalException
+	  */
+
+	 public int getRasterBandYSize()throws GdalException {
+		 return this.band.GetYSize();
+	 }
+
+
+	 /**
+	  * Devuelve el n�mero de overviews que contiene la banda.
+	  * @return N�mero de overviews
+	  * @throws GdalException
+	  */
+
+	 public int getOverviewCount()throws GdalException {
+		 return this.band.GetOverviewCount();
+	 }
+
+
+	 /**
+	  * Obtiene el overview indicado por el �ndice "i".
+	  *
+	  * @param i	indice del overview que se quiere recuperar.
+	  * @return GdalRasterBand	Banda correspondiente al overview selecccionado
+	  * @throws GdalException
+	  */
+
+	 public GdalRasterBand getOverview(int i)throws GdalException {
+		 Band band_ov;
+
+		 if((i < 0) || (i >= getOverviewCount()))
+			 throw new GdalException("El overview seleccionado no existe");
+
+		 band_ov = this.band.GetOverview(i);
+
+		 if (band_ov == null || !(band_ov instanceof Band))
+			 throw new GdalException("No se ha podido obtener el overview");
+
+		 return new GdalRasterBand(band_ov);
+	 }
+
+
+	 /**
+	  * Devuelve el tama�o en X del bloque para esa banda
+	  * @return Tama�o en pixeles del bloque en el eje X
+	  * @throws GdalException
+	  */
+
+	 public int getBlockXSize()throws GdalException {
+		 return this.band.GetBlockXSize();
+	 }
+
+
+	 /**
+	  * Devuelve el tama�o en Y del bloque para esa banda
+	  * @return Tama�o en pixeles del bloque en el eje Y
+	  * @throws GdalException
+	  */
+
+	 public int getBlockYSize()throws GdalException {
+		 return this.band.GetBlockYSize();
+	 }
+
+	 /**
+	  * Devuelve el tipo de datos de la banda
+	  * @return Tama�o en pixeles del bloque en el eje Y
+	  * @throws GdalException
+	  */
+
+	 public int getRasterDataType()throws GdalException {
+		 return this.band.getDataType();
+	 }
+
+	 /**
+	  * Obtiene la tabla de color asociada a la imagen
+	  */
+	 public GdalColorTable getRasterColorTable()throws GdalException {
+		 ColorTable ct = this.band.GetColorTable();
+
+		 if ((ct == null)) {
+			 return null;
+		 }
+
+		 return new GdalColorTable(ct);
+	 }
+
+	 /**
+	  * Lee datos de la banda de la im�gen con una paleta asociada
+	  *
+	  * @return	Devuelve un vector de bytes con el trozo de raster le�do.
+	  * @param nXOff	El desplazamiento del pixel desde la esquina superior derecha
+	  * de la banda accedida.
+	  * @param nYOff	El desplazamiento de l�nea desde la esquina superior derecha
+	  * de la banda accedida.
+	  * @param nXSize	Ancho de la regi�n en pixels de la banda que ser� accedida
+	  * @param nYSize	Altura de la regi�n en l�neas de la banda que ser� accedida
+	  * @param BufXSize	Ancho del buffer donde la regi�n de la im�gen ser� guardada
+	  * @param BufYSize	Altura del buffer donde la regi�n de la im�gen ser� guardada
+	  * En caso de que bufXSize o bufYSize sean menores que 1, pasan a tener el mismo valor que
+	  * nXSize y nYSize respectivamente para evitar buffers con tama�o 0.
+	  * @param eBufType
+	  */
+
+	 public GdalBuffer readRasterWithPalette(int nXOff, int nYOff, int nXSize, int nYSize,
+			 int bufXSize, int bufYSize,
+			 int eBufType)throws GdalException {
+
+		 if ((nXOff<0) || (nXOff > getRasterBandXSize()) || (nYOff < 0) || (nYOff > getRasterBandYSize()))
+			 throw new GdalException("Desplazamiento de la ventana fuera de rango.");
+
+		 if ((nXSize < 1) || (nXSize > getRasterBandXSize()) || (nYSize < 1) || (nYSize > getRasterBandYSize()))
+			 throw new GdalException("Tama�o de ventana incorrecto.");
+
+		 if (((nXSize + nXOff) > (getRasterBandXSize())) || ((nYSize + nYOff) > (getRasterBandYSize())))
+			 throw new GdalException("Posicion de la ventana incorrecta.");
+
+		 if ((eBufType < 1) || (eBufType > 11))
+			 throw new GdalException("Tipo de datos incorrecto.");
+
+		 if (bufXSize < 1)
+			 bufXSize = nXSize;
+
+		 if (bufYSize < 1)
+			 bufYSize = nYSize;
+
+
+		 GdalBuffer buf = new GdalBuffer();
+		 int i = 0;
+
+		 switch(eBufType) {
+		 case 0:
+			 i = 0;
+			 break;
+		 case 1:
+			 i = this.band.ReadRaster(nXOff, nYOff, nXSize, nYSize, bufXSize, bufYSize, eBufType, buf.buffByte);
+			 break;
+		 case 2:
+		 case 3:
+		 case 8:
+			 i = this.band.ReadRaster(nXOff, nYOff, nXSize, nYSize, bufXSize, bufYSize, eBufType, buf.buffShort);
+			 break;
+		 case 4:
+		 case 5:
+		 case 9:
+			 i = this.band.ReadRaster(nXOff, nYOff, nXSize, nYSize, bufXSize, bufYSize, eBufType, buf.buffInt);
+			 break;
+		 case 6:
+		 case 10:
+			 i = this.band.ReadRaster(nXOff, nYOff, nXSize, nYSize, bufXSize, bufYSize, eBufType, buf.buffFloat);
+			 break;
+		 case 7:
+		 case 11:
+			 i = this.band.ReadRaster(nXOff, nYOff, nXSize, nYSize, bufXSize, bufYSize, eBufType, buf.buffDouble);
+			 break;
+		 case 12:
+			 i = 0;
+			 break;
+		 }
+
+
+		 if(i>0)
+			 return buf;
+		 else
+			 return null;
+	 }
+
+	 /**
+	  *Devuelve el valor de NoData
+	  */
+	 public double getRasterNoDataValue()throws GdalException {
+
+		 Double[] aux = new Double[1];
+		 this.band.GetNoDataValue(aux);
+		 return aux[0];
+	 }
+
+	 /**
+	  * Obtiene el valorDevuelve el valor de NoData
+	  */
+	 public boolean existsNoDataValue()throws GdalException {
+			 return this.hasNoDataValue  ;
+	 }
+
+	 public void setRasterNoDataValue(double val){
+		 this.hasNoDataValue = true;
+
+		 this.band.SetNoDataValue(val);
+	 }
+
+	 /**
+	  * Obtiene un array de Strings con los metadatos
+	  *
+	  * @throws GdalException
+	  * @return Array de Strings que corresponden a los metadatos que ofrece la im�gen
+	  */
+
+	 public String[] getMetadata()throws GdalException {
+
+		 @SuppressWarnings("unchecked")
+         Vector<String> aux = this.band.GetMetadata_List();
+		 String[] res =  aux.toArray(new String[0]);
+		 if(res == null)
+			 return new String[0];
+		 else return res;
+	 }
+
+	 /**
+	  * Obtiene identificador que representa el tipo de banda de color.
+	  * @return	identificador del tipo de banda de color
+	  * @throws GdalException
+	  */
+
+	 public int getRasterColorInterpretation()throws GdalException {
+
+		 int bandType = this.band.GetColorInterpretation();
+		 return bandType;
+	 }
+
+
+	 /**
+	  * Asigna la interpretaci�n de color de la banda.
+	  * Con algunos formatos no es posible modificar la interpretaci�n de color,
+	  * tales como tiff y jpg. En el caso de tif, no hay error pero tampoco se
+	  * produce el cambio en la interpretaci�n. En el caso de jpg, gdal lanza un error.
+	  * 0 = "Undefined"
+	  * 1 = "Gray";
+	  * 2 = "Palette";
+	  * 3 = "Red";
+	  * 4 = "Green";
+	  * 5 = "Blue";
+	  * 6 = "Alpha";
+	  * 7 = "Hue";
+	  * 8 = "Saturation";
+	  * 9 = "Lightness";
+	  * 10 = "Cyan";
+	  * 11 = "Magenta";
+	  * 12 = "Yellow";
+	  * 13 = "Black";
+	  * 14 = "YCbCr_Y";
+	  * 15 = "YCbCr_Cb";
+	  * 16 = "YCbCr_Cr";
+	  * @param bandType
+	  * @throws GdalException
+	  */
+	 public void setRasterColorInterpretation(int bandType) throws GdalException{
+
+		 if ((bandType < 0) || (bandType > 16)){
+			 throw new GdalException("Tipo de banda incorrecto");
+		 }
+
+		 @SuppressWarnings("unused")
+         int err = this.band.SetColorInterpretation(bandType);
+
+	 }
+
+}

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/GdalRasterBand.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/GdalColorTable.java
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/GdalColorTable.java	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/GdalColorTable.java	(revision 9865)
@@ -0,0 +1,60 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+package org.gvsig.jgdal;
+
+import java.awt.Color;
+
+import org.gdal.gdal.ColorTable;
+
+public class GdalColorTable {
+
+
+    private ColorTable ct;
+
+    /**
+     *
+     */
+    public GdalColorTable(ColorTable ct) {
+        this.ct = ct;
+    }
+
+	public int getColorEntryCount() throws GdalException{
+		return this.ct.GetCount();
+	}
+
+	public GdalColorEntry getColorEntryAsRGB(int pos) throws GdalException{
+
+		if ((pos < 0) || (pos >= getColorEntryCount()))
+			throw new GdalException("Entrada de la tabla de color fuera de rango");
+
+		GdalColorEntry entry = new GdalColorEntry();
+		Color values =  this.ct.GetColorEntry(pos);
+		if(values == null)
+		    throw new GdalException("Error en getColorEntryAsRGB(). Posici�n de la tabla de color inexistente.");
+		entry.c1 =  (short) values.getRed();
+		entry.c2 =  (short) values.getGreen();
+		entry.c3 =  (short) values.getBlue();
+		entry.c4 =  (short) values.getAlpha();
+		return entry;
+	}
+
+}
\ No newline at end of file

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jgdal/GdalColorTable.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jogr/OGRTools.java
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jogr/OGRTools.java	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jogr/OGRTools.java	(revision 9865)
@@ -0,0 +1,134 @@
+/**********************************************************************
+ * $Id: OGRTools.java 7765 2006-10-03 07:05:18Z nacho $
+ *
+ * Name:     OGRTools.java
+ * Project:  JGDAL. Interface java to gdal (Frank Warmerdam).
+ * Purpose:
+ * Author:   Nacho Brodin, brodin_ign@gva.es
+ *
+ **********************************************************************/
+/*Copyright (C) 2004  Nacho Brodin <brodin_ign@gva.es>
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+package org.gvsig.jogr;
+
+import java.util.Arrays;
+import java.util.Vector;
+
+import org.gdal.ogr.ogrConstants;
+import org.gdal.osr.CoordinateTransformation;
+
+
+
+/**
+ *
+ * @author Nacho Brodin <brodin_ign@gva.es>.<BR> Equipo de desarrollo gvSIG.<BR> http://www.gvsig.gva.es
+ * @version 0.0
+ * @link http://www.gvsig.gva.es
+ */
+
+public class OGRTools {
+
+//	private native static long OGRCreateCoordinateTransformationNat( long poSource, long poTarget);
+//
+//	/**
+//	 *
+//	 */
+//
+//	public static OGRCoordinateTransformation OGRCreateCoordinateTransformation( OGRSpatialReference poSource,
+//            																OGRSpatialReference poTarget )throws OGRException{
+//		if(poSource == null  || poTarget == null)
+//			throw new OGRException("Error en OGRCreateCoordinateTransformation(). Los par�metros no tienen una referencia correcta.");
+//
+//		CoordinateTransformation cct = org.gdal.osr.osr.CreateCoordinateTransformation(poSource, poTarget);
+//
+//		if(cct == null || !(cct instanceof OGRCoordinateTransformation))
+//			throw new OGRException("Error en OGRCreateCoordinateTransformation(). No se ha podido obtener una referencia valida al objeto OGRCoordinateTransformation.");
+//
+//		return ((OGRCoordinateTransformation) cct);
+//
+//	}
+//
+//	public static int safeLongToInt(long l) {
+//	    if (l < Integer.MIN_VALUE || l > Integer.MAX_VALUE) {
+//	        throw new IllegalArgumentException
+//	            (l + " cannot be cast to int without changing its value.");
+//	    }
+//	    return (int) l;
+//	}
+
+//	public static Vector safeStringToVector(String s) {
+//		Vector myVec = new Vector();
+//
+//		//Convert the string to a char array and then just add each char to the vector
+//		char[] sChars = s.toCharArray();
+//		for(int i = 0; i < s.length(); ++i) {
+//		    myVec.add(sChars[i]);
+//		}
+//
+//		return myVec;
+//	}
+
+//	public static Vector safeStringArrayToVector(String[] s) {
+//		return new Vector<String>(Arrays.asList(s));
+//	}
+//
+//	public static int getTypeID(String gtype) throws OGRException {
+//		if(gtype!=null && (gtype.equals("wkbUnknown"))){
+//			return ogrConstants.wkbUnknown;
+//		}else if(gtype!=null && (gtype.equals("wkbPoint"))){
+//			return ogrConstants.wkbPoint;
+//		}else if(gtype!=null && (gtype.equals("wkbLineString"))){
+//			return ogrConstants.wkbLineString;
+//		}else if(gtype!=null && (gtype.equals("wkbPolygon"))){
+//			return ogrConstants.wkbPolygon;
+//		}else if(gtype!=null && (gtype.equals("wkbMultiPoint"))){
+//			return ogrConstants.wkbMultiPoint;
+//		}else if(gtype!=null && (gtype.equals("wkbMultiLineString"))){
+//			return ogrConstants.wkbMultiLineString;
+//		}else if(gtype!=null && (gtype.equals("wkbMultiPolygon"))){
+//			return ogrConstants.wkbMultiPolygon;
+//		}else if(gtype!=null && (gtype.equals("wkbGeometryCollection"))){
+//			return ogrConstants.wkbGeometryCollection;
+//		}else if(gtype!=null && (gtype.equals("wkbNone"))){
+//			return ogrConstants.wkbNone;
+//		}else if(gtype!=null && (gtype.equals("wkbLinearRing"))){
+//			return ogrConstants.wkbLinearRing;
+//		}else if(gtype!=null && (gtype.equals("wkbPoint25D"))){
+//			return ogrConstants.wkbPoint25D;
+//		}else if(gtype!=null && (gtype.equals("wkbLineString25D"))){
+//			return ogrConstants.wkbLineString25D;
+//		}else if(gtype!=null && (gtype.equals("wkbPolygon25D"))){
+//			return ogrConstants.wkbPolygon25D;
+//		}else if(gtype!=null && (gtype.equals("wkbMultiPoint25D"))){
+//			return ogrConstants.wkbMultiPoint25D;
+//		}else if(gtype!=null && (gtype.equals("wkbMultiLineString25D"))){
+//			return ogrConstants.wkbLineString25D;
+//		}else if(gtype!=null && (gtype.equals("wkbMultiPolygon25D"))){
+//			return ogrConstants.wkbLineString+ogrConstants.wkb25DBit;
+//		}else if(gtype!=null && (gtype.equals("wkbGeometryCollection25D"))){
+//			return ogrConstants.wkbGeometryCollection25D;
+//		}
+//
+//		throw new OGRException("Error en setGeomType(). Par�metro invalido");
+//	}
+//
+	public static String[] safeVectorToStringArray(Vector<String> res) {
+		return res.toArray(new String[0]);
+	}
+
+}
\ No newline at end of file

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/jogr/OGRTools.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/addo/BuildingOverviewsException.java
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/addo/BuildingOverviewsException.java	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/addo/BuildingOverviewsException.java	(revision 9865)
@@ -0,0 +1,38 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+* MA  02110-1301, USA.
+* 
+*/
+package org.gvsig.addo;
+
+/**
+ * Es generada cuando hay algun problema en la construccion de 
+ * las overviews y la funcion nativa devuelve 0
+ * 
+ * @author Nacho Brodin (nachobrodin@gmail.com).<BR> Equipo de desarrollo gvSIG.<BR> http://www.gvsig.gva.es
+ * @version 0.0
+ * @link http://www.gvsig.org
+ */
+public class BuildingOverviewsException extends Exception {
+
+	public BuildingOverviewsException(String msg) {
+		super(msg);
+	}
+	
+}
\ No newline at end of file

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/addo/BuildingOverviewsException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/addo/Jaddo.java
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/addo/Jaddo.java	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/addo/Jaddo.java	(revision 9865)
@@ -0,0 +1,86 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+package org.gvsig.addo;
+import java.io.File;
+
+import org.gdal.gdal.Dataset;
+import org.gdal.gdal.gdal;
+
+/**
+ * Clase para la construccion de overviews de un raster.
+ *
+ * 15-nov-2007
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ */
+public class Jaddo implements IOverviewIncrement{
+	public final static int NEAREST = 0;
+	public final static int AVERAGE = 1;
+	public final static int AVERAGE_MP = 2;
+	public final static int AVERAGE_MAGPHASE = 3;
+	public final static int MODE = 4;
+
+	private IOverviewIncrement  incrementListener = null;
+	private int value = 0;
+
+//	private native int buildOverviewsNative(int resamplingAlg, String file, int[] overviews);
+
+	/**
+	 * Construccion de overviews
+	 */
+	public void buildOverviews(int resamplingAlg, String file, int[] overviews)
+		throws BuildingOverviewsException, WritingException {
+		File f = new File(file);
+		if(!f.exists() || !f.isFile())
+			throw new BuildingOverviewsException("File does not exist.");
+		if(!f.canWrite())
+			throw new WritingException("File is not writeable");
+		Dataset data = gdal.Open(file);
+		if(data.BuildOverviews(overviews) >= 0)
+			throw new BuildingOverviewsException("Problems building overviews");
+	}
+
+	/**
+	 * Devuelve el porcentaje del incremento.
+	 * @return int
+	 */
+	public int getPercent() {
+		return value;
+	}
+
+	/**
+	 * Asigna el porcentaje de incremento de la construccion de overview.
+	 * Esto se hace automaticamente desde el callback que asigna el porcentaje.
+	 */
+	public void setPercent(int value) {
+		this.value = value;
+		if(incrementListener != null)
+			incrementListener.setPercent(value);
+	}
+
+	/**
+	 * Asigna el listener para la asignacion del incremento
+	 * @param incr IOverviewIncrement
+	 */
+	public void setIncrementListener(IOverviewIncrement incr) {
+		this.incrementListener = incr;
+	}
+}

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/addo/Jaddo.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/addo/WritingException.java
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/addo/WritingException.java	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/addo/WritingException.java	(revision 9865)
@@ -0,0 +1,40 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+* MA  02110-1301, USA.
+* 
+*/
+package org.gvsig.addo;
+
+/**
+ * Es generada no se puede escribir las overviews
+ * 
+ * @author Nacho Brodin (nachobrodin@gmail.com).<BR> Equipo de desarrollo gvSIG.<BR> http://www.gvsig.gva.es
+ * @version 0.0
+ * @link http://www.gvsig.org
+ */
+
+
+public class WritingException extends Exception {
+
+	public WritingException(String msg){
+		super(msg);
+	}
+	
+	
+}
\ No newline at end of file

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/addo/WritingException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/addo/IOverviewIncrement.java
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/addo/IOverviewIncrement.java	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/addo/IOverviewIncrement.java	(revision 9865)
@@ -0,0 +1,43 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+* MA  02110-1301, USA.
+* 
+*/
+package org.gvsig.addo;
+
+/**
+ * Interfaz para la asignacion y recuperacion del incremento
+ * de la tarea.
+ *
+ * 17-nov-2007
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ */
+public interface IOverviewIncrement {
+	/**
+	 * Devuelve el porcentaje del incremento
+	 * @return int
+	 */
+	public int getPercent();
+	
+	/**
+	 * Asigna el porcentaje de incremento de la construccion de overview.
+	 * Esto se hace automaticamente desde el callback que asigna el porcentaje. 
+	 */
+	public void setPercent(int value);
+}
\ No newline at end of file

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/addo/IOverviewIncrement.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/resources/META-INF/services/org.gvsig.tools.library.Library	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/src/main/resources/META-INF/services/org.gvsig.tools.library.Library	(revision 9865)
@@ -0,0 +1 @@
+org.gvsig.raster.gdal.io.DefaultGdalIOLibrary
Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/pom.xml
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/pom.xml	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/pom.xml	(revision 9865)
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>org.gvsig.raster.gdal.io</artifactId>
+    <packaging>jar</packaging>
+    <name>${project.artifactId}</name>
+    <parent>
+        <groupId>org.gvsig</groupId>
+        <artifactId>org.gvsig.raster.gdal</artifactId>
+        <version>2.2.85</version>
+    </parent>
+	
+    <dependencies>
+        <dependency>
+            <groupId>org.gdal</groupId>
+            <artifactId>gdal</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.raster.cache.lib.api</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.raster.lib.api</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.raster.lib.impl</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.metadata.lib.basic.api</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.remoteclient</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.tools.lib</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.projection.api</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.projection.cresques.impl</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.compat.api</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.compat.se</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.fmap.dal.api</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.fmap.dal.impl</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.fmap.dal.file.lib</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.fmap.dal.spi</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.fmap.geometry.api</artifactId>
+            <scope>compile</scope>
+        </dependency>
+
+    </dependencies>
+
+
+</project>

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io/pom.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain


Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.io
___________________________________________________________________
Added: svn:ignore
   + target

.project

.settings

.classpath


Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.app/pom.xml
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.app/pom.xml	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.app/pom.xml	(revision 9865)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+	<modelVersion>4.0.0</modelVersion>
+	<artifactId>org.gvsig.raster.gdal.app</artifactId>
+	<packaging>pom</packaging>
+	<name>${project.artifactId}</name>
+	<parent>
+		<groupId>org.gvsig</groupId>
+		<artifactId>org.gvsig.raster.gdal</artifactId>
+		<version>2.2.85</version>
+	</parent>
+
+	<modules>
+		<module>org.gvsig.raster.gdal.app.mainplugin</module>
+	</modules>
+
+</project>
+

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.app/pom.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.app/org.gvsig.raster.gdal.app.mainplugin/buildNumber.properties
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.app/org.gvsig.raster.gdal.app.mainplugin/buildNumber.properties	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.app/org.gvsig.raster.gdal.app.mainplugin/buildNumber.properties	(revision 9865)
@@ -0,0 +1,2 @@
+#Mon Oct 07 08:39:11 CEST 2019
+buildNumber=138
Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.app/org.gvsig.raster.gdal.app.mainplugin/src/main/resources-plugin/config.xml
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.app/org.gvsig.raster.gdal.app.mainplugin/src/main/resources-plugin/config.xml	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.app/org.gvsig.raster.gdal.app.mainplugin/src/main/resources-plugin/config.xml	(revision 9865)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<plugin-config>
+    <depends plugin-name="org.gvsig.gdal.app.mainplugin" />
+    <depends plugin-name="org.gvsig.raster.mainplugin" />
+    <depends plugin-name="org.gvsig.raster.tilecache.app" optional="true" />
+    <libraries library-dir="lib"/>
+    <resourceBundle name="text"/>
+    <extensions>
+        <extension class-name="org.gvsig.raster.gdal.app.GdalExtension"
+                           description=""
+                           active="true"
+                           priority="1">
+        </extension>
+    </extensions>
+</plugin-config>
Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.app/org.gvsig.raster.gdal.app.mainplugin/src/main/assembly/gvsig-plugin-package.xml
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.app/org.gvsig.raster.gdal.app.mainplugin/src/main/assembly/gvsig-plugin-package.xml	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.app/org.gvsig.raster.gdal.app.mainplugin/src/main/assembly/gvsig-plugin-package.xml	(revision 9865)
@@ -0,0 +1,64 @@
+<!--
+
+    gvSIG. Desktop Geographic Information System.
+
+    Copyright (C) 2007-2013 gvSIG Association.
+
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; either version 3
+    of the License, or (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+    MA  02110-1301, USA.
+
+    For any additional information, do not hesitate to contact us
+    at info AT gvsig.com, or visit our website www.gvsig.com.
+
+-->
+<assembly>
+    <id>gvsig-plugin-package</id>
+    <formats>
+        <format>zip</format>
+    </formats>
+    <baseDirectory>${project.artifactId}</baseDirectory>
+    <includeBaseDirectory>true</includeBaseDirectory>
+    <files>
+        <file>
+            <source>target/${project.artifactId}-${project.version}.jar</source>
+            <outputDirectory>lib</outputDirectory>
+        </file>
+        <file>
+            <source>target/package.info</source>
+        </file>
+    </files>
+
+    <fileSets>
+        <fileSet>
+            <directory>src/main/resources-plugin</directory>
+            <outputDirectory>.</outputDirectory>
+        </fileSet>
+    </fileSets>
+
+
+    <dependencySets>
+        <dependencySet>
+            <useProjectArtifact>false</useProjectArtifact>
+            <useTransitiveDependencies>false</useTransitiveDependencies>
+            <outputDirectory>lib</outputDirectory>
+            <includes>
+                <include>org.gvsig:org.gvsig.raster.gdal.io:jar</include>
+            </includes>
+        </dependencySet>
+    </dependencySets>
+
+</assembly>
+
+
Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.app/org.gvsig.raster.gdal.app.mainplugin/src/main/java/org/gvsig/raster/gdal/app/GdalExtension.java
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.app/org.gvsig.raster.gdal.app.mainplugin/src/main/java/org/gvsig/raster/gdal/app/GdalExtension.java	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.app/org.gvsig.raster.gdal.app.mainplugin/src/main/java/org/gvsig/raster/gdal/app/GdalExtension.java	(revision 9865)
@@ -0,0 +1,90 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+* MA  02110-1301, USA.
+* 
+*/
+package org.gvsig.raster.gdal.app;
+
+import org.gvsig.andami.plugins.Extension;
+import org.gvsig.fmap.dal.coverage.RasterLocator;
+import org.gvsig.fmap.dal.coverage.util.ProviderServices;
+import org.gvsig.installer.lib.api.InstallerLocator;
+import org.gvsig.installer.lib.api.InstallerManager;
+import org.gvsig.installer.lib.api.PackageInfo;
+import org.gvsig.raster.gdal.io.GdalProvider;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Extension to add Gdal library support
+ *
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ */
+public class GdalExtension extends Extension {
+
+        private static final org.slf4j.Logger logger = LoggerFactory.getLogger(GdalExtension.class);
+        
+        @Override
+	public void execute(String actionCommand) {
+	}
+
+        @Override
+        public void postInitialize() {
+            try {
+                InstallerManager installerManager = InstallerLocator.getInstallerManager();
+                PackageInfo[] pkgs = installerManager.getInstalledPackages();
+                boolean needECW = true;
+                boolean needMrSID = true;
+                for (PackageInfo pkg : pkgs) {
+                    if( "org.gvsig.raster.ermapper.app".equalsIgnoreCase(pkg.getCode() )) {
+                        needECW = false;
+                    }
+                    if( "org.gvsig.raster.lizardtech.app".equalsIgnoreCase(pkg.getCode() )) {
+                        needMrSID = false;
+                    }
+                }
+                ProviderServices providerServices = RasterLocator.getManager().getProviderServices();
+                if( needECW ) {
+                    providerServices.addFormat("ecw", GdalProvider.class);
+                    providerServices.addFormat("jp2", GdalProvider.class);
+                }
+                if( needMrSID ) {
+                    providerServices.addFormat("mrsid", GdalProvider.class);
+                }
+            } catch (Exception ex) {
+                logger.warn("Can't determine the use of gdal drivers for ecw, jp2 and mrsid",ex);
+            }
+        }
+
+
+
+        @Override
+	public void initialize() {
+	}
+	
+        @Override
+	public boolean isEnabled() {
+		return false;
+	}
+
+        @Override
+	public boolean isVisible() {
+		return false;
+	}
+
+}
\ No newline at end of file
Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.app/org.gvsig.raster.gdal.app.mainplugin/pom.xml
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.app/org.gvsig.raster.gdal.app.mainplugin/pom.xml	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.app/org.gvsig.raster.gdal.app.mainplugin/pom.xml	(revision 9865)
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>org.gvsig.raster.gdal.app.mainplugin</artifactId>
+    <packaging>jar</packaging>
+    <name>${project.artifactId}</name>
+    <description>GDAL raster data provider for gvSIG: jpeg, tiff, png, gif.</description>
+    <parent>
+        <groupId>org.gvsig</groupId>
+        <artifactId>org.gvsig.raster.gdal.app</artifactId>
+        <version>2.2.85</version>
+    </parent>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.andami</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.raster.gdal.io</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.raster.lib.api</artifactId>
+            <scope>compile</scope>
+        </dependency>
+    </dependencies>
+
+    <properties>
+        <svn.tags.folder>https://devel.gvsig.org/svn/gvsig-raster/org.gvsig.raster.gdal/tags/</svn.tags.folder>
+
+        <gvsig.package.info.name>Formats: GDAL raster file formats support</gvsig.package.info.name>     
+        <gvsig.package.info.state>testing</gvsig.package.info.state>
+        <gvsig.package.info.official>true</gvsig.package.info.official>
+        <gvsig.package.info.operatingSystem>all</gvsig.package.info.operatingSystem>
+        <gvsig.package.info.architecture>all</gvsig.package.info.architecture>
+        <gvsig.package.info.categories>Raster, Formats</gvsig.package.info.categories>
+        <gvsig.package.info.poolURL>https://devel.gvsig.org/download/projects/Raster/pool/</gvsig.package.info.poolURL>
+        <gvsig.package.info.codealias>org.gvsig.raster.gdal.app</gvsig.package.info.codealias>
+        <gvsig.package.info.description>${project.parent.description}</gvsig.package.info.description>
+        <gvsig.package.info.dependencies>required: org.gvsig.gdal.app.mainplugin -ge 1, required: org.gvsig.raster.tilecache.app -ge 2</gvsig.package.info.dependencies>
+
+        <gvsig.install.plugin>true</gvsig.install.plugin>
+        <gvsig.install.plugin.package>true</gvsig.install.plugin.package>
+
+    </properties>
+
+    <build>
+        <plugins>
+
+            <plugin>
+                <!-- Skip compilation tests -->
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>default-testCompile</id>
+                        <phase>process-test-sources</phase>
+                        <goals>
+                            <goal>testCompile</goal>
+                        </goals>
+                        <configuration>
+                            <skip>true</skip>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <plugin>
+                <!-- Skip test execution -->
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <skipTests>true</skipTests>
+                </configuration>
+            </plugin>
+ 
+        </plugins>
+    </build>
+
+</project>

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.app/org.gvsig.raster.gdal.app.mainplugin
___________________________________________________________________
Added: svn:ignore
   + target

.classpath

.project

.settings



Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/org.gvsig.raster.gdal.app
___________________________________________________________________
Added: svn:ignore
   + .classpath
.project
target
temp
.settings


Index: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/pom.xml
===================================================================
--- org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/pom.xml	(revision 0)
+++ org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/pom.xml	(revision 9865)
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<artifactId>org.gvsig.raster.gdal</artifactId>
+	<packaging>pom</packaging>
+	<version>2.2.85</version>
+	<name>${project.artifactId}</name>
+	<description>GDAL raster data provider for gvSIG</description>
+	<inceptionYear>2011</inceptionYear>
+
+	<parent>
+		<groupId>org.gvsig</groupId>
+		<artifactId>org.gvsig.desktop</artifactId>
+		<version>2.0.248</version>
+	</parent>
+
+	<properties>
+		<!-- El plugin versions:use-latest-versions falla con scope import -->
+		<!-- asi que toca usar el versions:update-properties que si que funciona -->
+		<org.gvsig.gdal.version>1.0.67</org.gvsig.gdal.version>
+		<org.gvsig.raster.version>2.2.97</org.gvsig.raster.version>
+	</properties>
+
+	<repositories>
+		<repository>
+			<id>gvsig-public-http-repository</id>
+			<name>gvSIG maven public HTTP repository</name>
+			<url>http://devel.gvsig.org/m2repo/j2se</url>
+			<releases>
+				<enabled>true</enabled>
+				<updatePolicy>daily</updatePolicy>
+				<checksumPolicy>warn</checksumPolicy>
+			</releases>
+			<snapshots>
+				<enabled>true</enabled>
+				<updatePolicy>daily</updatePolicy>
+				<checksumPolicy>warn</checksumPolicy>
+			</snapshots>
+		</repository>
+	</repositories>
+
+	<scm>
+		<connection>scm:svn:https://devel.gvsig.org/svn/gvsig-raster/org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85</connection>
+		<developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-raster/org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85</developerConnection>
+		<url>https://devel.gvsig.org/redmine/projects/gvsig-raster/repository/show/org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85</url>
+	</scm>
+
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-release-plugin</artifactId>
+				<configuration>
+					<tagBase>https://devel.gvsig.org/svn/gvsig-raster/org.gvsig.raster.gdal/tags/</tagBase>
+					<goals>deploy</goals>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+
+	<developers>
+		<developer>
+			<id>nbrodin</id>
+			<name>Nacho Brodin</name>
+			<email>nachobrodin@gmail.com</email>
+			<roles>
+				<role>Architect</role>
+				<role>Developer</role>
+			</roles>
+		</developer>
+	</developers>
+
+	<dependencyManagement>
+		<dependencies>
+			<dependency>
+				<groupId>org.gvsig</groupId>
+				<artifactId>org.gvsig.raster</artifactId>
+				<version>${org.gvsig.raster.version}</version>
+				<type>pom</type>
+				<scope>import</scope>
+			</dependency>
+
+			<dependency>
+				<groupId>org.gvsig</groupId>
+				<artifactId>org.gvsig.gdal</artifactId>
+				<version>${org.gvsig.gdal.version}</version>
+				<type>pom</type>
+				<scope>import</scope>
+			</dependency>
+
+                        <dependency>
+				<groupId>org.gvsig</groupId>
+				<artifactId>org.gvsig.raster.gdal.app.common</artifactId>
+				<version>2.2.14-SNAPSHOT</version>
+				<type>zip</type>
+			</dependency>
+
+			<dependency>
+				<groupId>org.gvsig</groupId>
+				<artifactId>org.gvsig.raster.gdal.io</artifactId>
+				<version>2.2.85</version>
+			</dependency>
+
+		</dependencies>
+	</dependencyManagement>
+
+	<modules>
+		<module>org.gvsig.raster.gdal.io</module>
+		<module>org.gvsig.raster.gdal.app</module>
+	</modules>
+
+</project>
+

Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85/pom.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain


Property changes on: org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.85
___________________________________________________________________
Added: svn:ignore
   + .project
.pom.xml.swp

.settings


