Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.spi/src/main/java/org/gvsig/fmap/dal/raster/spi/AbstractRasterStoreProvider.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.spi/src/main/java/org/gvsig/fmap/dal/raster/spi/AbstractRasterStoreProvider.java	(revision 43866)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.spi/src/main/java/org/gvsig/fmap/dal/raster/spi/AbstractRasterStoreProvider.java	(revision 43867)
@@ -66,7 +66,7 @@
  */
 public abstract class AbstractRasterStoreProvider extends AbstractDisposable implements RasterStoreProvider{
 
-    private static final Logger LOG =
+    protected static final Logger LOG =
         LoggerFactory.getLogger(AbstractRasterStoreProvider.class);
 
     private RasterStoreProviderServices store;
@@ -258,7 +258,7 @@
         try {
             open();
         } catch (Exception e) {
-            throw new RuntimeException();
+            throw new RuntimeException(e);
         }
     }
 
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.png/src/main/java/org/gvsig/fmap/dal/file/png/PngLibrary.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.png/src/main/java/org/gvsig/fmap/dal/file/png/PngLibrary.java	(revision 43866)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.png/src/main/java/org/gvsig/fmap/dal/file/png/PngLibrary.java	(revision 43867)
@@ -99,7 +99,8 @@
                     new ImageIOFileSystemServerProviderFactory(
                             NAME,
                             DESCRIPTION,
-                            FILE_EXTENSIONS
+                            FILE_EXTENSIONS,
+                            true
                     )
             );
         } catch (Exception e) {
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/resources/META-INF/services/org.gvsig.tools.library.Library	(revision 0)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/resources/META-INF/services/org.gvsig.tools.library.Library	(revision 43867)
@@ -0,0 +1 @@
+org.gvsig.fmap.dal.file.bsq.BSQLibrary
\ No newline at end of file
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/resources/org/gvsig/fmap/dal/file/bsq/BSQMetadata.xml
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/resources/org/gvsig/fmap/dal/file/bsq/BSQMetadata.xml	(revision 0)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/resources/org/gvsig/fmap/dal/file/bsq/BSQMetadata.xml	(revision 43867)
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<!--
+Definitions of metadata fields of a JIMI file.
+ -->
+<definitions>
+  <version>1.0.0</version>
+  <classes>
+
+    <class name="BSQ" namespace="Metadata">
+      <extends>
+      	<class namespace="Metadata" name="SpatialProvider"/>
+      </extends>
+      <description>Metadata of a BSQ store</description>
+      <fields>
+      </fields>
+    </class>
+
+  </classes>
+</definitions>
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/resources/org/gvsig/fmap/dal/file/bsq/BSQParameters.xml
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/resources/org/gvsig/fmap/dal/file/bsq/BSQParameters.xml	(revision 0)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/resources/org/gvsig/fmap/dal/file/bsq/BSQParameters.xml	(revision 43867)
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<definitions>
+  <version>1.0.0</version>
+  <classes>
+    <class name="BSQStoreProviderParameters">
+       <extends>
+      	<class namespace="dal" name="ProviderParameters"/>
+      </extends>
+      <description>Store the parameters need to open a tiff file</description>
+      <fields>
+        <field name="file" type="file" mandatory="true" group="Basic">
+          <description>tiff file</description>
+        </field>
+        <field name="crs" type="crs" mandatory="true" group="Basic">
+          <description>The coordinate reference system used in this BSQ file</description>
+        </field>
+      </fields>
+    </class>
+  </classes>
+</definitions>
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/file/bsq/BSQBandPageManager.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/file/bsq/BSQBandPageManager.java	(revision 0)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/file/bsq/BSQBandPageManager.java	(revision 43867)
@@ -0,0 +1,148 @@
+
+package org.gvsig.fmap.dal.file.bsq;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.nio.Buffer;
+import java.nio.ByteBuffer;
+import java.nio.DoubleBuffer;
+import java.nio.FloatBuffer;
+import java.nio.IntBuffer;
+import java.nio.ShortBuffer;
+import org.apache.commons.io.IOUtils;
+import org.gvsig.raster.lib.buffer.api.BandInfo;
+import org.gvsig.raster.lib.buffer.api.BandPageManager;
+import org.gvsig.raster.lib.buffer.api.BufferLocator;
+import org.gvsig.raster.lib.buffer.api.BufferManager;
+import org.gvsig.tools.dispose.impl.AbstractDisposable;
+import org.gvsig.tools.exception.BaseException;
+
+public class BSQBandPageManager extends AbstractDisposable implements BandPageManager {
+
+    private RandomAccessFile  raf;
+    private final int rows;
+    private final int columns;
+    private final int dataType;
+    private final File file;
+    private final long startpos;
+
+    /**
+     * @param file
+     * @param startpos
+     * @param rows
+     * @param columns
+     * @param dataType
+     * @throws IOException
+     */
+    public BSQBandPageManager(File file, long startpos, int rows, int columns, int dataType) throws IOException {
+        this.rows = rows;
+        this.columns = columns;
+        this.dataType = dataType;
+        this.file = file;
+        this.startpos = startpos;
+
+        this.raf = new RandomAccessFile(this.file, "rw");
+        // BufferManager bufferManager = BufferLocator.getBufferManager();
+        //raf.setLength(rows*columns*bufferManager.getDataTypeSize(dataType));
+
+    }
+
+    @Override
+    public void load(Buffer buffer, int row, int rows, int dataType) throws IOException {
+
+        long pos = row*this.columns + this.startpos;
+        raf.seek(pos);
+        BufferManager bufferManager = BufferLocator.getBufferManager();
+        int dataTypeSize = bufferManager.getDataTypeSize(dataType);
+        byte[] byteArray = new byte[buffer.capacity() * dataTypeSize];
+        raf.read(byteArray);
+        buffer.rewind();
+
+        switch (dataType) {
+        case BufferManager.TYPE_BYTE:
+            //FIXME: Elegir cual de las dos siguientes maneras de hacerlo es la idónea
+
+            ((ByteBuffer) buffer).put(byteArray, 0, byteArray.length);
+//            System.arraycopy(byteArray, 0, ((ByteBuffer) buffer).array(), 0, byteArray.length);
+            break;
+        case BufferManager.TYPE_SHORT:
+        case BufferManager.TYPE_USHORT:
+            for( int cell =0 ; cell<byteArray.length ; cell++ ) {
+                ((ShortBuffer) buffer).put((int)(cell/dataTypeSize), byteArray[cell]);
+            }
+            break;
+        case BufferManager.TYPE_INT:
+            for( int cell =0 ; cell<byteArray.length ; cell++ ) {
+                ((IntBuffer) buffer).put((int)(cell/dataTypeSize), byteArray[cell]);
+            }
+            break;
+        case BufferManager.TYPE_FLOAT:
+            for( int cell =0 ; cell<byteArray.length ; cell++ ) {
+                ((FloatBuffer) buffer).put((int)(cell/dataTypeSize), byteArray[cell]);
+            }
+            break;
+
+        case BufferManager.TYPE_DOUBLE:
+            for( int cell =0 ; cell<byteArray.length ; cell++ ) {
+                ((DoubleBuffer) buffer).put((int)(cell/dataTypeSize), byteArray[cell]);
+            }
+            break;
+
+        default:
+            throw new IllegalArgumentException("Data Type " + dataType + " not supported.");
+        }
+    }
+
+    @Override
+    public void save(Buffer buffer, int row, int rows, int dataType) throws IOException {
+
+        long pos = row*this.columns + this.startpos;
+        raf.seek(pos);
+
+        BufferManager bufferManager = BufferLocator.getBufferManager();
+        ByteBuffer byteBuffer = ByteBuffer.allocate(buffer.capacity() * bufferManager.getDataTypeSize(dataType));
+        switch (dataType) {
+        case BufferManager.TYPE_BYTE:
+            byteBuffer.put(((ByteBuffer)buffer).array());
+            break;
+        case BufferManager.TYPE_SHORT:
+        case BufferManager.TYPE_USHORT:
+            ShortBuffer byteAsShortBuffer = byteBuffer.asShortBuffer();
+            byteAsShortBuffer.put((short[]) buffer.array());
+            break;
+        case BufferManager.TYPE_INT:
+            IntBuffer byteAsIntBuffer = byteBuffer.asIntBuffer();
+            byteAsIntBuffer.put((int[]) buffer.array());
+            break;
+        case BufferManager.TYPE_FLOAT:
+            FloatBuffer byteAsFloatBuffer = byteBuffer.asFloatBuffer();
+            byteAsFloatBuffer.put((float[]) buffer.array());
+            break;
+        case BufferManager.TYPE_DOUBLE:
+            DoubleBuffer byteAsDoubleBuffer = byteBuffer.asDoubleBuffer();
+            byteAsDoubleBuffer.put((double[]) buffer.array());
+            break;
+        default:
+            throw new IllegalArgumentException("Data Type " + dataType + " not supported.");
+        }
+        raf.write(byteBuffer.array());
+
+    }
+
+    @Override
+    public boolean isSupportedSave() {
+        return true;
+    }
+
+    @Override
+    public BandInfo getBandInfo() {
+        return null;
+    }
+
+    @Override
+    protected void doDispose() throws BaseException {
+        IOUtils.closeQuietly(this.raf);
+        this.raf = null;
+    }
+}
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/file/bsq/FileOpenRasterStoreParameters.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/file/bsq/FileOpenRasterStoreParameters.java	(revision 0)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/file/bsq/FileOpenRasterStoreParameters.java	(revision 43867)
@@ -0,0 +1,83 @@
+/* gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright © 2007-2016 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 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.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.fmap.dal.file.bsq;
+
+import java.io.File;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.gvsig.fmap.dal.FileHelper;
+import org.gvsig.fmap.dal.raster.OpenRasterStoreParameters;
+import org.gvsig.fmap.dal.raster.spi.AbstractOpenRasterStoreParameters;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemStoreParameters;
+import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
+import org.gvsig.tools.dynobject.DelegatedDynObject;
+
+
+public class FileOpenRasterStoreParameters 
+        extends 
+            AbstractOpenRasterStoreParameters 
+        implements
+            OpenRasterStoreParameters, 
+            FilesystemStoreParameters
+    {
+
+    protected static final Logger logger = LoggerFactory.getLogger(FileOpenRasterStoreParameters.class);
+
+    public static final String FILE_PARAMTER_NAME = "file";
+
+    protected DelegatedDynObject parameters;
+
+    /**
+     * Constructor
+     * @param name
+     */
+    @SuppressWarnings("OverridableMethodCallInConstructor")
+    public FileOpenRasterStoreParameters(String name) {
+        super();
+        this.parameters = (DelegatedDynObject) FileHelper.newParameters(name+"StoreProviderParameters");
+        this.setDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME, name);
+    }
+
+    @Override
+    public boolean isValid() {
+        return (this.getFile() != null);
+    }
+
+    @Override
+    public File getFile() {
+        return (File) this.getDynValue(FILE_PARAMTER_NAME);
+    }
+
+    @Override
+    public void setFile(File file) {
+        this.setDynValue(FILE_PARAMTER_NAME, file);
+    }
+
+    @Override
+    protected DelegatedDynObject getDelegatedDynObject() {
+        return parameters;
+    }
+
+}
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/file/bsq/BSQFileSystemServerProviderFactory.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/file/bsq/BSQFileSystemServerProviderFactory.java	(revision 0)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/file/bsq/BSQFileSystemServerProviderFactory.java	(revision 43867)
@@ -0,0 +1,71 @@
+/* gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright © 2007-2018 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 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.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.fmap.dal.file.bsq;
+
+import java.io.File;
+
+import org.apache.commons.io.FilenameUtils;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.impl.AbstractFilesystemServerExplorerProviderFactory;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProvider;
+
+
+public class BSQFileSystemServerProviderFactory extends AbstractFilesystemServerExplorerProviderFactory {
+
+    protected String[] fileExtensions;
+    protected boolean canCreate;
+
+    public BSQFileSystemServerProviderFactory(
+            String name, 
+            String description, 
+            String[] fileExtensions
+        ) {
+        this(name, description, fileExtensions, false);
+    }
+
+    public BSQFileSystemServerProviderFactory(
+            String name, 
+            String description, 
+            String[] fileExtensions,
+            boolean canCreate
+        ) {
+        super(name, description);
+        this.fileExtensions = fileExtensions;
+        this.canCreate = canCreate;
+    }
+
+    @Override
+    public FilesystemServerExplorerProvider create() {
+        return new BSQFileSystemServerProvider(
+                this.getName(),
+                this.getDescription(),
+                this.fileExtensions,
+                this.canCreate
+        );
+    }
+
+    @Override
+    public boolean accept(File pathname) {
+        return FilenameUtils.isExtension(pathname.getName().toLowerCase(), this.fileExtensions);
+    }
+
+}
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/file/bsq/BSQStoreProviderFactory.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/file/bsq/BSQStoreProviderFactory.java	(revision 0)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/file/bsq/BSQStoreProviderFactory.java	(revision 43867)
@@ -0,0 +1,60 @@
+/* gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright © 2007-2016 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 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.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.fmap.dal.file.bsq;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.gvsig.fmap.dal.DataParameters;
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.raster.OpenRasterStoreParameters;
+import org.gvsig.fmap.dal.raster.spi.AbstractRasterStoreProviderFactory;
+import org.gvsig.fmap.dal.raster.spi.RasterStoreProvider;
+import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
+
+
+public class BSQStoreProviderFactory extends AbstractRasterStoreProviderFactory {
+
+    protected static final Logger logger = LoggerFactory.getLogger(BSQStoreProviderFactory.class);
+
+    public BSQStoreProviderFactory(String name, String description) {
+        super(name, description);
+    }
+
+    @Override
+    public RasterStoreProvider createProvider(DataParameters parameters,
+        DataStoreProviderServices providerServices) throws InitializeException {
+        return new BSQStoreProvider(
+                this.getName(), 
+                this.getDescription(), 
+                (OpenRasterStoreParameters)parameters, 
+                providerServices
+        );
+    }
+
+    @Override
+    public OpenRasterStoreParameters createParameters() {
+        return new FileOpenRasterStoreParameters(this.getName());
+    }
+
+}
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/file/bsq/BSQLibrary.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/file/bsq/BSQLibrary.java	(revision 0)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/file/bsq/BSQLibrary.java	(revision 43867)
@@ -0,0 +1,114 @@
+/* gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright © 2007-2016 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 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.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.fmap.dal.file.bsq;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.gvsig.fmap.dal.DALFileLibrary;
+import org.gvsig.fmap.dal.DALFileLocator;
+import org.gvsig.fmap.dal.DALLibrary;
+import org.gvsig.fmap.dal.FileHelper;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerManager;
+import org.gvsig.fmap.dal.spi.DALSPILocator;
+import org.gvsig.fmap.dal.spi.DataManagerProviderServices;
+import org.gvsig.metadata.MetadataLocator;
+import org.gvsig.metadata.MetadataManager;
+import org.gvsig.metadata.exceptions.MetadataException;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.library.AbstractLibrary;
+import org.gvsig.tools.library.LibraryException;
+
+/**
+ * BSQ, Band Sequential Format, Library to register provider components
+ *
+ */
+public class BSQLibrary extends AbstractLibrary {
+
+    public static String NAME = "BSQ";
+    public static String DESCRIPTION = "BSQ provider";
+    public static String[] FILE_EXTENSIONS = new String[]{"bsq"};
+
+    @Override
+    public void doRegistration() {
+        registerAsServiceOf(DALLibrary.class);
+        require(DALFileLibrary.class);
+
+    }
+
+    @Override
+    protected void doInitialize() throws LibraryException {
+    }
+
+    @Override
+    protected void doPostInitialize() throws LibraryException {
+        List<Throwable> exs = new ArrayList<>();
+
+
+        FileHelper.registerParametersDefinition(
+                NAME + "StoreProviderParameters",
+                FileOpenRasterStoreParameters.class,
+                this.getClass().getClassLoader(),
+                this.getClass().getResource(NAME + "Parameters.xml"));
+        try {
+            try {
+                FileHelper.registerMetadataDefinition(
+                        NAME,
+                        BSQStoreProvider.class,
+                        this.getClass().getClassLoader(),
+                        this.getClass().getResource(NAME + "Metadata.xml"));
+            } catch (MetadataException e) {
+                exs.add(e);
+            }
+            
+            DataManagerProviderServices datamanager = DALSPILocator.getDataManagerProviderServices();
+            FilesystemServerExplorerManager explorerManager = DALFileLocator.getFilesystemServerExplorerManager();
+
+            if (!datamanager.getStoreProviders().contains(NAME)) {
+                datamanager.registerStoreProviderFactory(
+                        new BSQStoreProviderFactory(
+                                NAME,
+                                DESCRIPTION));
+            }
+            explorerManager.registerProviderFactory(
+                    new BSQFileSystemServerProviderFactory(
+                            NAME,
+                            DESCRIPTION,
+                            FILE_EXTENSIONS,
+                            true
+                    )
+            );
+        } catch (Exception e) {
+            exs.add(e);
+        }
+
+        if (exs.size() > 0) {
+            throw new LibraryException(this.getClass(), exs);
+        }
+    }
+
+    public static DynClass getMatadataDefinition() {
+        MetadataManager metadataManager = MetadataLocator.getMetadataManager();
+        DynClass metadataDefinition = (DynClass) metadataManager.getDefinition(NAME);
+        return metadataDefinition;
+    }}
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/file/bsq/AbstractFileRasterStoreProvider.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/file/bsq/AbstractFileRasterStoreProvider.java	(revision 0)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/file/bsq/AbstractFileRasterStoreProvider.java	(revision 43867)
@@ -0,0 +1,328 @@
+
+package org.gvsig.fmap.dal.file.bsq;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.commons.io.FilenameUtils;
+import org.cresques.cts.IProjection;
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.DataManager;
+import org.gvsig.fmap.dal.DataServerExplorer;
+import org.gvsig.fmap.dal.DataStore;
+import org.gvsig.fmap.dal.DataStoreNotification;
+import org.gvsig.fmap.dal.FileHelper;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.exception.OpenException;
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
+import org.gvsig.fmap.dal.fileutils.CLRFile;
+import org.gvsig.fmap.dal.fileutils.PRJFile;
+import org.gvsig.fmap.dal.fileutils.STXFile;
+import org.gvsig.fmap.dal.fileutils.WLDFile;
+import org.gvsig.fmap.dal.fileutils.spi.UtilsFile;
+import org.gvsig.fmap.dal.raster.OpenRasterStoreParameters;
+import org.gvsig.fmap.dal.raster.api.BandQuery;
+import org.gvsig.fmap.dal.raster.api.RasterQuery;
+import org.gvsig.fmap.dal.raster.spi.AbstractAwtRasterStoreProvider;
+import org.gvsig.fmap.dal.raster.spi.AbstractRasterStoreProvider;
+import org.gvsig.fmap.dal.resource.file.FileResource;
+import org.gvsig.fmap.dal.resource.spi.ResourceConsumer;
+import org.gvsig.fmap.dal.resource.spi.ResourceProvider;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorer;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorerParameters;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemStoreParameters;
+import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.raster.lib.buffer.api.Buffer;
+import org.gvsig.raster.lib.buffer.api.BufferDimensions;
+import org.gvsig.raster.lib.buffer.api.BufferLocator;
+import org.gvsig.raster.lib.buffer.api.BufferManager;
+import org.gvsig.raster.lib.buffer.api.NoData;
+import org.gvsig.raster.lib.buffer.api.PageManager;
+import org.gvsig.raster.lib.buffer.api.TileStruct;
+import org.gvsig.raster.lib.buffer.api.exceptions.BufferException;
+import org.gvsig.raster.lib.buffer.spi.DefaultTileStruct;
+import org.gvsig.tools.dynobject.exception.DynFieldNotFoundException;
+import org.gvsig.tools.exception.BaseException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public abstract class AbstractFileRasterStoreProvider 
+        extends AbstractRasterStoreProvider
+        implements ResourceConsumer
+    {
+
+    private static final Logger logger = LoggerFactory.getLogger(AbstractAwtRasterStoreProvider.class);
+
+    protected Envelope envelope = null;
+    protected IProjection projection = null;
+    protected List<PageManager> pageManagers;
+    protected TileStruct tileStruct;
+    protected String storeProviderName;
+    protected String storeProviderDescription;
+    protected ResourceProvider resource;
+
+    protected WLDFile wldFile;
+    protected PRJFile prjFile;
+    protected STXFile stxFile;
+    // protected CLRFile clrFile;
+    
+    @SuppressWarnings("OverridableMethodCallInConstructor")
+    public AbstractFileRasterStoreProvider(
+        String storeProviderName, 
+        String storeProviderDescription, 
+        OpenRasterStoreParameters params,
+        DataStoreProviderServices storeServices
+        ) throws InitializeException {
+        super(
+                params,
+                storeServices,
+                FileHelper.newMetadataContainer(storeProviderName)
+        );
+        this.storeProviderName = storeProviderName;
+        this.storeProviderDescription = storeProviderDescription;
+        this.init(params, storeServices);
+    }
+    
+    protected void init(OpenRasterStoreParameters params, DataStoreProviderServices storeServices) throws InitializeException {
+        File file = this.getFile();
+        if (file == null) {
+            throw new InitializeException(
+                new NullPointerException(this.storeProviderName +" file is null"));
+        }
+
+        this.wldFile = UtilsFile.createWLDFile(this.getFile());
+        this.prjFile = UtilsFile.createPRJFile(this.getFile());
+        this.stxFile = UtilsFile.createSTXFile(this.getFile());
+        // this.clrFile = UtilsFile.createCLRFile(this.getFile());
+
+        this.projection = (IProjection) params.getDynValue(DataStore.METADATA_CRS);
+        if( this.projection==null ) {
+            this.projection = this.prjFile.getCRS();
+        }
+        
+        resource = this.createResource(
+            FileResource.NAME,
+            new Object[] { file.getAbsolutePath() }
+        );
+
+        resource.addConsumer(this);
+    }
+
+    @Override
+    public ResourceProvider getResource() {
+        return this.resource;
+    }
+
+    protected File getFile() {
+        return ((FilesystemStoreParameters)this.getParameters()).getFile();
+    }
+    
+    @Override
+    public Object getSourceId() {
+        return this.getFile();
+    }
+
+    @Override
+    public String getName() {
+        String name = this.getFile().getName();
+        return FilenameUtils.getBaseName(name);
+    }
+
+    @Override
+    public String getFullName() {
+        return this.getFile().getAbsolutePath();
+    }
+
+    @Override
+    public String getProviderName() {
+        return this.storeProviderName;
+    }
+    
+    @Override
+    public boolean closeResourceRequested(ResourceProvider resource) {
+        return true;
+    }
+
+    @Override
+    public void resourceChanged(ResourceProvider resource) {
+        this.getStoreServices().notifyChange(
+            DataStoreNotification.RESOURCE_CHANGED,
+            resource);
+    }
+
+    @Override
+    protected void doDispose() throws BaseException {
+        super.doDispose();
+    }
+    
+    @Override
+    public DataServerExplorer getExplorer() throws ReadException, ValidateDataParametersException {
+        DataManager manager = DALLocator.getDataManager();
+        FilesystemServerExplorerParameters params;
+        try {
+            params = (FilesystemServerExplorerParameters) manager
+            .createServerExplorerParameters(FilesystemServerExplorer.NAME);
+            params.setRoot(this.getFile().getParent());
+            return manager.openServerExplorer(FilesystemServerExplorer.NAME,params);
+        } catch (DataException | ValidateDataParametersException e) {
+            throw new ReadException(this.getProviderName(), e);
+        }
+
+    }
+
+    @Override
+    public BufferDimensions getDimensions() {
+        if(this.dimensions==null){
+            this.dimensions = BufferLocator.getBufferManager().createBufferDimensions(
+                    this.getRows(), 
+                    this.getColumns(), 
+                    this.getEnvelope()
+            );
+        }
+        return this.dimensions;
+    }
+
+    @Override
+    public TileStruct getTileStruct() {
+
+        List<Double> pixelSizes = new ArrayList<>();
+        Map<Integer, Double> zoomLevels = new HashMap<>();
+
+        if (this.tileStruct == null) {
+
+            tileStruct = new DefaultTileStruct();
+
+            int completeRows = getRows();
+            int completeColumns = getColumns();
+            double completePixelSizeX = envelope.getLength(Geometry.DIMENSIONS.X) / completeColumns;
+            double completePixelSizeY = envelope.getLength(Geometry.DIMENSIONS.Y) / completeRows;
+
+            int maximumLength = completeColumns;
+            int tileMaximumLength = tileStruct.getColumnsPerTile(); // tileSizeX;
+            double maximumPixelSize = completePixelSizeX;
+
+            if (completeRows * tileStruct.getRowsPerTile() > completeColumns * tileStruct.getColumnsPerTile()) {
+                maximumLength = completeRows;
+                tileMaximumLength = tileStruct.getRowsPerTile();
+                maximumPixelSize = completePixelSizeY;
+            }
+
+            double pixelSize = maximumPixelSize;
+            while (maximumLength * maximumPixelSize / pixelSize > tileMaximumLength) {
+                pixelSizes.add(pixelSize);
+                pixelSize = pixelSize * 2;
+            }
+            pixelSizes.add(pixelSize);
+            int i = 0;
+            for (int zoomLevel = pixelSizes.size() - 1; zoomLevel >= 0; zoomLevel--) {
+                zoomLevels.put(i, pixelSizes.get(zoomLevel));
+                i++;
+            }
+        }
+
+        return tileStruct;
+
+    }
+    
+    @Override
+    public Object getDynValue(String name) throws DynFieldNotFoundException {
+        switch(name) {
+            case DataStore.METADATA_CRS:
+                return this.getProjection();
+                
+            case DataStore.METADATA_ENVELOPE:
+                return this.getProjection();
+                
+            default:
+                return super.getDynValue(name);
+        }
+    }
+
+    @Override
+    public void setDynValue(String name, Object value)
+        throws DynFieldNotFoundException {
+        switch(name) {
+            case DataStore.METADATA_CRS:
+                this.projection = (IProjection) value;
+                break;
+                
+            case DataStore.METADATA_ENVELOPE:
+                this.envelope = (Envelope) value;
+                break;
+                
+            default:
+                super.setDynValue(name, value);
+                break;
+        }
+    }
+    
+    protected List<PageManager> getPageManagers() {
+        this.autoOpen();
+        return this.pageManagers;
+    }
+
+    protected IProjection getProjection() {
+        this.autoOpen();
+        return this.projection;
+    }
+
+    protected Envelope getEnvelope() {
+        this.autoOpen();
+        return this.envelope;
+    }
+    
+    @Override
+    public Buffer createBuffer(RasterQuery rasterQuery) throws BufferException {
+        BufferManager bufferManager = BufferLocator.getBufferManager();
+        int[] bandDataTypes;
+        List<PageManager> thePageManagers = new ArrayList<>();
+        NoData[] bandNoData;
+        if (rasterQuery != null && !rasterQuery.getBands().isEmpty() ) {
+            List<BandQuery> bands;
+            bands = rasterQuery.getBands();
+            bandDataTypes = new int[bands.size()];
+            bandNoData = new NoData[bands.size()];
+
+            for (BandQuery bandQuery : bands) {
+                int band = bandQuery.getBand();
+                bandDataTypes[band] = this.getBandDescriptor(band).getDataType();
+                bandNoData[band] = this.getNoData(rasterQuery, band);
+                thePageManagers.add(this.getPageManagers().get(band));
+            }
+        } else {
+            bandDataTypes = this.getDataTypes();
+            bandNoData = this.getNoDatas();
+            thePageManagers = this.getPageManagers();
+        }
+
+        Buffer buffer = bufferManager.createBuffer(
+                    this.getRows(), 
+                    this.getColumns(), 
+                    bandDataTypes, 
+                    bandNoData,
+                    this.getProjection(), 
+                    this.getEnvelope(), 
+                    thePageManagers
+            );
+
+        return buffer;    
+    }
+
+    @Override
+    public abstract void open() throws OpenException;
+    
+    @Override
+    public abstract int getBands();
+    
+    public abstract int getRows();
+    
+    public abstract int getColumns();
+    
+}
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/file/bsq/BSQFileSystemServerProvider.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/file/bsq/BSQFileSystemServerProvider.java	(revision 0)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/file/bsq/BSQFileSystemServerProvider.java	(revision 43867)
@@ -0,0 +1,82 @@
+/* gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright © 2007-2016 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 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.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.fmap.dal.file.bsq;
+
+import java.io.File;
+import org.apache.commons.io.FilenameUtils;
+
+import org.gvsig.fmap.dal.DataServerExplorer;
+import org.gvsig.fmap.dal.NewDataStoreParameters;
+import org.gvsig.fmap.dal.exception.CreateException;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.impl.AbstractFilesystemServerExplorerProvider;
+
+public class BSQFileSystemServerProvider extends AbstractFilesystemServerExplorerProvider {
+
+    protected String[] fileExtensions;
+    protected boolean canCreate;
+
+    public BSQFileSystemServerProvider(
+            String name, 
+            String description, 
+            String[] fileExtensions
+        ) {
+        this(name, description, fileExtensions, false);
+    }
+    
+    public BSQFileSystemServerProvider(
+            String name, 
+            String description, 
+            String[] fileExtensions,
+            boolean canCreate
+        ) {
+        super(name, description);
+        this.fileExtensions = fileExtensions;
+        this.canCreate = canCreate;
+    }
+    
+    @Override
+    public boolean canCreate() {
+        return canCreate;
+    }
+
+    @Override
+    public NewDataStoreParameters getCreateParameters() throws DataException {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void create(NewDataStoreParameters parameters, boolean overwrite) throws CreateException {
+        throw new UnsupportedOperationException();
+    }
+        
+    @Override
+    public int getMode() {
+        return DataServerExplorer.MODE_RASTER;
+    }
+
+    @Override
+    public boolean accept(File pathname) {
+        return FilenameUtils.isExtension(pathname.getName().toLowerCase(), this.fileExtensions);
+    }
+}
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/file/bsq/BSQStoreProvider.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/file/bsq/BSQStoreProvider.java	(revision 0)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/file/bsq/BSQStoreProvider.java	(revision 43867)
@@ -0,0 +1,128 @@
+/* gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright © 2007-2016 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 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.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.fmap.dal.file.bsq;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.exception.OpenException;
+import org.gvsig.fmap.dal.fileutils.HDRFile;
+import org.gvsig.fmap.dal.fileutils.spi.UtilsFile;
+import org.gvsig.fmap.dal.raster.OpenRasterStoreParameters;
+import org.gvsig.fmap.dal.raster.spi.BandDescriptorServices;
+import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
+import org.gvsig.tools.exception.BaseException;
+
+public class BSQStoreProvider extends AbstractFileRasterStoreProvider {
+
+    // https://www.qgistutorials.com/en/docs/open_bil_bip_bsq_files.html
+    // http://glcf.umd.edu/data/landcover/data.shtml
+    
+    protected HDRFile hdrFile;
+
+    @SuppressWarnings("OverridableMethodCallInConstructor")
+    public BSQStoreProvider(
+            String name,
+            String description,
+            OpenRasterStoreParameters params, 
+            DataStoreProviderServices storeServices) throws InitializeException {
+        super(
+                name,
+                description,
+                params,
+                storeServices
+        );
+        this.init(params, storeServices);
+    }
+
+    @Override
+    public int getBands() {
+        this.autoOpen();
+        return this.hdrFile.getNbands();
+    }
+
+    @Override
+    public int getRows() {
+        this.autoOpen();
+        return this.hdrFile.getNrows();
+    }
+
+    @Override
+    public int getColumns() {
+        this.autoOpen();
+        return this.hdrFile.getNcols();
+    }
+    
+    @Override
+    protected void doDispose() throws BaseException {
+        super.doDispose();
+        this.hdrFile = null;
+    }
+    
+    @Override
+    public void open() throws OpenException {
+        if ( this.hdrFile!=null ) {
+            return;
+        }
+        HDRFile theHDRFile = UtilsFile.createHDRFile(this.getFile());
+        if (!theHDRFile.isValid()) {
+            throw new OpenException(this.getProviderName(), null);
+        }
+        this.hdrFile = theHDRFile;
+        this.envelope = this.hdrFile.getEnvelope();
+        if (this.envelope == null) {
+            this.envelope = this.wldFile.getEnvelope(
+                    this.hdrFile.getNrows(),
+                    this.hdrFile.getNcols()
+            );
+        }
+        try {
+            int dataType = this.hdrFile.getDataType();
+            this.pageManagers = new ArrayList<>();
+            for (int nband = 0; nband < this.hdrFile.getNbands(); nband++) {
+                BandDescriptorServices bandDescriptor = getBandDescriptor(nband);
+                bandDescriptor.setDataType(dataType);
+                bandDescriptor.setName(String.valueOf(nband));
+                try {
+                    bandDescriptor.setDescription(this.getName()+ "- band "+nband);
+                } catch (Exception e) {
+                    bandDescriptor.setDescription("band "+nband);
+                }
+                bandDescriptor.add("X size", this.hdrFile.getNcols());
+                bandDescriptor.add("Y size", this.hdrFile.getNrows());                
+                BSQBandPageManager pageManager = new BSQBandPageManager(
+                        getFile(),
+                        nband * this.hdrFile.getBandSize(),
+                        this.hdrFile.getNrows(),
+                        this.hdrFile.getNcols(),
+                        dataType
+                );
+                this.pageManagers.add(pageManager);
+            }
+        } catch (IOException ex) {
+            this.hdrFile = null;
+            throw new OpenException(storeProviderName, ex);
+        }
+    }
+
+}
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/WLDFile.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/WLDFile.java	(revision 0)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/WLDFile.java	(revision 43867)
@@ -0,0 +1,45 @@
+
+package org.gvsig.fmap.dal.fileutils;
+
+import org.gvsig.fmap.geom.primitive.Envelope;
+
+
+public interface WLDFile extends AuxFile {
+
+    String FILE_EXTENSION = "wld";
+
+    Envelope getEnvelope(int rows, int columns);
+
+    void setValue(Envelope envelope, int rows, int columns);
+
+    /**
+     * @return the pixelSizeX
+     */
+    double getPixelSizeX();
+
+    /**
+     * @return the pixelSizeY
+     */
+    double getPixelSizeY();
+
+    /**
+     * @return the rotationAxisX
+     */
+    double getRotationAxisX();
+
+    /**
+     * @return the rotationAxisY
+     */
+    double getRotationAxisY();
+
+    /**
+     * @return the upperLeftPixelCenterCoordX
+     */
+    double getUpperLeftPixelCenterCoordX();
+
+    /**
+     * @return the upperLeftPixelCenterCoordY
+     */
+    double getUpperLeftPixelCenterCoordY();
+
+}
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/CPGFile.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/CPGFile.java	(revision 0)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/CPGFile.java	(revision 43867)
@@ -0,0 +1,36 @@
+
+package org.gvsig.fmap.dal.fileutils;
+
+public interface CPGFile extends AuxFile {
+
+    public String FILE_EXTENSION = "cpg";
+
+    public String getCharsetName();
+
+    public void setCharsetName(String charsetName);
+
+    /**
+     * Returns the code page corresponding to the
+     * provided charset name
+     *
+     * @param charsetName
+     * @return The code page, or 0x00 if no equivalent code page was found for
+     * the provided charsetName
+     */
+    public int toCPG(String charsetName);
+
+    public String toCPGName(String charsetName);
+
+    public String toCharsetName(String codePageName);
+
+    /**
+     * Gets the Java NIO charset name equivalent to the provided code page.
+     * Gets null if the provided code page is not recognised
+     * as a valid code
+     *
+     * @param codePage
+     * @return
+     */
+    public String toCharsetName(int codePage);
+    
+}
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/PRJFile.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/PRJFile.java	(revision 0)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/PRJFile.java	(revision 43867)
@@ -0,0 +1,15 @@
+
+package org.gvsig.fmap.dal.fileutils;
+
+import org.cresques.cts.IProjection;
+
+
+public interface PRJFile extends AuxFile {
+
+    public String FILE_EXTENSION = "prj";
+    
+    public IProjection getCRS();
+
+    public void setCRS(IProjection crs);
+
+}
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/spi/UtilsFile.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/spi/UtilsFile.java	(revision 0)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/spi/UtilsFile.java	(revision 43867)
@@ -0,0 +1,68 @@
+
+package org.gvsig.fmap.dal.fileutils.spi;
+
+import java.io.File;
+import org.gvsig.fmap.dal.fileutils.CLRFile;
+import org.gvsig.fmap.dal.fileutils.CPGFile;
+import org.gvsig.fmap.dal.fileutils.HDRFile;
+import org.gvsig.fmap.dal.fileutils.PRJFile;
+import org.gvsig.fmap.dal.fileutils.STXFile;
+import org.gvsig.fmap.dal.fileutils.WLDFile;
+import org.gvsig.fmap.dal.fileutils.impl.DefaultCLRFile;
+import org.gvsig.fmap.dal.fileutils.impl.DefaultCPGFile;
+import org.gvsig.fmap.dal.fileutils.impl.DefaultHDRFile;
+import org.gvsig.fmap.dal.fileutils.impl.DefaultPRJFile;
+import org.gvsig.fmap.dal.fileutils.impl.DefaultSTXFile;
+import org.gvsig.fmap.dal.fileutils.impl.DefaultWLDFile;
+
+public class UtilsFile {
+    
+    public static CPGFile createCFGFile() {
+        return new DefaultCPGFile();
+    }
+
+    public static CPGFile createCFGFile(File file) {
+        return new DefaultCPGFile(file);
+    }
+
+    public static HDRFile createHDRFile() {
+        return new DefaultHDRFile();
+    }
+
+    public static HDRFile createHDRFile(File file) {
+        return new DefaultHDRFile(file);
+    }
+
+    public static PRJFile createPRJFile() {
+        return new DefaultPRJFile();
+    }
+
+    public static PRJFile createPRJFile(File file) {
+        return new DefaultPRJFile(file);
+    }
+
+    public static STXFile createSTXFile() {
+        return new DefaultSTXFile();
+    }
+
+    public static STXFile createSTXFile(File file) {
+        return new DefaultSTXFile(file);
+    }
+
+    public static WLDFile createWLDFile() {
+        return new DefaultWLDFile();
+    }
+
+    public static WLDFile createWLDFile(File file) {
+        return new DefaultWLDFile(file);
+    }
+
+    public static CLRFile createCLRFile() {
+        return new DefaultCLRFile();
+    }
+
+    public static CLRFile createCLRFile(File file) {
+        return new DefaultCLRFile(file);
+    }
+
+}
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/AuxFile.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/AuxFile.java	(revision 0)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/AuxFile.java	(revision 43867)
@@ -0,0 +1,17 @@
+
+package org.gvsig.fmap.dal.fileutils;
+
+import java.io.File;
+import java.io.IOException;
+
+
+public interface AuxFile {
+ 
+    public File getFile(File file);
+
+    public File getFile();
+
+    public void read(File file) throws IOException ;
+
+    public void write(File file) throws IOException ;       
+}
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/HDRFile.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/HDRFile.java	(revision 0)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/HDRFile.java	(revision 43867)
@@ -0,0 +1,128 @@
+
+package org.gvsig.fmap.dal.fileutils;
+
+import java.nio.ByteOrder;
+import org.gvsig.fmap.geom.primitive.Envelope;
+
+
+public interface HDRFile extends AuxFile {
+
+    public String FILE_EXTENSION = "hdr";
+    public String LAYOUT_BIL = "bil";
+    public String LAYOUT_BIP = "bip";
+    public String LAYOUT_BSQ = "bsq";
+    
+    public int NONE = -1;
+
+    public Envelope getEnvelope();
+    
+    public int getDataType();
+    
+    /**
+     * @return the bandgapbytes
+     */
+    public int getBandgapbytes();
+
+    /**
+     * @return the bandrowbytes
+     */
+    public int getBandrowbytes();
+
+    /**
+     * @return the byteorder
+     */
+    public ByteOrder getByteorder();
+
+    /**
+     * @return the comments
+     */
+    public String getComments();
+
+    /**
+     * @return the layout
+     */
+    public String getLayout();
+
+    /**
+     * @return the nbands
+     */
+    public int getNbands();
+
+    /**
+     * @return the nbits
+     */
+    public int getNbits();
+
+    /**
+     * @return the ncols
+     */
+    public int getNcols();
+
+    /**
+     * @return the nrows
+     */
+    public int getNrows();
+
+    /**
+     * @return the skipbytes
+     */
+    public int getSkipbytes();
+
+    /**
+     * @return the totalrowbytes
+     */
+    public int getTotalrowbytes();
+
+    /**
+     * @return the ulxmax
+     */
+    public double getUlxmax();
+
+    /**
+     * @return the ulymax
+     */
+    public double getUlymax();
+
+    /**
+     * @return the xdim
+     */
+    public double getXdim();
+
+    /**
+     * @return the ydim
+     */
+    public double getYdim();
+
+    /**
+     * @return the isValid
+     */
+    public boolean isValid();
+
+    /**
+     * @param comments the comments to set
+     */
+    public void setComments(String comments);
+
+    public int getBandSize();
+
+    /**
+     * @return the cellsize
+     */
+    public int getCellsize();
+
+    /**
+     * @return the nodata_value
+     */
+    public double getNodata_value();
+
+    /**
+     * @return the xllcorner
+     */
+    public double getXllcorner();
+
+    /**
+     * @return the yllcorner
+     */
+    public double getYllcorner();
+    
+}
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/STXFile.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/STXFile.java	(revision 0)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/STXFile.java	(revision 43867)
@@ -0,0 +1,39 @@
+package org.gvsig.fmap.dal.fileutils;
+
+import java.util.List;
+
+public interface STXFile extends AuxFile {
+
+    public interface STXBand {
+        
+        public void parse(String line);
+
+        @Override
+        public String toString();
+        
+        public int getBand();
+        
+        public double getMinimum();
+        
+        public double getMaximum();
+        
+        public double getMean();
+        
+        public double getStdDeviation();
+        
+        public double getLinearStretchMin();
+        
+        public double getLinearStretchMax();
+
+        public boolean isValid();
+    }
+    
+    public String FILE_EXTENSION = "stx";
+
+    public void addBand(int band, double minimum, double maximum, double mean, double std_deviation, double linear_stretch_min, double linear_stretch_max);
+
+    public void clear();
+
+    public List<STXBand> getBands();
+   
+}
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/CLRFile.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/CLRFile.java	(revision 0)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/CLRFile.java	(revision 43867)
@@ -0,0 +1,17 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.gvsig.fmap.dal.fileutils;
+
+import org.gvsig.raster.lib.legend.api.colortable.ColorTable;
+
+
+public interface CLRFile extends AuxFile {
+
+    ColorTable getColorTable();
+
+    void setColorTable(ColorTable colorTable);
+    
+}
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/impl/DefaultHDRFile.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/impl/DefaultHDRFile.java	(revision 0)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/impl/DefaultHDRFile.java	(revision 43867)
@@ -0,0 +1,535 @@
+package org.gvsig.fmap.dal.fileutils.impl;
+
+import org.gvsig.fmap.dal.fileutils.HDRFile;
+import java.io.File;
+import java.nio.ByteOrder;
+import java.util.List;
+import java.util.logging.Level;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.FilenameUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.exception.CreateEnvelopeException;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.raster.lib.buffer.api.BufferManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DefaultHDRFile implements HDRFile {
+
+    // http://resources.esri.com/help/9.3/arcgisdesktop/com/gp_toolref/spatial_analyst_tools/esri_ascii_raster_format.htm
+    private static final Logger logger = LoggerFactory.getLogger(DefaultHDRFile.class);
+
+    private File source;
+    private String comments;
+
+    private int nrows = NONE;
+    private int ncols = NONE;
+    private int nbands = 1;
+    private int nbits = 8;
+    private String pixeltype;
+    private String byteorder_word;
+    private ByteOrder byteorder = ByteOrder.nativeOrder();
+    private String layout = LAYOUT_BIL;
+    private int skipbytes = 0;
+    private double ulxmax = Double.NaN;
+    private double ulymax = Double.NaN;
+    private double xdim = Double.NaN;
+    private double ydim = Double.NaN;
+    private int bandrowbytes = NONE;
+    private int totalrowbytes = NONE;
+    private int bandgapbytes = 0;
+    private boolean valid = false;
+    private double nodata_value = Double.NaN;
+
+    // X coordinate of the origin (by center or lower left corner of the cell).
+    private double xllcorner = Double.NaN;
+
+    // Y coordinate of the origin (by center or lower left corner of the cell).
+    private double yllcorner = Double.NaN;
+
+    private int cellsize = NONE;
+
+    public DefaultHDRFile() {
+        this.source = null;
+    }
+
+    @SuppressWarnings("OverridableMethodCallInConstructor")
+    public DefaultHDRFile(File file) {
+        this();
+        this.read(file);
+    }
+
+    @Override
+    public File getFile(File file) {
+        File f = new File(FilenameUtils.removeExtension(file.getAbsolutePath()) + "." + FILE_EXTENSION);
+        return f;
+    }
+
+    @Override
+    public File getFile() {
+        return source;
+    }
+
+    @Override
+    public void read(File file) {
+        File f = this.getFile(file);
+        if (f.exists()) {
+            try {
+                List<String> lines = FileUtils.readLines(f);
+                if (lines != null) {
+                    this.source = f.getAbsoluteFile();
+                    int lineno = 1;
+                    for (String line : lines) {
+                        String[] words = StringUtils.split(line.trim().toLowerCase());
+                        try {
+                            switch (words[0]) {
+                                case "nrows":
+                                    this.nrows = Integer.parseUnsignedInt(words[1]);
+                                    break;
+                                case "ncols":
+                                    this.ncols = Integer.parseUnsignedInt(words[1]);
+                                    break;
+                                case "nbands":
+                                    this.nbands = Integer.parseUnsignedInt(words[1]);
+                                    break;
+                                case "nbits":
+                                    this.nbits = Integer.parseUnsignedInt(words[1]);
+                                    break;
+                                case "pixeltype":
+                                    this.pixeltype = words[1];
+                                    break;
+                                case "byteorder":
+                                    this.byteorder_word = words[1];
+                                    break;
+                                case "layout":
+                                    this.layout = words[1];
+                                    break;
+                                case "skipbytes":
+                                    this.skipbytes = Integer.parseUnsignedInt(words[1]);
+                                    break;
+                                case "nodata_value":
+                                    this.nodata_value = Double.parseDouble(words[1]);
+                                    break;
+                                case "cellsize":
+                                    this.cellsize = Integer.parseUnsignedInt(words[1]);
+                                    break;
+                                case "xllcorner":
+                                case "xllcenter":
+                                    this.xllcorner = Double.parseDouble(words[1]);
+                                    break;
+                                case "yllcorner":
+                                case "yllcenter":
+                                    this.yllcorner = Double.parseDouble(words[1]);
+                                    break;
+                                case "ulxmax":
+                                    this.ulxmax = Double.parseDouble(words[1]);
+                                    break;
+                                case "ulymax":
+                                    this.ulymax = Double.parseDouble(words[1]);
+                                    break;
+                                case "xdim":
+                                    this.xdim = Double.parseDouble(words[1]);
+                                    break;
+                                case "ydim":
+                                    this.ydim = Double.parseDouble(words[1]);
+                                    break;
+                                case "bandrowbytes":
+                                    this.bandrowbytes = Integer.parseUnsignedInt(words[1]);
+                                    break;
+                                case "totalrowbytes":
+                                    this.totalrowbytes = Integer.parseUnsignedInt(words[1]);
+                                    break;
+                                case "bandgapbytes":
+                                    this.bandgapbytes = Integer.parseUnsignedInt(words[1]);
+                                    break;
+                            }
+                        } catch (NumberFormatException e) {
+                            logger.warn("Can't parse keyword '" + words[0]
+                                    + "' (value='" + words[1]
+                                    + "', lineno=+" + lineno
+                                    + ", file=" + f.getAbsoluteFile()
+                                    + ").", e);
+                        }
+                        lineno++;
+                    }
+                    this.fixValues();
+                }
+
+            } catch (Exception e) {
+                logger.warn("Couldn't read " + FILE_EXTENSION + " file (" + f.getAbsoluteFile() + ")", e);
+            }
+        }
+    }
+
+    private void fixValues() {
+        @SuppressWarnings("LocalVariableHidesMemberVariable")
+        boolean valid = true;
+
+        if (this.pixeltype != null) {
+            switch (this.pixeltype) {
+                case "signedint":
+                    this.nbits = 32;
+                    break;
+                case "byte_unsigned":
+                    this.nbits = 8;
+                    break;
+            }
+        }
+
+        switch (this.getNbits()) {
+            case 1:
+            case 4:
+                logger.warn("nbits keyword has a non supported value of " + this.getNbits() + " (" + this.source.getAbsolutePath() + ").");
+                valid = false;
+                break;
+            case 8:
+            case 16:
+            case 32:
+            case 64:
+                break;
+            default:
+                logger.warn("nbits keyword has an invalid value of " + this.getNbits() + " (" + this.source.getAbsolutePath() + ").");
+                this.nbits = 1;
+                valid = false;
+                break;
+        }
+
+        switch (this.getLayout()) {
+            case LAYOUT_BIL:
+            case LAYOUT_BIP:
+            case LAYOUT_BSQ:
+                break;
+            default:
+                logger.warn("layout keyword has an invalid value of '" + this.getLayout() + "' (" + this.source.getAbsolutePath() + ").");
+                this.layout = LAYOUT_BIL;
+                valid = false;
+                break;
+        }
+
+        if( StringUtils.isEmpty(this.byteorder_word) ) {
+            this.byteorder = ByteOrder.nativeOrder();
+            if( this.byteorder == ByteOrder.BIG_ENDIAN ) {
+                this.byteorder_word = "msbfirst";
+            } else {
+                this.byteorder_word = "lsbfirst";
+            }
+        } else {
+            switch(this.byteorder_word) {
+                case "lsbfirst":
+                case "little_endian":
+                case "littleendian":
+                case "intel":
+                case "i":
+                    this.byteorder = ByteOrder.LITTLE_ENDIAN;
+                    break;
+                case "motorola":
+                case "m":
+                case "msbfirst":
+                case "big_endian":
+                case "bigendian":
+                    this.byteorder = ByteOrder.BIG_ENDIAN;
+                    break;
+                default:
+                    logger.warn("byteorder keyword has an invalid value of '" + this.byteorder_word + "' (" + this.source.getAbsolutePath() + ").");
+                    this.byteorder = ByteOrder.nativeOrder();
+            }
+        }
+        if (this.getNrows() == NONE || this.getNcols() == NONE) {
+            logger.warn("nrows/ncols keywords has an invalid value of '" + this.getNrows() + "/" + this.getNcols() + "' (" + this.source.getAbsolutePath() + ").");
+            valid = false;
+        }
+        if (this.getUlymax() == NONE) {
+            this.ulymax = this.getNrows() - 1;
+        }
+        if (this.getBandrowbytes() == NONE) {
+            this.bandrowbytes = (this.getNcols() * this.getNbits()) / 8;
+        }
+        switch (this.getLayout()) {
+            case LAYOUT_BIL:
+                if (this.getTotalrowbytes() == NONE) {
+                    this.totalrowbytes = this.getNbands() * this.getBandrowbytes();
+                }
+                this.bandgapbytes = 0;
+                break;
+            case LAYOUT_BIP:
+                if (this.getTotalrowbytes() == NONE) {
+                    this.totalrowbytes = (this.getNcols() * this.getNbands() * this.getNbits()) / 8;
+                }
+                this.bandgapbytes = 0;
+                break;
+            case LAYOUT_BSQ:
+                if (this.getTotalrowbytes() == NONE) {
+                    this.totalrowbytes = 0;
+                }
+                if (this.getBandgapbytes() == NONE) {
+                    this.bandgapbytes = 0;
+                }
+                break;
+        }
+        this.valid = valid;
+    }
+
+    @Override
+    public int getDataType() {
+        if (this.pixeltype != null) {
+            switch (this.pixeltype) {
+                case "signedint":
+                    return BufferManager.TYPE_INT;
+                case "byte_unsigned":
+                    return BufferManager.TYPE_BYTE;
+            }
+        }
+        switch (this.getNbits()) {
+            case 1:
+            case 4:
+            default:
+                return BufferManager.TYPE_UNDEFINED;
+            case 8:
+                return BufferManager.TYPE_BYTE;
+            case 16:
+                return BufferManager.TYPE_USHORT;
+            case 32:
+                return BufferManager.TYPE_INT;
+            case 64:
+                return BufferManager.TYPE_DOUBLE;
+        }
+    }
+
+    @Override
+    public void write(File file) {
+        // TODO: falta implementar el write del hdr
+        File f = this.getFile(file);
+    }
+
+    @Override
+    public Envelope getEnvelope() {
+        Envelope envelope = null;
+        try {
+            if (!Double.isNaN(this.xllcorner)
+                    && !Double.isNaN(this.yllcorner)
+                    && this.cellsize > 0) {
+                envelope = GeometryLocator.getGeometryManager().createEnvelope(
+                        this.xllcorner,
+                        this.yllcorner,
+                        this.xllcorner + (this.ncols * this.cellsize),
+                        this.yllcorner + (this.nrows * this.cellsize),
+                        Geometry.SUBTYPES.GEOM2D);
+            }
+            if (envelope == null && !Double.isNaN(this.ulxmax)
+                    && !Double.isNaN(this.ulymax)
+                    && !Double.isNaN(this.xdim)
+                    && !Double.isNaN(this.ydim)) {
+                envelope = GeometryLocator.getGeometryManager().createEnvelope(
+                        this.ulxmax,
+                        this.ulymax - (this.nrows * this.ydim),
+                        this.ulxmax + (this.ncols * this.xdim),
+                        this.ulymax,
+                        Geometry.SUBTYPES.GEOM2D);
+            }
+            if (envelope == null && !Double.isNaN(this.xdim)
+                    && !Double.isNaN(this.ydim)) {
+                envelope = GeometryLocator.getGeometryManager().createEnvelope(
+                        0,
+                        0,
+                        this.ncols * this.xdim,
+                        this.nrows * this.ydim,
+                        Geometry.SUBTYPES.GEOM2D);
+            }
+            if (envelope == null && this.cellsize > 0) {
+                envelope = GeometryLocator.getGeometryManager().createEnvelope(
+                        0,
+                        0,
+                        this.ncols * this.cellsize,
+                        this.nrows * this.cellsize,
+                        Geometry.SUBTYPES.GEOM2D);
+            }
+            if (envelope == null) {
+                envelope = GeometryLocator.getGeometryManager().createEnvelope(
+                        0,
+                        0,
+                        this.ncols,
+                        this.nrows,
+                        Geometry.SUBTYPES.GEOM2D);
+            }
+        } catch (Exception ex) {
+            logger.debug("Can't calculate envelope.", ex);
+        }
+        return envelope;
+    }
+
+    /**
+     * @return the nrows
+     */
+    @Override
+    public int getNrows() {
+        return nrows;
+    }
+
+    /**
+     * @return the ncols
+     */
+    @Override
+    public int getNcols() {
+        return ncols;
+    }
+
+    /**
+     * @return the nbands
+     */
+    @Override
+    public int getNbands() {
+        return nbands;
+    }
+
+    /**
+     * @return the nbits
+     */
+    @Override
+    public int getNbits() {
+        return nbits;
+    }
+
+    /**
+     * @return the byteorder
+     */
+    @Override
+    public ByteOrder getByteorder() {
+        return byteorder;
+    }
+
+    /**
+     * @return the layout
+     */
+    @Override
+    public String getLayout() {
+        return layout;
+    }
+
+    /**
+     * @return the skipbytes
+     */
+    @Override
+    public int getSkipbytes() {
+        return skipbytes;
+    }
+
+    /**
+     * @return the ulxmax
+     */
+    @Override
+    public double getUlxmax() {
+        return ulxmax;
+    }
+
+    /**
+     * @return the ulymax
+     */
+    @Override
+    public double getUlymax() {
+        return ulymax;
+    }
+
+    /**
+     * @return the xdim
+     */
+    @Override
+    public double getXdim() {
+        return xdim;
+    }
+
+    /**
+     * @return the ydim
+     */
+    @Override
+    public double getYdim() {
+        return ydim;
+    }
+
+    /**
+     * @return the bandrowbytes
+     */
+    @Override
+    public int getBandrowbytes() {
+        return bandrowbytes;
+    }
+
+    /**
+     * @return the totalrowbytes
+     */
+    @Override
+    public int getTotalrowbytes() {
+        return totalrowbytes;
+    }
+
+    /**
+     * @return the bandgapbytes
+     */
+    @Override
+    public int getBandgapbytes() {
+        return bandgapbytes;
+    }
+
+    /**
+     * @return the isValid
+     */
+    @Override
+    public boolean isValid() {
+        return valid;
+    }
+
+    /**
+     * @return the comments
+     */
+    @Override
+    public String getComments() {
+        return comments;
+    }
+
+    /**
+     * @param comments the comments to set
+     */
+    @Override
+    public void setComments(String comments) {
+        this.comments = comments;
+    }
+
+    /**
+     * @return the nodata_value
+     */
+    @Override
+    public double getNodata_value() {
+        return nodata_value;
+    }
+
+    /**
+     * @return the xllcorner
+     */
+    @Override
+    public double getXllcorner() {
+        return xllcorner;
+    }
+
+    /**
+     * @return the yllcorner
+     */
+    @Override
+    public double getYllcorner() {
+        return yllcorner;
+    }
+
+    /**
+     * @return the cellsize
+     */
+    @Override
+    public int getCellsize() {
+        return cellsize;
+    }
+
+    @Override
+    public int getBandSize() {
+        return (this.nrows * this.ncols * this.nbits) + this.bandgapbytes;
+    }
+
+}
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/impl/DefaultSTXFile.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/impl/DefaultSTXFile.java	(revision 0)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/impl/DefaultSTXFile.java	(revision 43867)
@@ -0,0 +1,255 @@
+
+package org.gvsig.fmap.dal.fileutils.impl;
+
+import org.gvsig.fmap.dal.fileutils.STXFile;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.FilenameUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class DefaultSTXFile implements STXFile {
+
+    private static final Logger logger = LoggerFactory.getLogger(DefaultSTXFile.class);
+
+
+    private File source;
+    private List<STXBand> bands;
+    
+    public static class DefaultSTXBand implements STXBand {
+        
+        private int band;
+        private double minimum;
+        private double maximum;
+        private double mean; // Optional
+        private double std_deviation; // Optional
+        private double linear_stretch_min; // Optional
+        private double linear_stretch_max; // Optional
+ 
+        private boolean valid = false;
+        
+        public DefaultSTXBand() {
+            
+        }
+
+        public DefaultSTXBand(
+            int band, 
+            double minimum, 
+            double maximum, 
+            double mean, 
+            double std_deviation, 
+            double linear_stretch_min, 
+            double linear_stretch_max
+            ) {
+            this();
+            this.band = band;
+            this.minimum = minimum;
+            this.maximum = maximum;
+            this.mean = mean;
+            this.std_deviation = std_deviation;
+            this.linear_stretch_min = linear_stretch_min;
+            this.linear_stretch_max = linear_stretch_max;
+        }
+        
+        @SuppressWarnings("OverridableMethodCallInConstructor")
+        public DefaultSTXBand(String line) {
+            this();
+            this.parse(line);
+        }
+       
+        @Override
+        public void parse(String line) {
+            valid = false;
+            String[] words = StringUtils.split(line.trim().toLowerCase());
+            if( words.length < 7 ) {
+                throw new IllegalArgumentException("At least 7 parameters are needed ("+line+").");
+            }
+            this.band = Integer.parseUnsignedInt(words[0]);
+            this.minimum = Double.parseDouble(words[1]);
+            this.maximum = Double.parseDouble(words[2]);
+            if( "#".equals(words[3]) ) {
+                this.mean = Double.NaN;
+            } else {
+                this.mean = Double.parseDouble(words[3]);
+            }
+            if( "#".equals(words[4]) ) {
+                this.std_deviation = Double.NaN;
+            } else {
+                this.std_deviation = Double.parseDouble(words[4]);
+            }
+            if( "#".equals(words[5]) ) {
+                this.linear_stretch_min = Double.NaN;
+            } else {
+                this.linear_stretch_min = Double.parseDouble(words[5]);
+            }
+            if( "#".equals(words[6]) ) {
+                this.linear_stretch_max = Double.NaN;
+            } else {
+                this.linear_stretch_max = Double.parseDouble(words[6]);
+            }
+            valid = true;
+        }
+
+        @Override
+        public String toString() {
+            StringBuilder builder = new StringBuilder();
+            builder.append(this.band).append(" ");
+            builder.append(this.minimum).append(" ");
+            builder.append(this.maximum).append(" ");
+            if( Double.isNaN(this.mean) ) {
+                builder.append("# ");
+            } else {
+                builder.append(this.mean).append(" ");
+            }
+            if( Double.isNaN(this.std_deviation) ) {
+                builder.append("# ");
+            } else {
+                builder.append(this.std_deviation).append(" ");
+            }
+            if( Double.isNaN(this.linear_stretch_min) ) {
+                builder.append("# ");
+            } else {
+                builder.append(this.linear_stretch_min).append(" ");
+            }
+            if( Double.isNaN(this.linear_stretch_max) ) {
+                builder.append("# ");
+            } else {
+                builder.append(this.linear_stretch_max).append(" ");
+            }
+            return builder.toString();
+        }
+        
+        @Override
+        public int getBand() {
+            return band;
+        }
+
+        @Override
+        public double getMinimum() {
+            return minimum;
+        }
+
+        @Override
+        public double getMaximum() {
+            return maximum;
+        }
+
+        @Override
+        public double getMean() {
+            return mean;
+        }
+
+        @Override
+        public double getStdDeviation() {
+            return std_deviation;
+        }
+
+        @Override
+        public double getLinearStretchMin() {
+            return linear_stretch_min;
+        }
+
+        @Override
+        public double getLinearStretchMax() {
+            return linear_stretch_max;
+        }
+
+        @Override
+        public boolean isValid() {
+            return valid;
+        }
+    }
+
+   public DefaultSTXFile() {
+        this.source = null;
+        this.bands = new ArrayList<>();
+    }
+
+    @SuppressWarnings("OverridableMethodCallInConstructor")
+    public DefaultSTXFile(File file) {
+        this();
+        this.read(file);
+    }
+    
+    @Override
+    public File getFile(File file) {
+        File f = new File(FilenameUtils.removeExtension(file.getAbsolutePath())+"."+FILE_EXTENSION);
+        return f;
+    }
+    
+    @Override
+    public File getFile() {
+        return source;
+    }
+
+    @Override
+    public void read(File file) {
+        File f = this.getFile(file);
+        if (f.exists()) {
+            try {
+                this.bands = new ArrayList<>();
+                List<String> lines = FileUtils.readLines(f);
+                if (lines != null) {
+                    this.source = f.getAbsoluteFile();
+                    int lineno = 1;
+                    for (String line : lines) {
+                        try {
+                            DefaultSTXBand band = new DefaultSTXBand(line.trim());
+                            this.bands.add(band);
+                        } catch(IllegalArgumentException e) {
+                            logger.warn("Can't parse line '" + line
+                                    + "' (lineno=+" + lineno
+                                    + ", file=" + f.getAbsoluteFile()
+                                    + ").", e);
+                            
+                        }
+                    }
+                }
+                this.bands = Collections.unmodifiableList(this.bands);
+            } catch (IOException e) {
+                logger.warn("Couldn't read "+FILE_EXTENSION+" file (" + f.getAbsoluteFile() + ")", e);
+            }
+        }
+    }
+
+    @Override
+    public List<STXBand> getBands() {
+        return this.bands;
+    }
+    
+    @Override
+    public void clear() {
+        this.bands = new ArrayList<>();
+    }
+    
+    @Override
+    public void addBand(
+            int band, 
+            double minimum, 
+            double maximum, 
+            double mean, 
+            double std_deviation, 
+            double linear_stretch_min, 
+            double linear_stretch_max
+        ) {
+        DefaultSTXBand b = new DefaultSTXBand(band, minimum, maximum, mean, std_deviation, linear_stretch_min, linear_stretch_max);
+        this.bands.add(b);
+    }
+
+    @Override
+    public void write(File file) throws IOException {
+        File f = this.getFile(file);
+        List<String> lines = new ArrayList<>();
+        for (STXBand band : this.bands) {
+            lines.add(band.toString());
+        }
+        FileUtils.writeLines(f, lines);
+        this.source = f;
+    }
+}
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/impl/DefaultCLRFile.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/impl/DefaultCLRFile.java	(revision 0)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/impl/DefaultCLRFile.java	(revision 43867)
@@ -0,0 +1,117 @@
+package org.gvsig.fmap.dal.fileutils.impl;
+
+import org.gvsig.fmap.dal.fileutils.CLRFile;
+import java.awt.Color;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.FilenameUtils;
+import org.apache.commons.lang3.StringUtils;
+import static org.gvsig.fmap.dal.fileutils.PRJFile.FILE_EXTENSION;
+import org.gvsig.raster.lib.legend.api.RasterLegendLocator;
+import org.gvsig.raster.lib.legend.api.RasterLegendManager;
+import org.gvsig.raster.lib.legend.api.colortable.ColorTable;
+import org.gvsig.raster.lib.legend.api.colortable.colortableclass.ColorTableClass;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DefaultCLRFile implements CLRFile {
+
+    private static final Logger logger = LoggerFactory.getLogger(DefaultCLRFile.class);
+
+    private File source;
+    private ColorTable colorTable;
+
+    public DefaultCLRFile() {
+        this.source = null;
+        this.colorTable = null;
+    }
+
+    @SuppressWarnings("OverridableMethodCallInConstructor")
+    public DefaultCLRFile(File file) {
+        this();
+        this.read(file);
+    }
+
+    @Override
+    public File getFile(File file) {
+        File f = new File(FilenameUtils.removeExtension(file.getAbsolutePath()) + "." + FILE_EXTENSION);
+        return f;
+    }
+
+    @Override
+    public File getFile() {
+        return source;
+    }
+
+    @Override
+    public ColorTable getColorTable() {
+        return this.colorTable;
+    }
+
+    @Override
+    public void setColorTable(ColorTable colorTable) {
+        this.colorTable = colorTable;
+    }
+
+    @Override
+    public void read(File file) {
+        File f = this.getFile(file);
+        if (f.exists()) {
+            try {
+                RasterLegendManager legendManager = RasterLegendLocator.getRasterLegendManager();
+                List<ColorTableClass> colors = new ArrayList<>();
+                List<String> lines = FileUtils.readLines(f);
+                if (lines != null) {
+                    this.source = f.getAbsoluteFile();
+                    int lineno = 1;
+                    double interpolation = 50.0;
+                    for (String line : lines) {
+                        line = line.trim();
+                        if (!Character.isDigit(line.charAt(0))) {
+                            continue;
+                        }
+                        try {
+                            String[] words = StringUtils.split(line);
+                            if (words.length < 4) {
+                                continue;
+                            }
+                            int value = Integer.parseUnsignedInt(words[0]);
+                            int r = Integer.parseUnsignedInt(words[1]);
+                            int g = Integer.parseUnsignedInt(words[2]);
+                            int b = Integer.parseUnsignedInt(words[3]);
+                            Color color = new Color(r, g, b);
+
+                            ColorTableClass colorTableClass = legendManager.createColorTableClass(
+                                    String.valueOf(value), value, interpolation, color);
+
+                            colors.add(colorTableClass);
+                        } catch (Exception e) {
+                            logger.warn("Can't parse line '" + line
+                                    + "' (lineno=+" + lineno
+                                    + ", file=" + f.getAbsoluteFile()
+                                    + ").", e);
+
+                        }
+                    }
+                }
+                if( !colors.isEmpty() ) {
+                    String colorTableName = FilenameUtils.getBaseName(f.getName());
+                    this.colorTable = legendManager.createColorTable(colorTableName, colors, true);
+                }
+            } catch (IOException e) {
+                logger.warn("Couldn't read " + FILE_EXTENSION + " file (" + f.getAbsoluteFile() + ")", e);
+            }
+        }
+
+    }
+
+    @Override
+    public void write(File file) throws IOException {
+        File f = this.getFile(file);
+        // TODO: falta implementar guardar la CLR
+    }
+
+}
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/impl/DefaultWLDFile.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/impl/DefaultWLDFile.java	(revision 0)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/impl/DefaultWLDFile.java	(revision 43867)
@@ -0,0 +1,191 @@
+package org.gvsig.fmap.dal.fileutils.impl;
+
+import org.gvsig.fmap.dal.fileutils.WLDFile;
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.FilenameUtils;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class DefaultWLDFile implements WLDFile {
+    
+    private static final Logger logger = LoggerFactory.getLogger(DefaultWLDFile.class);
+    
+        
+    private File source;
+    
+    private double pixelSizeX;
+    private double rotationAxisY;
+    private double rotationAxisX;
+    private double pixelSizeY;
+    private double upperLeftPixelCenterCoordX;
+    private double upperLeftPixelCenterCoordY;
+
+    public DefaultWLDFile() {
+        this.source = null;
+    }
+    
+    @SuppressWarnings("OverridableMethodCallInConstructor")
+    public DefaultWLDFile(File file) {
+        this();
+        this.read(file);
+    }
+    
+    @Override
+    public File getFile(File file) {
+        File f = new File(FilenameUtils.removeExtension(file.getAbsolutePath())+"."+FILE_EXTENSION);
+        return f;
+    }
+    
+    @Override
+    public File getFile() {
+        return source;
+    }
+
+    @Override
+    public void read(File file) {
+        File f = this.getFile(file);
+        if (f.exists()) {
+            try {
+                List<String> lines = FileUtils.readLines(f);
+                if (lines!=null ) {
+                    this.source = f.getAbsoluteFile();
+                    int lineno = 0;
+                    for (String line : lines) {
+                        line = line.trim();
+                        char ch = line.charAt(0);
+                        if( lineno>5 || Character.isLetter(ch) || ch==';' || ch=='#' ) {
+                            continue;
+                        }
+                        try {
+                            double value = Double.parseDouble(line);
+                            switch(lineno) {
+                                case 0:
+                                    this.pixelSizeX=value;
+                                    break;
+                                case 1:
+                                    this.rotationAxisY = value;
+                                    break;
+                                case 2:
+                                    this.rotationAxisX = value;
+                                    break;
+                                case 3:
+                                    this.pixelSizeY = value;
+                                    break;
+                                case 4:
+                                    this.upperLeftPixelCenterCoordX = value;
+                                    break;
+                                case 5:
+                                    this.upperLeftPixelCenterCoordY = value;
+                                    break;
+                            }
+                            lineno++;
+                        } catch(NumberFormatException e) {
+                            
+                        }
+                    }
+                }
+
+            } catch (IOException e) {
+                logger.warn("Couldn't read "+FILE_EXTENSION+" file ("+f.getAbsolutePath()+").",e);
+            }
+        }
+    }
+
+    @Override
+    public Envelope getEnvelope(int rows, int columns) {
+        Envelope envelope = null;
+        if (0.0 != getRotationAxisX() || 0.0 != getRotationAxisY()) {
+            logger.warn("Rotation in wld file not implemented yet. It will be ignored");
+        }
+
+        double leftMostX = 0;
+        double upperMostY = 0;
+        double height = 0;
+        double width = 0;
+        try {
+            leftMostX = getUpperLeftPixelCenterCoordX() - (getPixelSizeX() * 0.5);
+            upperMostY = getUpperLeftPixelCenterCoordY() - (getPixelSizeY() * 0.5);
+            height=rows*getPixelSizeY();
+            width=columns*getPixelSizeX();
+
+            envelope = GeometryLocator.getGeometryManager().createEnvelope(
+                Math.min(leftMostX,leftMostX + width),
+                Math.min(upperMostY,upperMostY + height),
+                Math.max(leftMostX,leftMostX + width),
+                Math.max(upperMostY,upperMostY + height),
+                Geometry.SUBTYPES.GEOM2D);
+        } catch (Exception e) {
+            logger.warn(
+                "Failed to create envelope from wld file with coords: minx:"+leftMostX+
+                ", miny:"+upperMostY+", maxX: "+leftMostX + width+", maxY: "+upperMostY + height, e);
+        }
+        return envelope;        
+    }
+    
+    @Override
+    public void write(File file) {
+        // TODO: Falta implementar el write del WLDFile
+        File f = this.getFile(file);
+
+    }
+    
+    @Override
+    public void setValue(Envelope envelope, int rows, int columns) {
+        // TODO: Falta implementar el setValue del WLDFile
+    }
+
+    /**
+     * @return the pixelSizeX
+     */
+    @Override
+    public double getPixelSizeX() {
+        return pixelSizeX;
+    }
+
+    /**
+     * @return the rotationAxisY
+     */
+    @Override
+    public double getRotationAxisY() {
+        return rotationAxisY;
+    }
+
+    /**
+     * @return the rotationAxisX
+     */
+    @Override
+    public double getRotationAxisX() {
+        return rotationAxisX;
+    }
+
+    /**
+     * @return the pixelSizeY
+     */
+    @Override
+    public double getPixelSizeY() {
+        return pixelSizeY;
+    }
+
+    /**
+     * @return the upperLeftPixelCenterCoordX
+     */
+    @Override
+    public double getUpperLeftPixelCenterCoordX() {
+        return upperLeftPixelCenterCoordX;
+    }
+
+    /**
+     * @return the upperLeftPixelCenterCoordY
+     */
+    @Override
+    public double getUpperLeftPixelCenterCoordY() {
+        return upperLeftPixelCenterCoordY;
+    }
+}
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/impl/DefaultCPGFile.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/impl/DefaultCPGFile.java	(revision 0)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/impl/DefaultCPGFile.java	(revision 43867)
@@ -0,0 +1,229 @@
+package org.gvsig.fmap.dal.fileutils.impl;
+
+import java.io.File;
+import java.io.IOException;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.FilenameUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.gvsig.fmap.dal.fileutils.CPGFile;
+
+public class DefaultCPGFile implements CPGFile {
+
+    private static final Logger logger = LoggerFactory.getLogger(DefaultPRJFile.class);
+
+
+    private File source;
+    private String charsetName = null;
+
+    /**
+     * Define the valid code pages (equivalent to MSDOS code pages). 
+     * This codes are used on the byte 29 of the DBF header to define the DBF
+     * codepage.
+     *
+     * The equivalences of these charsets using Java NIO charset names are
+     * defined on the {@link #charsetNames} array (so 0x01 is
+     * equivalent to IBM437, 0x02 to IBM850, etc)
+     *
+     * See some other equivalences in:
+     * https://github.com/infused/dbf/blob/master/docs/supported_encodings.csv
+     * https://github.com/olemb/dbfread/blob/master/dbfread/codepages.py
+     * https://joinup.ec.europa.eu/svn/gvsig-desktop/trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/dbf/DbfEncodings.java
+     */
+    private static final short[] codePages = {
+        0x01, 0x02, 0x03, 0x04,
+        0x08, 0x09, 0x0a, 0x0b,
+        0x0d, 0x0e, 0x0f, 0x10,
+        0x11, 0x12, 0x13, 0x14,
+        0x15, 0x16, 0x17, 0x18,
+        0x19, 0x1a, 0x1b, 0x1c,
+        0x1d, 0x1f, 0x22, 0x23,
+        0x24, 0x25, 0x26, 0x37,
+        0x40, 0x4d, 0x4e, 0x4f,
+        0x50, 0x57, 0x58, 0x59,
+        0x64, 0x65, 0x66, 0x67,
+        0x68, 0x69, 0x6a, 0x6b,
+        0x6c, 0x78, 0x79, 0x7a,
+        0x7b, 0x7c, 0x7d, 0x7d,
+        0x86, 0x87, 0x88, 0xc8,
+        0xc9, 0xca, 0xcb, 0xcc};
+
+    /**
+     * Equivalent Java charset names to the code pages defined in
+     * {@link #codePages}, using Java NIO Charset names (which differ
+     * from JAVA IO names, see
+     * https://docs.oracle.com/javase/8/docs/technotes/guides/intl/encoding.doc.html)
+     */
+    private static final String[] charsetNames = new String[]{
+        "IBM437", "IBM850", "windows-1252", "x-MacRoman",
+        "IBM865", "IBM437", "IBM850", "IBM437",
+        "IBM437", "IBM850", "IBM437", "IBM850",
+        "IBM437", "IBM850", "x-IBM943", "IBM850",
+        "IBM437", "IBM850", "IBM865", "IBM437",
+        "IBM437", "IBM850", "IBM437", "IBM863",
+        "IBM850", "IBM852", "IBM852", "IBM852",
+        "IBM860", "IBM850", "IBM866", "IBM850",
+        "IBM852", "x-mswin-936", "x-IBM949", "IBM950",
+        "x-IBM874", "windows-1252", "windows-1252", "windows-1252",
+        "IBM852", "IBM866", "IBM865", "IBM861",
+        // 0x68 and 0x69 are unofficial "Codepage 895 Kamenicky (Czech) MS-DOS" and "Codepage 620  Mazovia (Polish) MS-DOS",
+        // but there is no Java equivalent
+        // so we use CP437 which is the closest charset for the latin characters part
+        "IBM437", "IBM437", "x-IBM737", "IBM857",
+        "IBM863", "x-IBM950", "x-IBM949", "x-mswin-936",
+        "x-IBM942", "x-IBM874", "windows-1255", "windows-1256",
+        "x-IBM737", "IBM852", "IBM857", "windows-1250",
+        "windows-1251", "windows-1254", "windows-1253", "windows-1257"};
+
+    public DefaultCPGFile() {
+        this.charsetName = null;
+        this.source = null;
+    }
+
+    @SuppressWarnings("OverridableMethodCallInConstructor")
+    public DefaultCPGFile(File file) {
+        this();
+        read(file);
+    }
+
+    @Override
+    public File getFile(File file) {
+        File f = new File(FilenameUtils.removeExtension(file.getAbsolutePath()) + "." + FILE_EXTENSION);
+        return f;
+    }
+
+    @Override
+    public File getFile() {
+        return source;
+    }
+
+    @Override
+    public String getCharsetName() {
+        return this.charsetName;
+    }
+
+    @Override
+    public void setCharsetName(String charsetName) {
+        this.charsetName = charsetName;
+    }
+
+    @Override
+    public String toCharsetName(String codePageName) {
+        if (codePageName.equals("UTF8")) {
+            return "UTF-8";
+        }
+        if (codePageName.equals("SJIS")) {
+            return "Shift_JIS";
+        }
+
+        if (StringUtils.isNumeric(codePageName)) {
+            if (codePageName.startsWith("8859") && codePageName.length() > 4) {
+                return "ISO-8859-" + codePageName.substring(4);
+            }
+            if (codePageName.startsWith("125") && codePageName.length() == 4) {
+                return "windows-" + codePageName;
+            }
+            if (codePageName.length() == 3) {
+                return "IBM-" + codePageName;
+            }
+            for (int i = 0; i < charsetNames.length; i++) {
+                if (charsetNames[i].contains(codePageName)) {
+                    return codePageName;
+                }
+            }
+        }
+        if (codePageName.equals("65001")) {
+            return "UTF-8";
+        }
+        return codePageName;
+    }
+
+    /**
+     * Gets the Java NIO charset name equivalent to the provided code page.
+     * Gets null if the provided code page is not recognised
+     * as a valid code
+     *
+     * @param codePage
+     * @return
+     */
+    @Override
+    public String toCharsetName(int codePage) {
+        if (codePage != 0) {
+            for (int i = 0; i < codePages.length; i++) {
+                if (codePages[i] == codePage) {
+                    return charsetNames[i];
+                }
+            }
+        }
+        return null;
+    }
+
+    @Override
+    public String toCPGName(String charsetName) {
+        if (charsetName.startsWith("windows-")
+                || charsetName.startsWith("ISO-8859")
+                || charsetName.startsWith("IBM-")
+                || charsetName.startsWith("x-IBM")
+                || charsetName.startsWith("x-mswin-")) {
+            return charsetName.replaceAll("[^\\d]", "");
+        }
+        if (charsetName.equals("Shift_JIS")) {
+            return "SJIS";
+        }
+        // For the rest of the charsets, we'll directly write the Java NIO Charset
+        // Probably they will only be recognized by gvSIG, but it's better than nothing
+        return charsetName;
+    }
+
+    /**
+     * Returns the code page corresponding to the
+     * provided charset name
+     *
+     * @param charsetName
+     * @return The code page, or 0x00 if no equivalent code page was found for
+     * the provided charsetName
+     */
+    @Override
+    public int toCPG(String charsetName) {
+        for (int i = 0; i < charsetNames.length; i++) {
+            if (charsetNames[i].equals(charsetName)) {
+                return codePages[i];
+            }
+        }
+        // default
+        return 0x00;
+    }
+
+    @Override
+    public void read(File file) {
+        File f = this.getFile(file);
+        if (f.exists()) {
+            try {
+                String theContents = FileUtils.readFileToString(f);
+                theContents = StringUtils.trim(theContents);
+                if (StringUtils.isNotEmpty(theContents)) {
+                    String theCharset = toCharsetName(theContents);
+                    this.charsetName = theCharset;
+                    this.source = f.getAbsoluteFile();
+                }
+            } catch (IOException e) {
+                logger.warn("Couldn't read " + FILE_EXTENSION + " file (" + f.getAbsolutePath() + ").", e);
+            }
+        }
+    }
+
+    @Override
+    public void write(File file) throws IOException {
+        File f = this.getFile(file);
+        try {
+            String export = toCPGName(this.charsetName) + "\n";
+            FileUtils.writeStringToFile(f, export, "ISO-8859-1");
+            this.source = f;
+        } catch (Exception e) {
+            logger.warn("Couldn't write " + FILE_EXTENSION + " file (" + f.getAbsolutePath() + ").", e);
+            throw e;
+        }
+    }
+
+}
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/impl/DefaultPRJFile.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/impl/DefaultPRJFile.java	(revision 0)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/impl/DefaultPRJFile.java	(revision 43867)
@@ -0,0 +1,89 @@
+
+package org.gvsig.fmap.dal.fileutils.impl;
+
+import org.gvsig.fmap.dal.fileutils.PRJFile;
+import java.io.File;
+import java.io.IOException;
+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.gvsig.fmap.crs.CRSFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class DefaultPRJFile implements PRJFile {
+            
+    private static final Logger logger = LoggerFactory.getLogger(DefaultPRJFile.class);
+    
+        
+    private File source;
+    private IProjection crs;
+    
+    public DefaultPRJFile() {
+        this.source = null;
+        this.crs = null;        
+    }
+    
+    @SuppressWarnings("OverridableMethodCallInConstructor")
+    public DefaultPRJFile(File file) {
+        this();
+        this.read(file);
+    }
+    
+    @Override
+    public File getFile(File file) {
+        File f = new File(FilenameUtils.removeExtension(file.getAbsolutePath())+"."+FILE_EXTENSION);
+        return f;
+    }
+    
+    @Override
+    public File getFile() {
+        return source;
+    }
+    
+    @Override
+    public IProjection getCRS() {
+        return this.crs;
+    }
+    
+    @Override
+    public void setCRS(IProjection crs) {
+        this.crs = crs;
+    }
+    
+    @Override
+    public void read(File file) {
+        File f = this.getFile(file);
+        if (f.exists()) {
+            try {
+                String theContents = FileUtils.readFileToString(f);
+                if (StringUtils.isNotEmpty(theContents)){
+                    IProjection theCrs=CRSFactory.getCRSFactory().get(ICRSFactory.FORMAT_WKT_ESRI, theContents);
+                    this.crs = theCrs;
+                    this.source = f.getAbsoluteFile();
+                }
+            } catch (IOException e) {
+                logger.warn("Couldn't read "+FILE_EXTENSION+" file ("+f.getAbsolutePath()+").",e);
+            }
+        }
+            
+    }
+    
+    @Override
+    public void write(File file) throws IOException {
+        File f = this.getFile(file);
+        try {
+            String export = crs.export(ICRSFactory.FORMAT_WKT_ESRI);
+            if(export!=null){
+                FileUtils.writeStringToFile(f, export);
+                this.source = f;
+            }
+        } catch (Exception e) {
+            logger.warn("Couldn't write "+FILE_EXTENSION+" file ("+f.getAbsolutePath()+").",e);
+            throw e;
+        }
+    }
+}
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/pom.xml
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/pom.xml	(revision 0)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/pom.xml	(revision 43867)
@@ -0,0 +1,35 @@
+<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>
+    <parent>
+        <groupId>org.gvsig</groupId>
+        <artifactId>org.gvsig.fmap.dal.file</artifactId>
+        <version>3.0.0-SNAPSHOT</version>
+    </parent>
+    <artifactId>org.gvsig.fmap.dal.file.bsq</artifactId>
+    <name>${project.artifactId}</name>
+    <description>BSQ, Band Sequential Format, provider</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.tools.lib</artifactId>
+            <scope>compile</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.raster.lib.buffer.spi</artifactId>
+            <scope>compile</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.mapcontext.api</artifactId>
+            <scope>compile</scope>
+        </dependency>
+    </dependencies>
+</project>

Property changes on: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq
___________________________________________________________________
Added: svn:ignore
   + target


Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/pom.xml
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/pom.xml	(revision 43866)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/pom.xml	(revision 43867)
@@ -6,6 +6,7 @@
     <artifactId>org.gvsig.fmap.dal.file</artifactId>
     <packaging>pom</packaging>
     <name>${project.artifactId}</name>
+    <description>This library has the implementation of the provider of te Data Access Library for accesing to file resources, like SHP, DBF or CSV.</description>
     <parent>
         <groupId>org.gvsig</groupId>
         <artifactId>org.gvsig.fmap.dal</artifactId>
@@ -41,7 +42,7 @@
         <module>org.gvsig.fmap.dal.file.png</module>
         <module>org.gvsig.fmap.dal.file.tiff</module>
         <module>org.gvsig.fmap.dal.file.jp2</module>
+        <module>org.gvsig.fmap.dal.file.bsq</module>
     </modules>
-    <description>This library has the implementation of the provider of te Data Access Library for accesing to file resources, like SHP, DBF or CSV.</description>
 </project>
 
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.tiff/src/main/java/org/gvsig/fmap/dal/file/tiff/TiffLibrary.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.tiff/src/main/java/org/gvsig/fmap/dal/file/tiff/TiffLibrary.java	(revision 43866)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.tiff/src/main/java/org/gvsig/fmap/dal/file/tiff/TiffLibrary.java	(revision 43867)
@@ -98,7 +98,8 @@
                     new ImageIOFileSystemServerProviderFactory(
                             NAME,
                             DESCRIPTION,
-                            FILE_EXTENSIONS
+                            FILE_EXTENSIONS,
+                            true
                     )
             );
         } catch (Exception e) {

Property changes on: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.tiff
___________________________________________________________________
Added: svn:ignore
   + target


Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.imageio/src/main/java/org/gvsig/fmap/dal/file/imageio/ImageIOFileSystemServerProviderFactory.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.imageio/src/main/java/org/gvsig/fmap/dal/file/imageio/ImageIOFileSystemServerProviderFactory.java	(revision 43866)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.imageio/src/main/java/org/gvsig/fmap/dal/file/imageio/ImageIOFileSystemServerProviderFactory.java	(revision 43867)
@@ -32,14 +32,25 @@
 public class ImageIOFileSystemServerProviderFactory extends AbstractFilesystemServerExplorerProviderFactory {
 
     protected String[] fileExtensions;
+    protected boolean canCreate;
 
     public ImageIOFileSystemServerProviderFactory(
             String name, 
             String description, 
             String[] fileExtensions
         ) {
+        this(name, description, fileExtensions, false);
+    }
+
+    public ImageIOFileSystemServerProviderFactory(
+            String name, 
+            String description, 
+            String[] fileExtensions,
+            boolean canCreate
+        ) {
         super(name, description);
         this.fileExtensions = fileExtensions;
+        this.canCreate = canCreate;
     }
 
     @Override
@@ -47,7 +58,8 @@
         return new ImageIOFileSystemServerProvider(
                 this.getName(),
                 this.getDescription(),
-                this.fileExtensions
+                this.fileExtensions,
+                this.canCreate
         );
     }
 
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.imageio/src/main/java/org/gvsig/fmap/dal/file/imageio/ImageIOFileSystemServerProvider.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.imageio/src/main/java/org/gvsig/fmap/dal/file/imageio/ImageIOFileSystemServerProvider.java	(revision 43866)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.imageio/src/main/java/org/gvsig/fmap/dal/file/imageio/ImageIOFileSystemServerProvider.java	(revision 43867)
@@ -22,30 +22,139 @@
  */
 package org.gvsig.fmap.dal.file.imageio;
 
+import java.awt.image.BufferedImage;
 import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.imageio.IIOImage;
+import javax.imageio.ImageIO;
+import javax.imageio.ImageWriteParam;
+import javax.imageio.ImageWriter;
 
 import org.apache.commons.io.FilenameUtils;
+import org.apache.commons.io.IOUtils;
 
 import org.gvsig.fmap.dal.DataServerExplorer;
+import org.gvsig.fmap.dal.NewDataStoreParameters;
+import org.gvsig.fmap.dal.exception.CreateException;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.raster.api.NewRasterStoreParameters;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemStoreParameters;
 import org.gvsig.fmap.dal.serverexplorer.filesystem.impl.AbstractFilesystemServerExplorerProvider;
 import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProviderServices;
+import org.gvsig.raster.lib.buffer.api.Buffer;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dataTypes.DataTypesManager;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynField_v2;
 
 public class ImageIOFileSystemServerProvider extends AbstractFilesystemServerExplorerProvider {
 
     protected FilesystemServerExplorerProviderServices serverExplorer;
 
     protected String[] fileExtensions;
+    protected boolean canCreate;
 
     public ImageIOFileSystemServerProvider(
             String name, 
             String description, 
             String[] fileExtensions
         ) {
+        this(name, description, fileExtensions, false);
+    }
+    
+    public ImageIOFileSystemServerProvider(
+            String name, 
+            String description, 
+            String[] fileExtensions,
+            boolean canCreate
+        ) {
         super(name, description);
         this.fileExtensions = fileExtensions;
+        this.canCreate = canCreate;
     }
     
     @Override
+    public boolean canCreate() {
+        return canCreate;
+    }
+
+    @Override
+    public NewDataStoreParameters getCreateParameters() throws DataException {
+        if( !this.canCreate() ) {
+           throw new UnsupportedOperationException();
+        }
+        return null ; // TODO: Falta la creacion de los parametros 
+    }
+
+    @Override
+    public void create(NewDataStoreParameters parameters, boolean overwrite) throws CreateException {
+        if( !this.canCreate() ) {
+           throw new UnsupportedOperationException();
+        }
+        File output = ((FilesystemStoreParameters)parameters).getFile();
+        if( output==null ) {
+            throw new IllegalArgumentException("Parameter 'file' can't be null.");
+        }
+        Buffer buffer = ((NewRasterStoreParameters)parameters).getBuffer();
+        if( buffer==null ) {
+            throw new IllegalArgumentException("Parameter 'buffer' can't be null.");
+        }
+        BufferedImage image = buffer.getBufferedImage();
+        try {
+            ImageIO.write(image, this.getName(), output);
+        } catch (IOException ex) {
+            throw new CreateException(output.getAbsolutePath(), ex);
+        }
+        
+//        DataTypesManager dtm = ToolsLocator.getDataTypesManager();
+//        ImageWriter writer = getImageWriter();
+//        ImageWriteParam writerParams = writer.getDefaultWriteParam();
+//        Class<? extends ImageWriteParam> writerParamsClass = writerParams.getClass();
+//        for( DynField field : parameters.getDynClass().getDynFields() ) {
+//            DynField_v2 field2 = (DynField_v2) field;
+//            try {
+//                String methodName = (String) field2.getTags().get(
+//                    "ImageWriteParam", 
+//                    DataTypes.STRING
+//                );
+//                if( methodName!=null ) {
+//                    Method setter = writerParamsClass.getMethod(
+//                        methodName, 
+//                        dtm.getDefaultClass(field.getType())
+//                    );
+//                    setter.invoke(
+//                        writerParams, 
+//                        parameters.getDynValue(field.getName())
+//                    );
+//                }
+//            } catch (Exception ex) {
+//            }
+//        }
+//        FileOutputStream fos = null;
+//        try {
+//            fos = new FileOutputStream(output);
+//            writer.setOutput(fos);
+//            writer.write(null, new IIOImage(image, null, null), writerParams);
+//        } catch (Exception ex) {
+//            throw new CreateException(output.getAbsolutePath(), ex);
+//        } finally {
+//            IOUtils.closeQuietly(fos);
+//        }
+        
+    }
+    
+//    private ImageWriter getImageWriter() {
+//        return null;
+//    }
+    
+    @Override
     public int getMode() {
         return DataServerExplorer.MODE_RASTER;
     }

Property changes on: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.imageio
___________________________________________________________________
Added: svn:ignore
   + target



Property changes on: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.jp2
___________________________________________________________________
Added: svn:ignore
   + target


Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.impl/src/main/java/org/gvsig/raster/lib/legend/impl/DefaultRasterLegend.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.impl/src/main/java/org/gvsig/raster/lib/legend/impl/DefaultRasterLegend.java	(revision 43866)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.impl/src/main/java/org/gvsig/raster/lib/legend/impl/DefaultRasterLegend.java	(revision 43867)
@@ -134,6 +134,7 @@
      * @param filters
      *            Filters of legend
      */
+    @SuppressWarnings("OverridableMethodCallInConstructor")
     public DefaultRasterLegend(ColorInterpretation colorInterpretation,
         Transparency transparency, OperationList filters) {
         this.transparency = transparency;
@@ -291,7 +292,7 @@
                     getFilters().setDefaultParameters(defaultParameters);
 
                     Object oColorInterpretation = null;
-                    filteredBuffer = getFilters().execute(null, bufferToDraw);
+                    filteredBuffer = getFilters().execute(taskStatus, bufferToDraw);
                     oColorInterpretation = getFilters().getParameterValue(ColoredOperation.OUTPUT_COLOR_INTERPRETATION_PARAM);
                     ColorInterpretation colorInterpretationAfterFilters = null;
                     if (oColorInterpretation != null) {
@@ -309,7 +310,7 @@
 //                        colorTableOperationParameters.setDynValue(ColoredOperation.COPY_UNPROCESSED_BANDS_PARAM,
 //                            true);
                         Buffer rgbBuffer =
-                            operationManager.execute(null, ColoredOperation.COLOR_TABLE_OPERATION_NAME, filteredBuffer,
+                            operationManager.execute(taskStatus, ColoredOperation.COLOR_TABLE_OPERATION_NAME, filteredBuffer,
                                 colorTableOperationParameters);
                         image =
                             drawRGBBuffer(graphics, rgbBuffer,
@@ -373,7 +374,7 @@
 //                        // Draw YCBCR buffer without color table
 //                        image = drawYCBCRBuffer(graphics, bufferToDraw, colorInterpretation, transparency, filters);
                     }
-                } catch (BufferOperationException e) {
+                } catch (Exception e) {
                     LOG.warn("Error drawing legend", e);
                     taskStatus.abort();
                     return;
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.impl/src/main/java/org/gvsig/fmap/mapcontext/raster/impl/DefaultRasterLayer.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.impl/src/main/java/org/gvsig/fmap/mapcontext/raster/impl/DefaultRasterLayer.java	(revision 43866)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.impl/src/main/java/org/gvsig/fmap/mapcontext/raster/impl/DefaultRasterLayer.java	(revision 43867)
@@ -32,6 +32,8 @@
 import java.util.Observer;
 import java.util.Set;
 import java.util.TreeSet;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import org.cresques.cts.ICoordTrans;
 import org.slf4j.LoggerFactory;
@@ -39,6 +41,7 @@
 import org.gvsig.compat.print.PrintAttributes;
 import org.gvsig.fmap.dal.DataStore;
 import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.InitializeException;
 import org.gvsig.fmap.dal.exception.ReadException;
 import org.gvsig.fmap.dal.raster.api.BandAttributeDescriptor;
 import org.gvsig.fmap.dal.raster.api.BandDescriptor;
@@ -67,6 +70,7 @@
 import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendClearEvent;
 import org.gvsig.fmap.mapcontext.rendering.legend.events.SymbolLegendEvent;
 import org.gvsig.metadata.exceptions.MetadataException;
+import org.gvsig.raster.lib.buffer.api.BufferDimensions;
 import org.gvsig.raster.lib.buffer.api.BufferLocator;
 import org.gvsig.raster.lib.buffer.api.statistics.Statistics;
 import org.gvsig.raster.lib.legend.api.RasterLegend;
@@ -292,21 +296,29 @@
         rasterQuery.setClip(reprojectedViewPortEnvelope);
 
         RasterSet rasterSet = null;
+        SimpleTaskStatus taskStatus = null;
         try {
 
             long tini = System.currentTimeMillis();
 
             // TODO Task status should be used to cancel
             TaskStatusManager manager = ToolsLocator.getTaskStatusManager();
-            final SimpleTaskStatus taskStatus = manager.createDefaultSimpleTaskStatus("Draw " + getDataStore().getName());
+            taskStatus = manager.createDefaultSimpleTaskStatus("Draw " + getDataStore().getName());
+            taskStatus.setAutoremove(true);
+            taskStatus.add();
             rasterSet = getRasterStore().getRasterSet(rasterQuery);
             if (!rasterSet.isEmpty()) {
                 getLegend().draw(g, rasterSet, viewPort, taskStatus);
                 logger.debug("Layer " + this.getName() + " drawn in " + (System.currentTimeMillis() - tini)
                     + " milliseconds.");
             }
+            
 
         } catch (DataException e) {
+            if( taskStatus!=null ) {
+                taskStatus.abort();
+                taskStatus = null;
+            }
             this.setAvailable(false);
             this.setError(e);
             throw new ReadException(getName(), e);
@@ -315,6 +327,10 @@
                 DisposeUtils.dispose(rasterSet);
                 rasterSet = null;
             }
+            if( taskStatus!=null ) {
+                taskStatus.terminate();
+                taskStatus = null;
+            }
         }
 
     }
@@ -441,6 +457,16 @@
         } catch (LocatorException | DataException | CreateEnvelopeException e) {
         }
         int bands = rasterStore.getBands();
+        int rows = -1;
+        int columns = -1;
+        String pixelSize = "-/-";
+        try {
+            BufferDimensions dimensions = rasterStore.getDimensions();
+            rows = dimensions.getRows();
+            columns = dimensions.getColumns();
+            pixelSize = String.format("%.3f/%.3f", dimensions.getPixelSizeX(), dimensions.getPixelSizeY());
+        } catch (InitializeException ex) {
+        }
         I18nManager i18nManager = ToolsLocator.getI18nManager();
         LayerInformationBuilder builder = MapContextLocator.getMapContextManager().createLayerInformationBuilder();
 
@@ -455,6 +481,9 @@
         }
 
         builder.property().labelkey("_bands").value("%d", bands);
+        builder.property().labelkey("_rows").value("%d", rows);
+        builder.property().labelkey("_columns").value("%d", columns);
+        builder.property().labelkey("_pixel_size").value("%s", pixelSize);
         builder.property().labelkey("transparency").value("%d", this.getTransparency());
 
         builder.title().labelkey("_Coordenadas_geograficas");
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.bsq.app/org.gvsig.bsq.app.mainplugin/src/main/assembly/gvsig-plugin-package.xml
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.bsq.app/org.gvsig.bsq.app.mainplugin/src/main/assembly/gvsig-plugin-package.xml	(revision 0)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.bsq.app/org.gvsig.bsq.app.mainplugin/src/main/assembly/gvsig-plugin-package.xml	(revision 43867)
@@ -0,0 +1,63 @@
+<!--
+
+    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.fmap.dal.file.bsq</include>
+      </includes>
+    </dependencySet>
+  </dependencySets>
+
+</assembly>
+
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.bsq.app/org.gvsig.bsq.app.mainplugin/src/main/java/org/gvsig/bsq/app/BSQExtension.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.bsq.app/org.gvsig.bsq.app.mainplugin/src/main/java/org/gvsig/bsq/app/BSQExtension.java	(revision 0)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.bsq.app/org.gvsig.bsq.app.mainplugin/src/main/java/org/gvsig/bsq/app/BSQExtension.java	(revision 43867)
@@ -0,0 +1,31 @@
+
+package org.gvsig.bsq.app;
+
+import org.gvsig.andami.plugins.Extension;
+
+
+public class BSQExtension extends Extension {
+
+    @Override
+    public void initialize() {
+//        DynClass metadataDefinition = BSQLibrary.getMatadataDefinition();
+//        BSQGetLegend.register(metadataDefinition);
+//        BSQGetColorInterpretation.register(metadataDefinition); 
+//        BSQGetColorTable.register(metadataDefinition); 
+    }
+
+    @Override
+    public void execute(String actionCommand) {
+    }
+
+    @Override
+    public boolean isEnabled() {
+        return false;
+    }
+
+    @Override
+    public boolean isVisible() {
+        return false;
+    }
+    
+}
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.bsq.app/org.gvsig.bsq.app.mainplugin/src/main/resources-plugin/config.xml
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.bsq.app/org.gvsig.bsq.app.mainplugin/src/main/resources-plugin/config.xml	(revision 0)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.bsq.app/org.gvsig.bsq.app.mainplugin/src/main/resources-plugin/config.xml	(revision 43867)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+    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.
+
+-->
+<plugin-config>
+  <depends plugin-name="org.gvsig.app.mainplugin" />
+  <libraries library-dir="lib"/>
+  <resourceBundle name="text"/>
+  <extensions>
+    <extension class-name="org.gvsig.bsq.app.BSQExtension"
+      description=""
+      active="true">
+    </extension>
+  </extensions>
+
+</plugin-config>
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.bsq.app/org.gvsig.bsq.app.mainplugin/pom.xml
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.bsq.app/org.gvsig.bsq.app.mainplugin/pom.xml	(revision 0)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.bsq.app/org.gvsig.bsq.app.mainplugin/pom.xml	(revision 43867)
@@ -0,0 +1,35 @@
+<?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.bsq.app.mainplugin</artifactId>
+    <packaging>jar</packaging>
+    <name>${project.artifactId}</name>
+    <description>BSQ file format support</description>
+    <parent>
+        <groupId>org.gvsig</groupId>
+        <artifactId>org.gvsig.bsq.app</artifactId>
+        <version>3.0.0-SNAPSHOT</version>
+    </parent>
+    <dependencies>
+
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.fmap.dal.file.bsq</artifactId>
+            <scope>compile</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.andami</artifactId>
+            <scope>compile</scope>
+        </dependency>
+    </dependencies>
+
+    <properties>
+        <gvsig.package.info.name>Formats: BSQ raster file format support</gvsig.package.info.name>
+        <gvsig.package.info.categories>Formats,Raster</gvsig.package.info.categories>
+        <gvsig.package.info.official>true</gvsig.package.info.official>
+    </properties>
+
+</project>
+
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.bsq.app/org.gvsig.bsq.app.mainplugin/buildNumber.properties
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.bsq.app/org.gvsig.bsq.app.mainplugin/buildNumber.properties	(revision 0)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.bsq.app/org.gvsig.bsq.app.mainplugin/buildNumber.properties	(revision 43867)
@@ -0,0 +1,2 @@
+#Tue Feb 20 10:20:55 CET 2018
+buildNumber=3000
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.bsq.app/pom.xml
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.bsq.app/pom.xml	(revision 0)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.bsq.app/pom.xml	(revision 43867)
@@ -0,0 +1,17 @@
+<?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/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>org.gvsig.bsq.app</artifactId>
+    <name>${project.artifactId}</name>
+    <packaging>pom</packaging>
+    <parent>
+        <groupId>org.gvsig</groupId>
+        <artifactId>org.gvsig.desktop.plugin</artifactId>
+        <version>3.0.0-SNAPSHOT</version>
+    </parent>
+  
+    <modules>
+        <module>org.gvsig.bsq.app.mainplugin</module>
+    </modules>
+</project>
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.mainplugin/src/main/java/org/gvsig/raster/tools/app/mainplugin/SaveRasterLayerExtension.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.mainplugin/src/main/java/org/gvsig/raster/tools/app/mainplugin/SaveRasterLayerExtension.java	(revision 43866)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.mainplugin/src/main/java/org/gvsig/raster/tools/app/mainplugin/SaveRasterLayerExtension.java	(revision 43867)
@@ -69,7 +69,7 @@
                     if (buffer != null) {
                         Buffer filteredBuffer = null;
                         try {
-                            filteredBuffer = filters.execute(buffer);
+                            filteredBuffer = filters.execute(null,buffer);
                             RasterSwingBufferManager rasterSwingBufferManager =
                                 RasterSwingBufferLocator.getSwingManager();
                             SaveBufferDialog saveBufferDialog = rasterSwingBufferManager.createSaveBufferDialog();
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.raster.app/org.gvsig.raster.app.mainplugin/src/main/java/org/gvsig/raster/app/mainplugin/StatisticsPage.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.raster.app/org.gvsig.raster.app.mainplugin/src/main/java/org/gvsig/raster/app/mainplugin/StatisticsPage.java	(revision 43866)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.raster.app/org.gvsig.raster.app.mainplugin/src/main/java/org/gvsig/raster/app/mainplugin/StatisticsPage.java	(revision 43867)
@@ -91,7 +91,8 @@
                     updateStatisticsPanel();
                 }
             });
-            panel.set(this.layer.getStatistics(null));
+            updateStatisticsPanel();
+//            panel.set(this.layer.getStatistics(null));
 
             panel.addActionListener(new ActionListener() {
 
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/pom.xml
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/pom.xml	(revision 43866)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/pom.xml	(revision 43867)
@@ -58,6 +58,7 @@
         <module>org.gvsig.png.app</module>
         <module>org.gvsig.tiff.app</module>
         <module>org.gvsig.jp2.app</module>
+        <module>org.gvsig.bsq.app</module>
     </modules>
 
 </project>

Property changes on: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.tiff.app/org.gvsig.tiff.app.mainplugin
___________________________________________________________________
Added: svn:ignore
   + target



Property changes on: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.jp2.app/org.gvsig.jp2.app.mainplugin
___________________________________________________________________
Added: svn:ignore
   + target


Index: branches/org.gvsig.desktop-2018a/pom.xml
===================================================================
--- branches/org.gvsig.desktop-2018a/pom.xml	(revision 43866)
+++ branches/org.gvsig.desktop-2018a/pom.xml	(revision 43867)
@@ -1252,6 +1252,11 @@
                 <artifactId>org.gvsig.fmap.dal.file.tiff</artifactId>
                 <version>3.0.0-SNAPSHOT</version>
             </dependency>
+            <dependency>
+                <groupId>org.gvsig</groupId>
+                <artifactId>org.gvsig.fmap.dal.file.bsq</artifactId>
+                <version>3.0.0-SNAPSHOT</version>
+            </dependency>
 
             <dependency>
                 <groupId>org.gvsig</groupId>
@@ -2764,7 +2769,7 @@
 
         <jython.artifactId>jython-standalone</jython.artifactId>
         <!-- External project versions -->
-        <gvsig.tools.version>3.0.153</gvsig.tools.version>
+        <gvsig.tools.version>3.0.154</gvsig.tools.version>
         <gvsig.proj.version>1.0.4</gvsig.proj.version>
         <gvsig.projection.api.version>2.0.25</gvsig.projection.api.version>
 

Property changes on: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster.legend/org.gvsig.raster.legend.imageio
___________________________________________________________________
Added: svn:ignore
   + target


Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.impl/src/main/java/org/gvsig/raster/lib/buffer/impl/statistics/DefaultStatistics.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.impl/src/main/java/org/gvsig/raster/lib/buffer/impl/statistics/DefaultStatistics.java	(revision 43866)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.impl/src/main/java/org/gvsig/raster/lib/buffer/impl/statistics/DefaultStatistics.java	(revision 43867)
@@ -27,7 +27,6 @@
     double[][] varCov;
 
     /**
-     * @param bands
      *
      */
     public DefaultStatistics() {
@@ -167,13 +166,13 @@
         }
         init(bands);
         try {
-            status.setRangeOfValues(0, statisticsBands.length * 3);
+            status.setIndeterminate();
             status.message("Calculating statistics");
-            long cont = 0;
-
+            int count = 1;
+            int maxCount = statisticsBands.length*3;
             for (int i = 0; i < statisticsBands.length; i++) {
-                status.setCurValue(cont++);
-                if (status.isCancelled()) {
+                status.message("Calculating statistics "+count++ +"/"+maxCount);
+               if (status.isCancelled()) {
                     status.abort();
                     return;
                 }
@@ -182,18 +181,18 @@
                 }
             }
             for (int i = 0; i < statisticsBands.length; i++) {
-                status.setCurValue(cont++);
+                status.message("Calculating statistics "+count++ +"/"+maxCount);
                 if (status.isCancelled()) {
                     status.abort();
                     return;
                 }
                 for (int j = i; j < statisticsBands.length; j++) {
-                    this.varCov[i][j] = getCovariance(statisticsBands[i],bands.get(i), statisticsBands[j], bands.get(j));
+                    this.varCov[i][j] = getCovariance(status,statisticsBands[i],bands.get(i), statisticsBands[j], bands.get(j));
                 }
             }
-
+            status.setIndeterminate();
             for (int i = 0; i < statisticsBands.length; i++) {
-                status.setCurValue(cont++);
+                status.message("Calculating statistics "+count++ +"/"+maxCount);
                 if (status.isCancelled()) {
                     status.abort();
                     return;
@@ -214,12 +213,14 @@
         }
     }
 
-    private double getCovariance(StatisticsBand statisticBand1, Band band1, StatisticsBand statisticBand2, Band band2) {
+    private double getCovariance(SimpleTaskStatus  status, StatisticsBand statisticBand1, Band band1, StatisticsBand statisticBand2, Band band2) {
 
         double sigma = 0;
         int n = 0;
-
-        for (int row = 0; row < band1.getRows(); row++) {
+        int rowCount = band1.getRows();
+        status.setRangeOfValues(0, rowCount);
+        for (int row = 0; row < rowCount; row++) {
+            status.setCurValue(row);
             for (int column = 0; column < band1.getColumns(); column++) {
                 Double v1 = band1.getAsDouble(row, column);
                 if (v1 != null) {
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.impl/src/main/java/org/gvsig/raster/lib/buffer/impl/statistics/DefaultStatisticsBand.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.impl/src/main/java/org/gvsig/raster/lib/buffer/impl/statistics/DefaultStatisticsBand.java	(revision 43866)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.impl/src/main/java/org/gvsig/raster/lib/buffer/impl/statistics/DefaultStatisticsBand.java	(revision 43867)
@@ -57,6 +57,7 @@
         if (status == null) {
             status = ToolsLocator.getTaskStatusManager().createDefaultSimpleTaskStatus("Statistics");
             status.add();
+            status.message("Calculating statistics band");
             isMyStatus = true;
         } else {
             status.push();
@@ -64,7 +65,6 @@
         try {
             calculated = false;
             status.setRangeOfValues(0, band.getRows() * 2);
-            status.message("Calculating statistics band");
             long cont = 0;
 
             this.bandLenght = band.getRows() * band.getColumns();
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.impl/src/main/java/org/gvsig/raster/lib/buffer/impl/AbstractPaginatedBand.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.impl/src/main/java/org/gvsig/raster/lib/buffer/impl/AbstractPaginatedBand.java	(revision 43866)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.impl/src/main/java/org/gvsig/raster/lib/buffer/impl/AbstractPaginatedBand.java	(revision 43867)
@@ -30,7 +30,8 @@
     protected BandPageManager pageManager;
     private boolean loaded;
 
-    protected static final int MAX_PREFERED_SIZE = 10485760; // 10MB;
+    // protected static final int MAX_PREFERED_SIZE = 10485760; // 10MB;
+    protected static final int MAX_PREFERED_SIZE = 2621440; // 2.5MB;
 
     /**
      * @param rows
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.impl/src/main/java/org/gvsig/raster/lib/buffer/impl/DefaultBufferManager.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.impl/src/main/java/org/gvsig/raster/lib/buffer/impl/DefaultBufferManager.java	(revision 43866)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.impl/src/main/java/org/gvsig/raster/lib/buffer/impl/DefaultBufferManager.java	(revision 43867)
@@ -55,7 +55,7 @@
 import org.gvsig.tools.dynobject.DynObject;
 import org.gvsig.tools.folders.FoldersManager;
 import org.gvsig.tools.locator.LocatorException;
-import org.gvsig.tools.task.TaskStatus;
+import org.gvsig.tools.task.SimpleTaskStatus;
 
 /**
  * @author fdiaz
@@ -655,7 +655,7 @@
     }
 
     @Override
-    public Buffer execute(TaskStatus status, String name, Buffer buffer, DynObject parameters) throws BufferOperationException {
+    public Buffer execute(SimpleTaskStatus status, String name, Buffer buffer, DynObject parameters) throws BufferOperationException {
         OperationFactory factory = getOperationFactory(name);
         Operation operation = factory.create();
         return operation.execute(status, buffer, parameters);
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.impl/src/main/java/org/gvsig/raster/lib/buffer/impl/BufferInterpolation.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.impl/src/main/java/org/gvsig/raster/lib/buffer/impl/BufferInterpolation.java	(revision 43866)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.impl/src/main/java/org/gvsig/raster/lib/buffer/impl/BufferInterpolation.java	(revision 43867)
@@ -194,6 +194,7 @@
         } else {
             status.push();
         }
+        status.add();
         try {
             int rows = target.getRows();
             int columns = target.getColumns();
@@ -201,25 +202,25 @@
             double pxSizeX = (double) source.getColumns() / (double) columns;
             double pxSizeY = (double) source.getRows() / (double) rows;
 
-            status.setRangeOfValues(0, source.getBandCount() * source.getRows() * source.getColumns());
-            status.message("Calculating interpolation");
-            int count = 0;
             double posX, posY;
             double dx = 0D, dy = 0D;
-
-            for (int iBand = 0; iBand < source.getBandCount(); iBand++) {
+            int bandCount = source.getBandCount();
+            for (int iBand = 0; iBand < bandCount; iBand++) {
+                status.setRangeOfValues(0, source.getRows());
+                status.message("Interpolating, band "+iBand+"/"+ bandCount);
+                status.setCurValue(0);
                 posY = pxSizeY / 2D;
                 Band sourceBand = source.getBand(iBand);
                 Band targetBand = target.getBand(iBand);
                 for (int iRow = 0; iRow < rows; iRow++) {
+                    status.setCurValue(iRow);
+                    if (status.isCancelled()) {
+                        status.abort();
+                        return;
+                    }
                     dy = posY - ((int) posY);
                     posX = pxSizeX / 2D;
                     for (int iCol = 0; iCol < columns; iCol++) {
-                        status.setCurValue(count++);
-                        if (status.isCancelled()) {
-                            status.abort();
-                            return;
-                        }
                         dx = posX - ((int) posX);
                         try {
                             double[] kernel = getKernel((int) posY, (int) posX, sourceBand);
@@ -245,7 +246,6 @@
             status.abort();
             throw e;
         }
-        return;
     }
 
     /**
@@ -374,7 +374,7 @@
             double pxSizeX = (double) source.getColumns() / (double) columns;
             double pxSizeY = (double) source.getRows() / (double) rows;
 
-            status.setRangeOfValues(0, source.getBandCount() * source.getRows() * source.getColumns());
+            status.setRangeOfValues(0, source.getRows()*source.getBandCount());
             status.message("Calculating interpolation");
             int count = 0;
             double posX, posY;
@@ -385,14 +385,14 @@
                 Band sourceBand = source.getBand(iBand);
                 Band targetBand = target.getBand(iBand);
                 for (int iRow = 0; iRow < rows; iRow++) {
+                    status.setCurValue(count++);
+                    if (status.isCancelled()) {
+                        status.abort();
+                        return;
+                    }
                     dy = posY - ((int) posY);
                     posX = pxSizeX / 2D;
                     for (int iCol = 0; iCol < columns; iCol++) {
-                        status.setCurValue(count++);
-                        if (status.isCancelled()) {
-                            status.abort();
-                            return;
-                        }
                         dx = posX - ((int) posX);
                         try {
                             double[][] submatrix = get4x4Submatrix(((int) posY), ((int) posX), source, sourceBand);
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.impl/src/main/java/org/gvsig/raster/lib/buffer/impl/operations/linearstretchenhancement/LinearStretchEnhancementOperation.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.impl/src/main/java/org/gvsig/raster/lib/buffer/impl/operations/linearstretchenhancement/LinearStretchEnhancementOperation.java	(revision 43866)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.impl/src/main/java/org/gvsig/raster/lib/buffer/impl/operations/linearstretchenhancement/LinearStretchEnhancementOperation.java	(revision 43867)
@@ -140,12 +140,19 @@
     @Override
     public void process() throws ProcessingOperationException {
         super.process();
-        for (int band=0; band<this.getInputBuffer().getBandCount(); band++){
+        int bandCount = this.getInputBuffer().getBandCount();
+        int rowCount = this.getInputBuffer().getRows();
+        for (int band=0; band<bandCount; band++){
             if (this.getBandsToProcess().contains(band)) {
+                this.getTaskStatus().setRangeOfValues(0, rowCount);
+                this.getTaskStatus().setCurValue(0);
+                this.getTaskStatus().message("LinearStretch band "+band+"/"+bandCount);
+
                 Band bufferBand = this.getInputBuffer().getBand(band);
                 Band outputBufferBand = this.getOutputBuffer().getBand(band);
 
-                for (int row = 0; row < this.getInputBuffer().getRows(); row++) {
+                for (int row = 0; row < rowCount; row++) {
+                    this.getTaskStatus().setCurValue(row);
                     Object rowBuffer = bufferBand.createRowBuffer();
                     bufferBand.fetchRow(row, rowBuffer);
 
@@ -164,6 +171,7 @@
                 }
             }
         }
+        this.getTaskStatus().terminate();
     }
 
     @Override
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.impl/src/main/java/org/gvsig/raster/lib/buffer/impl/operations/DefaultOperationList.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.impl/src/main/java/org/gvsig/raster/lib/buffer/impl/operations/DefaultOperationList.java	(revision 43866)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.impl/src/main/java/org/gvsig/raster/lib/buffer/impl/operations/DefaultOperationList.java	(revision 43867)
@@ -57,7 +57,7 @@
 import org.gvsig.tools.persistence.PersistenceManager;
 import org.gvsig.tools.persistence.PersistentState;
 import org.gvsig.tools.persistence.exception.PersistenceException;
-import org.gvsig.tools.task.TaskStatus;
+import org.gvsig.tools.task.SimpleTaskStatus;
 
 
 /**
@@ -249,7 +249,7 @@
     }
 
     @Override
-    public Buffer execute(TaskStatus status, Buffer buffer) throws BufferOperationException {
+    public Buffer execute(SimpleTaskStatus status, Buffer buffer) throws BufferOperationException {
         Buffer tmpBuffer1 = buffer;
         DisposeUtils.bind(tmpBuffer1);
         Buffer tmpBuffer2;
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.api/src/main/java/org/gvsig/raster/lib/buffer/api/OperationManager.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.api/src/main/java/org/gvsig/raster/lib/buffer/api/OperationManager.java	(revision 43866)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.api/src/main/java/org/gvsig/raster/lib/buffer/api/OperationManager.java	(revision 43867)
@@ -30,7 +30,7 @@
 import org.gvsig.raster.lib.buffer.api.operations.OperationList;
 import org.gvsig.raster.lib.buffer.api.operations.OperationListEntry;
 import org.gvsig.tools.dynobject.DynObject;
-import org.gvsig.tools.task.TaskStatus;
+import org.gvsig.tools.task.SimpleTaskStatus;
 
 
 /**
@@ -93,7 +93,7 @@
      * @return the buffer result of executing the operation
      * @throws BufferOperationException
      */
-    public Buffer execute (TaskStatus status, String name, Buffer buffer, DynObject parameters) throws BufferOperationException;
+    public Buffer execute (SimpleTaskStatus status, String name, Buffer buffer, DynObject parameters) throws BufferOperationException;
 
 
 };
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.api/src/main/java/org/gvsig/raster/lib/buffer/api/operations/OperationList.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.api/src/main/java/org/gvsig/raster/lib/buffer/api/operations/OperationList.java	(revision 43866)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.api/src/main/java/org/gvsig/raster/lib/buffer/api/operations/OperationList.java	(revision 43867)
@@ -30,7 +30,7 @@
 import org.gvsig.tools.observer.WeakReferencingObservable;
 import org.gvsig.tools.persistence.Persistent;
 import org.gvsig.tools.lang.Cloneable;
-import org.gvsig.tools.task.TaskStatus;
+import org.gvsig.tools.task.SimpleTaskStatus;
 
 
 /**
@@ -45,7 +45,7 @@
      * @return the buffer result of executing the operations list in chained fashion
      * @throws BufferOperationException
      */
-    public Buffer execute(TaskStatus status, Buffer buffer) throws BufferOperationException;
+    public Buffer execute(SimpleTaskStatus status, Buffer buffer) throws BufferOperationException;
 
     /**
      * @param operation
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.api/src/main/java/org/gvsig/raster/lib/buffer/api/operations/Operation.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.api/src/main/java/org/gvsig/raster/lib/buffer/api/operations/Operation.java	(revision 43866)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.api/src/main/java/org/gvsig/raster/lib/buffer/api/operations/Operation.java	(revision 43867)
@@ -25,6 +25,7 @@
 import org.gvsig.raster.lib.buffer.api.Buffer;
 import org.gvsig.raster.lib.buffer.api.exceptions.BufferOperationException;
 import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.task.SimpleTaskStatus;
 import org.gvsig.tools.task.TaskStatus;
 
 
@@ -41,7 +42,7 @@
      * @return the buffer result of executing the operation
      * @throws BufferOperationException
      */
-    public Buffer execute(TaskStatus status, Buffer buffer, DynObject parameters) throws BufferOperationException;
+    public Buffer execute(SimpleTaskStatus status, Buffer buffer, DynObject parameters) throws BufferOperationException;
 
     /**
      * @return the factory
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.api/src/main/java/org/gvsig/raster/lib/buffer/api/statistics/Statistics.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.api/src/main/java/org/gvsig/raster/lib/buffer/api/statistics/Statistics.java	(revision 43866)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.api/src/main/java/org/gvsig/raster/lib/buffer/api/statistics/Statistics.java	(revision 43867)
@@ -117,7 +117,6 @@
      * desde el principio del array ordenado y desde el final de él (mínimo y máximo).
      *
      * @param percent Porcentaje de recorte
-     * @param valueByBand array bidimensional de enteros o doubles. Depende del tipo de dato del raster.
      * @return El valor de recorte de colas para el porcentaje dado
      */
     public double[][] getTailTrimValue(double percent);
@@ -129,7 +128,6 @@
      * raster (o una muestra de ellos) y devolver el valor que corresponde al porcentaje comenzando
      * desde el principio del array ordenado y desde el final de él (mínimo y máximo).
      * @param pos posición de recorte
-     * @param valueByBand array bidimensional de enteros o doubles. Depende del tipo de dato del raster.
      * @return el valor de recorte de colas para la posición dada
      */
     public double[][] getTailTrimValue(int pos);
@@ -144,9 +142,6 @@
      * Throws the thread which figure out statistics
      * @param status
      * @param bands
-     * @throws FileNotOpenException
-     * @throws RasterDriverException
-     * @throws ProcessInterruptedException
      */
     public void calculate(SimpleTaskStatus status, List<Band> bands); //¿¿¿ scale ???
 
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.spi/src/main/java/org/gvsig/raster/lib/buffer/spi/operations/AbstractOperation.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.spi/src/main/java/org/gvsig/raster/lib/buffer/spi/operations/AbstractOperation.java	(revision 43866)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.spi/src/main/java/org/gvsig/raster/lib/buffer/spi/operations/AbstractOperation.java	(revision 43867)
@@ -28,7 +28,7 @@
 import org.gvsig.raster.lib.buffer.spi.exceptions.ProcessingOperationException;
 import org.gvsig.tools.ToolsLocator;
 import org.gvsig.tools.dynobject.DynObject;
-import org.gvsig.tools.task.TaskStatus;
+import org.gvsig.tools.task.SimpleTaskStatus;
 import org.gvsig.tools.task.TaskStatusManager;
 
 
@@ -44,7 +44,7 @@
     private DynObject parameters;
     private Buffer outputBuffer;
     private final OperationFactory factory;
-    private TaskStatus taskStatus;
+    private SimpleTaskStatus taskStatus;
 
     private boolean copyUnprocessedBands;
 
@@ -71,11 +71,13 @@
     }
 
     @Override
-    public TaskStatus getTaskStatus() {
+    public SimpleTaskStatus getTaskStatus() {
         if( this.taskStatus==null ) {
             TaskStatusManager taskStatusManager = ToolsLocator.getTaskStatusManager();
             this.taskStatus = taskStatusManager.createDefaultSimpleTaskStatus(
                 this.getFactory().getName());
+            this.taskStatus.setAutoremove(true);
+            this.taskStatus.add();
         }
         return this.taskStatus;
     }
@@ -95,14 +97,23 @@
      * @see org.gvsig.raster.lib.buffer.api.Operation#execute(org.gvsig.raster.lib.buffer.api.Buffer, org.gvsig.tools.dynobject.DynObject)
      */
     @Override
-    public Buffer execute(TaskStatus status, Buffer buffer, DynObject parameters) throws BufferOperationException {
+    public Buffer execute(SimpleTaskStatus status, Buffer buffer, DynObject parameters) throws BufferOperationException {
         this.buffer = buffer;
         this.parameters = parameters;
         this.taskStatus = status;
-        this.preProcess();
-        this.process();
-        this.postProcess();
-        return this.getOutputBuffer();
+        try {
+            this.taskStatus.push();
+            
+            this.preProcess();
+            this.process();
+            this.postProcess();
+            return this.getOutputBuffer();
+        } finally {
+            if( this.taskStatus.isRunning() ) {
+                this.taskStatus.terminate();
+            }
+            this.taskStatus.pop();
+        }
     }
 
     /* (non-Javadoc)
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.spi/src/main/java/org/gvsig/raster/lib/buffer/spi/operations/OperationServices.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.spi/src/main/java/org/gvsig/raster/lib/buffer/spi/operations/OperationServices.java	(revision 43866)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.spi/src/main/java/org/gvsig/raster/lib/buffer/spi/operations/OperationServices.java	(revision 43867)
@@ -26,6 +26,7 @@
 import org.gvsig.raster.lib.buffer.api.exceptions.BufferOperationException;
 import org.gvsig.raster.lib.buffer.api.operations.Operation;
 import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.task.SimpleTaskStatus;
 import org.gvsig.tools.task.TaskStatus;
 
 
@@ -73,5 +74,5 @@
      */
     void postProcess() throws BufferOperationException;
 
-    TaskStatus getTaskStatus();
+    SimpleTaskStatus getTaskStatus();
 }
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.spi/src/main/java/org/gvsig/raster/lib/buffer/spi/operations/AbstractSpecifiedBandsOperation.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.spi/src/main/java/org/gvsig/raster/lib/buffer/spi/operations/AbstractSpecifiedBandsOperation.java	(revision 43866)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.spi/src/main/java/org/gvsig/raster/lib/buffer/spi/operations/AbstractSpecifiedBandsOperation.java	(revision 43867)
@@ -24,7 +24,6 @@
 
 import java.util.ArrayList;
 import java.util.List;
-import org.gvsig.raster.lib.buffer.api.Buffer;
 import org.gvsig.raster.lib.buffer.api.NoData;
 
 import org.gvsig.raster.lib.buffer.api.exceptions.BufferOperationException;
